id
stringlengths
42
42
src_hexsha
stringlengths
40
40
example
stringlengths
80
1.37M
a72511d04644393c55593565f00bc7d41be70a1d-3
a72511d04644393c55593565f00bc7d41be70a1d
PHxmaW1fcHJlZml4fD4KIyBtYXhpbW8gY29tdW4gZGl2aXNvcgoKZGVmIG1jZChtLG4pOgogICAgd2hpbGUgbSVuICE9IDA6CiAgICAgICAgbVZpZWpvID0gbQogICAgICAgIG5WaWVqbyA9IG4KPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgoKICAgICAgICBtID0gblZpZWpvCiAgICAgICAgbiA9IG1WaWVqbyVuVmllam8KICAgIHJldHVybiBuCjx8ZmltX2VuZHw+
a72511d04644393c55593565f00bc7d41be70a1d-4
a72511d04644393c55593565f00bc7d41be70a1d
PHxmaW1fcHJlZml4fD4KCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KIyBtYXhpbW8gY29tdW4gZGl2aXNvcgoKZGVmIG1jZChtLG4pOgogICAgd2hpbGUgbSVuICE9IDA6Cjx8ZmltX2VuZHw+
a72511d04644393c55593565f00bc7d41be70a1d-5
a72511d04644393c55593565f00bc7d41be70a1d
PHxmaW1fcHJlZml4fD4KIyBtYXhpbW8gY29tdW4gZGl2aXNvcgo8fGZpbV9ob2xlfD4KICAgICAgICBuVmllam8gPSBuCgogICAgICAgIG0gPSBuVmllam8KICAgICAgICBuID0gbVZpZWpvJW5WaWVqbwogICAgcmV0dXJuIG4KPHxmaW1fc3VmZml4fD4KCmRlZiBtY2QobSxuKToKICAgIHdoaWxlIG0lbiAhPSAwOgogICAgICAgIG1WaWVqbyA9IG0KPHxmaW1fZW5kfD4=
3c79be24c60dc545b62ba85e3356add6ea5f7d3d-1
3c79be24c60dc545b62ba85e3356add6ea5f7d3d
PHxmaW1fcHJlZml4fD4KaW1wb3J0IGRhdGV0aW1lCgpmcm9tIGRqYW5nby5kYiBpbXBvcnQgbW9kZWxzCgojIENyZWF0ZSB5b3VyIG1vZGVscyBoZXJlLgoKCmNsYXNzIENsaXAobW9kZWxzLk1vZGVsKToKICAgIFRpdGxlID0gbW9kZWxzLkNoYXJGaWVsZChtYXhfbGVuZ3RoPTQwMCkKICAgIENyZWF0ZWRBdCA9IG1vZGVscy5EYXRlVGltZUZpZWxkKCd2aWRlbyBjcmVhdGVkJykKICAgIExlbmd0aEluU2Vjb25kID0gbW9kZWxzLkZsb2F0RmllbGQoKQogICAgVmlld0NvdW50ID0gbW9kZWxzLkludGVnZXJGaWVsZCgpCiAgICBWaWRlb0lkID0gbW9kZWxzLkNoYXJGaWVsZChtYXhfbGVuZ3RoPTEwMCkKCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KICAgIGRlZiBDcmVhdGVkQXRTdHJpbmcoc2VsZik6CiAgICAgICAgcmV0dXJuIChzZWxmLkNyZWF0ZWRBdCArIGRhdGV0aW1lLnRpbWVkZWx0YShob3Vycz05KSkuc3RyZnRpbWUoIiVZLSVtLSVkICVIOiVNOiVTIikKCiAgICBkZWYgX19zdHJfXyhzZWxmKToKPHxmaW1fZW5kfD4=
3c06adebf64d05c744bf8952189598ac0833b3c6-1
3c06adebf64d05c744bf8952189598ac0833b3c6
PHxmaW1fcHJlZml4fD4KZnJvbSAuYmx1ciBpbXBvcnQgKgpmcm9tIC5icmlnaHRuZXNzIGltcG9ydCAqCmZyb20gLmNsaXAgaW1wb3J0ICoKZnJvbSAuY3V0b3V0IGltcG9ydCAqCmZyb20gLmdyYXlzY2FsZSBpbXBvcnQgKgpmcm9tIC5odWUgaW1wb3J0ICoKZnJvbSAuc2F0dXJhdGlvbiBpbXBvcnQgKgpmcm9tIC5zaGFycG5lc3MgaW1wb3J0ICoKZnJvbSAud2FycCBpbXBvcnQgKgo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CmZyb20gLmNvbG9yIGltcG9ydCAqCjx8ZmltX2VuZHw+
af4d0b070e86efe911609bd76a38ead3344a1b6f-1
af4d0b070e86efe911609bd76a38ead3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9CiAgICAgICAgaWYgZGF0YSBpcyBub3QgTm9uZToKICAgICAgICAgICAgZGRhdGEudXBkYXRlKGRhdGEpCgogICAgICAgIG1lc3NhZ2UgPSBmIkNvbnNpc3RlbmN5IGVycm9yIHdoZW4gY2hlY2tpbmcge2luc3RhbmNlLl9fY2xhc3NfX30uXG4iCiAgICAgICAgbWVzc2FnZSArPSBmInt0eXBlKGVycm9yKS5fX25hbWVfX30iCiAgICAgICAgbWVzc2FnZSArPSBmIjpcblx0e2Vycm9yfVxuIiBpZiBzdHIoZXJyb3IpIGVsc2UgIlxuIgogICAgICAgIGlmIGRkYXRhOgogICAgICAgICAgICBtZXNzYWdlICs9ICJEYXRhIHVzZWQgZm9yIGNoZWNrOlxuXHQqICIKICAgICAgICAgICAgbWVzc2FnZSArPSAiXG5cdCogIi5qb2luKFtmIntrZXl9OiB7dmFsfSIgZm9yIGtleSwgdmFsIGluIGRkYXRhLml0ZW1zKCldKQoKICAgICAgICBzdXBlcigpLl9faW5pdF9fKG1lc3NhZ2UpCgogICAgICAgIHNlbGYuZGF0YSA9IGRkYXRhCiAgICAgICAgc2VsZi5pbnN0YW5jZSA9IGluc3RhbmNlCiAgICAgICAgc2VsZi5lcnJvciA9IGVycm9yCjx8ZmltX3N1ZmZpeHw+CgogICAgZGVmIF9faW5pdF9fKAogICAgICAgIHNlbGYsIGVycm9yOiBFeGNlcHRpb24sIGluc3RhbmNlOiBNb2RlbCwgZGF0YTogT3B0aW9uYWxbRGljdFtzdHIsIEFueV1dID0gTm9uZSwKICAgICk6Cjx8ZmltX2VuZHw+
af4d0b070e86efe911609bd76a38ead3344a1b6f-3
af4d0b070e86efe911609bd76a38ead3344a1b6f
PHxmaW1fcHJlZml4fD4KIiIiQ3VzdG9tIGV4Y2VwdGlvbnMgdXNlZCBpbiBFc3ByZXNzb0RCCiIiIgpmcm9tIHR5cGluZyBpbXBvcnQgT3B0aW9uYWwsIERpY3QsIEFueQoKZnJvbSBkamFuZ28uZGIubW9kZWxz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V9pbmZvLnNlY29uZHNfZWxhcHNlZCAtIHNlbGYuY291bnRkb3duX3N0YXJ0X3RpbWUKICAgICAgICBldmVudF9lbGFwc2VkID0gY291bnRkb3duX2VsYXBzZWQgLSBzZWxmLmNvdW50ZG93bl9zZWNvbmRzCiAgICAgICAgaWYgY291bnRkb3duX2VsYXBzZWQgPCBzZWxmLmNvdW50ZG93bl9zZWNvbmRzOgogICAgICAgICAgICBzZWxmLnJlbmRlcl9pZl9uZXcoc3RyKHNlbGYuY291bnRkb3duX3NlY29uZHMgLSBpbnQoY291bnRkb3duX2VsYXBzZWQpKSkKICAgICAgICAgICAgY2FycyA9IHtzZWxmLnBhY2tldF9pbmRleDogQ2FyU3RhdGUoCiAgICAgICAgICAgICAgICBwaHlzaWNzPVBoeXNpY3MoCiAgICAgICAgICAgICAgICAgICAgbG9jYXRpb249c2VsZi5wb3NpdGlvbi50b19nYW1lc3RhdGUoKSwKICAgICAgICAgICAgICAgICAgICByb3RhdGlvbj1zZWxmLnJvdGF0aW9uLnRvX2dhbWVzdGF0ZSgpLAogICAgICAgICAgICAgICAgICAgIHZlbG9jaXR5PVZlY3RvcjNHUygwLCAwLCAwKSwKICAgICAgICAgICAgICAgICAgICBhbmd1bGFyX3ZlbG9jaXR5PVZlY3RvcjNHUygwLCAwLCAwKQogICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgIGJvb3N0X2Ftb3VudD0xMDAKICAgICAgICAgICAgKX0KICAgICAgICAgICAgc2VsZi5nYW1lX2ludGVyZmFjZS5zZXRfZ2FtZV9zdGF0ZShHYW1lU3RhdGUoY2Fycz1jYXJzKSkKICAgICAgICBlbGlmIGNvdW50ZG93bl9lbGFwc2VkIDwgc2VsZi5jb3VudGRvd25fc2Vjb25kcyArIDE6CiAgICAgICAgICAgIHNlbGYuaXNfYm90X3JlbGVhc2VkID0gVHJ1ZQogICAgICAgICAgICBzZWxmLnJlbmRlcl9pZl9uZXcoIkdPIikKICAgICAgICBlbGlmIG5vdC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9yLAogICAgICAgIGdhbWVfaW50ZXJmYWNlOiBHYW1lSW50ZXJmYWNlLAogICAgICAgIGNvdW50ZG93bl9zZWNvbmRzPTMsCiAgICApOgogICAgICAgIHNlbGYucGFja2V0X2luZGV4ID0gcGFja2V0X2luZGV4CiAgICAgICAgc2VsZi5wb3NpdGlvbiA9IHBvc2l0aW9uCiAgICAgICAgc2VsZi5yb3RhdGlvbiA9IHJvdGF0aW9uCiAgICAgICAgc2VsZi5nYW1lX2ludGVyZmFjZSA9IGdhbWVfaW50ZXJmYWNlCiAgICAgICAgc2VsZi5jb3VudGRvd25fc3RhcnRfdGltZTogZmxvYXQgPSBOb25lCiAgICAgICAgc2VsZi5ldmVudF9zdGFydF90aW1lOiBmbG9hdCA9IE5vbmUKICAgICAgICBzZWxmLmlzX2JvdF9yZWxlYXNlZCA9IEZhbHNlCiAgICAgICAgc2VsZi5kb25lX2FuaW1hdGluZyA9IEZhbHNlCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KICAgICAgICBzZWxmLmFscmVhZHlfcmVuZGVyZWQgPSBbXQogICAgICAgIHNlbGYucmVuZGVyX2dyb3VwID0gImNvdW50ZG93biIKICAgICAgICBzZWxmLmNvdW50ZG93bl9zZWNvbmRzID0gY291bnRkb3duX3NlY29uZHMKCjx8ZmltX2VuZHw+
bbdde7fe5b5e69552f5e40fa3b90526dbbb389ee-1
bbdde7fe5b5e69552f5e40fa3b90526dbbb389ee
PHxmaW1fcHJlZml4fD4KaW1wb3J0IHRnYm90CmZyb20gdGdib3QuYm90YXBpIGltcG9ydCBFcnJvciwgRm9yY2VSZXBseQppbXBvcnQgaGFzaGxpYgoKCmNsYXNzIEFkbWluUGx1Z2luKHRnYm90LlRHUGx1Z2luQmFzZSk6CiAgICBkZWYgX19pbml0X18oc2VsZik6CiAgICAgICAgc3VwZXIoQWRtaW5QbHVnaW4sIHNlbGYpLl9faW5pdF9fKCkKICAgICAgICBzZWxmLl9fZGVmYXVsdF9wd2Qg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WRtaW4obWVzc2FnZSkgYW5kIHRleHQ6CiAgICAgICAgICAgIHNlbGYuc2F2ZV9kYXRhKCdBRE1JTlBXRCcsIG9iaj1oYXNobGliLnNoYTI1Nih0ZXh0KS5oZXhkaWdlc3QoKSkKICAgICAgICAgICAgc2VsZi5ib3Quc2VuZF9tZXNzYWdlKG1lc3NhZ2UuY2hhdC5pZCwgJ1Bhc3N3b3JkIHVwZGF0ZWQgdG86XG4nICsgdGV4dCkKCiAgICBkZWYgbGlzdChzZWxmLCBtZXNzYWdlLCBtb2RlbF9jbHMsIHBhZ2U9MSk6CiAgICAgICAgbXNnID0gJycKICAgICAgICBjbnQgPSAwCiAgICAgICAgZm9yIHUgaW4gbW9kZWxfY2xzLnNlbGVjdCgpLnBhZ2luYXRlKHBhZ2UsIDEwKToKICAgICAgICAgICAgY250ICs9IDEKCiAgICAgICAgICAgIG5pZCA9IHUuaWQKICAgICAgICAgICAgaWYgbmlkIDwgMDoKICAgICAgICAgICAgICAgIG5pZCA9ICdOJyArIHN0cihuaWQgKiAtMSkgICMgbXVjaCBmYXN0ZXIgdGhhbiBhYnMuLgoKICAgICAgICAgICAgaWYgbW9kZWxfY2xzID09IHNlbGYuYm90Lm1vZGVscy5Vc2VyOgogICAgICAgICAgICAgICAgbXNnICs9ICcvbXNnJXMgLSAlcyAlc1xuJyAlICgKICAgICAgICAgICAgICAgICAgICBuaWQsCiAgICAgICAgICAgICAgICAgICAgdS5maXJzdF9uYW1lLAogICAgICAgICAgICAgICAgICAgIHUubGFzdF9uYW1lLAogICAgICAgICAgICAgICAgKQogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgbXNnICs9ICcvbXNnJXMgLSAlc1xuJyAlICgKICAgICAgICAgICAgICAgICAgICBuaWQsCiAgICAgICAgICAgICAgICAgICAgdS50aXRsZSwKICAgICAgICAgICAgICAgICkKCiAgICAgICAgaWYgY250ID09IDEwOgogICAgICAgICAgICBtc2cgKz0gJ1RoZXJlIGFyZSBtb3JlL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1oYXNobGliLnNoYTI1Nih0ZXh0KS5oZXhkaWdlc3QoKSkKICAgICAgICAgICAgc2VsZi5ib3Quc2VuZF9tZXNzYWdlKG1lc3NhZ2UuY2hhdC5pZCwgJ1Bhc3N3b3JkIHVwZGF0ZWQgdG86XG4nICsgdGV4dCkKCiAgICBkZWYgbGlzdChzZWxmLCBtZXNzYWdlLCBtb2RlbF9jbHMsIHBhZ2U9MSk6CiAgICAgICAgbXNnID0gJycKICAgICAgICBjbnQgPSAwCjx8ZmltX2hvbGV8PgogICAgICAgICAgICBpZiBuaWQgPCAwOgogICAgICAgICAgICAgICAgbmlkID0gJ04nICsgc3RyKG5pZCAqIC0xKSAgIyBtdWNoIGZhc3RlciB0aGFuIGFicy4uCgogICAgICAgICAgICBpZiBtb2RlbF9jbHMgPT0gc2VsZi5ib3QubW9kZWxzLlVzZXI6CiAgICAgICAgICAgICAgICBtc2cgKz0gJy9tc2clcyAtICVzICVzXG4nICUgKAogICAgICAgICAgICAgICAgICAgIG5pZCwKICAgICAgICAgICAgICAgICAgICB1LmZpcnN0X25hbWUsCiAgICAgICAgICAgICAgICAgICAgdS5sYXN0X25hbWUsCiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBtc2cgKz0gJy9tc2clcyAtICVzXG4nICUgKAogICAgICAgICAgICAgICAgICAgIG5pZCwKICAgICAgICAgICAgICAgICAgICB1LnRpdGxlLAogICAgICAgICAgICAgICAgKQoKICAgICAgICBpZiBjbnQgPT0gMTA6CiAgICAgICAgICAgIG1zZyArPSAnVGhlcmUgYXJlIG1vcmUsIHR5cGUgL21vcmUgdG8gbGlzdCAxMCBtb3JlIHJlc3VsdHMnCiAgICAgICAgICAgIHNlbGYuc2F2ZV9kYXRhKG1lc3NhZ2UuY2hhdC5pZCwgb2JqPXsnbW9yZSc6IG1vZGVsX2Nscy5fX25hbWVfXywgJ3BhZ2UnOiBwYWdlfSkKICAgICAgICBlbGlmIGNudCA9PSA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lLmNoYXQuaWQsIHUnV2VsY29tZSBcVTAwMDFGNjBGJykKCiAgICBkZWYgbmV3cGFzcyhzZWxmLCBtZXNzYWdlLCB0ZXh0KToKICAgICAgICBpZiBzZWxmLl9faXNfYWRtaW4obWVzc2FnZSkgYW5kIHRleHQ6CiAgICAgICAgICAgIHNlbGYuc2F2ZV9kYXRhKCdBRE1JTlBXRCcsIG9iaj1oYXNobGliLnNoYTI1Nih0ZXh0KS5oZXhkaWdlc3QoKSkKICAgICAgICAgICAgc2VsZi5ib3Quc2VuZF9tZXNzYWdlKG1lc3NhZ2UuY2hhdC5pZCwgJ1Bhc3N3b3JkIHVwZGF0ZWQgdG86XG4nICsgdGV4dCkKCiAgICBkZWYgbGlzdChzZWxmLCBtZXNzYWdlLCBtb2RlbF9jbHMsIHBhZ2U9MSk6CiAgICAgICAgbXNnID0gJycKICAgICAgICBjbnQgPSAwCiAgICAgICAgZm9yIHUgaW4gbW9kZWxfY2xzLnNlbGVjdCgpLnBhZ2luYXRlKHBhZ2UsIDEwKToKICAgICAgICAgICAgY250ICs9IDEKCiAgICAgICAgICAgIG5pZCA9IHUuaWQKICAgICAgICAgICAgaWYgbmlkIDwgMDoKICAgICAgICAgICAgICAgIG5pZCA9ICdOJyArIHN0cihuaWQgKiAtMSkgICMgbXVjaCBmYXN0ZXIgdGhhbiBhYnMuLgoKICAgICAgICAgICAgaWYgbW9kZWxfY2xzID09IHNlbGYuYm90Lm1vZGVscy5Vc2VyOgogICAgICAgICAgICAgICAgbXNnICs9ICcvbXNnJXMgLSAlcyAlc1xuJyAlICgKICAgICAgICAgICAgICAgICAgICBuaWQsCiAgICAgICAgICAgICAgICAgICAgdS5maXJzdF9uYW1lLAogICAgICAgICAgICAgICAgICAgIHUubGFzdF9uYW1lLAogICAgICAgICAgICAgICAgKQogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgbXNnICs9ICcvbXNnJXMgLSAlc1xuJyAlICgKICAgICAgICAgICAgICAgICAgICBuaWQs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IHJldHVybgoKICAgICAgICBpZiB0ZXh0ID09ICcnOgogICAgICAgICAgICBzZWxmLmJvdC5zZW5kX21lc3NhZ2UobWVzc2FnZS5jaGF0LmlkLCAnVXNlIC91c2VycyBvciAvY2hhdHMgdG8gbGlzdCBhdmFpbGFibGUgaWRzJykKICAgICAgICAgICAgcmV0dXJuCgogICAgICAgIHAgPSB0ZXh0LmZpbmQoJyAnKQogICAgICAgIGlmIHAgPCAwOgogICAgICAgICAgICBzZWxmLnNhdmVfZGF0YShtZXNzYWdlLmNoYXQuaWQsIGtleTI9J21zZycsIG9iaj10ZXh0KQogICAgICAgICAgICBtID0gc2VsZi5ib3Quc2VuZF9tZXNzYWdlKAogICAgICAgICAgICAgICAgbWVzc2FnZS5jaGF0LmlkLAogICAgICAgICAgICAgICAgJ0FuZCBzYXkgd2hhdD8nLAogICAgICAgICAgICAgICAgcmVwbHlfdG9fbWVzc2FnZV9pZD1tZXNzYWdlLm1lc3NhZ2VfaWQsCiAgICAgICAgICAgICAgICByZXBseV9tYXJrdXA9Rm9yY2VSZXBseS5jcmVhdGUoc2VsZWN0aXZlPVRydWUpCiAgICAgICAgICAgICkud2FpdCgpCiAgICAgICAgICAgIHNlbGYubmVlZF9yZXBseShzZWxmLmZvcndhcmRfbWVzc2FnZSwgbWVzc2FnZSwgb3V0X21lc3NhZ2U9bSwgc2VsZWN0aXZlPVRydWUpCiAgICAgICAgICAgIHJldHVybgoKICAgICAgICBjaWQgPSB0ZXh0WzpwXQogICAgICAgIG1zZyA9IHRleHRbcCArIDE6XQoKICAgICAgICBzZWxmLmZvcndhcmRfbWVzc2FnZShtZXNzYWdlLCBtc2csIGRzdD1jaWQpCgogICAgZGVmIGZvcndhcmRfbWVzc2FnZShzZWxmLCBtZXNzYWdlLCBtc2csIGRzdD1Ob25lKToKICAgICAgICBpZiBkc3QgaXMgTm9uZToKICAgICAgICAgICAgZHN0ID0gc2VsZi5yZWFkX2RhdGEobWVzc2FnZS5jaGF0LmlkLCBrZX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ICAgICAgICAgICAgdS5maXJzdF9uYW1lLAogICAgICAgICAgICAgICAgICAgIHUubGFzdF9uYW1lLAogICAgICAgICAgICAgICAgKQogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgbXNnICs9ICcvbXNnJXMgLSAlc1xuJyAlICgKICAgICAgICAgICAgICAgICAgICBuaWQsCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KICAgICAgICAgICAgICAgICAgICB1LnRpdGxlLAo8fGZpbV9lbmR8Pg==
59c19e713f020343d2809430f23f3fc5cceae20c-1
59c19e713f020343d2809430f23f3fc5cceae20c
PHxmaW1fcHJlZml4fD4KZnJvbSBmbGFza19qd3RfZXh0ZW5kZWQgaW1wb3J0IGdldF9qd3RfaWRlbnRpdHkKZnJvbSBmbGFza19yZXN0ZnVsIGltcG9ydCBSZXNvdXJjZSwgZmllbGRzLCBtYXJzaGFsLCByZXF1ZXN0CmZyb20gYXBwLmRiIGltcG9ydCBkYiwgU2NoZWR1bGVNb2RlbCwgVXNlck1vZGVsLCBDb3Vyc2VTdWJzTW9kZWwKZnJvbSBhcHAucmVzb3VyY2UgaW1wb3J0IGp3dF90b2tlbl9yZXF1aXJlZF9jdXN0b20sIGpzb25HZXQsIG1lc3NhZ2UKZnJvbSBzcWxhbGNoZW15IGltcG9ydCBhbmRfLCBvcl8KCmNvdXJzZV9zY2hlZHVsZV9maWVsZHMgPSB7CiAgICAnaWQnIDogZmllbGRzLkludGVnZXIsCiAgICAndGl0dWxvJyA6IGZpZWxkcy5TdHJpbmcoYXR0cmlidXRlPWxhbWJkYSBvOiBvLmNvdXJzZS50aXR1bG8pLAogICAgJ2Rlc2NyaWNhbycgOiBmaWVsZHMuU3RyaW5nKGF0dHJpYnV0ZT1sYW1iZGEgbzogby5jb3Vyc2UuY29udGV1ZG8pLAogICAgJ21pbmlzdHJhbnRlJyA6IGZpZWxkcy5TdHJpbmcoYXR0cmlidXRlPWxhbWJkYSBvOiBvLmNvdXJzZS5zcG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gZmxhbWJkYShOb25lKQogICAgICAgICAgICByZXR1cm4gJ07Do28gZSBwb3NzaXZlbCBjYWRhc3RyYXIgZW0gbWluaWN1cnNvcyBkZSBtZXNtbyBob3JhcmlvIScKICAgICAgICBlbHNlOgogICAgICAgICAgICBjb3Vyc2UgPSBTY2hlZHVsZU1vZGVsLnF1ZXJ5LmZpbHRlcihhbmRfKAogICAgICAgICAgICAgICAgU2NoZWR1bGVNb2RlbC5jb3Vyc2VfaWQuaXNub3QoTm9uZSksCiAgICAgICAgICAgICAgICBTY2hlZHVsZU1vZGVsLmlkID09IGNvdXJzZV9pZAogICAgICAgICAgICApKS5maXJzdCgpCiAgICAgICAgICAgIGlmIG5vdCBjb3Vyc2U6CiAgICAgICAgICAgICAgICByZXR1cm4gJ01pbmljdXJzbyBzZWxlY2lvbmFkbyBuw6NvIGVuY29udHJhZG8uJwogICAgICAgICAgICBpZiBjb3Vyc2UudmFjUmVtYWluaW5nKCkgPiAwOgo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CiAgICAgICAgICAgICAgICBmbGFtYmRhKGNvdXJzZS5pZCkKICAgICAgICAgICAgICAgIHJldHVybiAnVmFnYSByZXNlcnZhZGEgY29tIHN1Y2Vzc28hJwo8fGZpbV9lbmR8Pg==
abd2448b0f2e2a359cd36ad35b6ddca80df14634-1
abd2448b0f2e2a359cd36ad35b6ddca80df14634
PHxmaW1fcHJlZml4fD4KaW1wb3J0IHJhbmRvbQppbXBvcnQgc3RyaW5nCgpmcm9tIGRhdGV1dGlsLnBhcnNlciBpbXBvcnQgcGFyc2UKCmZyb20gZGphbmdvLmNvbmYgaW1wb3J0IHNldHRpbmdzCmZyb20gZGphbmdvLmNvbnRyaWIuYXV0aC5oYXNoZXJzIGltcG9ydCBtYWtlX3Bhc3N3b3JkCmZyb20gZGphbmdvLmNvbnRyaWIuYXV0aC5tb2RlbHMgaW1wb3J0IFVzZXIKCmltcG9ydCByZXF1ZXN0cwoKCmNsYXNzIEZha2VVc2VyR2VuZXJhdG9yOgogICAgZGVmIF9faW5pdF9fKHNlbGYsIHVzZXJfY291bnQpOgogICAgICAgIHNlbGYudXNlcl9jb3VudCA9IHVzZXJfY291bnQKCiAgICBkZWYgcmVxdWVzdF9kYXRhKHNlbGYpOgogICAgICAgIHJldHVybiByZXF1ZXN0cy5nZXQoCiAgICAgICAgICAgICdodHRwczovL3JhbmRvbXVzZXIubWUvYXBpLz9yZXN1bHRzPXswfScuZm9ybWF0KAogICAgICAgICAgICAgICAgc2VsZi51c2VyX2NvdW50KSkuanNvbigpCgogICAgZGVmIGdldF9yYW5kb21fdXNlcl9kYXRhKHNlbGYpOgogICAgICAgICIiIkFkYXB0IHRoZSBkYXRhIHRoYXQgY2FtZSBmcm9tIHRoZSBBUEkgdG8gYmUgcmVhZHkgdG8gY3JlYXRlIGBVc2VyYAogICAgICAgIG9iamVjdHMKICAgICAgICAiIiIKICAgICAgICBqc29uID0gc2VsZi5yZXF1ZXN0X2RhdGEoKVsncmVzdWx0cyddCiAgICAgICAgcmV0dXJuIFt7CiAgICAgICAgICAgICd1c2VybmFtZSc6IHVbJ2xvZ2luJ11bJ3VzZXJuYW1lJ10sCiAgICAgICAgICAgICdwYXNzd29yZCc6IG1ha2VfcGFzc3dvcmQodVsnbG9naW4nXVsncGFzc3dvcmQnXSksCiAgICAgICAgICAgICdlbWFpbCc6IHVbJ2VtYWlsJ10sCiAgICAgICAgICAgICdmaXJzdF9uYW1lJzogdVsnbmFtZSddWydmaXJzdCddLAogICAgICAgICAgICAnbGFzdF9uYW1lJzogdVsnbmFtZSddWydsYXN0J10sCiAgICAgICAgICAgICdkYXRlX2pvaW5lZCc6IHBhcnNlKHVbJ3JlZ2lzdGVyZWQnXSArICdVVEMnKSwKICAgICAgICB9IGZvciB1IGluIGpzb25dCgogICAgZGVmIGNyZWF0ZV91c2VycyhzZWxmKToKICAgICAgICB1c2Vyc19kYXRhID0gc2VsZi5nZXRfcmFuZG9tX3VzZXJfZGF0YSg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ICAgICAgICBhc3NlcnQgcmVzdWx0X2RpY3RbInJvd3MiXVsyXSA9PSAicm93MiIKCiAgICBkZWYgdGVzdF9vdXRwdXRfcnVuX21ldGEoc2VsZiwgbW9ja2VyKToKICAgICAgICByZXNwb25zZSA9IHNlbGYuY2xpZW50LmdldCgiL3J1bi8lZC9tZXRhIiAlIChzZWxmLnJ1bl9pZCArIDEpKQogICAgICAgIGFzc2VydCByZXNwb25zZS5zdGF0dXNfY29kZSA9PSA0MDQKICAgICAgICBhc3NlcnQgcmVzcG9uc2UuZGF0YSA9PSBiIk5vIHN1Y2ggcXVlcnkgcnVuIGlkIgoKICAgICAgICAjIE1vY2sgb3V0IGpzb24uZHVtcHMgYmVjYXVzZSBqc29uIGNob2tlcyBvbiB0aGUKICAgICAgICAjICBvYmplY3RzIHdlJ3JlIGdldHRpbmcgZnJvbSBtb2NrX2FsY2hlbXkKICAgICAgICBtb2NrZXIucGF0Y2goImpzb24uZHVtcHMiKQoKICAgICAgICByZXNwb25zZSA9IHNlbGYuY2xpZW50LmdldCgiL3J1bi8lZC9tZXRhIiAlIHNlbGYucnVuX2lkKQogICAgICAgIGFzc2VydCByZXNwb25zZS5zdGF0dXNfY29kZSA9PSAyMDAKPHxmaW1fc3VmZml4fD4KICAgICAgICAgICAgcmV2PXIsCjx8ZmltX2VuZHw+
afc80830c7b92932f3659067fa2e217b92ec8874-1
afc80830c7b92932f3659067fa2e217b92ec8874
PHxmaW1fcHJlZml4fD4KIiIiCgogIEdUZXN0IGFuZCBiZW5jaG1hcmsgZ2VuZXJhdG9yIHRvIHZhbGlkYXRlIGdlbmVyYXRlZCBrZXJuZWxzIGZyb20gZGlvc3B5cm9zCiAgdG9vbCBhZ2FpbiBzcGVjaWZpY2F0aW9uCgogIFRoaXMgc2NyaXB0IGdlbmVyYXRlcyB0aGUgY29kZSBmb3IgdGhlIG1haW4gYmVuY2htYXJrIGJpbmFyeSBhbmQgR1Rlc3QgYnkKICBzdGljaGluZyB0b2dldGhlciB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2lkKToKICAgICAgICBhbnRpY2lwYXRlZF9yaXNrID0gMC4yCjx8ZmltX2VuZHw+
a5b00f687cbfad595da88d7fc8dea63c587a3523-2
a5b00f687cbfad595da88d7fc8dea63c587a3523
PHxmaW1fcHJlZml4fD4KZnJvbSBkYXRldGltZSBpbXBvcnQgZGF0ZQo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CmZyb20gdHlwaW5nIGltcG9ydCBEaWN0CgpjbGFzcyBHb29kc0Rhb01vY2s6Cgo8fGZpbV9lbmR8Pg==
a5b00f687cbfad595da88d7fc8dea63c587a3523-3
a5b00f687cbfad595da88d7fc8dea63c587a3523
PHxmaW1fcHJlZml4fD4KZnJvbSBkYXRldGltZSBpbXBvcnQgZGF0ZQpmcm9tIHR5cGluZyBpbXBvcnQgRGljdAoKY2xhc3MgR29vZHNEYW9Nb2NrOgoKICAgICMgIOiOt+WPlklOReWOn+ayueacn+i0p+eahOaUtuebmOS7t+WSjOaIkOS6pOmHjwogICAgZGVmIGdldF9mdXR1cmVfcHJpY2VfYW5kX2Ftb3VudChzZWxmLCBkOiBkYXRlKToKICAgICAgICByZXR1cm4gNTAuMywgMTAwMDAuMAoKICAgICMgIOiOt+WPlumFjee9ruaXtui/lOWbnueahHfmlbDnu4TvvIzljbPljp/msrnmnJ/otKflkoznjrDotKfliIbliKvkubDlpJrlsJEsIOS7peWPiueUqOaIt+mihOacn+mjjumZqQogICAgIyAg6ICM5LiL6Z2i55qEZ2V0X2dvb2RzX3dlaWdodOi/lOWbnui/meS4pOS4queahOavlOS+i++8jOWNsyA0IC8gMTEg5ZKMIDcgLyAxMQo8fGZpbV9ob2xlfD4KICAgICMgIOiOt+WPluWVhuWTgeaUtuebmOS7tyhuYW1l6Zmk5LqG5Y6f5rK55pyf6LSn5ZKM546w6LSnKOi/meS4qm5hbWXku6XkvaDku6zlrZjmlbDmja7lupPnmoTlkI3np7DkuLrlh4bvvIzot59nZXRfYnV5X3ByaWNl6I635Y+W5L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TAsIDUwMCksCiAgICAgICAgICAgICAgICAgICAgICAibWF4X2RlcHRoIjogKDUsIDEwMCksCiAgICAgICAgICAgICAgICAgICAgICAibWluX3NhbXBsZXNfc3BsaXQiOiAoMiwgMTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJtaW5fc2FtcGxlc19sZWFmIjogKDIsIDUwKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3Rpb24sIHBhcmFtZXRlcnMKCiAgICAjIC0tLS0tIHhnYm9vc3QgY2xhc3NpZmllciAtLS0tLQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfaW5pdF9YR0JDbGFzc2lmaWVyKHBhcmFtcywgb2JqZWN0aXZlPSdiaW5hcnk6bG9naXN0aWMnLCAqKmt3YXJncyk6CiAgICAgICAgcmV0dXJuIFhHQkNsYXNzaWZpZXIoCiAgICAgICAgICAgIG9iamVjdGl2ZT1vYmplY3RpdmUsCiAgICAgICAgICAgIGxlYXJuaW5nX3JhdGU9bWF4KHBhcmFtc1snZXRhJ10sIDApLAogICAgICAgICAgICBnYW1tYT1tYXgocGFyYW1zWydnYW1tYSddLCAwKSwKICAgICAgICAgICAgbWF4X2RlcHRoPWludChtYXgocGFyYW1zWydtYXhfZGVwdGgnXSwgMSkpLAogICAgICAgICAgICBuX2VzdGltYXRvcnM9aW50KG1heChwYXJhbXNbJ25fZXN0aW1hdG9ycyddLCAxKSksCiAgICAgICAgICAgIG1pbl9jaGlsZF93ZWlnaHQ9aW50KG1heChwYXJhbXNbJ21pbl9jaGlsZF93ZWlnaHQnXSwgMSkpLAogICAgICAgICAgICBzZWVkPTQyLAogICAgICAgICAgICBudGhyZWFkPS0xKQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfb3B0aW1pemVfWEdCQ2xhc3NpZmllcihYLCB5LCBjdl9zcGxpdHM9NSwgc2NvcmluZz0ncm9jX2F1YycsIG5fam9icz0tMSwgKiprd2FyZ3MpOgogICAgICAgIGRlZiBjdl9mdW5jdGlvbihldGEsIGdhbW1hLCBtYXhfZGVwdGgsIG5fZXN0aW1hdG9ycywgbWluX2NoaWxkX3dlaWdodCk6CiAgICAgICAgICAgIHBhcmFtcyA9IHsnZXRhJzogZXRhLCAnZ2FtbWEnOiBnYW1tYSwgJ21heF9kZXB0aCc6IG1heF9kZXB0aCwgJ25fZXN0aW1hdG9ycyc6IG5fZXN0aW1hdG9ycywKICAgICAgICAgICAgICAgICAgICAgICdtaW5fY2hpbGRfd2VpZ2h0JzogbWluX2NoaWxkX3dlaWdodH0KICAgICAgICAgICAgcmV0dXJuIGNyb3NzX3ZhbF9zY29yZShCZXN0TW9kZWwuX2luaXRfWEdCQ2xhc3NpZmllcihwYXJhbXMsICoqa3dhcmdzKSwgWD1YLCB5PXksIGN2PWN2X3NwbGl0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29yaW5nPXNjb3JpbmcsIG5fam9icz1uX2pvYnMpLm1lYW4oKQoKICAgICAgICBwYXJhbWV0ZXJzID0geyJldGEiOiAoMC4wMDEsIDAuNCksCiAgICAgICAgICAgICAgICAgICAgICAiZ2FtbWEiOiAoMCwgMTUpLAogICAgICAgICAgICAgICAgICAgICAgIm1heF9kZXB0aCI6ICgxLCAxMDApLAogICAgICAgICAgICAgICAgICAgICAgIm5fZXN0aW1hdG9ycyI6ICgxLCA1MDApLAogICAgICAgICAgICAgICAgICAgICAgIm1pbl9jaGlsZF93ZWlnaHQiOiAoMSwgMjApfQogICAgICAgIHJldHVybiBjdl9mdW5jdGlvbiwgcGFyYW1ldGVycwoKICAgICMgLS0tLS0geGdib29zdCByZWdyZXNzb3IgLS0tLS0gIwoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfaW5pdF9YR0JSZWdyZXNzb3IocGFyYW1zLCBvYmplY3RpdmU9J3JlZzpzcXVhcmVkZXJyb3InLCAqKmt3YXJncyk6CiAgICAgICAgcmV0dXJuIFhHQlJlZ3Jlc3NvcigKICAgICAgICAgICAgb2Jq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gICAgICAgICAgICAgICAgICAgICBzY29yaW5nPXNjb3JpbmcsIG5fam9icz1uX2pvYnMpLm1lYW4oKQoKICAgICAgICBwYXJhbWV0ZXJzID0geyJldGEiOiAoMC4wMDEsIDAuNCksCiAgICAgICAgICAgICAgICAgICAgICAiZ2FtbWEiOiAoMCwgMTUpLAogICAgICAgICAgICAgICAgICAgICAgIm1heF9kZXB0aCI6ICgxLCAxMDApLAogICAgICAgICAgICAgICAgICAgICAgIm5fZXN0aW1hdG9ycyI6ICgxLCA1MDApLAogICAgICAgICAgICAgICAgICAgICAgIm1pbl9jaGlsZF93ZWlnaHQiOiAoMSwgMjApfQogICAgICAgIHJldHVybiBjdl9mdW5jdGlvbiwgcGFyYW1ldGVycwoKICAgICMgLS0tLS0gbGFzc28gLS0tLS0gIwoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfaW5pdF9MYXNzbyhwYXJhbXMsICoqa3dhcmdzKToKICAgICAgICBpZiBwYXJhbXNbJ2FscGhhJ10gPCAwLjI1OgogICAgICAgICAgICByZXR1cm4gTGluZWFyUmVncmVzc2lvbihuX2pvYnM9LTEpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgcmV0dXJuIExhc3NvKGFscGhhPW1heChwYXJhbXNbJ2FscGhhJ10sIDAuMjUpKQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfb3B0aW1pemVfTGFzc28oWCwgeSwgY3Zfc3BsaXRzPTUsIHNjb3Jpbmc9J25lZ19tZWFuX3NxdWFyZWRfZXJyb3InLCBuX2pvYnM9LTEsICoqa3dhcmdzKToKICAgICAgICBkZWYgY3ZfZnVuY3Rpb24oYWxwaGEpOgogICAgICAgICAgICBwYXJhbXMgPSB7J2FscGhhJzogYWxwaGF9CiAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUoQmVzdE1vZGVsLl9pbml0X0xhc3NvKHBhcmFtcywgKiprd2FyZ3MpLCBYPVgsIHk9eSwgY3Y9Y3Zfc3Bs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ZGVmIF9pbml0X05DQUtOTihwYXJhbXMsIG5fbmVpZ2hib3JzPS0xLCBtYXhfaXRlcj0xMDAsICoqa3dhcmdzKToKICAgICAgICBwcmludChuX25laWdoYm9ycywgbWF4X2l0ZXIsIGt3YXJncykKICAgICAgICByZXR1cm4gTkNBS05OKAogICAgICAgICAgICBtYXhfaXRlcj1tYXhfaXRlciwKICAgICAgICAgICAgbl9uZWlnaGJvcnM9bl9uZWlnaGJvcnMsCiAgICAgICAgICAgIG5fY29tcG9uZW50cz1pbnQobWF4KHBhcmFtc1snbl9jb21wb25lbnRzJ10sIDIpKSwKICAgICAgICAgICAgbl9qb2JzPS0xKQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfb3B0aW1pemVfTkNBS05OKFgsIHksIGN2X3NwbGl0cz01LCBzY29yaW5nPSdyb2NfYXVjJywgbl9qb2JzPS0xLCAqKmt3YXJncyk6CiAgICAgICAgZGVmIGN2X2Z1bmN0aW9uKG5fY29tcG9uZW50cyk6CiAgICAgICAgICAgIHBhcmFtcyA9IHsnbl9jb21wb25lbnRzJzogbl9jb21wb25lbnRzfQogICAgICAgICAgICBuY2Frbm4gPSBCZXN0TW9kZWwuX2luaXRfTkNBS05OKHBhcmFtcywgKiprd2FyZ3MpCiAgICAgICAgICAgIFhfdHJhaW4sIFhfdGVzdCwgeV90cmFpbiwgeV90ZXN0ID0gdHJhaW5fdGVzdF9zcGxpdChYLCB5LCB0ZXN0X3NpemU9MC41LCByYW5kb21fc3RhdGU9NDIpCiAgICAgICAgICAgIG5jYWtubi5maXQoWF90cmFpbiwgeV90cmFpbikKICAgICAgICAgICAgWF90ZXN0X2ZpdHRlZCA9IG5jYWtubi50cmFuc2Zvcm0oWF90ZXN0KQogICAgICAgICAgICBpZiBuY2Frbm4uZmluZF9rOgogICAgICAgICAgICAgICAgc2NvcmVzID0gW10KICAgICAgICAgICAgICAgIGZvciBrIGluIE5DQUtOTi5saXN0X29mX2tzKGxlbihYX3Rlc3QpKToKICAgICAgICAgICAgICAgICAgICBuY2Frbm4ua25uLm5fbmVpZ2hib3JzID0gawogICAgICAgICAgICAgICAgICAgIHNjb3Jlcy5hcHBlbmQoY3Jvc3NfdmFsX3Njb3JlKG5jYWtubi5rbm4sIFg9WF90ZXN0X2ZpdHRlZCwgeT15X3Rlc3QsIGN2PWN2X3NwbGl0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkpCiAgICAgICAgICAgICAgICByZXR1cm4gbnAubWF4KHNjb3JlcykKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUobmNha25uLmtubiwgWD1YX3Rlc3RfZml0dGVkLCB5PXlfdGVzdCwgY3Y9Y3Zfc3BsaXRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29yaW5nPXNjb3JpbmcsIG5fam9icz1uX2pvYnMpLm1lYW4oKQogICAgICAgIHBhcmFtZXRlcnMgPSB7Im5fY29tcG9uZW50cyI6ICgyLCBtaW4oWC5zaGFwZVsxXSwgNTAwKSl9CiAgICAgICAgcmV0dXJuIGN2X2Z1bmN0aW9uLCBwYXJhbWV0ZXJzCgogICAgIyAtLS0tLSBtbGtya25uIC0tLS0tCgogICAgQHN0YXRpY21ldGhvZAogICAgZGVmIF9pbml0X01MS1JLTk4ocGFyYW1zLCBuX25laWdoYm9ycz0tMSwgbWF4X2l0ZXI9MTAwMCwgKiprd2FyZ3MpOgogICAgICAgIHJldHVybiBNTEtSS05OKAogICAgICAgICAgICBtYXhfaXRlcj1tYXhfaXRlciwKICAgICAgICAgICAgbl9uZWlnaGJvcnM9bl9uZWlnaGJvcnMsCiAgICAgICAgICAgIG5fY29tcG9uZW50cz1pbnQobWF4KHBhcmFtc1snbl9jb21wb25lbnRzJ10sIDIpKSwKICAgICAgICAgICAgbl9qb2JzPS0xKQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfb3B0aW1pemVfTUxLUktOTihYLCB5LCBjdl9zcGxpdHM9NSwgc2NvcmluZz0nbmVnX21lYW5fc3F1YXJlZF9lcnJvcicsIG5fam9icz0tMSwgKiprd2FyZ3MpOgogICAgICAgIGRlZiBjdl9mdW5jdGlvbihuX2NvbXBvbmVudHMpOgogICAgICAgICAgICBwYXJhbXMgPSB7J25fY29tcG9uZW50cyc6IG5fY29tcG9uZW50c30KICAgICAgICAgICAgbWxrcmtubiA9IEJlc3RNb2RlbC5faW5pdF9NTEtSS05OKHBhcmFtcywgKiprd2FyZ3MpCiAgICAgICAgICAgIFhfdHJhaW4sIFhfdGVzdCwgeV90cmFpbiwgeV90ZXN0ID0gdHJhaW5fdGVzdF9zcGxpdChYLCB5LCB0ZXN0X3NpemU9MC41LCByYW5kb21fc3RhdGU9NDIpCiAgICAgICAgICAgIG1sa3Jrbm4uZml0KFhfdHJhaW4sIHlfdHJhaW4pCiAgICAgICAgICAgIFhfdGVzdF9maXR0ZWQgPSBtbGtya25uLnRyYW5zZm9ybShYX3Rlc3QpCiAgICAgICAgICAgIGlmIG1sa3Jrbm4uZmluZF9rOgogICAgICAgICAgICAgICAgc2NvcmVzID0gW10KICAgICAgICAgICAgICAgIGZvciBrIGluIE1MS1JLTk4ubGlzdF9vZl9rcyhsZW4oWF90ZXN0KSk6CiAgICAgICAgICAgICAgICAgICAgbWxrcmtubi5rbm4ubl9uZWlnaGJvcnMgPSBrCiAgICAgICAgICAgICAgICAgICAgc2NvcmVzLmFwcGVuZChjcm9zc192YWxfc2NvcmUobWxrcmtubi5rbm4sIFg9WF90ZXN0X2ZpdHRlZCwgeT15X3Rlc3QsIGN2PWN2X3NwbGl0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29yaW5nPXNjb3JpbmcsIG5fam9icz1uX2pvYnMpLm1lYW4oKSkKICAgICAgICAgICAgICAgIHJldHVybiBucC5tYXgoc2NvcmVzKQogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgcmV0dXJuIGNyb3NzX3ZhbF9zY29yZShtbGtya25uLmtubiwgWD1YX3Rlc3RfZml0dGVkLCB5PXlfdGVzdCwgY3Y9Y3Zfc3BsaXRzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29yaW5nPXNjb3JpbmcsIG5fam9icz1uX2pvYnMpLm1lYW4oKQoKICAgICAgICBwYXJhbWV0ZXJzID0geyJuX2NvbXBvbmVudHMiOiAoMiwgbWluKFguc2hhcGVbMV0sIDUwMCkpfQogICAgICAgIHJldHVybiBjdl9mdW5jdGlvbiwgcGFyYW1ldGVycwoKICAgICMgLS0tLS0tLS0tLS0tLS0gc2tsZWFybiBBUEkgZnVuY3Rpb25zIC0tLS0tLS0tLS0tLS0tICMKCiAgICBkZWYgZml0KHNlbGYsIFgsIHksIGN2X3NwbGl0cz01LCBzY29yaW5nPSdyb2NfYXVjJywgbl9qb2JzPS0xKToKICAgICAgICBpZiBzZWxmLl9tb2RlbF9zdHIgaW4gKCdjbGFzc2lmaWVyJywgJ3JlZ3Jlc3NvcicpOgogICAgICAgICAgICBtb2RlbHNfdG9fY2hlY2sgPSAoJ3hnYm9vc3QnLCAncmZjJywgJ2xyJykgaWYgc2VsZi5fbW9kZWxfc3RyID09ICdjbGFzc2lmaWVyJyBlbHNlICgKICAgICAgICAgICAgICAgICd4Z2JyZWcnLCAncmZyJywgJ2xhc3NvJykKICAgICAgICAgICAgYmVzdF9tb2RlbCwgYmVzdF9zY29yZSwgYmVzdF9wYXJhbXMgPSBOb25lLCBOb25lLCBOb25lCiAgICAgICAgICAgIGZvciBtb2RlbF9zdHIgaW4gbW9kZWxzX3RvX2NoZWNrOgogICAgICAgICAgICAgICAgaWYobW9kZWxfc3RyID09ICdsYXNzbycgb3IgbW9kZWxfc3RyID09ICdscicpOgogICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRfcG9pbnRzID0gNzUKICAgICAgICAgICAgICAgICAgICBzZWxmLl9uX2l0ZXIgPSA1MAogICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRfa3dhcmdzID0geydtYXhfaXRlcic6IDEwMCwgJ25fbmVpZ2hib3JzJzogLTF9CiAgICAgICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgIHNlbGYuX2luaXRfcG9pbnRzID0gMwogICAgICAgICAgICAgICAgICAgIHNlbGYuX25faXRlciA9IDMKICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0X2t3YXJncyA9IHsnbWF4X2l0ZXInOiA2LCAnbl9uZWlnaGJvcnMnOiAtMX0KICAgICAgICAgICAgICAgIHByaW50KGYnLS0tLS0tLS0tLS0tLS0tLS0tIHdvcmtpbmcgb24ge21vZGVsX3N0cn0gLS0tLS0tLS0tLS0tLS0tLS0tJykKICAgICAgICAgICAgICAgIG1vZGVsID0gQmVzdE1vZGVsKG1vZGVsX3N0ciwgc2VsZi5faW5pdF9wb2ludHMsIHNlbGYuX25faXRlcikKICAgICAgICAgICAgICAgIGN2X2Z1bmN0aW9uLCBwYXJhbWV0ZXJzID0gbW9kZWwuX29wdGltaXplX2Z1bmN0aW9uKFgsIHksIGN2X3NwbGl0cywgc2NvcmluZywgbl9qb2JzLCAqKnNlbGYuZ2V0X2luaXRfa3dhcmdzKCkpCiAgICAgICAgICAgICAgICBiZXN0X3NvbHV0aW9uID0gbW9kZWwuX2JheWVzaWFuX29wdGltaXphdGlvbihjdl9mdW5jdGlvbiwgcGFyYW1ldGVycykKICAgICAgICAgICAgICAgIHBhcmFtcywgc2NvcmUgPSBiZXN0X3NvbHV0aW9uWyJwYXJhbXMiXSwgYmVzdF9zb2x1dGlvblsidGFyZ2V0Il0KICAgICAgICAgICAgICAgIHByaW50KGYnXHRSZXN1bHRzIGZvciB7bW9kZWxfc3RyfTpcblx0XHRiZXN0IHBhcmFtcz17cGFyYW1zfVxuXHRcdGJlc3Qgc2NvcmU9e3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OgogICAgICAgICAgICBwYXJhbXMgPSB7J25fZXN0aW1hdG9ycyc6IG5fZXN0aW1hdG9ycywgJ21heF9kZXB0aCc6IG1heF9kZXB0aCwgJ21pbl9zYW1wbGVzX3NwbGl0JzogbWluX3NhbXBsZXNfc3BsaXQsCiAgICAgICAgICAgICAgICAgICAgICAnbWluX3NhbXBsZXNfbGVhZic6IG1pbl9zYW1wbGVzX2xlYWZ9CiAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUoQmVzdE1vZGVsLl9pbml0X1JhbmRvbUZvcmVzdENsYXNzaWZpZXIocGFyYW1zLCAqKmt3YXJncyksIFg9WCwgeT15LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsibl9lc3RpbWF0b3JzIjogKDEwLCA1MDApLAogICAgICAgICAgICAgICAgICAgICAgIm1heF9kZXB0aCI6ICg1LCAxMDApLAogICAgICAgICAgICAgICAgICAgICAgIm1pbl9zYW1wbGVzX3NwbGl0IjogKDIsIDEwMCksCiAgICAgICAgICAgICAgICAgICAgICAibWluX3NhbXBsZXNfbGVhZiI6ICgyLCA1MCl9CiAgICAgICAgcmV0dXJuIGN2X2Z1bmN0aW9uLCBwYXJhbWV0ZXJzCgogICAgIyAtLS0tLSByZnIgLS0tLS0KCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfUmFuZG9tRm9yZXN0UmVncmVzc29yKHBhcmFtcywgKiprd2FyZ3MpOgogICAgICAgIHJldHVybiBSYW5kb21Gb3Jlc3RSZWdyZXNzb3IoCiAgICAgICAgICAgIG5fZXN0aW1hdG9ycz1pbnQobWF4KHBhcmFtc1snbl9lc3RpbWF0b3JzJ10sIDEpKSwKICAgICAgICAgICAgbWF4X2RlcHRoPWludChtYXgocGFyYW1zWydtYXhfZGVw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1MDApLAogICAgICAgICAgICAgICAgICAgICAgIm1heF9kZXB0aCI6ICg1LCAxMDApLAogICAgICAgICAgICAgICAgICAgICAgIm1pbl9zYW1wbGVzX3NwbGl0IjogKDIsIDEwMCksCiAgICAgICAgICAgICAgICAgICAgICAibWluX3NhbXBsZXNfbGVhZiI6ICgyLCA1MCl9CiAgICAgICAgcmV0dXJuIGN2X2Z1bmN0aW9uLCBwYXJhbWV0ZXJzCgogICAgIyAtLS0tLSB4Z2Jvb3N0IGNsYXNzaWZpZXIgLS0tLS0KCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfWEdCQ2xhc3NpZmllcihwYXJhbXMsIG9iamVjdGl2ZT0nYmluYXJ5OmxvZ2lzdGljJywgKiprd2FyZ3MpOgogICAgICAgIHJldHVybiBYR0JDbGFzc2lmaWVyKAogICAgICAgICAgICBvYmplY3RpdmU9b2JqZWN0aXZlLAogICAgICAgICAgICBsZWFybmluZ19yYXRlPW1heChwYXJhbXNbJ2V0YSddLCAwKSwKICAgICAgICAgICAgZ2FtbWE9bWF4KHBhcmFtc1snZ2FtbWEnXSwgMCksCiAgICAgICAgICAgIG1heF9kZXB0aD1pbnQobWF4KHBhcmFtc1snbWF4X2RlcHRoJ10sIDEpKSwKICAgICAgICAgICAgbl9lc3RpbWF0b3JzPWludChtYXgocGFyYW1zWyduX2VzdGltYXRvcnMnXSwgMSkpLAogICAgICAgICAgICBtaW5fY2hpbGRfd2VpZ2h0PWludChtYXgocGFyYW1zWydtaW5fY2hpbGRfd2VpZ2h0J10sIDEpKSwKICAgICAgICAgICAgc2VlZD00MiwKICAgICAgICAgICAgbnRocmVhZD0tMSkKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX29wdGltaXplX1hHQkNsYXNzaWZpZXIoWCwgeSwgY3Zfc3BsaXRzPTUsIHNjb3Jpbmc9J3JvY19hdWMnLCBuX2pvYnM9LTEsICoqa3dhcmdzKToKICAgICAgICBkZWYgY3ZfZnVuY3Rpb24oZXRhLCBnYW1tYSwgbWF4X2RlcHRoLCBuX2VzdGltYXRvcnMsIG1pbl9jaGlsZF93ZWlnaHQpOgogICAgICAgICAgICBwYXJhbXMgPSB7J2V0YSc6IGV0YSwgJ2dhbW1hJzogZ2FtbWEsICdtYXhfZGVwdGgnOiBtYXhfZGVwdGgsICduX2VzdGltYXRvcnMnOiBuX2VzdGltYXRvcnMsCiAgICAgICAgICAgICAgICAgICAgICAnbWluX2NoaWxkX3dlaWdodCc6IG1pbl9jaGlsZF93ZWlnaHR9CiAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUoQmVzdE1vZGVsLl9pbml0X1hHQkNsYXNzaWZpZXIocGFyYW1zLCAqKmt3YXJncyksIFg9WCwgeT15LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsiZXRhIjogKDAuMDAxLCAwLjQpLAogICAgICAgICAgICAgICAgICAgICAgImdhbW1hIjogKDAsIDE1KSwKICAgICAgICAgICAgICAgICAgICAgICJtYXhfZGVwdGgiOiAoMSwgMTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJuX2VzdGltYXRvcnMiOiAoMSwgNTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJtaW5fY2hpbGRfd2VpZ2h0IjogKDEsIDIwKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3Rpb24sIHBhcmFtZXRlcnMKCiAgICAjIC0tLS0tIHhnYm9vc3QgcmVncmVzc29yIC0tLS0tICMKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfWEdCUmVncmVzc29yKHBhcmFtcywgb2JqZWN0aXZlPSdyZWc6c3F1YXJlZGVycm9yJywgKiprd2FyZ3MpOgogICAgICAgIHJldHVybiBYR0JSZWdyZXNzb3IoCiAgICAgICAgICAgIG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ICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsiZXRhIjogKDAuMDAxLCAwLjQpLAogICAgICAgICAgICAgICAgICAgICAgImdhbW1hIjogKDAsIDE1KSwKICAgICAgICAgICAgICAgICAgICAgICJtYXhfZGVwdGgiOiAoMSwgMTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJuX2VzdGltYXRvcnMiOiAoMSwgNTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJtaW5fY2hpbGRfd2VpZ2h0IjogKDEsIDIwKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3Rpb24sIHBhcmFtZXRlcnMKCiAgICAjIC0tLS0tIGxhc3NvIC0tLS0tICMKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfTGFzc28ocGFyYW1zLCAqKmt3YXJncyk6CiAgICAgICAgaWYgcGFyYW1zWydhbHBoYSddIDwgMC4yNToKICAgICAgICAgICAgcmV0dXJuIExpbmVhclJlZ3Jlc3Npb24obl9qb2JzPS0xKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHJldHVybiBMYXNzbyhhbHBoYT1tYXgocGFyYW1zWydhbHBoYSddLCAwLjI1KSkKPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfb3B0aW1pemVfTGFzc28oWCwgeSwgY3Zfc3BsaXRzPTUsIHNjb3Jpbmc9J25lZ19tZWFuX3NxdWFyZWRfZXJyb3InLCBuX2pvYnM9LTEsICoqa3dhcmdzKToKICAgICAgICBkZWYgY3ZfZnVuY3Rpb24oYWxwaGEpOgo8fGZpbV9lbmR8Pg==
a71dccf1f45a2b638cdb7714eb03f92c8a86161a-3
a71dccf1f45a2b638cdb7714eb03f92c8a86161a
PHxmaW1fcHJlZml4fD4KZnJvbSBiYXllc19vcHQgaW1wb3J0IE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AgICAgICAnbWluX3NhbXBsZXNfbGVhZic6IG1pbl9zYW1wbGVzX2xlYWZ9CiAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUoQmVzdE1vZGVsLl9pbml0X1JhbmRvbUZvcmVzdENsYXNzaWZpZXIocGFyYW1zLCAqKmt3YXJncyksIFg9WCwgeT15LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsibl9lc3RpbWF0b3JzIjogKDEwLCA1MDApLAogICAgICAgICAgICAgICAgICAgICAgIm1heF9kZXB0aCI6ICg1LCAxMDApLAogICAgICAgICAgICAgICAgICAgICAgIm1pbl9zYW1wbGVzX3NwbGl0IjogKDIsIDEwMCksCiAgICAgICAgICAgICAgICAgICAgICAibWluX3NhbXBsZXNfbGVhZiI6ICgyLCA1MCl9CiAgICAgICAgcmV0dXJuIGN2X2Z1bmN0aW9uLCBwYXJhbWV0ZXJzCgogICAgIyAtLS0tLSByZnIgLS0tLS0KCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfUmFuZG9tRm9yZXN0UmVncmVzc29yKHBhcmFtcywgKiprd2FyZ3MpOgogICAgICAgIHJldHVybiBSYW5kb21Gb3Jlc3RSZWdyZXNzb3IoCiAgICAgICAgICAgIG5fZXN0aW1hdG9ycz1pbnQobWF4KHBhcmFtc1snbl9lc3RpbWF0b3JzJ10sIDEpKSwKICAgICAgICAgICAgbWF4X2RlcHRoPWludChtYXgocGFyYW1zWydtYXhfZGVwdGgnXSwgMSkpLAogICAgICAgICAgICBtaW5fc2FtcGxlc19zcGxpdD1pbnQobWF4KHBhcmFtc1snbWluX3NhbXBsZXNfc3BsaXQnXSwgMikpLAogICAgICAgICAgICBtaW5fc2FtcGxlc19sZWFmPWludChtYXgocGFyYW1zWydtaW5fc2FtcGx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fZGVwdGgsICduX2VzdGltYXRvcnMnOiBuX2VzdGltYXRvcnMsCiAgICAgICAgICAgICAgICAgICAgICAnbWluX2NoaWxkX3dlaWdodCc6IG1pbl9jaGlsZF93ZWlnaHR9CiAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUoQmVzdE1vZGVsLl9pbml0X1hHQkNsYXNzaWZpZXIocGFyYW1zLCAqKmt3YXJncyksIFg9WCwgeT15LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsiZXRhIjogKDAuMDAxLCAwLjQpLAogICAgICAgICAgICAgICAgICAgICAgImdhbW1hIjogKDAsIDE1KSwKICAgICAgICAgICAgICAgICAgICAgICJtYXhfZGVwdGgiOiAoMSwgMTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJuX2VzdGltYXRvcnMiOiAoMSwgNTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJtaW5fY2hpbGRfd2VpZ2h0IjogKDEsIDIwKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3Rpb24sIHBhcmFtZXRlcnMKCiAgICAjIC0tLS0tIHhnYm9vc3QgcmVncmVzc29yIC0tLS0tICMKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfWEdCUmVncmVzc29yKHBhcmFtcywgb2JqZWN0aXZlPSdyZWc6c3F1YXJlZGVycm9yJywgKiprd2FyZ3MpOgogICAgICAgIHJldHVybiBYR0JSZWdyZXNzb3IoCiAgICAgICAgICAgIG9iamVjdGl2ZT1vYmplY3RpdmUsCiAgICAgICAgICAgIGxlYXJuaW5nX3JhdGU9bWF4KHBhcmFtc1snZXRhJ10sIDApLAogICAgICAgICAgICBnYW1tYT1tYXgocGFyYW1zWydnYW1tYSddLCAwKSwKICAgICAgICAgICAgbWF4X2RlcHRoPW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KICAgICAgICAgICAgICAgICAgICAgICJtYXhfZGVwdGgiOiAoMSwgMTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJuX2VzdGltYXRvcnMiOiAoMSwgNTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJtaW5fY2hpbGRfd2VpZ2h0IjogKDEsIDIwKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3Rpb24sIHBhcmFtZXRlcnMKCiAgICAjIC0tLS0tIGxhc3NvIC0tLS0tICMKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfTGFzc28ocGFyYW1zLCAqKmt3YXJncyk6CiAgICAgICAgaWYgcGFyYW1zWydhbHBoYSddIDwgMC4yNToKICAgICAgICAgICAgcmV0dXJuIExpbmVhclJlZ3Jlc3Npb24obl9qb2JzPS0xKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHJldHVybiBMYXNzbyhhbHBoYT1tYXgocGFyYW1zWydhbHBoYSddLCAwLjI1KSkKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX29wdGltaXplX0xhc3NvKFgsIHksIGN2X3NwbGl0cz01LCBzY29yaW5nPSduZWdfbWVhbl9zcXVhcmVkX2Vycm9yJywgbl9qb2JzPS0xLCAqKmt3YXJncyk6CiAgICAgICAgZGVmIGN2X2Z1bmN0aW9uKGFscGhhKToKICAgICAgICAgICAgcGFyYW1zID0geydhbHBoYSc6IGFscGhhfQogICAgICAgICAgICByZXR1cm4gY3Jvc3NfdmFsX3Njb3JlKEJlc3RNb2RlbC5faW5pdF9MYXNzbyhwYXJhbXMsICoqa3dhcmdzKSwgWD1YLCB5PXksIGN2PWN2X3NwbGl0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29yaW5nPXNjb3JpbmcsIG5fam9icz1uX2pvYnMpLm1lYW4oKQoKICAgICAgICBwYXJhbWV0ZXJzID0geyJhbHBoYSI6ICgwLjAsIDEwKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3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AgICAgICAgbWF4X2l0ZXI9bWF4X2l0ZXIsCiAgICAgICAgICAgIG5fbmVpZ2hib3JzPW5fbmVpZ2hib3JzLAogICAgICAgICAgICBuX2NvbXBvbmVudHM9aW50KG1heChwYXJhbXNbJ25fY29tcG9uZW50cyddLCAyKSksCiAgICAgICAgICAgIG5fam9icz0tMSkKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX29wdGltaXplX05DQUtOTihYLCB5LCBjdl9zcGxpdHM9NSwgc2NvcmluZz0ncm9jX2F1YycsIG5fam9icz0tMSwgKiprd2FyZ3MpOgogICAgICAgIGRlZiBjdl9mdW5jdGlvbihuX2NvbXBvbmVudHMpOgogICAgICAgICAgICBwYXJhbXMgPSB7J25fY29tcG9uZW50cyc6IG5fY29tcG9uZW50c30KICAgICAgICAgICAgbmNha25uID0gQmVzdE1vZGVsLl9pbml0X05DQUtOTihwYXJhbXMsICoqa3dhcmdzKQogICAgICAgICAgICBYX3RyYWluLCBYX3Rlc3QsIHlfdHJhaW4sIHlfdGVzdCA9IHRyYWluX3Rlc3Rfc3BsaXQoWCwgeSwgdGVzdF9zaXplPTAuNSwgcmFuZG9tX3N0YXRlPTQyKQogICAgICAgICAgICBuY2Frbm4uZml0KFhfdHJhaW4sIHlfdHJhaW4pCiAgICAgICAgICAgIFhfdGVzdF9maXR0ZWQgPSBuY2Frbm4udHJhbnNmb3JtKFhfdGVzdCkKICAgICAgICAgICAgaWYgbmNha25uLmZpbmRfazoKICAgICAgICAgICAgICAgIHNjb3JlcyA9IFtdCiAgICAgICAgICAgICAgICBmb3IgayBpbiBOQ0FLTk4ubGlzdF9vZl9rcyhsZW4oWF90ZXN0KSk6CiAgICAgICAgICAgICAgICAgICAgbmNha25uLmtubi5uX25laWdoYm9ycyA9IGsKICAgICAgICAgICAgICAgICAgICBzY29yZXMuYXBwZW5kKGNyb3NzX3ZhbF9zY29yZShuY2Frbm4ua25uLCBYPVhfdGVzdF9maXR0ZWQsIHk9eV90ZXN0LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb3Jpbmc9c2NvcmluZywgbl9qb2JzPW5fam9icykubWVhbigpKQogICAgICAgICAgICAgICAgcmV0dXJuIG5wLm1heChzY29yZXMpCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICByZXR1cm4gY3Jvc3NfdmFsX3Njb3JlKG5jYWtubi5rbm4sIFg9WF90ZXN0X2ZpdHRlZCwgeT15X3Rlc3QsIGN2PWN2X3NwbGl0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKICAgICAgICBwYXJhbWV0ZXJzID0geyJuX2NvbXBvbmVudHMiOiAoMiwgbWluKFguc2hhcGVbMV0sIDUwMCkpfQogICAgICAgIHJldHVybiBjdl9mdW5jdGlvbiwgcGFyYW1ldGVycwoKICAgICMgLS0tLS0gbWxrcmtubiAtLS0tLQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfaW5pdF9NTEtSS05OKHBhcmFtcywgbl9uZWlnaGJvcnM9LTEsIG1heF9pdGVyPTEwMDAsICoqa3dhcmdzKToKICAgICAgICByZXR1cm4gTUxLUktOTigKICAgICAgICAgICAgbWF4X2l0ZXI9bWF4X2l0ZXIsCiAgICAgICAgICAgIG5fbmVpZ2hib3JzPW5fbmVpZ2hib3JzLAogICAgICAgICAgICBuX2NvbXBvbmVudHM9aW50KG1heChwYXJhbXNbJ25fY29tcG9uZW50cyddLCAyKSksCiAgICAgICAgICAgIG5fam9icz0tMSkKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX29wdGltaXplX01MS1JLTk4oWCwgeSwgY3Zfc3BsaXRzPTUsIHNjb3Jpbmc9J25lZ19tZWFuX3NxdWFyZWRfZXJyb3InLCBuX2pvYnM9LTEsICoqa3dhcmdzKToKICAgICAgICBkZWYgY3ZfZnVuY3Rpb24obl9jb21wb25lbnRzKToKICAgICAgICAgICAgcGFyYW1zID0geyduX2NvbXBvbmVudHMnOiBuX2NvbXBvbmVudHN9CiAgICAgICAgICAgIG1sa3Jrbm4gPSBCZXN0TW9kZWwuX2luaXRfTUxLUktOTihwYXJhbXMsICoqa3dhcmdzKQogICAgICAgICAgICBYX3RyYWluLCBYX3Rlc3QsIHlfdHJhaW4sIHlfdGVzdCA9IHRyYWluX3Rlc3Rfc3BsaXQoWCwgeSwgdGVzdF9zaXplPTAuNSwgcmFuZG9tX3N0YXRlPTQyKQogICAgICAgICAgICBtbGtya25uLmZpdChYX3RyYWluLCB5X3RyYWluKQogICAgICAgICAgICBYX3Rlc3RfZml0dGVkID0gbWxrcmtubi50cmFuc2Zvcm0oWF90ZXN0KQogICAgICAgICAgICBpZiBtbGtya25uLmZpbmRfazoKICAgICAgICAgICAgICAgIHNjb3JlcyA9IFtdCiAgICAgICAgICAgICAgICBmb3IgayBpbiBNTEtSS05OLmxpc3Rfb2Zfa3MobGVuKFhfdGVzdCkpOgogICAgICAgICAgICAgICAgICAgIG1sa3Jrbm4ua25uLm5fbmVpZ2hib3JzID0gawogICAgICAgICAgICAgICAgICAgIHNjb3Jlcy5hcHBlbmQoY3Jvc3NfdmFsX3Njb3JlKG1sa3Jrbm4ua25uLCBYPVhfdGVzdF9maXR0ZWQsIHk9eV90ZXN0LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkpCiAgICAgICAgICAgICAgICByZXR1cm4gbnAubWF4KHNjb3JlcykKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUobWxrcmtubi5rbm4sIFg9WF90ZXN0X2ZpdHRlZCwgeT15X3Rlc3QsIGN2PWN2X3NwbGl0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsibl9jb21wb25lbnRzIjogKDIsIG1pbihYLnNoYXBlWzFdLCA1MDApKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3Rpb24sIHBhcmFtZXRlcnMKCiAgICAjIC0tLS0tLS0tLS0tLS0tIHNrbGVhcm4gQVBJIGZ1bmN0aW9ucyAtLS0tLS0tLS0tLS0tLSAjCgogICAgZGVmIGZpdChzZWxmLCBYLCB5LCBjdl9zcGxpdHM9NSwgc2NvcmluZz0ncm9jX2F1YycsIG5fam9icz0tMSk6CiAgICAgICAgaWYgc2VsZi5fbW9kZWxfc3RyIGluICgnY2xhc3NpZmllcicsICdyZWdyZXNzb3InKToKICAgICAgICAgICAgbW9kZWxzX3RvX2NoZWNrID0gKCd4Z2Jvb3N0JywgJ3JmYycsICdscicpIGlmIHNlbGYuX21vZGVsX3N0ciA9PSAnY2xhc3NpZmllcicgZWxzZSAoCiAgICAgICAgICAgICAgICAneGdicmVnJywgJ3JmcicsICdsYXNzbycpCiAgICAgICAgICAgIGJlc3RfbW9kZWwsIGJlc3Rfc2NvcmUsIGJlc3RfcGFyYW1zID0gTm9uZSwgTm9uZSwgTm9uZQogICAgICAgICAgICBmb3IgbW9kZWxfc3RyIGluIG1vZGVsc190b19jaGVjazoKICAgICAgICAgICAgICAgIGlmKG1vZGVsX3N0ciA9PSAnbGFzc28nIG9yIG1vZGVsX3N0ciA9PSAnbHInKToKICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0X3BvaW50cyA9IDc1CiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbl9pdGVyID0gNTAKICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0X2t3YXJncyA9IHsnbWF4X2l0ZXInOiAxMDAsICduX25laWdoYm9ycyc6IC0xfQogICAgICAgICAgICAgICAgZWxzZToKPH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9maXR0ZWRfbW9kZWwKCiAgICBkZWYgcHJlZGljdChzZWxmLCBYKToKICAgICAgICBpZiBzZWxmLl9maXR0ZWRfbW9kZWwgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHJldHVybiBzZWxmLl9maXR0ZWRfbW9kZWwucHJlZGljdChYKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHJhaXNlIEV4Y2VwdGlvbignTW9kZWwgc2hvdWxkIGJlIGZpdHRlZCBiZWZvcmUgcHJlZGljdGlvbicpCgogICAgZGVmIGZpdF9wcmVkaWN0KHNlbGYsIFgsIHksIGN2X3NwbGl0cz01LCBzY29yaW5nPSdyb2NfYXVjJywgbl9qb2JzPS0xKToKICAgICAgICBzZWxmLmZpdChYLCB5LCBjdl9zcGxpdHMsIHNjb3JpbmcsIG5fam9icykKICAgICAgICByZXR1cm4gc2VsZi5wcmVkaWN0KFgpCgogICAgZGVmIHRyYW5zZm9ybShzZWxmLCBYKToKICAgICAgICBpZiBzZWxmLl9tb2RlbF9zdHIgaW4gKCduY2EnLCAnbWxrcicpOgogICAgICAgICAgICBpZiBzZWxmLl9maXR0ZWRfbW9kZWwgaXMgbm90IE5vbmU6CiAgICAgICAgICAgICAgICByZXR1cm4gc2VsZi5fZml0dGVkX21vZGVsLnRyYW5zZm9ybShYKQogICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgcmFpc2UgRXhjZXB0aW9uKCdNb2RlbCBzaG91bGQgYmUgZml0dGVkIGJlZm9yZSBwcmVkaWN0aW9uJykKICAgICAgICBlbHNlOgogICAgICAgICAgICByYWlzZSBFeGNlcHRpb24oJ09ubHkgbmNhIG9yIG1sa3IgbW9kZWxzIGhhdmUgdHJhbnNmb3JtIG1ldGhvZCcpCgogICAgZGVmIHByZWRpY3RfcHJvYmEoc2VsZiwgWCk6CiAgICAgICAgaWYgc2VsZi5fZml0dGVkX21vZGVsIGlzIG5vdCBOb25lOgogICAgICAgICAgICByZXR1cm4gc2VsZi5fZml0dGVk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Jlc3RNb2RlbC5faW5pdF9SYW5kb21Gb3Jlc3RSZWdyZXNzb3IocGFyYW1zLCAqKmt3YXJncyksIFg9WCwgeT15LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsibl9lc3RpbWF0b3JzIjogKDEwLCA1MDApLAogICAgICAgICAgICAgICAgICAgICAgIm1heF9kZXB0aCI6ICg1LCAxMDApLAogICAgICAgICAgICAgICAgICAgICAgIm1pbl9zYW1wbGVzX3NwbGl0IjogKDIsIDEwMCksCiAgICAgICAgICAgICAgICAgICAgICAibWluX3NhbXBsZXNfbGVhZiI6ICgyLCA1MCl9CiAgICAgICAgcmV0dXJuIGN2X2Z1bmN0aW9uLCBwYXJhbWV0ZXJzCgogICAgIyAtLS0tLSB4Z2Jvb3N0IGNsYXNzaWZpZXIgLS0tLS0KCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfWEdCQ2xhc3NpZmllcihwYXJhbXMsIG9iamVjdGl2ZT0nYmluYXJ5OmxvZ2lzdGljJywgKiprd2FyZ3MpOgogICAgICAgIHJldHVybiBYR0JDbGFzc2lmaWVyKAogICAgICAgICAgICBvYmplY3RpdmU9b2JqZWN0aXZlLAogICAgICAgICAgICBsZWFybmluZ19yYXRlPW1heChwYXJhbXNbJ2V0YSddLCAwKSwKICAgICAgICAgICAgZ2FtbWE9bWF4KHBhcmFtc1snZ2FtbWEnXSwgMCksCiAgICAgICAgICAgIG1heF9kZXB0aD1pbnQobWF4KHBhcmFtc1snbWF4X2RlcHRoJ10sIDEpKSwKICAgICAgICAgICAgbl9lc3RpbWF0b3JzPWludChtYXgocGFyYW1zWyduX2VzdGltYXRvcnMnXSwgMSkpLAogICAgICAgICAgICBtaW5fY2hpbGRfd2VpZ2h0PWludChtYXgocGFyYW1zWydtaW5fY2hpbGRfd2VpZ2h0J10sIDEpKSwKICAgICAgICAgICAgc2VlZD00MiwKICAgICAgICAgICAgbnRocmVhZD0tMSkKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX29wdGltaXplX1hHQkNsYXNzaWZpZXIoWCwgeSwgY3Zfc3BsaXRzPTUsIHNjb3Jpbmc9J3JvY19hdWMnLCBuX2pvYnM9LTEsICoqa3dhcmdzKToKICAgICAgICBkZWYgY3ZfZnVuY3Rpb24oZXRhLCBnYW1tYSwgbWF4X2RlcHRoLCBuX2VzdGltYXRvcnMsIG1pbl9jaGlsZF93ZWlnaHQpOgogICAgICAgICAgICBwYXJhbXMgPSB7J2V0YSc6IGV0YSwgJ2dhbW1hJzogZ2FtbWEsICdtYXhfZGVwdGgnOiBtYXhfZGVwdGgsICduX2VzdGltYXRvcnMnOiBuX2VzdGltYXRvcnMsCiAgICAgICAgICAgICAgICAgICAgICAnbWluX2NoaWxkX3dlaWdodCc6IG1pbl9jaGlsZF93ZWlnaHR9CiAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUoQmVzdE1vZGVsLl9pbml0X1hHQkNsYXNzaWZpZXIocGFyYW1zLCAqKmt3YXJncyksIFg9WCwgeT15LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsiZXRhIjogKDAuMDAxLCAwLjQpLAogICAgICAgICAgICAgICAgICAgICAgImdhbW1hIjogKDAsIDE1KSwKICAgICAgICAgICAgICAgICAgICAgICJtYXhfZGVwdGgiOiAoMSwgMTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJuX2VzdGltYXRvcnMiOiAoMSwgNTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJtaW5fY2hpbGRfd2VpZ2h0IjogKDEsIDIwKX0KICAgICAgICByZXR1cm4gY3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9lc3RpbWF0b3JzLAogICAgICAgICAgICAgICAgICAgICAgJ21pbl9jaGlsZF93ZWlnaHQnOiBtaW5fY2hpbGRfd2VpZ2h0fQogICAgICAgICAgICByZXR1cm4gY3Jvc3NfdmFsX3Njb3JlKEJlc3RNb2RlbC5faW5pdF9YR0JSZWdyZXNzb3IocGFyYW1zLCAqKmt3YXJncyksIFg9WCwgeT15LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsiZXRhIjogKDAuMDAxLCAwLjQpLAogICAgICAgICAgICAgICAgICAgICAgImdhbW1hIjogKDAsIDE1KSwKICAgICAgICAgICAgICAgICAgICAgICJtYXhfZGVwdGgiOiAoMSwgMTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJuX2VzdGltYXRvcnMiOiAoMSwgNTAwKSwKICAgICAgICAgICAgICAgICAgICAgICJtaW5fY2hpbGRfd2VpZ2h0IjogKDEsIDIwKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3Rpb24sIHBhcmFtZXRlcnMKCiAgICAjIC0tLS0tIGxhc3NvIC0tLS0tICMKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX2luaXRfTGFzc28ocGFyYW1zLCAqKmt3YXJncyk6CiAgICAgICAgaWYgcGFyYW1zWydhbHBoYSddIDwgMC4yNToKICAgICAgICAgICAgcmV0dXJuIExpbmVhclJlZ3Jlc3Npb24obl9qb2JzPS0xKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHJldHVybiBMYXNzbyhhbHBoYT1tYXgocGFyYW1zWydhbHBoYSddLCAwLjI1KSkKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX29wdGltaXplX0xhc3NvKFgsIHksIGN2X3NwbGl0cz01LCBzY29yaW5nPSduZWdfbWVhbl9zcXVhcmVkX2Vycm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AgICBuY2Frbm4uZml0KFhfdHJhaW4sIHlfdHJhaW4pCiAgICAgICAgICAgIFhfdGVzdF9maXR0ZWQgPSBuY2Frbm4udHJhbnNmb3JtKFhfdGVzdCkKICAgICAgICAgICAgaWYgbmNha25uLmZpbmRfazoKICAgICAgICAgICAgICAgIHNjb3JlcyA9IFtdCiAgICAgICAgICAgICAgICBmb3IgayBpbiBOQ0FLTk4ubGlzdF9vZl9rcyhsZW4oWF90ZXN0KSk6CiAgICAgICAgICAgICAgICAgICAgbmNha25uLmtubi5uX25laWdoYm9ycyA9IGsKICAgICAgICAgICAgICAgICAgICBzY29yZXMuYXBwZW5kKGNyb3NzX3ZhbF9zY29yZShuY2Frbm4ua25uLCBYPVhfdGVzdF9maXR0ZWQsIHk9eV90ZXN0LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb3Jpbmc9c2NvcmluZywgbl9qb2JzPW5fam9icykubWVhbigpKQogICAgICAgICAgICAgICAgcmV0dXJuIG5wLm1heChzY29yZXMpCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICByZXR1cm4gY3Jvc3NfdmFsX3Njb3JlKG5jYWtubi5rbm4sIFg9WF90ZXN0X2ZpdHRlZCwgeT15X3Rlc3QsIGN2PWN2X3NwbGl0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKICAgICAgICBwYXJhbWV0ZXJzID0geyJuX2NvbXBvbmVudHMiOiAoMiwgbWluKFguc2hhcGVbMV0sIDUwMCkpfQogICAgICAgIHJldHVybiBjdl9mdW5jdGlvbiwgcGFyYW1ldGVycwoKICAgICMgLS0tLS0gbWxrcmtubiAtLS0tLQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBfaW5pdF9NTEtSS05OKHBhcmFtcywgbl9uZWlnaGJvcnM9LTEsIG1heF9pdGVyPTEwMDAsICoqa3dhcmdzKToKICAgICAgICByZXR1cm4gTUxLUktOTigKICAgICAgICAgICAgbWF4X2l0ZXI9bWF4X2l0ZXIsCiAgICAgICAgICAgIG5fbmVpZ2hib3JzPW5fbmVpZ2hib3JzLAogICAgICAgICAgICBuX2NvbXBvbmVudHM9aW50KG1heChwYXJhbXNbJ25fY29tcG9uZW50cyddLCAyKSksCiAgICAgICAgICAgIG5fam9icz0tMSkKCiAgICBAc3RhdGljbWV0aG9kCiAgICBkZWYgX29wdGltaXplX01MS1JLTk4oWCwgeSwgY3Zfc3BsaXRzPTUsIHNjb3Jpbmc9J25lZ19tZWFuX3NxdWFyZWRfZXJyb3InLCBuX2pvYnM9LTEsICoqa3dhcmdzKToKICAgICAgICBkZWYgY3ZfZnVuY3Rpb24obl9jb21wb25lbnRzKToKICAgICAgICAgICAgcGFyYW1zID0geyduX2NvbXBvbmVudHMnOiBuX2NvbXBvbmVudHN9CiAgICAgICAgICAgIG1sa3Jrbm4gPSBCZXN0TW9kZWwuX2luaXRfTUxLUktOTihwYXJhbXMsICoqa3dhcmdzKQogICAgICAgICAgICBYX3RyYWluLCBYX3Rlc3QsIHlfdHJhaW4sIHlfdGVzdCA9IHRyYWluX3Rlc3Rfc3BsaXQoWCwgeSwgdGVzdF9zaXplPTAuNSwgcmFuZG9tX3N0YXRlPTQyKQogICAgICAgICAgICBtbGtya25uLmZpdChYX3RyYWluLCB5X3RyYWluKQogICAgICAgICAgICBYX3Rlc3RfZml0dGVkID0gbWxrcmtubi50cmFuc2Zvcm0oWF90ZXN0KQogICAgICAgICAgICBpZiBtbGtya25uLmZpbmRfazoKICAgICAgICAgICAgICAgIHNjb3JlcyA9IFtdCiAgICAgICAgICAgICAgICBmb3IgayBpbiBNTEtSS05OLmxpc3Rfb2Zfa3MobGVuKFhfdGVzdCkpOgogICAgICAgICAgICAgICAgICAgIG1sa3Jrbm4ua25uLm5fbmVpZ2hib3JzID0gawogICAgICAgICAgICAgICAgICAgIHNjb3Jlcy5hcHBlbmQoY3Jvc3NfdmFsX3Njb3JlKG1sa3Jrbm4ua25uLCBYPVhfdGVzdF9maXR0ZWQsIHk9eV90ZXN0LCBjdj1jdl9zcGxpdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkpCiAgICAgICAgICAgICAgICByZXR1cm4gbnAubWF4KHNjb3JlcykKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHJldHVybiBjcm9zc192YWxfc2NvcmUobWxrcmtubi5rbm4sIFg9WF90ZXN0X2ZpdHRlZCwgeT15X3Rlc3QsIGN2PWN2X3NwbGl0cywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NvcmluZz1zY29yaW5nLCBuX2pvYnM9bl9qb2JzKS5tZWFuKCkKCiAgICAgICAgcGFyYW1ldGVycyA9IHsibl9jb21wb25lbnRzIjogKDIsIG1pbihYLnNoYXBlWzFdLCA1MDApKX0KICAgICAgICByZXR1cm4gY3ZfZnVuY3Rpb24sIHBhcmFtZXRlcnMKCiAgICAjIC0tLS0tLS0tLS0tLS0tIHNrbGVhcm4gQVBJIGZ1bmN0aW9ucyAtLS0tLS0tLS0tLS0tLSAjCgogICAgZGVmIGZpdChzZWxmLCBYLCB5LCBjdl9zcGxpdHM9NSwgc2NvcmluZz0ncm9jX2F1YycsIG5fam9icz0tMSk6CiAgICAgICAgaWYgc2VsZi5fbW9kZWxfc3RyIGluICgnY2xhc3NpZmllcicsICdyZWdyZXNzb3InKToKICAgICAgICAgICAgbW9kZWxzX3RvX2NoZWNrID0gKCd4Z2Jvb3N0JywgJ3JmYycsICdscicpIGlmIHNlbGYuX21vZGVsX3N0ciA9PSAnY2xhc3NpZmllcicgZWxzZSAoCiAgICAgICAgICAgICAgICAneGdicmVnJywgJ3JmcicsICdsYXNzbycpCiAgICAgICAgICAgIGJlc3RfbW9kZWwsIGJlc3Rfc2NvcmUsIGJlc3RfcGFyYW1zID0gTm9uZSwgTm9uZSwgTm9uZQogICAgICAgICAgICBmb3IgbW9kZWxfc3RyIGluIG1vZGVsc190b19jaGVjazoKICAgICAgICAgICAgICAgIGlmKG1vZGVsX3N0ciA9PSAnbGFzc28nIG9yIG1vZGVsX3N0ciA9PSAnbHInKToKICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0X3BvaW50cyA9IDc1CiAgICAgICAgICAgICAgICAgICAgc2VsZi5fbl9pdGVyID0gNTAKICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0X2t3YXJncyA9IHsnbWF4X2l0ZXInOiAxMDAsICduX25laWdoYm9ycyc6IC0xfQogICAgICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgICAgICBzZWxmLl9pbml0X3BvaW50cyA9IDMKICAgICAgICAgICAgICAgICAgICBzZWxmLl9uX2l0ZXIgPSAzCiAgICAgICAgICAgICAgICAgICAgc2VsZi5faW5pdF9rd2FyZ3MgPSB7J21heF9pdGVyJzogNiwgJ25fbmVpZ2hib3JzJzogLTF9CiAgICAgICAgICAgICAgICBwcmludChmJy0tLS0tLS0tLS0tLS0tLS0tLSB3b3JraW5nIG9uIHttb2RlbF9zdHJ9IC0tLS0tLS0tLS0tLS0tLS0tLScpCiAgICAgICAgICAgICAgICBtb2RlbCA9IEJlc3RNb2RlbChtb2RlbF9zdHIsIHNlbGYuX2luaXRfcG9pbnRzLCBzZWxmLl9uX2l0ZXIpCiAgICAgICAgICAgICAgICBjdl9mdW5jdGlvbiwgcGFyYW1ldGVycyA9IG1vZGVsLl9vcHRpbWl6ZV9mdW5jdGlvbihYLCB5LCBjdl9zcGxpdHMsIHNjb3JpbmcsIG5fam9icywgKipzZWxmLmdldF9pbml0X2t3YXJncygpKQogICAgICAgICAgICAgICAgYmVzdF9zb2x1dGlvbiA9IG1vZGVsLl9iYXllc2lhbl9vcHRpbWl6YXRpb24oY3ZfZnV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AgICkgYXMgdG1wX3BuZzoKICAgICAgICAgICAgYnVpbGRfcG5nX3Jlc3VsdF9jb2RlID0gY2hlY2tfY2FsbCgKICAgICAgICAgICAgICAgIFsiaW5rc2NhcGUiLCBmaWxlX3BhdGgsICItLWV4cG9ydC1hcmVhLWRyYXdpbmciLCAiLWUiLCB0bXBfcG5nLm5hbWVdLAogICAgICAgICAgICAgICAgc3Rkb3V0PURFVk5VTEwsCiAgICAgICAgICAgICAgICBzdGRlcnI9U1RET1VULAogICAgICAgICAgICApCgogICAgICAgICAgICBpZiBidWlsZF9wbmdfcmVzdWx0X2NvZGUgIT0gMDoKICAgICAgICAgICAgICAgIHJhaXNlIEludGVybWVkaWF0ZUZpbGVCdWlsZGluZ0ZhaWxlZCgKICAgICAgICAgICAgICAgICAgICAiQnVpbGRpbmcgUE5HIGludGVybWVkaWF0ZSBmaWxlIHVzaW5nIGlua3NjYXBlICIKICAgICAgICAgICAgICAgICAgICAiZmFpbGVkIHdpdGggc3RhdHVzIHt9Ii5mb3JtYXQoYnVpbGRfcG5nX3Jlc3VsdF9jb2RlKQogICAgICAgICAgICAgICAgKQoKICAgICAgICAgICAgcmV0dXJuIEltYWdlUHJldmlld0J1aWxkZXJQaWxsb3coKS5idWlsZF9qcGVnX3ByZXZpZXcoCiAgICAgICAgICAgICAgICB0bXBfcG5nLm5hbWUsIHByZXZpZXdfbmFtZSwgY2FjaGVfcGF0aCwgcGFnZV9pZCwgZXh0ZW5zaW9uLCBzaXplLCBtaW1ldHlwZQogICAgICAgICAgICApCjx8ZmltX3N1ZmZpeHw+CmZyb20gc3VicHJvY2VzcyBpbXBvcnQgU1RET1VUCmZyb20gc3VicHJvY2VzcyBpbXBvcnQgY2hlY2tfY2FsbApmcm9tIHN1YnByb2Nlc3MgaW1wb3J0IGNoZWNrX291dHB1dAppbXBvcnQgdGVtcGZpbGUKPHxmaW1fZW5kfD4=
ab981bbc3fa90b21808b4ff5b5b8c98e47ed23a3-5
ab981bbc3fa90b21808b4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go8fGZpbV9zdWZmaXh8PgogICAgICAgIGlmIG5vdCBzaXplOgogICAgICAgICAgICBzaXplID0gc2VsZi5kZWZhdWx0X3NpemUKICAgICAgICAjIGlua3NjYXBlIHRlc3NlbGF0aW9uLVAzLnN2ZyAgLWUKICAgICAgICB3aXRoIHRlbXBmaWxlLk5hbWVkVGVtcG9yYXJ5RmlsZSgKPHxmaW1fZW5kfD4=
af36a0b1494275b212a6a8d580c3babb8112b4ec-1
af36a0b1494275b212a6a8d580c3babb8112b4ec
PHxmaW1fcHJlZml4fD4KIyBNb2RpZmlxdWUgZWwgZWplcmNpY2lvIGFudGVyaW9yIHBhcmEgcXVlIGVsIGNvbnRlbyBzZSBoYWdhIGhhY2lhIGF0csOhcyBkZXNkZSBlbCB0aWVtcG8gbGXDrWRvCiMgaGFzdGEgY2VybwoKZnJvbSBkYXRldGltZSBpbXBvcnQgZGF0ZXRpbWUsIHRpbWVkZWx0YQppbXBvcnQgdGltZQoKZGVmIGxlZXJOdW1lcm8obm9tYnJlKToKICAgIHJldHVybiBpbnQoaW5wdXQoJ0luZ3Jlc2UgdW4gbnVtZXJvIHBhcmEgJyArIG5vbWJyZSArICc6ICcpKQoKZGVmIGNvdW50ZG93bihkPTAsIGg9MCwgbT0wLCBzPTApOgogICAgY291bnRlciA9IHRpbWVkZWx0YShkYXlzPWQsIGhvdXJzPWgsIG1pbnV0ZXM9bSwgc2Vjb25kcz1zKQogICAgd2hpbGUgY291bnRlcjoKPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgogICAgICAgIHRpbWUuc2xlZXAoMSkKICAgICAgICBjb3VudGVyIC09IHRpbWVkZWx0YShzZWNvbmRzPTEpCiAgICAgICAgcHJpbnQoIlRpbWUgcmVtYWluaW5nOiB7fSIuZm9ybWF0KGNvdW50ZXIpKQoKPHxmaW1fZW5kfD4=
af36a0b1494275b212a6a8d580c3babb8112b4ec-2
af36a0b1494275b212a6a8d580c3babb8112b4ec
PHxmaW1fcHJlZml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WRfY29uc2Vuc3VzIChzY2lweV9rZHRyZWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnBfcG9pbnRjbG91ZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JyZXNwb25kaW5nX3BvaW50Y2xvdWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNsYXRpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5nbGVfdGhyZXNob2xkPWFuZ2xlX3RocmVzaG9sZF9yYWRpYW5zLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3RhbmNlX3RocmVzaG9sZD1kaXN0YW5jZV90aHJlc2hvbGQgKQoKICAgICAgICAgICAgICAgIGVsaWYgKGFsZ29yaXRobSA9PSAnYW5nbGUnKToKCiAgICAgICAgICAgICAgICAgICAgY29uc2Vuc3VzX2NvdW50LCBjb25zZW5zdXNfdmVjdG9yID0gXAogICAgICAgICAgICAgICAgICAgICAgICBub3JtYWxfdmVjdG9yX2Nsb3VkX2NvbnNlbnN1cyAoc2NpcHlfa2R0cmVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnBfcG9pbnRjbG91ZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnJlc3BvbmRpbmdfcG9pbnRjbG91ZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zbGF0aW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5nbGVfdGhyZXNob2xkX3JhZGlhbnMgKQoKICAgICAgICAgICAgICAgIGVsc2U6CgogICAgICAgICAgICAgICAgICAgIGFsZ29yaXRobSA9ICdkaXN0YW5jZScKICAgICAgICAgICAgICAgICAgICBjb25zZW5zdXNfY291bnQsIGNvbnNlbnN1c192ZWN0b3IgPSBcCiAgICAgICAgICAgICAgICAgICAgICAgIHBvaW50X2Rpc3RhbmNlX2Nsb3VkX2NvbnNlbnN1cyAoc2NpcHlfa2R0cmVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29ycmVzcG9uZGluZ19wb2ludGNsb3VkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNsYXRpb24sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXN0YW5jZV90aHJlc2hvbGQgKQoKICAgICAgICAgICAgICAgICMgY2hlY2sgZm9yIGEgbmV3IGNvbnNlbnN1cyBoaWdoCiAgICAgICAgICAgICAgICBpZiAoY29uc2Vuc3VzX2NvdW50ID4gaGlnaGVzdF9jb25zZW5zdXNfY291bnQgKToKCiAgICAgICAgICAgICAgICAgICAgIyBzYXZlIHRoZSB2YWx1ZXMgb2YgdGhlIG5ldyBiZXN0IHJlc3VsdHMKICAgICAgICAgICAgICAgICAgICBiZXN0X2FsaWdubWVudCA9IHRyYW5zbGF0aW9uCiAgICAgICAgICAgICAgICAgICAgaGlnaGVzdF9jb25zZW5zdXNfY291bnQgPSBjb25zZW5zdXNfY291bnQKICAgICAgICAgICAgICAgICAgICBiZXN0X2FsaWdubWVudF9jb25zZW5zdXNfdmVjdG9yID0gY29uc2Vuc3VzX3ZlY3RvcgoKICAgICAgICAgICAgICAgICMgcHJlcGFyZSB0aGUgQ29uc2Vuc3VzQ3ViZSBhcyBhIG51bXB5IGNsb3VkIHdpdGggYSBmb3VydGggZmllbGQgdGhhdCBzcGVjaWZpZXMgdGhlIGNvbnNlbnN1cyBjb3VudCBmb3IKICAgICAgICAgICAgICAgICMgZWFjaCBwb3NzaWJsZSB0cmFuc2xhdGlvbgogICAgICAgICAgICAgICAgaWYgKGRpc3BsYXlfcGxvdCBvciBzYXZlX3Bsb3QgKToKICAgICAgICAgICAgICAgICAgICBjb25zZW5zdXNfY2xvdWRbaXRlcmF0aW9uX2NvdW50LCA6XSA9ICh0cmFuc2xhdGlvblswXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2xhdGlvblsxXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2xhdGlvblsyXSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zZW5zdXNfY291bnQpCgogICAgICAgICAgICAgICAgaXRlcmF0aW9uX2NvdW50ID0gaXRlcmF0aW9uX2NvdW50ICsgMQoKICAgICMgcHJpbnQgcmVzdWx0cwogICAgcHJpbnQgKCJPdmVyYWxsIFRpbWU6ICIgKyBzdHIgKHRpbWUudGltZSAoKSAtIHN0YXJ0X3RpbWUgKSkKICAgIHByaW50ICgiXG5iZXN0X2FsaWdubWVudDogIiArIHN0cihiZXN0X2FsaWdubWVudCApKQogICAgcHJpbnQgKCJoaWdoZXN0X2NvbnNlbnN1c19jb3VudDogIiArIHN0cihoaWdoZXN0X2NvbnNlbnN1c19jb3VudCApKQoKICAgIGlmIChkaXNwbGF5X3Bsb3Qgb3Igc2F2ZV9wbG90ICk6CiAgICAgICAgIyBwdXQgdG9nZXRoZXIgdGhlIHBsb3QgdGlsZSwgaW5jbHVkaW5nIHRoZSBzdHJpbmcgZ2l2ZW4gYXMgYXJndW1lbnQgdG8gdGhpcyBmdW5jdGlvbiBhbmQgdGhlIG90aGVyIGFsZ29yaXRobQogICAgICAgICMgcGFyYW1ldGVycwogICAgICAgIHBsb3RfdGl0bGUgPSBjcmVhdGVfcGxvdF90aXRsZSAoCiAgICAgICAgICAgIHBsb3RfdGl0bGUsIGFsZ29yaXRobSwgY3VidXNfbGVuZ3RoLCBzdGVwLCBkaXN0YW5jZV90aHJlc2hvbGQsIGFuZ2xlX3RocmVzaG9sZCApCgogICAgICAgICMgZGlzcGxheSB0aGUgcGxvdAogICAgICAgIGRpc3BsYXlfY3ViZSwgZmlndXJlID0gZGlzcGxheV9jb25zZW5zdXNfY3ViZSAoCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnNlbnN1c19jbG91ZCwgY29ycmVzcG9uZGluZ19wb2ludGNsb3VkLnBvaW50cy5zaGFwZVswXSwgYmVzdF9hbGlnbm1lbnQsCiAgICAgICAgICAgICAgICAgICAgICAgIHBsb3RfdGl0bGUsIHJlbGF0aXZlX2NvbG9yX3NjYWxlPXJlbGF0aXZlX2NvbG9yX3NjYWxlICkKCiAgICAgICAgaWYgKHNhdmVfcGxvdCApOgogICAgICAgICAgICAjIHNhdmUgcGxvdCBpbWFnZQogICAgICAgICAgICBmaWd1cmUuc2F2ZWZpZyAoc3RyKCJkb2NzL2xvZ3MvdW5vcmRlcmVkX2N1YmVfc2F2ZWZpbGVzLyIgKyBwbG90X3RpdGxlICsgIi5wbmciICksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXQ9J3BuZycsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcGk9MjIwLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgYmJveF9pbmNoZXM9J3RpZ2h0JykKCiAgICAgICAgICAgICMgc2F2ZSBudW1weSBhcnJheSBvZiBjdWJlCiAgICAgICAgICAgIG5wLnNhdmUgKHN0cigiZG9jcy9sb2dzL3Vub3JkZXJlZF9jdWJlX3NhdmVmaWxlcy8iICsgcGxvdF90aXRsZSApLAogICAgICAgICAgICAgICAgZGlzcGxheV9jdWJlLCBhbGxvd19waWNrbGU9RmFsc2UgKQoKICAgICAgICAgICAgIyBzYXZlIGFzY2lpIGNsb3VkIG9mIGN1YmUK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plKSAqIDEwMC4wICkgKyAiICUiICkKCiAgICAgICAgICAgICAgICAjIENyZWF0ZSBhIGxpc3QgdGhhdCBjb250YWlucyB0aGUgdHJhbnNsYXRpb24gb2YgdGhpcyBzdGVwCiAgICAgICAgICAgICAgICB0cmFuc2xhdGlvbiA9IFt4X2l0ZXJhdG9yICogc3RlcCwgeV9pdGVyYXRvciAqIHN0ZXAsIHpfaXRlcmF0b3IgKiBzdGVwXQoKICAgICAgICAgICAgICAgICMgU3RhcnQgdGhlIGNvbXB1dGF0aW9uIG9mIHRoZSBjb25zZW5zdXMgZm9yIHRoaXMgdHJhbnNsYXRpb24sIHVzaW5nIHRoZSBzcGVjaWZpZWQgYWxnb3JpdGhtCiAgICAgICAgICAgICAgICBpZiAoYWxnb3JpdGhtID09ICdjb21iaW5lZCcpOgoKICAgICAgICAgICAgICAgICAgICBjb25zZW5zdXNfY291bnQsIGNvbnNlbnN1c192ZWN0b3IgPSBcCiAgICAgICAgICAgICAgICAgICAgICAgIGNvbWJpbmVkX2Nsb3VkX2NvbnNlbnN1cyAoc2NpcHlfa2R0cmVlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5wX3BvaW50Y2xvdWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29ycmVzcG9uZGluZ19wb2ludGNsb3VkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zbGF0aW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuZ2xlX3RocmVzaG9sZD1hbmdsZV90aHJlc2hvbGRfcmFkaWFucywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXN0YW5jZV90aHJlc2hvbGQ9ZGlzdGFuY2VfdGhyZXNob2xkICkKCiAgICAgICAgICAgICAgICBlbGlmIChhbGdvcml0aG0gPT0gJ2FuZ2xlJyk6CgogICAgICAgICAgICAgICAgICAgIGNvbnNlbnN1c19jb3VudCwgY29uc2Vuc3VzX3ZlY3RvciA9IFwKICAgICAgICAgICAgICAgICAgICAgICAgbm9ybWFsX3ZlY3Rvcl9jbG91ZF9jb25zZW5zdXMgKHNjaXB5X2tkdHJlZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5wX3BvaW50Y2xvdWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3JyZXNwb25kaW5nX3BvaW50Y2xvdWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2xhdGlvbiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuZ2xlX3RocmVzaG9sZF9yYWRpYW5zICkKCiAgICAgICAgICAgICAgICBlbHNlOgoKICAgICAgICAgICAgICAgICAgICBhbGdvcml0aG0gPSAnZGlzdGFuY2UnCiAgICAgICAgICAgICAgICAgICAgY29uc2Vuc3VzX2NvdW50LCBjb25zZW5zdXNfdmVjdG9yID0gXAogICAgICAgICAgICAgICAgICAgICAgICBwb2ludF9kaXN0YW5jZV9jbG91ZF9jb25zZW5zdXMgKHNjaXB5X2tkdHJlZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcnJlc3BvbmRpbmdfcG9pbnRjbG91ZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zbGF0aW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzdGFuY2VfdGhyZXNob2xkICkKCiAgICAgICAgICAgICAgICAjIGNoZWNrIGZvciBhIG5ldyBjb25zZW5zdXMgaGlnaAogICAgICAgICAgICAgICAgaWYgKGNvbnNlbnN1c19jb3VudCA+IGhpZ2hlc3RfY29uc2Vuc3VzX2NvdW50ICk6CgogICAgICAgICAgICAgICAgICAgICMgc2F2ZSB0aGUgdmFsdWVzIG9mIHRoZSBuZXcgYmVzdCByZXN1bHRzCiAgICAgICAgICAgICAgICAgICAgYmVzdF9hbGlnbm1lbnQgPSB0cmFuc2xhdGlvbgogICAgICAgICAgICAgICAgICAgIGhpZ2hlc3RfY29uc2Vuc3VzX2NvdW50ID0gY29uc2Vuc3VzX2NvdW50CiAgICAgICAgICAgICAgICAgICAgYmVzdF9hbGlnbm1lbnRfY29uc2Vuc3VzX3ZlY3RvciA9IGNvbnNlbnN1c192ZWN0b3IKCiAgICAgICAgICAgICAgICAjIHByZXBhcmUgdGhlIENvbnNlbnN1c0N1YmUgYXMgYSBudW1weSBjbG91ZCB3aXRoIGEgZm91cnRoIGZpZWxkIHRoYXQgc3BlY2lmaWVzIHRoZSBjb25zZW5zdXMgY291bnQgZm9yCiAgICAgICAgICAgICAgICAjIGVhY2ggcG9zc2libGUgdHJhbnNsYXRpb24KICAgICAgICAgICAgICAgIGlmIChkaXNwbGF5X3Bsb3Qgb3Igc2F2ZV9wbG90ICk6CiAgICAgICAgICAgICAgICAgICAgY29uc2Vuc3VzX2Nsb3VkW2l0ZXJhdGlvbl9jb3VudCwgOl0gPSAodHJhbnNsYXRpb25bMF0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNsYXRpb25bMV0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNsYXRpb25bMl0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc2Vuc3VzX2NvdW50KQoKICAgICAgICAgICAgICAgIGl0ZXJhdGlvbl9jb3VudCA9IGl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3QgKToKICAgICAgICAgICAgIyBzYXZlIHBsb3QgaW1hZ2UKICAgICAgICAgICAgZmlndXJlLnNhdmVmaWcgKHN0cigiZG9jcy9sb2dzL3Vub3JkZXJlZF9jdWJlX3NhdmVmaWxlcy8iICsgcGxvdF90aXRsZSArICIucG5nIiApLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9ybWF0PSdwbmcnLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgZHBpPTIyMCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJib3hfaW5jaGVzPSd0aWdodCcpCgogICAgICAgICAgICAjIHNhdmUgbnVtcHkgYXJyYXkgb2YgY3ViZQogICAgICAgICAgICBucC5zYXZlIChzdHIoImRvY3MvbG9ncy91bm9yZGVyZWRfY3ViZV9zYXZlZmlsZXMvIiArIHBsb3RfdGl0bGUgKSwKICAgICAgICAgICAgICAgIGRpc3BsYXlfY3ViZSwgYWxsb3dfcGlja2xlPUZhbHNlICkKCiAgICAgICAgICAgICMgc2F2ZSBhc2NpaSBjbG91ZCBvZiBjdWJlCiAgICAgICAgICAgIGlucHV0X291dHB1dC5zYXZlX2FzY2lpX2ZpbGUgKGRpc3BsYXlfY3ViZSwgWyJYIiwgIlkiLCAiWiIsICJDb25zZW5zdXMiXSwKICAgICAgICAgICAgICAgIHN0cigiZG9jcy9sb2dzL3Vub3JkZXJlZF9jdWJlX3NhdmVmaWxlcy8iICsgcGxvdF90aXRsZSArICIuYXNjIikpCgogICAgcmV0dXJuIGJlc3RfYWxpZ25tZW50LCBoaWdoZXN0X2NvbnNlbnN1c19jb3VudCwgYmVzdF9hbGlnbm1lbnRfY29uc2Vuc3VzX3ZlY3Rvcgo8fGZpbV9zdWZmaXh8PgogICAgICAgIGNvcnJlc3BvbmRpbmdfY2xvdWRfc2l6ZTogKGludCkgICAgICAgICAgICAgICAgIFBvaW50IE51bWJlciBvZiB0aGUgY2xvdWQgY29tcGFyZWQgaW4gYWNjdW11bGF0b3IgYWxnb3Jpd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0aW9uLicpCiAgICBvcHRpb25zLCBhcmdzID0gcGFyc2VyLnBhcnNlX2FyZ3MoKQoKICAgIHBhcmFtcyA9IHsgCiAgICAgICAgJ2JlZ2luJzogKHRpbWUudGltZSgpLShvcHRpb25zLmxhc3QqNjApKSoxMDAwLCAKICAgICAgICAjJ2VuZCc6IHRpbWUudGltZSgpKjEwMDAgIyBlbmQgaXMgb3B0aW9uYWwgLSBhcGkgd2lsbCBzZXQgdG8gbm93LgogICAgfQogICAgCiAgICBpZiBvcHRpb25zLmJhc2VyYXRlOgogICAgICAgIHByaW50ICdRdWVyeWluZyBiYXNlIHJhdGVzJwogICAgICAgIGtsYXNzID0gR2V0QnVsa0Jhc2VSYXRlCiAgICBlbHNlOgogICAgICAgIHByaW50ICdRdWVyeWluZyByYXcgZGF0YScKICAgICAgICBrbGFzcyA9IEdldEJ1bGtSYXdEYXRhCgogICAgYnVsayA9IGtsYXNzKG9wdGlvbnMudXJsLCB1c2VybmFtZT1vcHRpb25zLnVzZXIsIGFwaV9rZXk9b3B0aW9ucy5rZXkpCiAgICBwYXlsb2FkID0gYnVsay5nZXRfZGF0YShQQVRIUywgKipwYXJhbXMpCiAgICBwcmludCBwYXlsb2FkCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KCiAgICBmb3Igcm93IGluIHBheWxvYWQuZGF0YToKICAgICAgICBwcmludCAnIConLCByb3cKICAgICAgICBmb3IgZHAgaW4gcm93LmRhdGE6Cjx8ZmltX2VuZHw+
591dc42ad7c9a1b5540736647f851dfcc9f4687d-5
591dc42ad7c9a1b5540736647f851dfcc9f4687d
PHxmaW1fcHJlZml4fD4KIyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgoiIiIKRXhhbXBsZSBvbmUgb2ZmIHRvIHBsYXkgd2l0aC9naXZlIGV4YW1wbGUgb2YgYnVsayByZXRyaWV2YWwgaW50ZXJmYWNlLgoiIiIKCmltcG9ydCBvcwppbXBvcnQgc3lzCmltcG9ydCB0aW1l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gdGltZSwgc2luY2UKICAgICAgICAjIHN0YXJ0X3BvbGxpbmcoKSBpcyBub24tYmxvY2tpbmcgYW5kIHdpbGwgc3RvcCB0aGUgYm90IGdyYWNlZnVsbHkuCiAgICAgICAgc2VsZi51cGRhdGVyLmlkbGUoKQoKICAgIGRlZiBzaG93X2ltYWdlKHNlbGYsIHVwZGF0ZSwgY29udGV4dCk6CiAgICAgICAgZ2xvYmFsIGN1cl9kaXIKICAgICAgICBmcGF0aCA9IHN0cih1cGRhdGUubWVzc2FnZS50ZXh0KS5zcGxpdCgpCiAgICAgICAgICAgICMgZnBhdGhbMF0gOiAvc2VsZWN0CiAgICAgICAgIyBmcGF0aFsxXSA6IGRlc3RpbmF0aW9uCiAgICAgICAgZmxpc3QgPSBsaXN0KGN1cl9kaXIuZ2xvYignKiovJyArIGZwYXRoWzFdKSkKICAgICAgICBpZiBmbGlzdDoKICAgICAgICAgICAgY29udGV4dC5ib3Quc2VuZF9waG90byhjaGF0X2lkPXVwZGF0ZS5tZXNzYWdlLmNoYXRfaWQsIHBob3RvPW9wZW4oc3RyKGZsaXN0WzBdKSwgJ3JiJykpICAgIAogICAgCiAgICBkZWYgcm90OTAoc2VsZiwgdXBkYXRlLCBjb250ZXh0KToKICAgICAgICBnbG9iYWwgY3VyX2RpcgogICAgICAgIGZwYXRoID0gc3RyKHVwZGF0ZS5tZXNzYWdlLnRleHQpLnNwbGl0KCkKICAgICAgICAjIGZwYXRoWzBdIDogL3NlbGVjdAogICAgICAgICMgZnBhdGhbMV0gOiBkZXN0aW5hdGlvbgogICAgICAgIHBhc3MKCmRlZiBtYWluKCk6CiAgICBpbSA9IEltYWdlTWFuYWdlcigpCjx8ZmltX2hvbGV8PgppZiBfX25hbWVfXyA9PSAnX19tYWluX18nOgogICAgbWFpbigpCjx8ZmltX3N1ZmZpeHw+CiAgICBpbS5zdGFydF9wb2xsaW5nKCkKICAgIAo8fGZpbV9lbmR8Pg==
059333bd460a42f700b84f146e38638131915790-3
059333bd460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hbCBjdXJfZGlyCiAgICAgICAgZnBhdGggPSBzdHIodXBkYXRlLm1lc3NhZ2UudGV4dCkuc3BsaXQoKQogICAgICAgICAgICAjIGZwYXRoWzBdIDogL3NlbGVjdAogICAgICAgICMgZnBhdGhbMV0gOiBkZXN0aW5hdGlvbgogICAgICAgIGZsaXN0ID0gbGlzdChjdXJfZGlyLmdsb2IoJyoqLycgKyBmcGF0aFsxXSkpCiAgICAgICAgaWYgZmxpc3Q6CiAgICAgICAgICAgIGNvbnRleHQuYm90LnNlbmRfcGhvdG8oY2hhdF9pZD11cGRhdGUubWVzc2FnZS5jaGF0X2lkLCBwaG90bz1vcGVuKHN0cihmbGlzdFswXSksICdyYicpKSAgICAKICAgIAogICAgZGVmIHJvdDkwKHNlbGYsIHVwZGF0ZSwgY29udGV4dCk6CiAgICAgICAgZ2xvYmFsIGN1cl9kaXIKICAgICAgICBmcGF0aCA9IHN0cih1cGRhdGUubWVzc2FnZS50ZXh0KS5zcGxpdCgpCiAgICAgICAgIyBmcGF0aFswXSA6IC9zZWxlY3QKICAgICAgICAjIGZwYXRoWzFdIDogZGVzdGluYXRpb24KICAgICAgICBwYXNzCgpkZWYgbWFpbigpOgogICAgaW0gPSBJbWFnZU1hbmFnZXIoKQogICAgaW0uc3RhcnRfcG9sbGluZygpCiAgICAKaWYgX19uYW1lX18gPT0gJ19fbWFpbl9fJzoKICAgIG1haW4oKQo8fGZpbV9zdWZmaXh8PgpjdXJfZGlyID0gUGF0aCgiLi9pbWciKQpjdXJfZGlyID0gY3VyX2Rpci5yZXNvbHZlKCkKCmNsYXNzIEltYWdlTWFuYWdlcihvYmplY3QpOgo8fGZpbV9lbmR8Pg==
059333bd460a42f700b84f146e38638131915790-4
059333bd460a42f700b84f146e38638131915790
PHxmaW1fcHJlZml4fD4KaW1wb3J0IGxvZ2dpbmcKZnJvbSB0ZWxlZ3JhbS5leHQgaW1wb3J0IFVwZGF0ZXIsIENvbW1hbmRIYW5kbGVyLCBNZXNzYWdlS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lcmVuY2UsCiAgICAgICAgICAgICAgICAgZGlyTmFtZSwKICAgICAgICAgICAgICAgICBkYXRhc2V0c19rZXlzPVtUUkFJTiwgVkFMSURBVElPTl0sIAogICAgICAgICAgICAgICAgIGNyZWF0ZV9oZWF0bWFwPTAsCiAgICAgICAgICAgICAgICAgcGxvdF9vZmZzZXQ9MCk6CgogICAgICAgIGRpck5hbWUgPSBkaXJOYW1lICsgJy9wY2FfbGF0ZW50JyAgICAgICAgCiAgICAgICAgIyBmaWxlTmFtZSBzaG91bGQgYmUgc2V0IGJlZm9yZSBjYWxsaW5nIHN1cGVyKCkKICAgICAgICAjc2VsZi5fZmlsZU5hbWUgPSAiUENBIGxhdGVudCAtIiArIHNlbGYubmV0d29ya19uYW1lICsgIi1udW1faW1hZ2VzLSIgKyBzdHIobl9pbWFnZXMpCiAgICAgICAgI3NlbGYuX2ZpbGVIZWFkZXIgPSAnIyBmcmVjaGV0X2luY2VwdGlvbl9kaXN0YW5jZSwgbmV0d29yayA9ICcgKyBzZWxmLm5ldHdvcmtfbmFtZSArICcsIG51bSBpbWFnZXMgPSAnICsgc3RyKG5faW1hZ2VzKSArICdcbicKICAgICAgICAjc2VsZi5fZmlsZUhlYWRlciArPSAnIyBwZXJpb2QgXHQgZmlkX3RyYWluIFx0IGZpZF92YWxpZGF0aW9uIFx0IHRpbWVfc2VjJwoKICAgICAgICBzdXBlcigpLl9faW5pdF9fKG1vZGVsLAogICAgICAgICAgICAgICAgICAgICAgICAgcGVyaW9kLAogICAgICAgICAgICAgICAgICAgICAgICAgdGltZV9yZWZlcmVuY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhc2V0c19rZXlzLAogICAgICAgICAgICAgICAgICAgICAgICAgZGlyTmFtZT1kaXJOYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgcGxvdF9vZmZzZXQ9cGxvdF9vZmZzZXQpCgogICAgICAgIHNlbGYuX2hhbmRsZSA9IG1vZGVsLmRzX2hhbmRsZQogICAgIC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Ht9CiAgICAgICAgc2VsZi5zaWdtYSA9IHt9CgogICAgICAgIGZvciBkc19rZXkgaW4gc2VsZi5fZGF0YXNldHNfa2V5czoKCiAgICAgICAgICAgIHNlbGYuY29uY2F0X29wc1tkc19rZXldID0ge30KICAgICAgICAgICAgc2VsZi5jb25jYXRfdXBkYXRlX29wc1tkc19rZXldID0ge30KICAgICAgICAgICAgc2VsZi5jb25jYXRfcmVzZXRfb3BzW2RzX2tleV0gPSB7fQogICAgICAgICAgICBzZWxmLnNpZ21hW2RzX2tleV0gPSB7fQoKICAgICAgICAgICAgIyBldmVyeSBob29rIG5lZWRzIHRvIGhhdmUgaXRzIG93biBhY2N1bXVsYXRvciB0byBub3QgaGF2ZSBwcm9ibGVtIG9mIGVyYXNpbmcgbWVtb3J5IHRoYXQgb3RoZXIgaG9va3Mgc3RpbGwgbmVlZHMKICAgICAgICAgICAgIyBtYXliZSBtZW1vcnkgb2NjdXBhdGlvbiBjb3VsZCBiZSBpbXByb3ZlZCBpZiByZWFsbHkgbmVlZGVkLCBidXQgZ3JlYXQgdHJvdWJsZXMgZm9yIGNvbmN1cnJlbmN5IGluIHBhcmFsbGVsIGV4ZWN1dGlvbgogICAgICAgICAgICBzY29wZSA9IHNlbGYuX2hvb2tfbmFtZSsiLyIrIGRzX2tleSArICJfY29uY2F0X21ldHJpYy8iCgogICAgICAgICAgICAjd2l0aCB0Zi52YXJpYWJsZV9zY29wZShzY29wZSkgYXMgc2NvcGU6CgogICAgICAgICAgICBmb3IgKHRlbnNvciwgdGVuc29yX25hbWUpICBpbiB6aXAoc2VsZi5fdGVuc29ycywgc2VsZi5fdGVuc29yc19uYW1lcyk6CgogICAgICAgICAgICAgICAgZGltID0gdGVuc29yLnNoYXBlLmFzX2xpc3QoKVsxXQoKICAgICAgICAgICAgICAgIHNlbGYuY29uY2F0X29wc1tkc19rZXldW3RlbnNvcl9uYW1lXSxcCiAgICAgICAgICAgICAgICAgICAgc2VsZi5jb25jYXRfdXBkYXRlX29w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fb3BzID0ge30KCiAgICAgICAgZm9yIGRzX2tleSBpbiBzZWxmLl9kYXRhc2V0c19rZXlzOgogICAgICAgICAgICAjaW1hZ2VzID0gc2VsZi5faW1hZ2VzW2RzX2tleV1bMV0KCiAgICAgICAgICAgIHNlc3Npb24gPSBydW5fY29udGV4dC5zZXNzaW9uCiAgICAgICAgICAgIGRhdGFzZXRfaW5pdGlhbGl6ZXIgPSBzZWxmLl9kc19pbml0aWFsaXplcnNbZHNfa2V5XQoKICAgICAgICAgICAgI2ZvciB0ZW5zb3JfbmFtZSBpbiBzZWxmLl90ZW5zb3JzX25hbWVzOgogICAgICAgICAgICBzZXNzaW9uLnJ1bihbZGF0YXNldF9pbml0aWFsaXplcl0gKyBbKnNlbGYuY29uY2F0X3Jlc2V0X29wc1tkc19rZXldLnZhbHVlcygpXSkKCiAgICAgICAgICAgIHdoaWxlIFRydWU6CiAgICAgICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi5ydW4oWypzZWxmLmNvbmNhdF91cGRhdGVfb3BzW2RzX2tleV0udmFsdWVzKCldLCBmZWVkX2RpY3QgPSB7c2VsZi5faGFuZGxlOiBzZWxmLl9kc19oYW5kbGVzW2RzX2tleV0gfSkgIyAqKmZlZWRfZGljdCwKICAgICAgICAgICAgICAgIGV4Y2VwdCB0Zi5lcnJvcnMuT3V0T2ZSYW5nZUVycm9yOgogICAgICAgICAgICAgICAgICAgIGJyZWFrCgogICAgICAgICAgICByZXR1cm5zID0gc2Vzc2lvbi5ydW4oWypzZWxmLnNpZ21hW2RzX2tleV0udmFsdWVzKCldKQogICAgICAgICAgICBzZWxmLl90ZW5zb3JzX3ZhbHVlc1sic2lnbWEiXVtkc19rZXldID0gZGljdCh6aXAoc2VsZi5zaWdtYVtkc19rZXldLmtleXMoKSxyZXR1cm5zKSkKCiAgICAgICAgICAgIHJldHVybnMgPSBzZXNzaW9uLnJ1bihbKnNlbGYuY29uY2F0X29wc1tkc19rZXldLnZ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jaGV0X2luY2VwdGlvbl9kaXN0YW5jZSwgbmV0d29yayA9ICcgKyBzZWxmLm5ldHdvcmtfbmFtZSArICcsIG51bSBpbWFnZXMgPSAnICsgc3RyKG5faW1hZ2VzKSArICdcbicKICAgICAgICAjc2VsZi5fZmlsZUhlYWRlciArPSAnIyBwZXJpb2QgXHQgZmlkX3RyYWluIFx0IGZpZF92YWxpZGF0aW9uIFx0IHRpbWVfc2VjJwoKICAgICAgICBzdXBlcigpLl9faW5pdF9fKG1vZGVsLAogICAgICAgICAgICAgICAgICAgICAgICAgcGVyaW9kLAogICAgICAgICAgICAgICAgICAgICAgICAgdGltZV9yZWZlcmVuY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhc2V0c19rZXlzLAogICAgICAgICAgICAgICAgICAgICAgICAgZGlyTmFtZT1kaXJOYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgcGxvdF9vZmZzZXQ9cGxvdF9vZmZzZXQpCgogICAgICAgIHNlbGYuX2hhbmRsZSA9IG1vZGVsLmRzX2hhbmRsZQogICAgICAgIHNlbGYuX2RzX2luaXRpYWxpemVycyA9IG1vZGVsLmRhdGFzZXRzX2luaXRpYWxpemVycwogICAgICAgIHNlbGYuX2RzX2hhbmRsZXNfbm9kZXMgPSBtb2RlbC5kYXRhc2V0c19oYW5kbGVzX25vZGVzCgogICAgICAgICNzc2VsZi5fcGVyaW9kID0gcGVyaW9kCgogICAgICAgIHNlbGYuX3RlbnNvcnMgPSB0ZW5zb3JzCiAgICAgICAgc2VsZi5fdGVuc29yc19uYW1lcyA9IHRlbnNvcnNfbmFtZXMKICAgICAgICBzZWxmLl9jcmVhdGVfaGVhdG1hcCA9IGNyZWF0ZV9oZWF0bWFwID09IDEKCiAgICAgICAgI2ltYWdlcyA9IHtkc19rZXkgOiAoaW5kZXhfbGlzdCwgbW9kZWwuZGF0YXNldC5nZXRfZWxlbWVudHMoaW5kZXhfbGlzdCwgZHNfa2V5KSkgXAogICAgICAgICMgICAg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19rZXldID0ge30KICAgICAgICAgICAgc2VsZi5jb25jYXRfdXBkYXRlX29wc1tkc19rZXldID0ge30KICAgICAgICAgICAgc2VsZi5jb25jYXRfcmVzZXRfb3BzW2RzX2tleV0gPSB7fQogICAgICAgICAgICBzZWxmLnNpZ21hW2RzX2tleV0gPSB7fQoKICAgICAgICAgICAgIyBldmVyeSBob29rIG5lZWRzIHRvIGhhdmUgaXRzIG93biBhY2N1bXVsYXRvciB0byBub3QgaGF2ZSBwcm9ibGVtIG9mIGVyYXNpbmcgbWVtb3J5IHRoYXQgb3RoZXIgaG9va3Mgc3RpbGwgbmVlZHMKICAgICAgICAgICAgIyBtYXliZSBtZW1vcnkgb2NjdXBhdGlvbiBjb3VsZCBiZSBpbXByb3ZlZCBpZiByZWFsbHkgbmVlZGVkLCBidXQgZ3JlYXQgdHJvdWJsZXMgZm9yIGNvbmN1cnJlbmN5IGluIHBhcmFsbGVsIGV4ZWN1dGlvbgogICAgICAgICAgICBzY29wZSA9IHNlbGYuX2hvb2tfbmFtZSsiLyIrIGRzX2tleSArICJfY29uY2F0X21ldHJpYy8iCgogICAgICAgICAgICAjd2l0aCB0Zi52YXJpYWJsZV9zY29wZShzY29wZSkgYXMgc2NvcGU6CgogICAgICAgICAgICBmb3IgKHRlbnNvciwgdGVuc29yX25hbWUpICBpbiB6aXAoc2VsZi5fdGVuc29ycywgc2VsZi5fdGVuc29yc19uYW1lcyk6CgogICAgICAgICAgICAgICAgZGltID0gdGVuc29yLnNoYXBlLmFzX2xpc3QoKVsxXQoKICAgICAgICAgICAgICAgIHNlbGYuY29uY2F0X29wc1tkc19rZXldW3RlbnNvcl9uYW1lXSxcCiAgICAgICAgICAgICAgICAgICAgc2VsZi5jb25jYXRfdXBkYXRlX29wc1tkc19rZXldW3RlbnNvcl9uYW1lXSxcCiAgICAgICAgICAgICAgICAgICAgc2VsZi5jb25jYXRfcmVzZXRfb3BzW2RzX2tleV1bdGVuc29yX25hbWVdID0gY3JlYXRlX2NvbmN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iAgICAgICAgICAgIHNlc3Npb24gPSBydW5fY29udGV4dC5zZXNzaW9uCiAgICAgICAgICAgIGRhdGFzZXRfaW5pdGlhbGl6ZXIgPSBzZWxmLl9kc19pbml0aWFsaXplcnNbZHNfa2V5XQoKICAgICAgICAgICAgI2ZvciB0ZW5zb3JfbmFtZSBpbiBzZWxmLl90ZW5zb3JzX25hbWVzOgogICAgICAgICAgICBzZXNzaW9uLnJ1bihbZGF0YXNldF9pbml0aWFsaXplcl0gKyBbKnNlbGYuY29uY2F0X3Jlc2V0X29wc1tkc19rZXldLnZhbHVlcygpXSkKCiAgICAgICAgICAgIHdoaWxlIFRydWU6CiAgICAgICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICAgICAgc2Vzc2lvbi5ydW4oWypzZWxmLmNvbmNhdF91cGRhdGVfb3BzW2RzX2tleV0udmFsdWVzKCldLCBmZWVkX2RpY3QgPSB7c2VsZi5faGFuZGxlOiBzZWxmLl9kc19oYW5kbGVzW2RzX2tleV0gfSkgIyAqKmZlZWRfZGljdCwKICAgICAgICAgICAgICAgIGV4Y2VwdCB0Zi5lcnJvcnMuT3V0T2ZSYW5nZUVycm9yOgogICAgICAgICAgICAgICAgICAgIGJyZWFrCgogICAgICAgICAgICByZXR1cm5zID0gc2Vzc2lvbi5ydW4oWypzZWxmLnNpZ21hW2RzX2tleV0udmFsdWVzKCldKQogICAgICAgICAgICBzZWxmLl90ZW5zb3JzX3ZhbHVlc1sic2lnbWEiXVtkc19rZXldID0gZGljdCh6aXAoc2VsZi5zaWdtYVtkc19rZXldLmtleXMoKSxyZXR1cm5zKSkKCiAgICAgICAgICAgIHJldHVybnMgPSBzZXNzaW9uLnJ1bihbKnNlbGYuY29uY2F0X29wc1tkc19rZXldLnZhbHVlcygpXSkKICAgICAgICAgICAgY29uY2F0X29wc1tkc19rZXldID0gZGljdCh6aXAoc2VsZi5jb25jYXRfb3BzW2RzX2tleV0ua2V5cygpLHJldHVybnMpKQoKICAgICAgICAgICAgI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G9tPTApCiAgICAgICAgI3BsdC54dGlja3MobnAuYXJhbmdlKDEsbGVuKHNpZ21hKSsxKSkKICAgICAgICBwbHQubGVnZW5kKCkKCiAgICAgICAgZmlsZU5hbWUgPSAicGNhXyIgKyBzZWxmLl90aW1lX3JlZmVyZW5jZV9zdHIgKyAiXyIgKyBzdHIoc2VsZi5fdGltZV9yZWYpLnpmaWxsKDQpCgogICAgICAgIHBsdC5zYXZlZmlnKHNlbGYuX2Rpck5hbWUgKyAnLycgKyBmaWxlTmFtZSArICcucG5nJykgIyAsIGJib3hfaW5jaGVzPSd0aWdodCcKICAgICAgICBwbHQuY2xvc2UoKQoKICAgICAgICBpZiBzZWxmLl9jcmVhdGVfaGVhdG1hcDoKICAgICAgICAgICAgc2VsZi5fcGxvdF9oZWF0bWFwKCkKICAgICAgICAgICAgCiAgICBkZWYgX3Bsb3RfaGVhdG1hcChzZWxmKToKICAgICAgICBmb3IgdGVuc29yX25hbWUgaW4gc2VsZi5fdGVuc29yc19uYW1lczoKICAgICAgICAgICAgZm9yIGRzX2tleSBpbiBzZWxmLl9kYXRhc2V0c19rZXlzOgogICAgICAgICAgICAgICAgZmlsZW5hbWVzID0gc29ydGVkKGdsb2IuZ2xvYigKICAgICAgICAgICAgICAgICAgICBzZWxmLl9kaXJOYW1lICsgIi9wY2FfIiArIHRlbnNvcl9uYW1lICsgIl8iICsgc3RyKGRzX2tleSkgKyAiXyIgKyBzZWxmLl90aW1lX3JlZmVyZW5jZV9zdHIgKyAiXyoudHh0IikpCiAgICAgICAgICAgICAgICByZWNvcmRlZF9zdGVwcyA9IFt0LnNwbGl0KCJfIilbLTFdWzotNF0gZm9yIHQgaW4gZmlsZW5hbWVzXQoKICAgICAgICAgICAgICAgIGVpZ2VudmFsc19hbGxfZXBvY2hzID0gW10KICAgICAgICAgICAgICAgIGZvciBmaWxlbmFtZSBpbiBmaWxlbmFtZXM6CiAgICAgICAgICAgICAgICAgICAgZWlnZW52YWxzID0gbnAubG9hZHR4dCh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FZBTElEQVRJT04gIywgVEVTVCwgY2hlY2tzX2RhdGFzZXRfa2V5c19ub3RfbG9vcCwKZnJvbSBkYXRhc2V0cy5EYXRhc2V0IGltcG9ydCBsaW5lc3R5bGVfZGF0YXNldAoKCmNsYXNzIFBDQUxhdGVudFZhcmlhYmxlc0hvb2soRXZlcnlORXBvY2hzVEZNb2RlbEhvb2spOgoKICAgIGRlZiBfX2luaXRfXyhzZWxmLAogICAgICAgICAgICAgICAgIG1vZGVsLAogICAgICAgICAgICAgICAgIHRlbnNvcnMsCiAgICAgICAgICAgICAgICAgdGVuc29yc19uYW1lcywKICAgICAgICAgICAgICAgICBwZXJpb2QsCiAgICAgICAgICAgICAgICAgdGltZV9yZWZlcmVuY2UsCiAgICAgICAgICAgICAgICAgZGlyTmFtZSwKICAgICAgICAgICAgICAgICBkYXRhc2V0c19rZXlzPVtUUkFJTiwgVkFMSURBVElPTl0sIAogICAgICAgICAgICAgICAgIGNyZWF0ZV9oZWF0bWFwPTAsCiAgICAgICAgICAgICAgICAgcGxvdF9vZmZzZXQ9MCk6CgogICAgICAgIGRpck5hbWUgPSBkaXJOYW1lICsgJy9wY2FfbGF0ZW50JyAgICAgICAgCiAgICAgICAgIyBmaWxlTmFtZSBzaG91bGQgYmUgc2V0IGJlZm9yZSBjYWxsaW5nIHN1cGVyKCkKICAgICAgICAjc2VsZi5fZmlsZU5hbWUgPSAiUENBIGxhdGVudCAtIiArIHNlbGYubmV0d29ya19uYW1lICsgIi1udW1faW1hZ2VzLSIgKyBzdHIobl9pbWFnZXMpCiAgICAgICAgI3NlbGYuX2ZpbGVIZWFkZXIgPSAnIyBmcmVjaGV0X2luY2VwdGlvbl9kaXN0YW5jZSwgbmV0d29yayA9ICcgKyBzZWxmLm5ldHdvcmtfbmFtZSArICcsIG51bSBpbWFnZXMgPSAnICsgc3RyKG5faW1hZ2VzKSArICdcbicKICAgICAgICAjc2VsZi5fZmlsZUhlYWRlciArPSAnIyBwZXJpb2QgXHQgZmlkX3RyYWluIFx0IGZpZF92YWxpZGF0aW9uIFx0IHRpbWVfc2VjJwoKICAgICAgICBzdXBlcigpLl9faW5pdF9fKG1vZGVsLAogICAgICAgICAgICAgICAgICAgICAgICAgcGVyaW9kLAogICAgICAgICAgICAgICAgICAgICAgICAgdGltZV9yZWZlcmVuY2UsCiAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhc2V0c19rZXlzLAogICAgICAgICAgICAgICAgICAgICAgICAgZGlyTmFtZT1kaXJOYW1lLAogICAgICAgICAgICAgICAgICAgICAgICAgcGxvdF9vZmZzZXQ9cGxvdF9vZmZzZXQpCgogICAgICAgIHNlbGYuX2hhbmRsZSA9IG1vZGVsLmRzX2hhbmRsZQogICAgICAgIHNlbGYuX2RzX2luaXRpYWxpemVycyA9IG1vZGVsLmRhdGFzZXRzX2luaXRpYWxpemVycwogICAgICAgIHNlbGYuX2RzX2hhbmRsZXNfbm9kZXMgPSBtb2RlbC5kYXRhc2V0c19oYW5kbGVzX25vZGVzCgogICAgICAgICNzc2VsZi5fcGVyaW9kID0gcGVyaW9kCgogICAgICAgIHNlbGYuX3RlbnNvcnMgPSB0ZW5zb3JzCiAgICAgICAgc2VsZi5fdGVuc29yc19uYW1lcyA9IHRlbnNvcnNfbmFtZXMKICAgICAgICBzZWxmLl9jcmVhdGVfaGVhdG1hcCA9IGNyZWF0ZV9oZWF0bWFwID09IDEKCiAgICAgICAgI2ltYWdlcyA9IHtkc19rZXkgOiAoaW5kZXhfbGlzdCwgbW9kZWwuZGF0YXNldC5nZXRfZWxlbWVudHMoaW5kZXhfbGlzdCwgZHNfa2V5KSkgXAogICAgICAgICMgICAgICAgICAgICAgICAgICAgIGZvciAoZHNfa2V5LCBpbmRleF9saXN0KSBpbiBpbWFnZXNfaW5kZXhlcy5pdGVtcygpfQoKICAgICAgICAjY2hlY2tfZGF0YXNldF9rZXlzX25vdF9sb29wKGxpc3QoaW1hZ2VzLmtleXMoKSkpCgogICAgICAgICNzZWxmLl9pbWFnZXM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bmNlIG1hdHJpeCBpbiBURiwKICAgICAgICAgICAgIyBzaW5jZSBJIGNhbm5vdCBlYXNpbHkga25vdyBhdCBydW50aW1lIHRoZSBudW1iZXIgb2YgcG9pbnRzLgogICAgICAgICAgICAjIHNlZSB0aGUgY29tbWVudCBpbiB1dGlscy50Zl9jb3ZfdGltZV9uX3BvaW50cyAoTHVpZ2kpCiAgICAgICAgICAgICMgdG8gc29sdmUgdGhpcyBpc3N1ZSwgSSBnZXQgdGhlIG51bWJlciBvZiBwb2ludHMgZnJvbSB0aGUgbGVuIG9mIHRoZSBjb25jYXRfb3Agbm9kZQogICAgICAgICAgICBmb3IgdGVuc29yX25hbWUgaW4gc2VsZi5fdGVuc29yc19uYW1lczoKICAgICAgICAgICAgICAgIHNlbGYuX3RlbnNvcnNfdmFsdWVzWyJzaWdtYSJdW2RzX2tleV1bdGVuc29yX25hbWVdIC89IGxlbihjb25jYXRfb3BzW2RzX2tleV1bdGVuc29yX25hbWVdKQoKICAgICAgICAjIHNhdmUgdG8gdHh0IGZpbGUKICAgICAgICBmb3IgaiwgdGVuc29yX25hbWUgaW4gZW51bWVyYXRlKHNlbGYuX3RlbnNvcnNfbmFtZXMpOgogICAgICAgICAgICBmb3IgZHNfa2V5IGluIHNlbGYuX2RhdGFzZXRzX2tleXM6CiAgICAgICAgICAgICAgICBzaWdtYSA9IHNlbGYuX3RlbnNvcnNfdmFsdWVzWyJzaWdtYSJdW2RzX2tleV1bdGVuc29yX25hbWVdCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIGZpbGVOYW1lID0gInBjYV8iICsgdGVuc29yX25hbWUgKyAiXyIgKyBzdHIoZHNfa2V5KSArICJfIiArIHNlbGYuX3RpbWVfcmVmZXJlbmNlX3N0ciArICJfIiArIHN0cihzZWxmLl90aW1lX3JlZikuemZpbGwoNCkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgIyBzYXZlIHR4dCBmaWxlCiAgICAgICAgICAgICAgICBkYXRhID0g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Xh8PgoKZGVmIHNhdmVfY29uZmlnKGNvbmZpZywgbG9nZGlyKToKICAiIiJTYXZlIGEgbmV3IGNvbmZpZ3VyYXRpb24gYnkgbmFtZS4KCjx8ZmltX2VuZHw+
59e8d669f9d838ce08d44c1d1fbedb4bad488ff6-1
59e8d669f9d838ce08d44c1d1fbedb4bad488ff6
PHxmaW1fcHJlZml4fD4KIyBPcmRlciB0aGUgaW5wdXQgc3RyaW5nIGJ5IEFTQyAoYSAtPiB6LCAwIC0+IDkpIHdpdGggYW55IHN0cmluZwoKYSA9IGlucHV0KCJuaGFwIHZhbyBjaHVvaTogIikKbnVtYmVyID0gIiIKY2h1ID0gIiIKZm9yIHggaW4gYToKICAgIGlmICh4LmlzbnVtZXJpYygpKTogIyBraWVtIHRyYSBsYSBzbyBoYXkga2hvbmcKICAgICAgICBudW1iZXIgKz0geAogICAgZWxzZToKICAgICAgICBjaHUgKz0geAo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CmIgPSAnJy5qb2luKHNvcnRlZChzdHIobnVtYmVyKSkpCmMgPSAnJy5qb2luKHNvcnRlZChzdHIoY2h1KSkpCmNodW9pID0gYytiCnByaW50KCJjaHVvaSBzYXUga2hpIHNhcCB4ZXA6ICIgKyBjaHVvaSkKPHxmaW1fZW5kfD4=
59e8d669f9d838ce08d44c1d1fbedb4bad488ff6-2
59e8d669f9d838ce08d44c1d1fbedb4bad488ff6
PHxmaW1fcHJlZml4fD4KIyBPcmRlciB0aGUgaW5wdXQgc3RyaW5nIGJ5IEFTQyAoYSAtPiB6LCAwIC0+IDkpIHdpdGggYW55IHN0cmluZwoKYSA9IGlucHV0KCJuaGFwIHZhbyBjaHVvaTogIikKbnVtYmVyID0gIiIKY2h1ID0gIiIKZm9yIHggaW4gYToKICAgIGlmICh4LmlzbnVtZXJpYygpKTogIyBraWVtIHRyYSBsYSBzbyBoYXkga2hvbmcKPHxmaW1faG9sZXw+CiAgICBlbHNlOgogICAgICAgIGNodSArPSB4CmIgPSAnJy5qb2luKHNvcnRlZChzdHIobnVtYmVyKSkpCmMgPSAnJy5qb2luKHNvcnRlZChzdHIoY2h1KSkpCmNodW9pID0gYytiCnByaW50KCJjaHVvaSBzYXUga2hpIHNhcCB4ZXA6ICIgKyBjaHVvaSkKPHxmaW1fc3VmZml4fD4KICAgICAgICBudW1iZXIgKz0geAo8fGZpbV9lbmR8Pg==
59e8d669f9d838ce08d44c1d1fbedb4bad488ff6-3
59e8d669f9d838ce08d44c1d1fbedb4bad488ff6
PHxmaW1fcHJlZml4fD4KIyBPcmRlciB0aGUgaW5wdXQgc3RyaW5nIGJ5IEFTQyAoYSAtPiB6LCAwIC0+IDkpIHdpdGggYW55IHN0cmluZwoKYSA9IGlucHV0KCJuaGFwIHZhbyBjaHVvaTogIikKbnVtYmVyID0gIiIKY2h1ID0gIiIKZm9yIHggaW4gYToKICAgIGlmICh4LmlzbnVtZXJpYygpKTogIyBraWVtIHRyYSBsYSBzbyBoYXkga2hvbmcKICAgICAgICBudW1iZXIgKz0geAogICAgZWxzZToKICAgICAgICBjaHUgKz0geApiID0gJycuam9pbihzb3J0ZWQoc3RyKG51bWJlcikpKQpjID0gJycuam9pbihzb3J0ZWQoc3RyKGNodSkpKQo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CmNodW9pID0gYytiCnByaW50KCJjaHVvaSBzYXUga2hpIHNhcCB4ZXA6ICIgKyBjaHVvaSkKPHxmaW1fZW5kfD4=
59e8d669f9d838ce08d44c1d1fbedb4bad488ff6-4
59e8d669f9d838ce08d44c1d1fbedb4bad488ff6
PHxmaW1fcHJlZml4fD4KIyBPcmRlciB0aGUgaW5wdXQgc3RyaW5nIGJ5IEFTQyAoYSAtPiB6LCAwIC0+IDkpIHdpdGggYW55IHN0cmluZwoKYSA9IGlucHV0KCJuaGFwIHZhbyBjaHVvaTogIikKbnVtYmVyID0gIiIKPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgpjaHUgPSA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Rlc3QKCl9fYWxsX18gPSBbCiAgICAiVGVzdCIsCjx8ZmltX2VuZHw+
e618fa22d35d67bb40f224119079c224071e18e5-2
e618fa22d35d67bb40f224119079c224071e18e5
PHxmaW1fcHJlZml4fD4KZnJvbSBvdXRwdXQubW9kZWxzLnN1bl9kYXRhLnN0eXBlLnN0X2ZhY2V0cy5zdF9mYWNldHMwMDExOW0uc3RfZmFjZXRzMDAxMTltX3hzZC5zdF9mYWNldHMwMDExOW0gaW1wb3J0IFRlc3QKCl9fYWxsX18gPSBbCiAgICAiVGVzdCIsCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KXQo8fGZpbV9lbmR8Pg==
e618fa22d35d67bb40f224119079c224071e18e5-3
e618fa22d35d67bb40f224119079c224071e18e5
PHxmaW1fcHJlZml4fD4KZnJvbSBvdXRwdXQubW9kZWxzLnN1bl9kYXRhLnN0eXBlLnN0X2ZhY2V0cy5zdF9mYWNldHMwMDExOW0uc3RfZmFjZXRzMDAxMTltX3hzZC5zdF9mYWNldHMwMDExOW0gaW1wb3J0IFRlc3QKCl9fYWxsX18gPSBbCiAgICAiVGVzdCIsCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KXQo8fGZpbV9lbmR8Pg==