Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@青豆@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6ImpzOlxuZXZhbChKU09OLnBhcnNlKHJlcXVlc3QoXCJoaWtlcjovL3BhZ2UvbWFpblwiKSkucnVsZSk7XG5sZXQgdHlwZSA9IGdldFBhcmFtKCd0eXBlJywgJycpLFxuICAgIGlkID0gZ2V0UGFyYW0oJ2lkJywgJycpLFxuICAgIHRpdGxlID0gZ2V0UGFyYW0oJ3RpdGxlJywgJycpO1xubGV0IHJlcyA9IGdldERvdWJhblJlcyhcImh0dHBzOi8vZnJvZG8uZG91YmFuLmNvbS9hcGkvdjIvXCIgKyB0eXBlICsgXCIvXCIgKyBpZCk7XG5sZXQgdXBkYXRlID0gXCJcIjtcbmlmICh0aXRsZSA9PSAnJykge1xuICAgIGxldCBsZW5ndGggPSByZXMudmVuZG9ycy5sZW5ndGg7XG4gICAgdXBkYXRlICs9IGxlbmd0aCA+IDAgPyAn5YWxJyArIGxlbmd0aCArICfkuKrniYfmupAnIDogJ+aaguaXoOeJh+a6kCc7XG4gICAgaWYgKGxlbmd0aCA+IDApIHtcbiAgICAgICAgbGV0IGUgPSByZXMudmVuZG9yc1swXTtcbiAgICAgICAgdXBkYXRlICs9IGUuZXBpc29kZXNfaW5mbyA/IFwifFwiICsgZS5lcGlzb2Rlc19pbmZvIDogXCJcIjtcbiAgICB9XG59IGVsc2Uge1xuICAgIGZvciAobGV0IGUgb2YgcmVzLnZlbmRvcnMpIHtcbiAgICAgICAgaWYgKGUudGl0bGUgPT0gdGl0bGUpIHtcbiAgICAgICAgICAgIHVwZGF0ZSArPSBlLmVwaXNvZGVzX2luZm8gPyBlLmVwaXNvZGVzX2luZm8gOiBcIlwiO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICB9XG59XG5zZXRSZXN1bHQodXBkYXRlKTsiLCJ0aXRsZSI6Iumdk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neWtmFxcXCIsXFxuICAgICAgICAgICAgZGVzYzogZGF0YS5kZXNjLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnaW5wdXQnLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoZGF0YS5rZXksIFxcXCJcXFwiKSxcXG4gICAgICAgICAgICAgICAgdHlwZTogZGF0YS50eXBlID8gZGF0YS50eXBlIDogJycsXFxuICAgICAgICAgICAgICAgIGhlaWdodDogLTEsXFxuICAgICAgICAgICAgICAgIGhpZ2hsaWdodDogdHJ1ZSxcXG4gICAgICAgICAgICAgICAgb25DaGFuZ2U6ICdwdXRNeVZhcihcXFwiJyArIGRhdGEua2V5ICsgJ1xcXCIsIGlucHV0KSdcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ+S/neWtmCcsXFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKGNvbmZpZ0tleSwgcGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgbGV0IGNvbmZpZyA9IEpTT04ucGFyc2UocmVxdWVzdChnZXRNeVZhcigncWRiX2NvbmZpZycpKSlcXG4gICAgICAgICAgICBsZXQgbmFtZSA9IGdldE15VmFyKHBhcmFtcy5rZXksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICBjb25maWdbY29uZmlnS2V5XS51c2UgPSBuYW1lXFxuICAgICAgICAgICAgaWYgKCFjb25maWdbY29uZmlnS2V5XVtuYW1lXSkgY29uZmlnW2NvbmZpZ0tleV1bbmFtZV0gPSB7fVxcbiAgICAgICAgICAgIGxldCBkYXRhcyA9IHBhcmFtcy5kYXRhO1xcbiAgICAgICAgICAgIGx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QjeensFxcXCIsXFxuICAgICAgICAvLyB0eXBlOiAnaW5wdXQnXFxuICAgICAgICBkYXRhOiB7XFxuICAgICAgICAgICAgY29uZmlnOiB7XFxuICAgICAgICAgICAgICAgIGtleTogXFxcImlucHV0X2NvZGVcXFwiLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBcXFwi6K+36L6T5YWl6YWN572u5Luj56CBXFxcIixcXG4gICAgICAgICAgICAgICAgdHlwZTogJ3RleHRhcmVhJ1xcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgc2V0dGluZzoge1xcbiAgICAgICAgICAgICAgICBrZXk6IFxcXCJpbnB1dF9zZXR0aW5nX2NvZGVcXFwiLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBcXFwi6K+36L6T5YWl6K6+572u6aG16Z2i5Luj56CBXFxcIixcXG4gICAgICAgICAgICAgICAgdHlwZTogJ3RleHRhcmVhJ1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfSlcXG59XFxuXFxuLy/oh6rlrprkuYnop6PmnpAt57yW6L6R6aG16Z2iXFxuZnVuY3Rpb24gYW5hbHlzaXNNb2RlRWRpdFBhZ2UoZCkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICc8Zm9udCBjb2xvcj1cXFwiIzgwODA4MFxcXCI+JyArICfjgJDop6PmnpDku6PnoIHlhoXnva7lj5jph4/jgJEnICsgJzxicj4mbmJzcDsmbmJzcDsmbmJzcDtpbnB1dDog6KeG6aKR6ZO+5o6lJyArICc8L2ZvbnQ+JyxcXG4gICAgICAgIGNvbF90eXBlOiAncmljaF90ZXh0J1xcbiAgICB9KVxcbiAgICBtb2RlRWRpdFBhZ2UoZCwgXFxcImFuYWx5c2lzQ29uZmlnc1xcXCIsIHtcXG4gICAgICAgIGtleTogXFxcImlucHV0X25hbWVcXFwiLFxcbiAgICAgICAgZGVzYzogXFxcIuivt+i+k+WFpeWQjeensFxcXCIsXFxuICAgICAgICAvLyB0eXBlOiAnaW5wdXQnXFxuICAgICAgICBkYXRhOiB7XFxuICAgICAgICAgICAgY29uZmlnOiB7XFxuICAgICAgICAgICAgICAgIGtleTogXFxcImlucHV0X2NvZGVcXFwiLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBcXFwi6K+36L6T5YWl6Kej5p6Q5Luj56CBXFxcIixcXG4gICAgICAgICAgICAgICAgdHlwZTogJ3RleHRhcmVhJ1xcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAga2V5OiAnaW5wdXRfZXh0cmEnLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAn6K+36L6T5YWlZXh0cmHlsZ7mgKflgLwnLFxcbiAgICAgICAgICAgICAgICB0eXBlOiAndGV4dGFyZWEnXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICBzZXR0aW5nOiB7XFxuICAgICAgICAgICAgICAgIGtleTogXFxcImlucHV0X3NldHRpbmdfY29kZVxcXCIsXFxuICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLor7fovpPlhaXorr7nva7pobXpnaLku6PnoIFcXFwiLFxcbiAgICAgICAgICAgICAgICB0eXBlOiAndGV4dGFyZWEnXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9KVxcbn1cXG5cXG5sZXQgZCA9IFtdO1xcbmxldCB2aWV3ID0gZ2V0UGFyYW0oXFxcInZpZXdcXFwiLFxcXCJcXFwiKTtcXG5pZih2aWV3PT1cXFwiYW5hbHlzaXNNb2RlRWRpdFBhZ2VcXFwiKXtcXG4gICAgc2V0UGFnZVRpdGxlKFxcXCLoh6rlrprkuYnop6PmnpDnvJbovpFcXFwiKVxcbiAgICBhbmFseXNpc01vZGVFZGl0UGFnZShkKTtcXG59ZWxzZSBpZih2aWV3PT1cXFwiZGV0YWlsVmlld01vZGVFZGl0UGFnZVxcXCIpe1xcbiAgICBzZXRQYWdlVGl0bGUoXFxcIuiHquWumuS5ieiv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gICBjb25maXJtOiAnJyxcXHJcXG4gICAgICAgICAgICBjYW5jZWw6ICcnXFxyXFxuICAgICAgICB9KVxcclxcbiAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgbGV0IHVwZGF0ZUluZm8gPSBnZXRJdGVtKCd1cGRhdGUnLCAnJyk7XFxyXFxuICAgICAgICBpZiAodXBkYXRlSW5mbyA9PSAnJyB8fCBwYXJzZUludCh1cGRhdGVJbmZvKSA8IHZlcnNpb24pIHtcXHJcXG4gICAgICAgICAgICBzZXRJdGVtKCd1cGRhdGUnLCBTdHJpbmcodmVyc2lvbikpO1xcclxcbiAgICAgICAgICAgIGNvbmZpcm0oe1xcclxcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+acrOasoeabtOaWsOWGheWuuScsXFxyXFxuICAgICAgICAgICAgICAgIGNvbnRlbnQ6ICdidWdzIGZpeGVkJyxcXHJcXG4gICAgICAgICAgICAgICAgY29uZmlybTogJycsXFxyXFxuICAgICAgICAgICAgICAgIGNhbmNlbDogJydcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgfVxcclxcbiAgICB9XFxyXFxuICAgIGFkZExpc3RlbmVyKFxcXCJvbkNsb3NlXFxcIiwgJC50b1N0cmluZygoKSA9PiB7XFxyXFxuICAgICAgICBjbGVhck15VmFyKFxcXCJxZGJfY29uZmlnXFxcIik7XFxyXFxuICAgIH0pKVxcclxcbiAgICBsZXQgaG9tZVBhZ2VDb25maWdzID0gZ2V0Q29uZmlnKCdob21lUGFnZUNvbmZpZ3MnKTtcXHJcXG4gICAgbGV0IGhvbWVQYWdlQ29uZmlnID0gaG9tZVBhZ2VDb25maWdzW2hvbWVQYWdlQ29uZmlncy51c2VdLmNvbmZpZztcXHJcXG4gICAgaWYgKGhvbWVQYWdlQ29uZmlnLnN0YXJ0c1dpdGgoXFxcIihcXFwiKSkge1xcclxcbiAgICAgICAgZXZhbCgnZCA9ICcgKyBob21lUGFnZUNvbmZpZylcXHJcXG4gICAgfSBl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yeSMnKVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ydWxlKCh0eXBlLCBpZCkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UocmVxdWVzdCgnaGlrZXI6Ly9wYWdlL21haW4nKSkucnVsZSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSBcXFwicGxheWxpc3RcXFwiKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VMaXN0KGlkLCBNWV9QQUdFLCA1MCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PSBcXFwiY29sbGVjdGlvblxcXCIgfHwgdHlwZSA9PSBcXFwiY2hhcnRcXFwiKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJqZWN0Q29sbGVjdGlvbkxpc3QoTVlfUEFHRSwgNTAsIGlkKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGUudGFyZ2V0X3R5cGUsIGUuaWQpLFxcclxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBlLmNvdmVyX3VybCArIFxcXCJAUmVmZXJlcj1cXFwiICsgZS5jb3Zlcl91cmxcXHJcXG4gICAgICAgICAgICAgICAgfSlcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgfSBlbHNlIGlmIChkYXRhLnRhcmdldF90eXBlID09ICdjaGFydCcpIHtcXHJcXG4gICAgICAgICAgICBsZXQgZSA9IGRhdGEudGFyZ2V0O1xcclxcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICB0aXRsZTogZS50aXRsZSxcXHJcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCdoaWtlcjovL2VtcHR5LyRwYWdle2Z5cGFnZX0jbm9IaXN0b3J5IycpXFxyXFxuICAgICAgICAgICAgICAgICAgICAucnVsZSgodHlwZSwgaWQpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UocmVxdWVzdCgnaGlrZXI6Ly9wYWdlL21haW4nKSkucnVsZSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09IFxcXCJwbGF5bGlzdFxcXCIpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91TGlzdChpZCwgTVlfUEFHRSwgNTApO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PSBcXFwiY29sbGVjdGlvblxcXCIgfHwgdHlwZSA9PSBcXFwiY2hhcnRcXFwiKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YmplY3RDb2xsZWN0aW9uTGlzdChNWV9QQUdFLCA1MCwgaWQpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgICAgIH0sIGRhdGEudGFyZ2V0X3R5cGUsIGUuaWQpLFxcclxcbiAgICAgICAgICAgICAgICBpbWc6IGUuY292ZXJfdXJsICsgXFxcIkBSZWZlcmVyPVxcXCIgKyBlLmNvdmVyX3VybFxcclxcbiAgICAgICAgICAgIH0pXFxyXFxuICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgIGxldCB0eXBlID0gZGF0YS50YXJnZXRfdHlwZSxcXHJcXG4gICAgICAgICAgICAgICAgaWQgPSBkYXRhLnRhcmdldC5pZCxcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSBkYXRhLnRhcmdldC50aXRsZTtcXHJcXG4gICAgICAgICAgICBsZXQgdXNlQ29uZmlnID0gZGV0YWlsc1ZpZXdDb25maWdzW2RldGFpbHNWaWV3Q29uZmlncy51c2VdLmNvbmZpZztcXHJcXG4gICAgICAgICAgICBsZXQgdXJsUGFyYW1zID0ge307XFxyXFxuICAgICAgICAgICAgaWYgKHVzZUNvbmZpZy5zdGFydHNXaXRoKCd7JykpIHtcXHJcXG4gICAgICAgICAgICAgICAgZXZhbCgndXJsUGFyYW1zID0gJyArIHVzZUNvbmZpZyk7XFxyXFxuICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgdXJsUGFyYW1zLnVybCA9ICQoXFxcImhpa2VyOi8vZW1wdHkjbm9IaXN0b3J5IyNpbW1lcnNpdmVUaGVtZSNcXFwiICsgJz90eXBlPScgKyB0eXBlICsgJyZpZD0nICsgaWQpXFxyXFxuICAgICAgICAgICAgICAgICAgICAucnVsZSgodHlwZSwgaWQsIHRpdGxlLCB1c2VDb25maWcpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UocmVxdWVzdCgnaGlrZXI6Ly9wYWdlL21haW4nKSkucnVsZSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGUgPT09IFxcXCJwbGF5bGlzdFxcXCIpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG91TGlzdChpZCwgTVlfUEFHRSwgNTApO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwodXNlQ29uZmlnKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgICAgICB9LCB0eXBlLCBpZCwgdGl0bGUsIHVzZUNvbmZpZyk7XFxyXFxuICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxyXFxuICAgICAgICAgICAgICAgIGltZzogZGF0YS50YXJnZXQuY292ZXJfdXJsICsgXFxcIkBSZWZlcmVyPVxcXCIgK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jtcXHJcXG5cXHJcXG4gICAgciArPSAnPHNtYWxsPjxmb250IGNvbG9yPVxcXCJncmV5XFxcIj4nICsgcmF0aW5nQ291bnQgKyAn5Lq66K+E5YiGJyArICc8L2ZvbnQ+PC9zbWFsbD48YnIvPic7XFxyXFxuXFxyXFxuICAgIGxldCBzdGFyQ29sb3IgPSBnZXRDb25maWcoJ3N0YXJDb2xvcicpO1xcclxcbiAgICBpZiAoaS5zdGF0cy5sZW5ndGggPT0gMCkge1xcclxcbiAgICAgICAgaS5zdGF0cyA9IFswLCAwLCAwLCAwLCAwXTtcXHJcXG4gICAgfVxcclxcbiAgICBpLnN0YXRzLnJldmVyc2UoKS5mb3JFYWNoKCgodmFsdWUsIGluZGV4KSA9PiB7XFxyXFxuICAgICAgICByICs9ICc8Zm9udCBjb2xvcj0nICsgc3RhckNvbG9yICsgJz4nICsgW1xcXCLimIXimIXimIXimIXimIVcXFwiLCBcXFwi4piF4piF4piF4piF4piGXFxcIiwgXFxcIuKYheKYheKYheKYhuKYhlxcXCIsIFxcXCLimIXimIXimIbimIbimIZcXFwiLCBcXFwi4piF4piG4piG4piG4piGXFxcIl1baW5kZXhdICsgXFxcIjwvZm9udD4mbmJzcDtcXFwiO1xcclxcblxcclxcbiAgICAgICAgciArPSBmdW5jdGlvbihlKSB7XFxyXFxuICAgICAgICAgICAgbGV0IHQxID0gJyc7XFxyXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBlOyBpKyspIHQxICs9IFxcXCLilodcXFwiO1xcclxcbiAgICAgICAgICAgIGxldCB0MiA9ICcnO1xcclxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgMTAgLSBlOyBpKyspIHQyICs9IFxcXCLilodcXFwiO1xcclxcbiAgICAgICAgICAgIHJldHVybiB0MS5mb250Y29sb3IoJyNmZmFjMmQnKSArIHQyLmZvbnRjb2xvcignI2U1ZTFlNCcpO1xcclxcbiAgICAgICAgfSgoMTAgKiB2YWx1Z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ICAgICAgICAgfV1cXHJcXG4gICAgICAgIH0pXFxyXFxuICAgIH0gZWxzZSBpZihzLmF3YXJkcy5sZW5ndGggPT0gMCl7XFxyXFxuICAgICAgICBzZXRSZXN1bHQoW10pO1xcclxcbiAgICB9IGVsc2V7XFxyXFxuICAgICAgICBzZXRIb21lUmVzdWx0KHtcXHJcXG4gICAgICAgICAgICBkYXRhOiBbe1xcclxcbiAgICAgICAgICAgICAgICB0aXRsZTogcjIsXFxyXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwicmljaF90ZXh0XFxcIlxcclxcbiAgICAgICAgICAgIH1dXFxyXFxuICAgICAgICB9KVxcclxcbiAgICB9XFxyXFxufVxcclxcblxcclxcbi8v5aWW6aG56K+m5oOF6aG16Z2iXFxyXFxuZnVuY3Rpb24gYXdhcmRWaWV3KGlkLCBuYW1lKSB7XFxyXFxuICAgIHNldFBhZ2VUaXRsZShuYW1lKTtcXHJcXG4gICAgbGV0IHMgPSBnZXREb3ViYW5SZXMoXFxcImh0dHBzOi8vZnJvZG8uZG91YmFuLmNvbS9hcGkvdjIvY2VyZW1vbnkvXFxcIiArIGlkKTtcXHJcXG4gICAgbGV0IGEgPSBbXTtcXHJcXG4gICAgYS5wdXNoKHtcXHJcXG4gICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIChzLnRpdGxlICsgJygnICsgcy55ZWFyICsgJyknKS5iaWcoKS5ib2xkKCksXFxyXFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfMScsXFxyXFxuICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcclxcbiAgICAgICAgfVxcclxcbiAgICB9KVxcclxcbiAgICBzLnBsYXlsaXN0cy5mb3JFYWNoKGUgPT4ge1xcclxcbiAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogZS50aXRsZSxcXHJcXG4gICAgICAgICAgICBkZXNjOiAn5YWxJ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HJcXG4gICAgICAgIHIucHVzaCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6IGUudGl0bGUsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJyaWNoX3RleHRcXFwiXFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgICAgIGUuY2VsZWJyaXRpZXMuZm9yRWFjaCgoZSA9PiB7XFxyXFxuICAgICAgICAgICAgci5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGUubmFtZSArIFxcXCJcXFxcblxcXCIgKyBlLmxhdGluX25hbWUsXFxyXFxuICAgICAgICAgICAgICAgIGRlc2M6IGUuY2hhcmFjdGVyLFxcclxcbiAgICAgICAgICAgICAgICBpbWc6IGUuYXZhdGFyLm5vcm1hbCArIFxcXCJAUmVmZXJlcj1cXFwiICsgZS5hdmF0YXIubm9ybWFsLFxcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzFfdmVydGljYWxfcGljJyxcXHJcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCdoaWtlcjovL2VtcHR5I25vSGlzdG9yeSMjaW1tZXJzaXZlVGhlbWUjJykucnVsZSgoZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKHJlcXVlc3QoJ2hpa2VyOi8vcGFnZS9tYWluJykpLnJ1bGUpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgZWxlc3NhclZpZXcoZS51cmkuc3BsaXQoXFxcInN1YmplY3RfaWQ9XFxcIilbMV0sIGUuaWQsIGUubmFtZSk7XFxyXFxuICAgICAgICAgICAgICAgIH0sIGUpXFxyXFxuICAgICAgICAgICAgfSlcXHJcXG4gICAgICAgIH0pKVxcclxcbiAgICB9KSk7XFxyXFxuICAgIHNldEhvbWVSZXN1bHQoe1xcclxcbiAgICAgICAgZGF0YTogclxcclxcbiAgICB9KVxcclxcbn1cXHJcXG5cXHJcXG4vL+efreivhOmhtemdolxcclxcbmZ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Ii9cXFwiICsgaWQgKyBcXFwiL3Jldmlld3M/c3RhcnQ9XFxcIiArIDE1ICogKHBhZ2UgLSAxKSArIFxcXCImY291bnQ9MTUmb3JkZXJfYnk9XFxcIiArIHUpO1xcclxcbiAgICBsZXQgbCA9IFtdO1xcclxcbiAgICBsZXQgc3RhckNvbG9yID0gZ2V0Q29uZmlnKCdzdGFyQ29sb3InKTtcXHJcXG4gICAgci5yZXZpZXdzLmZvckVhY2goKGUgPT4ge1xcclxcbiAgICAgICAgbGV0IHQgPSBcXFwiXFxcIjtcXHJcXG4gICAgICAgIGlmIChlLnJhdGluZykge1xcclxcbiAgICAgICAgICAgIHQgPSBjb21wdXRlUmF0aW5nKGUucmF0aW5nLm1heCwgZS5yYXRpbmcudmFsdWUpO1xcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgbGV0IGkgPSBlLmNvbW1lbnRzX2NvdW50ID8gZS5jb21tZW50c19jb3VudCArIFxcXCLlm57lpI1cXFwiIDogXFxcIlxcXCIsXFxyXFxuICAgICAgICAgICAgciA9IGUudXNlZnVsX2NvdW50ID8gZS51c2VmdWxfY291bnQgKyBcXFwi5pyJ55SoXFxcIiA6IFxcXCJcXFwiLFxcclxcbiAgICAgICAgICAgIG8gPSBlLnJlc2hhcmVzX2NvdW50ID8gZS5yZXNoYXJlc19jb3VudCArIFxcXCLovazlj5FcXFwiIDogXFxcIlxcXCI7XFxyXFxuXFxyXFxuICAgICAgICByID0gaSAmJiByID8gXFxcIuKAolxcXCIgKyByIDogcjtcXHJcXG4gICAgICAgIG8gPSAoaSB8fCByKSAmJiBvID8gXFxcIuKAolxcXCIgKyBvIDogbztcXHJcXG4gICAgICAgIGwucHVzaCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6IGUudXNlci5uYW1lLFxcclxcbiAgICAgICAgICAgIGltZzogZS51c2VyLmF2YXRhcixcXHJcXG4gICAgICAgICAgICB1cmw6IGUudXNlci51cmwsXFxyXFxuICAgICAgICAgICAgY29sX3R5cG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KTtcXHJcXG4gICAgbGV0IG8gPSBpLmZpbHRlcigoZSA9PiBcXFwiQ1xcXCIgPT09IGUudHlwZSkpO1xcclxcblxcclxcbiAgICBpZiAoci5sZW5ndGggPiAwKSB7XFxyXFxuICAgICAgICByLnVuc2hpZnQoe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi6aKE5ZGKXFxcIixcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInJpY2hfdGV4dFxcXCJcXHJcXG4gICAgICAgIH0pXFxyXFxuICAgIH1cXHJcXG4gICAgaWYgKGwubGVuZ3RoID4gMCkge1xcclxcbiAgICAgICAgbC51bnNoaWZ0KHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogXFxcIueJh+autVxcXCIsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJyaWNoX3RleHRcXFwiXFxyXFxuICAgICAgICB9KVxcclxcbiAgICB9XFxyXFxuICAgIGlmIChvLmxlbmd0aCA+IDApIHtcXHJcXG4gICAgICAgIG8udW5zaGlmdCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLoirHnta5cXFwiLFxcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwicmljaF90ZXh0XFxcIlxcclxcbiAgICAgICAgfSlcXHJcXG4gICAgfVxcclxcblxcclxcbiAgICBzZXRIb21lUmVzdWx0KHtcXHJcXG4gICAgICAgIGRhdGE6IHIuY29uY2F0KGwpXFxyXFxuICAgICAgICAgICAgLmNvbmNhdChvKVxcclxcbiAgICB9KVxcclxcbn1cXHJcXG5cXHJcXG4vL+inhumikeivhOiuuumhtemdolxcclxcbmZ1bmN0aW9uIHZpZGVvQ29tbWVudCh0eXBlLCBpZCkge1xcclxcbiAgICBsZXQgaSA9IGdldERvdWJhblJlcyhcXFwiaHR0cHM6Ly9mcm9kby5kb3ViYW4uY29tL2FwaS92Mi9cXFwiICsgdHlwZSArIFxcXCIvXFxcIiArIGlkICsgXFxcIi92aWRlb3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HlwZSwgaWQsIHRpdGxlLCB1c2VDb25maWcpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGV2YWwoSlNPTi5wYXJzZShyZXF1ZXN0KCdoaWtlcjovL3BhZ2UvbWFpbicpKS5ydWxlKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09PSBcXFwicGxheWxpc3RcXFwiKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgZG91TGlzdChpZCwgTVlfUEFHRSwgNTApO1xcclxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKHVzZUNvbmZpZyk7XFxyXFxuICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIH0sIHR5cGUsIGlkLCB0aXRsZSwgdXNlQ29uZmlnKTtcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcclxcbiAgICAgICAgICAgICAgICBpbWc6IGUuc3ViamVjdC5jb3Zlci5ub3JtYWwudXJsICsgXFxcIkBSZWZlcmVyPVxcXCIgKyBlLnN1YmplY3QuY292ZXIubm9ybWFsLnVybCxcXHJcXG4gICAgICAgICAgICAgICAgZGVzYzogcmF0aW5nLFxcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzMnLFxcclxcbiAgICAgICAgICAgICAgICB1cmw6IHVybFBhcmFtcy51cmwsXFxyXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB1cmxQYXJhbXMuZXh0cmFcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgLyphLnB1c2goe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiAn5p+l55yL5pu05aSaJyxcXHJcXG4gICAgICAgICAgICBpbWc6ICdodHRwczovL2pva2VyLXR4LmNvZGluZ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cXG4gICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOi8vZW1wdHkvIy8kcGFnZXtmeXBhZ2V9I25vSGlzdG9yeSMnKS5ydWxlKChwaWQpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKHJlcXVlc3QoJ2hpa2VyOi8vcGFnZS9tYWluJykpLnJ1bGUpO1xcclxcbiAgICAgICAgICAgICAgICBlbGVzc2FyUGhvdG9zKHBpZCk7XFxyXFxuICAgICAgICAgICAgfSwgcGlkKSxcXHJcXG4gICAgICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9KVxcclxcblxcclxcbiAgICAgICAgbGV0IHBsZW5ndGggPSBlMy5waG90b3MubGVuZ3RoIDw9IDIgPyBlMy5waG90b3MubGVuZ3RoIDogMjtcXHJcXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgcGxlbmd0aDsgaSsrKSB7XFxyXFxuICAgICAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgLy90aXRsZTogZTMucGhvdG9zWzBdLmRlc2NyaXB0aW9uLFxcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2NhcmRfcGljXzInLFxcclxcbiAgICAgICAgICAgICAgICBkZXNjOiAnMCcsXFxyXFxuICAgICAgICAgICAgICAgIGltZzogZTMucGhvdG9zW2ldLmltYWdlLm5vcm1hbC51cmwgKyAnQFJlZmVyZXI9JyArIGUzLnBob3Rvc1tpXS5pbWFnZS5ub3JtYWwudXJsLFxcclxcbiAgICAgICAgICAgICAgICB1cmw6IGUzLnBob3Rvc1tpXS5pbWFnZS5ub3JtYWwudXJsICsgJ0BSZWZlcmVyPScgKyBlMy5waG90b3NbaV0uaW1hZ2Uubm9ybWFsLnVybFxcclxcbiAgICAgICAgICAgIH0pXFxyXFxuICAgICAgICB9XFxy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IGxldCBsID0gW107XFxyXFxuICAgIGxldCBkZXRhaWxzVmlld0NvbmZpZ3MgPSBnZXRDb25maWcoJ2RldGFpbHNWaWV3Q29uZmlncycpO1xcclxcbiAgICBpLmF3YXJkcy5mb3JFYWNoKHQgPT4ge1xcclxcbiAgICAgICAgbC5wdXNoKHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogKHQueWVhcitcXFwiXFxcIikuYm9sZCgpLmJpZygpLFxcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiAncmljaF90ZXh0J1xcclxcbiAgICAgICAgfSlcXHJcXG5cXHJcXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgdC5tb2R1bGVzLmxlbmd0aDsgaSsrKSB7XFxyXFxuICAgICAgICAgICAgbGV0IGUgPSB0Lm1vZHVsZXNbaV07XFxyXFxuICAgICAgICAgICAgaWYgKCFlLmNlcmVtb255IHx8ICFlLmNhdGVnb3J5KSB7XFxyXFxuICAgICAgICAgICAgICAgIGxldCByYXRpbmcgPSBcXFwiXFxcIjtcXHJcXG4gICAgICAgICAgICAgICAgaWYgKGUuZXh0cmEucmF0aW5nX2dyb3VwLnJhdGluZykge1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmF0aW5nID0gY29tcHV0ZVJhdGluZyhlLmV4dHJhLnJhdGluZ19ncm91cC5yYXRpbmcubWF4LCBlLmV4dHJhLnJhdGluZ19ncm91cC5yYXRpbmcudmFsdWUpICsgXFxcIiBcXFwiICsgZS5leHRyYS5yYXRpbmdfZ3JvdXAucmF0aW5nLnZhbHVlICsgXFxcIuWIhlxcXCI7XFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGUgPSBlLnN1YnR5cGUsXFxyXFxuICAgICAgICAgICAgICAgICAgICBpZCA9IGUuaWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IGUudGl0bGU7XFxyXFxuICAgICAgICAgICAgICAgIGxldCB1c2VDb25maWcgPSBkZXRhaWxzVmlld0NvbmZpZ3NbZGV0YWlsc1ZpZXdDb25maWdzLnVzZV0uY29uZmlnO1xcclxcbiAgICAgICAgICAgICAgICBsZXQgdXJsUGFyYW1zID0ge307XFxyXFxuICAgICAgICAgICAgICAgIGlmICh1c2VDb25maWcuc3RhcnRzV2l0aCgneycpKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBldmFsKCd1cmxQYXJhbXMgPSAnICsgdXNlQ29uZmlnKTtcXHJcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHVybFBhcmFtcy51cmwgPSAkKFxcXCJoaWtlcjovL2VtcHR5I25vSGlzdG9yeSMjaW1tZXJzaXZlVGhlbWUjXFxcIiArICc/dHlwZT0nICsgdHlwZSArICcmaWQ9JyArIGlkKS5ydWxlKCh0eXBlLCBpZCwgdGl0bGUsIHVzZUNvbmZpZykgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoSlNPTi5wYXJzZShyZXF1ZXN0KCdoaWtlcjovL3BhZ2UvbWFpbicpKS5ydWxlKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZSA9PT0gXFxcInBsYXlsaXN0XFxcIikge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VMaXN0KGlkLCBNWV9QQUdFLCA1MCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCh1c2VDb25maWcpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgICAgIH0sIHR5cGUsIGlkLCB0aXRsZSwgdXNlQ29uZmlnKTtcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICBsLnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcclxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBlLmNvdmVyLm5vcm1hbC51cmwgKyBcXFwiQFJlZmVyZXI9XFxcIiArIGUuY292ZXIubm9ybWFsLnVybCxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHJhdGluZyArICdcXFxcbicgKyBlLmV4dHJhLnNob3J0X2luZm8sXFxyXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybFBhcmFtcy51cmwsXFxyXFxuICAgICAgICAgICAgICAgICAgICBleHRyYTogdXJsUGFyYW1zLmV4dHJhXFxyXFxuICAgICAgICAgICAgICAgIH0pXFxyXFxuICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgbC5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBlLmNlcmVtb255LnRpdGxlLmJvbGQoKSArICc8c21hbGw+KDxhIGhyZWY9XFxcImhpa2VyOi8vZW1wdHkjbm9IaXN0b3J5I0BydWxlPWpzOmV2YWwoSlNPTi5wYXJzZShmZXRjaChgaGlrZXI6Ly9wYWdlL21haW5gKSkucnVsZSk7YXdhcmRWaWV3KGAnICsgZS5jZXJlbW9ueS5pZCArICdgLGAnICsgZS5jZXJlbW9ueS50aXRsZSArICdgKTtcXFwiPuafpeeci+ivpuaDhTwvYT4pPC9zbWFsbD4nICsgJzxici8+JyArIChlLmNhdGVnb3J5LnRpdGxlICsgKGUuaXNfd29uID8gJycgOiAnKOaPkOWQjSknKSkuc21hbGwoKSxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAncmljaF90ZXh0J1xcclxcbiAgICAgICAgICAgICAgICB9KVxcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfSlcXHJcXG5cXHJcXG4gICAgaWYgKE1ZX1BBR0UgPT0gMSkge1xcclxcbiAgICAgICAgbC51bnNoaWZ0KHtcXHJcXG4gICAgICAgICAg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1MCk7XFxyXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBldmFsKHVzZUNvbmZpZyk7XFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICB9LCB0eXBlLCBpZCwgdGl0bGUsIHVzZUNvbmZpZyk7XFxyXFxuICAgICAgICB9XFxyXFxuICAgICAgICBsLnB1c2goe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXHJcXG4gICAgICAgICAgICBpbWc6IGUuc3ViamVjdC5jb3Zlci5ub3JtYWwudXJsICsgXFxcIkBSZWZlcmVyPVxcXCIgKyBlLnN1YmplY3QuY292ZXIubm9ybWFsLnVybCxcXHJcXG4gICAgICAgICAgICBkZXNjOiBlLnJvbGVzLmpvaW4oXFxcIuKAolxcXCIpICsgXFxcIlxcXFxuXFxcIiArIHJhdGluZyxcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzFfdmVydGljYWxfcGljJyxcXHJcXG4gICAgICAgICAgICB1cmw6IHVybFBhcmFtcy51cmwsXFxyXFxuICAgICAgICAgICAgZXh0cmE6IHVybFBhcmFtcy5leHRyYVxcclxcbiAgICAgICAgfSlcXHJcXG4gICAgfSkpXFxyXFxuXFxyXFxuICAgIGlmIChNWV9QQUdFID09IDEpIHtcXHJcXG4gICAgICAgIGwudW5zaGlmdCh7XFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCJcXHJcXG4gICAgICAgIH0pXFxyXFxuICAgICAgICBsLnVuc2hpZnQoe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiBcXFwiPGJpZz7lhbE8c3Ryb25nPiBcXFwiICsgaS50b3RhbCArIFxcXCIgPC9zdHJvbmc+6YOo5L2c5ZOBPC9iaWc+XFxcIixcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInJpY2hfdGV4dFxcXCJcXHJcXG4gICAgICAgIH0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wZTogXFxcInJpY2hfdGV4dFxcXCJcXHJcXG4gICAgfV07XFxyXFxuXFxyXFxuICAgIGwuY29tbWVudHMubGVuZ3RoID4gMCA/IGwuY29tbWVudHMuZm9yRWFjaCgoZSA9PiB7XFxyXFxuICAgICAgICBvLnB1c2goe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiBlLmF1dGhvci5uYW1lLFxcclxcbiAgICAgICAgICAgIGltZzogZS5hdXRob3IuYXZhdGFyLFxcclxcbiAgICAgICAgICAgIHVybDogZS5hdXRob3IudXJsLFxcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYXZhdGFyXFxcIlxcclxcbiAgICAgICAgfSlcXHJcXG4gICAgICAgIG8ucHVzaCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6IGUudGV4dCArIChlLnJlcGxpZXMubGVuZ3RoID4gMCA/ICcgPHNtYWxsPjxhIGhyZWY9XFxcImhpa2VyOi8vZW1wdHkjbm9IaXN0b3J5I0BydWxlPWpzOmV2YWwoSlNPTi5wYXJzZShmZXRjaChgaGlrZXI6Ly9wYWdlL21haW5gKSkucnVsZSk7ZHJhbWFSZXZpZXdSZXBseVZpZXcoJyArIGUuaWQgKyAnKTtcXFwiPlvmn6XnnIvlm57lpI1dPC9hPjwvc21hbGw+JyA6IFxcXCJcXFwiKSxcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInJpY2hfdGV4dFxcXCJcXHJcXG4gICAgICAgIH0pXFxyXFxuICAgICAgICBvLnB1c2goe1xcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCJcXHJcXG4gICAgICAgIH0pXFxyXFxuICAgIH0pKSA6IG8ucHVzaCh7XFxyXFxuICAgICAgICB0aXRsZTogJzxmb250IGNvbG9yPVxcXCJncmV5XFxcIj4oIOKAosylzIEgy40g4oCizIDgpYIgKei/mOayoeacieS6uuivhOiuui4uLjwvZm9udD4nLFxcclxcbiAgICAgICAgY29sX3R5cGU6IFxc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xuICAgIGxldCBpID0gW107XFxyXFxuICAgIHQucmVwbGllcy5mb3JFYWNoKChlID0+IHtcXHJcXG4gICAgICAgIGkucHVzaCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6IGUuYXV0aG9yLm5hbWUsXFxyXFxuICAgICAgICAgICAgaW1nOiBlLmF1dGhvci5hdmF0YXIsXFxyXFxuICAgICAgICAgICAgdXJsOiBlLmF1dGhvci51cmwsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJhdmF0YXJcXFwiXFxyXFxuICAgICAgICB9KVxcclxcbiAgICAgICAgaS5wdXNoKHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogKGUucmVmX2NvbW1lbnQuaGFzX3JlZiA/ICflm57lpI1APGZvbnQgY29sb3I9XFxcImJsdWVcXFwiPicgKyBlLnJlZl9jb21tZW50LmF1dGhvci5uYW1lICsgXFxcIjwvZm9udD7vvJpcXFwiIDogXFxcIlxcXCIpICsgZS50ZXh0LFxcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwicmljaF90ZXh0XFxcIlxcclxcbiAgICAgICAgfSlcXHJcXG4gICAgICAgIGkucHVzaCh7XFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIlxcclxcbiAgICAgICAgfSlcXHJcXG4gICAgfSkpXFxyXFxuXFxyXFxuICAgIHNldEhvbWVSZXN1bHQoe1xcclxcbiAgICAgICAgZGF0YTogaVxcclxcbiAgICB9KVxcclxcbn1cXHJcXG5cXHJcXG4vL+ebuOWFs+aOqOiNkOmhtemdolxcclxcbmZ1bmN0aW9uIHJlY29tbWVuZGF0aW9ucyh0eXBlLCBpZCl7XFxyXFxuICAgIHNldFBhZ2VUaXRsZSgn55u45YWz5o6o6I2QJyk7XFxyXFxuICAgIGxldCByZXMgPSBnZXREb3ViYW5SZXMoXFxcImh0dHBzOi8vZnJvZG8uZG91YmFuLmNvbS9hcGkvdjIvXFxcIisgdHlwZSArIFxcXCIvX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ICAgICAgICAgICAgZXZhbCh1c2VDb25maWcpO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgfSwgdHlwZSwgaWQsIHRpdGxlLCB1c2VDb25maWcpO1xcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgcmV0dXJuIHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxyXFxuICAgICAgICAgICAgdXJsOiB1cmxQYXJhbXMudXJsLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB1cmxQYXJhbXMuZXh0cmEsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdtb3ZpZV8zJyxcXHJcXG4gICAgICAgICAgICBpbWc6IGUucGljID8gZS5waWMubm9ybWFsICsgXFxcIkBSZWZlcmVyPVxcXCIgKyBlLnBpYy5ub3JtYWwgOiBlLmNvdmVyLnVybCArICdAUmVmZXJlcj0nICsgZS5jb3Zlci51cmwsXFxyXFxuICAgICAgICAgICAgZGVzYzogZS5udWxsX3JhdGluZ19yZWFzb24gfHwgZS5yYXRpbmcudmFsdWVcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfSkpO1xcclxcblxcclxcbiAgICBzZXRIb21lUmVzdWx0KHtcXHJcXG4gICAgICAgIGRhdGE6IGlcXHJcXG4gICAgfSlcXHJcXG59XFxyXFxuXFxyXFxuLy/lvbHniYfor6bmg4XpobXpnaJcXHJcXG5mdW5jdGlvbiBkZXRhaWxzVmlldyh0eXBlLCBpZCkge1xcclxcbiAgICBsZXQgaSA9IGdldERvdWJhblJlcyhcXFwiaHR0cHM6Ly9mcm9kby5kb3ViYW4uY29tL2FwaS92Mi9cXFwiICsgdHlwZSArIFxcXCIvXFxcIiArIGlkKTtcXHJcXG4gICAgc2V0UGFnZVRpdGxlKGkudGl0bGUpO1xcclxcbiAgICBsZXQgaW5mbyA9IFxcXCJcXFwiO1xcclxcbiAgICBpZiAoaS5pc190dikge1xcclxcbiAgICAgICAgaW5mbyA9IFtpLmNvd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lja1NlYXJjaEl0ZW1zLnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICB0aXRsZTogcXVpY2tTZWFyY2hJdGVtLFxcclxcbiAgICAgICAgICAgICAgICBpbWc6IHF1aWNrU2VhcmNoQ29uZmlnc1txdWlja1NlYXJjaEl0ZW1dLnBpYyxcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHF1aWNrU2VhcmNoQ29uZmlncy5tb2RlIHx8ICdpY29uX3NtYWxsXzQnLFxcclxcbiAgICAgICAgICAgICAgICB1cmw6ICdoaWtlcjovL3NlYXJjaD9zPScgKyBpLnRpdGxlICsgJyZydWxlPScgKyBxdWlja1NlYXJjaENvbmZpZ3NbcXVpY2tTZWFyY2hJdGVtXS5uYW1lXFxyXFxuICAgICAgICAgICAgfSlcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfSlcXHJcXG4gICAgaWYgKHF1aWNrU2VhcmNoSXRlbXMubGVuZ3RoID4gMCkge1xcclxcbiAgICAgICAgcXVpY2tTZWFyY2hJdGVtcy51bnNoaWZ0KHtcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08c3Ryb25nPjxiaWc+5b+r6YCf5pCc57SiPC9iaWc+PC9zdHJvbmc+JyxcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXHJcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcclxcbiAgICAgICAgICAgICAgICB9LFxcclxcbiAgICAgICAgICAgICAgICB1cmw6ICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgIH0pXFxyXFxuICAgICAgICAgICAgLypxdWlja1NlYXJjaEl0ZW1zLnVuc2hpZnQoe1xcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2xpbmUnXFxyXFxuICAgICAgICAgICAgfSkqL1xcclxcbiAgICB9XFxyXFxuXFxyXFxuICAgIHNldEhvbWVSZXN1bHQoe1xcclxcbiAgICAgICAgZGF0YTogaW5mb0l0ZW1zLmNvbmNhdChyYXRpbmdJdGVtcylcXHJcXG4gICAgICAgICAgICAuY29uY2F0KHJlbGF0ZWRJdGVtcylcXHJcXG4gICAgICAgICAgICAuY29uY2F0KHtcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lJ1xcclxcbiAgICAgICAgICAgIH0pXFxyXFxuICAgICAgICAgICAgLmNvbmNhdChxdWlja1NlYXJjaEl0ZW1zKVxcclxcbiAgICAgICAgICAgIC5jb25jYXQoe1xcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2xpbmUnXFxyXFxuICAgICAgICAgICAgfSlcXHJcXG4gICAgICAgICAgICAuY29uY2F0KHZpZGVvSXRlbXMpXFxyXFxuICAgICAgICAgICAgLmNvbmNhdCh7XFxyXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbGluZSdcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgICAgIC5jb25jYXQodmlkZW9SZWxhdGVkSXRlbXMpXFxyXFxuICAgICAgICAgICAgLmNvbmNhdCh7XFxyXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbGluZSdcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgICAgIC5jb25jYXQoaW50cm9JdGVtcylcXHJcXG4gICAgICAgICAgICAuY29uY2F0KHtcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lJyxcXHJcXG4gICAgICAgICAgICAgICAgZXh0cmE6e1xcclxcbiAgICAgICAgICAgICAgICAgIGlkOiAncmVjb21tZW5kYXRpb25zJ1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgfSlcXHJcXG4gICAgICAgICAgICAuY29uY2F0KHtcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0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XRDb25maWcoJ2RldGFpbHNWaWV3Q29uZmlncycpO1xcclxcbiAgICAgICAgICAgIGxldCBsID0gW3Jlc1swXSxyZXNbMV0scmVzWzJdXTtcXHJcXG4gICAgICAgICAgICBsZXQgaSA9IGwubWFwKChlID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGUgPSBlLnR5cGUsXFxyXFxuICAgICAgICAgICAgICAgICAgICBpZCA9IGUuaWQsXFxyXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IGUudGl0bGU7XFxyXFxuICAgICAgICAgICAgICAgIGxldCB1c2VDb25maWcgPSBkZXRhaWxzVmlld0NvbmZpZ3NbZGV0YWlsc1ZpZXdDb25maWdzLnVzZV0uY29uZmlnO1xcclxcbiAgICAgICAgICAgICAgICBsZXQgdXJsUGFyYW1zID0ge307XFxyXFxuICAgICAgICAgICAgICAgIGlmICh1c2VDb25maWcuc3RhcnRzV2l0aCgneycpKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBldmFsKCd1cmxQYXJhbXMgPSAnICsgdXNlQ29uZmlnKTtcXHJcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHVybFBhcmFtcy51cmwgPSAkKFxcXCJoaWtlcjovL2VtcHR5I25vSGlzdG9yeSMjaW1tZXJzaXZlVGhlbWUjXFxcIiArICc/dHlwZT0nICsgdHlwZSArICcmaWQ9JyArIGlkKS5ydWxlKCh0eXBlLCBpZCwgdGl0bGUsIHVzZUNvbmZpZykgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoSlNPTi5wYXJzZShyZXF1ZXN0KCdoaWtlcjovL3BhZ2UvbWFpbicpKS5ydWxlKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZSA9PT0gXFxcInBsYXlsaXN0XFxcIikge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3VMaXN0KGlkLCBNWV9QQUdFLCA1MCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCh1c2VDb25maWcpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgICAgIH0sIHR5cGUsIGlkLCB0aXRsZSwgdXNlQ29uZmlnKTtcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcclxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmxQYXJhbXMudXJsLFxcclxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHVybFBhcmFtcy5leHRyYSxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGltZzogZS5waWMgPyBlLnBpYy5ub3JtYWwgKyBcXFwiQFJlZmVyZXI9XFxcIiArIGUucGljLm5vcm1hbCA6IGUuY292ZXIudXJsICsgJ0BSZWZlcmVyPScgKyBlLmNvdmVyLnVybCxcXHJcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IGUubnVsbF9yYXRpbmdfcmVhc29uIHx8IGUucmF0aW5nLnZhbHVlXFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICB9KSk7XFxyXFxuICAgICAgICAgICAgYWRkSXRlbUFmdGVyKCdyZWNvbW1lbmRhdGlvbnMnLCBpWzJdKTtcXHJcXG4gICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoJ3JlY29tbWVuZGF0aW9ucycsIGlbMV0pO1xcclxcbiAgICAgICAgICAgIGFkZEl0ZW1BZnRlcigncmVjb21tZW5kYXRpb25zJywgaVswXSk7XFxyXFxuICAgICAgICAgICAgYWRkSXRlbUFmdGVyKCdyZWNvbW1lbmRhdGlvbnMnLCB7XFxyXFxuICAgICAgICAgICAgICAgIHRpdGxlO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ZlVGhlbWUjJztcXHJcXG4gICAgICAgIGxldCB1c2VDb25maWcgPSBkZXRhaWxzVmlld0NvbmZpZ3NbZGV0YWlsc1ZpZXdDb25maWdzLnVzZV0uY29uZmlnO1xcclxcbiAgICAgICAgbGV0IHVybFBhcmFtcyA9IHt9O1xcclxcbiAgICAgICAgaWYgKHVzZUNvbmZpZy5zdGFydHNXaXRoKCd7JykpIHtcXHJcXG4gICAgICAgICAgICBldmFsKCd1cmxQYXJhbXMgPSAnICsgdXNlQ29uZmlnKTtcXHJcXG4gICAgICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICAgICAgdXJsUGFyYW1zLnVybCA9ICQoYmFzZVVybCArIFxcXCIjbm9IaXN0b3J5I1xcXCIgKyAnP3R5cGU9JyArIHR5cGUgKyAnJmlkPScgKyBpZCkucnVsZSgodHlwZSwgaWQsIHRpdGxlLCB1c2VDb25maWcpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKHJlcXVlc3QoJ2hpa2VyOi8vcGFnZS9tYWluJykpLnJ1bGUpO1xcclxcbiAgICAgICAgICAgICAgICBpZiAodHlwZSA9PT0gXFxcInBsYXlsaXN0XFxcIikge1xcclxcbiAgICAgICAgICAgICAgICAgICAgZG91TGlzdChpZCwgTVlfUEFHRSwgNTApO1xcclxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICAgICAgZXZhbCh1c2VDb25maWcpO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgfSwgdHlwZSwgaWQsIHRpdGxlLCB1c2VDb25maWcpO1xcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgcmV0dXJuIHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogdGl0bGUgKyAodHlwZSA9PT0gXFxcInBsYXlsaXN0XFxcIiA/IFxcXCJcXFwiIDogXFxcIu+8iFxcXCIgKyBlLnllYXIgKyBcXFwi77yJXFxcIiksXFxy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sXFxcInNvcnRcXFwiOlxcXCJyZWNvbW1lbmRcXFwiLFxcXCJzY29yZVxcXCI6XFxcIjAsMTBcXFwifScpO1xcclxcbiAgICBsZXQgYSA9IFtdO1xcclxcbiAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ2hvdExpc3QnKSk7XFxyXFxuICAgIGxldCBjb2xvciA9IGdldENvbmZpZygnY2hvb3NlQ29sb3InKTtcXHJcXG5cXHJcXG4gICAgbGV0IGl0ZW1zID0ge1xcclxcbiAgICAgICAg55S15b2xOiB7XFxyXFxuICAgICAgICAgICAg5b2x6Zmi54Ot5pig55S15b2xOiAnbW92aWVfc2hvd2luZz9hcmVhPeWFqOmDqCcsXFxyXFxuICAgICAgICAgICAg6LGG55Oj54Ot6Zeo55S15b2xOiAnaG90X2dhaWE/YXJlYT3lhajpg6gnLFxcclxcbiAgICAgICAgICAgIOeDremXqOWNjuivreeUteW9sTogJ2hvdF9nYWlhP2FyZWE95Y2O6K+tJyxcXHJcXG4gICAgICAgICAgICDng63pl6jmrKfnvo7nlLXlvbE6ICdob3RfZ2FpYT9hcmVhPeasp+e+jicsXFxyXFxuICAgICAgICAgICAg54Ot6Zeo6Z+p5Zu955S15b2xOiAnaG90X2dhaWE/YXJlYT3pn6nlm70nLFxcclxcbiAgICAgICAgICAgIOeDremXqOaXpeacrOeUteW9sTogJ2hvdF9nYWlhP2FyZWE95pel5pysJ1xcclxcbiAgICAgICAgfSxcXHJcXG4gICAgICAgIOeUteinhuWJpzoge1xcclxcbiAgICAgICAgICAgIOeDreaSreeUteinhuWJpzogJ3R2X2hvdCcsXFxyXFxuICAgICAgICAgICAg54Ot5pKt5Zu95Lqn5YmnOiAndHZfZG9tZXN0aWMnLFxcclxcbiAgICAgICAgICAgIOeDreaSreasp+e+juWJpzogJ3R2X2FtZXJpY2FuJyxcXHJcXG4gICAgICAgICAgICDng63mkq3ml6Xliac6ICd0dl9qYXBhbmVzZScsXFxyXFxuICAgICAgICAgICAg54Ot5pKt6Z+p5YmnOiAndHZfa29yZWFuJyxcXHJcXG4gICAgICAgICAgICDng63mkq3liqjnlLs6ICd0dl9hbmltYXRpb24nXFxyXFxuICAgICAgICB9LFxcclxcbiAgICAgICAg57u86Im6OiB7XFxyXFxuICAgICAgICAgICAg54Ot5pKt57u86Im6OiAnc2hvd19ob3QnLFxcclxcbiAgICAgICAgICAgIOWbveWGhee7vOiJujogJ3Nob3dfZG9tZXN0aWMnLFxcclxcbiAgICAgICAgICAgIOWbveWklue7vOiJujogJ3Nob3dfZm9yZWlnbidcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfVxcclxcbiAgICBmb3IgKGxldCBpIGluIGl0ZW1zKSB7XFxyXFxuICAgICAgICBmb3IgKGxldCBqIGluIGl0ZW1zW2ldKSB7XFxyXFxuICAgICAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRlbXAuaXRlbSA9PSBpdGVtc1tpXVtqXSA/ICfigJzigJzigJ3igJ08Yj4gPGZvbnQgY29sb3I9JyArIGNvbG9yICsgJz4nICsgaiArICcgPC9mb250PjwvYj4nIDogaixcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXHJcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCdoaWtlcjovL2VtcHR5I25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRlbXAgPSBKU09OLnBhcnNlKGdldE15VmFyKCdob3RMaXN0JykpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgdGVtcC5pdGVtID0gZTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdob3RMaXN0JywgSlNPTi5zdHJpbmdpZnkodGVtcCkpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXHJcXG4gICAgICAgICAgICAgICAgfSwgaXRlbXNbaV1bal0pXFxyXFxuICAgICAgICAgICAgfSlcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgICAgIGEucHVzaCh7XFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCJcXHJcXG4gICAgICAgIH0pXFxyXFxuICAgIH1cXHJcXG5cXHJcXG4gICAgbGV0IHNvcnQgPSB7XFxyXFxuICAgICAgICDng63luqbmjpLluo86ICdyZWNvbW1lbmQnLFxcclxcbiAgICAgICAg5pe26Ze05o6S5bqPOiAndGltZScsXFxyXFxuICAgICAgICDor4TliIbmjpLluo86ICdyYW5rJ1xcclxcbiAgICB9XFxyXFxuICAgIGZvciAobGV0IHIgaW4gc29ydCkge1xcclxcbiAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogdGVtcC5zb3J0ID09IHNvcnRbcl0gPyAn4oCc4oCc4oCd4oCdPGI+IDxmb250IGNvbG9yPScgKyBjb2xvciArICc+JyArIHIgKyAnIDwvZm9udD48L2I+JyA6IHIsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXHJcXG4gICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOiAvL2VtcHR5I25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ2hvdExpc3QnKSk7XFxyXFxuICAgICAgICAgICAgICAgIHRlbXAuc29ydCA9IGU7XFxyXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJob3RMaXN0XFxcIiwgSlNPTi5zdHJpbmdpZnkodGVtcCkpO1xcclxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcclxcbiAgICAgICAgICAgICAgICByZX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Z2V0TXlWYXIoJ2NsYXNzbGlzdCcpKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB0ZW1wW2l0ZW1dID0gdGV4dC5pbmRleE9mKFxcXCLlhajpg6hcXFwiKSAhPSAtMSA/IFxcXCJcXFwiIDogdGV4dDtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiY2xhc3NsaXN0XFxcIiwgSlNPTi5zdHJpbmdpZnkodGVtcCkpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgICAgICAgICAgfSwgaXRlbXNbaXRlbV1baV0sIGl0ZW0pO1xcclxcbiAgICAgICAgICAgIFxcclxcbiAgICAgICAgICAgIGlmKGl0ZW1zW2l0ZW1dW2ldID09IFxcXCLoh6rlrprkuYnlubTku71cXFwiKXtcXHJcXG4gICAgICAgICAgICAgICAgaWYodGVtcC55ZWFyID09IFxcXCLoh6rlrprkuYnlubTku71cXFwiKXtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlID0gJ+KAnOKAnOKAneKAnTxiPiA8Zm9udCBjb2xvcj0nICsgY29sb3IgKyAnPuiHquWumuS5ieW5tOS7vTonICsgdGVtcC5jdXN0b21ZZWFyICsgJyA8L2ZvbnQ+PC9iPic7XFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgXFxyXFxuICAgICAgICAgICAgICAgIHVybCA9ICQodGVtcC5jdXN0b21ZZWFyLCAn55u05o6l6L6T5YWl6K+m57uG5bm05Lu9LOS+i+WmgjIwMDAnKS5pbnB1dCgoKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ2NsYXNzbGlzdCcpKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGlmKGlucHV0Lmxlbmd0aCA9PSA0KXtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB0ZW1wLmN1c3RvbVllYXIgPSBpbnB1dDtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB0ZW1wLnllYXIgPSBcXFwi6Ieq5a6a5LmJ5bm05Lu9XFxcIjtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiY2xhc3NsaXN0XFxcIiwgSlNPTi5zdHJpbmdpZnkodGVtcCkpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgICAgICAgICAgfWVsc2V7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+ivt+ato+ehrui+k+WFpSdcXHJcXG4gICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgfWVsc2UgaWYoaXRlbXNbaXRlbV1baV0gPT0gXFxcIuiHquWumuS5ieWcsOWMulxcXCIpe1xcclxcbiAgICAgICAgICAgICAgICBpZih0ZW1wLmxvY2FsID09IFxcXCLoh6rlrprkuYnlnLDljLpcXFwiKXtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlID0gJ+KAnOKAnOKAneKAnTxiPiA8Zm9udCBjb2xvcj0nICsgY29sb3IgKyAnPuiHquWumuS5ieWcsOWMujonICsgdGVtcC5jdXN0b21Mb2NhbCArICcgPC9mb250PjwvYj4nO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIFxcclxcbiAgICAgICAgICAgICAgICB1cmwgPSAkKHRlbXAuY3VzdG9tTG9jYWwsICfnm7TmjqXovpPlhaXor6bnu4blnLDljLos5L6L5aaC5Lit5Zu95aSn6ZmGJykuaW5wdXQoKCkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRlbXAgPSBKU09OLnBhcnNlKGdldE15VmFyKCdjbGFzc2xpc3QnKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICBpZihpbnB1dC5sZW5ndGggPiAwKXtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB0ZW1wLmN1c3RvbUxvY2FsID0gaW5wdXQ7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGVtcC5sb2NhbCA9IFxcXCLoh6rlrprkuYnlnLDljLpcXFwiO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJjbGFzc2xpc3RcXFwiLCBKU09OLnN0cmluZ2lmeSh0ZW1wKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxyXFxuICAgICAgICAgICAgICAgICAgICB9ZWxzZXtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6K+35q2j56Gu6L6T5YWlJ1xcclxcbiAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICB9ZWxzZSBpZihpdGVtc1tpdGVtXVtpXSA9PSBcXFwi6Ieq5a6a5LmJ57G75Z6LXFxcIil7XFxyXFxuICAgICAgICAgICAgICAgIGlmKHRlbXAudHlwZSA9PSBcXFwi6Ieq5a6a5LmJ57G75Z6LXFxcIil7XFxyXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSA9ICfigJzigJzigJ3igJ08Yj4gPGZvbnQgY29sb3I9JyArIGNvbG9yICsgJz7oh6rlrprkuYnnsbvlnos6JyArIHRlbXAuY3VzdG9tVHlwZSArICcgPC9mb250PjwvYj4nO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIFxcclxcbiAgICAgICAgICAgICAgICB1cmwgPSAkKHRlbXAuY3VzdG9tVHlwZSwgJ+ebtOaOpei+k+WFpeivpue7huexu+WeiyzkvovlpoLliafmg4UnKS5pbnB1dCgoKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ2NsYXNzbGlzdCcpKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGlmKGlucHV0Lmxlbmd0aCA+IDApe1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRlbXAuY3VzdG9tVHlwZSA9IGlucHV0O1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRlbXAudHlwZSA9IFxcXCLoh6rlrprkuYnnsbvlnotcXFwiO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJjbGFzc2xpc3RcXFwiLCBKU09OLnN0cmluZ2lmeSh0ZW1wKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxyXFxuICAgICAgICAgICAgICAgICAgICB9ZWxzZXtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6K+35q2j56Gu6L6T5YWlJ1xcclxcbiAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICB9ZWxzZSBpZihpdGVtc1tpdGVtXVtpXSA9PSBcXFwi6Ieq5a6a5LmJ5qCH562+XFxcIil7XFxyXFxuICAgICAgICAgICAgICAgIGlmKHRlbXAuY2xhc3MgPT0gXFxcIuiHquWumuS5ieagh+etvlxcXCIpe1xcclxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSAn4oCc4oCc4oCd4oCdPGI+IDxmb250IGNvbG9yPScgKyBjb2xvciArICc+6Ieq5a6a5LmJ5qCH562+OicgKyB0ZW1wLmN1c3RvbUNsYXNzICsgJyA8L2ZvbnQ+PC9iPic7XFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgXFxyXFxuICAgICAgICAgICAgICAgIHVybCA9ICQodGVtcC5jdXN0b21DbGFzcywgJ+ebtOaOpei+k+WFpeivpue7huagh+etvizkvovlpoLnu4/lhbhcXFxcbuWPr+WGmeWkmuS4quagh+etvizkvb/nlKhcXFwi6Iux5paH6YCX5Y+3XFxcIuWIhumalCcpLmlucHV0KCgpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0ZW1wID0gSlNPTi5wYXJzZShnZXRNeVZhcignY2xhc3NsaXN0JykpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgaWYoaW5wdXQubGVuZ3RoID4gMCl7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGVtcC5jdXN0b21DbGFzcyA9IGlucHV0O1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRlbXAuY2xhc3MgPSBcXFwi6Ieq5a6a5LmJ5qCH562+XFxcIjtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiY2xhc3NsaXN0XFxcIiwgSlNPTi5zdHJpbmdpZnkodGVtcCkpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgICAgICAgICAgfWVsc2V7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+ivt+ato+ehrui+k+WFpSdcXHJcXG4gICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIGEucHVzaCh7XFxyXFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXHJcXG4gICAgICAgICAgICAgICAgdXJsOiB1cmxcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2JsYW5rX2Jsb2NrJ1xcclxcbiAgICAgICAgfSlcXHJcXG4gICAgfVxcclxcblxcclxcbiAgICBsZXQgcmFuayA9IHtcXHJcXG4gICAgICAgIOm7mOiupOaOkuW6jzogXFxcIlVcXFwiLFxcclxcbiAgICAgICAg54Ot5bqmOiBcXFwiVFxcXCIsXFxyXFxuICAgICAgICDor4TliIY6IFxcXCJTXFxcIixcXHJcXG4gICAgICAgIOaXtumXtDogXFxcIlJcXFwiXFxyXFxuICAgIH1cXHJcXG4gICAgZm9yIChsZXQgciBpbiByYW5rKSB7XFxyXFxuICAgICAgICBhLnB1c2goe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiB0ZW1wLnJhbmsgPT09IHJhbmtbcl0gPyAn4oCc4oCc4oCd4oCdPGI+IDxmb250IGNvbG9yPScgKyBjb2xvciArICc+JyArIHIgKyAnIDwvZm9udD48L2I+JyA6IHIsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXHJcXG4gICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOiAvL2VtcHR5I25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ2NsYXNzbGlzdCcpKTtcXHJcXG4gICAgICAgICAgICAgICAgdGVtcC5yYW5rID0gZTtcXHJcX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xcIikge1xcclxcbiAgICAgICAgICAgICAgICAgICAgZG91TGlzdChpZCwgTVlfUEFHRSwgNTApO1xcclxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICAgICAgZXZhbCh1c2VDb25maWcpO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgfSwgdHlwZSwgaWQsIHRpdGxlLCB1c2VDb25maWcpO1xcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgcmV0dXJuIHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdtb3ZpZV8zJyxcXHJcXG4gICAgICAgICAgICB1cmw6IHVybFBhcmFtcy51cmwsXFxyXFxuICAgICAgICAgICAgZXh0cmE6IHVybFBhcmFtcy5leHRyYSxcXHJcXG4gICAgICAgICAgICBpbWc6IGUuY292ZXJfdXJsICsgXFxcIkBSZWZlcmVyPVxcXCIgKyBlLmNvdmVyX3VybCxcXHJcXG4gICAgICAgICAgICBkZXNjOiBlLm51bGxfcmF0aW5nX3JlYXNvbiB8fCBlLnJhdGluZy52YWx1ZVxcclxcbiAgICAgICAgfVxcclxcbiAgICB9KSk7XFxyXFxuXFxyXFxuICAgIHJldHVybiBwYWdlID4gMSA/IGkgOiBhLmNvbmNhdChpKTtcXHJcXG59XFxyXFxuXFxyXFxuLy/niYfljZVcXHJcXG5mdW5jdGlvbiBwbGF5TGlzdChwYWdlLCBjb3VudCkge1xcclxcbiAgICBpZiAoIWdldE15VmFyKCdwbGF5bGlzdCcpKSBwdXRNeVZhcigncGxheWxpc3QnLCAne1xcXCJzdWJ0eXBlXFxcIjpcXFwiXFxcIixcXFwidHlwZVxcXCI6XFxcImFsbFxcXCJ9Jyk7XFxyXFxuICAgIGxldCBhID0gW107XFxyXFxuICAgIGxldCB0ZW1wID0gSlNPTi5wYXJzZShnZXRNeVZhcigncGxheWxpc3QnLCAne1xcXCJzdWJ0eXBlXFxcIjpcXFwiXFxcIixcXFwidHlwZVxcXCI6XFxcImFsbFxcXCJ9JykpO1xcclxcbiAgICBsZXQgY29sb3IgPSBnZXRDb25maWcoJ2Nob29zZUNvbG9yJyk7XFxyXFxuXFxyXFxuICAgIGxldCBpdGVtcyA9IHtcXHJcXG4gICAgICAgIHR5cGU6IHtcXHJcXG4gICAgICAgICAgICDlhajpg6g6IFxcXCJhbGxcXFwiLFxcclxcbiAgICAgICAgICAgIOixhueTo+eJh+WNlTogXFxcIm9mZmljaWFsXFxcIixcXHJcXG4gICAgICAgICAgICDnsr7pgIk6IFxcXCJzZWxlY3RlZFxcXCIsXFxyXFxuICAgICAgICAgICAg57uP5YW4OiBcXFwiY2xhc3NpY2FsXFxcIixcXHJcXG4gICAgICAgICAgICDojrflpZY6IFxcXCJwcml6ZVxcXCIsXFxyXFxuICAgICAgICAgICAg6auY5YiGOiBcXFwiaGlnaF9zY29yZVxcXCIsXFxyXFxuICAgICAgICAgICAg5qac5Y2VOiBcXFwibW92aWVfbGlzdFxcXCIsXFxyXFxuICAgICAgICAgICAg5Ya36Zeo5L2z54mHOiBcXFwiZGFya19ob3JzZVxcXCIsXFxyXFxuICAgICAgICAgICAg5Li76aKYOiBcXFwidG9waWNcXFwiLFxcclxcbiAgICAgICAgICAgIOWvvOa8lDogXFxcImRpcmVjdG9yXFxcIixcXHJcXG4gICAgICAgICAgICDmvJTlkZg6IFxcXCJhY3RvclxcXCIsXFxyXFxuICAgICAgICAgICAg57O75YiXOiBcXFwic2VyaWVzXFxcIixcXHJcXG4gICAgICAgICAgICDljY7or606IFxcXCJjaGluZXNlXFxcIixcXHJcXG4gICAgICAgICAgICDmrKfnvo46IFxcXCJ3ZXN0ZXJuXFxcIixcXHJcXG4gICAgICAgICAgICDml6XmnKw6IFxcXCJqYXBhbmVzZVxcXCIsXFxyXFxuICAgICAgICAgICAg6Z+p5Zu9OiBcXFwia29yZWFcXFwiLFxcclxcbiAgICAgICAgICAgIOWWnOWJpzogXFxcImNvbWVkeVxcXCIsXFxyXFxuICAgICAgICAgICAg5Yqo5L2cOiBcXFwiYWN0aW9uXFxcIixcXHJcXG4gICAgICAgICAgICDniLHmg4U6IFxcXCJsb3ZlXFxcIixcXHJcXG4gICAgICAgICAgICDnp5Hlubs6IFxcXCJzY2llbmNlX2ZpY3Rpb25cXFwiLFxcclxcbiAgICAgICAgICAgIOWKqOeUuzogXFxcImNhcnRvb25cXFwiLFxcclxcbiAgICAgICAgICAgIOaCrOeWkTogXFxcIm15c3RlcnlcXFwiLFxcclxcbiAgICAgICAgICAgIOaDiuaCmjogXFxcInBhbmljXFxcIixcXHJcXG4gICAgICAgICAgICDmgZDmgJY6IFxcXCJob3JyaWJsZVxcXCIsXFxyXFxuICAgICAgICAgICAg54qv572qOiBcXFwiY3JpbWluYWxcXFwiLFxcclxcbiAgICAgICAgICAgIOWQjOaApzogXFxcImxnYnRcXFwiLFxcclxcbiAgICAgICAgICAgIOaImOS6iTogXFxcIndhclxcXCIsXFxyXFxuICAgICAgICAgICAg5aWH5bm7OiBcXFwiZmFudGFzeVxcXCIsXFxyXFxuICAgICAgICAgICAgXFxcIlxcXFx1NjBjNVxcXFx1ODI3MlxcXCI6IFxcXCJlcm90aWNhXFxcIixcXHJcXG4gICAgICAgICAgICDpn7PkuZA6IFxcXCJtdXNpY1xcXCIsXFxyXFxuICAgICAgICAgICAg57qq5b2V54mHOiBcXFwiZG9jdW1lbnRhcnlcXFwiLFxcclxcbiAgICAgICAgICAgIOayu+aEiDogXFxcImN1cmVcXFwiLFxcclxcbiAgICAgICAgICAgIOiJuuacrzogXFxcImFydFxcXCIsXFxyXFxuICAgICAgICAgICAg6buR6Imy5bm96buYOiBcXFwiZGFya19odW1vclxcXCIsXFxyXFxuICAgICAgICAgICAg6Z2S5pilOiBcXFwieW91dGhcXFwiLFxcclxcbiAgICAgICAgICAgIOWls+aApzogXFxcImZlbWFsZVxcXCIsXFxyXFxuICAgICAgICAgICAg55yf5a6e5LqL5Lu25pS557yWOiBcXFwicmVhbF9ldmVudFxcXCIsXFxyXFxuICAgICAgICAgICAg5pq05YqbOiBcXFwidmlvbGVuY2VcXFwiLFxcclxcbiAgICAgICAgICAgIOm7keeZvTogXFxcImJsYWNrX3doaXRlXFxcIixcXHJcXG4gICAgICAgICAgICDnvo7po586IFxcXCJmb29kXFxcIixcXHJcXG4gICAgICAgICAgICDml4XooYw6IFxcXCJ0cmF2ZWxcXFwiLFxcclxcbiAgICAgICAgICAgIOWEv+erpTogXFxcImNoaWxkXFxcIixcXHJcXG4gICAgICAgICAgICDkurrmgKc6IFxcXCJodW1hbml0eVxcXCIsXFxyXFxuICAgICAgICAgICAg5a625bqtOiBcXFwiZmFtaWx5XFxcIixcXHJcXG4gICAgICAgICAgICDmlofoibo6IFxcXCJsaXRlcmFyeV9hcnRcXFwiLFxcclxcbiAgICAgICAgICAgIOWwj+ivtOaUuee8ljogXFxcIm5vdmVsXFxcIixcXHJcXG4gICAgICAgICAgICDmhJ/kuro6IFxcXCJtb3ZpbmdcXFwiLFxcclxcbiAgICAgICAgICAgIOWKseW/lzogXFxcImluc3BpcmF0aW9uXFxcIlxcclxcbiAgICAgICAgfSxcXHJcXG4gICAgICAgIHN1YnR5cGU6IHtcXHJcXG4gICAgICAgICAgICDlhajpg6g6IFxcXCJcXFwiLFxcclxcbiAgICAgICAgICAgIOeUteW9sTogXFxcIm1vdmllXFxcIixcXHJcXG4gICAgICAgICAgICDnlLXop4bliac6IFxcXCJ0dlxcXCJcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfVxcclxcbiAgICBmb3IgKGxldCBpIGluIGl0ZW1zKSB7XFxyXFxuICAgICAgICBmb3IgKGxldCBqIGluIGl0ZW1zW2ldKSB7XFxyXFxuICAgICAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRlbXBbaV0gPT09IGl0ZW1zW2ldW2pdID8gJ+KAnOKAnOKAneKAnTxiPiA8Zm9udCBjb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xcbiAgICBpZiAodGVtcC5saXN0ID09ICd5ZWFyX3JhbmtzJykge1xcclxcbiAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIlxcclxcbiAgICAgICAgfSlcXHJcXG4gICAgICAgIGlmICghdGVtcC55ZWFyKSB0ZW1wLnllYXIgPSB0ZW1wLnllYXJfbGlzdHNbMF0ua2V5O1xcclxcbiAgICAgICAgZm9yIChsZXQgdCBvZiB0ZW1wLnllYXJfbGlzdHMpIHtcXHJcXG4gICAgICAgICAgICBhLnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICB0aXRsZTogdGVtcC55ZWFyID09IHQua2V5ID8gJ+KAnOKAnOKAneKAnTxiPiA8Zm9udCBjb2xvcj0nICsgY29sb3IgKyAnPicgKyB0LnRpdGxlICsgJyA8L2ZvbnQ+PC9iPicgOiB0LnRpdGxlLFxcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcclxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChlKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ3JhbmtMaXN0JykpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgdGVtcC55ZWFyID0gZTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJyYW5rTGlzdFxcXCIsIEpTT04uc3RyaW5naWZ5KHRlbXApKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxyXFxuICAgICAgICAgICAgICAgIH0sIHQua2V5KVxcclxcbiAgICAgICAgICAgIH0pXFxyXFxuICAg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ICAgICAgICB9LCBlLnR5cGUsIGUuaWQpLFxcclxcbiAgICAgICAgICAgIGltZzogZS5jb3Zlcl91cmwgKyBcXFwiQFJlZmVyZXI9XFxcIiArIGUuY292ZXJfdXJsLFxcclxcbiAgICAgICAgICAgIGRlc2M6IFxcXCLlhbFcXFwiICsgZS50b3RhbCArIFxcXCLpg6hcXFwiXFxyXFxuICAgICAgICB9KSkpO1xcclxcbiAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgaSA9IGwubWFwKChlID0+ICh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6ICcnIC8qJ+KAnOKAnOKAneKAnScgKyBlLm1lZGl1bV9uYW1lICsgJ1xcXFxuJyArIGdldFN0cm9uZ1RleHQoZS50aXRsZSkqLyAsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdjYXJkX3BpY18yJyxcXHJcXG4gICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOi8vZW1wdHkvJHBhZ2V7ZnlwYWdlfSNub0hpc3RvcnkjJykucnVsZSgodHlwZSwgaWQsIHN0aXRsZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoc3RpdGxlKTtcXHJcXG4gICAgICAgICAgICAgICAgZXZhbChKU09OLnBhcnNlKHJlcXVlc3QoJ2hpa2VyOi8vcGFnZS9tYWluJykpLnJ1bGUpO1xcclxcbiAgICAgICAgICAgICAgICBpZiAodHlwZSA9PT0gXFxcInBsYXlsaXN0XFxcIikge1xcclxcbiAgICAgICAgICAgICAgICAgICAgZG91TGlzdChpZCwgTVlfUEFHRSwgNTApO1xcclxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICAgICAgc3ViamVjdENvbGxlY3Rpb25MaXN0KE1ZX1BBR0UsIDUwLCBpZCk7XFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICB9LCBlLnR5cGUsIGUuaWQsIGUudGl0bGUpLFxcclxcbi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ZyMnKS5sYXp5UnVsZSgoZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ2NvbWluZycpKTtcXHJcXG4gICAgICAgICAgICAgICAgdGVtcC5yYW5rID0gZTtcXHJcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImNvbWluZ1xcXCIsIEpTT04uc3RyaW5naWZ5KHRlbXApKTtcXHJcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgIH0sIHJhbmtbaV0pXFxyXFxuICAgICAgICB9KVxcclxcbiAgICB9XFxyXFxuICAgIGxldCBsb2NhbCA9IHtcXHJcXG4gICAgICAgIOWbveWGhTogJ2RvbWVzdGljJyxcXHJcXG4gICAgICAgIOWFqOeQgzogJ2ludGVybmF0aW9uYWwnXFxyXFxuICAgIH1cXHJcXG4gICAgaWYgKHRlbXAudHlwZSA9PSAnbW92aWUnKSB7XFxyXFxuICAgICAgICBhLnB1c2goe1xcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiXFxyXFxuICAgICAgICB9KVxcclxcbiAgICAgICAgZm9yIChsZXQgaSBpbiBsb2NhbCkge1xcclxcbiAgICAgICAgICAgIGEucHVzaCh7XFxyXFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0ZW1wLmxvY2FsID09PSBsb2NhbFtpXSA/ICfigJzigJzigJ3igJ08Yj4gPGZvbnQgY29sb3I9JyArIGNvbG9yICsgJz4nICsgaSArICcgPC9mb250PjwvYj4nIDogaSxcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXHJcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCdoaWtlcjovL2VtcHR5I25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRlbXAgPSBKU09OLnBhcnNlKGdldE15VmFyKCdjb21pbmcnKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICB0ZW1wLmxvY2FsID0gZTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJjb21pbmdcXFwiLCBKU09OLnN0cmluZ2lmeSh0ZW1wKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgICAgICB9LCBsb2NhbFtpXSlcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgfVxcclxcbiAgICB9XFxyXFxuICAgIGxldCBhcmVhID0ge1xcclxcbiAgICAgICAg5YWo6YOoOiAnJyxcXHJcXG4gICAgICAgIOe+juWbvTogJyZhcmVhX2ZpbHRlcj1hbWVyaWNhbicsXFxyXFxuICAgICAgICDmrKfmtLI6ICcmYXJlYV9maWx0ZXI9ZXVyb3BlJyxcXHJcXG4gICAgICAgIOaXpeacrDogJyZhcmVhX2ZpbHRlcj1qYXBhbmVzZScsXFxyXFxuICAgICAgICDpn6nlm706ICcmYXJlYV9maWx0ZXI9a29yZWFuJ1xcclxcbiAgICB9XFxyXFxuICAgIGlmICh0ZW1wLnR5cGUgPT0gJ21vdmllJyAmJiB0ZW1wLmxvY2FsID09ICdpbnRlcm5hdGlvbmFsJykge1xcclxcbiAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIlxcclxcbiAgICAgICAgfSlcXHJcXG4gICAgICAgIGZvciAobGV0IGkgaW4gYXJlYSkge1xcclxcbiAgICAgICAgICAgIGEucHVzaCh7XFxyXFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0ZW1wLmFyZWEgPT09IGFyZWFbaV0gPyAn4oCc4oCc4oCd4oCdPGI+IDxmb250IGNvbG9yPScgKyBjb2xvciArICc+JyArIGkgKyAnIDwvZm9udD48L2I+JyA6IGksXFxyXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxyXFxuICAgICAgICAgICAgICAgIHVybDogJCgnaGlrZXI6Ly9lbXB0eSNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGUpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0ZW1wID0gSlNPTi5wYXJzZShnZXRNeVZhcignY29taW5nJykpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgdGVtcC5hcmVhID0gZTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJjb21pbmdcXFwiLCBKU09OLnN0cmluZ2lmeSh0ZW1wKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgICAgICB9LCBhcmVhW2ldKVxcclxcbiAgICAgICAgICAgIH0pXFxyXFxuICAgICAgICB9XFxyXFxuICAgIH1cXHJcXG4gICAgbGV0IGZpbHRlciA9IHtcXHJcXG4gICAgICAgIOWFqOmDqDogJycsXFxyXFxuICAgICAgICDlm73kuqfliac6ICcmdHlwZV9maWx0ZXI9dHZfZG9tZXN0aWMnLFxcclxcbiAgICAgICAg5qyn576O5YmnOiAnJnR5cGVfZmlsdGVyPXR2X2FtZXJpY2FuJyxcXHJcXG4gICAgICAgIOaXpeWJpzogJyZ0eXBlX2ZpbHRlcj10dl9qYXBhbmVzZScsXFxyXFxuICAgICAgICDpn6nliac6ICcmdHlwZV9maWx0ZXI9dHZfa29yZWFuJyxcXHJcXG4gICAgICAgIOWKqOeUuzogJyZ0eXBlX2ZpbHRlcj10dl9hbmltYXRpb24nLFxcclxcbiAgICAgICAg5Zu95YaF57u86Im6OiAnJnR5cGVfZmlsdGVyPXNob3dfZG9tZXN0aWMnLFxcclxcbiAgICAgICAg5Zu95aSW57u86Im6OiAnJnR5cGVfZmlsdGVyPXNob3dfZm9yZWlnbidcXHJcXG4gICAgfVxcclxcbiAgICBpZiAodGVtcC50eXBlID09ICd0dicpIHtcXHJcXG4gICAgICAgIGEucHVzaCh7XFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCJcXHJcXG4gICAgICAgIH0pXFxyXFxuICAgICAgICBmb3IgKGxldCBpIGluIGZpbHRlcikge1xcclxcbiAgICAgICAgICAgIGEucHVzaCh7XFxyXFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0ZW1wLmZpbHRlciA9PT0gZmlsdGVyW2ldID8gJ+KAnOKAnOKAneKAnTxiPiA8Zm9udCBjb2xvcj0nICsgY29sb3IgKyAnPicgKyBpICsgJyA8L2ZvbnQ+PC9iPicgOiBpLFxcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcclxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJ2hpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChlKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdGVtcCA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ2NvbWluZycpKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHRlbXAuZmlsdGVyID0gZTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJjb21pbmdcXFwiLCBKU09OLnN0cmluZ2lmeSh0ZW1wKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgICAgICB9LCBmaWx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x5JyxcXHJcXG4gICAgICAgICAgICDlhajnkIPlj6PnopHliafpm4Y6ICd0dl9nbG9iYWxfYmVzdF93ZWVrbHknXFxyXFxuICAgICAgICB9LFxcclxcbiAgICAgICAg57u86Im6OiB7XFxyXFxuICAgICAgICAgICAg5Zu95YaF5Y+j56KR57u86Im6OiAnc2hvd19jaGluZXNlX2Jlc3Rfd2Vla2x5JyxcXHJcXG4gICAgICAgICAgICDlm73lpJblj6PnopHnu7zoibo6ICdzaG93X2dsb2JhbF9iZXN0X3dlZWtseSdcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfVxcclxcbiAgICBmb3IgKGxldCBpIGluIGl0ZW1zKSB7XFxyXFxuICAgICAgICBmb3IgKGxldCBqIGluIGl0ZW1zW2ldKSB7XFxyXFxuICAgICAgICAgICAgYS5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRlbXAuaXRlbSA9PSBpdGVtc1tpXVtqXSA/ICfigJzigJzigJ3igJ08Yj4gPGZvbnQgY29sb3I9JyArIGNvbG9yICsgJz4nICsgaiArICcgPC9mb250PjwvYj4nIDogaixcXHJcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXHJcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCdoaWtlcjovL2VtcHR5I25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRlbXAgPSBKU09OLnBhcnNlKGdldE15VmFyKCdyYW5raW5nJykpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgdGVtcC5pdGVtID0gZTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJyYW5raW5nXFxcIiwgSlNPTi5zdHJpbmdpZnkodGVtcCkpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXHJcXG4gICAgICAgICAgICAgICAgfSwgaXRlbXNbaV1bal0pXFxyXFxuICAgICAgICAgICAgfSlcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgICAgIGEucHVzaCh7XFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCJcXHJcXG4gICAgICAgIH0pXFxyXFxuICAgIH1cXHJcXG5cXHJcXG4gICAgYS5wdXNoKHtcXHJcXG4gICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxyXFxuICAgIH0pXFxyXFxuXFxyXFxuICAgIGxldCBpID0gW107XFxyXFxuICAgIGxldCBwbGF5YWJsZSA9IHtcXHJcXG4gICAgICAgIOWFqOmDqOW9seeJhzogJzAnLFxcclxcbiAgICAgICAg5LuF5pyJ54mH5rqQOiAnMSdcXHJcXG4gICAgfVxcclxcbiAgICBmb3IgKGxldCByIGluIHBsYXlhYmxlKSB7XFxyXFxuICAgICAgICBpLnB1c2goe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiB0ZW1wLnBsYXlhYmxlID09IHBsYXlhYmxlW3JdID8gJ+KAnOKAnOKAneKAnTxiPiA8Zm9udCBjb2xvcj0nICsgY29sb3IgKyAnPicgKyByICsgJyA8L2ZvbnQ+PC9iPicgOiByLFxcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxyXFxuICAgICAgICAgICAgdXJsOiAkKCdoaWtlcjogLy9lbXB0eSNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGUpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgbGV0IHRlbXAgPSBKU09OLnBhcnNlKGdldE15VmFyKCdyYW5raW5nJykpO1xcclxcbiAgICAgICAgICAgICAgICB0ZW1wLnBsYXlhYmxlID0gZTtcXHJcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcInJhbmtpbmdcXFwiLCBKU09OLnN0cmluZ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GF5YWJsZSkge1xcclxcbiAgICAgICAgaS5wdXNoKHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogdGVtcC5wbGF5YWJsZSA9PSBwbGF5YWJsZVtyXSA/ICfigJzigJzigJ3igJ08Yj4gPGZvbnQgY29sb3I9JyArIGNvbG9yICsgJz4nICsgciArICcgPC9mb250PjwvYj4nIDogcixcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcclxcbiAgICAgICAgICAgIHVybDogJCgnaGlrZXI6IC8vZW1wdHkjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChlKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIGxldCB0ZW1wID0gSlNPTi5wYXJzZShnZXRNeVZhcignZG91TGlzdCcpKTtcXHJcXG4gICAgICAgICAgICAgICAgdGVtcC5wbGF5YWJsZSA9IGU7XFxyXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJkb3VMaXN0XFxcIiwgSlNPTi5zdHJpbmdpZnkodGVtcCkpO1xcclxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcclxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxyXFxuICAgICAgICAgICAgfSwgcGxheWFibGVbcl0pXFxyXFxuICAgICAgICB9KVxcclxcbiAgICB9XFxyXFxuXFxyXFxuICAgIGkucHVzaCh7XFxyXFxuICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxiPiA8Zm9udCBjb2xvcj0nICsgY29sb3IgKyAnPuivhOWIhuWMuumXtDonICsgdGVtcC5zY29yZSArICcgPC9mb250PjwvYj4nLFxcclxcbiAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXHJcXG4gICAgICAgIHVybDogJCh0ZW1wLnNjb3JlLCAn6K+E5YiG5bqU5ZyoMC0xMOS5i+mXtCcpLmlucHV0KCgpID0+IHtcXHJcXG4gICAgICAgICAgICBsZ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clxcbiAgICAgICAgICAgIH0sIHR5cGUsIGlkLCB0aXRsZSwgdXNlQ29uZmlnKTtcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgICAgIHJldHVybiB7XFxyXFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcclxcbiAgICAgICAgICAgIHVybDogdXJsUGFyYW1zLnVybCxcXHJcXG4gICAgICAgICAgICBleHRyYTogdXJsUGFyYW1zLmV4dHJhLFxcclxcbiAgICAgICAgICAgIGltZzogZS5jb250ZW50LnN1YmplY3QucGljLm5vcm1hbCArIFxcXCJAUmVmZXJlcj1cXFwiICsgZS5jb250ZW50LnN1YmplY3QucGljLm5vcm1hbCxcXHJcXG4gICAgICAgICAgICBkZXNjOiBlLmNvbnRlbnQuc3ViamVjdC5jYXJkX3N1YnRpdGxlLnNwbGl0KFxcXCIvXFxcIikuZmlsdGVyKCgoZSwgdCkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICBpZiAodCA8IDMpIHJldHVybiBlXFxyXFxuICAgICAgICAgICAgfSkpLmpvaW4oXFxcIixcXFwiKSArIFxcXCJcXFxcblxcXCIgKyAoZS5jb250ZW50LnN1YmplY3QucmF0aW5nID8gY29tcHV0ZVJhdGluZyhlLmNvbnRlbnQuc3ViamVjdC5yYXRpbmcubWF4LCBlLmNvbnRlbnQuc3ViamVjdC5yYXRpbmcudmFsdWUpICsgXFxcIiBcXFwiICsgZS5jb250ZW50LnN1YmplY3QucmF0aW5nLnZhbHVlLnRvRml4ZWQoMSkgKyBcXFwi5YiGXFxcIiA6IFxcXCLmmoLml6Dor4TliIZcXFwiKVxcclxcbiAgICAgICAgfVxcclxcbiAgICB9KSk7XFxyXFxuXFxyXFxuICAgIHNldEhvbWVSZXN1bHQoe1xcclxcbiAgICAgICAgZGF0YTogcGFnZSA+IDEgPyByIDogaS5jb25jYXQocilcXHJcXG4gICAgfSlcXHJcXG59XFxyXFxuXFxyXFxuXFxyXFxuXFxyXFxuLy/op4bpopHmqKHlnZdcX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B7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSByZXMudGl0bGUsXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGljID0gcmVzLnBpYy5ub3JtYWwgKyBcXFwiQFJlZmVyZXI9XFxcIiArIHJlcy5waWMubm9ybWFsO1xcclxcbiAgICAgICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKGUudGl0bGUgKyAnLScgKyB0aXRsZSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICB0cnkge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNldFBhZ2VQaWNVcmwocGljKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxyXFxuICAgICAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UocmVxdWVzdCgnaGlrZXI6Ly9wYWdlL21haW4nKSkucnVsZSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdXJscyA9IGdldFR2VXJscyhpZCwgZS5pZCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsYXp5ID0gJChcXFwiXFxcIikubGF6eVJ1bGUobGF6eSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJlc3VsdFVybCA9IFxcXCJ0b2FzdDovL+ino+aekOWksei0pVxcXCI7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxhenkuc3RhcnRzV2l0aChcXFwiKFxcXCIpKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdyZXN1bHRVcmwgPSAnICsgbGF6eSlcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ3Jlc3VsdFVybCA9ICcgKyAnKCgpID0+IHsnICsgbGF6eSArICd9KSgpJylcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9nKGUubWVzc2FnZSlcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdFVybFxcclxcbiAgICAgICAgICAgICAgICAgICAgfSwgbGF6eSlcXHJcXG4gICAgICAgICAgICAgICAgICAgIGxldCBkID0gW107XFxyXFxuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mKHVybHMpID09IFxcXCJvYmplY3RcXFwiKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGQgPSBbXTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHVybHMubGVuZ3RoOyBpKyspIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn56ysJyArIChpICsgMSkgKyAn6ZuGJyxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF80JyxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbGF6eSA/IHVybHNbaV0gKyBsYXp5IDogdXJsc1tpXSxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiBleHRyYVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoZCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZih1cmxzKSA9PSBcXFwic3RyaW5nXFxcIiAmJiB1cmxzID09ICfooqvlsIFpcCcpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IEpTT04ucGFyc2UocmVxdWVzdChcXFwiaGlrZXI6Ly9wYWdlL3JlbGVhc2VJUD9ydWxlPemdkuixhlxcXCIpKVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAucnVsZTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKHJ1bGUpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YodXJscykgPT0gJ3N0cmluZycgJiYgdXJscyA9PSAn5rKh5pyJ5pS25b2VJykge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkID0gW107XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfosYbnk6PmsqHmnInmlLblvZXmraTop4bpopHmupDnmoTor6bnu4bkv6Hmga8nLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiAn54K55oiR5Y+v5Lul5Y676KeG6aKR5rqQ572R56uZ55yL55yLJyxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBlLnVybFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KGQpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICB9LCByZXMsIGlkLCBlLCBsYXp5LCBleHRyYSlcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgfSBlbHNlIGlmICh0eXBlID09PSAnbW92aWUnKSB7XFxyXFxuICAgICAgICAgICAgbGV0IG1MYXp5ID0gJChcXFwiXFxcIikubGF6eVJ1bGUobGF6eSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIGxldCByZXN1bHRVcmwgPSBcXFwidG9hc3Q6Ly/op6PmnpDlpLHotKVcXFwiO1xcclxcbiAgICAgICAgICAgICAgICB0cnkge1xcclxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGxhenkuc3RhcnRzV2l0aChcXFwiKFxcXCIpKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgncmVzdWx0VXJsID0gJyArIGxhenkpXFxyXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ3Jlc3VsdFVybCA9ICcgKyAnKCgpID0+IHsnICsgbGF6eSArICd9KSgpJylcXHJcXG4gICAgICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcclxcbiAgICAgICAgICAgICAgICAgICAgbG9nKGUubWVzc2FnZSlcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0VXJsXFxyXFxuICAgICAgICAgICAgfSwgbGF6eSlcXHJcXG4gICAgICAgICAgICBkLnB1c2goe1xcclxcbiAgICAgICAgICAgICAgICB0aXRsZTogZS50aXRsZSArIChlLmVwaXNvZGVzX2luZm8gPyBcXFwi4oCiXFxcIiArIGUuZXBpc29kZXNfaW5mbyA6IFxcXCJcXFwiKSxcXHJcXG4gICAgICAgICAgICAgICAgaW1nOiBlLmljb24sXFxyXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBjb2xbMV0gfHwgXFxcImljb25fc21hbGxfNFxcXCIsXFxyXFxuICAgICAgICAgICAgICAgIHVybDogbUxhenkgPyBlLnVybCArIG1MYXp5IDogZS51cmwsXFxyXFxuICAgICAgICAgICAgICAgIGV4dHJhOiBleHRyYVxcclxc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XE6IDEsXFxyXFxuICAgICAgICAgICAgeW91a3U6IDMsXFxyXFxuICAgICAgICAgICAgbGV0djogNixcXHJcXG4gICAgICAgICAgICBtZ3R2OiA3LFxcclxcbiAgICAgICAgICAgIGJpbGliaWxpOiA4LFxcclxcbiAgICAgICAgICAgIGlxaXlpOiA5LFxcclxcbiAgICAgICAgICAgIGNudHY6IDEyLFxcclxcbiAgICAgICAgICAgIGNjdHY2OiAxMyxcXHJcXG4gICAgICAgICAgICBtaWd1dmlkZW86IDE1LFxcclxcbiAgICAgICAgICAgIHhpZ3VhOiAxNyxcXHJcXG4gICAgICAgICAgICBhY2Z1bjogMTgsXFxyXFxuICAgICAgICAgICAgbWFpZHVpZHVpOiAxOVxcclxcbiAgICAgICAgfTtcXHJcXG4gICAgICAgIGxldCBudW0gPSBzW3VpZF07XFxyXFxuXFxyXFxuICAgICAgICB2YXIgc291cmNlcyA9IHt9O1xcclxcbiAgICAgICAgbGV0IHNsID0gaHRtbC5tYXRjaCgvc291cmNlc1xcXFxbWzEtOV17MSwyfVxcXFxdW1xcXFxzXFxcXFNdKj9cXFxcXS9nKTtcXHJcXG4gICAgICAgIGlmIChzbCkge1xcclxcbiAgICAgICAgICAgIGZvciAodmFyIGkgaW4gc2wpIHtcXHJcXG4gICAgICAgICAgICAgICAgZXZhbChzbFtpXSk7XFxyXFxuICAgICAgICAgICAgfVxcclxcbiAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICBsZXQgc2NyaXB0X2xpc3QgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICdib2R5JiZzY3JpcHRbc3JjXScpO1xcclxcbiAgICAgICAgICAgIGxldCBzb3VyY2VzX3VybCA9IFxcXCJcXFwiO1xcclxcbiAgICAgICAgICAgIGZvciAobGV0IGkgaW4gc2NyaXB0X2xpc3QpIHtcXHJcXG4gICAgICAgICAgICAgICAgbGV0IHVybCA9IHBhcnNlRG9tRm9ySHRtbChzY3JpcHRfbGlzdFtpXSwgJ3NjcmlwdCYmc3JjJyk7XFxyXFxuICAgICAgICAgICAgICAgIGlmICh1cmwuaW5kZXhPZignbWl4ZWRfc3RhdGljJykgIT09IC0xKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBzb3VyY2VzX3VybCA9IHVybDtcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICBsZXQgc291cmNlc19saXN0ID0gcmVxdWVzdChzb3VyY2VzX3VybCkubWF0Y2goL3NvdXJjZXNcXFxcW1sxLTldezEsMn1cXFxcXVtcXFxcc1xcXFxTXSo/XFxcXF0vZyk7XFxyXFxuICAgICAgICAgICAgZm9yICh2YXIgaSBpbiBzb3VyY2VzX2xpc3QpIHtcXHJcXG4gICAgICAgICAgICAgICAgZXZhbChzb3VyY2VzX2xpc3RbaV0pO1xcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgIH1cXHJcXG5cXHJcXG4gICAgICAgIGxldCByZW4gPSBzb3VyY2VzW251bV07XFxyXFxuICAgICAgICBpZiAocmVuICYmIHJlbi5sZW5ndGggPiAwKSB7XFxyXFxuICAgICAgICAgICAgLyp2YXIgciA9IHJlbi5tYXAoZSA9PiB1bmVzY2FwZShlLnBsYXlfbGluay5yZXBsYWNlKC8oaHR0cHN8aHR0cCk6XFxcXC9cXFxcL3d3dy5kb3ViYW4uY29tXFxcXC9saW5rMlxcXFwvXFxcXD91cmw9LywgJycpXFxyXFxuICAgICAgICAgICAgICAgIC5zcGxpdCgnOycpWzBdLnNwbGl0KCcuaHRtbCcpWzBdICsgJy5odG1sJykpKi9cXHJcXG4gICAgICAgICAgICB2YXIgciA9IHJlbi5tYXAoZSA9PiB1bmVzY2FwZShlLnBsYXlfbGluay5zcGxpdCgnP3VybD0nKVsxXS5zcGxpdCgnJicpWzBdKSlcXHJcXG5cXHJcXG4gICAgICAgIH1cXHJcXG4gICAgICAgIHJldHVybiByIHx8ICfmsqHmnInmlLblvZUnO1xcclxcbi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ICAgICAgICAgICAgICBpZiAoY29uZmlnLmRldGFpbHNWaWV3Q29uZmlncy51c2UgPT09IGNvbmZpZ0tleSkge1xcbiAgICAgICAgICAgICAgICAgICAgLy9wdXRNeVZhcihcXFwiaW5wdXRfY29uZmlnX3R5cGVcXFwiLCAn5b2x54mH6K+m5oOF6aG16Z2i6YWN572uJylcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJpbnB1dF9uYW1lXFxcIiwgY29uZmlnS2V5KTtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJpbnB1dF9jb2RlXFxcIiwgY29uZmlnLmRldGFpbHNWaWV3Q29uZmlnc1tjb25maWdLZXldLmNvbmZpZyk7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaW5wdXRfc2V0dGluZ19jb2RlXFxcIiwgY29uZmlnLmRldGFpbHNWaWV3Q29uZmlnc1tjb25maWdLZXldLnNldHRpbmcgfHwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL3BhZ2Uvc2V0dGluZy1lZGl0b3I/cnVsZT3pnZLosYYmdmlldz1kZXRhaWxWaWV3TW9kZUVkaXRQYWdlJztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBjb25maWcuZGV0YWlsc1ZpZXdDb25maWdzLnVzZSA9IGNvbmZpZ0tleVxcbiAgICAgICAgICAgICAgICB3cml0ZUZpbGUoZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSwgSlNPTi5zdHJpbmdpZnkoY29uZmlnKSlcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5oiQ5YqfJ1xcbiAgICAgICAgICAgIH0sIGNvbmZpZ0tleSksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdmbGV4X2J1dHRvbidcXG4gICAg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tleSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIGNvbmZpZy5kZXRhaWxzVmlld0NvbmZpZ3NbY29uZmlnS2V5XVxcbiAgICAgICAgICAgICAgICAgICAgd3JpdGVGaWxlKGdldE15VmFyKCdxZGJfY29uZmlnJyksIEpTT04uc3RyaW5naWZ5KGNvbmZpZykpXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5Yig6ZmkJyArIGNvbmZpZ0tleSArICfmiJDlip8nXFxuICAgICAgICAgICAgICAgIH0sIGNvbmZpZywgaW5wdXQpXFxuICAgICAgICAgICAgfSlcXG4gICAgfSlcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAn8J+TnScsXFxuICAgICAgICBjb2xfdHlwZTogJ2ZsZXhfYnV0dG9uJyxcXG4gICAgICAgIHVybDogJChPYmplY3Qua2V5cyhkZXRhaWxzVmlld0NvbmZpZ3MpLmZpbHRlcihjb25maWdLZXkgPT4gY29uZmlnS2V5ICE9PSAndXNlJyksIDIpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgLy8gaWYgKGlucHV0ID09PSAn6buY6K6kJykgcmV0dXJuICd0b2FzdDovL+m7mOiupOmFjee9ruaXoOazlee8lui+ke+8gSdcXG4gICAgICAgICAgICBsZXQgY29uZmlnID0gSlNPTi5wYXJzZShyZXF1ZXN0KGdldE15VmFyKCdxZGJfY29uZmlnJykpKVxcbiAgICAgICAgICAgIHB1dE15VmFyKFxcXCJpbnB1dF9uYW1lXFxcIiwgY29uZmlnS2V5KTtcXG4gICAgICAgICAgICBwdXRNeVZhcihcXFwiaW5wdXRfY29kZVxcXCIsIGNvbmZpZy5kZXRhaWxzVmlld0NvbmZpZ3NbY29uZmlnS2V5XS5jb25maWcpO1xcbiAgICAgICAgICAgIHB1dE15VmFyKFxcXCJpbnB1dF9zZXR0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ICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBldmFsKCdyZXN1bHQgPSAnICsgJygoKSA9PiB7JyArIGRldGFpbFZpZXdTZXR0aW5nICsgJ30pKCknKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coZS5tZXNzYWdlKTtcXG4gICAgICAgICAgICByZXN1bHQgPSBcXFwidG9hc3Q6Ly/plJnor6/nmoTorr7nva7pobXpnaLku6PnoIEs6K+35YmN5b6AIOaXpeW/lyDmn6XnnIvplJnor6/ljp/lm6BcXFwiXFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAn4pqZ77iPJyxcXG4gICAgICAgIGNvbF90eXBlOiAnZmxleF9idXR0b24nLFxcbiAgICAgICAgdXJsOiByZXN1bHRcXG4gICAgfSlcXG59XFxuXFxuLy8g6aaW6aG16K6+572u5qih5Z2XXFxuZnVuY3Rpb24gaG9tZVBhZ2VTZXR0aW5nTW9kdWxlKGQpIHtcXG4gICAgbGV0IGhvbWVQYWdlQ29uZmlncyA9IGdldENvbmZpZygnaG9tZVBhZ2VDb25maWdzJyk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ+iHquWumuS5iemmlumhtScuYm9sZCgpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJyaWNoX3RleHRcXFwiXFxuICAgIH0pXFxuICAgIGZvciAobGV0IGNvbmZpZ0tleSBvZiBPYmplY3Qua2V5cyhob21lUGFnZUNvbmZpZ3MpKSB7XFxuICAgICAgICBpZiAoY29uZmlnS2V5ID09PSAndXNlJykgY29udGludWU7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBjb25maWdLZXkgPT09IGhvbWVQYWdlQ29uZmlncy51c2UgPyBcXFwi4oCc4oCcXFxcIiArIGNvbmZpZ0tleSArIFxcXCLigJ3igJ1cXFwiIDogY29uZmlnS2V5LFxcbiAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eSNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoY29uZmlnS2V5ID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGNvbmZpZyA9IEpTT04ucGFyc2UocmVxdWVzdChnZXRNeVZhcigncWRiX2NvbmZpZycpKSlcXG4gICAgICAgICAgICAgICAgaWYgKGNvbmZpZy5ob21lUGFnZUNvbmZpZ3MudXNlID09PSBjb25maWdLZXkpIHtcXG4gICAgICAgICAgICAgICAgICAgIC8vcHV0TXlWYXIoXFxcImlucHV0X2NvbmZpZ190eXBlXFxcIiwgJ+mmlumhtemFjee9ricpXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaW5wdXRfbmFtZVxcXCIsIGNvbmZpZ0tleSk7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaW5wdXRfY29kZVxcXCIsIGNvbmZpZy5ob21lUGFnZUNvbmZpZ3NbY29uZmlnS2V5XS5jb25maWcpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL3BhZ2Uvc2V0dGluZy1lZGl0b3I/cnVsZT3pnZLosYYmdmlldz1ob21lUGFnZU1vZGVFZGl0UGFnZSc7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY29uZmlnLmhvbWVQYWdlQ29uZmlncy51c2UgPSBjb25maWdLZXlcXG4gICAgICAgICAgICAgICAgd3JpdGVGaWxlKGdldE15VmFyKCdxZGJfY29uZmlnJyksIEpTT04uc3RyaW5naWZ5KGNvbmZpZykpXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaIkOWKnydcXG4gICAgICAgICAgICB9LCBjb25maWdLZXkpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnZmxleF9idXR0b24nXFxuICAgICAgICB9KVxcbiAgICB9XFxuICAgIGQucHVzaCh7XFxuICAgICAgICBjb2xfdHlwZTogJ2JsYW5rX2Jsb2NrJ1xcbiAgICB9KVxcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfinpUnLFxcbiAgICAgICAgY29sX3R5cGU6ICdmbGV4X2J1dHRvbicsXFxuICAgICAgICB1cmw6ICdoaWtlcjovL3BhZ2Uvc2V0dGluZy1lZGl0b3I/dmlldz1ob21lUGFnZU1vZGVFZGl0UGFnZSdcXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ+KelicsXFxuICAgICAgICBjb2xfdHlwZTogJ2ZsZXhfYnV0dG9uJyxcXG4gICAgICAgIHVybDogJChPYmplY3Qua2V5cyhob21lUGFnZUNvbmZpZ3MpLmZpbHRlcihjb25maWdLZXkgPT4gY29uZmlnS2V5ICE9PSAndXNlJyAmJiBjb25maWdLZXkgIT09ICfpu5jorqQnKSwgMilcXG4gICAgICAgICAgICAuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09PSAn6buY6K6kJykgcmV0dXJuICd0b2FzdDovL+m7mOiupOmFjee9ruaXoOazleWIoOmZpO+8gSdcXG4gICAgICAgICAgICAgICAgbGV0IGNvbmZpZyA9IEpTT04ucGFyc2UocmVxdWVzdChnZXRNeVZhcigncWRiX2NvbmZpZycpKSlcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09PSBjb25maWcuaG9tZVBhZ2VDb25maWdzLnVzZSkgcmV0dXJuICd0b2FzdDovL+ivpemFjee9ruato+WcqOS9v+eUqO+8jOaXoOazleWIoOmZpO+8gSdcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoJ+ehruiupOWIoOmZpFxcXCInICsgaW5wdXQgKyAnXFxcIu+8nycpLmNvbmZpcm0oKGNvbmZpZywgY29uZmlnS2V5KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBkZWxldGUgY29uZmlnLmhvbWVQYWdlQ29uZmlnc1tjb25maWdLZXldXFxuICAgICAgICAgICAgICAgICAgICB3cml0ZUZpbGUoZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSwgSlNPTi5zdHJpbmdpZnkoY29uZmlnKSlcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/liKDpmaQnICsgY29uZmlnS2V5ICsgJ+aIkOWKnydcXG4gICAgICAgICAgICAgICAgfSwgY29uZmlnLCBpbnB1dClcXG4gICAgICAgICAgICB9KVxcbiAgICB9KVxcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfwn5OdJyxcXG4gICAgICAgIGNvbF90eXBlOiAnZmxleF9idXR0b24nLFxcbiAgICAgICAgdXJsOiAkKE9iamVjdC5rZXlzKGhvbWVQYWdlQ29uZmlncykuZmlsdGVyKGNvbmZpZ0tleSA9PiBjb25maWdLZXkgIT09ICd1c2UnKSwgMikuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgICAgICAvLyBpZiAoaW5wdXQgPT09ICfpu5jorqQnKSByZXR1cm4gJ3RvYXN0Oi8v6buY6K6k6YWN572u5peg5rOV57yW6L6R77yBJ1xcbiAgICAgICAgICAgIGxldCBjb25maWcgPSBKU09OLnBhcnNlKHJlcXVlc3QoZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSkpO1xcbiAgICAgICAgICAgIGxldCBjb25maWdLZXkgPSBpbnB1dDtcXG4gICAgICAgICAgICBwdXRNeVZhcihcXFwiaW5wdXRfbmFtZVxcXCIsIGNvbmZpZ0tleSk7XFxuICAgICAgICAgICAgcHV0TXlWYXIoXFxcImlucHV0X2NvZGVcXFwiLCBjb25maWcuaG9tZVBhZ2VDb25maWdzW2NvbmZpZ0tleV0uY29uZmlnKTtcXG4gICAgICAgICAgICByZXR1cm4g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AgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAn8J+TpCcsXFxuICAgICAgICBjb2xfdHlwZTogJ2ZsZXhfYnV0dG9uJyxcXG4gICAgICAgIHVybDogJChPYmplY3Qua2V5cyhob21lUGFnZUNvbmZpZ3MpLmZpbHRlcihjb25maWdLZXkgPT4gY29uZmlnS2V5ICE9PSAndXNlJyksIDIpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgLy8gaWYgKGlucHV0ID09PSAn6buY6K6kJykgcmV0dXJuICd0b2FzdDovL+m7mOiupOmFjee9ruaXoOazlee8lui+ke+8gSdcXG4gICAgICAgICAgICBldmFsKEpTT04ucGFyc2UocmVxdWVzdCgnaGlrZXI6Ly9wYWdlL3V0aWxzJykpLnJ1bGUpXFxuICAgICAgICAgICAgbGV0IGNvbmZpZyA9IGdldENvbmZpZygpO1xcbiAgICAgICAgICAgIGxldCBzZWxlY3RDb25maWcgPSB7XFxuICAgICAgICAgICAgICAgIG5hbWU6IGlucHV0LFxcbiAgICAgICAgICAgICAgICBkYXRhOiBjb25maWcuaG9tZVBhZ2VDb25maWdzW2lucHV0XVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gJChDb25maWdUb29sLmVuY1R5cGVMaXN0LCAyKS5zZWxlY3QoKHNlbGVjdENvbmZpZykgPT4ge1xcbiAgICAgICAgICAgICAgICBldmFsKEpTT04ucGFyc2UocmVxdWVzdCgnaGlrZXI6Ly9wYWdlL3V0aWxzJykpLnJ1bGUpXFxuICAgICAgICAgICAgICAgIHJldHVybiBDb25maWdUb29sLnRvQ2xpcGJvYXJkKENvbmZpZ1Rvb2wuZXhwb3J0KHNlbGVjdENvbmZpZy5uYW1lLCBzZWxlY3RDb25maWcsIFxcXCLpppbpobXphY3nva5cXFwiLCBpbnB1dCkpXFxuICAgICAgICAgICAgfSwgc2VsZWN0Q29uZmlnKVxcbiAgICAgICAgfSlcXG4gICAgfSlcXG59XFxuXFxuLy8g6Kej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hbHlzaXNDb25maWdzW2NvbmZpZ0tleV0uY29uZmlnKTtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJpbnB1dF9leHRyYVxcXCIsIGNvbmZpZy5hbmFseXNpc0NvbmZpZ3NbY29uZmlnS2V5XS5leHRyYSB8fCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaW5wdXRfc2V0dGluZ19jb2RlXFxcIiwgY29uZmlnLmFuYWx5c2lzQ29uZmlnc1tjb25maWdLZXldLnNldHRpbmcgfHwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL3BhZ2Uvc2V0dGluZy1lZGl0b3I/cnVsZT3pnZLosYYmdmlldz1hbmFseXNpc01vZGVFZGl0UGFnZSc7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY29uZmlnLmFuYWx5c2lzQ29uZmlncy51c2UgPSBjb25maWdLZXlcXG4gICAgICAgICAgICAgICAgd3JpdGVGaWxlKGdldE15VmFyKCdxZGJfY29uZmlnJyksIEpTT04uc3RyaW5naWZ5KGNvbmZpZykpXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaIkOWKnydcXG4gICAgICAgICAgICB9LCBjb25maWdLZXkpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnZmxleF9idXR0b24nXFxuICAgICAgICB9KVxcbiAgICB9XFxuICAgIGQucHVzaCh7XFxuICAgICAgICBjb2xfdHlwZTogJ2JsYW5rX2Jsb2NrJ1xcbiAgICB9KVxcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfinpUnLFxcbiAgICAgICAgY29sX3R5cGU6ICdmbGV4X2J1dHRvbicsXFxuICAgICAgICB1cmw6ICdoaWtlcjovL3BhZ2Uvc2V0dGluZy1lZGl0b3I/cnVsZT3pnZLosYYmdmlldz1hbmFseXNpc01vZGVFZGl0UGFnZSdcXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ+KelicsXFxuICAgICAgICBjb2xfdHlwZTogJ2ZsZXhfYnV0dG9uJyxcXG4gICAgICAgIHVybDogJChPYmplY3Qua2V5cyhhbmFseXNpc0NvbmZpZ3MpLmZpbHRlcihjb25maWdLZXkgPT4gY29uZmlnS2V5ICE9PSAndXNlJyAmJiBjb25maWdLZXkgIT09ICfkuI3op6PmnpAnICYmIGNvbmZpZ0tleSAhPT0gJ+aWreaPkicpLCAyKVxcbiAgICAgICAgICAgIC5zZWxlY3QoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT09ICfkuI3op6PmnpAnICYmIGlucHV0ID09PSAn5pat5o+SJykgcmV0dXJuICd0b2FzdDovL+m7mOiupOino+aekOaXoOazleWIoOmZpO+8gSdcXG4gICAgICAgICAgICAgICAgbGV0IGNvbmZpZyA9IEpTT04ucGFyc2UocmVxdWVzdChnZXRNeVZhcigncWRiX2NvbmZpZycpKSlcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09PSBjb25maWcuYW5hbHlzaXNDb25maWdzLnVzZSkgcmV0dXJuICd0b2FzdDovL+ivpeino+aekOato+WcqOS9v+eUqO+8jOaXoOazleWIoOmZpO+8gSdcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoJ+ehruiupOWIoOmZpFxcXCInICsgaW5wdXQgKyAnXFxcIu+8nycpLmNvbmZpcm0oKGNvbmZpZywgY29uZmlnS2V5KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBkZWxldGUgY29uZmlnLmFuYWx5c2lzQ29uZmlnc1tjb25maWdLZXldXFxuICAgICAgICAgICAgICAgICAgICB3cml0ZUZpbGUoZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSwgSlNPTi5zdHJpbmdpZnkoY29uZmlnKSlcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/liKDpmaQnICsgY29uZmlnS2V5ICsgJ+aIkOWKnydcXG4gICAgICAgICAgICAgICAgfSwgY29uZmlnLCBpbnB1dClcXG4gICAgICAgICAgICB9KVxcbiAgICB9KVxcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfwn5OdJyxcXG4gICAgICAgIGNvbF90eXBlOiAnZmxleF9idXR0b24nLFxcbiAgICAgICAgdXJsOiAkKE9iamVjdC5rZXlzKGFuYWx5c2lzQ29uZmlncykuZmlsdGVyKGNvbmZpZ0tleSA9PiBjb25maWdLZXkgIT09ICd1c2UnKSwgMilcXG4gICAgICAgICAgICAuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgICAgICAgICAgLy8gaWYgKGlucHV0ID09PSAn5LiN6Kej5p6QJyAmJiBpbnB1dCA9PT0gJ+aWreaPkicpIHJldHVybiAndG9hc3Q6Ly/pu5jorqTop6PmnpDml6Dms5XnvJbovpHvvIEnXFxuICAgICAgICAgICAgICAgIGxldCBjb25maWcgPSBKU09OLnBhcnNlKHJlcXVlc3QoZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSkpO1xcbiAgICAgICAgICAgICAgICBsZXQgY29uZmlnS2V5ID0gaW5wdXQ7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJpbnB1dF9uYW1lXFxcIiwgY29uZmlnS2V5KTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImlucHV0X2NvZGVcXFwiLCBjb25maWcuYW5hbHlzaXNDb25maWdzW2NvbmZpZ0tleV0uY29uZmlnKTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImlucHV0X2V4dHJhXFxcIiwgY29uZmlnLmFuYWx5c2lzQ29uZmlnc1tjb25maWdLZXldLmV4dHJhIHx8IFxcXCJcXFwiKTtcXG4gIC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B0cnkge1xcbiAgICAgICAgICAgIGlmIChhbmFseXNpc1NldHRpbmcuaW5kZXhPZigncmV0dXJuJykgPT0gLTEpIHRocm93IG5ldyBFcnJvcign5b+F6aG7IHJldHVybiBAcnVsZT1qczog5oiWICQoKS5ydWxlJyk7XFxuICAgICAgICAgICAgaWYgKGFuYWx5c2lzU2V0dGluZy5zdGFydHNXaXRoKFxcXCIoXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgZXZhbCgncmVzdWx0ID0gJyArIGFuYWx5c2lzU2V0dGluZyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgZXZhbCgncmVzdWx0ID0gJyArICcoKCkgPT4geycgKyBhbmFseXNpc1NldHRpbmcgKyAnfSkoKScpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coZS5tZXNzYWdlKTtcXG4gICAgICAgICAgICByZXN1bHQgPSBcXFwidG9hc3Q6Ly/plJnor6/nmoTorr7nva7pobXpnaLku6PnoIEs6K+35YmN5b6AIOaXpeW/lyDmn6XnnIvplJnor6/ljp/lm6BcXFwiXFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAn4pqZ77iPJyxcXG4gICAgICAgIGNvbF90eXBlOiAnZmxleF9idXR0b24nLFxcbiAgICAgICAgdXJsOiByZXN1bHRcXG4gICAgfSlcXG59XFxuXFxuLy/oh6rlrprkuYnlv6vpgJ/mkJzntKLmqKHlnZdcXG5mdW5jdGlvbiBxdWlja1NlYXJjaERJWU1vZHVsZShkLCBjb25maWcpIHtcXG4gICAgbGV0IHF1aWNrU2VhcmNoQ29uZmlncyA9IGdldENvbmZpZygncXVpY2tTZWFyY2hDb25maWdzJywgY29uZmlnKTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAn6Ieq5a6a5LmJ5b+r6YCf5pCc57SiJy5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R1cm4gJChkdGV4dCwgJ+ivt+S/ruaUuScpLmlucHV0KChjb25maWcsIHJhdykgPT4ge1xcbiAgICAgICAgICAgICAgICBpbnB1dCA9IGlucHV0LnNwbGl0KCdAQCcpO1xcbiAgICAgICAgICAgICAgICBpZiAocmF3ICE9IGlucHV0WzBdKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgaW5kZXggPSBjb25maWcucXVpY2tTZWFyY2hDb25maWdzLm9yZGVyLmluZGV4T2YocmF3KTtcXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5xdWlja1NlYXJjaENvbmZpZ3Mub3JkZXJbaW5kZXhdID0gaW5wdXRbMF07XFxuICAgICAgICAgICAgICAgICAgICBkZWxldGUgY29uZmlnLnF1aWNrU2VhcmNoQ29uZmlnc1tyYXddO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChjb25maWcucXVpY2tTZWFyY2hDb25maWdzLm9yZGVyLmluZGV4T2YoaW5wdXRbMF0pID09IC0xKSBjb25maWcucXVpY2tTZWFyY2hDb25maWdzLm9yZGVyLnB1c2goaW5wdXRbMF0pO1xcbiAgICAgICAgICAgICAgICBjb25maWcucXVpY2tTZWFyY2hDb25maWdzW2lucHV0WzBdXSA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWU6IGlucHV0WzFdLFxcbiAgICAgICAgICAgICAgICAgICAgcGljOiBpbnB1dFsyXVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICB3cml0ZUZpbGUoZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSwgSlNPTi5zdHJpbmdpZnkoY29uZmlnKSk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+S/ruaUueaIkOWKnyc7XFxuICAgICAgICAgICAgfSwgY29uZmlnLCBpbnB1dClcXG4gICAgICAgIH0pXFxuICAgIH0pXFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ/CflIEnLFxcbiAgICAgICAgY29sX3R5cGU6ICdmbGV4X2J1dHRvbicsXFxuICAgICAgICB1cmw6ICQoJ2hpa2VyOi8vZW1wdHkjbm9IaXN0b3J5IycpLnJ1bGUoKCkgPT4ge1xcbiAgICAgICAgICAgIGFkZExpc3RlbmVyKCdvbkNsb3NlJywgJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2pzb24nKTtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcignb3AnKTtcXG4gICAgICAgICAgICB9KSlcXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoJ2pzb24nKSA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgY29uZmlnID0gSlNPTi5wYXJzZShyZXF1ZXN0KGdldE15VmFyKCdxZGJfY29uZmlnJykpKTtcXG4gICAgICAgICAgICAgICAgbGV0IHF1aWNrU2VhcmNoQ29uZmlncyA9IGNvbmZpZy5xdWlja1NlYXJjaENvbmZpZ3M7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCdqc29uJywgSlNPTi5zdHJpbmdpZnkocXVpY2tTZWFyY2hDb25maWdzKSk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGxldCBvbGQgPSBKU09OLnBhcnNlKGdldE15VmFyKCdqc29uJykpO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfliIbliKvngrnlh7vkuKTpobnku6XkuqTmjaLpobrluo9cXFxcbuKAmOKAmOaOkuW6j+WujOavleWQjueCueaIkeS/neWtmOaOkuW6jyzlkKbliJnmjpLluo/kuI3nlJ/mlYjigJnigJknLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvbmZpZyA9IEpTT04ucGFyc2UoZmV0Y2goZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSkpO1xcbiAgICAgICAgICAgICAgICAgICAgY29uZmlnLnF1aWNrU2VhcmNoQ29uZmlncyA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoJ2pzb24nKSk7XFxuICAgICAgICAgICAgICAgICAgICB3cml0ZUZpbGUoZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSwgSlNPTi5zdHJpbmdpZnkoY29uZmlnKSk7XFxuICAgICAgICAgICAgICAgICAgICBiYWNrKHRydWUpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+S/ruaUueaIkOWKnydcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIG9sZC5vcmRlci5mb3JFYWNoKCh2YWx1ZSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRNeVZhcignb3AnKSA9PSB2YWx1ZSA/IHZhbHVlICsgJ+KAmOKAmCjlvZPliY3pgInkuK0p4oCZ4oCZJyA6IHZhbHVlLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0XzEnLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKGtleSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgb3AgPSBnZXRNeVZhcignb3AnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAob3AgPT0gJycpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ29wJywga2V5KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAob3AgPT0ga2V5KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ29wJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgb2xkID0gSlNPTi5wYXJzZShnZXRNeVZhcignanNvbicpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5ld2EgPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiBvbGQubW9kZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yZGVyOiBvbGQub3JkZXJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG9waW5kZXggPSBuZXdhLm9yZGVyLmluZGV4T2Yob3ApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoTWF0aC5hYnMob3BpbmRleCAtIGluZGV4KSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdhLm9yZGVyW29waW5kZXhdID0ga2V5O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3YS5vcmRlcltpbmRleF0gPSBvcDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChvcGluZGV4ID4gaW5kZXgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld2Eub3JkZXIuc3BsaWNlKG9waW5kZXgsIDEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3YS5vcmRlci5zcGxpY2UoaW5kZXgsIDAsIG9wKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld2Eub3JkZXIuc3BsaWNlKG9waW5kZXgsIDEpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3YS5vcmRlci5zcGxpY2UoaW5kZXggLSAxLCAwLCBvcCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3YS5vcmRlci5mb3JFYWNoKHZhbHVlID0+IG5ld2FbdmFsdWVdID0gb2xkW3ZhbHVlXSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2pzb24nLCBKU09OLnN0cmluZ2lmeShuZXdhKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ29wJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9LCB2YWx1ZSwgaW5kZXgpXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBzZXRSZXN1bHQoZCk7XFxuICAgICAgICB9KVxcbiAgICB9KVxcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfimpnvuI8nLFxcbiAgICAgICAgY29sX3R5cGU6ICdmbGV4X2J1dHRvbicsXFxuICAgICAgICB1cmw6ICQocXVpY2tTZWFyY2hDb25maWdzWydtb2RlJ10gfHwgXFxcIlxcX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G4gICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7mm7TmlLnlt7Lkv53lrZhcXFwiO1xcbiAgICAgICAgfSlcXG4gICAgfSlcXG5cXG4gICAgaG9tZVBhZ2VTZXR0aW5nTW9kdWxlKGQpO1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgY29sX3R5cGU6ICdsaW5lJ1xcbiAgICB9KVxcblxcbiAgICBxdWlja1NlYXJjaERJWU1vZHVsZShkLCBjb25mKTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiAnbGluZSdcXG4gICAgfSlcXG5cXG4gICAgZGV0YWlsVmlld1NldHRpbmdNb2R1bGUoZCk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICBjb2xfdHlwZTogJ2xpbmUnXFxuICAgIH0pXFxuXFxuICAgIGlmICh0cnVlLypnZXRJdGVtKCdwYXNzd29yZCcpID09ICd0cnVlJyovKSB7XFxuICAgICAgICBhbmFseXNpc1NldHRpbmdNb2R1bGUoZCk7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiAnbGluZSdcXG4gICAgICAgIH0pXFxuICAgIH1cXG5cXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArICfmgaLlpI3pu5jorqTorr7nva4nLmJvbGQoKSxcXG4gICAgICAgIGRlc2M6ICfph43nlJ8nLFxcbiAgICAgICAgY29sX3R5cGU6ICd0ZXh0XzEnLFxcbiAgICAgICAgdXJsOiAkKFsn6YeN572u5pif5pif6aKc6ImyJywgJ+mHjee9rumAieS4reagh+etvuminOiJsicsICfph43nva7lv6vpgJ/mkJzntKInLCAn6YeN572u6aaW6aG15Li66buY6K6kJywgJ+mHjee9ruivpuaDhemhtScgLCAn5riF6Zmk5YWo6YOo6K6+572uJ10sIDEpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgcmV0dXJuICQoXFxcIuehruWumuimgVxcXCIgKyBpbnB1dCArIFxcXCLvvJ9cXFwiKS5jb25maXJtKChzZWwpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ZW0gPSAnJztcXG4gICAgICAgICAgICAgICAgc3dpdGNoIChzZWwpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ+mHjee9ruaYn+aYn+minOiJsic6XFxuICAgICAgICAgICAgICAgICAgICAgICAgaXRlbSA9ICdzdGFyQ29sb3InO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAn6YeN572u6YCJ5Lit5qCH562+6aKc6ImyJzpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpdGVtID0gJ2Nob29zZUNvbG9yJztcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ+mHjee9ruW/q+mAn+aQnOe0oic6XFxuICAgICAgICAgICAgICAgICAgICAgICAgaXRlbSA9ICdxdWlja1NlYXJjaENvbmZpZ3MnO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAn6YeN572u6aaW6aG15Li66buY6K6kJzpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpdGVtID0gJ2hvbWVQYWdlQ29uZmlncyc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlICfph43nva7or6bmg4XpobUnOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW0gPSAnZGV0YWlsVmlld0NvbmZpZ3MnO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAn5riF6Zmk5YWo6YOo6K6+572uJzpcXG4gICAgICAgICAgICAgICAgICAgICAgICBpdGVtID0gJ2FsbCc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgLy8gZXZhbChKU09OLnBhcnNlKHJlcXVlc3QoJ2hpa2VyOi8vcGFnZS9zZXR0aW5nUGFnZScpKS5ydWxlKTtcXG4gICAgICAgICAgICAgICAgbGV0IGRlZmF1bHRDb25maWdzID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGVmYXVsdENvbmZpZ3NcXFwiKTtcXG4gICAgICAgICAgICAgICAgaWYgKGl0ZW0gPT0gJ2FsbCcpIHtcXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlRmlsZShnZXRNeVZhcigncWRiX2NvbmZpZycpLCBKU09OLnN0cmluZ2lmeShkZWZhdWx0Q29uZmlncykpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lt7JcXFwiICsgc2VsO1xcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYoaXRlbSA9PSBcXFwiaG9tZVBhZ2VDb25maWdzXFxcIil7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgY29uZmlnID0gSlNPTi5wYXJzZShmZXRjaChnZXRNeVZhcigncWRiX2NvbmZpZycpKSk7XFxuICAgICAgICAgICAgICAgICAgICBjb25maWdbaXRlbV1bXFxcIum7mOiupFxcXCJdID0gZGVmYXVsdENvbmZpZ3NbaXRlbV1bXFxcIum7mOiupFxcXCJdO1xcbiAgICAgICAgICAgICAgICAgICAgY29uZmlnW2l0ZW1dLnVzZSA9IFxcXCLpu5jorqRcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgd3JpdGVGaWxlKGdldE15VmFyKCdxZGJfY29uZmlnJyksIEpTT04uc3RyaW5naWZ5KGNvbmZpZykpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lt7JcXFwiICsgc2VsO1xcbiAgICAgICAgICAgICAgICB9ZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgY29uZmlnID0gSlNPTi5wYXJzZShmZXRjaChnZXRNeVZhcigncWRiX2NvbmZpZycpKSk7XFxuICAgICAgICAgICAgICAgICAgICBjb25maWdbaXRlbV0gPSBkZWZhdWx0Q29uZmlnc1tpdGVtXTtcXG4gICAgICAgICAgICAgICAgICAgIHdyaXRlRmlsZShnZXRNeVZhcigncWRiX2NvbmZpZycpLCBKU09OLnN0cmluZ2lmeShjb25maWcpKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5beyXFxcIiArIHNlbDtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0sIGlucHV0KVxcbiAgICAgICAgfSlcXG4gICAgfSlcXG4gICAgc2V0UmVzdWx0KGQpO1xcbn1cXG5cXG5sZXQgdmlldyA9IGdldFBhcmFtKFxcXCJ2aWV3XFxcIixcXFwiXFxcIik7XFxuaWYodmlldz09XFxcIlxcXCIpe1xcbiAgICBzZXRQYWdlVGl0bGUoXFxcIuiuvue9rlxcXCIpXFxuICAgIHNldHRpbmdQYWdlKCk7XFxufWVsc2UgaWYodmlldz09XFxcImFuYWx5c2lzU2V0dGluZ01vZHVsZVxcXCIpe1xcbiAgICBsZXQgZCA9IFtdO1xcbiAgICBzZXRQYWdlVGl0bGUoXFxcIuino+aekOiuvue9rlxcXCIpXFxuICAgIGFuYWx5c2lzU2V0dGluZ01vZHVsZShkKTtcXG4gICAgc2V0UmVzdWx0KGQpO1xcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIum7mOiupOmFjee9rlwiLFwicGF0aFwiOlwiZGVmYXVsd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HRpbmc6ICQudG9TdHJpbmcoKCkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K+l5o+S5Lu25peg6K6+572u6aG16Z2iXFxcIjtcXHJcXG4gICAgICAgICAgICB9KVxcclxcbiAgICAgICAgfSxcXHJcXG4gICAgICAgIFxcXCLmlq3mj5JcXFwiOiB7XFxyXFxuICAgICAgICAgICAgY29uZmlnOiAkLnRvU3RyaW5nKCgpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgbGV0IGZpbGUgPSBcXFwiaGlrZXI6Ly9maWxlcy9ydWxlcy9EdWFuTmlhbi9NeVBhcnNlLmpzb25cXFwiO1xcclxcbiAgICAgICAgICAgICAgICBsZXQgb2xkZmlsZSA9IFxcXCJoaWtlcjovL2ZpbGVzL2NhY2hlL015UGFyc2VTZXQuanNvblxcXCI7XFxyXFxuICAgICAgICAgICAgICAgIGlmIChmaWxlRXhpc3QoZmlsZSkpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGV2YWwoJ2pzb249JyArIGZldGNoKGZpbGUpKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGxldCBqc1VybCA9IGpzb24uc2V0dGluZ3MuY2o7XFxyXFxuICAgICAgICAgICAgICAgICAgICBldmFsKGZldGNoKGpzVXJsKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXl0bVBhcnNlKGlucHV0KTtcXHJcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChmaWxlRXhpc3Qob2xkZmlsZSkpIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGxldCBqc1VybCA9IEpTT04ucGFyc2UoZmV0Y2gob2xkZmlsZSkpLmNqO1xcclxcbiAgICAgICAgICAgICAgICAgICAgZXZhbChmZXRjaChqc1VybCkpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGF5dG1QYXJzZShpbnB1dCk7XFxyXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5rKh5om+5Yiw5pat5o+S6YWN572u5paH5Lu2JztcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIH0pLFxcclxcbiAgICAgICAgICAgIHNldHRpbmc6ICQudG9TdHJpbmcoKCkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICBsZXQgZmlsZSA9IFxcXCJoaWtlcjovL2ZpbGVzL3J1bGVzL0R1YW5OaWFuL015UGFyc2UuanNvblxcXCI7XFxyXFxuICAgICAgICAgICAgICAgIGxldCBvbGRmaWxlID0gXFxcImhpa2VyOi8vZmlsZXMvY2FjaGUvTXlQYXJzZVNldC5qc29uXFxcIjtcXHJcXG4gICAgICAgICAgICAgICAgaWYgKGZpbGVFeGlzdChmaWxlKSkge1xcclxcbiAgICAgICAgICAgICAgICAgICAgZXZhbCgnanNvbj0nICsgZmV0Y2goZmlsZSkpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGpzVXJsID0ganNvbi5zZXR0aW5ncy5jajtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGV2YWwoZmV0Y2goanNVcmwpKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzZXRVcmw7XFxyXFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZmlsZUV4aXN0KG9sZGZpbGUpKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQganNVcmwgPSBKU09OLnBhcnNlKGZldGNoKG9sZGZpbGUpKS5jajtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGV2YWwoZmV0Y2goanNVcmwpKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzZXRVcmw7XFxyXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9Sb3V0ZT9ydWxlPU15Rm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IEpTT04ucGFyc2UoZmV0Y2goZ2V0TXlWYXIoJ3FkYl9jb25maWcnKSkpO1xcclxcbiAgICBpZiAobmFtZSkge1xcclxcbiAgICAgICAgaWYgKGNvbmZpZ1tuYW1lXSA9PSBudWxsKSB7XFxyXFxuICAgICAgICAgICAgY29uZmlnID0gaW5pdENvbmZpZ3MobmFtZSwgY29uZmlnKTtcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgICAgIHJldHVybiBjb25maWdbbmFtZV07XFxyXFxuICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICByZXR1cm4gY29uZmlnO1xcclxcbiAgICB9XFxyXFxufVxcclxcblxcclxcbi8v57yW56CB5bel5YW357G7XFxyXFxubGV0IFppcFRvb2wgPSB7XFxyXFxuICAgIGRlcGVuZGVuY2U6ICdodHRwczovL3VucGtnLmNvbS9sei1zdHJpbmdAMS40LjQvbGlicy9sei1zdHJpbmcubWluLmpzJyxcXHJcXG4gICAgY29tcHJlc3M6IHtcXHJcXG4gICAgICAgIHNpemU6IHtcXHJcXG4gICAgICAgICAgICBrZXk6IFxcXCJ0ZXh0LWNvbXByZXNzLXNpemVcXFwiLFxcclxcbiAgICAgICAgICAgIHNldDogKG5ld1ZhbHVlKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKHRoaXMua2V5LCBuZXdWYWx1ZS50b1N0cmluZygpKVxcclxcbiAgICAgICAgICAgIH0sXFxyXFxuICAgICAgICAgICAgZ2V0OiAoKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIHJldHVybiBwYXJzZUludChnZXRNeVZhcih0aGlzLmtleSwgXFxcIjBcXFwiKSlcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9LFxcclxcbiAgICAgICAgZXhlYzogKGlucHV0KSA9PiB7XFxyXFxuICAgICAgICAgICAgZXZhbChyZXF1ZXN0KFppcFRvb2wuZGVwZW5kZW5jZSkpXFxyXFxuICAgICAgICAgICAgbGV0IHJlc3VsdCA9IExaU3RyaW5nLmNvbXByZXNzVG9FbmNvZGVkVVJJQ29tcG9uZW50KGlucHV0KVxcclxcbiAgICAgICAgICAgICAgICAvLyBaaXBUb29sLmNvbXByZXNzLnNpemUuc2V0KHJlc3VsdC5sZW5ndGggKiAyKVxcclxcbiAgICAgICAgICAgIHJldHVybiByZXN1bHRcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfSxcXHJcXG4gICAgZGVjb21wcmVzczoge1xcclxcbiAgICAgICAgc2l6ZToge1xcclxcbiAgICAgICAgICAgIGdldDogKCkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICByZXR1cm4gZ2V0TXlWYXIoXFxcInRleHQtZGVjb21wcmVzc1xcXCIsIFxcXCIwXFxcIilcXHJcXG4gICAgICAgICAgICAgICAgICAgIC5sZW5ndGhcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9LFxcclxcbiAgICAgICAgZXhlYzogKGlucHV0KSA9PiB7XFxyXFxuICAgICAgICAgICAgZXZhbChyZXF1ZXN0KFppcFRvb2wuZGVwZW5kZW5jZSkpXFxyXFxuICAgICAgICAgICAgbGV0IHJlc3VsdCA9IExaU3RyaW5nLmRlY29tcHJlc3NGcm9tRW5jb2RlZFVSSUNvbXBvbmVudChpbnB1dClcXHJcXG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0XFxyXFxuICAgICAgICB9XFxyXFxuICAgIH1cXHJcXG59XFxyXFxuXFxyXFxuLy8g6YWN572u6aG55bel5YW357G7XFxyXFxubGV0IENvbmZpZ1Rvb2wgPSB7XFxyXFxuICAgIGVuY1R5cGVMaXN0OiBbJ0Jhc2U2NCcsICdaaXBwZXInXS5jb25jYXQoZ2V0UGFzdGVzKCkpLFxcclxcbiAgICB0b0NsaXBib2FyZDogKGNvbmZpZ0NvbW1hbmQsIG5hbWUpID0+IHtcXHJcXG4gICAgICAgIGlmIChjb25maWdDb21tYW5kLnN0YXJ0c1dpdGgoJ3RvYXN0Oi8vJykpIHJldHVyb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AgICAgdGhyb3cgXFxcIuWvvOWHuuaVsOaNruS4jeWQiOazlVxcXCJcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgICAgIHN3aXRjaCAoZW5jVHlwZSkge1xcclxcbiAgICAgICAgICAgIGNhc2UgJ0Jhc2U2NCc6XFxyXFxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IGJhc2U2NEVuY29kZShyZXN1bHQpO1xcclxcbiAgICAgICAgICAgICAgICBicmVhaztcXHJcXG4gICAgICAgICAgICBjYXNlICdaaXBwZXInOlxcclxcbiAgICAgICAgICAgICAgICByZXN1bHQgPSBaaXBUb29sLmNvbXByZXNzLmV4ZWMocmVzdWx0KVxcclxcbiAgICAgICAgICAgICAgICBicmVhaztcXHJcXG4gICAgICAgICAgICBkZWZhdWx0IDpcXHJcXG4gICAgICAgICAgICAgICAgaWYgKGdldEFwcFZlcnNpb24oKSA+IDIwNzApIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHN5bWJvbCA9IFxcXCLpnZLosYblj6Pku6Tvv6VcXFwiICsgcmVtYXJrICsgXFxcIu+/pVxcXCIgKyBuYW1lXFxyXFxuICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBzaGFyZVBhc3RlKENvbmZpZ1Rvb2wuZXhwb3J0KG5hbWUsIGNvbmZpZywgcmVtYXJrLCAnWmlwcGVyJyksZW5jVHlwZSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0ICsgJ1xcXFxuXFxcXG4nICsgc3ltYm9sXFxyXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6K+35pu05paw6KeG55WM54mI5pys6IezIEMyMDcwIOS7peS4iidcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICBicmVhaztcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgICAgIHJlc3VsdCA9IHN5bWJvbCArIHJlc3VsdFxcclxcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcXHJcXG4gICAgfSxcXHJcXG4gICAgaW1wb3J0OiAoY29uZmlnQ29tbWFuZCkgPT4ge1xcclxcbiAgICAgICAgbGV0IHJlc3VsdCA9ICcnXFxyXFxuICAgICAgICBpZiAoY29uZmlnQ29tbWFuZC5zdGFydHNXaXRoKCfkupEnKSkge1xcclxcbiAgICAgICAgICAgIGlmIChnZXRBcHBWZXJzaW9uKCkgPiAyMDcwKSB7XFxyXFxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IGNvbmZpZ0NvbW1hbmQuc3BsaXQoJ+mdkuixhicpWzBdLnJlcGxhY2UoL1xcXFxcXFxcbi8sICcnKVxcclxcbiAgICAgICAgICAgICAgICBjb25maWdDb21tYW5kID0gcGFyc2VQYXN0ZShyZXN1bHQpXFxyXFxuICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+ivt+abtOaWsOinhueVjOeJiOacrOiHsyBDMjA3MCDku6XkuIonXFxyXFxuICAgICAgICAgICAgfVxcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgdHJ5IHtcXHJcXG4gICAgICAgICAgICBsZXQgcmVzdWx0U3BsaXRzID0gY29uZmlnQ29tbWFuZC5zcGxpdChcXFwi77+lXFxcIilcXHJcXG4gICAgICAgICAgICBsZXQgZW5jVHlwZSA9IHJlc3VsdFNwbGl0c1szXVxcclxcbiAgICAgICAgICAgIHJlc3VsdCA9IHJlc3VsdFNwbGl0c1s0XVxcclxcbiAgICAgICAgICAgIHN3aXRjaCAoZW5jVHlwZSkge1xcclxcbiAgICAgICAgICAgICAgICBjYXNlICdCYXNlNjQnOlxcclxcbiAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gYmFzZTY0RGVjb2RlKHJlc3VsdCk7XFxyXFxuICAgICAgICAgICAgICAgICAgICBicmVhaztcXHJcXG4gICAgICAgICAgICAgICAgY2FzZSAnWmlwcGVyJzpcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IFppcFRvb2wuZGVjb21wcmVzcy5leGVjKHJlc3VsdClcXHJcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICByZXN1bHQgPSBKU09OLnBhcnNlKHJlc3VsdCk7XFxyXFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxyXFxuICAgICAgICAgICAgbG9nKGUubWVzc2FnZSlcXHJcXG4gICAgICAgICAgICB0aHJvdyBcXFwi5a+85YWl5pWw5o2u5LiN5ZCI5rOVXFxcIlxcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcXHJcXG4gICAgfVxcclxcbn1cIn1dIiwiaWNvbiI6Imh0dHBzOi8vZ2l0Y29kZS5uZXQvcXFfNDE4NDY3NTYvaGlrZXIvLS9yYXcvbWFzdGVyL2ltZy/pnZLosYYucG5nIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment