id
stringlengths
42
42
src_hexsha
stringlengths
40
40
example
stringlengths
80
1.37M
a597bff5209236310a9049082453ed1d079bb226-3
a597bff5209236310a9049082453ed1d079bb226
PHxmaW1fcHJlZml4fD4KZnJvbSBldmFsbWF0ZSBpbXBvcnQgY29uZnVzaW9uCgppbXBvcnQgcHl0ZXN0Cjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KCgpAcHl0ZXN0LmZpeHR1cmUKZGVmIHNhbXBsZV9jb25mdXNpb24oKToKPHxmaW1fZW5kfD4=
a597bff5209236310a9049082453ed1d079bb226-4
a597bff5209236310a9049082453ed1d079bb226
PHxmaW1fcHJlZml4fD4KZnJvbSBldmFsbWF0ZSBpbXBvcnQgY29uZnVzaW9uCgppbXBvcnQgcHl0ZXN0CgoKQHB5dGVzdC5maXh0dXJlCmRlZiBzYW1wbGVfY29uZnVzaW9uKCk6CiAgICBjbGFzcyBDb25mTW9jayhjb25mdXNpb24uQ29uZnVzaW9uKToKCiAgICAgICAgQHByb3BlcnR5CiAgICAgICAgZGVmIGNvcnJlY3Qoc2VsZik6CiAgICAgICAgICAgIHJldHVybiAxOS45CgogICAgICAgIEBwcm9wZXJ0eQogICAgICAgIGRlZiBpbnNlcnRpb25zKHNlbGYpOgogICAgICAgICAgICByZXR1cm4gMjguMgoKICAgICAgICBAcHJvcGVydHkKICAgICAgICBkZWYgZGVsZXRpb25zKHNlbGYpOgogICAgICAgICAgICByZXR1cm4gMTIuMzkKCiAgICAgICAgQHByb3BlcnR5CiAgICAgICAgZGVmIHN1YnN0aXR1dGlvbnMoc2VsZik6CiAgICAgICAgICAgIHJldHVybiAxMy4xCgogICAgICAgIEBwcm9wZXJ0eQogICAgICAgIGRlZiBzdWJzdGl0dXRpb25zX291dChzZWxmKToKICAgICAgICAgICAgcmV0dXJuIDIxLjkKCiAgICByZXR1cm4gQ29uZk1vY2soKQoKCmNsYXNzIFRlc3RDb25mdXNpb246CgogICAgZGVmIHRlc3RfdG90YWwoc2VsZiwgc2FtcGxlX2NvbmZ1c2lvbik6CiAgICAgICAgYXNzZXJ0IHNhbXBsZV9jb25mdXNpb24udG90YWwgPT0gcHl0ZXN0LmFwcHJveCgxOS45ICsgMTIuMzkgKyAxMy4xKQo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CgogICAgZGVmIHRlc3RfZmFsc2VfbmVnYXRpdmVzKHNlbGYsIHNhbXBsZV9jb25mdXNpb24pOgogICAgICAgIGFzc2VydCBzYW1wbGVfY29uZnVzaW9uLmZhbHNlX25lZ2F0aXZlcyA9PSBweXRlc3QuYXBwcm94KDEyLjM5ICsgMTMuMSkKCjx8ZmltX2VuZHw+
a597bff5209236310a9049082453ed1d079bb226-5
a597bff5209236310a9049082453ed1d079bb226
PHxmaW1fcHJlZml4fD4KZnJvbSBldmFsbWF0ZSBpbXBvcnQgY29uZnVzaW9uCgppbXBvcnQgcHl0ZXN0CgoKQHB5dGVzdC5maXh0dXJlCmRlZiBzYW1wbGVfY29uZnVzaW9uKCk6CiAgICBjbGFzcyBDb25mTW9jayhjb25mdXNpb24uQ29uZnVzaW9uKToKCiAgICAgICAgQHByb3BlcnR5CiAgICAgICAgZGVmIGNvcnJlY3Qoc2VsZik6CiAgICAgICAgICAgIHJldHVybiAxOS45CgogICAgICAgIEBwcm9wZXJ0eQogICAgICAgIGRlZiBpbnNlcnRpb25zKHNlbGYpOgogICAgICAgICAgICByZXR1cm4gMjguMgoKICAgICAgICBAcHJvcGVydHkKICAgICAgICBkZWYgZGVsZXRpb25zKHNlbGYpOgogICAgICAgICAgICByZXR1cm4gMTIuMzkKCiAgICAgICAgQHByb3BlcnR5CiAgICAgICAgZGVmIHN1YnN0aXR1dGlvbnMoc2VsZik6CiAgICAgICAgICAgIHJldHVybiAxMy4xCgogICAgICAgIEBwcm9wZXJ0eQogICAgICAgIGRlZiBzdWJzdGl0dXRpb25zX291dChzZWxmKToKICAgICAgICAgICAgcmV0dXJuIDIxLjkKCiAgICByZXR1cm4gQ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mFsc2UsIkNhdGVnb3J5L0xvY2F0aW9uIElEIGlzIGludmFsaWQgaW4gdGhlIGZpbGUgYXQgcm93IDoge30iLmZvcm1hdChyb3dfbnVtKSkJCgkJCQkKCQkJcm93X251bSArPSAxCQoJCQoJCXJldHVybiAoVHJ1ZSxtYWluX2xpc3QpCQo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CgojPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KIyBDaGVjayBpZiB0aGUgZHVwbGljYXRlIHNlcnZlcl9kZXRhaWxzCiM9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQo8fGZpbV9lbmR8Pg==
3c3b08ccef7653236fc6d392ea04cd514c5068d1-2
3c3b08ccef7653236fc6d392ea04cd514c5068d1
PHxmaW1fcHJlZml4fD4KZnJvbSBwb3J0YWwubW9kZWxzIGltcG9ydCAqCmltcG9ydCBqc29uLCBvcywgc3lzLCBjc3YKCmRlZiByZWxvYWRfc2Vzc2lvbl92YWx1ZXMocGFyYW1zKToKCQoJdXNlciA9IFNpZ25pbl90Ymwub2JqZWN0cy5nZXQoCgkJCXVzZXJuYW1lX19pZXhhY3QgPSBwYXJhbXMuc2Vzc2lvblsndXNlcm5hbWUnXQoJCSkKCQkKCWxvY2F0aW9uX2lkeCA9IHVzZXIubG9jYXRpb24uYWxsKCkJCgkKCWxvY2F0aW9uX25hbWVzID0gW2wubmFtZSBmb3IgbCBpbiBsb2NhdGlvbl9pZHhdCglsb2NhdGlvbl9pZHMgPSBbc3RyKGwuaWQpIGZvciBsIGluIGxvY2F0aW9uX2lkeF0KCglwYXJhbXMuc2Vzc2lvblsnZmlyc3RuYW1lJ10gPSB1c2VyLmZpcnN0bmFtZS50aXRsZSgpCglwYXJhbXMuc2Vzc2lvblsnb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T09PT09PT09PT0KCQkKZGVmIGNoZWNrX2lwYWRkcmVzcyhpcGFkZHJlc3MpOgoJaWYgaXBhZGRyZXNzLnN0cmlwKCkhPSIiOgoJCXRyeToKCQkJc2VydmVyID0gU2VydmVyX3RibC5vYmplY3RzLmdldChpcGFkZHJlc3NfX2lleGFjdCA9IGlwYWRkcmVzcykKCQkJaWYgc2VydmVyLmlwYWRkcmVzcyA9PSBpcGFkZHJlc3M6CgkJCQlyZXR1cm4gVHJ1ZQoJCQlyZXR1cm4gRmFsc2UJCgkJZXhjZXB0IFNlcnZlcl90YmwuRG9lc05vdEV4aXN0OgoJCQlyZXR1cm4gRmFsc2UKCXJldHVybiBUcnVlCgkJCgkJCiM9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQojIENoZWNrIGlmIHRoZSBjYXRlZ29yeSBleGlzdHMKIz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CQoKZGVmIGNoZWNrX2NhdGVnb3J5X2V4aXN0cyhjYXRlZ29yeV9pZCk6CglpZiBjYXRlZ29yeV9pZC5pc251bWVyaWMoKToKCQl0cnk6CgkJCWNhdGVnb3J5ID0gQ2F0ZWdvcnlfdGJsLm9iamVjdHMuZ2V0KHBrID0gY2F0ZWdvcnlfaWQpCQkJCgkJCWlmIGNhdGVnb3J5LmlkID09IGludChjYXRlZ29yeV9pZCk6CgkJCQlyZXR1cm4gVHJ1ZQoJCQlyZXR1cm4gRmFsc2UJCgkJZXhjZXB0IENhdGVnb3J5X3RibC5Eb2VzTm90RXhpc3Q6CgkJCXJldHVybiBGYWxzZQoJcmV0dXJuIEZhbHNlCgkJCgkJCQojPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KIyBDaGVjayBpZiB0aGUgbG9jYXRpb24gZXhpc3RzCiM9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQkKCmRlZiBjaGVja19sb2NhdGlvbl9leGlzdHMobG9jYXRpb25faWQpOgoJaWYgbG9jYXRpb25faWQuaXNudW1lcmljKCk6CgkJdHJ5OgoJCQlsb2NhdGlvbiA9IExvY2F0aW9uX3RibC5vYmplY3RzLmdldChwayA9IGxvY2F0aW9uX2lkKQoJCQlpZiBsb2NhdGlvbi5pZCA9PSBpbnQobG9jYXRpb25faWQpOgoJCQkJcmV0dXJuIFRydWUKCQkJcmV0dXJuIEZhbHNlCQoJCWV4Y2VwdCBMb2NhdGlvbl90YmwuRG9lc05vdEV4aXN0OgoJCQlyZXR1cm4gRmFsc2UKCXJldHVybiBGYWxzZQkJCgkJCQoJCQkKIz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CiMgV3JpdGUgZmlsZSBjb250ZW50cyB0byBkYgojPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0JCQkKCQkJCmRlZiB3cml0ZV9kYXRhX3RvX2RiKGRhdGEpOgoJcm93X251bSA9IDAKCWZvciByb3cgaW4gZGF0YToKCQkKCQl0cnk6CgkJCXNlcnZlciA9IFNlcnZlcl90YmwoCgkJCQlpcGFkZHJlc3MgPSByb3dbMF0uc3RyaXAoKSwKCQkJCXNlcmlhbF9udW1iZXIgPSByb3dbMV0uc3RyaXAoKSwKCQkJCW1vZGVsX251bWJlciA9IHJvd1syXS5zdHJpcCgpLAoJCQkJd2FycmFudHkgPSByb3dbM10uc3RyaXAoKSwKCQkJCWFkbWluX3VpZCA9IHJvd1s0XS5zdHJpcCgpL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1cm4gRmFsc2UKCXJldHVybiBUcnVlCgkJCgkJCiM9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQojIENoZWNrIGlmIHRoZSBjYXRlZ29yeSBleGlzdHMKIz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CQoKZGVmIGNoZWNrX2NhdGVnb3J5X2V4aXN0cyhjYXRlZ29yeV9pZCk6CglpZiBjYXRlZ29yeV9pZC5pc251bWVyaWMoKToKCQl0cnk6CgkJCWNhdGVnb3J5ID0gQ2F0ZWdvcnlfdGJsLm9iamVjdHMuZ2V0KHBrID0gY2F0ZWdvcnlfaWQpCQkJCgkJCWlmIGNhdGVnb3J5LmlkID09IGludChjYXRlZ29yeV9pZCk6CgkJCQlyZXR1cm4gVHJ1ZQoJCQlyZXR1cm4gRmFsc2UJCgkJZXhjZXB0IENhdGVnb3J5X3RibC5Eb2VzTm90RXhpc3Q6CgkJCXJldHVybiBGYWxzZQoJcmV0dXJuIEZhbHNlCgkJCgkJCQojPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KIyBDaGVjayBpZiB0aGUgbG9jYXRpb24gZXhpc3RzCiM9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQkKCmRlZiBjaGVja19sb2NhdGlvbl9leGlzdHMobG9jYXRpb25faWQpOgoJaWYgbG9jYXRpb25faWQuaXNudW1lcmljKCk6CgkJdHJ5OgoJCQlsb2NhdGlvbiA9IExvY2F0aW9uX3RibC5vYmplY3RzLmdldChwayA9IGxvY2F0aW9uX2lkKQoJCQlpZiBsb2NhdGlvbi5pZCA9PSBpbnQ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Z19wcm9icywgbWluPXRva2VuX21pbl92YWwsIG1heD10b2tlbl9tYXhfdmFsKQogICAgICAgIGVsaWYgdG9rZW5fbWluX3ZhbCBpcyBub3QgTm9uZToKICAgICAgICAgICAgdG9rZW5fbG9nX3Byb2JzID0gdG9yY2guY2xhbXAodG9rZW5fbG9nX3Byb2JzLCBtaW49dG9rZW5fbWluX3ZhbCkKICAgICAgICBlbGlmIHRva2VuX21heF92YWwgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHRva2VuX2xvZ19wcm9icyA9IHRvcmNoLmNsYW1wKHRva2VuX2xvZ19wcm9icywgbWF4PXRva2VuX21heF92YWwpCgogICAgICAgICMgY2FsY3VsYWUgc2VudC1sZXZlbCBsb2cgcHJvYmFibGl0aWVzCiAgICAgICAgIyAhIHRvZG86IGNoZWNrIHRoZSBiYXNpcyBvZiB0aGlzIG5vcm1hbGl6YXRpb24gdGVybQogICAgICAgIGlmIG5vcm1hbGl6ZV9ieV9sZW5ndGg6CiAgICAgICAgICAgIHNlbnRfbG9nX3Byb2IgPSB0b3JjaC5tZWFuKHRva2VuX2xvZ19wcm9icykKICAgICAgICBlbHNlOgogICAgICAgICAgICBzZW50X2xvZ19wcm9iID0gdG9yY2guc3VtKHRva2VuX2xvZ19wcm9icykKCiAgICAgICAgIyBjYXAgc2VudF9sb2dfcHJvYnMKICAgICAgICBpZiBzZW50X21pbl92YWwgaXMgbm90IE5vbmUgYW5kIHNlbnRfbWF4X3ZhbCBpcyBub3QgTm9uZToKICAgICAgICAgICAgc2VudF9sb2dfcHJvYiA9IHRvcmNoLmNsYW1wKHNlbnRfbG9nX3Byb2IsIG1pbj1zZW50X21pbl92YWwsIG1heD1zZW50X21heF92YWwpCiAgICAgICAgZWxpZiBzZW50X21pbl92YWwgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHNlbnRfbG9nX3Byb2IgPSB0b3JjaC5jbGFtcChzZW50X2xvZ19wcm9iLCBtaW49c2VudF9taW5fdmFsKQogICAgICA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joKICAgICAgICAgICAgICAgICAgICByZXdhcmRfd2VpZ2h0cyA9IHRvcmNoLm9uZXMoc3RhdGVfdGVuc29ycy5zaGFwZVswXSkudG8odXRpbC5ERVZJQ0UpCiAgICAgICAgICAgICAgICAgICAgd2VpZ2h0X2luZGV4ID0gcmV3YXJkcyA8IDAKICAgICAgICAgICAgICAgICAgICBpZiB0b3JjaC5hbGwod2VpZ2h0X2luZGV4ID09IEZhbHNlKToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJld2FyZF93ZWlnaHRzCiAgICAgICAgICAgICAgICAgICAgc3RhdGVfdGVuc29ycyA9IHN0YXRlX3RlbnNvcnNbd2VpZ2h0X2luZGV4XQogICAgICAgICAgICAgICAgICAgIGluc3RydWN0aW9uX3RlbnNvcnMgPSBpbnN0cnVjdGlvbl90ZW5zb3JzW3dlaWdodF9pbmRleF0KICAgICAgICAgICAgICAgICAgICBmaWxlX25hbWVzID0gW2YgZm9yIGksIGYgaW4gZW51bWVyYXRlKGZpbGVfbmFtZXMpIGlmIHdlaWdodF9pbmRleFtpXV0KICAgICAgICAgICAgICAgICAgICB0cmFqX3RlbnNvcnMgPSBbdCBmb3IgaSwgdCBpbiBlbnVtZXJhdGUodHJhal90ZW5zb3JzKSBpZiB3ZWlnaHRfaW5kZXhbaV1dCiAgICAgICAgICAgICAgICBzdGF0ZV90ZW5zb3JzID0gc3RhdGVfdGVuc29ycy50byh1dGlsLkRFVklDRSkKICAgICAgICAgICAgICAgIGluc3RydWN0aW9uX3RlbnNvcnMgPSBpbnN0cnVjdGlvbl90ZW5zb3JzLnRvKHV0aWwuREVWSUNFKQogICAgICAgICAgICAgICAgdHJhal90ZW5zb3JzID0gW3RyYWoudG8odXRpbC5ERVZJQ0UpIGZvciB0cmFqIGluIHRyYWpfdGVuc29yc10KICAgICAgICAgICAgICAgIGJhdGNoX3NpemUgPSBzdGF0ZV90ZW5zb3JzLnNoYXBlWzBdCiAgICAgICAgICAgICAgICBlbmNvZGVyX2lucHV0cyA9IChzdGF0ZV90ZW5zb3JzLCB0cmFqX3RlbnNvcnMpCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIHN0YXRlX2VtYmVkZGluZ3MsIGF0dGVudGlvbl9tYXNrID0gZW5jb2Rlcl9zdGVwKGN1cnJlbnRfZW5jb2RlciwgZW5jb2Rlcl9pbnB1dHMsIGluc3RydWN0aW9uX3RlbnNvcnMpCiAgICAgICAgICAgICAgICBjdXJyZW50X2RlY29kZXJfb3V0cHV0cyA9IGN1cnJlbnRfZGVjb2RlcihpbnN0cnVjdGlvbl90ZW5zb3JzLCBjb25kaXRpb25fZW1icz1zdGF0ZV9lbWJlZGRpbmdzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVscz1pbnN0cnVjdGlvbl90ZW5zb3JzLCBhdHRlbnRpb25fbWFzaz1hdHRlbnRpb25fbWFzaywgdmFsaWRhdGlvbj1UcnVlKQogICAgICAgICAgICAgICAgY3VycmVudF9zZW50X2xvZ19wcm9icyA9IGdldF9zZW50X2xvZ19wcm9icyhpbnN0cnVjdGlvbl90ZW5zb3JzLCBjdXJyZW50X2RlY29kZXJfb3V0cHV0c1syXSwgbm9ybWFsaXplX2J5X2xlbmd0aD1GYWxzZSkKICAgICAgICAgICAgICAgIGN1cnJlbnRfc2VudF9wcm9icyA9IHRvcmNoLmV4cChjdXJyZW50X3NlbnRfbG9nX3Byb2JzKQogICAgICAgICAgICAgICAgIyAhIHNvIGZhciBpcHMgd2VpZ2h0aW5nIG9ubHkgc3VwcG9ydHMgbmVnYXRpdmUgZXhhbXBsZXMKICAgICAgICAgICAgICAgIGluaXRfc2VudF9wcm9icyA9IHRvcmNoLm9uZXMoY3VycmVudF9zZW50X3Byb2JzLnNoYXBlKS50byh1dGlsLkRFVklDRSkKICAgICAgICAgICAgICAgIGZvciBpLCBmIGluIGVudW1lcmF0ZShmaWxlX25hbWVzKToKICAgICAgICAgICAgICAgICAgICBpZiBmIGluIHNlbn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6ZSgxKQogICAgICAgICAgICBpZHggPSBpZHgucmVwZWF0KDEsIGluc3RydWN0aW9uX3RlbnNvcnMuc2hhcGVbLTFdLTEpCiAgICAgICAgICAgIGlkeCA9IGlkeC52aWV3KC0xKQoKICAgICAgICBmb3IgaSBpbiByYW5nZShsZW4oc2VudF9sb2dfcHJvYnNfbGlzdCkpOgogICAgICAgICAgICAjIHVwZGF0ZSBzZW50X2xvZ19wcm9icyBmb3IgZWFjaCBleGFtcGxlcwogICAgICAgICAgICBuYW1lID0gInt9X3NlbnRfcHJvYnMiLmZvcm1hdChkYXRhX2xhYmVsW2ldKQogICAgICAgICAgICB0cmFpbl9zdGF0cy5zZXRkZWZhdWx0KG5hbWUsIFtdKQogICAgICAgICAgICB0cmFpbl9zdGF0c1tuYW1lXS5hcHBlbmQoc2VudF9sb2dfcHJvYnNfbGlzdFtpXSkKICAgICAgICAgICAgIyB1cGRhdGUgbG9zcyBmb3IgZWFjaCBleGFtcGxlcwogICAgICAgICAgICBpZiBub3JtX3R5cGUgPT0gImdwdDIiOgogICAgICAgICAgICAgICAgbmFtZSA9ICJ7fV9sb3NzIi5mb3JtYXQoZGF0YV9sYWJlbFtpXSkKICAgICAgICAgICAgICAgIHRyYWluX3N0YXRzLnNldGRlZmF1bHQobmFtZSwgW10pCiAgICAgICAgICAgICAgICB0cmFpbl9zdGF0c1tuYW1lXSArPSBsb3NzZXNbaWR4ID09IGldLnRvbGlzdCgpCiAgICAgICAgICAgIGVsc2U6CiAgICAgICAgICAgICAgICBuYW1lID0gInt9X2xvc3MiLmZvcm1hdChkYXRhX2xhYmVsW2ldKQogICAgICAgICAgICAgICAgdHJhaW5fc3RhdHMuc2V0ZGVmYXVsdChuYW1lLCBbXSkKICAgICAgICAgICAgICAgIHRyYWluX3N0YXRzW25hbWVdLmFwcGVuZChsb3NzZXNbaV0udG9saXN0KCkpCiAgICByZXR1cm4gbG9zcywgdHJhaW5fc3RhdHMKCmRlZiBjYWxjX2tsX2xvc3MoY3V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hdGNoIGRhdGEKICAgICAgICBpZiBtYWluX2xvYWRlciBpcyBub3QgTm9uZToKICAgICAgICAgICAgaWYgc3RlcF9jdHNbIm1haW5fY3QiXSA+PSBsZW4obWFpbl9sb2FkZXIpOgogICAgICAgICAgICAgICAgbWFpbl9sb2FkZXIgPSBpdGVyKGRhdGFfbG9hZGVyc1sibWFpbl9sb2FkZXIiXSkKICAgICAgICAgICAgICAgIHN0ZXBfY3RzWyJtYWluX2N0Il0gPSAwCiAgICAgICAgICAgIG1haW5fYmF0Y2ggPSBuZXh0KG1haW5fbG9hZGVyKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIG1haW5fYmF0Y2ggPSBOb25lCgogICAgICAgIGlmIGF1eF9sb2FkZXIgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIGlmIHN0ZXBfY3RzWyJhdXhfY3QiXSA+PSBsZW4oYXV4X2xvYWRlcik6CiAgICAgICAgICAgICAgICBhdXhfbG9hZGVyID0gIGl0ZXIoZGF0YV9sb2FkZXJzWyJhdXhfbG9hZGVyIl0pCiAgICAgICAgICAgICAgICBzdGVwX2N0c1siYXV4X2N0Il0gPSAwCiAgICAgICAgICAgIGF1eF9iYXRjaCA9IG5leHQoYXV4X2xvYWRlcikKICAgICAgICBlbHNlOgogICAgICAgICAgICBhdXhfYmF0Y2ggPSBOb25lCgogICAgICAgIGlmIGtsX2xvYWRlciBpcyBub3QgTm9uZToKICAgICAgICAgICAgaWYgc3RlcF9jdHNbImtsX2N0Il0gPj0gbGVuKGtsX2xvYWRlcik6CiAgICAgICAgICAgICAgICBrbF9sb2FkZXIgPSAgaXRlcihkYXRhX2xvYWRlcnNbImtsX2xvYWRlciJdKQogICAgICAgICAgICAgICAgc3RlcF9jdHNbImtsX2N0Il0gPSAwCiAgICAgICAgICAgIGtsX2JhdGNoID0gbmV4dChrbF9sb2FkZXIpCiAgICAgICAgZWxzZToKICAgICAgICAgICAga2xfYmF0Y2ggPSBOb25lCiAgICAgICAgCiAgICAgIC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IyBodHRwczovL2dpdGh1Yi5jb20vcHl0b3JjaC9weXRvcmNoL2lzc3Vlcy80ODI5CiAgICAgICAgICAgICAgICAjIGh0dHBzOi8vZGlzY3Vzcy5weXRvcmNoLm9yZy90L2dyYWRpZW50LWNsaXBwaW5nLzI4MzYKICAgICAgICAgICAgICAgIGZvciBwIGluIGVuY29kZXIucGFyYW1ldGVycygpOgogICAgICAgICAgICAgICAgICAgIGlmIHAuZ3JhZCBpcyBub3QgTm9uZToKICAgICAgICAgICAgICAgICAgICAgICAgcC5ncmFkLmRhdGEuY2xhbXBfKC1mbG9hdCh0cmFpbl9jb25maWdzWyJncmFkaWVudF9jbGlwcGluZyJdWyJtYXhfdmFsdWUiXSksIGZsb2F0KHRyYWluX2NvbmZpZ3NbImdyYWRpZW50X2NsaXBwaW5nIl1bIm1heF92YWx1ZSJdKSkKICAgICAgICAgICAgICAgIGZvciBwIGluIGRlY29kZXIucGFyYW1ldGVycygpOgogICAgICAgICAgICAgICAgICAgIGlmIHAuZ3JhZCBpcyBub3QgTm9uZToKICAgICAgICAgICAgICAgICAgICAgICAgcC5ncmFkLmRhdGEuY2xhbXBfKC1mbG9hdCh0cmFpbl9jb25maWdzWyJncmFkaWVudF9jbGlwcGluZyJdWyJtYXhfdmFsdWUiXSksIGZsb2F0KHRyYWluX2NvbmZpZ3NbImdyYWRpZW50X2NsaXBwaW5nIl1bIm1heF92YWx1ZSJdKSkKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHJhaXNlIFZhbHVlRXJyb3IoIm5vdCBzdXBwb3J0ZWQgbm9ybSB0eXBlLiIpCgogICAgICAgIGlmIHVzZV9hbXA6CiAgICAgICAgICAgICMgVW5zY2FsZXMgZ3JhZGllbnRzIGFuZCBjYWxscwogICAgICAgICAgICAjIG9yIHNraXBzIG9wdGltaXplci5zdGVwKCkKICAgICAgICAgICAgc2NhbGVyLnN0ZXAob3B0aW1pemVyKQogICAgICAgICAgICAjIFVwZGF0ZXMgdGhlIH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gICBtc2cgPSAiIyBTdGVwcyB7fSwge30gczogQVZHX0xPU1Mge30iLmZvcm1hdChzdGVwcywgdGltZS50aW1lKCkgLSBzdCwgbnAucm91bmQoYXZnX2xvc3MsIDYpKQogICAgICAgICAgICBwcmludF9hbmRfbG9nKG1zZywgbG9nZ2VyKQogICAgICAgICAgICBmb3Iga2V5IGluIHRyYWluX3N0YXRzLmtleXMoKToKICAgICAgICAgICAgICAgIHdhbmRiLmxvZyh7IlRyYWluX21lYW4ve30iLmZvcm1hdChrZXkpOiBucC5tZWFuKHRyYWluX3N0YXRzW2tleV0pfSwgc3RlcD1zdGVwcywgY29tbWl0PUZhbHNlKQogICAgICAgICAgICBmb3Iga2V5IGluIHRyYWluX3N0YXRzLmtleXMoKToKICAgICAgICAgICAgICAgIHdhbmRiLmxvZyh7IlRyYWluX21lZGlhbi97fSIuZm9ybWF0KGtleSk6IG5wLm1lZGlhbih0cmFpbl9zdGF0c1trZXldKX0sIHN0ZXA9c3RlcHMsIGNvbW1pdD1GYWxzZSkKICAgICAgICAgICAgdHJhaW5fc3RhdHMgPSB7fQogICAgICAgICAgICBzdCA9IHRpbWUudGltZSgpCgogICAgICAgICMgdmFsaWRhdGlvbgogICAgICAgIGlmIGludCgoc3RlcHMtbGFzdF9jaGVja3BvaW50X3N0ZXApIC8gdHJhaW5pbmdfYXJndW1lbnRzLmdldF9jaGVja3BvaW50X3N0ZXAoKSk6CiAgICAgICAgICAgIHZhbGlkYXRlX2FuZF9zYXZlX21vZGVsKGVuY29kZXIsIGRlY29kZXIsIG9wdGltaXplciwgZnVsbF92YWxfbG9hZGVyLCBjbGVhbmVkX3ZhbF9sb2FkZXIsIHRva2VuaXplciwgc3RlcHMsIHRyYWluaW5nX2FyZ3VtZW50cywgbG9nZ2VyKQogICAgICAgICAgICBsYXN0X2NoZWNrcG9pbnRfc3RlcCA9IHN0ZXBzCgogICAgICAgICMgdXBkYXRlIHN0ZXAKICAgICAgICBzdGVwcyArPSAxCgogICAgIyBz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wKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpbl9tZW1vcnk9RmFsc2UsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudW1fd29ya2Vycz10cmFpbmluZ19hcmd1bWVudHMuZ2V0X251bV93b3JrZXJzKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xsYXRlX2ZuPWNvbGxhdGVfZm4pCiAgICAgICAgZWxzZToKICAgICAgICAgICAgZGF0YV9zZXQgPSBOb25lCiAgICAgICAgICAgIGRhdGFfbG9hZGVyID0gTm9uZQogICAgICAgIGRhdGFfcGF0aGVzW2RwXVsiZGF0YV9zZXQiXSA9IGRhdGFfc2V0CiAgICAgICAgZGF0YV9wYXRoZXNbZHBdWyJkYXRhX2xvYWRlciJdID0gZGF0YV9sb2FkZXIKICAgIAogICAgaWYgbG9nZ2VyIGlzIG5vdCBOb25lOgogICAgICAgIG1zZyA9ICJEYXRhc2V0IGNyZWF0ZWQiCiAgICAgICAgaWYgIGRhdGFfcGF0aGVzWyJtYWluX2RhdGFfcGF0aCJdWyJkYXRhX3NldCJdIGlzIG5vdCBOb25lOgogICAgICAgICAgICBtc2cgKz0gIiB7fSBtYWluIHNldCIuZm9ybWF0KGxlbihkYXRhX3BhdGhlc1sibWFpbl9kYXRhX3BhdGgiXVsiZGF0YV9zZXQiXSkpCiAgICAgICAgaWYgIGRhdGFfcGF0aGVzWyJhdXhfZGF0YV9wYXRoIl1bImRhdGFfc2V0Il0gaXMgbm90IE5vbmU6CiAgICAgICAgICAgIG1zZyArPSAiIHt9IGF1eCBzZXQiLmZvcm1hdChsZW4oZGF0YV9wYXRoZXNbImF1eF9kYXRhX3BhdGgiXVsiZGF0YV9zZXQiXSkpCiAgICAgICAgaWYgZGF0YV9wYXRoZXNbImtsX2RhdGFfcGF0aCJdWyJkYXRhX3NldCJdIGlzIG5v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zOiBib29sPSBUcnVlKToKICAgICIiIgogICAgbG9hZCBhIG1vZGVsCiAgICAiIiIKICAgIHByaW50X2FuZF9sb2coIkxvYWRpbmcgbW9kZWxzIC4uLiIsIGxvZ2dlcikKICAgIHRyYWluX2NvbmZpZ3MgPSB0cmFpbmluZ19hcmd1bWVudHMuZ2V0X2NvbmZpZygpCiAgICBpZiBjaGVja3BvaW50X3BhdGggIT0gJyc6CiAgICAgICAgY2hlY2twb2ludHMgPSB0b3JjaC5sb2FkKGNoZWNrcG9pbnRfcGF0aCkKICAgICAgICBwcmludF9hbmRfbG9nKCJMb2FkaW5nIGEgbW9kZWwgZnJvbSB7fSIuZm9ybWF0KGNoZWNrcG9pbnRfcGF0aCksIGxvZ2dlcikKICAgIGVsc2U6CiAgICAgICAgY2hlY2twb2ludHMgPSBOb25lCgogICAgZW5jb2Rlcl9jb25maWdzID0gewogICAgICAgICJlbmNvZGVyX3R5cGUiOiAiY25uX2xzdG0iLAogICAgICAgICJkX2VtYmVkIjogNDgsCiAgICAgICAgImRfbW9kZWwiOiA1MTIsCiAgICAgICAgIm5fZGVwdGgiOiAyLAogICAgICAgICJyY3BmX3NpemUiOiAxLAogICAgICAgICJjbm5faGV4IjogVHJ1ZSwKICAgICAgICAiY25uX2FjdHZfZnVuYyI6ICJ0YW5oIiwKICAgICAgICAiY25uX3VzZV9ub3JtIjogVHJ1ZSwKICAgICAgICAiZW1iZWRkaW5nc190eXBlIjogImxlYXJuZWQiLAogICAgICAgICJicmVha3BvaW50X3R5cGUiOiAiIiwKICAgICAgICAiZmVhdHVyZV9tYXBfc2l6ZSI6IDUsCiAgICAgICAgImZlYXR1cmVfZmlsdGVyX3NpemUiOiAzLAogICAgICAgICJyb3RhdGVfZmVhdHVyZV9tYXAiOiBUcnVlLAogICAgICAgICJmZWF0dXJlX21lcmdlX3R5cGUiOiAiY2F0IiwKICAgICAgICAiZmVhdHVyZV9vdXRwdXRfZGltZW5zaW9uIjogMTQwMCwKICAgICAgICAiZm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ICAgdG9rZW5fbG9nX3Byb2JzID0gc2hpZnRfcHJvYnNbaSwgLi4uXVtzZXF1ZW5jZV90ZW5zb3JzLCBpbnN0YW5jZV9zaGlmdF9sYWJlbHNdCgogICAgICAgICMgY2FwIHRva2VuX2xvZ19wcm9icwogICAgICAgIGlmIHRva2VuX21pbl92YWwgaXMgbm90IE5vbmUgYW5kIHRva2VuX21heF92YWwgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHRva2VuX2xvZ19wcm9icyA9IHRvcmNoLmNsYW1wKHRva2VuX2xvZ19wcm9icywgbWluPXRva2VuX21pbl92YWwsIG1heD10b2tlbl9tYXhfdmFsKQogICAgICAgIGVsaWYgdG9rZW5fbWluX3ZhbCBpcyBub3QgTm9uZToKICAgICAgICAgICAgdG9rZW5fbG9nX3Byb2JzID0gdG9yY2guY2xhbXAodG9rZW5fbG9nX3Byb2JzLCBtaW49dG9rZW5fbWluX3ZhbCkKICAgICAgICBlbGlmIHRva2VuX21heF92YWwgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHRva2VuX2xvZ19wcm9icyA9IHRvcmNoLmNsYW1wKHRva2VuX2xvZ19wcm9icywgbWF4PXRva2VuX21heF92YWwpCgogICAgICAgICMgY2FsY3VsYWUgc2VudC1sZXZlbCBsb2cgcHJvYmFibGl0aWVzCiAgICAgICAgIyAhIHRvZG86IGNoZWNrIHRoZSBiYXNpcyBvZiB0aGlzIG5vcm1hbGl6YXRpb24gdGVybQogICAgICAgIGlmIG5vcm1hbGl6ZV9ieV9sZW5ndGg6CiAgICAgICAgICAgIHNlbnRfbG9nX3Byb2IgPSB0b3JjaC5tZWFuKHRva2VuX2xvZ19wcm9icykKICAgICAgICBlbHNlOgogICAgICAgICAgICBzZW50X2xvZ19wcm9iID0gdG9yY2guc3VtKHRva2VuX2xvZ19wcm9icykKCiAgICAgICAgIyBjYXAgc2VudF9sb2dfcHJvYnMKICAgICAgICBpZiBzZW50X21pbl92YWwgaXMgbm90IE5vbmUgYW5kI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BOb25lOgogICAgICAgIHJldHVybiByZXdhcmRfd2VpZ2h0cwoKICAgIGJhdGNoX3NpemUgPSBiYXRjaFswXS5zaGFwZVswXQoKICAgIGlmIG1ldGhvZCBpcyBub3QgTm9uZSBhbmQgbWV0aG9kICE9ICIiOgogICAgICAgICMgZm9yd2FyZCBwYXNzIG9uIHM7IGV4YW1wbGVzCiAgICAgICAgaWYgYmF0Y2ggaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHdpdGggdG9yY2gubm9fZ3JhZCgpOgogICAgICAgICAgICAgICAgc3RhdGVfdGVuc29ycywgaW5zdHJ1Y3Rpb25fdGVuc29ycywgdHJhal90ZW5zb3JzLCBmaWxlX25hbWVzLCByZXdhcmRzLCBfID0gYmF0Y2gKICAgICAgICAgICAgICAgIGlmIHdlaWdodF90eXBlID09ICJuZWdhdGl2ZV9vbmx5IjoKICAgICAgICAgICAgICAgICAgICByZXdhcmRfd2VpZ2h0cyA9IHRvcmNoLm9uZXMoc3RhdGVfdGVuc29ycy5zaGFwZVswXSkudG8odXRpbC5ERVZJQ0UpCiAgICAgICAgICAgICAgICAgICAgd2VpZ2h0X2luZGV4ID0gcmV3YXJkcyA8IDAKICAgICAgICAgICAgICAgICAgICBpZiB0b3JjaC5hbGwod2VpZ2h0X2luZGV4ID09IEZhbHNlKToKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJld2FyZF93ZWlnaHRzCiAgICAgICAgICAgICAgICAgICAgc3RhdGVfdGVuc29ycyA9IHN0YXRlX3RlbnNvcnNbd2VpZ2h0X2luZGV4XQogICAgICAgICAgICAgICAgICAgIGluc3RydWN0aW9uX3RlbnNvcnMgPSBpbnN0cnVjdGlvbl90ZW5zb3JzW3dlaWdodF9pbmRleF0KICAgICAgICAgICAgICAgICAgICBmaWxlX25hbWVzID0gW2YgZm9yIGksIGYgaW4gZW51bWVyYXRlKGZpbGVfbmFtZXMpIGlmIHdlaWdodF9pbmRleFtpXV0KICAgICAgICAgICAgICAgICAg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JzLCBjdXJyZW50X2RlY29kZXJfb3V0cHV0c1syXSwgbm9ybWFsaXplX2J5X2xlbmd0aD1GYWxzZSkKICAgICAgICAgICAgICAgIGN1cnJlbnRfc2VudF9wcm9icyA9IHRvcmNoLmV4cChjdXJyZW50X3NlbnRfbG9nX3Byb2JzKQogICAgICAgICAgICAgICAgIyAhIHNvIGZhciBpcHMgd2VpZ2h0aW5nIG9ubHkgc3VwcG9ydHMgbmVnYXRpdmUgZXhhbXBsZXMKICAgICAgICAgICAgICAgIGluaXRfc2VudF9wcm9icyA9IHRvcmNoLm9uZXMoY3VycmVudF9zZW50X3Byb2JzLnNoYXBlKS50byh1dGlsLkRFVklDRSkKICAgICAgICAgICAgICAgIGZvciBpLCBmIGluIGVudW1lcmF0ZShmaWxlX25hbWVzKToKICAgICAgICAgICAgICAgICAgICBpZiBmIGluIHNlbnRfcHJvYnM6CiAgICAgICAgICAgICAgICAgICAgICAgIGluaXRfc2VudF9wcm9ic1tpXSA9IHNlbnRfcHJvYnNbZl0KCiAgICAgICAgICAgICAgICBpZiB3ZWlnaHRfdHlwZSA9PSAibmVnYXRpdmVfb25seSI6CiAgICAgICAgICAgICAgICAgICAgcmV3YXJkX3dlaWdodHNbd2VpZ2h0X2luZGV4XSA9IGN1cnJlbnRfc2VudF9wcm9icyAvIGluaXRfc2VudF9wcm9icwogICAgICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgICAgICByZXdhcmRfd2VpZ2h0cyA9IGN1cnJlbnRfc2VudF9wcm9icyAvIGluaXRfc2VudF9wcm9icwogICAgICAgICAgICAgICAgICAgIHJld2FyZF93ZWlnaHRzID0gcmV3YXJkX3dlaWdodHMuZGV0YWNoKCkKCiAgICAjIGNsYW1wIHJld2FyZCB3ZWlnaHRzCiAgICBpZiBtaW5fY2xhbXBfdmFsdWUgaXMgbm90IE5vbmU6CiAgICAgICAgaWYgcmV3YXJkX3dlaWdodHMgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHJld2FyZ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Gl2ZSBsb3NzCiAgICAgICAgbWFpbl9sb3NzLCBhdXhfbG9zcywga2xfbG9zcyA9IHRvcmNoLnRlbnNvcihbMC5dKS50byh1dGlsLkRFVklDRSksIHRvcmNoLnRlbnNvcihbMC5dKS50byh1dGlsLkRFVklDRSksICB0b3JjaC50ZW5zb3IoWzAuXSkudG8odXRpbC5ERVZJQ0UpCiAgICAgICAgdG90YWxfc3RhdHMgPSB7fQoKICAgICAgICAjIGdldCBiYXRjaCBkYXRhCiAgICAgICAgaWYgbWFpbl9sb2FkZXIgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIGlmIHN0ZXBfY3RzWyJtYWluX2N0Il0gPj0gbGVuKG1haW5fbG9hZGVyKToKICAgICAgICAgICAgICAgIG1haW5fbG9hZGVyID0gaXRlcihkYXRhX2xvYWRlcnNbIm1haW5fbG9hZGVyIl0pCiAgICAgICAgICAgICAgICBzdGVwX2N0c1sibWFpbl9jdCJdID0gMAogICAgICAgICAgICBtYWluX2JhdGNoID0gbmV4dChtYWluX2xvYWRlcikKICAgICAgICBlbHNlOgogICAgICAgICAgICBtYWluX2JhdGNoID0gTm9uZQoKICAgICAgICBpZiBhdXhfbG9hZGVyIGlzIG5vdCBOb25lOgogICAgICAgICAgICBpZiBzdGVwX2N0c1siYXV4X2N0Il0gPj0gbGVuKGF1eF9sb2FkZXIpOgogICAgICAgICAgICAgICAgYXV4X2xvYWRlciA9ICBpdGVyKGRhdGFfbG9hZGVyc1siYXV4X2xvYWRlciJdKQogICAgICAgICAgICAgICAgc3RlcF9jdHNbImF1eF9jdCJdID0gMAogICAgICAgICAgICBhdXhfYmF0Y2ggPSBuZXh0KGF1eF9sb2FkZXIpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgYXV4X2JhdGNoID0gTm9uZQoKICAgICAgICBpZiBrbF9sb2FkZXIgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIGlmIHN0ZXBfY3RzWyJrbF9jdCJdID49IGxlbihrbF9sb2FkZXIpOgog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Vfb25lLAogICAgfQoKICAgIHJld2FyZF9zY2FsYWluZ19kaXNwYXRjaGVyID0gewogICAgICAgICJjbGFtcCI6IGNsYW1waW5nLAogICAgICAgICJsaW5lYXIiOiBsaW5lYXJfc2NhbGluZywKICAgIH0KCiAgICBkYXRhX3BhdGhlcyA9IHsKICAgICAgICAibWFpbl9kYXRhX3BhdGgiOiB7fSwKICAgICAgICAiYXV4X2RhdGFfcGF0aCI6IHt9LAogICAgICAgICJrbF9kYXRhX3BhdGgiOiB7fSwKICAgICAgICAiZnVsbF92YWxfZGF0YV9wYXRoIjoge30sCiAgICAgICAgImNsZWFuZWRfdmFsX2RhdGFfcGF0aCI6IHt9LAogICAgfQoKICAgIHNlbnRfcHJvYl9kaWN0cyA9IHt9CiAgICBmb3IgZHAgaW4gZGF0YV9wYXRoZXM6CiAgICAgICAgaWYgZHAgaW4gdHJhaW5fY29uZmlncy5rZXlzKCk6CiAgICAgICAgICAgIGRhdGFfc2V0ID0gSU5TVFJVQ1RJT05fREFUQVNFVCh0b2tlbml6ZXIsIGxvZ2dlcikKICAgICAgICAgICAgZm9yIGNmZyBpbiB0cmFpbl9jb25maWdzW2RwXToKICAgICAgICAgICAgICAgIGRhdGFfcGF0aCA9IGNmZ1siZGF0YV9wYXRoIl0KICAgICAgICAgICAgICAgIHJld2FyZF9mbmMgPSBjZmdbInJld2FyZF9mbmMiXSBpZiAicmV3YXJkX2ZuYyIgaW4gY2ZnIGVsc2UgTm9uZQogICAgICAgICAgICAgICAgaWYgcmV3YXJkX2ZuYyBpcyBub3QgTm9uZToKICAgICAgICAgICAgICAgICAgICAgICAgcmV3YXJkX2ZuYz1yZXdhcmRfZm5jX2Rpc3BhdGNoZXJbcmV3YXJkX2ZuY10KICAgICAgICAgICAgICAgIGlmICIucGtsIiBpbiBkYXRhX3BhdGg6CiAgICAgICAgICAgICAgICAgICAgIyBsb2FkaW5nIGh1bWFuLWh1bWFuICAoc3VociBldCBhbC4sKSB0cmFpbmluZyBkYXRhC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lbHNlIHRyYWluX2NvbmZpZ3NbInRyYWluX2JhdGNoX3NpemUiXSAKICAgICAgICAgICAgZGF0YV9sb2FkZXIgPSB0b3JjaC51dGlscy5kYXRhLkRhdGFMb2FkZXIoZGF0YV9zZXQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXRjaF9zaXplPWJhdGNoX3NpemUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaHVmZmxlPXNodWZmbGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaW5fbWVtb3J5PUZhbHNlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtX3dvcmtlcnM9dHJhaW5pbmdfYXJndW1lbnRzLmdldF9udW1fd29ya2VycygpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sbGF0ZV9mbj1jb2xsYXRlX2ZuKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIGRhdGFfc2V0ID0gTm9uZQogICAgICAgICAgICBkYXRhX2xvYWRlciA9IE5vbmUKICAgICAgICBkYXRhX3BhdGhlc1tkcF1bImRhdGFfc2V0Il0gPSBkYXRhX3NldAogICAgICAgIGRhdGFfcGF0aGVzW2RwXVsiZGF0YV9sb2FkZXIiXSA9IGRhdGFfbG9hZGVyCiAgICAKICAgIGlmIGxvZ2dlciBpcyBub3QgTm9uZToKICAgICAgICBtc2cgPSAiRGF0YXNldCBjcmVhdGVkIgogICAgICAgIGlmICBkYXRhX3BhdGhlc1sibWFpbl9kYXRhX3BhdGgiXVsiZGF0YV9zZXQiXSBpcyBub3QgTm9uZToKICAgICAgICAgICAgbXNnICs9ICIge30gbWFpbiBzZXQiLmZvcm1hdChsZW4oZGF0YV9wYXRoZXNbIm1haW5fZGF0YV9wYXRoIl1bImRhdGFf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3VtZW50cy5nZXRfd2FuZGJfbmFtZSgpKQoKZGVmIGdldF90b2tlbml6ZXIoKSAtPiBHUFQyVG9rZW5pemVyOgogICAgcmV0dXJuIEdQVDJUb2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCJncHQyIikKCmRlZiBnZXRfbW9kZWwoY2hlY2twb2ludF9wYXRoOiBzdHIsIHRyYWluaW5nX2FyZ3VtZW50cywgdm9jYWJfc2l6ZTogaW50LCBsb2dnZXIsIGdldF9vbmx5X21vZGVsczogYm9vbD0gVHJ1ZSk6CiAgICAiIiIKICAgIGxvYWQgYSBtb2RlbAogICAgIiIiCiAgICBwcmludF9hbmRfbG9nKCJMb2FkaW5nIG1vZGVscyAuLi4iLCBsb2dnZXIpCiAgICB0cmFpbl9jb25maWdzID0gdHJhaW5pbmdfYXJndW1lbnRzLmdldF9jb25maWcoKQogICAgaWYgY2hlY2twb2ludF9wYXRoICE9ICcnOgogICAgICAgIGNoZWNrcG9pbnRzID0gdG9yY2gubG9hZChjaGVja3BvaW50X3BhdGgpCiAgICAgICAgcHJpbnRfYW5kX2xvZygiTG9hZGluZyBhIG1vZGVsIGZyb20ge30iLmZvcm1hdChjaGVja3BvaW50X3BhdGgpLCBsb2dnZXIpCiAgICBlbHNlOgogICAgICAgIGNoZWNrcG9pbnRzID0gTm9uZQoKICAgIGVuY29kZXJfY29uZmlncyA9IHsKICAgICAgICAiZW5jb2Rlcl90eXBlIjogImNubl9sc3RtIiwKICAgICAgICAiZF9lbWJlZCI6IDQ4LAogICAgICAgICJkX21vZGVsIjogNTEyLAogICAgICAgICJuX2RlcHRoIjogMiwKICAgICAgICAicmNwZl9zaXplIjogMSwKICAgICAgICAiY25uX2hleCI6IFRydWUsCiAgICAgICAgImNubl9hY3R2X2Z1bmMiOiAidGFuaCIsCiAgICAgICAgImNubl91c2Vfbm9ybSI6IFRydWUsCiAgICAgICAgImVtYmVkZGluZ3NfdHlwZSI6ICJsZWFybmVkIiwKICAgICAgICAiYnJlYWtwb2ludF90eXBlIjogIiIsCiAgICAgICAgImZlYXR1cmVfbWFwX3NpemUiOiA1LAogICAgICAgICJmZWF0dXJlX2ZpbHRlcl9zaXplIjogMywKICAgICAgICAicm90YXRlX2ZlYXR1cmVfbWFwIjogVHJ1ZSwKICAgICAgICAiZmVhdHVyZV9tZXJnZV90eXBlIjogImNhdCIsCiAgICAgICAgImZlYXR1cmVfb3V0cHV0X2RpbWVuc2lvbiI6IDE0MDAsCiAgICAgICAgImZlYXR1cmVfY25uX25fZGVwdGgiOiAxLAogICAgICAgICJmZWF0dXJlX2Nubl9hY3R2X2Z1bmMiOiAidGFuaCIsCiAgICAgICAgImZlYXR1cmVfY25uX3VzZV9ub3JtIjogVHJ1ZSwKICAgICAgICAibHN0bV9pbnB1dF9tZXJnZV90eXBlIjogImNhdCIsCiAgICAgICAgImxzdG1fb3V0cHV0X21lcmdlX3R5cGUiOiAic3BhdGlhbC1jYXQiLAogICAgICAgICJsc3RtX3NraXAiOiBUcnVlLAogICAgICAgICJsc3RtX3BiX2RpbSI6IDQ4LAogICAgICAgICJyZWR1Y2VfZmVhdHVyZSI6IEZhbHNlLAogICAgICAgICJsc3RtX2RfbW9kZWwiOiAxMjgsCiAgICAgICAgImxzdG1fbnVtX2xheWVycyI6IDIsCiAgICAgICAgImxzdG1fYmlkaXJlY3Rpb25hbCI6IFRydWUsCiAgICAgICAgImxzdG1fZHJvcG91dCI6IDAuNQogICAgfQogICAgZW5jb2RlciA9IENOTkxTVE1TdGF0ZUVuY29kaW5nTW9kZWwoZW5jb2Rlcl9jb25maWdzKQogICAgaWYgY2hlY2twb2ludHMgaXMgbm90IE5vbmU6CiAgICAgICAgZW5jb2Rlci5sb2FkX3N0YXRlX2RpY3QoY2hlY2twb2ludHNbImVuY29kZXIiXSkKCiAgICBkZWNvZGVyX2NvbmZpZyA9IEdQVDJDb25maWcuZnJvbV9wcmV0cmFpbmVkKCJncHQyIikKICAgIGRlY29kZXJfY29uZmlnLm5fY3R4ID0g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m9yIG5kIGluIG5vX2RlY2F5KV0sCiAgICAgICAgICAgICdscic6IGZsb2F0KGxyKSwKICAgICAgICAgICAgIndlaWdodF9kZWNheSI6IDFlLTUsCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJwYXJhbXMiOiBbcCBmb3IgbiwgcCBpbiBkZWNvZGVyLm5hbWVkX3BhcmFtZXRlcnMoKSBpZiBhbnkobmQgaW4gbiBmb3IgbmQgaW4gbm9fZGVjYXkpXSwKICAgICAgICAgICAgJ2xyJzogZmxvYXQobHIpCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJwYXJhbXMiOiBbcCBmb3IgbiwgcCBpbiBlbmNvZGVyLm5hbWVkX3BhcmFtZXRlcnMoKSBpZiBub3QgYW55KG5kIGluIG4gZm9yIG5kIGluIG5vX2RlY2F5KV0sCiAgICAgICAgICAgICdscic6IGZsb2F0KGxyKSwKICAgICAgICAgICAgIndlaWdodF9kZWNheSI6IDFlLTUsCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJwYXJhbXMiOiBbcCBmb3IgbiwgcCBpbiBlbmNvZGVyLm5hbWVkX3BhcmFtZXRlcnMoKSBpZiBhbnkobmQgaW4gbiBmb3IgbmQgaW4gbm9fZGVjYXkpXSwKICAgICAgICAgICAgJ2xyJzogZmxvYXQobHIpCiAgICAgICAgfSwKICAgIF0KICAgIG9wdGltaXplciA9IHRvcmNoLm9wdGltLkFkYW1XKG9wdGltaXplcl9ncm91cGVkX3BhcmFtZXRlcnMsIGVwcz0xZS04KQogICAgcmV0dXJuIG9wdGltaXplcgoKZGVmIHVwZGF0ZV9jb25maWcodHJhaW5fY29uZmlncyk6CiAgICBpZiAidmFsX3NhbXBsZV9zaXplIiBub3QgaW4gdHJhaW5fY29uZmlnczoKICAgICAgICB0cmFpbl9jb25maWdzWyJ2YWxfc2FtcGxlX3NpemUiXSA9IDUKCiAgICAjIHNldCBkZWZhdWx0IGRyb3BvdXQgY29uZmlncmF0aW9uIGlmIGVtcHR5LgogICAgaWYgImxvc3NfY29uZmlncyIgaW4gdHJhaW5fY29uZmlnczoKICAgICAgICBpZiAibWFpbl9kcm9wb3V0IiBub3QgaW4gdHJhaW5fY29uZmlnc1sibG9zc19jb25maWdzIl06CiAgICAgICAgICAgIHRyYWluX2NvbmZpZ3NbImxvc3NfY29uZmlncyJdWyJtYWluX2Ryb3BvdXQiXSA9IFRydWUKICAgICAgICBpZiAiYXV4X2Ryb3BvdXQiIG5vdCBpbiB0cmFpbl9jb25maWdzWyJsb3NzX2NvbmZpZ3MiXToKICAgICAgICAgICAgdHJhaW5fY29uZmlnc1sibG9zc19jb25maWdzIl1bImF1eF9kcm9wb3V0Il0gPSBUcnVlCiAgICAgICAgaWYgImtsX2Ryb3BvdXRzIiBub3QgaW4gdHJhaW5fY29uZmlnc1sibG9zc19jb25maWdzIl06CiAgICAgICAgICAgIHRyYWluX2NvbmZpZ3NbImxvc3NfY29uZmlncyJdWyJrbF9kcm9wb3V0cyJdID0gewogICAgICAgICAgICAgICAgImluaXRfZW5jb2Rlcl9kcm9wb3V0IjogVHJ1ZSwKICAgICAgICAgICAgICAgICJpbml0X2RlY29kZXJfZHJvcG91dCI6IFRydWUsCiAgICAgICAgICAgICAgICAiY3VycmVudF9lbmNvZGVyX2Ryb3BvdXQiOiBUcnVlLAogICAgICAgICAgICAgICAgImN1cnJlbnRfZGVjb2Rlcl9kcm9wb3V0IjogVHJ1ZSwKICAgICAgICAgICAgfQogICAgICAgIGlmICJyZXdhcmRfd2VpZ2h0aW5nIiBub3QgaW4gdHJhaW5fY29uZmlnc1sibG9zc19jb25maWdzIl06CiAgICAgICAgICAgIHRyYWluX2NvbmZpZ3NbImxvc3NfY29uZmlncyJdWyJyZXdhcmRfd2VpZ2h0aW5nIl0gPSB7fQogICAgICAgICAgICB0cmFpbl9jb25maWdzWyJsb3NzX2NvbmZpZ3MiXVsicmV3YXJkX3dlaWdodGluZyJdWyJtZXRob2QiXSA9ICIiCi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iAgICBzdGF0ZV9lbWJlZGRpbmdzLCBhdHRlbnRpb25fbWFzayA9IGVuY29kZXJfc3RlcChlbmNvZGVyLCBlbmNvZGVyX2lucHV0cywgaW5zdHJ1Y3Rpb25fdGVuc29ycykKCjx8ZmltX2VuZHw+
bbb7a1aba4ed4148525c176914e42768c160f5b9-1
bbb7a1aba4ed4148525c176914e42768c160f5b9
PHxmaW1fcHJlZml4fD4KZnJvbSBfX2Z1dHVyZV9fIGltcG9ydCB1bmljb2RlX2xpdGVyYWxzCgpmcm9tIGRqYW5nby5hcHBzIGltcG9ydCBBcHBDb25maWcKCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KCmNsYXNzIE5vbkZ1bmN0aW9uYWxSZXF1aXJlbWVudHNDb25maWcoQXBwQ29uZmlnKToKICAgIG5hbWUgPSAnbm9uX2Z1bmN0aW9uYWxfcmVxdWlyZW1lbnRzJwo8fGZpbV9lbmR8Pg==
bbb7a1aba4ed4148525c176914e42768c160f5b9-2
bbb7a1aba4ed4148525c176914e42768c160f5b9
PHxmaW1fcHJlZml4fD4KZnJvbSBfX2Z1dHVyZV9fIGltcG9ydCB1bmljb2RlX2xpdGVyYWxzCgpmcm9tIGRqYW5nby5hcHBzIGltcG9ydCBBcHBDb25maWcKCgo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CmNsYXNzIE5vbkZ1bmN0aW9uYWxSZXF1aXJlbWVudHNDb25maWcoQXBwQ29uZmlnKToKICAgIG5hbWUgPSAnbm9uX2Z1bmN0aW9uYWxfcmVxdWlyZW1lbnRzJwo8fGZpbV9lbmR8Pg==
bbb7a1aba4ed4148525c176914e42768c160f5b9-3
bbb7a1aba4ed4148525c176914e42768c160f5b9
PHxmaW1fcHJlZml4fD4KZnJvbSBfX2Z1dHVyZV9fIGltcG9ydCB1bmljb2RlX2xpdGVyYWxzCgo8fGZpbV9ob2xlfD4KICAgIG5hbWUgPSAnbm9uX2Z1bmN0aW9uYWxfcmVx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gICAgcmV0dXJuIFRydWUKCjx8ZmltX2VuZHw+
05fa95a424db7403fc7490a3e6f35dc56a9fd727-3
05fa95a424db7403fc7490a3e6f35dc56a9fd727
PHxmaW1fcHJlZml4fD4KZnJvbSBweW1vbmdvIGltcG9ydCBNb25nb0NsaWVudCwgR0VPU1BIRVJFCmZyb20gYnM0IGltcG9ydCBCZWF1dGlmdWxTb3VwCgpkYiA9IE1vbmdvQ2xpZW50KCdsb2NhbGhvc3QnLCAyNzAxNykuaHlicmlkY29tbXV0ZQpjb2wgPSBkYi5sb2NhdGlvbnMKCmNvbC5jcmVhdGVfaW5kZXgoWygnbG9jJywgR0VPU1BIRVJFKSwgKCd0eXBlJywgMSldKQpjb2wuY3JlYXRlX2luZGV4KCdpZCcsIHVuaXF1ZT1UcnVlKQoKd2l0aCBvcGVuKCdtYXAueG1sJywgJ3InKSBhcyBmOgogICAgc291cCA9IEJlYXV0aWZ1bFNvdXAoZiwgImx4bWwiKQoKPHxmaW1faG9sZXw+CiAgICAgICAgICAgICAgICByZXR1cm4gVHJ1ZQoKICAgIHJldHVybiBGYWxzZQoKZGVmIGdldE5vZGVzQnlLVihub2Rlcywga2V5LCB2YWx1ZSk6CiAgICByZXMgPSBbXQogICAgZm9yIG5vZGUgaW4gbm9kZXM6CiAgICAgICAgZm9yIGNoaWxkIGluIG5vZGUuZmluZF9hbGwoJ3RhZycpOgogICAgICAgICAgICBpZiBjaGlsZFsnayddID09IGtleSBhbmQgY2hpbGRbJ3YnXSA9PSB2YWx1ZToKICAgICAgICAgICAgICAgcmVzLmFwcGVuZChub2RlKQogICAgcmV0dXJuIHJlcwoKZGVmIHByb2Nlc3NOb2Rlcyhub2RlcywgdHlwZVZhbHVlKToKICAgIHJlcyA9IFtdCiAgICBmb3Igbm9kZSBpbiBub2RlczoKICAgICAgICByZXMuYXBwZW5kKHsKICAgICAgICAgICAgJ2lkJzogbm9kZVsnaWQnXSwKICAgICAgICAgICAgJ2xvYyc6IFsKICAgICAgICAgICA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ICBjb25mLkZST01fRU1BSUwgPSAnZm9vQGV4YW1wbGUuY29tJwogICAgICAgIGNvbmYuQkFTRV9VUkwgPSAnaHR0cDovL2V4YW1wbGUuY29tJwogICAgCjx8ZmltX2hvbGV8PgogICAgICAgIGNvbmYuQUxMT1dfU1VCU0NSSVBUSU9OUyA9IFRydWUKICAgICAgICAKICAgICAgICBzdWIgPSBTdWJzY3JpcHRpb24ub2JqZWN0cy5jcmVhdGUoCiAgICAgICAgICAgIGVtYWlsPSdmb29AZXhhbXBsZS5jb20nLAogICAgICAgICkKICAgICAgICBzdWIuc2VydmljZXMgPSBbc2VsZi5zZXJ2aWNlXQogICAgICAgIAogICAgICAgIGV2ZW50ID0gRXZlbnQub2JqZWN0cy5jcmVhdGUoKQogICAgICAgIGV2ZW50LnNlcnZpY2VzLmFkZChzZWxmLnNlcnZpY2UpCiAgICAgICAgCiAgICAgICAgRXZlbnRVcGRhdGUub2JqZWN0cy5jcmVhdGUoCiAgICAgICAgICAgIGV2ZW50PWV2ZW50LAogICAgICAgICAgICBzdGF0dXM9MiwKICAgICAgICApCiAgICAKICAgICAgICBzZWxmLmFzc2VydEVxdWFscyhsZW4obWFpbC5vdXRib3gpLCAxKQoKICAgICAgICBtc2cgPSBtYWlsLm91dGJveFswXQoKICAgICAgICBzZWxmLmFzc2VydEVxdWFscyhsZW4obXNnLnRvKSwgMSkKICAgICAgICBzZWxmLmFzc2VydEVxdWFscyhtc2cudG9bMF0sICdmb29AZXhhbXBsZS5jb20nKQoKICAgICAgICBib2R5ID0gbXNnLmJvZHkKCiAgICAgICAgc2VsZi5hc3NlcnRUcnVlKCdUZXN0IG1heSBiZSB1bmF2YWlsYWJsZScgaW4gYm9keSkKICAgICAgICBzZWxmLmFzc2VydFRydWUoJ2h0dHA6Ly9leGFtcGxlLmNvbS9zdWJzY3JpcHRpb24vJXMvJyAlIHN1Yi5pZGVudCBpbiBib2R5KQogICAgICAgIAogICAgICAgIGNvbmYuQUxMT1dfU1VCU0NSSV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ci50ZXN0cy51cmxzJwogICAgCiAgICBkZWYgc2V0VXAoc2VsZik6CiAgICAgICAgc2VsZi5zZXJ2aWNlID0gU2VydmljZS5vYmplY3RzLmNyZWF0ZSgKICAgICAgICAgICAgbmFtZT0nVGVzdCcsCiAgICAgICAgICAgIHNsdWc9J3Rlc3QnLAogICAgICAgICkKICAgICAgICBjb25mLkZST01fRU1BSUwgPSAnZm9vQGV4YW1wbGUuY29tJwogICAgICAgIGNvbmYuQkFTRV9VUkwgPSAnaHR0cDovL2V4YW1wbGUuY29tJwogICAgCiAgICBkZWYgcmVmcmVzaChzZWxmLCBpbnN0KToKICAgICAgICByZXR1cm4gaW5zdC5fX2NsYXNzX18ub2JqZWN0cy5nZXQocGs9aW5zdC5waykKCiAgICBkZWYgdGVzdF9zdWJzY3JpcHRpb25zKHNlbGYpOgogICAgICAgIGNvbmYuQUxMT1dfU1VCU0NSSVBUSU9OUyA9IFRydWUKICAgICAgICAKICAgICAgICBzdWIgPSBTdWJzY3JpcHRpb24ub2JqZWN0cy5jcmVhdGUoCiAgICAgICAgICAgIGVtYWlsPSdmb29AZXhhbXBsZS5jb20nLAogICAgICAgICkKICAgICAgICBzdWIuc2VydmljZXMgPSBbc2VsZi5zZXJ2aWNlXQogICAgICAgIAogICAgICAgIGV2ZW50ID0gRXZlbnQub2JqZWN0cy5jcmVhdGUoKQogICAgICAgIGV2ZW50LnNlcnZpY2VzLmFkZChzZWxmLnNlcnZpY2UpCiAgICAgICAgCiAgICAgICAgRXZlbnRVcGRhdGUub2JqZWN0cy5jcmVhdGUoCiAgICAgICAgICAgIGV2ZW50PWV2ZW50LAo8fGZpbV9ob2xlfD4KICAgICAgICApCiAgICAKICAgICAgICBzZWxmLmFzc2VydEVxdWFscyhsZW4obWFpbC5vdXRib3gpLCAxKQoKICAgICAgICBtc2cgPSBtYWlsLm91dGJveFswXQoKICAgICAgICBzZWxmLmFzc2VydEVxdWFscyhsZW4obXNnLnRvKSwgMSkKICAgICAgICBzZWxmL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c2UoVGVzdENhc2UpOgogICAgdXJscyA9ICdvdmVyc2Vlci50ZXN0cy51cmxzJwogICAgCiAgICBkZWYgc2V0VXAoc2VsZik6CiAgICAgICAgc2VsZi5zZXJ2aWNlID0gU2VydmljZS5vYmplY3RzLmNyZWF0ZSgKICAgICAgICAgICAgbmFtZT0nVGVzdCcsCiAgICAgICAgICAgIHNsdWc9J3Rlc3QnLAogICAgICAgICkKICAgICAgICBjb25mLkZST01fRU1BSUwgPSAnZm9vQGV4YW1wbGUuY29tJwogICAgICAgIGNvbmYuQkFTRV9VUkwgPSAnaHR0cDovL2V4YW1wbGUuY29tJwogICAgCiAgICBkZWYgcmVmcmVzaChzZWxmLCBpbnN0KToKICAgICAgICByZXR1cm4gaW5zdC5fX2NsYXNzX18ub2JqZWN0cy5nZXQocGs9aW5zdC5waykKCiAgICBkZWYgdGVzdF9zdWJzY3JpcHRpb25zKHNlbGYpOgogICAgICAgIGNvbmYuQUxMT1dfU1VCU0NSSVBUSU9OUyA9IFRydWUKICAgICAgICAKICAgICAgICBzdWIgPSBTdWJzY3JpcHRpb24ub2JqZWN0cy5jcmVhdGUoCiAgICAgICAgICAgIGVtYWlsPSdmb29AZXhhbXBsZS5jb20nLAogICAgICAgICkKICAgICAgICBzdWIuc2VydmljZXMgPSBbc2VsZi5zZXJ2aWNlXQogICAgICAgIAogICAgICAgIGV2ZW50ID0gRXZlbnQub2JqZWN0cy5jcmVhdGUoKQogICAgICAgIGV2ZW50LnNlcnZpY2VzLmFkZChzZWxmLnNlcnZpY2UpCiAgICAgICAgCiAgICAgICAgRXZlbnRVcGRhdGUub2JqZWN0cy5jcmVhdGUoCiAgICAgICAgICAgIGV2ZW50PWV2ZW50LAogICAgICAgICAgICBzdGF0dXM9MiwKICAgICAgICApCjx8ZmltX2hvbGV8PgoKICAgICAgICBzZWxmLmFzc2VydEVxdWFscyhsZW4obXNnLnRvKSwgMSkKICAgICAgICBzZWxmLmFzc2VydEVxdWFscyhtc2cudG9bMF0sICd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m5vdENvbm5lY3Q6CiAgICAgICAgICAgICAgICBlcnJvcnNbImJhc2UiXSA9ICJjYW5ub3RfY29ubmVjdCIKICAgICAgICAgICAgZXhjZXB0IEludmFsaWRBdXRoOgogICAgICAgICAgICAgICAgZXJyb3JzWyJiYXNlIl0gPSAiaW52YWxpZF9hdXRoIgoKICAgICAgICAgICAgaWYgbm90IGVycm9yczoKICAgICAgICAgICAgICAgIGlmIGV4aXN0aW5nX2VudHJ5OgogICAgICAgICAgICAgICAgICAgIHNlbGYuaGFzcy5jb25maWdfZW50cmllcy5hc3luY191cGRhdGVfZW50cnkoCiAgICAgICAgICAgICAgICAgICAgICAgIGV4aXN0aW5nX2VudHJ5LCBkYXRhPWluZm8KICAgICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAgICAgYXdhaXQgc2VsZi5oYXNzLmNvbmZpZ19lbnRyaWVzLmFzeW5jX3JlbG9hZChleGlzdGluZ19lbnRyeS5lbnRyeV9pZCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2VsZi5hc3luY19hYm9ydChyZWFzb249InJlYXV0aF9zdWNjZXNzZnVsIikKCiAgICAgICAgICAgICAgICBzZWxmLmltYyA9IHVzZXJfaW5wdXRbQ09ORl9JUF9BRERSRVNTXQogICAgICAgICAgICAgICAgcmV0dXJuIHNlbGYuYXN5bmNfY3JlYXRlX2VudHJ5KHRpdGxlPXNlbGYuaW1jLCBkYXRhPWluZm8pCgogICAgICAgIHJldHVybiBzZWxmLmFzeW5jX3Nob3dfZm9ybSgKICAgICAgICAgICAgc3RlcF9pZD0idXNlciIsCiAgICAgICAgICAgIGRhdGFfc2NoZW1hPXNlbGYuX2FzeW5jX3NjaGVtYSgpLAogICAgICAgICAgICBlcnJvcnM9ZXJyb3JzLAogICAgICAgICAgICBkZXNjcmlwdGlvbl9wbGFjZWhvbGRlcnM9e30sCiAgICAgICAgKQoKICAgIGFzeW5jIGRlZiBhc3luY19zdGVwX3JlYXV0aChzZWxmLCBkYXRh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lc3MuIiIiCiAgICAgICAgZm9yIGVudHJ5IGluIHNlbGYuX2FzeW5jX2N1cnJlbnRfZW50cmllcygpOgogICAgICAgICAgICBpZiBlbnRyeS5kYXRhLmdldChDT05GX0lQX0FERFJFU1MpID09IGltYzoKICAgICAgICAgICAgICAgIHJldHVybiBlbnRyeQogICAgICAgIHJldHVybiBOb25lCgoKY2xhc3MgT3B0aW9uc0Zsb3dIYW5kbGVyKGNvbmZpZ19lbnRyaWVzLk9wdGlvbnNGbG93KToKICAgICIiIkhhbmRsZSBhIG9wdGlvbiBmbG93IGZvciBJTUMuIiIiCgogICAgZGVmIF9faW5pdF9fKHNlbGYsIGNvbmZpZ19lbnRyeTogY29uZmlnX2VudHJpZXMuQ29uZmlnRW50cnkpIC0+IE5vbmU6CiAgICAgICAgIiIiSW5pdGlhbGl6ZSBvcHRpb25zIGZsb3cuIiIiCiAgICAgICAgc2VsZi5jb25maWdfZW50cnkgPSBjb25maWdfZW50cnkKCiAgICBhc3luYyBkZWYgYXN5bmNfc3RlcF9pbml0KHNlbGYsIHVzZXJfaW5wdXQ9Tm9uZSk6CiAgICAgICAgIiIiSGFuZGxlIG9wdGlvbnMgZmxvdy4iIiIKICAgICAgICBpZiB1c2VyX2lucHV0IGlzIG5vdCBOb25lOgogICAgICAgICAgICByZXR1cm4gc2VsZi5hc3luY19jcmVhdGVfZW50cnkodGl0bGU9IiIsIGRhdGE9dXNlcl9pbnB1dCkKCiAgICAgICAgZGF0YV9zY2hlbWEgPSB2b2wuU2NoZW1hKAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2b2wuT3B0aW9uYWwoCiAgICAgICAgICAgICAgICAgICAgQ09ORl9TQ0FOX0lOVEVSVkFMLAogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ9c2VsZi5jb25maWdfZW50cnkub3B0aW9ucy5nZXQoCiAgICAgICAgICAgICAgICAgICAgICAgIENPTkZfU0NBTl9JTlRFUlZBTCwgREVGQVVMVF9TQ0FOX0lOV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aWRBdXRoOgogICAgICAgICAgICAgICAgZXJyb3JzWyJiYXNlIl0gPSAiaW52YWxpZF9hdXRoIgoKICAgICAgICAgICAgaWYgbm90IGVycm9yczoKICAgICAgICAgICAgICAgIGlmIGV4aXN0aW5nX2VudHJ5OgogICAgICAgICAgICAgICAgICAgIHNlbGYuaGFzcy5jb25maWdfZW50cmllcy5hc3luY191cGRhdGVfZW50cnkoCiAgICAgICAgICAgICAgICAgICAgICAgIGV4aXN0aW5nX2VudHJ5LCBkYXRhPWluZm8KICAgICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAgICAgYXdhaXQgc2VsZi5oYXNzLmNvbmZpZ19lbnRyaWVzLmFzeW5jX3JlbG9hZChleGlzdGluZ19lbnRyeS5lbnRyeV9pZCkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2VsZi5hc3luY19hYm9ydChyZWFzb249InJlYXV0aF9zdWNjZXNzZnVsIikKCiAgICAgICAgICAgICAgICBzZWxmLmltYyA9IHVzZXJfaW5wdXRbQ09ORl9JUF9BRERSRVNTXQogICAgICAgICAgICAgICAgcmV0dXJuIHNlbGYuYXN5bmNfY3JlYXRlX2VudHJ5KHRpdGxlPXNlbGYuaW1jLCBkYXRhPWluZm8pCgogICAgICAgIHJldHVybiBzZWxmLmFzeW5jX3Nob3dfZm9ybSgKICAgICAgICAgICAgc3RlcF9pZD0idXNlciIsCiAgICAgICAgICAgIGRhdGFfc2NoZW1hPXNlbGYuX2FzeW5jX3NjaGVtYSgpLAogICAgICAgICAgICBlcnJvcnM9ZXJyb3JzLAogICAgICAgICAgICBkZXNjcmlwdGlvbl9wbGFjZWhvbGRlcnM9e30sCiAgICAgICAgKQoKICAgIGFzeW5jIGRlZiBhc3luY19zdGVwX3JlYXV0aChzZWxmLCBkYXRhKToKICAgICAgICAiIiJIYW5kbGUgY29uZmlndXJhdGlvbiBieSByZS1hdXRoLiIiIgogICAgICAgIHNlbGYuaW1jID0gZGF0YVtDT05GX0lQX0FERFJF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LmdldChDT05GX0lQX0FERFJFU1MpID09IGltYzoKICAgICAgICAgICAgICAgIHJldHVybiBlbnRyeQogICAgICAgIHJldHVybiBOb25lCgoKY2xhc3MgT3B0aW9uc0Zsb3dIYW5kbGVyKGNvbmZpZ19lbnRyaWVzLk9wdGlvbnNGbG93KToKICAgICIiIkhhbmRsZSBhIG9wdGlvbiBmbG93IGZvciBJTUMuIiIiCgogICAgZGVmIF9faW5pdF9fKHNlbGYsIGNvbmZpZ19lbnRyeTogY29uZmlnX2VudHJpZXMuQ29uZmlnRW50cnkpIC0+IE5vbmU6CiAgICAgICAgIiIiSW5pdGlhbGl6ZSBvcHRpb25zIGZsb3cuIiIiCiAgICAgICAgc2VsZi5jb25maWdfZW50cnkgPSBjb25maWdfZW50cnkKCiAgICBhc3luYyBkZWYgYXN5bmNfc3RlcF9pbml0KHNlbGYsIHVzZXJfaW5wdXQ9Tm9uZSk6CiAgICAgICAgIiIiSGFuZGxlIG9wdGlvbnMgZmxvdy4iIiIKICAgICAgICBpZiB1c2VyX2lucHV0IGlzIG5vdCBOb25lOgogICAgICAgICAgICByZXR1cm4gc2VsZi5hc3luY19jcmVhdGVfZW50cnkodGl0bGU9IiIsIGRhdGE9dXNlcl9pbnB1dCkKCiAgICAgICAgZGF0YV9zY2hlbWEgPSB2b2wuU2NoZW1hKAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2b2wuT3B0aW9uYWwoCiAgICAgICAgICAgICAgICAgICAgQ09ORl9TQ0FOX0lOVEVSVkFMLAogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ9c2VsZi5jb25maWdfZW50cnkub3B0aW9ucy5nZXQoCiAgICAgICAgICAgICAgICAgICAgICAgIENPTkZfU0NBTl9JTlRFUlZBTCwgREVGQVVMVF9TQ0FOX0lOVEVSVkFMCiAgICAgICAgICAgICAgICAgICAgKSwKICAgICAgICAgICAgICAgICk6IHZvbC5BbGwoY3YucG9zaXRpdmVfaW50LCB2b2wuQ2xhbXAobWluPU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Zm5hbWUpCiAgICAgICAgcmVzdWx0ID0ga3cucG9wKCJyZXN1bHQiLCBOb25lKQogICAgICAgIHJlc3AgPSB7CiAgICAgICAgICAgICJhcmdzIjogYSwKICAgICAgICAgICAgImt3YXJncyI6IGt3LAogICAgICAgICAgICAibmFtZSI6IGZuLl9fbmFtZV9fLAogICAgICAgICAgICAic2lnbmFsIjoga3cuZ2V0KCdzZWxmJywga3cuZ2V0KCdjbHMnLCBmbikpCiAgICAgICAgfQogICAgICAgIGlmIGFjdGlvbiA9PSAncG9zdCc6CiAgICAgICAgICAgIG5zLnNpZ25hbChzaWdfbmFtZSkuc2VuZChyZXN1bHQsICoqcmVzcCkKICAgICAgICBlbHNlOgogICAgICAgICAgICBucy5zaWduYWwoc2lnX25hbWUpLnNlbmQoKipyZXNwKQoKICAgIEBmdW5jdG9vbHMud3JhcHMoZm4pCiAgICBkZWYgd3JhcHBlcigqYXJncywgKiprd2FyZ3MpOgogICAgICAgIHNlbmQoJ3ByZScsICphcmdzLCAqKmt3YXJncykKICAgICAgICByZXN1bHQgPSBmbigqYXJncywgKiprd2FyZ3MpCiAgICAgICAga3dhcmdzWyJyZXN1bHQiXSA9IHJlc3VsdAogICAgICAgIHNlbmQoJ3Bvc3QnLCAqYXJncywgKiprd2FyZ3MpCiAgICAgICAgcmV0dXJuIHJlc3VsdAoKICAgIHJldHVybiB3cmFwcGVyCgoKQHNpZ25hbApkZWYgZG9fc29tZXRoaW5nKGRhdGEsICoqa3cpOgogICAgcHJpbnQoIk1ZIE9XTiBLVyIsIGt3KQogICAgcmV0dXJuIGRhdGEKCgpAZG9fc29tZXRoaW5nLnBvc3QKZGVmIG15X3RoaW5nKHJlc3VsdCwgKiprdyk6CiAgICBwcmludCgiTElTVEVORVIiLCByZXN1bHQsIGt3KQoKCkBkb19zb21ldGhpbmcucG9zdApkZWYgbXlfdGhpbmcyKHJlc3VsdCwgKiprdyk6CiAgICBwcmludCgiSSBqdXN0IHB1bGwgdXAgdG8gdGhpcy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mdzIG9yICdjbHMnIGluIGZuYXJnczoKICAgICAgICBjYWxsZXIgPSBpbnNwZWN0LmN1cnJlbnRmcmFtZSgpLmZfYmFjawogICAgICAgIGZuYW1lICs9ICJfIiArIGNhbGxlci5mX2NvZGUuY29fbmFtZQogICAgZm5hbWUgKz0gIl9fIiArIGZuLl9fbmFtZV9fCgogICAgIyBwcmUgYW5kIHBvc3QKICAgIGZuLnByZV8gPSBucy5zaWduYWwoJ3ByZV8lcycgJSBmbmFtZSkKICAgIGZuLnBvc3RfID0gbnMuc2lnbmFsKCdwb3N0XyVzJyAlIGZuYW1lKQoKICAgICMgYWxpYXMKICAgIGZuLnByZSA9IGZuLnByZV8uY29ubmVjdAogICAgZm4ucG9zdCA9IGZuLnBvc3RfLmNvbm5lY3QKCiAgICBkZWYgc2VuZChhY3Rpb24sICphLCAqKmt3KToKICAgICAgICBzaWdfbmFtZSA9ICIlc18lcyIgJSAoYWN0aW9uLCBmbmFtZSkKICAgICAgICByZXN1bHQgPSBrdy5wb3AoInJlc3VsdCIsIE5vbmUpCiAgICAgICAgcmVzcCA9IHsKICAgICAgICAgICAgImFyZ3MiOiBhLAogICAgICAgICAgICAia3dhcmdzIjoga3csCiAgICAgICAgICAgICJuYW1lIjogZm4uX19uYW1lX18sCiAgICAgICAgICAgICJzaWduYWwiOiBrdy5nZXQoJ3NlbGYnLCBrdy5nZXQoJ2NscycsIGZuKSkKICAgICAgICB9CiAgICAgICAgaWYgYWN0aW9uID09ICdwb3N0JzoKICAgICAgICAgICAgbnMuc2lnbmFsKHNpZ19uYW1lKS5zZW5kKHJlc3VsdCwgKipyZXNwKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIG5zLnNpZ25hbChzaWdfbmFtZSkuc2VuZCgqKnJlc3ApCgogICAgQGZ1bmN0b29scy53cmFwcyhmbikKICAgIGRlZiB3cmFwcGVyKCphcmdzLCAqKmt3YXJncyk6CiAgICAgICAgc2VuZCgncHJlJywgKmFyZ3MsICoqa3dhcmdzK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nBhcmFtIGtleTogc3RyaW5nIC0gdGhlIGtleSB0byBmbGF0dGVuCiAgICA6cGFyYW0gZGljdDogYXBwLmNvbmZpZyAtIHRoZSBmbGFzayBhcHAuY29uZmlnIG9yIGRpY3QKICAgICIiIgogICAgaWYga2V5IGluIGNvbmZpZzoKICAgICAgICBmb3IgaywgdiBpbiBjb25maWdba2V5XS5pdGVtcygpOgogICAgICAgICAgICBfID0gIiVzXyVzIiAlIChrZXksIGsudXBwZXIoKSkKICAgICAgICAgICAgaWYgXyBub3QgaW4gY29uZmlnOgogICAgICAgICAgICAgICAgY29uZmlnW19dID0gdgoKCmFwcCA9IEZsYXNrKF9fbmFtZV9fKQphcHAudGVzdGluZyA9IFRydWUKYXBwLmNvbmZpZy5mcm9tX29iamVjdChDb25mKCkpCgpjb25maWdfZmxhdHRlbl9wcm9wZXJ0eSgiQVdTIiwgYXBwLmNvbmZpZykKY29uZmlnX2ZsYXR0ZW5fcHJvcGVydHkoIkNPUlMiLCBhcHAuY29uZmlnKQoKcHJpbnQoYXBwLmNvbmZpZykKCgpzZW5kX21haWwodG89IiIsIHN1YmplY3Q9IiIsIGJvZHk9IiIpCnNlbmRfbWFpbCh0bz0iIiwgdGVtcGxhdGU9IiIsICkKPHxmaW1fc3VmZml4fD4KICAgICMyLiBDcmVhdGUgdGhlIGxpc3RlbmVyIGRlY29yYXRvcnMsIHVzaW5nIHRoZSBmdW5jdGlvbiB0aGF0IGhhcyB0aGUgc2lnbmFsCiAgICAtIEBwcmUgdG8gY2FwdHVyZSBiZWZvcmUgdGhlIGV4ZWN1dGlvbgogICAgICBhY2NlcHRzIGFyZ3M6ICgqYSwgKiprdykKICAgICAgLSAqKmt3OiBwcm9wZXJ0aWVzCjx8ZmltX2VuZHw+
3c305f0734f30395dbd302ca23be10be52533070-1
3c305f0734f30395dbd302ca23be10be52533070
PHxmaW1fcHJlZml4fD4KIyEvdXNyL2Jpbi9lbnYgcHl0aG9uCiIiIgo9PT09PT09CnRleHRleHQKP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AgICAgICAgIi1zIiwgIi0tc2NhbGUtZmFjdG9yIiwgYWN0aW9uPSJzdG9yZSIsIHR5cGU9ImZsb2F0IiwKICAgICAgICAgICAgZGVzdD0ic2NhbGVfZmFjdG9yIiwKICAgICAgICAgICAgZGVmYXVsdD1zZWxmLnNldHRpbmdzLmdldCgnc2NhbGUnLCBmbG9hdCwgMS4wKSkKICAgIAogICAgZGVmIGVmZmVjdChzZWxmKToKICAgICAgICAiIiJQZXJmb3JtIHRoZSBlZmZlY3Q6IGNyZWF0ZS9tb2RpZnkgVGV4VGV4dCBvYmplY3RzIiIiCiAgICAgICAgZ2xvYmFsIENPTlZFUlRFUlMKCiAgICAgICAgIyBQaWNrIGEgY29udmVydGVyCiAgICAgICAgY29udmVydGVyX2Vycm9ycyA9IFtdCiAgICAgICAgCiAgICAgICAgY29udmVydGVyX2NscyA9IE5vbmUKICAgICAgICBmb3IgY29udl9jbHMgaW4gQ09OVkVSVEVSUzoKICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgY29udl9jbHMuYXZhaWxhYmxlKCkKICAgICAgICAgICAgICAgIGNvbnZlcnRlcl9jbHMgPSBjb252X2NscwogICAgICAgICAgICAgICAgYnJlYWsKICAgICAgICAgICAgZXhjZXB0IFN0YW5kYXJkRXJyb3IsIGU6CiAgICAgICAgICAgICAgICBjb252ZXJ0ZXJfZXJyb3JzLmFwcGVuZCgiJXM6ICVzIiAlIChjb252X2Nscy5fX25hbWVfXywgc3RyKGUpKSkKICAgICAgICAKICAgICAgICBpZiBub3QgY29udmVydGVyX2NsczoKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJObyBMYXRleCAtPiBTVkcgY29udmVydGVyIGF2YWlsYWJsZTpcbiVzIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJSAnO1xuJy5qb2luKGNvbnZlcnRlcl9lcnJvcnMpKQogICAgICAgIAogICAgICAgICMgRmluZCByb290IGVsZW1lbnQKICAgICAgICBvbGRfbm9kZSwgdGV4dCwgcHJlYW1ibGVfZmlsZSA9IHNlbGYuZ2V0X29sZCgpCiAgICAgICAgCiAgICAgICAgIyBBc2sgZm9yIFRlWCBjb2RlCiAgICAgICAgaWYgc2VsZi5vcHRpb25zLnRleHQgaXMgTm9uZToKICAgICAgICAgICAgIyBJZiB0aGVyZSBpcyBhIHRyYW5zZm9ybSwgc2NhbGUgaW4gR1VJIHdpbGwgYmUgaWdub3JlZAogICAgICAgICAgICBpZiBvbGRfbm9kZSBpcyBub3QgTm9uZToKICAgICAgICAgICAgICAgIHNjYWxlX2ZhY3RvciA9IE5vbmUKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHNjYWxlX2ZhY3RvciA9IHNlbGYub3B0aW9ucy5zY2FsZV9mYWN0b3IKCiAgICAgICAgICAgIGlmIG5vdCBwcmVhbWJsZV9maWxlOgogICAgICAgICAgICAgICAgcHJlYW1ibGVfZmlsZSA9IHNlbGYub3B0aW9ucy5wcmVhbWJsZV9maWxlCgogICAgICAgICAgICBpZiBub3Qgb3MucGF0aC5pc2ZpbGUocHJlYW1ibGVfZmlsZSk6CiAgICAgICAgICAgICAgICBwcmVhbWJsZV9maWxlID0gIiIKICAgICAgICAgICAgCiAgICAgICAgICAgIGFza2VyID0gQXNrVGV4dCh0ZXh0LCBwcmVhbWJsZV9maWxlLCBzY2FsZV9mYWN0b3IpCiAgICAgICAgICAgIGFza2VyLmFzayhsYW1iZGEgdCwgcCwgczogc2VsZi5kb19jb252ZXJ0KHQsIHAsIHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnZlcnRlcl9jbHMsIG9sZF9ub2RlKSkKICAgICAgICBlbHNlOgogICAgICAgICAgICBzZWxmLmRvX2NvbnZlcnQoc2VsZi5vcHRpb25zLnRleHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLm9wdGlvbnMucHJlYW1ibGVfZmlsZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYub3B0aW9ucy5zY2FsZV9mYWN0b3IsIGNvbnZlcnRlcl9jbHMsIG9sZF9ub2RlKQoKICAgIGRlZiBkb19jb252ZXJ0KHNlbGYsIHRleHQsIHByZWFtYmxlX2ZpbGUsIHNjYWxlX2ZhY3RvciwgY29udmVydGVyX2NscywKICAgICAgICAgICAgICAgICAgIG9sZF9ub2RlKToKICAgICAgICAKICAgICAgICBpZiBub3QgdGV4dDoKICAgICAgICAgICAgcmV0dXJuCgogICAgICAgIGlmIGlzaW5zdGFuY2UodGV4dCwgdW5pY29kZSk6CiAgICAgICAgICAgIHRleHQgPSB0ZXh0LmVuY29kZSgndXRmLTgnKQogICAgICAgIAogICAgICAgICMgQ29udmVydAogICAgICAgIGNvbnZlcnRlciA9IGNvbnZlcnRlcl9jbHMoc2VsZi5kb2N1bWVudCkKICAgICAgICB0cnk6CiAgICAgICAgICAgIG5ld19ub2RlID0gY29udmVydGVyLmNvbnZlcnQodGV4dCwgcHJlYW1ibGVfZmlsZSwgc2NhbGVfZmFjdG9yKQogICAgICAgIGZpbmFsbHk6CiAgICAgICAgICAgIGNvbnZlcnRlci5maW5pc2goKQogICAgICAgIAogICAgICAgIGlmIG5ld19ub2RlIGlzIE5vbmU6CiAgICAgICAgICAgIHJldHVybiAjIG5vb3AKCiAgICAgICAgIyBJbnNlcnQgaW50byBkb2N1bWVudAoKICAgICAgICAjIC0tIFNldCB0ZXh0ZXh0IGF0dHJpYnMKICAgICAgICBuZXdfbm9kZS5hdHRyaWJbJ3slc310ZXh0JyVURVhURVhUX05TXSA9IHRleHQuZW5jb2RlKCdzdHJpbmctZXNjYXBlJykKICAgICAgICBuZXdfbm9kZS5hdHRyaWJbJ3slc31wcmVhbWJsZSclVEVYVEVYVF9OU10gPSBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWFtYmxlX2ZpbGUuZW5jb2RlKCdzdHJpbmctZXNjYXBlJykKCiAgICAgICAgI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luZ3MKICAgICAgICBpZiBvcy5wYXRoLmlzZmlsZShwcmVhbWJsZV9maWxlKToKICAgICAgICAgICAgc2VsZi5zZXR0aW5ncy5zZXQoJ3ByZWFtYmxlJywgcHJlYW1ibGVfZmlsZSkKICAgICAgICBpZiBzY2FsZV9mYWN0b3IgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHNlbGYuc2V0dGluZ3Muc2V0KCdzY2FsZScsIHNjYWxlX2ZhY3RvcikKICAgICAgICBzZWxmLnNldHRpbmdzLnNhdmUoKQogICAgCiAgICBkZWYgZ2V0X29sZChzZWxmKToKICAgICAgICAiIiIKICAgICAgICBEaWcgb3V0IExhVGVYIGNvZGUgYW5kIG5hbWUgb2YgcHJlYW1ibGUgZmlsZSBmcm9tIG9sZAogICAgICAgIFRleFRleHQtZ2VuZXJhdGVkIG9iamVjdHMuCgogICAgICAgIDpSZXR1cm5zOiAob2xkX25vZGUsIGxhdGV4X3RleHQsIHByZWFtYmxlX2ZpbGVfbmFtZSkKICAgICAgICAiIiIKCiAgICAgICAgZm9yIGkgaW4gc2VsZi5vcHRpb25zLmlkczoKICAgICAgICAgICAgbm9kZSA9IHNlbGYuc2VsZWN0ZWRbaV0KICAgICAgICAgICAgaWYgbm9kZS50YWcgIT0gJ3slc31nJyAlIFNWR19OUzogY29udGludWUKICAgICAgICAgICAgCiAgICAgICAgICAgIGlmICd7JXN9dGV4dCclVEVYVEVYVF9OUyBpbiBub2RlLmF0dHJpYjoKICAgICAgICAgICAgICAgICMgc3RhcnRpbmcgZnJvbSAwLjIsIHVzZSBuYW1lc3BhY2VzCiAgICAgICAgICAgICAgICByZXR1cm4gKG5vZGUsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUuYXR0cmliLmdldCgneyVzfXRleHQnJVRFWFRFWFRfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5hdHRyaWIuZ2V0KCd7JXN9cHJlYW1ibGUnJVRFWFRFWFRfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSkKICAgICAgICAgICAgZWxpZiAneyVzfXRleHQnJVNWR19OUyBpbiBub2RlLmF0dHJpYjoKICAgICAgICAgICAgICAgICMgPCAwLjIgYmFja3dhcmQgY29tcGF0aWJpbGl0eQogICAgICAgICAgICAgICAgcmV0dXJuIChub2RlLAogICAgICAgICAgICAgICAgICAgICAgICBub2RlLmF0dHJpYi5nZXQoJ3slc310ZXh0JyVTVkdfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5hdHRyaWIuZ2V0KCd7JXN9cHJlYW1ibGUnJVNWR19OUywgJycpLmRlY29kZSgnc3RyaW5nLWVzY2FwZScpKQogICAgICAgIHJldHVybiBOb25lLCAiIiwgIiIKCiAgICBkZWYgcmVwbGFjZV9ub2RlKHNlbGYsIG9sZF9ub2RlLCBuZXdfbm9kZSk6CiAgICAgICAgIiIiCiAgICAgICAgUmVwbGFjZSBhbiBYTUwgbm9kZSBvbGRfbm9kZSB3aXRoIG5ld19ub2RlCiAgICAgICAgaW4gc2VsZi5kb2N1bWVudC4KICAgICAgICAiIiIKICAgICAgICBpZiBvbGRfbm9kZSBpcyBOb25lOgogICAgICAgICAgICBzZWxmLmN1cnJlbnRfbGF5ZXIuYXBwZW5kKG5ld19ub2RlKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHBhcmVudCA9IG9sZF9ub2RlLmdldHBhcmVudCgpCiAgICAgICAgICAgIHBhcmVudC5yZW1vdmUob2xkX25vZGUpCiAgICAgICAgICAgIHBhcmVudC5hcHBlbmQobmV3X25vZGUpCgoKICAgIFNUWUxFX0FUVFJTID0gWydmaWxsJywnZmlsbC1vcGFjaXR5JywnZmlsbC1ydWxlJywKICAgICAgICAgICAgICAgICAgICdmb250LXNpemUtYWRqdXN0JywnZm9udC1zdHJldGNoJywKICAgICAgICAgICAgICAgICAgICdmb250LXN0eWxlJywnZm9udC12YXJpYW50JywKICAgICAgICAgICAgICAgICAgICdmb250LXdlaWdodCcsJ2xldHRlci1zcGFjaW5nJywKICAgICAgICAgICAgICAgICAgICdzdHJva2UnLCdzdHJva2UtZGFzaGFycmF5JywKICAgICAgICAgICAgICAgICAgICdzdHJva2UtbGluZWNhcCcsJ3N0cm9rZS1saW5lam9pbicsCiAgICAgICAgICAgICAgICAgICAnc3Ryb2tlLW1pdGVybGltaXQnLCdzdHJva2Utb3BhY2l0eScsCiAgICAgICAgICAgICAgICAgICAndGV4dC1hbmNob3InLCd3b3JkLXNwYWNpbmcnLCdzdHlsZSddCiAgICAKICAgIGRlZiBjb3B5X3N0eWxlKHNlbGYsIG9sZF9ub2RlLCBuZXdfbm9kZSk6CiAgICAgICAgIyBYWFg6IE5lZWRzIHdvcmsuLi4KICAgICAgICAjCiAgICAgICAgIyAgICAgIFdlIGNvdWxkIHRyeSB0cmF2ZXJzaW5nIHRoZSBub2RlIHRyZWUgZG93bndhcmRzIGFuZAogICAgICAgICMgICAgICByZW1vdmluZyBjb2xvci1hbHRlcmF0aW9uIGZyb20gdGhlIGF0dHJpYnV0ZXMuCiAgICAgICAgIyAgICAgIE5vdCBzdHJhaWdodGZvcndhcmQsIG5lZWQgdG8gcmVhZCB0aGUgU1ZHIHNwZWMuLi4KICAgICAgICAjCiAgICAgICAgIyAgICAgIFJlbW92aW5nIHN0eWxlIGF0dHJpYnV0ZXMgZG9lcyBub3Qgd29yayBpbiBnZW5lcmFsLCBiZWNhdXNlCiAgICAgICAgIyAgICAgIGF0IGxlYXN0IHBkZjJzdmcgcmVsaWVzIG9uIHByZXNlcnZpbmcgdGhlIHN0cm9rZSBhdHRycy4KICAgICAgICAjCiAgICAgICAgdHJ5OgogICAgICAgICAgICBuZXdfbm9kZS5hdHRyaWJbJ3N0eWxlJ10gPSBvbGRfbm9kZS5hdHRyaWJbJ3N0eWxlJ10KICAgICAgICBleGNlcHQgKEtleUVyc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OgogICAgICAgICAgICAgICAgICAgICAgICBuYW1lLCBkYXRhLCBkdHlwZSA9IF93aW5yZWcuRW51bVZhbHVlKGtleSwgaikKICAgICAgICAgICAgICAgICAgICBleGNlcHQgRW52aXJvbm1lbnRFcnJvcjoKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsKICAgICAgICAgICAgICAgICAgICBzZWxmLnZhbHVlc1tuYW1lXSA9IHN0cihkYXRhKQogICAgICAgICAgICBmaW5hbGx5OgogICAgICAgICAgICAgICAga2V5LkNsb3NlKCkKICAgICAgICBlbHNlOgogICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICBmID0gb3BlbihzZWxmLmZpbGVuYW1lLCAncicpCiAgICAgICAgICAgIGV4Y2VwdCAoSU9FcnJvciwgT1NFcnJvcik6CiAgICAgICAgICAgICAgICByZXR1cm4KICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgc2VsZi52YWx1ZXMgPSB7fQogICAgICAgICAgICAgICAgZm9yIGxpbmUgaW4gZi5yZWFkKCkuc3BsaXQoIlxuIik6CiAgICAgICAgICAgICAgICAgICAgaWYgbm90ICc9JyBpbiBsaW5lOiBjb250aW51ZQogICAgICAgICAgICAgICAgICAgIGssIHYgPSBsaW5lLnNwbGl0KCI9IiwgMSkKICAgICAgICAgICAgICAgICAgICBzZWxmLnZhbHVlc1trLnN0cmlwKCldID0gdi5zdHJpcCgpCiAgICAgICAgICAgIGZpbmFsbHk6CiAgICAgICAgICAgICAgICBmLmNsb3NlKCkKICAgIAogICAgZGVmIHNhdmUoc2VsZik6CiAgICAgICAgaWYgVVNFX1dJTkRPV1M6CiAgICAgICAgICAgIGltcG9ydCBfd2lucmVnCiAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgIGtleSA9IF93aW5yZWcuT3BlbktleShfd2lucmVnLkhLRVlfQ1VSUkVOVF9VU0VSLCBzZWxmLmtleW5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtPV93aW5yZWcuS0VZX1NFVF9WQUxVRSB8IF93aW5yZWcuS0VZX1dSSVRFKQogICAgICAgICAgICBleGNlcHQ6CiAgICAgICAgICAgICAgICBrZXkgPSBfd2lucmVnLkNyZWF0ZUtleShfd2lucmVnLkhLRVlfQ1VSUkVOVF9VU0VSLCBzZWxmLmtleW5hbWUpCiAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgIGZvciBrLCB2IGluIHNlbGYudmFsdWVzLml0ZXJpdGVtcygpOgogICAgICAgICAgICAgICAgICAgIF93aW5yZWcuU2V0VmFsdWVFeChrZXksIHN0cihrKSwgMCwgX3dpbnJlZy5SRUdfU1osIHN0cih2KSkKICAgICAgICAgICAgZmluYWxseToKICAgICAgICAgICAgICAgIGtleS5DbG9zZSgpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgZCA9IG9zLnBhdGguZGlybmFtZShzZWxmLmZpbGVuYW1lKQogICAgICAgICAgICBpZiBub3Qgb3MucGF0aC5pc2RpcihkKToKICAgICAgICAgICAgICAgIG9zLm1ha2VkaXJzKGQpCiAgICAgICAgICAgIAogICAgICAgICAgICBmID0gb3BlbihzZWxmLmZpbGVuYW1lLCAndycpCiAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgIGRhdGEgPSAnXG4nLmpvaW4oWyIlcz0lcyIgJSAoayx2KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIGssdiBpbiBzZWxmLnZhbHVlcy5pdGVyaXRlbXMoKV0pCiAgICAgICAgICAgICAgICBmLndyaXRlKGRhdGEpCiAgICAgICAgICAgIGZpbmFsbHk6CiAgICAgICAgICAgICAgICBmLmNsb3NlKCkKICAgIAogICAgZGVmIGdldChzZWxmLCBrZXksIHR5cGVjYXN0LCBkZWZhdWx0PU5vbmUpOgogICAgICAgIHRyeToKICAgICAgICAgICAgcmV0dXJuIHR5cGVjYXN0KHNlbGYudmFsdWVzW2tleV0pCiAgICAgICAgZXhjZXB0IChLZXlFcnJ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ycm9yKCJDb21tYW5kICVzIGZhaWxlZDogJXMiICUgKCcgJy5qb2luKGNtZCksIGUpKQogICAgICAgIAogICAgICAgIGlmIG9rX3JldHVybl92YWx1ZSBpcyBub3QgTm9uZSBhbmQgcC5yZXR1cm5jb2RlICE9IG9rX3JldHVybl92YWx1ZToKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJDb21tYW5kICVzIGZhaWxlZCAoY29kZSAlZCk6ICVzIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJSAoJyAnLmpvaW4oY21kKSwgcC5yZXR1cm5jb2RlLCBvdXQgKyBlcnIpKQogICAgICAgIHJldHVybiBvdXQgKyBlcnIKICAKZXhjZXB0IEltcG9ydEVycm9yOgoKICAgICMgUHl0aG9uIDwgMi40IC4uLgogICAgaW1wb3J0IHBvcGVuMgogICAgCiAgICBkZWYgZXhlY19jb21tYW5kKGNtZCwgb2tfcmV0dXJuX3ZhbHVlPTAsIGNvbWJpbmVfZXJyb3I9RmFsc2UpOgogICAgICAgICIiIgogICAgICAgIFJ1biBnaXZlbiBjb21tYW5kLCBjaGVjayByZXR1cm4gdmFsdWUsIGFuZCByZXR1cm4KICAgICAgICBjb25jYXRlbmF0ZWQgc3Rkb3V0IGFuZCBzdGRlcnIuCiAgICAgICAgIiIiCiAgICAgICAgCiAgICAgICAgIyBYWFg6IHVuaXgtb25seSEKCiAgICAgICAgdHJ5OgogICAgICAgICAgICBwID0gcG9wZW4yLlBvcGVuNChjbWQsIFRydWUpCiAgICAgICAgICAgIHAudG9jaGlsZC5jbG9zZSgpCiAgICAgICAgICAgIHJldHVybmNvZGUgPSBwLndhaXQoKSA+PiA4CiAgICAgICAgICAgIG91dCA9IHAuZnJvbWNoaWxkLnJlYWQoKQogICAgICAgIGV4Y2VwdCBPU0Vycm9yLCBlOgogICAgICAgICAgICByYWlzZSBSdW50aW1lRXJyb3IoIkNvbW1hbmQgJXMgZmFpbGVkOiAlcyIgJSAoJyAnLmpvaW4oY21k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saWMgYXBpCiAgICAKICAgIGRlZiBfX2luaXRfXyhzZWxmLCBkb2N1bWVudCk6CiAgICAgICAgIiIiCiAgICAgICAgSW5pdGlhbGl6ZSBMYXRleCAtPiBTVkcgY29udmVydGVyLgoKICAgICAgICA6UGFyYW1ldGVyczoKICAgICAgICAgIC0gYGRvY3VtZW50YDogRG9jdW1lbnQgd2hlcmUgdGhlIHJlc3VsdCBpcyB0byBiZSBlbWJlZGRlZCAocmVhZC1vbmx5KQogICAgICAgICIiIgogICAgICAgIGlmIERFQlVHX01PREU6CiAgICAgICAgICBzZWxmLnRtcF9wYXRoID0gVEVNUERJUl9URVhGSUxFX0RFQlVHCiAgICAgICAgZWxzZToKICAgICAgICAgIHNlbGYudG1wX3BhdGggPSB0ZW1wZmlsZS5ta2R0ZW1wKCkKICAgICAgICBzZWxmLnRtcF9iYXNlID0gJ3RtcCcKCiAgICBkZWYgY29udmVydChzZWxmLCBsYXRleF90ZXh0LCBwcmVhbWJsZV9maWxlLCBzY2FsZV9mYWN0b3IpOgogICAgICAgICIiIgogICAgICAgIFJldHVybiBhbiBYTUwgbm9kZSBjb250YWluaW5nIGxhdGV4IHRleHQKCiAgICAgICAgOlBhcmFtZXRlcnM6CiAgICAgICAgICAtIGBsYXRleF90ZXh0YDogTGF0ZXggY29kZSB0byB1c2UKICAgICAgICAgIC0gYHByZWFtYmxlX2ZpbGVgOiBOYW1lIG9mIGEgcHJlYW1ibGUgZmlsZSB0byBpbmNsdWRlCiAgICAgICAgICAtIGBzY2FsZV9mYWN0b3JgOiBTY2FsZSBmYWN0b3IgdG8gdXNlIGlmIG9iamVjdCBkb2Vzbid0IGhhdmUKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGEgYGB0cmFuc2Zvcm1gYCBhdHRyaWJ1dGUuCgogICAgICAgIDpSZXR1cm5zOiBYTUwgRE9NIG5vZGUKICAgICAgICAiIiIKICAgICAgICByYWlzZSBOb3RJbXBsZW1lbnRlZEVycm9yCgogICAgZGVmIGF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VhbWJsZV9maWxlLCAncicpCiAgICAgICAgICAgIHByZWFtYmxlICs9IGYucmVhZCgpCiAgICAgICAgICAgIGYuY2xvc2UoKQogICAgICAgIAogICAgICAgICMgT3B0aW9ucyBwYXNzIHRvIExhVGVYLXJlbGF0ZWQgY29tbWFuZHMKICAgICAgICBsYXRleE9wdHMgPSBbJy1pbnRlcmFjdGlvbj1ub25zdG9wbW9kZScsCiAgICAgICAgICAgICAgICAgICAgICctaGFsdC1vbi1lcnJvciddCiAgICAgICAgCiAgICAgICAgdGV4d3JhcHBlciA9IHIiIiIKICAgICAgICBcZG9jdW1lbnRjbGFzc1tsYW5kc2NhcGUsYTBde2FydGljbGV9CiAgICAgICAgJXMKICAgICAgICBccGFnZXN0eWxle2VtcHR5fQogICAgICAgIFxiZWdpbntkb2N1bWVudH0KICAgICAgICBcbm9pbmRlbnQKICAgICAgICAlcwogICAgICAgIFxlbmR7ZG9jdW1lbnR9CiAgICAgICAgIiIiICUgKHByZWFtYmxlLCBsYXRleF90ZXh0KQogIAogICAgICAgICMgQ29udmVydCBUZVggdG8gUERGCgogICAgICAgICMgV3JpdGUgdGV4CiAgICAgICAgZl90ZXggPSBvcGVuKHNlbGYudG1wKCd0ZXgnKSwgJ3cnKQogICAgICAgIHRyeToKICAgICAgICAgICAgZl90ZXgud3JpdGUodGV4d3JhcHBlcikKICAgICAgICBmaW5hbGx5OgogICAgICAgICAgICBmX3RleC5jbG9zZSgpCiAgICAgICAgICAgIAogICAgICAgICMgRXhlYyBwZGZsYXRleDogdGV4IC0+IHBkZgogICAgICAgIGV4ZWNfY29tbWFuZChbJ3BkZmxhdGV4Jywgc2VsZi50bXAoJ3RleCcpXSArIGxhdGV4T3B0cykKICAgICAgICBpZiBub3Qgb3MucGF0aC5leGlzdHMoc2VsZi50bXAoJ3BkZicpKToKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJwZGZsYXRleCBkaWRuJ3QgcHJvZHVjZSBvdXRwdXQiKQoKICAgIGR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b252X2NscwogICAgICAgICAgICAgICAgYnJlYWsKICAgICAgICAgICAgZXhjZXB0IFN0YW5kYXJkRXJyb3IsIGU6CiAgICAgICAgICAgICAgICBjb252ZXJ0ZXJfZXJyb3JzLmFwcGVuZCgiJXM6ICVzIiAlIChjb252X2Nscy5fX25hbWVfXywgc3RyKGUpKSkKICAgICAgICAKICAgICAgICBpZiBub3QgY29udmVydGVyX2NsczoKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJObyBMYXRleCAtPiBTVkcgY29udmVydGVyIGF2YWlsYWJsZTpcbiVzIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJSAnO1xuJy5qb2luKGNvbnZlcnRlcl9lcnJvcnMpKQogICAgICAgIAogICAgICAgICMgRmluZCByb290IGVsZW1lbnQKICAgICAgICBvbGRfbm9kZSwgdGV4dCwgcHJlYW1ibGVfZmlsZSA9IHNlbGYuZ2V0X29sZCgpCiAgICAgICAgCiAgICAgICAgIyBBc2sgZm9yIFRlWCBjb2RlCiAgICAgICAgaWYgc2VsZi5vcHRpb25zLnRleHQgaXMgTm9uZToKICAgICAgICAgICAgIyBJZiB0aGVyZSBpcyBhIHRyYW5zZm9ybSwgc2NhbGUgaW4gR1VJIHdpbGwgYmUgaWdub3JlZAogICAgICAgICAgICBpZiBvbGRfbm9kZSBpcyBub3QgTm9uZToKICAgICAgICAgICAgICAgIHNjYWxlX2ZhY3RvciA9IE5vbmUKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHNjYWxlX2ZhY3RvciA9IHNlbGYub3B0aW9ucy5zY2FsZV9mYWN0b3IKCiAgICAgICAgICAgIGlmIG5vdCBwcmVhbWJsZV9maWxlOgogICAgICAgICAgICAgICAgcHJlYW1ibGVfZmlsZSA9IHNlbGYub3B0aW9ucy5wcmVhbWJsZV9maWxlCgogICAgICAgICAgICBpZiBub3Qgb3MucGF0aC5pc2ZpbGUocHJlYW1ibGVfZmlsZSk6CiAgICAgICAgICAgICAgICBwcmVhbWJsZV9maWxlID0gIiIKICAgICAgICAgICAgCiAgICAgICAgICAgIGFza2VyID0gQXNrVGV4dCh0ZXh0LCBwcmVhbWJsZV9maWxlLCBzY2FsZV9mYWN0b3IpCiAgICAgICAgICAgIGFza2VyLmFzayhsYW1iZGEgdCwgcCwgczogc2VsZi5kb19jb252ZXJ0KHQsIHAsIHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnZlcnRlcl9jbHMsIG9sZF9ub2RlKSkKICAgICAgICBlbHNlOgogICAgICAgICAgICBzZWxmLmRvX2NvbnZlcnQoc2VsZi5vcHRpb25zLnRleHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLm9wdGlvbnMucHJlYW1ibGVfZmlsZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYub3B0aW9ucy5zY2FsZV9mYWN0b3IsIGNvbnZlcnRlcl9jbHMsIG9sZF9ub2RlKQoKICAgIGRlZiBkb19jb252ZXJ0KHNlbGYsIHRleHQsIHByZWFtYmxlX2ZpbGUsIHNjYWxlX2ZhY3RvciwgY29udmVydGVyX2NscywKICAgICAgICAgICAgICAgICAgIG9sZF9ub2RlKToKICAgICAgICAKICAgICAgICBpZiBub3QgdGV4dDoKICAgICAgICAgICAgcmV0dXJuCgogICAgICAgIGlmIGlzaW5zdGFuY2UodGV4dCwgdW5pY29kZSk6CiAgICAgICAgICAgIHRleHQgPSB0ZXh0LmVuY29kZSgndXRmLTgnKQogICAgICAgIAogICAgICAgICMgQ29udmVydAogICAgICAgIGNvbnZlcnRlciA9IGNvbnZlcnRlcl9jbHMoc2VsZi5kb2N1bWVudCkKICAgICAgICB0cnk6CiAgICAgICAgICAgIG5ld19ub2RlID0gY29udmVydGVyLmNvbnZlcnQodGV4dCwgcHJlYW1ibGVfZmlsZSwgc2NhbGVfZmFjdG9yKQogICAgICAgIGZpbmFsbHk6CiAgICAgICAgICAgIGNvbnZlcnRlci5maW5pc2goKQogICAgICAgIAogICAgICAgIGlmIG5ld19ub2RlIGlzIE5vbmU6CiAgICAgICAgICAgIHJldHVybiAjIG5vb3AKCiAgICAgICAgIyBJbnNlcnQgaW50byBkb2N1bWVudAoKICAgICAgICAjIC0tIFNldCB0ZXh0ZXh0IGF0dHJpYnMKICAgICAgICBuZXdfbm9kZS5hdHRyaWJbJ3slc310ZXh0JyVURVhURVhUX05TXSA9IHRleHQuZW5jb2RlKCdzdHJpbmctZXNjYXBlJykKICAgICAgICBuZXdfbm9kZS5hdHRyaWJbJ3slc31wcmVhbWJsZSclVEVYVEVYVF9OU10gPSBcCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWFtYmxlX2ZpbGUuZW5jb2RlKCdzdHJpbmctZXNjYXBlJykKCiAgICAgICAgIyAtLSBDb3B5IHRyYW5zZm9ybQogICAgICAgIHRyeToKICAgICAgICAgICAgIyBOb3RlOiB0aGUgbmV3IG5vZGUgZG9lcyAqbm90KiBoYXZlIHRoZSBTVkcgbmFtZXNwYWNlIHByZWZpeGVzIQogICAgICAgICAgICAjICAgICAgIFRoaXMgY2F1c2VkIHNvbWUgcHJvYmxlbXMgYXMgSW5rc2NhcGUgY291bGRuJ3QgcHJvcGVybHkKICAgICAgICAgICAgIyAgICAgICBoYW5kbGUgYm90aCBzdmc6IGFuZCBwcmVmaXhsZXNzIGVudHJpZXMgaW4gdGhlIHNhbWUgZmlsZQogICAgICAgICAgICAjICAgICAgIGluIHNvbWUgY2FzZXMuCiAgICAgICAgICAgIG5ld19ub2RlLmF0dHJpYlsndHJhbnNmb3JtJ10gPSBvbGRfbm9kZS5hdHRyaWJbJ3RyYW5zZm9ybSddCiAgICAgICAgZXhjZXB0IChLZXlFcnJvciwgSW5kZXhFcnJvciwgVHlwZUVycm9yLCBBdHRyaWJ1dGVFcnJvcik6CiAgICAgICAgICAgIHBhc3MKCiAgICAgICAgdHJ5OgogICAgICAgICAgICBuZXdfbm9kZS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IHNlbGYuc2VsZWN0ZWRbaV0KICAgICAgICAgICAgaWYgbm9kZS50YWcgIT0gJ3slc31nJyAlIFNWR19OUzogY29udGludWUKICAgICAgICAgICAgCiAgICAgICAgICAgIGlmICd7JXN9dGV4dCclVEVYVEVYVF9OUyBpbiBub2RlLmF0dHJpYjoKICAgICAgICAgICAgICAgICMgc3RhcnRpbmcgZnJvbSAwLjIsIHVzZSBuYW1lc3BhY2VzCiAgICAgICAgICAgICAgICByZXR1cm4gKG5vZGUsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUuYXR0cmliLmdldCgneyVzfXRleHQnJVRFWFRFWFRfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5hdHRyaWIuZ2V0KCd7JXN9cHJlYW1ibGUnJVRFWFRFWFRfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSkKICAgICAgICAgICAgZWxpZiAneyVzfXRleHQnJVNWR19OUyBpbiBub2RlLmF0dHJpYjoKICAgICAgICAgICAgICAgICMgPCAwLjIgYmFja3dhcmQgY29tcGF0aWJpbGl0eQogICAgICAgICAgICAgICAgcmV0dXJuIChub2RlLAogICAgICAgICAgICAgICAgICAgICAgICBub2RlLmF0dHJpYi5nZXQoJ3slc310ZXh0JyVTVkdfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5hdHRyaWIuZ2V0KCd7JXN9cHJlYW1ibGUnJVNWR19OUywgJycpLmRlY29kZSgnc3RyaW5nLWVzY2FwZScpKQogICAgICAgIHJldHVybiBOb25lLCAiIiwgIiIKCiAgICBkZWYgcmVwbGFjZV9ub2RlKHNlbGYsIG9sZF9ub2RlLCBuZXdfbm9kZSk6CiAgICAgICAgIiIiCiAgICAgICAgUmVwbGFjZSBhbiBYTUwgbm9kZSBvbGRfbm9kZSB3aXRoIG5ld19ub2RlCiAgICAgICAgaW4gc2VsZi5kb2N1bWVudC4KICAgICAgICAiIiIKICAgICAgICBpZiBvbGRfbm9kZSBpcyBOb25lOgogICAgICAgICAgICBzZWxmLmN1cnJlbnRfbGF5ZXIuYXBwZW5kKG5ld19ub2RlKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHBhcmVudCA9IG9sZF9ub2RlLmdldHBhcmVudCgpCiAgICAgICAgICAgIHBhcmVudC5yZW1vdmUob2xkX25vZGUpCiAgICAgICAgICAgIHBhcmVudC5hcHBlbmQobmV3X25vZGUpCgoKICAgIFNUWUxFX0FUVFJTID0gWydmaWxsJywnZmlsbC1vcGFjaXR5JywnZmlsbC1ydWxlJywKICAgICAgICAgICAgICAgICAgICdmb250LXNpemUtYWRqdXN0JywnZm9udC1zdHJldGNoJywKICAgICAgICAgICAgICAgICAgICdmb250LXN0eWxlJywnZm9udC12YXJpYW50JywKICAgICAgICAgICAgICAgICAgICdmb250LXdlaWdodCcsJ2xldHRlci1zcGFjaW5nJywKICAgICAgICAgICAgICAgICAgICdzdHJva2UnLCdzdHJva2UtZGFzaGFycmF5JywKICAgICAgICAgICAgICAgICAgICdzdHJva2UtbGluZWNhcCcsJ3N0cm9rZS1saW5lam9pbicsCiAgICAgICAgICAgICAgICAgICAnc3Ryb2tlLW1pdGVybGltaXQnLCdzdHJva2Utb3BhY2l0eScsCiAgICAgICAgICAgICAgICAgICAndGV4dC1hbmNob3InLCd3b3JkLXNwYWNpbmcnLCdzdHlsZSddCiAgICAKICAgIGRlZiBjb3B5X3N0eWxlKHNlbGYsIG9sZF9ub2RlLCBuZXdfbm9kZSk6CiAgICAgICAgIyBYWFg6IE5lZWRzIHdvcmsuLi4KICAgICAgICAjCiAgICAgICAgIyAgICAgIFdlIGNvdWxkIHRyeSB0cmF2ZXJzaW5nIHRoZSBub2RlIHRyZWUgZG93bndhcmRzIGFuZAogICAgICAgICMgICAgICByZW1vdmluZyBjb2xvci1hbHRlcmF0aW9uIGZyb20gdG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lua3NjYXBlL3RleHRleHRyYyIpCgogICAgICAgIHNlbGYubG9hZCgpCiAgICAKICAgIGRlZiBsb2FkKHNlbGYpOgogICAgICAgIGlmIFVTRV9XSU5ET1dTOgogICAgICAgICAgICBpbXBvcnQgX3dpbnJlZwogICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICBrZXkgPSBfd2lucmVnLk9wZW5LZXkoX3dpbnJlZy5IS0VZX0NVUlJFTlRfVVNFUiwgc2VsZi5rZXluYW1lKQogICAgICAgICAgICBleGNlcHQ6CiAgICAgICAgICAgICAgICByZXR1cm4KICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgc2VsZi52YWx1ZXMgPSB7fQogICAgICAgICAgICAgICAgZm9yIGogaW4gcmFuZ2UoMTAwMCk6CiAgICAgICAgICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgICAgICAgICBuYW1lLCBkYXRhLCBkdHlwZSA9IF93aW5yZWcuRW51bVZhbHVlKGtleSwgaikKICAgICAgICAgICAgICAgICAgICBleGNlcHQgRW52aXJvbm1lbnRFcnJvcjoKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsKICAgICAgICAgICAgICAgICAgICBzZWxmLnZhbHVlc1tuYW1lXSA9IHN0cihkYXRhKQogICAgICAgICAgICBmaW5hbGx5OgogICAgICAgICAgICAgICAga2V5LkNsb3NlKCkKICAgICAgICBlbHNlOgogICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICBmID0gb3BlbihzZWxmLmZpbGVuYW1lLCAncicpCiAgICAgICAgICAgIGV4Y2VwdCAoSU9FcnJvciwgT1NFcnJvcik6CiAgICAgICAgICAgICAgICByZXR1cm4KICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgc2VsZi52YWx1ZXMgPSB7fQogICAgICAgICAgICAgICAgZm9yIGxpbmUgaW4gZi5yZWFkKCkuc3BsaXQoIlxuIik6CiAgICAgICAgICAgICAgICAgICAgaWYgbm90ICc9JyBpbiBsaW5lOiBjb250aW51ZQogICAgICAgICAgICAgICAgICAgIGssIHYgPSBsaW5lLnNwbGl0KCI9IiwgMSkKICAgICAgICAgICAgICAgICAgICBzZWxmLnZhbHVlc1trLnN0cmlwKCldID0gdi5zdHJpcCgpCiAgICAgICAgICAgIGZpbmFsbHk6CiAgICAgICAgICAgICAgICBmLmNsb3NlKCkKICAgIAogICAgZGVmIHNhdmUoc2VsZik6CiAgICAgICAgaWYgVVNFX1dJTkRPV1M6CiAgICAgICAgICAgIGltcG9ydCBfd2lucmVnCiAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgIGtleSA9IF93aW5yZWcuT3BlbktleShfd2lucmVnLkhLRVlfQ1VSUkVOVF9VU0VSLCBzZWxmLmtleW5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtPV93aW5yZWcuS0VZX1NFVF9WQUxVRSB8IF93aW5yZWcuS0VZX1dSSVRFKQogICAgICAgICAgICBleGNlcHQ6CiAgICAgICAgICAgICAgICBrZXkgPSBfd2lucmVnLkNyZWF0ZUtleShfd2lucmVnLkhLRVlfQ1VSUkVOVF9VU0VSLCBzZWxmLmtleW5hbWUpCiAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgIGZvciBrLCB2IGluIHNlbGYudmFsdWVzLml0ZXJpdGVtcygpOgogICAgICAgICAgICAgICAgICAgIF93aW5yZWcuU2V0VmFsdWVFeChrZXksIHN0cihrKSwgMCwgX3dpbnJlZy5SRUdfU1osIHN0cih2KSkKICAgICAgICAgICAgZmluYWxseToKICAgICAgICAgICAgICAgIGtleS5DbG9zZSgpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgZCA9IG9zLnBhdGguZGlybmFtZShzZWxmLmZpbGVuYW1lKQogICAgICAgICAgICBpZiBub3Qgb3MucGF0aC5pc2RpcihkKToKICAgICAgICAgICAgICAgIG9zLm1ha2VkaXJzKGQpCiAgICAgICAgICAgIAogICAgICAgICAgICBmID0gb3BlbihzZWx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m4KICAgICAgICBjb25jYXRlbmF0ZWQgc3Rkb3V0IGFuZCBzdGRlcnIuCiAgICAgICAgIiIiCiAgICAgICAgdHJ5OgogICAgICAgICAgICBwID0gc3VicHJvY2Vzcy5Qb3BlbihjbWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZG91dD1zdWJwcm9jZXNzLlBJUEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZGVycj1zdWJwcm9jZXNzLlBJUEUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0ZGluPXN1YnByb2Nlc3MuUElQRSkKICAgICAgICAgICAgb3V0LCBlcnIgPSBwLmNvbW11bmljYXRlKCkKICAgICAgICBleGNlcHQgT1NFcnJvciwgZToKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJDb21tYW5kICVzIGZhaWxlZDogJXMiICUgKCcgJy5qb2luKGNtZCksIGUpKQogICAgICAgIAogICAgICAgIGlmIG9rX3JldHVybl92YWx1ZSBpcyBub3QgTm9uZSBhbmQgcC5yZXR1cm5jb2RlICE9IG9rX3JldHVybl92YWx1ZToKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJDb21tYW5kICVzIGZhaWxlZCAoY29kZSAlZCk6ICVzIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJSAoJyAnLmpvaW4oY21kKSwgcC5yZXR1cm5jb2RlLCBvdXQgKyBlcnIpKQogICAgICAgIHJldHVybiBvdXQgKyBlcnIKICAKZXhjZXB0IEltcG9ydEVycm9yOgoKICAgICMgUHl0aG9uIDwgMi40IC4uLgogICAgaW1wb3J0IHBvcGVuMgogICAgCiAgICBkZWYgZXhlY19jb21tYW5kKGNtZCwgb2tfcmV0dXJuX3ZhbHVlPTAsIGNvbWJpbmVfZXJyb3I9RmFsc2UpOgogICAgICAgICIiIgogICAgICAgIFJ1biBnaXZlbiBjb21tYW5kLCBjaGVjayByZXR1cm4gdmFsdWUsIG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b3J5LgogICAgICAgICIiIgogICAgICAgIHJldHVybiBvcy5wYXRoLmpvaW4oc2VsZi50bXBfcGF0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYudG1wX2Jhc2UgKyAnLicgKyBzdWZmaXgpCgogICAgZGVmIHRleF90b19wZGYoc2VsZiwgbGF0ZXhfdGV4dCwgcHJlYW1ibGVfZmlsZSk6CiAgICAgICAgIiIiCiAgICAgICAgQ3JlYXRlIGEgUERGIGZpbGUgZnJvbSBsYXRleCB0ZXh0CiAgICAgICAgIiIiCiAgICAgICAgCiAgICAgICAgIyBSZWFkIHByZWFtYmxlCiAgICAgICAgcHJlYW1ibGUgPSAiIgogICAgICAgIGlmIG9zLnBhdGguaXNmaWxlKHByZWFtYmxlX2ZpbGUpOgogICAgICAgICAgICBmID0gb3BlbihwcmVhbWJsZV9maWxlLCAncicpCiAgICAgICAgICAgIHByZWFtYmxlICs9IGYucmVhZCgpCiAgICAgICAgICAgIGYuY2xvc2UoKQogICAgICAgIAogICAgICAgICMgT3B0aW9ucyBwYXNzIHRvIExhVGVYLXJlbGF0ZWQgY29tbWFuZHMKICAgICAgICBsYXRleE9wdHMgPSBbJy1pbnRlcmFjdGlvbj1ub25zdG9wbW9kZScsCiAgICAgICAgICAgICAgICAgICAgICctaGFsdC1vbi1lcnJvciddCiAgICAgICAgCiAgICAgICAgdGV4d3JhcHBlciA9IHIiIiIKICAgICAgICBcZG9jdW1lbnRjbGFzc1tsYW5kc2NhcGUsYTBde2FydGljbGV9CiAgICAgICAgJXMKICAgICAgICBccGFnZXN0eWxle2VtcHR5fQogICAgICAgIFxiZWdpbntkb2N1bWVudH0KICAgICAgICBcbm9pbmRlbnQKICAgICAgICAlcwogICAgICAgIFxlbmR7ZG9jdW1lbnR9CiAgICAgICAgIiIiICUgKHByZWFtYmxlLCBsYXRleF90ZXh0KQogIAogICAgICAgICMgQ29udmVydCBUZVggdG8gUERGCgogICAgICAgICMgV3JpdGUgdGV4CiAgICAgICA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JldHVybnM6IDxzdmc6Zz4gbm9kZQogICAgICAgICIiIgogICAgICAgIHRyZWUgPSBldHJlZS5wYXJzZShzZWxmLnRtcCgnc3ZnJykpCiAgICAgICAgc2VsZi5maXhfeG1sX25hbWVzcGFjZSh0cmVlLmdldHJvb3QoKSkKICAgICAgICB0cnk6CiAgICAgICAgICAgIHJldHVybiBjb3B5LmNvcHkodHJlZS5nZXRyb290KCkueHBhdGgoJ2cnKVswXSkKICAgICAgICBleGNlcHQgSW5kZXhFcnJvcjoKICAgICAgICAgICAgcmV0dXJuIE5vbmUKCiAgICBkZWYgZml4X3htbF9uYW1lc3BhY2Uoc2VsZiwgbm9kZSk6CiAgICAgICAgc3ZnID0gJ3slc30nICUgU1ZHX05TCiAgICAgICAgCiAgICAgICAgaWYgbm9kZS50YWcuc3RhcnRzd2l0aChzdmcpOgogICAgICAgICAgICBub2RlLnRhZyA9IG5vZGUudGFnW2xlbihzdmcpOl0KICAgICAgICAKICAgICAgICBmb3Iga2V5IGluIG5vZGUuYXR0cmliLmtleXMoKToKICAgICAgICAgICAgaWYga2V5LnN0YXJ0c3dpdGgoc3ZnKToKICAgICAgICAgICAgICAgIG5ld19rZXkgPSBrZXlbbGVuKHN2Zyk6XQogICAgICAgICAgICAgICAgbm9kZS5hdHRyaWJbbmV3X2tleV0gPSBub2RlLmF0dHJpYltrZXldCiAgICAgICAgICAgICAgICBkZWwgbm9kZS5hdHRyaWJba2V5XQogICAgICAgIAogICAgICAgIGZvciBjIGluIG5vZGU6CiAgICAgICAgICAgIHNlbGYuZml4X3htbF9uYW1lc3BhY2UoYykKICAgIAoKY2xhc3MgU2tDb252ZXJ0KFBkZkNvbnZlcnRlckJhc2UpOgogICAgIiIiCiAgICBDb252ZXJ0IFBERiAtPiBTSyAtPiBTVkcgdXNpbmcgcHN0b2VkaXQgYW5kIHNrY29udmVydAogICAgIiIiCiAgICBkZWYgZ2V0X3RyYW5zZm9ybShzZWxmLCBzY2FsZV9mYWN0b3IpOgogICAg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CcvLypbYXR0cmlidXRlOjppZF0nKSk6CiAgICAgICAgICAgIGN1cl9pZCA9IGVsLmF0dHJpYlsnaWQnXQogICAgICAgICAgICBuZXdfaWQgPSAiJXMlcy0lZCIgJSAoSURfUFJFRklYLCBzZWxmLmhhc2gsIGkpCiAgICAgICAgICAgIGhyZWZfbWFwWycjJyArIGN1cl9pZF0gPSAiIyIgKyBuZXdfaWQKICAgICAgICAgICAgZWwuYXR0cmliWydpZCddID0gbmV3X2lkCgogICAgICAgICMgUmVwbGFjZSBocmVmcwogICAgICAgIHVybF9yZSA9IHJlLmNvbXBpbGUoJ151cmxcKCguKilcKSQnKQoKICAgICAgICBmb3IgZWwgaW4gcm9vdC54cGF0aCgnLy8qW2F0dHJpYnV0ZTo6eGxpbms6aHJlZl0nLCBuYW1lc3BhY2VzPU5TUyk6CiAgICAgICAgICAgIGhyZWYgPSBlbC5hdHRyaWJbJ3slc31ocmVmJyVYTElOS19OU10KICAgICAgICAgICAgZWwuYXR0cmliWyd7JXN9aHJlZiclWExJTktfTlNdID0gaHJlZl9tYXAuZ2V0KGhyZWYsIGhyZWYpCgogICAgICAgIGZvciBlbCBpbiByb290LnhwYXRoKCcvLypbYXR0cmlidXRlOjpzdmc6Y2xpcC1wYXRoXScsIG5hbWVzcGFjZXM9TlNTKToKICAgICAgICAgICAgdmFsdWUgPSBlbC5hdHRyaWJbJ2NsaXAtcGF0aCddCiAgICAgICAgICAgIG0gPSB1cmxfcmUubWF0Y2godmFsdWUpCiAgICAgICAgICAgIGlmIG06CiAgICAgICAgICAgICAgICBlbC5hdHRyaWJbJ2NsaXAtcGF0aCddID0gXAogICAgICAgICAgICAgICAgICAgICd1cmwoJXMpJyAlIGhyZWZfbWFwLmdldChtLmdyb3VwKDEpLCBtLmdyb3VwKDEpKQoKICAgICAgICAjIEJ1bmRsZSBldmVyeXRoaW5nIGluIGEgc2luZ2xlIGdyb3VwCiAgICAgICAgbWFzdGVyX2dyb3VwID0gZXRyZWUuU3ViRWxl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ICAgICAgICAgIGRlZmF1bHQ9c2VsZi5zZXR0aW5ncy5nZXQoJ3ByZWFtYmxlJywgc3RyLCAiIikpCiAgICAgICAgc2VsZi5PcHRpb25QYXJzZXIuYWRkX29wdGlvbigKICAgICAgICAgICAgIi1zIiwgIi0tc2NhbGUtZmFjdG9yIiwgYWN0aW9uPSJzdG9yZSIsIHR5cGU9ImZsb2F0IiwKICAgICAgICAgICAgZGVzdD0ic2NhbGVfZmFjdG9yIiwKICAgICAgICAgICAgZGVmYXVsdD1zZWxmLnNldHRpbmdzLmdldCgnc2NhbGUnLCBmbG9hdCwgMS4wKSkKICAgIAogICAgZGVmIGVmZmVjdChzZWxmKToKICAgICAgICAiIiJQZXJmb3JtIHRoZSBlZmZlY3Q6IGNyZWF0ZS9tb2RpZnkgVGV4VGV4dCBvYmplY3RzIiIiCiAgICAgICAgZ2xvYmFsIENPTlZFUlRFUlMKCiAgICAgICAgIyBQaWNrIGEgY29udmVydGVyCiAgICAgICAgY29udmVydGVyX2Vycm9ycyA9IFtdCiAgICAgICAgCiAgICAgICAgY29udmVydGVyX2NscyA9IE5vbmUKICAgICAgICBmb3IgY29udl9jbHMgaW4gQ09OVkVSVEVSUzoKICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgY29udl9jbHMuYXZhaWxhYmxlKCkKICAgICAgICAgICAgICAgIGNvbnZlcnRlcl9jbHMgPSBjb252X2NscwogICAgICAgICAgICAgICAgYnJlYWsKICAgICAgICAgICAgZXhjZXB0IFN0YW5kYXJkRXJyb3IsIGU6CiAgICAgICAgICAgICAgICBjb252ZXJ0ZXJfZXJyb3JzLmFwcGVuZCgiJXM6ICVzIiAlIChjb252X2Nscy5fX25hbWVfXywgc3RyKGUpKSkKICAgICAgICAKICAgICAgICBpZiBub3QgY29udmVydGVyX2NsczoKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJObyBMYXRleCAtPiBTVkcgY29udmVydGVyIGF2YWlsYWJsZTpcbiVzIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJSAnO1xuJy5qb2luKGNvbnZlcnRlcl9lcnJvcnMpKQogICAgICAgIAogICAgICAgICMgRmluZCByb290IGVsZW1lbnQKICAgICAgICBvbGRfbm9kZSwgdGV4dCwgcHJlYW1ibGVfZmlsZSA9IHNlbGYuZ2V0X29sZCgpCiAgICAgICAgCiAgICAgICAgIyBBc2sgZm9yIFRlWCBjb2RlCiAgICAgICAgaWYgc2VsZi5vcHRpb25zLnRleHQgaXMgTm9uZToKICAgICAgICAgICAgIyBJZiB0aGVyZSBpcyBhIHRyYW5zZm9ybSwgc2NhbGUgaW4gR1VJIHdpbGwgYmUgaWdub3JlZAogICAgICAgICAgICBpZiBvbGRfbm9kZSBpcyBub3QgTm9uZToKICAgICAgICAgICAgICAgIHNjYWxlX2ZhY3RvciA9IE5vbmUKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHNjYWxlX2ZhY3RvciA9IHNlbGYub3B0aW9ucy5zY2FsZV9mYWN0b3IKCiAgICAgICAgICAgIGlmIG5vdCBwcmVhbWJsZV9maWxlOgogICAgICAgICAgICAgICAgcHJlYW1ibGVfZmlsZSA9IHNlbGYub3B0aW9ucy5wcmVhbWJsZV9maWxlCgogICAgICAgICAgICBpZiBub3Qgb3MucGF0aC5pc2ZpbGUocHJlYW1ibGVfZmlsZSk6CiAgICAgICAgICAgICAgICBwcmVhbWJsZV9maWxlID0gIiIKICAgICAgICAgICAgCiAgICAgICAgICAgIGFza2VyID0gQXNrVGV4dCh0ZXh0LCBwcmVhbWJsZV9maWxlLCBzY2FsZV9mYWN0b3IpCiAgICAgICAgICAgIGFza2VyLmFzayhsYW1iZGEgdCwgcCwgczogc2VsZi5kb19jb252ZXJ0KHQsIHAsIHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnZlcnRlcl9jbHMsIG9sZF9ub2RlKSkKICAgICAgICBlbHNlOgogICAgICAgICAgICBzZWxmLmRvX2NvbnZlcnQoc2VsZi5vcHRpb25zLnRleHQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxmLm9wdGlvbnMucHJlYW1ibGVfZmlsZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGYub3B0aW9ucy5zY2FsZV9mYWN0b3IsIGNvbnZlcnRlcl9jbHMsIG9sZF9ub2RlKQoKICAgIGRlZiBkb19jb252ZXJ0KHNlbGYsIHRleHQsIHByZWFtYmxlX2ZpbGUsIHNjYWxlX2ZhY3RvciwgY29udmVydGVyX2NscywKICAgICAgICAgICAgICAgICAgIG9sZF9ub2RlKToKICAgICAgICAKICAgICAgICBpZiBub3QgdGV4dDoKICAgICAgICAgICAgcmV0dXJuCgogICAgICAgIGlmIGlzaW5zdGFuY2UodGV4dCwgdW5pY29kZSk6CiAgICAgICAgICAgIHRleHQgPSB0ZXh0LmVuY29kZSgndXRmLTgnKQogICAgICAgIAogICAgICAgICMgQ29udmVydAogICAgICAgIGNvbnZlcnRlciA9IGNvbnZlcnRlcl9jbHMoc2VsZi5kb2N1bWVudCkKICAgICAgICB0cnk6CiAgICAgICAgICAgIG5ld19ub2RlID0gY29udmVydGVyLmNvbnZlcnQodGV4dCwgcHJlYW1ibGVfZmlsZSwgc2NhbGVfZmFjdG9yKQogICAgICAgIGZpbmFsbHk6CiAgICAgICAgICAgIGNvbnZlcnRlci5maW5pc2goKQogICAgICAgIAogICAgICAgIGlmIG5ld19ub2RlIGlzIE5vbmU6CiAgICAgICAgICAgIHJldHVybiAjIG5vb3AKCiAgICAgICAgIyBJbnNlcnQgaW50byBkb2N1bWVudAoKICAgICAgICAjIC0tIFNldCB0ZXh0ZXh0IGF0dHJpYnMKICAgICAgICBuZXdfbm9kZS5hdHRyaWJbJ3slc310ZXh0JyVURVhURVhUX05TXSA9IHRleHQuZW5jb2RlKCdzdHJpbmctZXNjYXBlJykKICAgICAgICBuZXdfbm9kZS5hdHRyaWJbJ3slc31wcmVhbWJ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GUpCiAgICAgICAgCiAgICAgICAgIyAtLSBSZXBsYWNlCiAgICAgICAgc2VsZi5yZXBsYWNlX25vZGUob2xkX25vZGUsIG5ld19ub2RlKQoKICAgICAgICAjIC0tIFNhdmUgc2V0dGluZ3MKICAgICAgICBpZiBvcy5wYXRoLmlzZmlsZShwcmVhbWJsZV9maWxlKToKICAgICAgICAgICAgc2VsZi5zZXR0aW5ncy5zZXQoJ3ByZWFtYmxlJywgcHJlYW1ibGVfZmlsZSkKICAgICAgICBpZiBzY2FsZV9mYWN0b3IgaXMgbm90IE5vbmU6CiAgICAgICAgICAgIHNlbGYuc2V0dGluZ3Muc2V0KCdzY2FsZScsIHNjYWxlX2ZhY3RvcikKICAgICAgICBzZWxmLnNldHRpbmdzLnNhdmUoKQogICAgCiAgICBkZWYgZ2V0X29sZChzZWxmKToKICAgICAgICAiIiIKICAgICAgICBEaWcgb3V0IExhVGVYIGNvZGUgYW5kIG5hbWUgb2YgcHJlYW1ibGUgZmlsZSBmcm9tIG9sZAogICAgICAgIFRleFRleHQtZ2VuZXJhdGVkIG9iamVjdHMuCgogICAgICAgIDpSZXR1cm5zOiAob2xkX25vZGUsIGxhdGV4X3RleHQsIHByZWFtYmxlX2ZpbGVfbmFtZSkKICAgICAgICAiIiIKCiAgICAgICAgZm9yIGkgaW4gc2VsZi5vcHRpb25zLmlkczoKICAgICAgICAgICAgbm9kZSA9IHNlbGYuc2VsZWN0ZWRbaV0KICAgICAgICAgICAgaWYgbm9kZS50YWcgIT0gJ3slc31nJyAlIFNWR19OUzogY29udGludWUKICAgICAgICAgICAgCiAgICAgICAgICAgIGlmICd7JXN9dGV4dCclVEVYVEVYVF9OUyBpbiBub2RlLmF0dHJpYjoKICAgICAgICAgICAgICAgICMgc3RhcnRpbmcgZnJvbSAwLjIsIHVzZSBuYW1lc3BhY2VzCiAgICAgICAgICAgICAgICByZXR1cm4gKG5vZGUsCiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUuYXR0cmliLmdldCgneyVzfXRleHQnJVRFWFRFWFRfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5hdHRyaWIuZ2V0KCd7JXN9cHJlYW1ibGUnJVRFWFRFWFRfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSkKICAgICAgICAgICAgZWxpZiAneyVzfXRleHQnJVNWR19OUyBpbiBub2RlLmF0dHJpYjoKICAgICAgICAgICAgICAgICMgPCAwLjIgYmFja3dhcmQgY29tcGF0aWJpbGl0eQogICAgICAgICAgICAgICAgcmV0dXJuIChub2RlLAogICAgICAgICAgICAgICAgICAgICAgICBub2RlLmF0dHJpYi5nZXQoJ3slc310ZXh0JyVTVkdfTlMsICcnKS5kZWNvZGUoJ3N0cmluZy1lc2NhcGUnKSwKICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5hdHRyaWIuZ2V0KCd7JXN9cHJlYW1ibGUnJVNWR19OUywgJycpLmRlY29kZSgnc3RyaW5nLWVzY2FwZScpKQogICAgICAgIHJldHVybiBOb25lLCAiIiwgIiIKCiAgICBkZWYgcmVwbGFjZV9ub2RlKHNlbGYsIG9sZF9ub2RlLCBuZXdfbm9kZSk6CiAgICAgICAgIiIiCiAgICAgICAgUmVwbGFjZSBhbiBYTUwgbm9kZSBvbGRfbm9kZSB3aXRoIG5ld19ub2RlCiAgICAgICAgaW4gc2VsZi5kb2N1bWVudC4KICAgICAgICAiIiIKICAgICAgICBpZiBvbGRfbm9kZSBpcyBOb25lOgogICAgICAgICAgICBzZWxmLmN1cnJlbnRfbGF5ZXIuYXBwZW5kKG5ld19ub2RlKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHBhcmVudCA9IG9sZF9ub2RlLmdldHBhcmVudCgpCiAgICAgICAgICAgIHBhcmVudC5yZW1vdmUob2xkX25vZGUpCiAgICAgICAgICAgIHBhcmVudC5hcHBlbmQobmV3X25vZGUpCgoKICAgIFNUWUxFX0FUVFJTID0gWydmaWxsJywnZmlsbC1vcGFjaXR5JywnZmlsbC1ydWxlJywKICAgICAgICAgICAgICAgICAgICdmb250LXNpemUtYWRqdXN0JywnZm9udC1zdHJldGNoJywKICAgICAgICAgICAgICAgICAgICdmb250LXN0eWxlJywnZm9udC12YXJpYW50JywKICAgICAgICAgICAgICAgICAgICdmb250LXdlaWdodCcsJ2xldHRlci1zcGFjaW5nJywKICAgICAgICAgICAgICAgICAgICdzdHJva2UnLCdzdHJva2UtZGFzaGFycmF5JywKICAgICAgICAgICAgICAgICAgICdzdHJva2UtbGluZWNhcCcsJ3N0cm9rZS1saW5lam9pbicsCiAgICAgICAgICAgICAgICAgICAnc3Ryb2tlLW1pdGVybGltaXQnLCdzdHJva2Utb3BhY2l0eScsCiAgICAgICAgICAgICAgICAgICAndGV4dC1hbmNob3InLCd3b3JkLXNwYWNpbmcnLCdzdHlsZSddCiAgICAKICAgIGRlZiBjb3B5X3N0eWxlKHNlbGYsIG9sZF9ub2RlLCBuZXdfbm9kZSk6CiAgICAgICAgIyBYWFg6IE5lZWRzIHdvcmsuLi4KICAgICAgICAjCiAgICAgICAgIyAgICAgIFdlIGNvdWxkIHRyeSB0cmF2ZXJzaW5nIHRoZSBub2RlIHRyZWUgZG93bndhcmRzIGFuZAogICAgICAgICMgICAgICByZW1vdmluZyBjb2xvci1hbHRlcmF0aW9uIGZyb20gdGhlIGF0dHJpYnV0ZXMuCiAgICAgICAgIyAgICAgIE5vdCBzdHJhaWdodGZvcndhcmQsIG5lZWQgdG8gcmVhZCB0aGUgU1ZHIHNwZWMuLi4KICAgICAgICAjCiAgICAgICAgIyAgICAgIFJlbW92aW5nIHN0eWxlIGF0dHJpYnV0ZXMgZG9lcyBub3Qgd29yayBpbiBnZW5lcmFsLCBiZWNhdXNlCiAgICAgICAgIyAgICAgIGF0IGxlYXN0IHBkZjJzdmcgcmVsaWVzIG9uIHByZXNlcnZpbmcgdGhlIHN0cm9rZSBhdHRycy4KICAgICAgICA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AgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgc2VsZi52YWx1ZXMgPSB7fQogICAgICAgICAgICAgICAgZm9yIGogaW4gcmFuZ2UoMTAwMCk6CiAgICAgICAgICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgICAgICAgICBuYW1lLCBkYXRhLCBkdHlwZSA9IF93aW5yZWcuRW51bVZhbHVlKGtleSwgaikKICAgICAgICAgICAgICAgICAgICBleGNlcHQgRW52aXJvbm1lbnRFcnJvcjoKICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWsKICAgICAgICAgICAgICAgICAgICBzZWxmLnZhbHVlc1tuYW1lXSA9IHN0cihkYXRhKQogICAgICAgICAgICBmaW5hbGx5OgogICAgICAgICAgICAgICAga2V5LkNsb3NlKCkKICAgICAgICBlbHNlOgogICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICBmID0gb3BlbihzZWxmLmZpbGVuYW1lLCAncicpCiAgICAgICAgICAgIGV4Y2VwdCAoSU9FcnJvciwgT1NFcnJvcik6CiAgICAgICAgICAgICAgICByZXR1cm4KICAgICAgICAgICAgdHJ5OgogICAgICAgICAgICAgICAgc2VsZi52YWx1ZXMgPSB7fQogICAgICAgICAgICAgICAgZm9yIGxpbmUgaW4gZi5yZWFkKCkuc3BsaXQoIlxuIik6CiAgICAgICAgICAgICAgICAgICAgaWYgbm90ICc9JyBpbiBsaW5lOiBjb250aW51ZQogICAgICAgICAgICAgICAgICAgIGssIHYgPSBsaW5lLnNwbGl0KCI9IiwgMSkKICAgICAgICAgICAgICAgICAgICBzZWxmLnZhbHVlc1trLnN0cmlwKCldID0gdi5zdHJpcCgpCiAgICAgICAgICAgIGZpbmFsbHk6CiAgICAgICAgICAgICAgICBmLmNsb3NlKCkKICAgIAogICAgZGVmIHNhdmUoc2VsZik6CiAgICAgICAgaWYgVVNFX1dJTkRPV1M6CiAgICAgICAgICAgIGltcG9ydCBfd2lucmVnCiAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgIGtleSA9IF93aW5yZWcuT3BlbktleShfd2lucmVnLkhLRVlfQ1VSUkVOVF9VU0VSLCBzZWxmLmtleW5hbWUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2FtPV93aW5yZWcuS0VZX1NFVF9WQUxVRSB8IF93aW5yZWcuS0VZX1dSSVRFKQogICAgICAgICAgICBleGNlcHQ6CiAgICAgICAgICAgICAgICBrZXkgPSBfd2lucmVnLkNyZWF0ZUtleShfd2lucmVnLkhLRVlfQ1VSUkVOVF9VU0VSLCBzZWxmLmtleW5hbWUpCiAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgIGZvciBrLCB2IGluIHNlbGYudmFsdWVzLml0ZXJpdGVtcygpOgogICAgICAgICAgICAgICAgICAgIF93aW5yZWcuU2V0VmFsdWVFeChrZXksIHN0cihrKSwgMCwgX3dpbnJlZy5SRUdfU1osIHN0cih2KSkKICAgICAgICAgICAgZmluYWxseToKICAgICAgICAgICAgICAgIGtleS5DbG9zZSgpCiAgICAgICAgZWxzZToKICAgICAgICAgICAgZCA9IG9zLnBhdGguZGlybmFtZShzZWxmLmZpbGVuYW1lKQogICAgICAgICAgICBpZiBub3Qgb3MucGF0aC5pc2RpcihkKToKICAgICAgICAgICAgICAgIG9zLm1ha2VkaXJzKGQpCiAgICAgICAgICAgIAogICAgICAgICAgICBmID0gb3BlbihzZWxmLmZpbGVuYW1lLCAndycpCiAgICAgICAgICAgIHRyeToKICAgICAgICAgICAgICAgIGRhdGEgPSAnXG4nLmpvaW4oWyIlcz0lcyIgJSAoayx2KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIGssdiBpbiBzZWxmLnZhbHVlcy5pdGVyaXRlbXMoKV0pCiAgICAgICAgICAgICAgICBmLndyaXRlKGRhdGEpCiAgICAgICAgICAgIGZpbmFsbHk6CiAgICAgICAgICAgICAgICBmLmNsb3NlKCkKICAgIAogICAgZGVmIGdldChzZWxmLCBrZXksIHR5cG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YnByb2Nlc3MuUElQRSkKICAgICAgICAgICAgb3V0LCBlcnIgPSBwLmNvbW11bmljYXRlKCkKICAgICAgICBleGNlcHQgT1NFcnJvciwgZToKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJDb21tYW5kICVzIGZhaWxlZDogJXMiICUgKCcgJy5qb2luKGNtZCksIGUpKQogICAgICAgIAogICAgICAgIGlmIG9rX3JldHVybl92YWx1ZSBpcyBub3QgTm9uZSBhbmQgcC5yZXR1cm5jb2RlICE9IG9rX3JldHVybl92YWx1ZToKICAgICAgICAgICAgcmFpc2UgUnVudGltZUVycm9yKCJDb21tYW5kICVzIGZhaWxlZCAoY29kZSAlZCk6ICVzIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJSAoJyAnLmpvaW4oY21kKSwgcC5yZXR1cm5jb2RlLCBvdXQgKyBlcnIpKQogICAgICAgIHJldHVybiBvdXQgKyBlcnIKICAKPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgpleGNlcHQgSW1wb3J0RXJyb3I6CgogICAgIyBQeXRob24gPCAyLjQgLi4uCiAgICBpbXBvcnQgcG9wZW4yCjx8ZmltX2VuZHw+
59a17132f58552a56245899667cfa09fdff59db8-1
59a17132f58552a56245899667cfa09fdff59db8
PHxmaW1fcHJlZml4fD4KaW1wb3J0IG9zCmltcG9ydCBzdWJwcm9jZXNzCmltcG9ydCBzeXMKaW1wb3J0IHRlbXBmaWxlCmZyb20gcGF0aGxpYiBpbXBvcnQgUGF0aApmcm9tIHR5cGluZyBpbXBvcnQgVGV4dElPLCBPcHRpb25hbCwgQW55U3RyCgoKZGVmIHRvX3BhdGgoKmFyZ3M6IHN0cikgLT4gUGF0aDoKICAgIHJldHVybiBQYXRoKG9zLnBhdGguam9pbigqYXJncykpLnJlc29sdmUoKQoKCmRlZiB0b19zdHIoYnl0ZXNfc3RyOiBBbnlTdHIpIC0+IHN0cjoKICAgIGlmIGlzaW5zdGFuY2UoYnl0ZXNfc3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fc3RkZXJyOgogICAgICAgICAgICAgICAgcmV0dXJuIEtub3duSXNzdWUoKSAgIyBub3RoaW5nIGhhcHBlbnMKICAgICAgICAgICAgaWYgcmF3X3N0ZGVycjoKICAgICAgICAgICAgICAgIHN5cy5zdGRvdXQud3JpdGUoCiAgICAgICAgICAgICAgICAgICAgZidXaGlsZSBydW5uaW5nICJ7Y21kfSIsIHByb2Nlc3MgcmV0dXJuZWQge3JldHVybl9jb2RlfSB3aXRoIHRoZSBmb2xsb3dpbmcgc3RkZXJyOlxuJwogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC53cml0ZShyYXdfc3RkZXJyKQogICAgICAgICAgICAgICAgc3lzLnN0ZG91dC5mbHVzaCgpCiAgICAgICAgICAgICAgICBzeXMuZXhpdChyZXR1cm5fY29kZSkKPHxmaW1fc3VmZml4fD4KICAgIGxvZ19zdHJlYW0ud3JpdGUoJ3J1biBjb21tYW5kOiAnICsgY21kICsgJ1xuJykKICAgIHdpdGggdGVtcGZpbGUuTmFtZWRUZW1wb3JhcnlGaWxlKCkgYXMgZnc6CiAgICAgICAgIyBzZXQgc3Rkb3V0IGFuZCBzdGRlcnIgYm90aCB0byBzdWJwcm9jZXNzLlBJUEUgbWF5IGNhdXNlIGRlYWRsb2NrCiAgICAgICAgIyBodHRwczovL2RvY3MucHl0aG9uLm9yZy8zL2xpYnJhcnkvc3VicHJvY2Vzcy5odG1sI3N1YnByb2Nlc3MuUG9wZW4ud2FpdAo8fGZpbV9lbmR8Pg==
59a17132f58552a56245899667cfa09fdff59db8-2
59a17132f58552a56245899667cfa09fdff59db8
PHxmaW1fcHJlZml4fD4KaW1wb3J0IG9zCmltcG9ydCBzdWJwcm9jZXNzCmltcG9ydCBzeXMKaW1wb3J0IHRlbXBmaWxlCmZyb20gcGF0aGxpYiBpbXBvcnQgUGF0aApmcm9tIHR5cGluZyBpbXBvcnQgVGV4dElPLCBPcHRpb25hbCwgQW55U3RyCgoKZGVmIH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ICAgaWdub3JlX2Vycm9yOiBPcHRpb25hbFtzdHJdID0gTm9uZSwKICAgICoqa3dhcmdzLAo8fGZpbV9lbmR8Pg==
af1a3c1bbe2fb440a55689f9b422c2bf3386222b-1
af1a3c1bbe2fb440a55689f9b422c2bf3386222b
PHxmaW1fcHJlZml4fD4KIyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KIyBHZW5lcmF0ZWQgYnkgRGphbmdvIDEuMTEuNCBvbiAyMDE3LTA5LTAxIDE0OjUxCmZyb20gX19mdXR1cmVfXyBpbXBvcnQgdW5pY29kZV9saXRlcmFscwoKPHxmaW1faG9sZXw+CmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnYWNjb3VudCcsICcwMDAyX2F1dG9fMjAxNzA4MzFfMTMxMicpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nVXNlckludGVyZXN0JywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKGF1dG9fY3JlYXRlZD1UcnVlLCBwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UsIHZlcmJvc2VfbmFtZT0nSUQnKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdpbnRlcmVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VzZXInLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcmludGVyZXN0JywKICAgICAgICAgICAgbmFtZT0naW50ZXJlc3QnLAogICAgICAgICAgICBmaWVsZD1tb2RlbH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wMDAyX2F1dG9fMjAxNzA4MzFfMTMxMicpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nVXNlckludGVyZXN0JywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKGF1dG9fY3JlYXRlZD1UcnVlLCBwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UsIHZlcmJvc2VfbmFtZT0nSUQnKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdpbnRlcmVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VzZXInLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKPHxmaW1faG9sZXw+CiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLkFkZEZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSd1c2VyaW50ZXJlc3QnLAogICAgICAgICAgICBuYW1lPSd1c2VyJywKICAgICAgICAgICAgZmllbGQ9bW9kZWxzLkZvcmVpZ25LZXkobnVsbD1UcnVlLCBvbl9kZWxldGU9ZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbi5DQVNDQURFLCByZWxhdGVkX25hbWU9J3VzZXJpbnRlcmVzdCcsIHRvPSdhY2NvdW50LlVzZXJQcm9maWxlJyksCiAgICAgICAgKSwKICAgIF0KPHxmaW1fc3VmZml4fD4KICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcmludGVyZXN0JywKICAgICAgICAgICAgbmFtZT0naW50ZXJlc3QnLAogICAgICAgICAgICBmaWVsZD1tb2RlbHMuRm9yZWlnbktleShudWxsPVRydWUsIG9uX2RlbGV0ZT1kamFuZ28uZGIubW9kZWxzLmRlbGV0aW9uLkNBU0NBREUsIHJlbGF0ZWRfbmFtZT0ndXNlcmludGVyZXN0JywgdG89J2FjY291bnQuSW50ZXJlc3QnKSwKPHxmaW1fZW5kfD4=
af1a3c1bbe2fb440a55689f9b422c2bf3386222b-3
af1a3c1bbe2fb440a55689f9b422c2bf3386222b
PHxmaW1fcHJlZml4fD4KIyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KIyBHZW5lcmF0ZWQgYnkgRGphbmdvIDEuMTEuNCBvbiAyMDE3LTA5LTAxIDE0OjUxCmZyb20gX19mdXR1cmVfXyBpbXBvcnQgdW5pY29kZV9saXRlcmFscwoKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwppbXBvcnQgZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbgoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnYWNjb3VudCcsICcwMDAyX2F1dG9fMjAxNzA4MzFfMTMxMicpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nVXNlckludGVyZXN0JywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKGF1dG9fY3JlYXRlZD1UcnVlLCBwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UsIHZlcmJvc2VfbmFtZT0nSUQnKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdpbnRlcmVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VzZXInLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICA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ncmF0aW9uKToKCjx8ZmltX2VuZHw+
af1a3c1bbe2fb440a55689f9b422c2bf3386222b-5
af1a3c1bbe2fb440a55689f9b422c2bf3386222b
PHxmaW1fcHJlZml4fD4KIyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KIyBHZW5lcmF0ZWQgYnkgRGphbmdvIDEuMTEuNCBvbiAyMDE3LTA5LTAxIDE0OjUxCmZyb20gX19mdXR1cmVfXyBpbXBvcnQgdW5pY29kZV9saXRlcmFscwoKZnJvbSBkamFuZ28uZGIgaW1wb3J0IG1pZ3JhdGlvbnMsIG1vZGVscwppbXBvcnQgZGphbmdvLmRiLm1vZGVscy5kZWxldGlvbgoKCmNsYXNzIE1pZ3JhdGlvbihtaWdyYXRpb25zLk1pZ3JhdGlvbik6CgogICAgZGVwZW5kZW5jaWVzID0gWwogICAgICAgICgnYWNjb3VudCcsICcwMDAyX2F1dG9fMjAxNzA4MzFfMTMxMicpLAogICAgXQoKICAgIG9wZXJhdGlvbnMgPSBbCiAgICAgICAgbWlncmF0aW9ucy5DcmVhdGVNb2RlbCgKICAgICAgICAgICAgbmFtZT0nVXNlckludGVyZXN0JywKICAgICAgICAgICAgZmllbGRzPVsKICAgICAgICAgICAgICAgICgnaWQnLCBtb2RlbHMuQXV0b0ZpZWxkKGF1dG9fY3JlYXRlZD1UcnVlLCBwcmltYXJ5X2tleT1UcnVlLCBzZXJpYWxpemU9RmFsc2UsIHZlcmJvc2VfbmFtZT0nSUQnKSksCiAgICAgICAgICAgIF0sCiAgICAgICAgKSwKICAgICAgICBtaWdyYXRpb25zLlJlbW92ZUZpZWxkKAogICAgICAgICAgICBtb2RlbF9uYW1lPSdpbnRlcmVzdCcsCiAgICAgICAgICAgIG5hbWU9J3VzZXInLAogICAgICAgICksCiAgICAgICAgbWlncmF0aW9ucy5BZGRGaWVsZCgKICAgICAgICAgICAgbW9kZWxfbmFtZT0ndXNlcmludGVyZXN0JywKICAgICAgICAgICAgbmFtZT0naW50ZXJlc3QnLAogIC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pjbGFzcyBVcGRhdGVMRURTdHJpcFRocmVhZChRVGhyZWFkKToKICAgIHNpZ191cGRhdGVfdmlldyA9IHB5cXRTaWduYWwobGlzdCkKCiAgICBkZWYgX19pbml0X18oc2VsZiwgcGFyZW50KToKICAgICAgICBzdXBlcihVcGRhdGVMRURTdHJpcFRocmVhZCwgc2VsZikuX19pbml0X18ocGFyZW50KQogICAgICAgIHNlbGYuX19wYXJlbnQgPSBwYXJlbnQKICAgICAgICBzZWxmLl9fc3RvcCA9IEZhbHNlCiAgICAgICAgc2VsZi5fX2xvb3AgPSBhc3luY2lvLm5ld19ldmVudF9sb29wKCkKICAgIAogICAgZGVmIHN0b3BfdGhyZWFkKHNlbGYpOgogICAgICAgIHByaW50KCJTdG9wcGluZyBhbmFseXNlci4uLiIpCiAgICAgICAgc2VsZi5fX3N0b3AgPSBUcnVlCgogICAgZGVmIHJ1bihzZWxmKToKICAgICAgICBhc3luYyBkZWYgY2FsbGJhY2socGFyZW50KToKICAgICAgICAgICAgIyBJbml0IGltYWdlIGhhbmRsZXIKICAgICAgICAgICAgc2N0ID0gbXNzLm1zcygpCiAgICAgICAgICAgIHdoaWxlIG5vdCBzZWxmLl9fc3RvcDoKICAgICAgICAgICAgICAgIGNvbG9yX2xpc3QgPSBwYXJlbnQuZ2V0X2J5dGVfYXJyYXlfZm9yX3NjcmVlbihzY3QpCiAgICAgICAgICAgICAgICBzZWxmLnNpZ191cGRhdGVfdmlldy5lbWl0KGNvbG9yX2xpc3QpCiAgICAgICAgICAgICAgICBzbGVlcCgwLjAzKQoKICAgICAgICBzZWxmLl9fbG9vcC5ydW5fdW50aWxfY29tcGxldGUoYXN5bmNpby53YWl0KFtjYWxsYmFjayhzZWxmLl9fcGFyZW50KV0pKQo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CiAgICAgICAgc2VsZi5fX2xvb3Auc3RvcCgpCiAgICAgICAgc2VsZi5fX2xvb3AuY2xvc2UoKQogICAgICAgIGRlbCBz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ocmVhZChzZWxmKQogICAgICAgIHNlbGYuX19kaXNjb25uZWN0X2RyaXZlX3RocmVhZC5zaWdfdXBkYXRlX3ZpZXcuY29ubmVjdChzZWxmLnVwZGF0ZV92aWV3KQogICAgICAgIHNlbGYuX19kaXNjb25uZWN0X2RyaXZlX3RocmVhZC5zdGFydCgpCgogICAgZGVmIGFkanVzdF9jb2xvcl9saWdodG5lc3Moc2VsZiwgY29sb3IpOgogICAgICAgICMgVE9ETzogRGVmaW5lIGFuZCB0ZXN0IGEgcHJvcGVyIGFsZ29yaXRobSB0byBicmluZyB0aGUgYmVzdCBjb2xvciBhY2N1cmFjeQogICAgICAgIHIsIGcsIGIgPSBjb2xvcgogICAgICAgIGgsIGwsIHMgPSByZ2JfdG9faGxzKHIgLyAyNTUuMCwgZyAvIDI1NS4wLCBiIC8gMjU1LjApCiAgICAgICAgbCA9IG1heChtaW4obCoqMC45LCAxLjApLCAwLjApCiAgICAgICAgciwgZywgYiA9IGhsc190b19yZ2IoaCwgbCwgcykKICAgICAgICByZXR1cm4gW2ludChyICogMjU1KSwgaW50KGcgKiAyNTUpLCBpbnQoYiAqIDI1NSldCgogICAgZGVmIGF2ZXJhZ2VfY29sb3JfZnJvbV9hcmVhKHNlbGYsIGltZywgYXJlYSk6CiAgICAgICAgbmV3X2ltZyA9IGltZy5jcm9wKGFyZWEpCiAgICAgICAgY29sb3IgPSBJbWFnZVN0YXQuU3RhdChuZXdfaW1nKS5tZWRpYW4KICAgICAgICBhZGpfY29sb3IgPSBzZWxmLmFkanVzdF9jb2xvcl9saWdodG5lc3MoY29sb3IpCiAgICAgICAgaWYgc3VtKGFkal9jb2xvcikgPD0gMTA6CiAgICAgICAgICAgIGFkal9jb2xvciA9IFswLCAwLCAwXQoKICAgICAgICByZXR1cm4gYWRqX2NvbG9yCgogICAgZGVmIGdldF9ieXRlX2FycmF5X2Zvcl9zY3JlZW4oc2VsZiwgc2N0LCBieXRlX21vZGU9RmFsc2UpOgogICAgICAgIGltZ19z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QogICAgICAgICAgICBib3JkZXJfY29sb3JzLmFwcGVuZChzZWxmLmF2ZXJhZ2VfY29sb3JfZnJvbV9hcmVhKGltZywgYXJlYSkpCgogICAgICAgIGZvciByaWdodF9pbmRleCBpbiByYW5nZSgwLCBzZWxmLmxlZF9zaWRlcyk6CiAgICAgICAgICAgIGFyZWEgPSAody1kZXB0aF9waXhlbHMsIHJpZ2h0X2luZGV4KmhlaWdodF9waXhlbHMsIHcsIChyaWdodF9pbmRleCsxKSpoZWlnaHRfcGl4ZWxzKQogICAgICAgICAgICBib3JkZXJfY29sb3JzLmFwcGVuZChzZWxmLmF2ZXJhZ2VfY29sb3JfZnJvbV9hcmVhKGltZywgYXJlYSkpCiAgICAgICAgCiAgICAgICAgIyBDcmVhdGUgYnl0ZSBsaXN0CiAgICAgICAgYnl0ZV9saXN0ID0gYnl0ZWFycmF5KCkKCiAgICAgICAgZm9yIGJvcmRlcl9jb2xvciBpbiBib3JkZXJfY29sb3JzOgogICAgICAgICAgICBmb3IgcGl4ZWwgaW4gYm9yZGVyX2NvbG9yOgogICAgICAgICAgICAgICAgYnl0ZV9saXN0LmFwcGVuZChwaXhlbCkKICAgICAgICAjIGJ5dGVfbGlzdC5hcHBlbmQoMTApICMgVGVybWluYXRlIHdpdGggbmV3bGluZSBjaGFyYWN0ZXIKICAgICAgICAKICAgICAgICBpZiBieXRlX21vZGU6CiAgICAgICAgICAgIHJldHVybiBieXRlX2xpc3QKICAgICAgICByZXR1cm4gYm9yZGVyX2NvbG9ycwo8fGZpbV9zdWZmaXh8PgogICAgZGVmIF9faW5pdF9fKHNlbGYsIG1vbml0b3JfbnVtYmVyLCBsZWRfc2lkZXMsIGxlZF90b3AsIGZhZGVfc3BlZWQpOgogICAgICAgIHN1cGVyKFNpbXVsYXRpb25Db250cm9sbGVyLCBzZWxmKS5fX2luaXRfXygpCiAgICAgICAgc2VsZi5tb25pdG9yX251bWJlciA9IG1vbml0b3JfbnVtYmVyCiAgICAgICAgc2VsZi5sZ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dXJzIC0gMToKICAgIHByaW50KCJFeHBlY3RlZCA4YnBwIEJNUCIpCiAgICBzeXMuZXhpdCg0KQoKYmluX291dC53cml0ZShzdHJ1Y3QucGFjaygiPEkiLCBudW1fY29sb3VycykpCmJpbl9vdXQud3JpdGUoc3RydWN0LnBhY2soIjxJIiwgbGVuKGRhdGEpKSkKCmZvciBpIGluIHJhbmdlKG51bV9jb2xvdXJzKToKICAgIHZhbCA9IHBhbGV0dGVbMyAqIGldIDw8IDE2CiAgICB2YWwgfD0gcGFsZXR0ZVszICogaSArIDFdIDw8IDgKICAgIHZhbCB8PSBwYWxldHRlWzMgKiBpICsgMl0KICAgIGJpbl9vdXQud3JpdGUoc3RydWN0LnBhY2soIjxJIiwgdmFsKSkKCmZvciB2YWwgaW4gZGF0YToKICAgIGJpbl9vdXQud3JpdGUoc3RydWN0LnBhY2soIj1CIiwgdmFsKSkKPHxmaW1fc3VmZml4fD4KICAgIHN5cy5leGl0KDMpCgo8fGZpbV9lbmR8Pg==
a70624260607ba2948627f977ccbf53eddfd8053-1
a70624260607ba2948627f977ccbf53eddfd8053
PHxmaW1fcHJlZml4fD4KIyBpbnNlcnRpbm9uIHNvcnQKCmRlZiBzb3J0SVMoYXJyKToKICAgICMgY2hlY2sgaWYgYXJyYXkgaGFzIG1vcmUgdGhhbiAyIHZhbHVlcyB0byBzb3J0CiAgICBpZiAobGVuKGFycik8PTEpOgogICAgICAgIHJldHVybiBhcnIKICAgIAogICAgIyBtYWluIGxvZ2ljIC0gc3JhcnQgZnJvbSB0aGUgc2Vjb25kIGVsZW1lbnQKICAgIGZvciBpIGluIHJhbmdlKDEsbGVuKGFycikpOgogICAgICAgIAogICAgICAgICMgY2hlY2sgaWYgcHJldmlvdXMgdmFsdWUgaXMgc21hbGxlciAKICAgICAgICBpZiAoYXJyW2ldPGFycltpLTFdKToKICAgICAgICAgICAgCiAgICAgICAgICAgICMgYXNzaWduIHR3byBuZXcgbG9jYXRvcnMgZm9yIG1vdmluZyB2YWx1ZXMKICAgICAgICAgICAgaj1pLTEKICAgICAgICAgICAgej1pCjx8ZmltX2hvbGV8PgogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAjIHVwZGF0ZSB0d28gbG9jYXRvcnMKICAgICAgICAgICAgICAgIGo9ai0xCiAgICAgICAgICAgICAgICB6PXotMQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAjIGNoZWNrIGlmIHdlIGFyZSBpbiB0aGUgcmFuZ2Ugb2YgYXJyYXkKICAgICAgICAgICAgICAgIGlmIChqID09IC0xKToKICAgICAgICAgICAgICAgICAgICBicmVhawogICAgcmV0dXJuIGFycgoKPHxmaW1fc3VmZml4fD4KICAgICAgICAgICAgCiAgICAgICAgICAgICMgbW92ZSBzbWFsbGVyIHZhbHVlIHVwIHVudGlsIGl0IG9uIGl0cyByaWdodCBwb3NpdGlvbgogICAgICAgICAgICB3aGlsZSAoYXJyW3pdPGFycltqXSk6CiAgICAgICAgICAgICAgICBhcnJbel0sIGFycltqXSA9IGFycltqXSwgYXJyW3pdCjx8ZmltX2VuZHw+
a70624260607ba2948627f977ccbf53eddfd8053-2
a70624260607ba2948627f977ccbf53eddfd8053
PHxmaW1fcHJlZml4fD4KIyBpbnNlcnRpbm9uIHNvcnQKCmRlZiBzb3J0SVMoYXJyKToKICAgICMgY2hlY2sgaWYgYXJyYXkgaGFzIG1vcmUgdGhhbiAyIHZhbHVlcyB0byBzb3J0CiAgICBpZiAobGVuKGFycik8PTEpOgogICAgICAgIHJldHVybiBhcnIKICAgIAogICAgIyBtYWluIGxvZ2ljIC0gc3JhcnQgZnJvbSB0aGUgc2Vjb25kIGVsZW1lbnQKICAgIGZvciBpIGluIHJhbmdlKDEsbGVuKGFycikpOgogICAgICAgIAogICAgICAgICMgY2hlY2sgaWYgcHJldmlvdXMgdmFsdWUgaXMgc21hbGxlciAKICAgICAgICBpZiAoYXJyW2ldPGFycltpLTFdKToKICAgICAgICAgICAgCiAgICAgICAgICAgICMgYXNzaWduIHR3byBuZXcgbG9jYXRvcnMgZm9yIG1vdmluZyB2YWx1ZXMKICAgICAgICAgICAgaj1pLTEKICAgICAgICAgICAgej1pCiAgICAgICAgICAgIAogICAgICAgICAgICAjIG1vdmUgc21hbGxlciB2YWx1ZSB1cCB1bnRpbCBpdCBvbiBpdHMgcmlnaHQgcG9zaXRpb24KICAgICAgICAgICAgd2hpbGUgKGFyclt6XTxhcnJbal0pOgogICAgICAgICAgICAgICAgYXJyW3pdLCBhcnJbal0gPSBhcnJbal0sIGFyclt6XQo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICMgdXBkYXRlIHR3byBsb2NhdG9ycwogICAgICAgICAgICAgICAgaj1qLTEKICAgICAgICAgICAgICAgIHo9ei0xCjx8ZmltX2VuZHw+
a70624260607ba2948627f977ccbf53eddfd8053-3
a70624260607ba2948627f977ccbf53eddfd8053
PHxmaW1fcHJlZml4fD4KIyBpbnNlcnRpbm9uIHNvcnQKPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgoKZGVmIHNvcnRJUyhhcnIpOgogICAgIyBjaGVjayBpZiBhcnJheSBoYXMgbW9yZSB0aGFuIDIgdmFsdWVzIHRvIHNvcnQKICAgIGlmIChsZW4oYXJyKTw9MSk6Cjx8ZmltX2VuZHw+
a70624260607ba2948627f977ccbf53eddfd8053-4
a70624260607ba2948627f977ccbf53eddfd8053
PHxmaW1fcHJlZml4fD4KIyBpbnNlcnRpbm9uIHNvcnQKCmRlZiBzb3J0SVMoYXJyKToKICAgICMgY2hlY2sgaWYgYXJyYXkgaGFzIG1vcmUgdGhhbiAyIHZhbHVlcyB0byBzb3J0Cjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KICAgIGlmIChsZW4oYXJyKTw9MSk6CiAgICAgICAgcmV0dXJuIGFycgogICAgCiAgICAjIG1haW4gbG9naWMgLSBzcmFydCBmcm9tIHRoZSB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nJlYWRvdXRlcnIoKQogICAgYXNzZXJ0IG91dCA9PSBmImlvdC1maXJtd2FyZSB7X192ZXJzaW9uX199XG4iCjx8ZmltX3N1ZmZpeHw+CmZyb20gaW90X2Zpcm13YXJlIGltcG9ydCBfX3ZlcnNpb25fXwpmcm9tIGlvdF9maXJtd2FyZS5jbGkgaW1wb3J0IGNsaQoKCjx8ZmltX2VuZHw+
3cc90ca1f090b71afc73ba25c3f73cf256a78188-1
3cc90ca1f090b71afc73ba25c3f73cf256a78188
PHxmaW1fcHJlZml4fD4KCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KIyBMZWZ0IG91dCBzaW5jZSBpdCB3YXMgYW4gZW5oYW5jZW1lbnQKPHxmaW1fZW5kfD4=
3cc90ca1f090b71afc73ba25c3f73cf256a78188-2
3cc90ca1f090b71afc73ba25c3f73cf256a78188
PHxmaW1fcHJlZml4fD4KCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KIyBMZWZ0IG91dCBzaW5jZSBpdCB3YXMgYW4gZW5oYW5jZW1lbnQKPHxmaW1fZW5kfD4=
b1dcdcd881169ffbbe15df634b750ad0957f494f-1
b1dcdcd881169ffbbe15df634b750ad0957f494f
PHxmaW1fcHJlZml4fD4KIyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KCgpkZWYgcHVzaF90b2tlbihwdXNoYm90cywgcGxhdGZvcm0sIHRva2VuLCBtc2csIHNvdW5kLCBiYWRnZSwgcGF5bG9hZCk6CiAgICByZXR1cm4gcHVzaGJvdHMucHVzaChwbGF0Zm9ybT1wbGF0Zm9ybSwgdG9rZW49dG9rZW4sIG1zZz1tc2csIHNvdW5kPXNvdW5kLAogICAgICAgICAgICAgICAgICAgICAgICAgYmFkZ2U9YmFkZ2UsIHBheWxvYWQ9cGF5bG9hZCkKCgpkZWYgcHVzaF9kYXRhKHB1c2hib3RzLCBkYXRhKToKPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgogICA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W5jKCkKPHxmaW1faG9sZXw+CiAgICBkZWYgY2hlY2tfb3ZlcmZsb3coc2VsZik6CiAgICAgICAgIiIiIFJldHVybnMgdHJ1ZSBpZiBvdmVyZmxvdyBoYXMgaGFwcGVuZWQKICAgICAgICAiIiIKICAgICAgICAjIHNlbGVjdCBsc2IgZnJvbSBvdmVyZmxvdyByZWcKICAgICAgICBvdmVyZmxvd192YWwgPSBzZWxmLmZwZ2EucmVhZF91aW50KHNlbGYub3ZlcmZsb3dfcmVnKSAmIDB4MQogICAgICAgIGlmIG92ZXJmbG93X3ZhbCAhPSAwOgogICAgICAgICAgICBzZWxmLmxvZ2dlci5kZWJ1ZygiT3ZlcmZsb3cgZmxhZyBpcyBTRVQiKQogICAgICAgICAgICByZXR1cm4gVHJ1ZQogICAgICAgIHNlbGYubG9nZ2VyLmRlYnVnKCJPdmVyZmxvdyBmbGFnIGlzIENMRUFSIikKICAgICAgICByZXR1cm4gRmFsc2UKICAgICAgICAKCgo8fGZpbV9zdWZmaXh8PgogICAgICAgIHRpbWUuc2xlZXAoMSkgICMgZGVsYXkgdG8gYWxsb3cgZWZmZWN0IHRvIG1hbmlmZXN0LgoKPHxmaW1fZW5kfD4=
3cce76ca10412729dee4533707a3f2a3c771ec7c-1
3cce76ca10412729dee4533707a3f2a3c771ec7c
PHxmaW1fcHJlZml4fD4KCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KZnJvbSAuZGlybyBpbXBvcnQgKgo8fGZpbV9lbmR8Pg==
3cce76ca10412729dee4533707a3f2a3c771ec7c-2
3cce76ca10412729dee4533707a3f2a3c771ec7c
PHxmaW1fcHJlZml4fD4KCjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KZnJvbSAuZGlybyBpbXBvcnQgKgo8fGZpbV9lbmR8Pg==
59005f1af68d5f93353ae9d0d53bc1beac5afe0d-1
59005f1af68d5f93353ae9d0d53bc1beac5afe0d
PHxmaW1fcHJlZml4fD4KIyEvdXNyL2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JyZXBvc2l0b3J5IjogaW50ZWdlciwKICAgICAgICAgICAgICJicmFuY2giOiBpbnRlZ2VyLAogICAgICAgICAgICAgIm93bmVycyI6IGludGVnZXJbXSwKICAgICAgICAgICAgICJhY3RpdmVfcmV2aWV3ZXJzIjogaW50ZWdlcltdLAogICAgICAgICAgICAgImFzc2lnbmVkX3Jldmlld2VycyI6IGludGVnZXJbXSwKICAgICAgICAgICAgICJ3YXRjaGVycyI6IGludGVnZXJbXSwKICAgICAgICAgICAgICJwYXJ0aXRpb25zIjogUGFydGl0aW9uW10sCiAgICAgICAgICAgICAiaXNzdWVzIjogaW50ZWdlcltdLAogICAgICAgICAgICAgIm5vdGVzIjogaW50ZWdlcltdLAogICAgICAgICAgICAgInBlbmRpbmdfcmViYXNlIjogaW50ZWdlciBvciBudWxsLAogICAgICAgICAgICAgInByb2dyZXNzIjogZmxvYXQsCiAgICAgICAgICAgICAicHJvZ3Jlc3NfcGVyX2NvbW1pdCI6IENvbW1pdENoYW5nZUNvdW50W10sCiAgICAgICAgICAgfQoKICAgICAgICAgICBQYXJ0aXRpb24gewogICAgICAgICAgICAgImNvbW1pdHMiOiBpbnRlZ2VyW10sCiAgICAgICAgICAgICAicmViYXNlIjogaW50ZWdlciBvciBudWxsLAogICAgICAgICAgIH0KCiAgICAgICAgICAgQ29tbWl0Q2hhbmdlQ291bnQgewogICAgICAgICAgICAgImNvbW1pdF9pZCI6IGludGVnZXIsCiAgICAgICAgICAgICAidG90YWxfY2hhbmdlcyI6IGludGVnZXIsCiAgICAgICAgICAgICAicmV2aWV3ZWRfY2hhbmdlcyI6IGludGVnZXIsCiAgICAgICAgICAgfSIiIgoKICAgICAgICBkZWYgY2hhbmdlX2NvdW50c19hc19kaWN0KGNoYW5nZV9jb3VudHMpOgogICAgICAgICAgICByZXR1cm4gW3sKICAgICAgICAgICAgICAgICJjb21taXRfaWQiOiBjaGFuZ2VfY291bnQuY29tbWl0X2lkLAogICAgICAgICAgICAgICAgInRvdGFsX2NoYW5nZXMiOiBjaGFuZ2VfY291bnQudG90YWxfY2hhbmdlcywKICAgICAgICAgICAgICAgICJyZXZpZXdlZF9jaGFuZ2VzIjogY2hhbmdlX2NvdW50LnJldmlld2VkX2NoYW5nZXMsCiAgICAgICAgICAgICAgICB9IGZvciBjaGFuZ2VfY291bnQgaW4gY2hhbmdlX2NvdW50c10KCiAgICAgICAgcGFydGl0aW9ucyA9IFtdCgogICAgICAgIGRlZiBhZGRfcGFydGl0aW9uKHBhcnRpdGlvbik6CiAgICAgICAgICAgIGlmIHBhcnRpdGlvbi5mb2xsb3dpbmc6CiAgICAgICAgICAgICAgICBwYXJ0aXRpb25fcmViYXNlID0gcGFydGl0aW9uLmZvbGxvd2luZy5yZWJhc2UKICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHBhcnRpdGlvbl9yZWJhc2UgPSBOb25lCgogICAgICAgICAgICBwYXJ0aXRpb25zLmFwcGVuZCh7ICJjb21taXRzIjogbGlzdChwYXJ0aXRpb24uY29tbWl0cy50b3BvX29yZGVyZWQpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJyZWJhc2UiOiBwYXJ0aXRpb25fcmViYXNlIH0pCgogICAgICAgICAgICBpZiBwYXJ0aXRpb24uZm9sbG93aW5nOgogICAgICAgICAgICAgICAgYWRkX3BhcnRpdGlvbihwYXJ0aXRpb24uZm9sbG93aW5nLnBhcnRpdGlvbikKCiAgICAgICAgYWRkX3BhcnRpdGlvbih2YWx1ZS5maXJzdF9wYXJ0aXRpb24pCgogICAgICAgIHJldHVybiBwYXJhbWV0ZXJzLmZpbHRlcmVkKAogICAgICAgICAgICAicmV2aWV3cyIsIHsgImlkIjogdmFsdWUuaWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAic3RhdGUiOiB2YWx1ZS5zdGF0ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICJzdW1tYXJ5IjogdmFsdWUuc3VtbWFyeSwKICAgICAgICAgICAgICAgICAgICAgICAgICJkZXNjcmlwdGlvbiI6IHZhbHVlLmRlc2NyaXB0aW9uLAogICAgICAgICAgICAgICAgICAgICAgICAgInJlcG9zaXRvcnkiOiB2YWx1ZS5yZXBvc2l0b3J5LAogICAgICAgICAgICAgICAgICAgICAgICAgImJyYW5jaCI6IHZhbHVlLmJyYW5jaCwKICAgICAgICAgICAgICAgICAgICAgICAgICJvd25lcnMiOiBqc29uYXBpLnNvcnRlZF9ieV9pZCh2YWx1ZS5vd25lcnMpLAogICAgICAgICAgICAgICAgICAgICAgICAgImFjdGl2ZV9yZXZpZXdlcnMiOiBqc29uYXBpLnNvcnRlZF9ieV9pZCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZS5hY3RpdmVfcmV2aWV3ZXJzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICJhc3NpZ25lZF9yZXZpZXdlcnMiOiBqc29uYXBpLnNvcnRlZF9ieV9pZCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZS5hc3NpZ25lZF9yZXZpZXdlcnMpLAogICAgICAgICAgICAgICAgICAgICAgICAgIndhdGNoZXJzIjoganNvbmFwaS5zb3J0ZWRfYnlfaWQodmFsdWUud2F0Y2hlcnMpLAogICAgICAgICAgICAgICAgICAgICAgICAgInBhcnRpdGlvbnMiOiBwYXJ0aXRpb25zLAogICAgICAgICAgICAgICAgICAgICAgICAgImlzc3VlcyI6IGpzb25hcGkuc29ydGVkX2J5X2lkKHZhbHVlLmlzc3VlcyksCiAgICAgICAgICAgICAgICAgICAgICAgICAibm90ZXMiOiBqc29uYXBpLnNvcnRlZF9ieV9pZCh2YWx1ZS5ub3RlcyksCiAgICAgICAgICAgICAgICAgICAgICAgICAicGVuZGluZ19yZWJhc2UiOiB2YWx1ZS5wZW5kaW5nX3JlYmFzZSwKICAgICAgICAgICAgICAgICAgICAgICAgICJwcm9ncmVzcyI6IHZhbHVlLnRvdGFsX3Byb2dyZXNzLAogICAgICAgICAgICAgICAgICAgICAgICAgInByb2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ICAgICAgICBpZiByZXZpZXc6CiAgICAgICAgICAgIGlmIHBhdGggPT0gWyJpc3N1ZXMiXSBvciBwYXRoID09IFsibm90ZXMiXToKICAgICAgICAgICAgICAgIFJldmlld3Muc2V0QXNDb250ZXh0KHBhcmFtZXRlcnMsIHJldmlldykKICAgICAgICAgICAgICAgIGlmIHBhdGggPT0gWyJpc3N1ZXMiXToKICAgICAgICAgICAgICAgICAgICBjb21tZW50X3R5cGUgPSAiaXNzdWUiCiAgICAgICAgICAgICAgICBlbHNlOgogICAgICAgICAgICAgICAgICAgIGNvbW1lbnRfdHlwZSA9ICJub3RlIgogICAgICAgICAgICAgICAganNvbmFwaS5lbnN1cmUoZGF0YSwgInR5cGUiLCBjb21tZW50X3R5cGUpCiAgICAgICAgICAgICAgICByYWlzZSBqc29uYXBpLkludGVybmFsUmVkaXJlY3QoInYxL2NvbW1lbnRzIikKCiAgICAgICAgcmFpc2UganNvbmFwaS5Vc2FnZUVycm9yKCJSZXZpZXcgY3JlYXRpb24gbm90IHlldCBzdXBwb3J0ZWQiKQoKICAgIEBzdGF0aWNtZXRob2QKICAgIGRlZiBkZWR1Y2UocGFyYW1ldGVycyk6CiAgICAgICAgcmV2aWV3ID0gcGFyYW1ldGVycy5jb250ZXh0LmdldCgicmV2aWV3cyIpCiAgICAgICAgcmV2aWV3X3BhcmFtZXRlciA9IHBhcmFtZXRlcnMuZ2V0UXVlcnlQYXJhbWV0ZXIoInJldmlldyIpCiAgICAgICAgaWYgcmV2aWV3X3BhcmFtZXRlciBpcyBub3QgTm9uZToKICAgICAgICAgICAgaWYgcmV2aWV3IGlzIG5vdCBOb25lOgogICAgICAgICAgICAgICAgcmFpc2UganNvbmFwaS5Vc2FnZUVycm9yKAogICAgICAgICAgICAgICAgICAgICJSZWR1bmRhbnQgcXVlcnkgcGFyYW1ldGVyOiByZXZpZXc9JXMiICUgcmV2aWV3X3BhcmFtZXRlcikKICAgICAgICAgICAgcmV2aWV3ID0gYXBpLnJldmlldy5mZXRjaCgKICAgICAgICAgICAgICAgIHBhcmFtZXRlcnMuY3JpdGljLAogICAgICAgICAgICAgICAgcmV2aWV3X2lkPWpzb25hcGkubnVtZXJpY19pZChyZXZpZXdfcGFyYW1ldGVyKSkKICAgICAgICByZXR1cm4gcmV2aWV3CgogICAgQHN0YXRpY21ldGhvZAo8fGZpbV9ob2xlfD4KICAgICAgICAgICAgcGFyYW1ldGVycywgcmV2aWV3LnJlcG9zaXRvcnkpCiAgICAgICAganNvbmFwaS52MS5icmFuY2hlcy5CcmFuY2hlcy5zZXRBc0NvbnRleHQocGFyYW1ldGVycywgcmV2aWV3LmJyYW5jaCkKICAgICAgICByZXR1cm4gcmV2aWV3Cjx8ZmltX3N1ZmZpeHw+CiAgICBkZWYgc2V0QXNDb250ZXh0KHBhcmFtZXRlcnMsIHJldmlldyk6CiAgICAgICAgcGFyYW1ldGVycy5zZXRDb250ZXh0KFJldmlld3MubmFtZSwgcmV2aWV3KQogICAgICAgICMgQWxzbyBzZXQgdGhlIHJldmlldydzIHJlcG9zaXRvcnkgYW5kIGJyYW5jaCBhcyBjb250ZXh0LgogICAgICAgIGpzb25hcGkudjEucmVwb3NpdG9yaWVzLlJlcG9zaXRvcmllcy5zZXRBc0NvbnRleHQoCjx8ZmltX2VuZHw+
a72e8672cdf4569a03559e59447c10459f6dcf09-2
a72e8672cdf4569a03559e59447c10459f6dcf09
PHxmaW1fcHJlZml4fD4KIyAtKi0gbW9kZTogcHl0aG9uOyBlbmNvZGluZzogdXRmLTggLSotCiMKIyBDb3B5cmlnaHQgMjAxNCB0aGUgQ3JpdGljIGNvbnRyaWJ1dG9ycywgT3BlcmEgU29mdHdhcmUgQVNBCiMKIyBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsgeW91IG1heSBub3QKIyB1c2UgdGhpcyBmaWxlIGV4Y2VwdCBpbiBjb21wbGlhbmNlIHdpdGggdGh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9fY3JlYXRlZD1UcnVlKSksCiAgICAgICAgICAgICAgICAoJ2NvbW1lbnQnLCBtb2RlbHMuVGV4dEZpZWxkKHZlcmJvc2VfbmFtZT0n6K+E6K665YaF5a65JykpLAo8fGZpbV9lbmR8Pg==
a701d39d074beb6719e8f1e219b355c1b5ca4ac4-2
a701d39d074beb6719e8f1e219b355c1b5ca4ac4
PHxmaW1fcHJlZml4fD4KIyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KZnJvbSBfX2Z1dHVyZV9fIGltcG9ydCB1bmljb2RlX2xpdGVyYWxzCgpmcm9tIGRqYW5nby5kYiBpbXBvcnQgbWlncmF0aW9ucywgbW9kZWxzCgoKY2xhc3MgTWlncmF0aW9uKG1pZ3JhdGlvbnMuTWlncmF0aW9uKToKCiAgICBkZXBlbmRlbmNpZXMgPSBbCiAgICAgICAgKCduZXdzJywgJzAwMDdfYXV0b18yMDE4MDcwNl8xNTQwJyksCiAgICBdCgo8fGZpbV9ob2xlfD4KCjx8ZmltX3N1ZmZpeHw+CiAgICBvcGVyYXRpb25zID0gWwogICAgICAgIG1pZ3JhdGlvbnMuQ3JlYXRlTW9kZWwoCiAgICAgICAgICAgIG5hbWU9J05ld3NDb21tZW50JywKICAgICAgICAgICAgZmllbGRzPVsKPHxmaW1fZW5kfD4=
a55cbe8244dc48f96d2d454beab64686ea97a11c-1
a55cbe8244dc48f96d2d454beab64686ea97a11c
PHxmaW1fcHJlZml4fD4KZnJvbSBicnV0ZW1hcmsucGFyc2VyIGltcG9ydCBUb2tlbml6ZUxpbmUKZnJvbSBicnV0ZW1hcmsubGluZV90b2tlbnMgaW1wb3J0IE9yZGVyZWRJdGVtTGluZSwgVW5vcmRlcmVkSXRlbUxpbmUKCmRlZiB0ZXN0X19saW5lX3Rva2Vuc19fT3JkZXJlcmVkSXRlbUxpbmVfX3Rlc3Rjb25zdW1lX2RldGVjdHNfb3JkZXJlZF9pdGVtc19jb3JyZWN0bHkoKToKCiAgICBub3JtYWxfdGVz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
3c274627d9c2e8d5d2d01acfc465efda254749d0-1
3c274627d9c2e8d5d2d01acfc465efda254749d0
PHxmaW1fcHJlZml4fD4KY2xhc3MgU29sdXRpb246CiAgICBkZWYgc3BpcmFsT3JkZXIoc2VsZiwgbWF0cml4OiBsaXN0W2xpc3RbaW50XV0pIC0+IGxpc3RbaW50XToKICAgICAgICBpZiBsZW4obWF0cml4KSA9PSAwOgogICAgICAgICAgICByZXR1cm4gW10KCiAgICAgICAgYW5zOiBsaXN0W2ludF0gPSBbXQogICAgICAgIHJvd3MsIGNvbHMgPSBsZW4obWF0cml4KSwgbGVuKG1hdHJpeFswXSkKICAgICAgICB0b3AsIGJvdHRvbSwgbGVmdCwgcmlnaHQgPSAwLCByb3dzIC0gMSwgMCwgY29scyAtIDEKICAgICAgICB3aGlsZSBsZWZ0IDwgcmlnaHQgYW5kIHRvcCA8IGJvdHRvbToKPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgogICAgICAgICAgICBhbnMuZXh0ZW5kKG1hdHJpeFt0b3BdW2ldIGZvciBpIGluIHJhbmdlKGxlZnQsIHJpZ2h0KSkKICAgICAgICAgICAgYW5zLmV4dGVuZChtYXRyaXhbaV1bcmlnaHRdIGZvciBpIGluIHJhbmdlKHRvcCwgYm90dG9tKSkKICAgICAgICAgICAgYW5zLmV4dGVuZChtYXRyaXhbYm90dG9tXVtpXSBmb3IgaSBpbiByYW5nZShyaWdodCwgbGVmdCwgLTEpKQogICAgICAgICAgICBhbnMuZXh0ZW5kKG1hdHJpeFtpXVtsZWZ0XSBmb3IgaSBpbiByYW5nZShib3R0b20sIHRvcCwgLTEpKQo8fGZpbV9lbmR8Pg==
af54ae3bed4dfc23930918f88ed483e51d3b2796-1
af54ae3bed4dfc23930918f88ed483e51d3b2796
PHxmaW1fcHJlZml4fD4KIyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgonJycKICAgIFVHViBSb3RhdGVzIHRvIGFsd2F5cyBwb2ludCBpdHMgTGl2b3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ciA8IDAuMgogICAgICAgIHlhd19kaWZmID0gYWJzKHNlbGYueWF3LW9iamVjdGl2ZV95YXcpCiAgICAgICAgaWYgeWF3X2RpZmYgPCAwLjEgOgogICAgICAgICAgICByZXR1cm4KCiAgICAgICAgIyBJbmNyZWFzZSB5YXcKICAgICAgICBpZiBzZWxmLnlhdyA8IG9iamVjdGl2ZV95YXcgYW5kIHlhd19kaWZmIDwgbWF0aC5waSA6CiAgICAgICAgICAgIHR3aXN0LmFuZ3VsYXIueiA9IDAuNSArIHlhd19kaWZmLzQKICAgICAgICBlbGlmIHNlbGYueWF3ID4gb2JqZWN0aXZlX3lhdyBhbmQgeWF3X2RpZmYgPiBtYXRoLnBpIDoKICAgICAgICAgICAgdHdpc3QuYW5ndWxhci56ID0gMC41ICsgeWF3X2RpZmYvNAogICAgICAgICMgRGVjcmVhc2UgeWF3CiAgICAgICAgZWxpZiBzZWxmLnlhdyA8IG9iamVjdGl2ZV95YXcgYW5kIHlhd19kaWZmIDwgbWF0aC5waSA6CiAgICAgICAgICAgIHR3aXN0LmFuZ3VsYXIueiA9IC0wLjUgLSB5YXdfZGlmZi80CiAgICAgICAgZWxzZSA6CiAgICAgICAgICAgIHR3aXN0LmFuZ3VsYXIueiA9IC0wLjUgLSB5YXdfZGlmZi80CiAgICAgICAgCiAgICAgICAgc2VsZi5zcGVlZF9wdWIucHVibGlzaCh0d2lzdCkKCiAgICBkZWYgdXBkYXRlX3Vndl9wb3Moc2VsZiwgcG9zKSA6Cjx8ZmltX2hvbGV8PgoKPHxmaW1fc3VmZml4fD4KICAgICAgICBzZWxmLnggPSBwb3MucG9zaXRpb24ueAogICAgICAgIHNlbGYueSA9IHBvcy5wb3NpdGlvbi55Cgo8fGZpbV9lbmR8Pg==
af54ae3bed4dfc23930918f88ed483e51d3b2796-3
af54ae3bed4dfc23930918f88ed483e51d3b2796
PHxmaW1fcHJlZml4fD4KIyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgonJycKICAgIFVHViBSb3R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GYudmlvX2NiKQoKICAgIGRlZiBydW4oc2VsZikgOgogICAgICAgICcnJwogICAgICAgICAgICBDcmVhdGVzIHRoZSB2ZWxvY2l0eSBwdWJsaWNhdGlvbiB0aW1lcgogICAgICAgICAgICBHb2VzIGludG8gaW5maW5pdGUgbG9vcCB3aXRoIHJvc3B5IHNwaW4oKQogICAgICAgICcnJwoKICAgICAgICBzZWxmLm1vdmVfdGltZXIgPSByb3NweS5UaW1lcihyb3NweS5EdXJhdGlvbigwLjA1KSwgc2VsZi51cGRhdGVfdmVsKQoKICAgICAgICAjIEluZmluaXRlIGxvb3AKICAgICAgICByb3NweS5zcGluKCkKCiAgICBkZWYgdXBkYXRlX3ZlbChzZWxmLCBldmVudCkgOgogICAgICAgICcnJwogICAgICAgICAgICBUTyBETwogICAgICAgICAgICBPbmx5IGZvciB0ZXN0aW5nIHZlcnkgYmFzaWMgdHdpc3QgY2FsY3VsYXRpb24gdG8gY29udmVyZ2UgaW4gfjIgc2Vjb25kcy4KICAgICAgICAgICAgTWluIHJvdGF0aW9uYWwgc3BlZWQgaXMgMC41IHJhZC9zCiAgICAgICAgJycnCiAgICAgICAgb2JqZWN0aXZlX3lhdyA9IG1hdGguYXRhbjIoc2VsZi51YXZfeS1zZWxmLnksIHNlbGYudWF2X3gtc2VsZi54KQogICAgICAgIHByaW50KCIgTXlwb3M9KHt9LCB7fSksIFVBVnBvcz0oe30sIHt9KSwgeWF3PXt9LCBvYmplY3RpdmVfeWF3PXt9Ii5mb3JtYXQoCiAgICAgICAgICAgIHNlbGYueCwgc2VsZi55LCBzZWxmLnVhdl94LCBzZWxmLnVhdl95LCBzZWxmLnlhdywgb2JqZWN0aXZlX3lhdykpCiAgICAgICAgdHdpc3QgPSBUd2lzdCgpCgogICAgICAgICMgRG8gbm90aGluZyBpZiB5YXcgZXJyb3IgPCAwLjIKICAgICAgICB5YXdfZGlmZiA9IGFicyhzZWxmLnlhdy1vYmplY3RpdmVfeWF3KQogICAgICAgIGlmIHlhd19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AogICAgICAgICAgICBvZG9tLnBvc2UucG9zZS5vcmllbnRhdGlvbi54LAogICAgICAgICAgICBvZG9tLnBvc2UucG9zZS5vcmllbnRhdGlvbi55LAogICAgICAgICAgICBvZG9tLnBvc2UucG9zZS5vcmllbnRhdGlvbi56LAogICAgICAgICAgICBvZG9tLnBvc2UucG9zZS5vcmllbnRhdGlvbi53KQoKICAgICAgICBldWxlciA9IHRmLnRyYW5zZm9ybWF0aW9ucy5ldWxlcl9mcm9tX3F1YXRlcm5pb24ocXVhdGVybmlvbikKCiAgICAgICAgc2VsZi55YXcgPSBldWxlclsyXQoKCiAgICAgICAgCgppZiBfX25hbWVfXyA9PSAnX19tYWluX18nOgogICAgJycnCiAgICAgICAgUnVuIHRoZSBub2RlCiAgICAnJycKICAgIHRyeToKCiAgICAgICAgIyBDcmVhdGUgbmV3IG9iamVjdAogICAgICAgIGZvbGxvd2VyID0gVUdWX0ZvbGxvd2VyKCkKCiAgICAgICAgIyBMb29wIHdoaWxlIHJlYWRpbmcgZGF0YQogICAgICAgIGZvbGxvd2VyLnJ1bigpCgogICAgZXhjZXB0IHJvc3B5LlJPU0ludGVycnVwdEV4Y2VwdGlvbjoKCiAgICAgICAgcGFzcwoKPHxmaW1fc3VmZml4fD4KCiAgICAgICAgIyBCYXNpYyBwb3NlCiAgICAgICAgc2VsZi54ID0gMAogICAgICAgIHNlbGYueSA9IDAKPHxmaW1fZW5kfD4=
af54ae3bed4dfc23930918f88ed483e51d3b2796-4
af54ae3bed4dfc23930918f88ed483e51d3b2796
PHxmaW1fcHJlZml4fD4KIyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgonJycKICAgIFVHViBSb3RhdGVzIHRvIGFsd2F5cyBwb2ludCBpdHMgTGl2b3ggbGlkYXIgdG8gVUFWLgoKICAgIFBvc2l0aW9ucyBiYXNlZCBvbiBVV0IgcmFuZ2luZyBhbmQgb3JpZW50YXRpb25zIGJhc2VkIG9uIFZJTy4KJycnCgpfX2F1dGhvcl9fICA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ZG9tLnBvc2UucG9zZS5vcmllbnRhdGlvbi53KQoKICAgICAgICBldWxlciA9IHRmLnRyYW5zZm9ybWF0aW9ucy5ldWxlcl9mcm9tX3F1YXRlcm5pb24ocXVhdGVybmlvbikKCiAgICAgICAgc2VsZi55YXcgPSBldWxlclsyXQoKCiAgICAgICAgCgppZiBfX25hbWVfXyA9PSAnX19tYWluX18nOgogICAgJycnCiAgICAgICAgUnVuIHRoZSBub2RlCiAgICAnJycKICAgIHRyeToKCiAgICAgICAgIyBDcmVhdGUgbmV3IG9iamVjdAogICAgICAgIGZvbGxvd2VyID0gVUdWX0ZvbGxvd2VyKCkKCiAgICAgICAgIyBMb29wIHdoaWxlIHJlYWRpbmcgZGF0YQogICAgICAgIGZvbGxvd2VyLnJ1bigpCgogICAgZXhjZXB0IHJvc3B5LlJPU0ludGVycnVwdEV4Y2VwdGlvbjoKCiAgICAgICAgcGFzcwoKPHxmaW1fc3VmZml4fD4KICAgICAgICAnJycKCiAgICAgICAgcXVhdGVybmlvbiA9ICgKICAgICAgICAgICAgb2RvbS5wb3NlLnBvc2Uub3JpZW50YXRpb24ueCwKPHxmaW1fZW5kfD4=
af44c002e25242c8b9d99671b85d293eb87689c4-1
af44c002e25242c8b9d99671b85d293eb87689c4
PHxmaW1fcHJlZml4fD4KCjx8ZmltX2hvbGV8PgogICAgbmFtZSA9ICdyZWNvbWVuZCcKPHxmaW1fc3VmZml4fD4KZnJvbSBkamFuZ28uYXBwcyBpbXBvcnQgQXBwQ29uZmlnCgoKY2xhc3MgUmVjb21lbmRDb25maWcoQXBwQ29uZmlnKToKPHxmaW1fZW5kfD4=
af44c002e25242c8b9d99671b85d293eb87689c4-2
af44c002e25242c8b9d99671b85d293eb87689c4
PHxmaW1fcHJlZml4fD4KZnJvbSBkamFuZ28uYXBwcyBpbXBvcnQgQXBwQ29uZmlnCgoKY2xhc3MgUmVjb21lbmRDb25maWcoQXBwQ29uZmlnKToKPHxmaW1faG9sZXw+Cgo8fGZpbV9zdWZmaXh8PgogICAgbmFtZSA9ICdyZWNvbWVuZCcKPHxmaW1fZW5kfD4=