Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥封神第一部:朝歌风云@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCIubW9kdWxlLWJsb2NrbGlzdCYmYSwtMSYmVGV4dC5qczon5pu05paw6Iez77yaJytpbnB1dFwiLFwibGlzdFRvQ2xlYXJBc3NvY2lhdGVkRktcIjpbXSxcImxpc3RUb0NsZWFyU2VsZkZLXCI6W10sXCJwYWdlTGlzdFwiOlt7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi4pO46YCa55So6Kej5p6QXCIsXCJwYXRoXCI6XCJsYXp5XCIsXCJydWxlXCI6XCJcXG52YXIgbGF6eSA9ICQoJycpLmxhenlSdWxlKCgpID0+IHtcXG5pZiAoaW5wdXQuaW5kZXhPZignbWFnbmV0Oj94dCcpID09IC0xKSB7XFxuICAgIHRyeXtcXG4gICAgICB2YXIgaHRtbCA9IEpTT04ucGFyc2UocmVxdWVzdChpbnB1dCkubWF0Y2goL3IgcGxheWVyXy4qPz0oLio/KTwvKVsxXSlcXG4gICAgdmFyIHVybCA9IGh0bWwudXJsXFxuICAgIGlmIChodG1sLmVuY3J5cHQgPT0gJzEnKSB7XFxuICAgICAgICB1cmwgPSB1bmVzY2FwZSh1cmwpO1xcbiAgICB9IGVsc2UgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMicpIHtcXG4gICAgICAgIHVybCA9IHVuZXNjYXBlKGJhc2U2NERlY29kZSh1cmwpKT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XNjOiBkZXNjLFxcbiAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICB1cmw6IGl0ZW0udXJsLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBpZDogaWQrJ2JhcicsXFxuICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgaW1nOiBpdGVtLmltZyxcXG4gICAgICAgIH1cXG4gICAgfSlcXG5cXG4gICAgaWYgKHN0YXJ0ID09IGZhbHNlIHx8IGdldE15VmFyKCdiZW5zdGFydCcsICd0cnVlJykgPT0gJ2ZhbHNlJykge1xcbiAgICAgICAgdW5SZWdpc3RlclRhc2soaWQpXFxuICAgICAgICByZXR1cm5cXG4gICAgfVxcbiAgICBcXG4gICAgLy9sb2coZGF0YSlcXG5cXG4gICAgbGV0IG9iaiA9IHtcXG4gICAgICAgIGRhdGE6IGRhdGEsXFxuICAgIH07XFxuXFxuICAgIHJlZ2lzdGVyVGFzayhpZCwgdGltZSwgJC50b1N0cmluZygob2JqLGlkKSA9PiB7XFxuICAgICAgICB2YXIgZGF0YSA9IG9iai5kYXRhO1xcbiAgICAgICAgdmFyIHJ1bSA9IGdldE15VmFyKCdybnVtJyk7XFxuXFxuICAgICAgICB2YXIgaSA9IE51bWJlcihnZXRNeVZhcignYmFubmVyaScsICcwJykpO1xcbiAgICAgICAgaWYgKHJ1bSAhPSAnJykge1xcbiAgICAgICAgICAgIGkgPSBOdW1iZXIocnVtKSArIDFcXG4gICAgICAgICAgICBjbGVhck15VmFyKCdybnVtJylcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgaSA9IGkgKyAxO1xcbiAgICAgICAgfVxcbiAgICAgICAgLy9sb2coaSlcXG4gICAgICAgIC8vbG9nKGRhdGEubGVuZ3RoKVxcblxcbiAgICAgICAgaWYgKGkgPiBkYXRhLmxlbmd0aCAtIDEpIHtcXG4gICAgICAgICAgICBpID0gMFxcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIGl0ZW0gPSBkYXRhW2ldO1xcbiAgICAgICAgLy9sb2coaXRlbSlcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgdXBkYXRlSXRlbShpZCsnYmFyJywge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICAgICAgaW1nOiBpdGVtLmltZyxcXG4gICAgICAgICAgICAgICAgdXJsOiBpdGVtLnVybCxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLmltZyxcXG4gICAgICAgICAgICAgICAgICAgIC8vbmFtZTogaXRlbS50aXRsZS5yZXBsYWNlKC88W14+XSs+L2csICcnKSxcXG4gICAgICAgICAgICAgICAgICAgIC8vc25hbWU6IGl0ZW0uZXh0cmEuc25hbWUsXFxuICAgICAgICAgICAgICAgICAgICAvL3N0eXBlOiBpdGVtLmV4dHJhLnN0eXBlLFxcbiAgICAgICAgICAgICAgICAgICAgLy9zdXJsOiBpdGVtLnVybCxcXG4gICAgICAgICAgICAgICAgICAgIC8vaW1nOml0ZW0uaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgLy9wYWdlVGl0bGU6IGl0ZW0udGl0bGUucmVwbGFjZSgvPFtePl0rPi9nLCAnJyksXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGxvZyhlLm1lc3NhZ2UpXFxuICAgICAgICAgICAgdW5SZWdpc3RlclRhc2soaWQpXFxuICAgICAgICB9XFxuICAgICAgICBwdXRNeVZhcignYmFubmVyaScsIGkpO1xcblxcbiAgICB9LCBvYmosaWQpKVxcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuKRoOS4gOe6p+mhtemdolwiLFwicGF0aFwiOlwieWlcIixcInJ1bGVcIjpcInZhciBJY29uX3ByZWZpeCA9ICdodHRwczovL3Jhdy5mYXN0Z2l0Lm9yZy9sczEyNTc4MTAwMy9sbXR1Ymlhby9tYWluL21vcmUvJztcXG5cXG4vL+WIt+aWsCAgICAgICBcXG4gICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+WIt+aWsCcsXFxuICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5Yi35paw5oiQ5YqfJyAgXFxuICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgcGljX3VybDogSWNvbl9wcmVmaXggKyAnMTQucG5nJysgXFxcIkBSZWZlcmVyPVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJpY29uXzVcXFwiXFxuICAgICAgICB9KTtcXG5cXG4vL+etm+mAiVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+etm+mAiScsXFxuICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL3NoYWk/cGFnZT1meXBhZ2Ujbm9IaXN0b3J5IycsXFxuICAgICAgICAgICAgcGljX3VybDogSWNvbl9wcmVmaXggKyAnMzEucG5nJyArIFxcXCJAUmVmZXJlcj1cXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaWNvbl81XFxcIlxcbiAgICAgICAgfSk7XFxuXFxuLy/mkJzntKJcXG4gICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+aQnOe0oicsXFxuICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL3NzJyxcXG4gICAgICAgICAgICBwaWNfdXJsOiBJY29uX3ByZWZpeCArICc3LnBuZycgKyBcXFwiQFJlZmVyZXI9XFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgICAgIH0pO1xcblxcbi8v5pu05pawXFxuICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAn5pu05pawJyxcXG4gICAgICAgICAgICB1cmw6ICdoaWtlcjovL3BhZ2UvZ3h4JyxcXG4gICAgICAgICAgICBwaWNfdXJsOiBJY29uX3ByZWZpeCArICcyNzcucG5nJyArIFxcXCJAUmVmZXJlcj1cXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaWNvbl81XFxcIlxcbiAgICAgICAgfSk7XFxuXFxuLy/liIfmjaJcXG5jb25zdCBmb2xkID0gZ2V0TXlWYXIoJ2xpZS5ncm91cCcsIFxcXCIxXFxcIilcXG5kLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAn5YiH5o2iJyxcXG4gICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGZvbGQpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2xpZS5ncm91cCcsIGZvbGQgPT09ICcxJyA/ICcwJyA6ICcxJyk7XFxuXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgfSwgZm9sZCksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdpY29uXzUnLFxcbiAgICAgICAgICAgIHBpY191cmw6IEljb25fcHJlZml4ICsgJzIwMC5wbmcnICsgXFxcIkBSZWZlcmVyPVxcXCIsXFxuICAgICAgICB9KTtcXG5kLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCJcXG4gICAgICAgIH0pO1xcbmQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJiaWdfYmxhbmtfYmxvY2t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1bmN0aW9uKHdrKSB7XFxuICAgICAgICBpZiAoL+WRqHzmmJ/mnJ8vLnRlc3Qod2spKSB7XFxuICAgICAgICAgICAgd2sgPSB3ay5yZXBsYWNlKC/lkah85pif5pyfLywgXFxcIlxcXCIpXFxuICAgICAgICB9XFxuICAgICAgICB2YXIgbWFwID0ge1xcbiAgICAgICAgICAgIFxcXCLml6VcXFwiOiA2LFxcbiAgICAgICAgICAgIFxcXCLkuIBcXFwiOiAwLFxcbiAgICAgICAgICAgIFxcXCLkuoxcXFwiOiAxLFxcbiAgICAgICAgICAgIFxcXCLkuIlcXFwiOiAyLFxcbiAgICAgICAgICAgIFxcXCLlm5tcXFwiOiAzLFxcbiAgICAgICAgICAgIFxcXCLkupRcXFwiOiA0LFxcbiAgICAgICAgICAgIFxcXCLlha1cXFwiOiA1XFxuICAgICAgICB9O1xcbiAgICAgICAgcmV0dXJuIG1hcFt3a11cXG4gICAgfVxcbiAgICBsZXQgd2tfbnVtID0gd2tUb251bShjaG9zZV93ZWVrKTtcXG4vL2xvZyh3a19udW0pXFxuZm9yICh2YXIgayA9IDA7IGsgPD0gNjsgaysrKSB7XFxuICAgIGV2YWwoJ3ZhciB3aycgKyBrICsgJz1wZGZhKGh0bWwsIFxcXCIubW9kdWxlLW1haW4sJyArIChrPT0wPzA6aykgKyAnJiYubW9kdWxlLWl0ZW0sMDoxMlxcXCIpOycpOy8v5pif5pyf5YiX6KGoXFxuICAgIGlmICh3a19udW0gPT0gaykge1xcbiAgICAgICAgZXZhbCgnd2snK2spLmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICAgICAgdmFyIHVybGwgPSBNWV9IT01FICsgcGRmaChpdGVtLCAnYSYmaHJlZicpICsgJyNpbW1lcnNpdmVUaGVtZSMnO1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBwZGZoKGl0ZW0sIOagh+mimCksXFxuICAgICAgICAgICAgICAgIGRlc2M6IHBkZmgoaXR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goKSA9PiB7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHZhciBodG1sID0gSlNPTi5wYXJzZShyZXF1ZXN0KGlucHV0KS5tYXRjaCgvciBwbGF5ZXJfLio/PSguKj8pPC8pWzFdKVxcbiAgICAgICAgICAgIHZhciB1cmwgPSBodG1sLnVybFxcbiAgICAgICAgICAgIGlmIChodG1sLmVuY3J5cHQgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IHVuZXNjYXBlKHVybCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChodG1sLmVuY3J5cHQgPT0gJzInKSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IHVuZXNjYXBlKGJhc2U2NERlY29kZSh1cmwpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKC9tM3U4fG1wNC8udGVzdCh1cmwpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB1cmxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInZpZGVvOi8vXFxcIiArIGlucHV0XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidmlkZW86Ly9cXFwiICsgaW5wdXRcXG4gICAgICAgIH1cXG4gICAgfSksXFxuICAgIHVwZGF0YTogZnVuY3Rpb24ocnVsZSwgaGVhZGVycykge1xcbiAgICAgICAgaGVhZGVycyA9IGhlYWRlcnMgIT0gdW5kZWZpbmVkID8gaGVhZGVycyA6IHt9O1xcbiAgICAgICAgc2V0TGFzdENoYXB0ZXJSdWxlKCdqczonICsgJC50b1N0cmluZygodXJsLCBydWxlLCBoZWFkZXJzKSA9PiB7XFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBmZXRjaCh1cmwsIGhlYWRlcnMpO1xcbiAgICAgICAgICAgIHNldFJlc3VsdChldmFsKHJ1bGUpKVxcbiAgICAgICAgfSwgTVlfVV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gICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG5cXG4vL+eugOS7i1xcbiAgICBzZXREZXNjOiBmdW5jdGlvbihkZXNjLCBudW0pIHtcXG4gICAgICAgIGRlc2MgPSBkZXNjLmNvbnN0cnVjdG9yID09IEFycmF5ID8gZGVzYy5qb2luKCc8YnI+JykgOiBkZXNjO1xcbiAgICAgICAgaWYgKGRlc2MucmVwbGFjZSgvKDxicj58XFxcXHMrKS9nLCAnJykubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICByZXR1cm5cXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBpbmZvID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX2luZm8nLCAne30nKVxcbiAgICAgICAgaWYgKGluZm9bJ2Rlc2MnXSAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICBpbmZvWydkZXNjJ10gPSBpbmZvWydkZXNjJ10gKyAnIOeugOS7izonICsgZGVzYztcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfaW5mbycsIGluZm8pO1xcbiAgICAgICAgfVxcblxcbiAgICAgICAgY29uc3QgbWFyayA9ICdkZXNjJztcXG4gICAgICAgIG51bSA9IHR5cGVvZihudW0pID09ICd1bmRlZmluZWQnID8gOTAgOiBudW1cXG4gICAgICAgIGRlc2MgPSBkZXNjLnN0YXJ0c1dpdGgoJ+OAgOOAgCcpID8gZGVzYyA6ICfjgIDjgIAnICsgZGVzYztcXG4gICAgICAgIGRlc2MgPSBkZXNjLnJlcGxhY2UoLycvZywgXFxcIiYjMzk7XFxcIik7XFxuICAgICAgICBkZXNjID0gZGVzYy5yZXBsYWNlKC9cXFxcclxcXFxuL2csIFxcXCI8YnI+XFxcIik7XFxuXFxuICAgICAgICBmdW5jdGlvbiBzdWJzdHIoc3RyLCBtYXhMZW5ndGgpIHtcXG4gICAgICAgICAgICBsZXQgbGVuID0gMDtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBpZiAoc3RyLmNoYXJDb2RlQXQoaSkgPiAyNTUpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxlbiArPSAyO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgbGVuKys7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKGxlbiA+IG1heExlbmd0aCkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0ci5zbGljZSgwLCBpKSArICcuLi4nO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBzdHI7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgc2Rlc2MgPSBzdWJzdHIoZGVzYywgbnVtKTtcXG4gICAgICAgIHZhciBsYXp5ID0gJChgI25vTG9hZGluZyNgKS5sYXp5UnVsZSgoZGMsIHNkYywgbSkgPT4ge1xcbiAgICAgICAgICAgIHZhciBzaG93ID0gc3RvcmFnZTAuZ2V0SXRlbShtLCAnMCcpO1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGZpbmRJdGVtKCdkZXNjJykudGl0bGU7XFxuICAgICAgICAgICAgdmFyIHJlID0gLyg8XFxcXC9zbWFsbD48YnI+Lio/PikuKy9nO1xcbiAgICAgICAgICAgIHZhciBleHAgPSAn5bGV5byAOic7XFxuICAgICAgICAgICAgdmFyIHJldCA9ICfmlLbotbc6JztcXG4gICAgICAgICAgICBpZiAoc2hvdyA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSgnZGVzYycsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKHJldCwgZXhwKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKHJlLCAnJDEnICsgc2RjICsgJzwvc21hbGw+JylcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvKDxcXFxcL3NtYWxsPjxicj48Zm9udCBjb2xvcj1cXFwiKS4qPyhcXFwiPikvLCAnJDEjOEEyQkUyJDInKS8v5pS26LW36aKc6ImyXFxuXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0obSwgJzAnKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKCdkZXNjJywge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoZXhwLCByZXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UocmUsICckMScgKyBkYyArICc8L3NtYWxsPicpXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLyg8XFxcXC9zbWFsbD48YnI+PGZvbnQgY29sb3I9XFxcIikuKj8oXFxcIj4pLywgJyQxIzAwODAwMCQyJykvL+WxleW8gOminOiJslxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKG0sICcxJyk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBgaGlrZXI6Ly9lbXB0eWBcXG4gICAgICAgIH0sIGRlc2MsIHNkZXNjLCBtYXJrKVxcbiAgICAgICAgdmFyIHNjID0gc3RvcmFnZTAuZ2V0SXRlbShtYXJrLCAnMCcpID09ICcwJyA/ICflsZXlvIA6JyA6ICfmlLbotbc6JztcXG4gICAgICAgIHZhciBkYyA9IHN0b3JhZ2UwLmdldEl0ZW0obWFyaywgJzAnKSA9PSAnMCcgPyBzZGVzYyA6IGRlc2M7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAnJyArICc8Yj48Zm9udCBjb2xvcj1cXFwiIzA5OEFDMVxcXCI+4oi3ICAgICAgICAgICAgICAgICAgICAgIOWJp+aDheeugOS7i1xcdDwvZm9udD48L2I+JyArIFxcXCI8c21hbGw+PGEgc3R5bGU9J3RleHQtZGVjb3JhdGlvbjogbm9uZTsnIGhyZWY9J1xcXCIgKyBsYXp5ICsgXFxcIic+XFxcIiArIHNjICsgJzwvYT48L3NtYWxsPjxicj48Zm9udCBjb2xvcj1cXFwiIzhBMkJFMlxcXCI+JyArIGAke2RjfWAgKyAnPC9zbWFsbD4nLC8v6buY6K6k6aKc6ImyXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdyaWNoX3RleHQnLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiAnZGVzYycsXFxuICAgICAgICAgICAgICAgIGxpbmVTcGFjaW5nOiA2LFxcbiAgICAgICAgICAgICAgICB0ZXh0U2l6ZTogMTUsXFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiB0cnVlLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgIH0sXFxuXFxuXFxuLy/mtbfmiqVcXG4gICAgc3RyQ29udmVydDogZnVuY3Rpb24oYXJyKSB7XFxuICAgICAgICByZXR1cm4gYXJyLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICBzdHIgPSB4O1xcbiAgICAgICAgICAgIGlmICgvKOWvvOa8lHzkuLvmvJR857G75Z6LKe+8mi8udGVzdChzdHIpKSB7XFxuICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zcGxpdCgnLycpLm1hcCgodmFsLCBpbmRleCkgPT4gKGluZGV4ID09PSAwID8gJycgOiAnJykgKyB2YWwpLnNsaWNlKDAsIDUpLmpvaW4oJyAnKS5yZXBsYWNlKC8gJC8sICcnKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHN0clxcbiAgICAgICAgfSlcXG4gICAgfSxcXG4gICAgc2V0Q29udGVudDogZnVuY3Rpb24ob2JqKSB7XFxuICAgICAgICAvL2xvZyhvYmopXFxuICAgICAgICB2YXIgY29udGVudHMgPSBvYmoubWFpbjtcXG4gICAgICAgIHZhciBzb3J0T3JkZXIgPSBvYmouc29ydDtcXG4gICAgICAgIHZhciBpbWcgPSBvYmouaW1nO1xcbiAgICAgICAgdmFyIHRleHRzID0gY29udGVudHMubWFwKHggPT4gcGRmaCh4LCAnVGV4dCcpKTtcXG5cXG4gICAgICAgIHZhciBhcnJheSA9IHRleHRzLnNvcnQoKGEsIGIpID0+IHtcXG4gICAgICAgICAgICBjb25zdCBpbmRleEEgPSBzb3J0T3JkZXIuaW5kZXhPZihhLnN1YnN0cigwLCAyKSk7XFxuICAgICAgICAgICAgY29uc3QgaW5kZXhCID0gc29ydE9yZGVyLmluZGV4T2YoYi5zdWJzdHIoMCwgMikpO1xcbiAgICAgICAgICAgIHJldHVybiBpbmRleEEgLSBpbmRleEI7XFxuICAgICAgICB9KVxcbiAgICAgICAgdmFyIHJlZ2V4ID0gbmV3IFJlZ0V4cCgnKCcgKyBzb3J0T3JkZXIuam9pbignfCcpICsgJyknKTtcXG4gICAgICAgIGFycmF5ID0gYXJyYXkuZmlsdGVyKGZ1bmN0aW9uKGl0ZW0pIHtcXG4gICAgICAgICAgICByZXR1cm4gcmVnZXgudGVzdChpdGVtKTtcXG4gICAgICAgIH0pO1xcbiAgICAgICAgLy9sb2coYXJyYXkpXFxuXFxuICAgICAgICAvL2FycmF5ID0gc29ydE9yZGVyLmxlbmd0aD09MD9hcnJheTp0aGlzLnN0ckNvbnZlcnQoYXJyYXkpO1xcbiAgICAgICAgYXJyYXkgPSB0aGlzLnN0ckNvbnZlcnQoYXJyYXkpO1xcblxcbiAgICAgICAgaWYgKGFycmF5Lmxlbmd0aCA+IDYpIHtcXG4gICAgICAgICAgICBhcnJheSA9IGFycmF5LnNsaWNlKDAsIDYpO1xcbiAgICAgICAgfVxcblxcbiAgICAgICAgdmFyIHRpdGxlcyA9IFtdO1xcbiAgICAgICAgdmFyIGRlc2NzID0gW107XFxuXFxuICAgICAgICBzd2l0Y2ggKGFycmF5Lmxlbmd0aCkge1xcbiAgICAgICAgICAgIGNhc2UgNDpcXG4gICAgICAgICAgICBjYXNlIDU6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDIpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDIpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlIDY6XFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDMpO1xcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDMpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgIH1cXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9pbmZvJywge1xcbiAgICAgICAgICAgIGRlc2M6IGRlc2NzLmpvaW4oJ1xcXFxuJyksXFxuICAgICAgICAgICAgaW1nOiBpbWcsXFxuICAgICAgICB9KVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgIC8vdGl0bGU6ICB0aGlzLnNtYWxsKCB0aXRsZXNbMF0gKyAnXFxcXG4nICt0aXRsZXMuc2xpY2UoMSwgMykuam9pbignXFxcXG4nKSwncmVkJyksXFxuICAgICAgICAgICAgLy9kZXNjOiB0aGlzLnNtYWxsKGRlc2NzLmpvaW4oJ1xcXFxuJyksJyNGRjdGMDAnKSxcXG4gICAgICAgICAgICB0aXRsZTogIHRoaXMuc21hbGwocGRmaChodG1sLCAnLnZpZGVvLWluZm8tYXV4JiZUZXh0JykgKyAnXFxcXG4nICsgcGRmaChodG1sLCAnLnZpZGVvLWluZm8taXRlbXM6bWF0Y2hlcyjlpIfms6jvvJp86L+e6L2977yafOmbhuaVsO+8mikmJlRleHQnKSwncmVkJyksXFxuICAgICAgICAgIGRlc2M6IHRoaXMuc21hbGwocGRmaChodG1sLCAnLnZpZGVvLWluZm8taXRlbXM6Y29udGFpbnMo5pu05paw77yaKSYmVGV4dCcpICsgJ1xcXFxuJyArIHBkZmgoaHRtbCwgJy52aWRlby1pbmZvLWl0ZW1zOmNvbnRhaW5zKOWvvOa8lO+8mikmJlRleHQnKSArICdcXFxcbicgKyBwZGZoKGh0bWwsICcudmlkZW8taW5mby1pdGVtczpjb250YWlucyjkuLvmvJTvvJopJiZUZXh0JyksJyNGRjdGMDAnKSxcXG4gICAgICAgICAgICBwaWNfdXJsOiBpbWcgKyAnQFJlZmVyZXI9JyxcXG4gICAgICAgICAgICB1cmw6IE1ZX1VSTCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzFfdmVydGljYWxfcGljX2JsdXInLFxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmIChvYmouZGVzYyAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICB0aGlzLnNldERlc2Mob2JqLmRlc2MpO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICBzZXRDdXN0b206IGZ1bmN0aW9uKG9iaiwgaW1nKSB7XFxuICAgICAgICB2YXIgYXJyYXkgPSBbXTtcXG4gICAgICAgIGlmIChvYmouY29uc3RydWN0b3IgPT0gQXJyYXkpIHtcXG4gICAgICAgICAgICBhcnJheSA9IG9iajtcXG4gICAgICAgIH1cXG4gICAgICAgIGFycmF5ID0gdGhpcy5zdHJDb252ZXJ0KGFycmF5KTtcXG4gICAgICAgIHZhciB0aXRsZXMgPSBbXTtcXG4gICAgICAgIHZhciBkZXNjcyA9IFtdO1xcbiAgICAgICAgc3dpdGNoIChhcnJheS5sZW5ndGgpIHtcXG4gICAgICAgICAgICBjYXNlIDQ6XFxuICAgICAgICAgICAgY2FzZSA1OlxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAyKTtcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgyKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSA2OlxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAzKTtcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgzKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICB9XFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfaW5mbycsIHtcXG4gICAgICAgICAgICBkZXNjOiBkZXNjcy5qb2luKCdcXFxcbicpLFxcbiAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgfSlcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSArICdcXFxcbicgKyB0aGlzLnNtYWxsKHRpdGxlcy5zbGljZSgxLCAzKS5qb2luKCdcXFxcbicpKSxcXG4gICAgICAgICAgICBkZXNjOiB0aGlzLnNtYWxsKGRlc2NzLmpvaW4oJ1xcXFxuJykpLFxcbiAgICAgICAgICAgIHBpY191cmw6IGltZyArICdAUmVmZXJlcj0nLFxcbiAgICAgICAgICAgIHVybDogTVlfVVJMLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMV92ZXJ0aWNhbF9waWNfYmx1cicsXFxuICAgICAgICB9KVxcbiAgICB9LFxcbiAgICBpc0NvbG9yOiBmdW5jdGlvbih0ZXh0KSB7XFxuICAgICAgICBjb25zdCByZWdleCA9IC9eIyhbMC05QS1GYS1mXXszfXxbMC05QS1GYS1mXXs2fSkkfF4oW2Etel0rKSQvaTtcXG4gICAgICAgIHJldHVybiByZWdleC50ZXN0KHRleHQpO1xcbiAgICB9LFxcbiAgICBnZXRQcmVzZXQ6IGZ1bmN0aW9uKGN1c3RvbSkge1xcbiAgICAgICAgaWYgKHR5cGVvZiBjdXN0b21kYXRhID09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0LCBjdXN0b20pIHtcXG4gICAgICAgIHZhcmkgPSBcXFwiZXJfXFxcIiArIHZhcmk7XFxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRhYnMubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICB2YXIgdXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgodmFyaSwgc2hzb3J0LCBpLCBsaW5lYykgPT4ge1xcblxcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCAnW10nKTtcXG5cXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHZhcmkgKyAnZm9sZCcsICcxJykgPT0gJzAnKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgYnRuID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19idXR0b24nKTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBmb2xkcyA9IFsnPGZvbnQgY29sb3I9XFxcIiNEM0QzRDNcXFwiPuKYtycsICc8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJ107XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGxpc3QgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9Jyk7XFxuICAgICAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjb2wgPSBwbGlzdFtzaHNvcnRdLmNvbF90eXBlO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNscyA9IHBsaXN0W3Noc29ydF0uY2xzO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBpYyA9IHBsaXN0W3Noc29ydF0ucGljO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGV4dHJhID0gcGxpc3Rbc2hzb3J0XS5leHRyYTtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGV4dHJhKVxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMF0sIGZvbGRzWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcih2YXJpICsgJ2ZvbGQnLCAnMScpO1xcbiAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXG4gICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbCA9IHBsaXN0W3Noc29ydF0uY29sX3R5cGU7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgY2xzID0gcGxpc3Rbc2hzb3J0XS5jbHM7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGljID0gcGxpc3Rbc2hzb3J0XS5waWM7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgZXh0cmEgPSBwbGlzdFtzaHNvcnRdLmV4dHJhO1xcbiAgICAgICAgICAgICAgICAgICAgLy9sb2coZXh0cmEpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIodmFyaSwgaSk7XFxuXFxuICAgICAgICAgICAgICAgIHZhciB4bGlzdCA9IGxpc3RzW2ldO1xcbiAgICAgICAgICAgICAgICBpZiAoJC5mdW5jICE9IHVuZGVmaW5lZCAmJiAkLmZ1bmMuY29uc3RydWN0b3IgPT0gRnVuY3Rpb24pIHtcXG4gICAgICAgICAgICAgICAgICAgIHhsaXN0ID0gJC5mdW5jKGkpO1xcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19saXN0JywgeGxpc3QpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHZhciBwbGF5cyA9IHhsaXN0Lm1hcCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHgudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogY29sLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpYzogcGljLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiBPYmplY3QuYXNzaWduKHt9LGV4dHJhLHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHgudXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGNscyxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JykgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5cy5yZXZlcnNlKCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIHBjZmcgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCAne30nKTtcXG4gICAgICAgICAgICAgICAgaWYgKHBjZmdbJ+WNleaOqCddKSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaCcsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGNmZ1snb2JqJ11bJ+WNleaOqCddWzBdXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn5Y2V5o6oJ10gPSBmYWxzZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAocGNmZ1sn6YCJ5o6oJ10pIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNocycsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGNmZ1snb2JqJ11bJ+mAieaOqCddWzBdXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn6YCJ5o6oJ10gPSBmYWxzZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCBwY2ZnKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihzaHNvcnQgKyAnX2xpbmUnLCBwbGF5cyk7XFxuXFxuICAgICAgICAgICAgICAgIHZhciB0YWJ4ID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXG4gICAgICAgICAgICAgICAgdGFieC5mb3JFYWNoKCh4LCBpaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0geC50aXRsZTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpID09IGlpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKC8jKFxcXFx3Kyk/L2csIGxpbmVjKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoLyMoXFxcXHcrKT8vZywgJyMnKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5oiQ5Yqf77yBJztcXG4gICAgICAgICAgICB9LCB2YXJpLCBzaHNvcnQsIGksIGN1c3RvbS7nur/ot6/pgInkuK0pXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgKGdldE15VmFyKHZhcmksICcwJykgPT0gaSA/IHRhYnNbaV0uZm9udGNvbG9yKGN1c3RvbS7nur/ot6/pgInkuK0pIDogdGFic1tpXS5mb250Y29sb3IoJyMnKSksXFxuICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogY3VzdG9tLue6v+i3r+agt+W8jyxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ190YWInLFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfdGFiXycgKyBpLFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IGN1c3RvbS7liIblibLmoLflvI8sXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfbGluZScsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfSxcXG4gICAgcHVzaFRhYjogZnVuY3Rpb24odmFyaSwgc2hzb3J0KSB7XFxuICAgICAgICBhZGRMaXN0ZW5lcignb25SZWZyZXNoJywgJC50b1N0cmluZygoc2hzb3J0KSA9PiB7XFxuICAgICAgICAgICAgY2xlYXJNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnKTtcXG4gICAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCArICdfZHVvc2VsZWN0Jyk7XFxuICAgICAgICB9LCBzaHNvcnQpKVxcbiAgICAgICAgdmFyIHBvYmogPSB7XFxuICAgICAgICAgICAgJ+WNleaOqCc6IFsn4qa/5Y2V5o6oJywgJzxiPuKmv+WNleaOqDwvYj4nLmZvbnRjb2xvcignIzAwRkE5QScpXSxcXG4gICAgICAgICAgICAn6YCJ5o6oJzogWyfimJHpgInmjqgnLCAnPGI+4piR6YCJ5o6oPC9iPicuZm9udGNvbG9yKCcjNDY4MkI0JyldLFxcbiAgICAgICAgfVxcblxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+KMmCcsXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICB1cmw6ICdoaWtlcjovL2VtcHR5JyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYicsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfljZXmjqgnXVswXSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LCBwb2JqLCB2YXJpKSA9PiB7XFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcih2YXJpICsgJ2ZvbGQnLCAnMScpID09ICcwJykge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlcyA9IHBvYmpbJ+WNleaOqCddO1xcbiAgICAgICAgICAgICAgICB2YXIgcGNmZyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsICd7fScpO1xcbiAgICAgICAgICAgICAgICBwY2ZnWydvYmonXSA9IHBvYmo7XFxuICAgICAgICAgICAgICAgIHZhciDljZXmjqggPSBwY2ZnWyfljZXmjqgnXSA/IHBjZmdbJ+WNleaOqCddIDogZmFsc2U7XFxuXFxuICAgICAgICAgICAgICAgIGlmICjljZXmjqgpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZXNbMF0sXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn5Y2V5o6oJ10gPSBmYWxzZTtcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10ubWFwKCh4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogeC51cmwsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaCcsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyB0aXRsZXNbMV0sXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfpgInmjqgnXVswXSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXSA9IHRydWU7XFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IGZhbHNlO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBsYXlsaXN0ID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10gPSBwbGF5bGlzdDtcXG4gICAgICAgICAgICAgICAgICAgIGZpbmRJdGVtc0J5Q2xzKHNoc29ydCkubWFwKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkcHVzaCA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZ2V0UGFnZVRpdGxlKCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogeC50aXRsZSArICckJyArIHguZXh0cmEuaWRcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJCgnJykubGF6eVJ1bGUoKGRwdXNoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vcGFnZS9wdXNoP3J1bGU9WFlR5o6o6YCBJnB1c2h1cmw9JyArIGVuY29kZVVSSUNvbXBvbmVudChKU09OLnN0cmluZ2lmeShkcHVzaCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkcHVzaClcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCBwY2ZnKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovLycgKyAo5Y2V5o6oID8gJ+WNleaOqOW8gOWQrycgOiAn5Y2V5o6o5YWz6ZetJyk7XFxuICAgICAgICAgICAgfSwgc2hzb3J0LCBwb2JqLCB2YXJpKSxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19wdXNoJyxcXG4gICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQgKyAnX3B1c2h0YWInLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICB0aXRsZTogcG9ialsn6YCJ5o6oJ11bMF0sXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHNoc29ydCwgcG9iaiwgdmFyaSkgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIodmFyaSArICdmb2xkJywgJzEnKSA9PSAnMCcpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lsZXlvIDmiY3og73mk43kvZwnO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHZhciB0aXRsZXMgPSBwb2JqWyfpgInmjqgnXTtcXG4gICAgICAgICAgICAgICAgdmFyIHBjZmcgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCAne30nKTtcXG4gICAgICAgICAgICAgICAgcGNmZ1snb2JqJ10gPSBwb2JqO1xcbiAgICAgICAgICAgICAgICB2YXIg6YCJ5o6oID0gcGNmZ1sn6YCJ5o6oJ10gPyBwY2ZnWyfpgInmjqgnXSA6IGZhbHNlO1xcbiAgICAgICAgICAgICAgICBpZiAo6YCJ5o6oKSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHMnLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IGZhbHNlO1xcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sncGxheWxpc3QnXS5tYXAoKHgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHgudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogeC51cmwsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHRvJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5o6o6YCB5pys6aG1PT5UVkJveCcsXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoc2hzb3J0ICsgJ19kdW9zZWxlY3QnKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNocycsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyB0aXRsZXNbMV0sXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn6YCJ5o6oJ10gPSB0cnVlO1xcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn5Y2V5o6oJ10gPSBmYWxzZTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbGF5bGlzdCA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWydwbGF5bGlzdCddID0gcGxheWxpc3Q7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgSWRzID0gcGxheWxpc3QubWFwKGl0ID0+IGl0LmV4dHJhLmlkKTtcXG4gICAgICAgICAgICAgICAgICAgIElkcy5mb3JFYWNoKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IGZpbmRJdGVtKHgpLnRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQubXNtKHRpdGxlLCB4LCBzaHNvcnQpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaCcsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcG9ialsn5Y2V5o6oJ11bMF0sXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2h0bycsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aOqOmAgemAieS4rT0+VFZCb3gnLFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19wdXNoY2ZnJywgcGNmZyk7XFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKOmAieaOqCA/ICfpgInmjqjlvIDlkK8nIDogJ+mAieaOqOWFs+mXrScpO1xcbiAgICAgICAgICAgIH0sIHNoc29ydCwgcG9iaiwgdmFyaSksXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfcHVzaHMnLFxcbiAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYidcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLmjqjpgIHmnKzpobU9PlRWQm94XFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LCB2YXJpKSA9PiB7XFxuICAgICAgICAgICAgICAgIHZhciBwY2ZnID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19wdXNoY2ZnJywgJ3t9Jyk7XFxuICAgICAgICAgICAgICAgIHZhciDljZXmjqggPSBwY2ZnWyfljZXmjqgnXSA/IHBjZmdbJ+WNleaOqCddIDogZmFsc2U7XFxuICAgICAgICAgICAgICAgIHZhciDpgInmjqggPSBwY2ZnWyfpgInmjqgnXSA/IHBjZmdbJ+mAieaOqCddIDogZmFsc2U7XFxuICAgICAgICAgICAgICAgIGlmICgh5Y2V5o6oICYmICHpgInmjqgpIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0YWJzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ190YWJzJywgJ1tdJyk7XFxuICAgICAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwbHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCAnW10nKS5tYXAobGkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGkubWFwKGl0ZW0gPT4gaXRlbS50aXRsZSArICckJyArIGl0ZW0udXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpKS5qb2luKCcjJylcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KS5qb2luKCckJCQnKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2gge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBwbHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFwiX2xpc3RcXFwiLCAnW10nKS5tYXAoeCA9PiB4LnRpdGxlICsgXFxcIiRcXFwiICsgeC51cmwpLmpvaW4oXFxcIiNcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGFicyA9IFt0YWJzW2dldE15VmFyKHZhcmksICcwJyldXTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIC8qbG9nKHBscylcXG4gICAgICAgICAgICAgICAgICAgIGxvZyh0YWJzKSovXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKOmAieaOqCkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBscyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArIFxcXCJfZHVvc2VsZWN0XFxcIiwgJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXCIkXFxcIiArIHgudXJsKS5qb2luKFxcXCIjXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBpZiAocGxzLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+mAieaLqeS4uuepuic7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB2YXIgdGFicyA9IFsn5pKt5pS+5YiX6KGoJ107XFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgdmFyIGluZm8gPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfaW5mbycsICd7fScpO1xcbiAgICAgICAgICAgICAgICB2YXIgZGVzYyA9IGluZm9bJ2Rlc2MnXTtcXG4gICAgICAgICAgICAgICAgdmFyIOaOqOmAgSA9IHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJuYW1lXFxcIjogZ2V0UGFnZVRpdGxlKCksXFxuICAgICAgICAgICAgICAgICAgICBcXFwiY29udGVudFxcXCI6IGRlc2MgfHwgJycsXFxuICAgICAgICAgICAgICAgICAgICBcXFwicGljXFxcIjogaW5mb1snaW1nJ10gfHwgJycsXFxuICAgICAgICAgICAgICAgICAgICBcXFwiZnJvbVxcXCI6IHRhYnMuam9pbignJCQkJyksXFxuICAgICAgICAgICAgICAgICAgICBcXFwidXJsXFxcIjogcGxzLFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vbG9nKOaOqOmAgSlcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvcHVzaD9ydWxlPVhZUeaOqOmAgSZwdXNodXJsPVxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQoSlNPTi5zdHJpbmdpZnko5o6o6YCBKSlcXG4gICAgICAgICAgICB9LCBzaHNvcnQsIHZhcmkpLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX3B1c2h0bycsXFxuICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ19wdXNodGFiJ1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2JsYW5rX2Jsb2NrJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYicsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfSxcXG4gICAgc2V0TG9uZ2NsaWNrOiBmdW5jdGlvbihzaHNvcnQsIGN1c3RvbSkge1xcbiAgICAgICAgcmV0dXJuIFt7XFxuICAgICAgICAgICAgdGl0bGU6ICfmoLflvI/wn46oJyxcXG4gICAgICAgICAgICBqczogJC50b1N0cmluZygoc2hzb3J0KSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBhbGxfY29scyA9IFsnJ10uY29uY2F0KGdldENvbFR5cGVzKCkpO1xcbiAgICAgICAgICAgICAgICBhbGxfY29scyA9IGFsbF9jb2xzLmZpbHRlcih4ID0+XFxuICAgICAgICAgICAgICAgICAgICAvKHRleHRffGZsZXgpLiovLnRlc3QoeCkgJiYgeCAhPSAndGV4dF9pY29uJyk7XFxuICAgICAgICAgICAgICAgIC8vbG9nKGFsbF9jb2xzKVxcbiAgICAgICAgICAgICAgICBsZXQgY2xzID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpIHx8XFxuICAgICAgICAgICAgICAgICAgICAnJztcXG4gICAgICAgICAgICAgICAgaWYgKGNsc1tzaHNvcnRdICE9ICcnKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb2wgPSBjbHNbc2hzb3J0XS5jb2xfdHlwZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBsZXQg5oyJ6ZKu5qC35byPID0gYWxsX2NvbHMubWFwKChpdCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGl0ID09PSBjb2wgPyAn8J+RiScgKyBpdCA6IGl0O1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpcHMgPSAn6K+36YCJ5oup6YCJ6ZuG5oyJ6ZKu5qC35byPJztcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQo5oyJ6ZKu5qC35byPLCAyLCB0aXBzKS5zZWxlY3QoKHNoc29ydCwgY2xzKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBpbnB1dCA9IGlucHV0LnJlcGxhY2UoL/CfkYkvZywgJycpO1xcbiAgICAgICAgICAgICAgICAgICAgLypzdG9yYWdlMC5zZXRJdGVtKCfmjInpkq7moLflvI8nLCBpbnB1dCk7Ki9cXG4gICAgICAgICAgICAgICAgICAgIGxldCBvbGRJZHMgPSAoZmluZEl0ZW1zQnlDbHMoc2hzb3J0KSB8fCBbXSkubWFwKGl0ID0+IGl0LmV4dHJhLmlkKTsgLy/ogIHlhYPntKBpZHNcXG4gICAgICAgICAgICAgICAgICAgIG9sZElkcy5mb3JFYWNoKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogaW5wdXRcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3suWIh+aNoumAiembhuaMiemSruagt+W8j+S4ujonICsgaW5wdXQ7XFxuICAgICAgICAgICAgICAgIH0sIHNoc29ydCwgY2xzKTtcXG4gICAgICAgICAgICB9LCBzaHNvcnQsIGN1c3RvbSlcXG4gICAgICAgIH1dXFxuICAgIH0sXFxuICAgIHNldFRhYnM6IGZ1bmN0aW9uKHRhYnMsIHZhcmksIHNoc29ydCwgcGFyc2UpIHtcXG4gICAgICAgIGxldCBjdXN0b20gPSBwYXJzZS7oh6rlrprkuYk7XFxuICAgICAgICBjdXN0b20gPSB0aGlzLmdldFByZXNldChjdXN0b20pO1xcbiAgICAgICAgc2hzb3J0ID0gc2hzb3J0ID8gc2hzb3J0IDogJ3Noc29ydCc7XFxuICAgICAgICB2YXIgdGl0bGUgPSAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKSA9PSAnMScpID8gJzxiPjxzcGFuIHN0eWxlPVxcXCJjb2xvcjogJyArIGN1c3RvbS7pgIbluo/popzoibIgKyAnXFxcIj7pgIbluo88L3NwYW4+PC9iPicgOiAnPGI+PHNwYW4gc3R5bGU9XFxcImNvbG9yOiAnICsgY3VzdG9tLuato+W6j+minOiJsiArICdcXFwiPuato+W6jzwvc3Bhbj48L2I+J1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogdmFyaSArICc6JyArIHRpdGxlLFxcbiAgICAgICAgICAgIGRlc2M6ICflhbEnICsgU3RyaW5nKHRhYnMubGVuZ3RoKS5mb250Y29sb3IoJyM0NjgyQjQnKSArICfmnaHnur/ot68nLFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LCB2YXJpLCBjdXN0b20pID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGNvbmYgPSBnZXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpO1xcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoJ2VyXycgKyB2YXJpICsgJ2ZvbGQnLCAnMScpID09ICcwJykge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIGNsc2xpc3RzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgdmFyIG5ld2Nsc2xpc3QgPSAkLmRhdGFDb252ZXJ0KGNsc2xpc3RzKTtcXG5cXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlcyA9IFtgJHtjdXN0b20u5q2j5bqP6aKc6ImyfVxcXCI+5q2j5bqPYCwgYCR7Y3VzdG9tLumAhuW6j+minOiJsn1cXFwiPumAhuW6j2BdO1xcblxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgbmV3Y2xzbGlzdC5yZXZlcnNlKCk7XFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihzaHNvcnQgKyAnX2xpbmUnLCBuZXdjbHNsaXN0KTtcXG5cXG4gICAgICAgICAgICAgICAgdmFyIG9iaiA9IGZpbmRJdGVtKHNoc29ydCArICdfYXZhdGFyJylcXG5cXG4gICAgICAgICAgICAgICAgaWYgKGNvbmYgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMV0sIHRpdGxlc1swXSksXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1swXSwgdGl0bGVzWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMScpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/liIfmjaLmjpLluo/miJDlip8nO1xcbiAgICAgICAgICAgIH0sIHNoc29ydCwgdmFyaSwgY3VzdG9tKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcicsXFxuICAgICAgICAgICAgaW1nOiBjdXN0b20u5Zu+5qCHLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX2F2YXRhcicsXFxuICAgICAgICAgICAgICAgIGxvbmdDbGljazogdGhpcy5zZXRMb25nY2xpY2soc2hzb3J0KSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgdmFyIOaKmOWPoCA9ICfigJzigJzigJ3igJ08Yj4nICsgJ+KYtycuZm9udGNvbG9yKFxcXCIjRDNEM0QzXFxcIik7XFxuICAgICAgICB2YXIg5bGV5byAID0gJ+KAnOKAnOKAneKAnTxiPicgKyAn4piwJy5mb250Y29sb3IoXFxcIiNGRkE1MDBcXFwiKTtcXG4gICAgICAgIHZhciBmb2xkbmFtZSA9ICdlcl8nICsgdmFyaSArICdmb2xkJztcXG4gICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuICAgICAgICBpZiAodHlwZW9mKHBhcnNlWyfmjqjpgIEnXSkgIT0gJ3VuZGVmaW5lZCcgJiYgcGFyc2VbJ+aOqOmAgSddKVxcbiAgICAgICAgICAgIHRoaXMucHVzaFRhYignZXJfJyArIHZhcmksIHNoc29ydCk7XFxuXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBmb2xkID09PSAnMCcgPyDmipjlj6AgOiDlsZXlvIAsXFxuICAgICAgICAgICAgY29sX3R5cGU6IGN1c3RvbS7nur/ot6/moLflvI8sXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChmb2xkbmFtZSwgc2hzb3J0KSA9PiB7XFxuICAgICAgICAgICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXG4gICAgICAgICAgICAgICAgdmFyIGJ0biA9IGZpbmRJdGVtKHNoc29ydCArICdfYnV0dG9uJyk7XFxuICAgICAgICAgICAgICAgIHZhciBmb2xkcyA9IFsnPGZvbnQgY29sb3I9XFxcIiNEM0QzRDNcXFwiPuKYtycsICc8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJ107XFxuXFxuICAgICAgICAgICAgICAgIGlmIChmb2xkID09ICcwJykge1xcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgY3MgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2NscycpO1xcbiAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKG9iai5leHRyYS5pZCwgY3MpO1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMF0sIGZvbGRzWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgJzAnKTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwY2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjeCA9ICQuZGF0YUNvbnZlcnQocGNscyk7XFxuICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2NscycsIGN4KTtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMV0sIGZvbGRzWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovLycgKyAoZm9sZCA9PT0gJzEnID8gJ+aUtui1tycgOiAn5bGV5byAJyk7XFxuICAgICAgICAgICAgfSwgZm9sZG5hbWUsIHNoc29ydCksXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYnV0dG9uJyxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgdGhpcy5jcmVhdGVQTGlzdCh0YWJzLCB2YXJpLCBzaHNvcnQsIGN1c3RvbSk7XFxuICAgIH0sXFxuICAgIHNldFRhYnMyOiBmdW5jdGlvbih0YWJzLCB2YXJpLCBzaHNvcnQsIHBhcnNlLCBleHApIHtcXG4gICAgICAgIGxldCBjdXN0b20gPSBwYXJzZS7oh6rlrprkuYk7XFxuICAgICAgICBjdXN0b20gPSB0aGlzLmdldFByZXNldChjdXN0b20pO1xcblxcbiAgICAgICAgc2hzb3J0ID0gc2hzb3J0ID8gc2hzb3J0IDogJ3Noc29ydCc7XFxuICAgICAgICB2YXIgdGl0bGUgPSAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKSA9PSAnMScpID8gJzxiPjxzcGFuIHN0eWxlPVxcXCJjb2xvcjonICsgY3VzdG9tLumAhuW6j+minOiJsiArICdcXFwiPumAhuW6jzwvc3Bhbj48L2I+JyA6ICc8Yj48c3BhbiBzdHlsZT1cXFwiY29sb3I6JyArIGN1c3RvbS7mraPluo/popzoibIgKyAnXFxcIj7mraPluo88L3NwYW4+PC9iPidcXG5cXG4gICAgICAgIHZhciDmipjlj6AgPSAnPGI+5oqY5Y+gJyArICfimLcnLmZvbnRjb2xvcihcXFwiI0QzRDNEM1xcXCIpO1xcbiAgICAg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xcblxcbiAgICAgICAgICAgICAgICBpZiAocHVzaCkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQgKyAnX3B1c2h0YWInKTtcXG4gICAgICAgICAgICAgICAgICAgIGNzID0gcGNscy5jb25jYXQoY3MpO1xcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIHZhciBjeCA9ICQuZGF0YUNvbnZlcnQoY3MpO1xcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2NscycsIGN4KTtcXG4gICAgICAgICAgICAgICAgaWYgKHB1c2gpIHtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQgKyAnX3B1c2h0YWInKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKGJjbHMuZXh0cmEuaWQpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0ob2JqLmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBvYmouZGVzYy5yZXBsYWNlKCflsZXlvIA8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJywgJ+aKmOWPoDxmb250IGNvbG9yPVxcXCIjRDNEM0QzXFxcIj7imLcnKSxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzAnKSB7XFxuICAgICAgICAgICAgICAgIHZhciBjcyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfY2xzJyk7XFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihzaHNvcnQgKyAnX2F2YXRhcicsIGNzKTtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShvYmouZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IG9iai5kZXNjLnJlcGxhY2UoJ+aKmOWPoDxmb250IGNvbG9yPVxcXCIjRDNEM0QzXFxcIj7imLcnLCAn5bGV5byAPGZvbnQgY29sb3I9XFxcIiNGRkE1MDBcXFwiPuKYsCcpLFxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgZm9sZCA9PT0gJzEnID8gJzAnIDogJzEnKTtcXG4gICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyArIChmb2xkID09PSAnMScgPyAn5pS26LW3JyA6ICflsZXlvIAnKTtcXG4gICAgICAgIH0sIGZvbGRuYW1lLCBzaHNvcnQsIChwYXJzZVsn5o6o6YCBJ10gPyB0cnVlIDogZmFsc2UpKTtcXG4gICAgICAgIHZhciBkZXNjID0gKGZvbGQgPT09ICcwJyA/IOaKmOWPoCA6IOWxleW8gCkgKyAnXFxcXHQnO1xcblxcbiAgICAgICAgaWYgKGV4cC5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICAgIHVybCA9ICdoaWtlcjovL2VtcHR5JztcXG4gICAgICAgICAgICBkZXNjID0gJyc7XFxuICAgICAgICB9XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiB2YXJpICsgJzpcXFxcdFxcXFx0JyArICflhbEnICsgU3RyaW5nKHRhYnMubGVuZ3RoKS5mb250Y29sb3IoJyM0NjgyQjQnKSArICfmnaHnur/ot68nLFxcbiAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdhdmF0YXInLFxcbiAgICAgICAgICAgIGltZzogY3VzdG9tLuWbvuaghyxcXG4gICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19hdmF0YXInLFxcbiAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IHRoaXMuc2V0TG9uZ2NsaWNrKHNoc29ydCksXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmICh0eXBlb2YocGFyc2VbJ+aOqOmAgSddKSAhPSAndW5kZWZpbmVkJyAmJiBwYXJzZVsn5o6o6YCBJ10pXFxuICAgICAgICAgICAgdGhpcy5wdXNoVGFiKCdlcl8nICsgdmFyaSwgc2hzb3J0KTtcXG5cXG4gICAgICAgIGlmIChmb2xkID09ICcwJykge1xcbiAgICAgICAgICAgIHJldHVyblxcbiAgICAgICAgfVxcblxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyB0aXRsZSxcXG4gICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHZhcmksIHNoc29ydCwgY3VzdG9tKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBjb25mID0gZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgICAgICAgICAgdmFyIGNsc2xpc3RzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgdmFyIG5ld2Nsc2xpc3QgPSAkLmRhdGFDb252ZXJ0KGNsc2xpc3RzKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgIG5ld2Nsc2xpc3QucmV2ZXJzZSgpO1xcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywgbmV3Y2xzbGlzdCk7XFxuXFxuICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2J1dHRvbicpXFxuICAgICAgICAgICAgICAgIHZhciB0aXRsZXMgPSBbYCR7Y3VzdG9tLuato+W6j+minOiJsn1cXFwiPuato+W6j2AsIGAke2N1c3RvbS7pgIbluo/popzoibJ9XFxcIj7pgIbluo9gXTtcXG5cXG4gICAgICAgICAgICAgICAgaWYgKGNvbmYgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYnV0dG9uJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMV0sIHRpdGxlc1swXSksXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19idXR0b24nLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1swXSwgdGl0bGVzWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMScpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5o6S5bqP5oiQ5YqfJ1xcbiAgICAgICAgICAgIH0sIHZhcmksIHNoc29ydCwgY3VzdG9tKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogY3VzdG9tLue6v+i3r+agt+W8jyxcXG4gICAgIC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G4gICAgICAgIGZvciAodmFyIGogaW4gbGlzdCkge1xcbiAgICAgICAgICAgIGxldCBsdCA9IHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGxpc3Rbal0udGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogbGlzdFtqXS51cmwsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiDmoLflvI8sXFxuICAgICAgICAgICAgICAgIHBpYzog5Zu+5qCHLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGxpc3Rbal0udXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQsICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICBsdFsnZXh0cmEnXSA9IE9iamVjdC5hc3NpZ24oe30sIGx0WydleHRyYSddLCBleHRyYSk7XFxuICAgICAgICAgICAgZC5wdXNoKGx0KTtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAgZXZhbFJlOiBmdW5jdGlvbihpbnB1dCwg5Ye95pWwKSB7XFxuICAgICAgICBsZXQgcmVzdWx0ID0gaW5wdXQ7XFxuICAgICAgICByZXN1bHQgPSBldmFsKCdpbnB1dCcgKyDlh73mlbApO1xcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcXG4gICAgfSxcXG4gICAgZ2V0VGFiczogZnVuY3Rpb24ocGFyc2UpIHtcXG4gICAgICAgIHZhciB0YWJzID0gW107XFxuICAgICAgICB2YXIgYXJ0cyA9IFtdO1xcbiAgICAgICAgaWYgKHR5cGVvZiBwYXJzZS7nur/ot68gPT0gJ29iamVjdCcpIHtcXG4gICAgICAgICAgICBhcnRzID0gcGFyc2Uu57q/6LevO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGFydHMubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICBhcnRzID0gcGRmYShodG1sLCBwYXJzZS7nur/ot68pO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIOe6v+i3r+WQjSA9IHBhcnNlLue6v+i3r+WQjeensDtcXG4gICAgICAgIHZhciDmm7/mjaLlh73mlbAgPSAnJztcXG4gICAgICAgIGlmIChwYXJzZS7nur/ot6/lkI3np7AuaW5jbHVkZXMoJ0BAJykpIHtcXG4gICAgICAgICAgICDnur/ot6/lkI0gPSBwYXJzZS7nur/ot6/lkI3np7Auc3BsaXQoJ0BAJylbMF07XFxuICAgICAgICAgICAg5pu/5o2i5Ye95pWwID0gcGFyc2Uu57q/6Lev5ZCN56ewLnNwbGl0KCdAQCcpWzFdO1xcbiAgICAgICAgfVxcbiAgICAgICAgZm9yICh2YXIgaSBpbiBhcnRzKSB7XFxuICAgICAgICAgICAgbGV0IGxpbmVuYW1lID0gJyc7XFxuICAgICAgICAgICAgaWYgKOe6v+i3r+WQjSA9PSAnJykge1xcbiAgICAgICAgICAgICAgICBsaW5lbmFtZSA9IGFydHNbaV07XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgbGluZW5hbWUgPSBwZGZoKGFydHNbaV0sIOe6v+i3r+WQjSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICjmm7/mjaLlh73mlbAgIT0gJycpIHtcXG4gICAgICAgICAgICAgICAgbGluZW5hbWUgPSB0aGlzLmV2YWxSZShsaW5lbmFtZSwg5pu/5o2i5Ye95pWwKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGFicy5wdXNoKGxpbmVuYW1lKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiB0YWJzO1xcbiAgICB9LFxcbiAgICBnZXRMaXN0czogZnVuY3Rpb24ocGFyc2UsIHNoc29ydCkge1xcbiAgICAgICAgc2hzb3J0ID0gc2hzb3J0ID8gc2hzb3J0IDogJ3Noc29ydCc7XFxuICAgICAg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gY29udHMpIHtcXG4gICAgICAgICAgICBpZiAocGFyc2Uu6YCJ6ZuG5YiX6KGoICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICBpZiAocGFyc2Uu6YCJ6ZuG5YiX6KGoID09ICdvYmplY3QnKSB7XFxuICAgICAgICAgICAgICAgICAgICBsaXN0cy5wdXNoKGNvbnRzW2ldLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogeC50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCArIOino+aekCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9KSlcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxpc3RzLnB1c2gocGRmYShjb250c1tpXSwgcGFyc2Uu6YCJ6ZuG5YiX6KGoKS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoeCwg6YCJ6ZuG5ZCN56ewKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBwZCh4LCDpgInpm4bpk77mjqUpICsg6Kej5p6QLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdmFyIHVybCA9IHBkKGNvbnRzW2ldLCDpgInpm4bpk77mjqUpO1xcbiAgICAgICAgICAgICAgICBpZiAoIemAiembhumTvuaOpS5pbmNsdWRlcygnaHJlZicpKSB7XFxuICAgICAgICAgICAgICAgICAgICB1cmwgPSBwZGZoKGNvbnRzW2ldLCDpgInpm4bpk77mjqUpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IHBkZmgoY29udHNbaV0sIOmAiembhuWQjeensCk7XFxuICAgICAgICAgICAgICAgIHRpdGxlID0g5pu/5o2i5Ye95pWwICE9ICcnID8gdGhpcy5ldmFsUmUodGl0bGUsIOabv+aNouWHveaVsCkgOiB0aXRsZTtcXG4gICAgICAgICAgICAgICAgdGVtcC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsICsg6Kej5p6QLFxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGxldCDlgJLluo8gPSBwYXJzZS7lgJLluo8gPyBwYXJzZS7lgJLluo8gOiBmYWxzZTtcXG4gICAgICAgIHZhciByZXN1bHRzID0gbGlzdHMubGVuZ3RoID8gbGlzdHMgOiBbdGVtcF07XFxuICAgICAgICBpZiAo5YCS5bqPKSB7XFxuICAgICAgICAgICAgcmVzdWx0cyA9IHJlc3VsdHMubWFwKHggPT4geC5yZXZlcnNlKCkpO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcbiAgICAgICAgaWYgKHJlc3VsdHMuc29tZSh4ID0+IHgubGVuZ3RoID4gMCkpIHtcXG4gICAgICAgICAgICBpZiAoIXBsaXN0Lmhhc093blByb3BlcnR5KHNoc29ydCkpIHtcXG4gICAgICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XSA9IHt9O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydsZW5ndGgnXSA9IHJlc3VsdHMubGVuZ3RoO1xcbiAgICAgICAgfTtcXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9wbGF5bGlzdHMnLCBwbGlzdCk7XFxuICAgICAgICByZXR1cm4gcmVzdWx0cztcXG4gICAgfSxcXG4gICAgZ2V0UGxheWVyczogZnVuY3Rpb24ocGFyc2UsIG1vZGUsIGZ1bmMpIHtcXG4gICAgICAgIC8vbG9nKG1vZGUpXFxuICAgICAgICB2YXIgcGxheSA9ICdlcl9wbGF5bGlzdF8nO1xcbiAgICAgICAgdGhpcy5wcmVMb2FkKGZ1bmMpO1xcbiAgICAgICAgdGhpcy5jbG9zZShwYXJzZS5tYXAoeCA9PiB4Luexu+WeiyksIHBhcnNlLmxlbmd0aCk7XFxuICAgICAgICBtb2RlID0gbW9kZSA/IG1vZGUgOiAxO1xcblxcbiAgICAgICAgbGV0IHBlID0gWzFdO1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBwZSA9IHBhcnNlLm1hcCh4ID0+IHBkZmEoaHRtbCwgeC7nur/ot68pLmxlbmd0aCkuZmlsdGVyKHkgPT4geSA+IDApO1xcbiAgICAgICAgfSBjYXRjaCB7fVxcblxcblxcbiAgICAgICAgcGFyc2UuZm9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcbiAgICAgICAgICAgIHZhciB0YWJzID0gWyfkuLvnur8nXTtcXG4gICAgICAgICAgICBpZiAoaXRlbS7nur/ot68gIT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIHRhYnMgPSB0aGlzLmdldFRhYnMoaXRlbSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHB1dE15VmFyKHBsYXkgKyBpICsgJ190YWJzJywgdGFicyk7XFxuICAgICAgICAgICAgaWYgKGl0ZW0uQWpheCkge1xcbiAgICAgICAgICAgICAgICBpZiAobW9kZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhYnModGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLCBpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFiczIodGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLCBpdGVtLCBwZSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2VyX2h0bWwnLCBodG1sKTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2VyX3VybCcsIE1ZX1VSTCk7XFxuXFxuICAgICAgICAgICAgICAgIHZhciBsaXN0cyA9IGZ1bmMoZ2V0TXlWYXIoJ2VyXycgKyBpdGVtLuexu+WeiywgJzAnKSwgTVlfVVJMKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHMgPSB0aGlzLmdldExpc3RzKGl0ZW0sIHBsYXkgKyBpKTtcXG5cXG5cXG4gICAgICAgICAgICAgICAgaWYgKGxpc3RzLnNvbWUoeCA9PiB4Lmxlbmd0aCA+IDApKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAobW9kZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzKHRhYnMsIGl0ZW0u57G75Z6LLCBwbGF5ICsgaSwgaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFiczIodGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLCBpdGVtLCBwZSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKCdlcl8nICsgaXRlbS7nsbvlnosgKyAnZm9sZCcsICcxJykgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgIHRoaXMuc2V0TGlzdHMobGlzdHMsIGdldE15VmFyKCdlcl8nICsgaXRlbS7nsbvlnossICcwJyksIHBsYXkgKyBpLCBpdGVtKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdibGFua19ibG9jaydcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSlcXG4gICAgfVxcbn1cXG5cXG5cXG5sZXQgTWV0aG9kcyA9IHtcXG4gICAgLy/lpJrpgInmqKHlnZdcXG4gICAgTXVsdGlTZWxlY3RNb2RlOiBmdW5jdGlvbihuYW1lLCBpZCwgc2hzb3J0KSB7XFxuICAgICAgICByZXR1cm4gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZGF0YXRpdGxlLCBkYXRhdXJsLCBzaHNvcnQpID0+IHtcXG4gICAgICAgICAgICBmdW5jdGlvbiB1bmlxdWUoYXJyKSB7XFxuICAgICAgICAgICAgICAgIGNvbnN0IHJlcyA9IG5ldyBNYXAoKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gYXJyLmZpbHRlcigoYSkgPT4gIXJlcy5oYXMoYS51cmwpICYmIHJlcy5zZXQoYS51cmwsIDEpKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgZHVvc2VsZWN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgXFxcIl9kdW9zZWxlY3RcXFwiKSA/IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArIFxcXCJfZHVvc2VsZWN0XFxcIikgOiBbXTtcXG4gICAgICAgICAgICBpZiAoZHVvc2VsZWN0LmZpbmRJbmRleCh4ID0+IHgudXJsID09PSBkYXRhdXJsKSA9PSAtMSkge1xcbiAgICAgICAgICAgICAgICBkdW9zZWxlY3QucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogZGF0YXRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBkYXRhdXJsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIGR1b3NlbGVjdCA9IHVuaXF1ZShkdW9zZWxlY3QpXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oZGF0YXVybCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGDigJzigJzigJ3igJ08c3BhbiBzdHlsZT1cXFwiY29sb3I6I0ZGNTczM1xcXCI+YCArIGRhdGF0aXRsZSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgZnVuY3Rpb24gcmVtb3ZlQnlWYWx1ZShhcnIsIHZhbCkge1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXJyW2ldWyd1cmwnXSA9PSB2YWwpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyLnNwbGljZShpLCAxKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlbW92ZUJ5VmFsdWUoZHVvc2VsZWN0LCBkYXRhdXJsKVxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGRhdGF1cmwsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBkYXRhdGl0bGVcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArIFxcXCJfZHVvc2VsZWN0XFxcIiwgZHVvc2VsZWN0KTtcXG4gICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICB9LCBuYW1lLCBpZCwgc2hzb3J0KVxcbiAgICB9LFxcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixc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aWFibGUgIT09IFxcXCJib29sZWFuXFxcIikge1xcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLlvIDlkK/mipjlj6Dor7fkvKDlhaXluIPlsJTlgLxcXFwiKTtcXG4gICAgICB9XFxuICAgIH0sXFxuICAgIOa4hemZpChsaXN0KSB7XFxuICAgICAgaWYgKHRoaXMuaXNOdWxsKGxpc3QpKSB7XFxuICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICB9XFxuICAgICAgaWYgKGxpc3QuY29uc3RydWN0b3IgPT0gU3RyaW5nKSB7XFxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIua4hemZpOaKpemUmTror7fkvKDliJfooahcXFwiKTtcXG4gICAgICB9XFxuICAgICAgdGhpcy5jbGVhcnMgPSBsaXN0O1xcbiAgICAgIHJldHVybiB0aGlzO1xcbiAgICB9LFxcbiAgICDlhajmuIUobGlzdCkge1xcbiAgICAgIGlmICh0aGlzLmlzTnVsbChsaXN0KSkge1xcbiAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgfVxcbiAgICAgIHZhciBjID0gdGhpcy5jbGVhcmFsbDtcXG4gICAgICBsaXN0ID0gYy5jb25jYXQobGlzdCk7XFxuICAgICAgdGhpcy5jbGVhcmFsbCA9IGxpc3Q7XFxuICAgICAgcmV0dXJuIHRoaXM7XFxuICAgIH0sXFxuICAgIOa6kOeggShpbnB1dCkge1xcbiAgICAgIHRoaXMuaHRtbCA9IGlucHV0O1xcbiAgICAgIHJldHVybiB0aGlzO1xcbiAgICB9LFxcbiAgICDnlYzpnaIoaW5wdXQpIHtcXG4gICAgICB0aGlzLmxheW91dCA9IGlucHV0O1xcbiAgICAgIHJldHVybiB0aGlzO1xcbiAgICB9LFxcbiAgICDpobXnoIEoaW5wdXQpIHtcXG4gICAgICB0aGlzLnBhZ2UgPSBpbnB1dDtcXG4gICAgICByZXR1cm4gdGhpcztcXG4gICAgfSxcXG4gICAg54q25oCBKGlucHV0KSB7XFxuICAgICAgdGhpcy5zdGF0ZSA9IGlucHV0O1xcbiAgICAgIHJldHVybiB0aGlzO1xcbiAgICB9LFxcbiAgICDlvIDlkK/mkJzntKIoKSB7XFxuICAgICAgdGhpcy5zZWFyY2ggPSB0cnVlO1xcbiAgICAgIHJldHVybiB0aGlzO1xcbiAgICB9LFxcbiAgICDlvIDlkK/mipjlj6AoaW5wdXQpIHtcXG4gICAgICBpZiAoaW5wdXQgPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICBpbnB1dCA9IHRydWU7XFxuICAgICAgfVxcbiAgICAgIHRoaXMuaXNCb29sZWFuKGlucHV0KTtcXG4gICAgICB0aGlzLm9wZW4gPSBpbnB1dDtcXG4gICAgICByZXR1cm4gdGhpcztcXG4gICAgfSxcXG4gICAgc2V0VGl0bGUoaywgaSwgdCkge1xcbiAgICAgIHJldHVybiBrID09IGkgPyBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIHQuZm9udGNvbG9yKHRoaXMu5YiG57G76aKc6ImyKSA6IHQ7XFxuICAgIH0sXFxuICAgIGFjdGlvbihvYmopIHtcXG4gICAgICByZXR1cm4gW1xcbiAgICAgICAge1xcbiAgICAgICAgICB0aXRsZTogXFxcIua4hemZpOeKtuaAgVxcXCIsXFxuICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChvYmopID0+IHtcXG4gICAgICAgICAgICBsb2cob2JqKTtcXG4gICAgICAgICAgICBjbGVhck15VmFyKG9iai5zdGF0ZSk7XFxuICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiaGVhZC5jYXRlXFxcIik7XFxuICAgICAgICAgICAgb2JqLmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIG9iai5jbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICA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AgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBzbGlzdCA9IHBkZmEocywgeC7lsI/nsbspO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIHZhciDlrprkvY0gPSBzbGlzdC5tYXAoKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLmdldFRpdGxlKGl0ZW0sIHgu5qCH6aKYKTtcXG4gICAgICAgICAgICB2YXIgdXJsID0gdGhpcy5nZXRVcmwoaXRlbSwgeCk7XFxuICAgICAgICAgICAgdmFyIG9iaiA9IHsgdGl0bGU6IHRpdGxlLCB1cmw6IHVybCB9O1xcbiAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShvYmopO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgcmV0dXJuIOWumuS9jTtcXG4gICAgICAgIH0pO1xcbiAgICAgICAgLy9sb2co5LiA57qnKVxcbiAgICAgICAgLy9sb2co5LiA57qnLmxlbmd0aClcXG4gICAgICAgIGlmICjkuIDnuqcubGVuZ3RoID09IDEpIHtcXG4gICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKOS4gOe6py5qb2luKFxcXCJcXFxcblxcXCIpKTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgIOS4gOe6py5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKGl0ZW0uam9pbihcXFwiLFxcXCIpKTtcXG4gICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZyhjYXRlZ29yaWVzKVxcbiAgICAgIH0pO1xcbiAgICAgIGlmICjmipjlj6DnirbmgIEpIHtcXG4gICAgICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogZm9sZCA9PT0gXFxcIjFcXFwiID8g5oqY5Y+gIDog5bGV5byALFxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZShcXG4gICAgICAgICAgICAgIChmb2xkLCB1LCBhbGwpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoTVlfUlVMRS5ncm91cCwgZm9sZCA9PT0gXFxcIjFcXFwiID8gXFxcIjBcXFwiIDogXFxcIjFcXFwiKTtcXG4gICAgICAgICAgICAgICAgLyphbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0pOyovXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICBmb2xkLFxcbiAgICAgICAgICAgICAg54q25oCBLFxcbiAgICAgICAgICAgICAg5YWo5riFXFxuICAgICAgICAgICAgKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICBsb25nQ2xpY2s6IHRoaXMuYWN0aW9uKHtcXG4gICAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXG4gICAgICAgICAgICAgICAgYWxsOiDlhajmuIUsXFxuICAgICAgICAgICAgICAgIGNsOiDmuIXpmaQsXFxuICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICB9XFxuICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgIGNhdGVnb3JpZXMuZm9yRWFjaCgoY2F0ZWdvcnksIGluZGV4KSA9PiB7XFxuICAgICAgICAvL2xvZyhjYXRlZ29yaWVzKVxcbiAgICAgICAgbGV0IHN1Yl9jYXRlZ29yaWVzID0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gICAgICAganNvbiA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgIFxcbiAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxuICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgIGNsZWFyczog5riF6ZmkLFxcbiAgICAgICAgICAgICAganNvbjoganNvbixcXG4gICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXG4gICAgICAgICAgICB9O1xcblxcbiAgICAgICAgICAgIC8vbGV0IHVybCA9IHBkKGl0ZW0sIF/lpKfnsbvpk77mjqUpO1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAvKmlmICjlpKfnsbvlpITnkIYpIHtcXG4gICAgICAgICAgICAgIHVybCA9IOS4gOe6p+WIhuexu+WkhOeQhih1cmwpO1xcbiAgICAgICAgICAgIH0qL1xcbiAgICAgICAgICAgIC8vbG9nKHVybClcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICB1cmw6ICQoXFxcImhpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IG5ld19jYXRlID0gW107XFxuICAgICAgICAgICAgICAgIHBhcmFtcy5jbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcC5mb3JFYWNoKChjYXRlLCBpbmRleCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIG5ld19jYXRlLnB1c2goaW5kZXggPT09IDAgPyBwYXJhbXMua2V5LnRvU3RyaW5nKCkgOiBcXFwiMFxcXCIpO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIsIEpTT04uc3RyaW5naWZ5KG5ld19jYXRlKSk7XFxuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImR0X1xcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICAgICAgICB9LCBwYXJhbXMpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIixcXG4gICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2UgaWYgKGZvbGQgPT09IFxcXCIxXFxcIiB8fCDmipjlj6DnirbmgIEgPT0gZmFsc2UpIHtcXG4gICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxuICAgICAgICAgICAgdmFyIGV4dHJhcG9zID0gZmFsc2U7XFxuICAgICAgICAgICAgLyppZiAoaXRlbS5pbmNsdWRlcygndHlwZT1cXFwiQGV4dHJhXFxcIicpKSB7XFxuICAgICAgICAgICAgICBleHRyYXBvcyA9IHRydWU7XFxuICAgICAgICAgICAgICAvL2xvZygn6ZmE5Yqg5a6a5L2NJylcXG4gICAgICAgICAgICB9Ki9cXG5cXG4gICAgICAgICAgICBpZiAoZXh0cmFwb3MpIHtcXG4gICAgICAgICAgICAgIHZhciB0aXRsZSA9IHBkZmgoaXRlbSwgXFxcImEmJlRleHRcXFwiKTtcXG4gICAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOaOkumZpCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgIHZhciBqc29uID0ge1xcbiAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIFxcXCJhJiZzdGF0ZVxcXCIpLFxcbiAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCBcXFwiYSYmdmFsdWVcXFwiKSxcXG4gICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgIC8vdmFyIHRpdGxlID0gcGRmaChpdGVtLCDliIbnsbvmoIfpopgpO1xcbiAgICAgICAgICAgICAgdmFyIHRpdGxlID0gaXRlbS50aXRsZTtcXG4gICAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOaOkumZpCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgIHZhciBqc29uID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAvKnN3aXRjaCAodHJ1ZSkge1xcbiAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcyhcXFwiQEBAXFxcIik6XFxuICAgICAgICAgICAgICAgICAganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQEBcXFwiKVswXSksXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAQFxcXCIpWzFdKSxcXG4gICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcyhcXFwiQEBcXFwiKTpcXG4gICAgICAgICAgICAgICAgICBqc29uID0ge1xcbiAgICAgICAgICAgICAgICAgICAgdHlwZTog5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQFxcXCIpWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQFxcXCIpWzFdKSxcXG4gICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAgICAgICAvLyBqc29uID0gcGQoaXRlbSwg5YiG57G76ZO+5o6lKTtcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgIH0qL1xcbiAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgICAgLyp2YXIganNvbj3liIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAQCcpP3tcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEBAJylbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEBAJylbMV0pLFxcbiAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTtcXG4gICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQCcpP3tcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU65YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpOyovXFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxuICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgIGluZGV4OiBpbmRleCxcXG4gICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgIGpzb246IGpzb24sXFxuICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eVxcXCIgKyBcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wW3BhcmFtcy5pbmRleF0gPSBwYXJhbXMua2V5LnRvU3RyaW5nKCk7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJoZWFkLmNhdGVcXFwiLCBKU09OLnN0cmluZ2lmeShwYXJhbXMuY2F0ZV90ZW1wKSk7XFxuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImR0X1xcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAg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tcXG4gICAgICAgIHZhciB0aXRsZSA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLnRpdGxlKTtcXG4gICAgICAgIHZhciBkZXNjID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuZGVzYyk7XFxuICAgICAgICB2YXIgaW1nID0gdGhpcy5pbWdIYW5kbGUoaXRlbSwgcnVsZSk7XFxuICAgICAgICB2YXIgdXJsID0gdGhpcy51cmxIYW5kbGUoaXRlbSwgcnVsZSk7XFxuICAgICAgICB2YXIgY29udGVudCA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmNvbnRlbnQpO1xcbiAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxKSB7XFxuICAgICAgICAgIGlkID0gXFxcImxhc3RpZF9cXFwiICsgcGFnZTtcXG4gICAgICAgICAgY2xzID0gXFxcImxhc3RtYXJrXFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgcGljX3VybDogaW1nLFxcbiAgICAgICAgICB1cmw6ICdoaWtlcjovL3BhZ2UvZWo/dXJsPScrdXJsKycjbm9IaXN0b3J5IycsXFxuICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxuICAgICAgICAgIGNvbF90eXBlOiBydWxlLmNvbF90eXBlLFxcbiAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICBpZDogaWQsXFxuICAgICAgICAgICAgY2xzOiBjbHMsXFxuICAgICAgICAgIH0sXFxuICAgICAgICB9KTtcXG4gICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSAmJiBzaG93KSB7XFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbGluZVxcXCIsXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ08c21hbGw+5Yqg6L295LitLi4uPC9zbWFsbD5cXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgIGlkOiBcXFwicGFnZW51bVxcXCIsXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgfSk7XFxuICAgIH0gZWxzZSB7XFxuICAgICAgdXBkYXRlSXRlbShcXFwicGFnZW51bVxcXCIsIHtcXG4gICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdPGZvbnQgY29sb3I9XFxcImdyZXlcXFwiPjxzbWFsbD7liLDlupXkuoY8L3NtYWxsPjwvZm9udD4nLFxcbiAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgaWQ6IFxcXCJsYXN0XFxcIixcXG4gICAgICAgIH0sXFxuICAgICAgfSk7XFxuICAgIH1cXG4gICAgaWYgKGxpc3QubGVuZ3RoID09IDAgJiYgcGFnZSA9PSAxKSB7XFxuICAgICAgZC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCIsXFxuICAgICAgfSk7XFxuICAgICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiA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IGdldE15VmFyKCdybnVtJyk7XFxcXG5cXFxcbiAgICAgICAgdmFyIGkgPSBOdW1iZXIoZ2V0TXlWYXIoJ2Jhbm5lcmknLCAnMCcpKTtcXFxcbiAgICAgICAgaWYgKHJ1bSAhPSAnJykge1xcXFxuICAgICAgICAgICAgaSA9IE51bWJlcihydW0pICsgMVxcXFxuICAgICAgICAgICAgY2xlYXJNeVZhcigncm51bScpXFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBpID0gaSArIDE7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgLy9sb2coaSlcXFxcbiAgICAgICAgLy9sb2coZGF0YS5sZW5ndGgpXFxcXG5cXFxcbiAgICAgICAgaWYgKGkgPiBkYXRhLmxlbmd0aCAtIDEpIHtcXFxcbiAgICAgICAgICAgIGkgPSAwXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgdmFyIGl0ZW0gPSBkYXRhW2ldO1xcXFxuICAgICAgICAvL2xvZyhpdGVtKVxcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgdXBkYXRlSXRlbShpZCsnYmFyJywge1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgIGltZzogaXRlbS5pbWcsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiBpdGVtLnVybCxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLmltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9uYW1lOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLFxcXFxuICAgICAgICAgICAgICAgICAgICAvL3NuYW1lOiBpdGVtLmV4dHJhLnNuYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAvL3N0eXBlOiBpdGVt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xcXG4gICAgaWYgKHdrX251bSA9PSBrKSB7XFxcXG4gICAgICAgIGV2YWwoJ3drJytrKS5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgdmFyIHVybGwgPSBNWV9IT01FICsgcGRmaChpdGVtLCAnYSYmaHJlZicpICsgJyNpbW1lcnNpdmVUaGVtZSMnO1xcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogcGRmaChpdGVtLCDmoIfpopgpLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6IHBkZmgoaXRlbSwg5o+P6L+wKSxcXFxcbiAgICAgICAgICAgICAgICBpbWc6IHBkZmgoaXRlbSwg5Zu+54mHKSArIFxcXFxcXFwiQFJlZmVyZXI9XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL2VqI25vSGlzdG9yeSMjaW1tZXJzaXZlVGhlbWUjJyxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybGwsXFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwZGZoKGl0ZW0sIOagh+mimCksXFxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogcGRmaChpdGVtLCDlm77niYcpICsgXFxcXFxcXCJAUmVmZXJlcj1cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMycsXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9ICAgIFxcXFxufVxcXFxuZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJibGFua19ibG9ja1xcXFxcXFwiXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuXFxcIn0se1xcXCJjb2xfdHlwZVxcXCI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cXFxudmFyIGN1c3RvbSA9IHt9O1xcXFxuXFxcXG4vL+mihOiuvlxcXFxuZnVuY3Rpb24gY3VzdG9tRGF0YShjdXN0b20pIHtcXFxcbiAgICBPYmplY3Qua2V5cyhjdXN0b20pLmZvckVhY2goKGspID0+IHtcXFxcbiAgICAgICAgdGhpc1trXSA9IGN1c3RvbVtrXTtcXFxcbiAgICB9KVxcXFxufVxcXFxuXFxcXG5sZXQgRXJqaSA9IHtcXFxcbiAgICDpgJrlhY06ICQoJycpLmxhenlSdWxlKCgpID0+IHtcXFxcbiAgICAgICAgdHJ5IHtcXFxcbiAgICAgICAgICAgIHZhciBodG1sID0gSlNPTi5wYXJzZShyZXF1ZXN0KGlucHV0KS5tYXRjaCgvciBwbGF5ZXJfLio/PSguKj8pPC8pWzFdKVxcXFxuICAgICAgICAgICAgdmFyIHVybCA9IGh0bWwudXJsXFxcXG4gICAgICAgICAgICBpZiAoaHRtbC5lbmNyeXB0ID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgIHVybCA9IHVuZXNjYXBlKHVybCk7XFxcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMicpIHtcXFxcbiAgICAgICAgICAgICAgICB1cmwgPSB1bmVzY2FwZShiYXNlNjREZWNvZGUodXJsKSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAoL20zdTh8bXA0Ly50ZXN0KHVybCkpIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gdXJsXFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInZpZGVvOi8vXFxcXFxcXCIgKyBpbnB1dFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ2aWRlbzovL1xcXFxcXFwiICsgaW5wdXRcXFxcbiAgICAgICAgfV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AgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IHRoaXMuc21hbGwoJ+S7peS4iuaVsOaNruadpea6kOS6jue9kee7nO+8jOWmguaCqOWWnOasou+8jOivt+aUr+aMgeWumOaWue+8gScsICcjODcxRjc4JyksXFxcXG4gICAgICAgICAgICBkZXNjOiB0aGlzLnNtYWxsKCfmraTop4TliJnku4XpmZDlrabkuaDkuqTmtYHkvb/nlKjvvIzor7fkuo7lr7zlhaXlkI4yNOWwj+aXtuWGheWIoOmZpO+8jOS7u+S9lee7hOe7h+aIluS4quS6uuS4jeW+l+S7peS7u+S9leaWueW8j+aWueazleS8oOaSreatpOinhOWImeeahOaVtOS9k+aIlumDqOWIhu+8gScsICcjRjIwQzAwJyksXFxcXG4gICAgICAgICAgICB1cmw6ICdoaWtlcjovL2VtcHR5JyxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMSdcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgfSxcXFxcblxcXFxuXFxcXG4vL+eugOS7i1xcXFxuICAgIHNldERlc2M6IGZ1bmN0aW9uKGRlc2MsIG51bSkge1xcXFxuICAgICAgICBkZXNjID0gZGVzYy5jb25zdHJ1Y3RvciA9PSBBcnJheSA/IGRlc2Muam9pbignPGJyPicpIDogZGVzYztcXFxcbiAgICAgICAgaWYgKGRlc2MucmVwbGFjZSgvKDxicj58XFxcXFxcXFxzKykvZywgJycpLmxlbmd0aCA9PSAwKSB7XFxcXG4gICAgICAgICAgICByZXR1cm5cXFxcbiAgICAgICAgfVxcXFxuICAgICAgICB2YXIgaW5mbyA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9pbmZvJywgJ3t9JylcXFxcbiAgICAgICAgaWYgKGluZm9bJ2Rlc2MnXSAhPSB1bmRlZmluZWQpIHtcXFxcbiAgICAgICAgICAgIGluZm9bJ2Rlc2MnXSA9IGluZm9bJ2Rlc2MnXSArICcg566A5LuLOicgKyBkZXNjO1xcXFxuICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2VyX2luZm8nLCBpbmZvKTtcXFxcbiAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgIGNvbnN0IG1hcmsgPSAnZGVzYyc7XFxcXG4gICAgICAgIG51bSA9IHR5cGVvZihudW0pID09ICd1bmRlZmluZWQnID8gOTAgOiBudW1cXFxcbiAgICAgICAgZGVzYyA9IGRlc2Muc3RhcnRzV2l0aCgn44CA44CAJykgPyBkZXNjIDogJ+OAgOOAgCcgKyBkZXNjO1xcXFxuICAgICAgICBkZXNjID0gZGVzYy5yZXBsYWNlKC8nL2csIFxcXFxcXFwiJiMzOTtcXFxcXFxcIik7XFxcXG4gICAgICAgIGRlc2MgPSBkZXNjLnJlcGxhY2UoL1xcXFxcXFxcclxcXFxcXFxcbi9nLCBcXFxcXFxcIjxicj5cXFxcXFxcIik7XFxcXG5cXFxcbiAgICAgICAgZnVuY3Rpb24gc3Vic3RyKHN0ciwgbWF4TGVuZ3RoKSB7XFxcXG4gICAgICAgICAgICBsZXQgbGVuID0gMDtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHN0ci5jaGFyQ29kZUF0KGkpID4gMjU1KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxlbiArPSAyO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxlbisrO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAobGVuID4gbWF4TGVuZ3RoKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzdHIuc2xpY2UoMCwgaSkgKyAnLi4uJztcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gc3RyO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGxldCBzZGVzYyA9IHN1YnN0cihkZXNjLCBudW0pO1xcXFxuICAgICAgICB2YXIgbGF6eSA9ICQoYCNub0xvYWRpbmcjYCkubGF6eVJ1bGUoKGRjLCBzZGMsIG0pID0+IHtcXFxcbiAgICAgICAgICAgIHZhciBzaG93ID0gc3RvcmFnZTAuZ2V0SXRlbShtLCAnMCcpO1xcXFxuICAgICAgICAgICAgdmFyIHRpdGxlID0gZmluZEl0ZW0oJ2Rlc2MnKS50aXRsZTtcXFxcbiAgICAgICAgICAgIHZhciByZSA9IC8oPFxcXFxcXFxcL3NtYWxsPjxicj4uKj8+KS4rL2c7XFxcXG4gICAgICAgICAgICB2YXIgZXhwID0gJ+WxleW8gDonO1xcXFxuICAgICAgICAgICAgdmFyIHJldCA9ICfmlLbotbc6JztcXFxcbiAgICAgICAgICAgIGlmIChzaG93ID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rlc2MnLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UocmV0LCBleHApXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZSwgJyQxJyArIHNkYyArICc8L3NtYWxsPicpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvKDxcXFxcXFxcXC9zbWFsbD48YnI+PGZvbnQgY29sb3I9XFxcXFxcXCIpLio/KFxcXFxcXFwiPikvLCAnJDEjOEEyQkUyJDInKS8v5pS26LW36aKc6ImyXFxcXG5cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0obSwgJzAnKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSgnZGVzYycsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShleHAsIHJldClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKHJlLCAnJDEnICsgZGMgKyAnPC9zbWFsbD4nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLyg8XFxcXFxcXFwvc21hbGw+PGJyPjxmb250IGNvbG9yPVxcXFxcXFwiKS4qPyhcXFxcXFxcIj4pLywgJyQxIzAwODAwMCQyJykvL+WxleW8gOminOiJslxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShtLCAnMScpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGBoaWtlcjovL2VtcHR5YFxcXFxuICAgICAgICB9LCBkZXNjLCBzZGVzYywgbWFyaylcXFxcbiAgICAgICAgdmFyIHNjID0gc3RvcmFnZTAuZ2V0SXRlbShtYXJrLCAnMCcpID09ICcwJyA/ICflsZXlvIA6JyA6ICfmlLbotbc6JztcXFxcbiAgICAgICAgdmFyIGRjID0gc3RvcmFnZTAuZ2V0SXRlbShtYXJrLCAnMCcpID09ICcwJyA/IHNkZXNjIDogZGVzYztcXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiAnJyArICc8Yj48Zm9udCBjb2xvcj1cXFxcXFxcIiMwOThBQzFcXFxcXFxcIj7iiLcgICAgICAgICAgICAgICAgICAgICAg5Ymn5oOF566A5LuLXFxcXHQ8L2ZvbnQ+PC9iPicgKyBcXFxcXFxcIjxzbWFsbD48YSBzdHlsZT0ndGV4dC1kZWNvcmF0aW9uOiBub25lOycgaHJlZj0nXFxcXFxcXCIgKyBsYXp5ICsgXFxcXFxcXCInPlxcXFxcXFwiICsgc2MgKyAnPC9hPjwvc21hbGw+PGJyPjxmb250IGNvbG9yPVxcXFxcXFwiIzhBMkJFMlxcXFxcXFwiPicgKyBgJHtkY31gICsgJzwvc21hbGw+JywvL+m7mOiupOminOiJslxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdyaWNoX3RleHQnLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBpZDogJ2Rlc2MnLFxcXFxuICAgICAgICAgICAgICAgIGxpbmVTcGFjaW5nOiA2LFxcXFxuICAgICAgICAgICAgICAgIHRleHRTaXplOiAxNSxcXFxcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogdHJ1ZSxcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSlcXFxcbiAgICB9LFxcXFxuXFxcXG5cXFxcbi8v5rW35oqlXFxcXG4gICAgc3RyQ29udmVydDogZnVuY3Rpb24oYXJyKSB7XFxcXG4gICAgICAgIHJldHVybiBhcnIubWFwKHggPT4ge1xcXFxuICAgICAgICAgICAgc3RyID0geDtcXFxcbiAgICAgICAgICAgIGlmICgvKOWvvOa8lHzkuLvmvJR857G75Z6LKe+8mi8udGVzdChzdHIpKSB7XFxcXG4gICAgICAgICAgICAgICAgc3RyID0gc3RyLnNwbGl0KCcvJykubWFwKCh2YWwsIGluZGV4KSA9PiAoaW5kZXggPT09IDAgPyAnJyA6ICcnKSArIHZhbCkuc2xpY2UoMCwgNSkuam9pbignICcpLnJlcGxhY2UoLyAkLywgJycpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIHN0clxcXFxuICAgICAgICB9KVxcXFxuICAgIH0sXFxcXG4gICAgc2V0Q29udGVudDogZnVuY3Rpb24ob2JqKSB7XFxcXG4gICAgICAgIC8vbG9nKG9iailcXFxcbiAgICAgICAgdmFyIGNvbnRlbnRzID0gb2JqLm1haW47XFxcXG4gICAgICAgIHZhciBzb3J0T3JkZXIgPSBvYmouc29ydDtcXFxcbiAgICAgICAgdmFyIGltZyA9IG9iai5pb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gICAgICBjYXNlIDQ6XFxcXG4gICAgICAgICAgICBjYXNlIDU6XFxcXG4gICAgICAgICAgICAgICAgdGl0bGVzID0gYXJyYXkuc2xpY2UoMCwgMik7XFxcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgyKTtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgIGNhc2UgNjpcXFxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAzKTtcXFxcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDMpO1xcXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9pbmZvJywge1xcXFxuICAgICAgICAgICAgZGVzYzogZGVzY3Muam9pbignXFxcXFxcXFxuJyksXFxcXG4gICAgICAgICAgICBpbWc6IGltZyxcXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgLy90aXRsZTogIHRoaXMuc21hbGwoIHRpdGxlc1swXSArICdcXFxcXFxcXG4nICt0aXRsZXMuc2xpY2UoMSwgMykuam9pbignXFxcXFxcXFxuJyksJ3JlZCcpLFxcXFxuICAgICAgICAgICAgLy9kZXNjOiB0aGlzLnNtYWxsKGRlc2NzLmpvaW4oJ1xcXFxcXFxcbicpLCcjRkY3RjAwJyksXFxcXG4gICAgICAgICAgICB0aXRsZTogIHRoaXMuc21hbGwocGRmaChodG1sLCAnLnZpZGVvLWluZm8tYXV4JiZUZXh0JykgKyAnXFxcXFxcXFxuJyArIHBkZmgoaHRtbCwgJy52aWRlby1pbmZvLWl0ZW1zOm1hdGNoZXMo5aSH5rOo77yafOi/nui9ve+8mnzpm4bmlbDvvJopJiZUZXh0JyksJ3JlZCcpLFxcXFxuICAgICAgICAgIGRlc2M6IHRoaXMuc21hbGwocGRmaChodG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LCAyKTtcXFxcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDIpO1xcXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgY2FzZSA2OlxcXFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDMpO1xcXFxuICAgICAgICAgICAgICAgIGRlc2NzID0gYXJyYXkuc2xpY2UoMyk7XFxcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2VyX2luZm8nLCB7XFxcXG4gICAgICAgICAgICBkZXNjOiBkZXNjcy5qb2luKCdcXFxcXFxcXG4nKSxcXFxcbiAgICAgICAgICAgIGltZzogaW1nLFxcXFxuICAgICAgICB9KVxcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSArICdcXFxcXFxcXG4nICsgdGhpcy5zbWFsbCh0aXRsZXMuc2xpY2UoMSwgMykuam9pbignXFxcXFxcXFxuJykpLFxcXFxuICAgICAgICAgICAgZGVzYzogdGhpcy5zbWFsbChkZXNjcy5qb2luKCdcXFxcXFxcXG4nKSksXFxcXG4gICAgICAgICAgICBwaWNfdXJsOiBpbWcgKyAnQFJlZmVyZXI9JyxcXFxcbiAgICAgICAgICAgIHVybDogTVlfVVJMLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdtb3ZpZV8xX3ZlcnRpY2FsX3BpY19ibHVyJyxcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9LFxcXFxuICAgIGlzQ29sb3I6IGZ1bmN0aW9uKHRleHQpIHtcXFxcbiAgICAgICAgY29uc3QgcmVnZXggPSAvXiMoWzAtOUEtRmEtZl17M318WzAtOUEtRmEtZl17Nn0pJHxeKFthLXpdKykkL2k7XFxcXG4gICAgICAgIHJldHVybiByZWdleC50ZXN0KHRleHQpO1xcXFxu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35byPIDogJ2JsYW5rX2Jsb2NrJztcXFxcbiAgICAgICAgcmV0dXJuIGN1c3RvbTtcXFxcbiAgICB9LFxcXFxuICAgIGNyZWF0ZVBMaXN0OiBmdW5jdGlvbih0YWJzLCB2YXJpLCBzaHNvcnQsIGN1c3RvbSkge1xcXFxuICAgICAgICB2YXJpID0gXFxcXFxcXCJlcl9cXFxcXFxcIiArIHZhcmk7XFxcXG4gICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgdGFicy5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgdmFyIHVybCA9ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHZhcmksIHNoc29ydCwgaSwgbGluZWMpID0+IHtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciBsaXN0cyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfbGlzdCcsICdbXScpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHZhcmkgKyAnZm9sZCcsICcxJykgPT0gJzAnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBidG4gPSBmaW5kSXRlbShzaHNvcnQgKyAnX2J1dHRvbicpO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgZm9sZHMgPSBbJzxmb250IGNvbG9yPVxcXFxcXFwiI0QzRDNEM1xcXFxcXFwiPuKYtycsICc8Zm9udCBjb2xvcj1cXFxcXFxcIiNGRkE1MDBcXFxcXFxcIj7imLAnXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbCA9IHBsaXN0W3Noc29ydF0uY29sX3R5cGU7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjbHMgPSBwbGlzdFtzaHNvcnRdLmNscztcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBpYyA9IHBsaXN0W3Noc29ydF0ucGljO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgZXh0cmEgPSBwbGlzdFtzaHNvcnRdLmV4dHJhO1xcXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhleHRyYSlcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1swXSwgZm9sZHNbMV0pLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHZhcmkgKyAnZm9sZCcsICcxJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8vcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbCA9IHBsaXN0W3Noc29ydF0uY29sX3R5cGU7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjbHMgPSBwbGlzdFtzaHNvcnRdLmNscztcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBpYyA9IHBsaXN0W3Noc29ydF0ucGljO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgZXh0cmEgPSBwbGlzdFtzaHNvcnRdLmV4dHJhO1xcXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhleHRyYSlcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIodmFyaSwgaSk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB2YXIgeGxpc3QgPSBsaXN0c1tpXTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoJC5mdW5jICE9IHVuZGVmaW5lZCAmJiAkLmZ1bmMuY29uc3RydWN0b3IgPT0gRnVuY3Rpb24pIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgeGxpc3QgPSAkLmZ1bmMoaSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfbGlzdCcsIHhsaXN0KTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgdmFyIHBsYXlzID0geGxpc3QubWFwKHggPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHgudGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHgudXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IGNvbCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpYzogcGljLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IE9iamVjdC5hc3NpZ24oe30sZXh0cmEse1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiB4LnVybC5yZXBsYWNlKC9AbGF6eVJ1bGVbXFxcXFxcXFxzXFxcXFxcXFxTXSsvZywgJycpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogY2xzLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHNoc29ydCArICdfc29ydCcpID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgICAgICBwbGF5cy5yZXZlcnNlKCk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHZhciBwY2ZnID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19wdXNoY2ZnJywgJ3t9Jyk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHBjZmdbJ+WNleaOqCddKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBjZmdbJ29iaiddWyfljZXmjqgnXVswXVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXSA9IGZhbHNlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAocGNmZ1sn6YCJ5o6oJ10pIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBjZmdbJ29iaiddWyfpgInmjqgnXVswXVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IGZhbHNlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnLCBwY2ZnKTtcXFxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywgcGxheXMpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgdmFyIHRhYnggPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQgKyAnX3RhYicpO1xcXFxuICAgICAgICAgICAgICAgIHRhYnguZm9yRWFjaCgoeCwgaWkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0geC50aXRsZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT0gaWkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKC8jKFxcXFxcXFxcdyspPy9nLCBsaW5lYyksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoLyMoXFxcXFxcXFx3Kyk/L2csICcjJyksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5oiQ5Yqf77yBJztcXFxcbiAgICAgICAgICAgIH0sIHZhcmksIHNoc29ydCwgaSwgY3VzdG9tLue6v+i3r+mAieS4rSlcXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgKGdldE15VmFyKHZhcmksICcwJykgPT0gaSA/IHRhYnNbaV0uZm9udGNvbG9yKGN1c3RvbS7nur/ot6/pgInkuK0pIDogdGFic1tpXS5mb250Y29sb3IoJyMnKSksXFxcXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IGN1c3RvbS7nur/ot6/moLflvI8sXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQgKyAnX3RhYicsXFxcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX3RhYl8nICsgaSxcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogY3VzdG9tLuWIhuWJsuagt+W8jyxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfbGluZScsXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pXFxcXG4gICAgfSxcXFxcbiAgICBwdXNoVGFiOiBmdW5jdGlvbih2YXJpLCBzaHNvcnQpIHtcXFxcbiAgICAgICAgYWRkTGlzdGVuZXIoJ29uUmVmcmVzaCcsICQudG9TdHJpbmcoKHNoc29ydCkgPT4ge1xcXFxuICAgICAgICAgICAgY2xlYXJNeVZhcihzaHNvcnQgKyAnX3B1c2hjZmcnKTtcXFxcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoc2hzb3J0ICsgJ19kdW9zZWxlY3QnKTtcXFxcbiAgICAgICAgfSwgc2hzb3J0KSlcXFxcbiAgICAgICAgdmFyIHBvYmogPSB7XFxcXG4gICAgICAgICAgICAn5Y2V5o6oJzogWyfipr/ljZXmjqgnLCAnPGI+4qa/5Y2V5o6oPC9iPicuZm9udGNvbG9yKCcjMDBGQTlBJyldLFxcXFxuICAgICAgICAgICAgJ+mAieaOqCc6IFsn4piR6YCJ5o6oJywgJzxiPuKYkemAieaOqDwvYj4nLmZvbnRjb2xvcignIzQ2ODJCNCcpXSxcXFxcbiAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICB0aXRsZTogJ+KMmCcsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcXFxuICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9lbXB0eScsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ19wdXNodGFiJyxcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgdGl0bGU6IHBvYmpbJ+WNleaOqCddWzBdLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LCBwb2JqLCB2YXJpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHZhcmkgKyAnZm9sZCcsICcxJykgPT0gJzAnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lsZXlvIDmiY3og73mk43kvZwnO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciB0aXRsZXMgPSBwb2JqWyfljZXmjqgnXTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgcGNmZyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsICd7fScpO1xcXFxuICAgICAgICAgICAgICAgIHBjZmdbJ29iaiddID0gcG9iajtcXFxcbiAgICAgICAgICAgICAgICB2YXIg5Y2V5o6oID0gcGNmZ1sn5Y2V5o6oJ10gPyBwY2ZnWyfljZXmjqgnXSA6IGZhbHNlO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKOWNleaOqCkge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaCcsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZXNbMF0sXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ+WNleaOqCddID0gZmFsc2U7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10ubWFwKCh4KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHgudXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaCcsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIHRpdGxlc1sxXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBvYmpbJ+mAieaOqCddWzBdLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXSA9IHRydWU7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ+mAieaOqCddID0gZmFsc2U7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbGF5bGlzdCA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10gPSBwbGF5bGlzdDtcXFxcbiAgICAgICAgICAgICAgICAgICAgZmluZEl0ZW1zQnlDbHMoc2hzb3J0KS5tYXAoeCA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgZHB1c2ggPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZ2V0UGFnZVRpdGxlKCksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnRpdGxlICsgJyQnICsgeC5leHRyYS5pZFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCcnKS5sYXp5UnVsZSgoZHB1c2gpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL3BhZ2UvcHVzaD9ydWxlPVhZUeaOqOmAgSZwdXNodXJsPScgKyBlbmNvZGVVUklDb21wb25lbnQoSlNPTi5zdHJpbmdpZnkoZHB1c2gpKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBkcHVzaClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsIHBjZmcpO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKOWNleaOqCA/ICfljZXmjqjlvIDlkK8nIDogJ+WNleaOqOWFs+mXrScpO1xcXFxuICAgICAgICAgICAgfSwgc2hzb3J0LCBwb2JqLCB2YXJpKSxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfcHVzaCcsXFxcXG4gICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQgKyAnX3B1c2h0YWInLFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICB0aXRsZTogcG9ialsn6YCJ5o6oJ11bMF0sXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaHNvcnQsIHBvYmosIHZhcmkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIodmFyaSArICdmb2xkJywgJzEnKSA9PSAnMCcpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHZhciB0aXRsZXMgPSBwb2JqWyfpgInmjqgnXTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgcGNmZyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsICd7fScpO1xcXFxuICAgICAgICAgICAgICAgIHBjZmdbJ29iaiddID0gcG9iajtcXFxcbiAgICAgICAgICAgICAgICB2YXIg6YCJ5o6oID0gcGNmZ1sn6YCJ5o6oJ10gPyBwY2ZnWyfpgInmjqgnXSA6IGZhbHNlO1xcXFxuICAgICAgICAgICAgICAgIGlmICjpgInmjqgpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn6YCJ5o6oJ10gPSBmYWxzZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sncGxheWxpc3QnXS5tYXAoKHgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogeC51cmwsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHRvJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmjqjpgIHmnKzpobU9PlRWQm94JyxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoc2hzb3J0ICsgJ19kdW9zZWxlY3QnKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHMnLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyB0aXRsZXNbMV0sXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHBjZmdbJ+mAieaOqCddID0gdHJ1ZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sn5Y2V5o6oJ10gPSBmYWxzZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBsYXlsaXN0ID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcGNmZ1sncGxheWxpc3QnXSA9IHBsYXlsaXN0O1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgSWRzID0gcGxheWxpc3QubWFwKGl0ID0+IGl0LmV4dHJhLmlkKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgSWRzLmZvckVhY2goeCA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSBmaW5kSXRlbSh4KS50aXRsZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJC5tc20odGl0bGUsIHgsIHNoc29ydCksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBvYmpbJ+WNleaOqCddWzBdLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHRvJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmjqjpgIHpgInkuK09PlRWQm94JyxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsIHBjZmcpO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKOmAieaOqCA/ICfpgInmjqjlvIDlkK8nIDogJ+mAieaOqOWFs+mXrScpO1xcXFxuICAgICAgICAgICAgfSwgc2hzb3J0LCBwb2JqLCB2YXJpKSxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfcHVzaHMnLFxcXFxuICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ19wdXNodGFiJ1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLmjqjpgIHmnKzpobU9PlRWQm94XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaHNvcnQsIHZhcmkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICB2YXIgcGNmZyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsICd7fScpO1xcXFxuICAgICAgICAgICAgICAgIHZhciDljZXmjqggPSBwY2ZnWyfljZXmjqgnXSA/IHBjZmdbJ+WNleaOqCddIDogZmFsc2U7XFxcXG4gICAgICAgICAgICAgICAgdmFyIOmAieaOqCA9IHBjZmdbJ+mAieaOqCddID8gcGNmZ1sn6YCJ5o6oJ10gOiBmYWxzZTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoIeWNleaOqCAmJiAh6YCJ5o6oKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0YWJzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ190YWJzJywgJ1tdJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcGxzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19saXN0JywgJ1tdJykubWFwKGxpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbGkubWFwKGl0ZW0gPT4gaXRlbS50aXRsZSArICckJyArIGl0ZW0udXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcXFxcXHNcXFxcXFxcXFNdKy9nLCAnJykpLmpvaW4oJyMnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSkuam9pbignJCQkJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2gge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHBscyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArIFxcXFxcXFwiX2xpc3RcXFxcXFxcIiwgJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXFxcXFwiJFxcXFxcXFwiICsgeC51cmwpLmpvaW4oXFxcXFxcXCIjXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRhYnMgPSBbdGFic1tnZXRNeVZhcih2YXJpLCAnMCcpXV07XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgLypsb2cocGxzKVxcXFxuICAgICAgICAgICAgICAgICAgICBsb2codGFicykqL1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAo6YCJ5o6oKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFxcXFxcIl9kdW9zZWxlY3RcXFxcXFxcIiwgJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXFxcXFwiJFxcXFxcXFwiICsgeC51cmwpLmpvaW4oXFxcXFxcXCIjXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAocGxzLmxlbmd0aCA9PSAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6YCJ5oup5Li656m6JztcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgdGFicyA9IFsn5pKt5pS+5YiX6KGoJ107XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgdmFyIGluZm8gPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfaW5mbycsICd7fScpO1xcXFxuICAgICAgICAgICAgICAgIHZhciBkZXNjID0gaW5mb1snZGVzYyddO1xcXFxuICAgICAgICAgICAgICAgIHZhciDmjqjpgIEgPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwibmFtZVxcXFxcXFwiOiBnZXRQYWdlVGl0bGUoKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJjb250ZW50XFxcXFxcXCI6IGRlc2MgfHwgJycsXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicGljXFxcXFxcXCI6IGluZm9bJ2ltZyddIHx8ICcnLFxcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcImZyb21cXFxcXFxcIjogdGFicy5qb2luKCckJCQnKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJ1cmxcXFxcXFxcIjogcGxzLFxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAvL2xvZyjmjqjpgIEpXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9wYWdlL3B1c2g/cnVsZT1YWVHmjqjpgIEmcHVzaHVybD1cXFxcXFxcIiArIGVuY29kZVVSSUNvbXBvbmVudChKU09OLnN0cmluZ2lmeSjmjqjpgIEpKVxcXFxuICAgICAgICAgICAgfSwgc2hzb3J0LCB2YXJpKSxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfcHVzaHRvJyxcXFxcbiAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfcHVzaHRhYidcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdibGFua19ibG9jaycsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGNsczogc2hzb3J0ICsgJ19wdXNodGFiJyxcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSlcXFxcbiAgICB9LFxcXFxuICAgIHNldExvbmdjbGljazogZnVuY3Rpb24oc2hzb3J0LCBjdXN0b20pIHtcXFxcbiAgICAgICAgcmV0dXJuIFt7XFxcXG4gICAgICAgICAgICB0aXRsZTogJ+agt+W8j/CfjqgnLFxcXFxuICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKHNoc29ydCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGxldCBhbGxfY29scyA9IFsnJ10uY29uY2F0KGdldENvbFR5cGVzKCkpO1xcXFxuICAgICAgICAgICAgICAgIGFsbF9jb2xzID0gYWxsX2NvbHMuZmlsdGVyKHggPT5cXFxcbiAgICAgICAgICAgICAgICAgICAgLyh0ZXh0X3xmbGV4KS4qLy50ZXN0KHgpICYmIHggIT0gJ3RleHRfaWNvbicpO1xcXFxuICAgICAgICAgICAgICAgIC8vbG9nKGFsbF9jb2xzKVxcXFxuICAgICAgICAgICAgICAgIGxldCBjbHMgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9JykgfHxcXFxcbiAgICAgICAgICAgICAgICAgICAgJyc7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGNsc1tzaHNvcnRdICE9ICcnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbCA9IGNsc1tzaHNvcnRdLmNvbF90eXBlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBsZXQg5oyJ6ZKu5qC35byPID0gYWxsX2NvbHMubWFwKChpdCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gaXQgPT09IGNvbCA/ICfwn5GJJyArIGl0IDogaXQ7XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHRpcHMgPSAn6K+36YCJ5oup6YCJ6ZuG5oyJ6ZKu5qC35byPJztcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJCjmjInpkq7moLflvI8sIDIsIHRpcHMpLnNlbGVjdCgoc2hzb3J0LCBjbHMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5wdXQgPSBpbnB1dC5yZXBsYWNlKC/wn5GJL2csICcnKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgLypzdG9yYWdlMC5zZXRJdGVtKCfmjInpkq7moLflvI8nLCBpbnB1dCk7Ki9cXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IG9sZElkcyA9IChmaW5kSXRlbXNCeUNscyhzaHNvcnQpIHx8IFtdKS5tYXAoaXQgPT4gaXQuZXh0cmEuaWQpOyAvL+iAgeWFg+e0oGlkc1xcXFxuICAgICAgICAgICAgICAgICAgICBvbGRJZHMuZm9yRWFjaCh4ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBpbnB1dFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bey5YiH5o2i6YCJ6ZuG5oyJ6ZKu5qC35byP5Li6OicgKyBpbnB1dDtcXFxcbiAgICAgICAgICAgICAgICB9LCBzaHNvcnQsIGNscyk7XFxcXG4gICAgICAgICAgICB9LCBzaHNvcnQsIGN1c3RvbSlcXFxcbiAgICAgICAgfV1cXFxcbiAgICB9LFxcXFxuICAgIHNldFRhYnM6IGZ1bmN0aW9uKHRhYnMsIHZhcmksIHNoc29ydCwgcGFyc2UpIHtcXFxcbiAgICAgICAgbGV0IGN1c3RvbSA9IHBhcnNlLuiHquWumuS5iTtcXFxcbiAgICAgICAgY3VzdG9tID0gdGhpcy5nZXRQcmVzZXQoY3VzdG9tKTtcXFxcbiAgICAg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xzbGlzdHMpO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlcyA9IFtgJHtjdXN0b20u5q2j5bqP6aKc6ImyfVxcXFxcXFwiPuato+W6j2AsIGAke2N1c3RvbS7pgIbluo/popzoibJ9XFxcXFxcXCI+6YCG5bqPYF07XFxcXG5cXFxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICBuZXdjbHNsaXN0LnJldmVyc2UoKTtcXFxcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywgbmV3Y2xzbGlzdCk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInKVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKGNvbmYgPT0gJzEnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzFdLCB0aXRsZXNbMF0pLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzBdLCB0aXRsZXNbMV0pLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3Nv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vIAsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogY3VzdG9tLue6v+i3r+agt+W8jyxcXFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZm9sZG5hbWUsIHNoc29ydCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIG9iaiA9IGZpbmRJdGVtKHNoc29ydCArICdfbGluZScpO1xcXFxuICAgICAgICAgICAgICAgIHZhciBidG4gPSBmaW5kSXRlbShzaHNvcnQgKyAnX2J1dHRvbicpO1xcXFxuICAgICAgICAgICAgICAgIHZhciBmb2xkcyA9IFsnPGZvbnQgY29sb3I9XFxcXFxcXCIjRDNEM0QzXFxcXFxcXCI+4pi3JywgJzxmb250IGNvbG9yPVxcXFxcXFwiI0ZGQTUwMFxcXFxcXFwiPuKYsCddO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzAnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKGZvbGRuYW1lLCAnMScpO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgY3MgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2NscycpO1xcXFxuICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIob2JqLmV4dHJhLmlkLCBjcyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oYnRuLmV4dHJhLmlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMF0sIGZvbGRzWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzEnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKGZvbGRuYW1lLCAnMCcpO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGNscyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjeCA9ICQuZGF0YUNvbnZlcnQocGNscyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfY2xzJywgY3gpO1xcXFxuICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1sxXSwgZm9sZHNbMF0pLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKGZvbGQgPT09ICcxJyA/ICfmlLbotbcnIDogJ+WxleW8gCcpO1xcXFxuICAgICAgICAgICAgfSwgZm9sZG5hbWUsIHNoc29ydCksXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX2J1dHRvbicsXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pXFxcXG4gICAgICAgIHRoaXMuY3JlYXRlUExpc3QodGFicywgdmFyaSwgc2hzb3J0LCBjdXN0b20pO1xcXFxuICAgIH0sXFxcXG4gICAgc2V0VGFiczI6IGZ1bmN0aW9uKHRhYnMsIHZhcmksIHNoc29ydCwgcGFyc2UsIGV4cCkge1xcXFxuICAgICAgICBsZXQgY3VzdG9tID0gcGFyc2Uu6Ieq5a6a5LmJO1xcXFxuICAgICAgICBjdXN0b20gPSB0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tcHR5J1xcXFxuICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICB2YXIgZm9sZCA9IGdldE15VmFyKGZvbGRuYW1lLCAnMScpO1xcXFxuICAgICAgICAgICAgdmFyIG9iaiA9IGZpbmRJdGVtKHNoc29ydCArICdfYXZhdGFyJylcXFxcbiAgICAgICAgICAgIGlmIChmb2xkID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgIHZhciBiY2xzID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19idXR0b24nKTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgdGNscyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCArICdfdGFiJyk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGxjbHMgPSBmaW5kSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciBwY2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgY3MgPSBbYmNsc10uY29uY2F0KHRjbHMsIFtsY2xzXSwgcGNscyk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICBpZiAocHVzaCkge1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGNscyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCArICdfcHVzaHRhYicpO1xcXFxuICAgICAgICAgICAgICAgICAgICBjcyA9IHBjbHMuY29uY2F0KGNzKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB2YXIgY3ggPSAkLmRhdGFDb252ZXJ0KGNzKTtcXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2NscycsIGN4KTtcXFxcbiAgICAgICAgICAgICAgICBpZiAocHVzaCkge1xcXFxuICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0ICsgJ19wdXNodGFiJyk7X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XG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgZm9sZCA9PT0gJzEnID8gJzAnIDogJzEnKTtcXFxcbiAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKGZvbGQgPT09ICcxJyA/ICfmlLbotbcnIDogJ+WxleW8gCcpO1xcXFxuICAgICAgICB9LCBmb2xkbmFtZSwgc2hzb3J0LCAocGFyc2VbJ+aOqOmAgSddID8gdHJ1ZSA6IGZhbHNlKSk7XFxcXG4gICAgICAgIHZhciBkZXNjID0gKGZvbGQgPT09ICcwJyA/IOaKmOWPoCA6IOWxleW8gCkgKyAnXFxcXFxcXFx0JztcXFxcblxcXFxuICAgICAgICBpZiAoZXhwLmxlbmd0aCA9PSAxKSB7XFxcXG4gICAgICAgICAgICB1cmwgPSAnaGlrZXI6Ly9lbXB0eSc7XFxcXG4gICAgICAgICAgICBkZXNjID0gJyc7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiB2YXJpICsgJzpcXFxcXFxcXHRcXFxcXFxcXHQnICsgJ+WFsScgKyBTdHJpbmcodGFicy5sZW5ndGgpLmZvbnRjb2xvcignIzQ2ODJCNCcpICsgJ+adoee6v+i3rycsXFxcXG4gICAgICAgICAgICBkZXNjOiBkZXNjLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdhdmF0YXInLFxcXFxuICAgICAgICAgICAgaW1nOiBjdXN0b20u5Zu+5qCHLFxcXFxuICAgICAgICAgICAgdXJsOiB1cmwsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX2F2YXRhcicsXFxcXG4gICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiB0aGlzLnNldExvbmdjbGljayhzaHNvcnQpLFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KVxcXFxuICAgICAg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1cXFxcXFxcIj7pgIbluo9gXTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIGlmIChjb25mID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYnV0dG9uJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1sxXSwgdGl0bGVzWzBdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYnV0dG9uJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1swXSwgdGl0bGVzWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzEnKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgLy9yZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaOkuW6j+aIkOWKnydcXFxcbiAgICAgICAgICAgIH0sIHZhcmksIHNoc29ydCwgY3VzdG9tKSxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBjdXN0b20u57q/6Lev5qC35byPLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19idXR0b24nLFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KVxcXFxuICAgICAgICB0aGlzLmNyZWF0ZVBMaXN0KHRhYnMsIHZhcmksIHNoc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ZXJzZSgpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgaWYgKOagt+W8jyA9PSAnJykge1xcXFxuICAgICAgICAgICAg5qC35byPID0gbGlzdC5sZW5ndGggPiAzID8gJ3RleHRfNCcgOiAndGV4dF8yJ1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIFxcXFxuICAgICAgICB2YXIgZXh0cmEgPSAnJztcXFxcblxcXFxuICAgICAgICBpZiAocGFyc2UuZXh0cmEgIT0gdW5kZWZpbmVkKSB7XFxcXG4gICAgICAgICAgICBleHRyYSA9IHBhcnNlLmV4dHJhXFxcXG4gICAgICAgIH1cXFxcblxcXFxuICAgICAgICBpZiAobGlzdC5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgICAgICB2YXIgcGxpc3QgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9Jyk7XFxcXG4gICAgICAgICAgICBpZiAoIXBsaXN0Lmhhc093blByb3BlcnR5KHNoc29ydCkpIHtcXFxcbiAgICAgICAgICAgICAgICBwbGlzdFtzaHNvcnRdID0ge307XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydjbHMnXSA9IHNoc29ydDtcXFxcbiAgICAgICAgICAgIHBsaXN0W3Noc29ydF1bJ2NvbF90eXBlJ10gPSDmoLflvI87XFxcXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydwaWMnXSA9IOWbvuaghzsgXFxcXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydleHRyYSddPWV4dHJhOyAgICAgICAgICAgXFxcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfcGxheWxpc3RzJywgcGxpc3QpO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIFxcXFxuXFxcXG4gICAgICAgIGZvciAodmFyIGogaW4gbGlzdCkge1xcXFxuICAgICAgICAgICAgbGV0IGx0ID0ge1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBsaXN0W2pdLnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgIHVybDogbGlzdFtqXS51cmwsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IOagt+W8jyxcXFxcbiAgICAgICAgICAgICAgICBwaWM6IOWbvuaghyxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZDogbGlzdFtqXS51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxcXFxcc1xcXFxcXFxcU10rL2csICcnKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQsICAgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICBsdFsnZXh0cmEnXSA9IE9iamVjdC5hc3NpZ24oe30sIGx0WydleHRyYSddLCBleHRyYSk7XFxcXG4gICAgICAgICAgICBkLnB1c2gobHQpO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICBldmFsUmU6IGZ1bmN0aW9uKGlucHV0LCDlh73mlbApIHtcXFxcbiAgICAgICAgbGV0IHJlc3VsdCA9IGlucHV0O1xcXFxuICAgICAgICByZXN1bHQgPSBldmFsKCdpbnB1dCcgKyDlh73mlbApO1xcXFxuICAgICAgICByZXR1cm4gcmVzdWx0O1xcXFxuICAgIH0sXFxcXG4gICAgZ2V0VGFiczogZnVuY3Rpb24ocGFyc2UpIHtcXFxcbiAgICAgICAgdmFyIHRhYnMgPSBbXTtcXFxcbiAgICAgICAgdmFyIGFydHMgPSBbXTtcXFxcbiAgICAgICAgaWYgKHR5cGVvZiBwYXJzZS7nur/ot68gPT0gJ29iamVjdCcpIHtcXFxcbiAgICAgICAgICAgIGFydHMgPSBwYXJzZS7nur/ot687XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgaWYgKGFydHMubGVuZ3RoID09IDApIHtcXFxcbiAgICAgICAgICAgIGFydHMgPSBwZGZhKGh0bWwsIHBhcnNlLue6v+i3ryk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgdmFyIOe6v+i3r+WQjSA9IHBhcnNlLue6v+i3r+WQjeensDtcXFxcbiAgICAgICAgdmFyIOabv+aNouWHveaVsCA9ICcnO1xcXFxuICAgICAgICBpZiAocGFyc2Uu57q/6Lev5ZCN56ewLmluY2x1ZGVzKCdAQCcpKSB7XFxcXG4gICAgICAgICAgICDnur/ot6/lkI0gPSBwYXJzZS7nur/ot6/lkI3np7Auc3BsaXQoJ0BAJylbMF07XFxcXG4gICAgICAgICAgICDmm7/mjaLlh73mlbAgPSBwYXJzZS7nur/ot6/lkI3np7Auc3BsaXQoJ0BAJylbMV07XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgZm9yICh2YXIgaSBpbiBhcnRzKSB7XFxcXG4gICAgICAgICAgICBsZXQgbGluZW5hbWUgPSAnJztcXFxcbiAgICAgICAgICAgIGlmICjnur/ot6/lkI0gPT0gJycpIHtcXFxcbiAgICAgICAgICAgICAgICBsaW5lbmFtZSA9IGFydHNbaV07XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGxpbmVuYW1lID0gcGRmaChhcnRzW2ldLCDnur/ot6/lkI0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKOabv+aNouWHveaVsCAhPSAnJykge1xcXFxuICAgICAgICAgICAgICAgIGxpbmVuYW1lID0gdGhpcy5ldmFsUmUobGluZW5hbWUsIOabv+aNouWHveaVsCk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB0YWJzLnB1c2gobGluZW5hbWUpO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHJldHVybiB0YWJzO1xcXFxuICAgIH0sXFxcXG4gICAgZ2V0TGlzdHM6IGZ1bmN0aW9uKHBhcnNlLCBzaHNvcnQpIH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2EmJmhyZWYnO1xcXFxuICAgICAgICB2YXIg6Kej5p6QID0gcGFyc2Uu6Kej5p6QID8gcGFyc2Uu6Kej5p6QIDogJyc7XFxcXG4gICAgICAgIHZhciB0ZW1wID0gW107XFxcXG5cXFxcbiAgICAgICAgZm9yICh2YXIgaSBpbiBjb250cykge1xcXFxuICAgICAgICAgICAgaWYgKHBhcnNlLumAiembhuWIl+ihqCAhPSB1bmRlZmluZWQpIHtcXFxcbiAgICAgICAgICAgICAgICBpZiAocGFyc2Uu6YCJ6ZuG5YiX6KGoID09ICdvYmplY3QnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxpc3RzLnB1c2goY29udHNbaV0ubWFwKHggPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogeC50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHgudXJsICsg6Kej5p6QLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB9KSlcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICBsaXN0cy5wdXNoKHBkZmEoY29udHNbaV0sIHBhcnNlLumAiembhuWIl+ihqCkubWFwKHggPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGRmaCh4LCDpgInpm4blkI3np7ApLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogcGQoeCwg6YCJ6ZuG6ZO+5o6lKSArIOino+aekCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSkpXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICB2YXIgdXJsID0gcGQoY29udHNbaV0sIOmAiembhumTvuaOpSk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKCHpgInpm4bpk77mjqUuaW5jbHVkZXMoJ2hyZWYnKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cmwgPSBwZGZoKGNvbnRzW2ldLCDpgInpm4bpk77mjqUpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSBwZGZoKGNvbnRzW2ldLCDpgInpm4blkI3np7ApO1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlID0g5pu/5o2i5Ye95pWwICE9ICcnID8gdGhpcy5ldmFsUmUodGl0bGUsIOabv+aNouWHveaVsCkgOiB0aXRsZTtcXFxcbiAgICAgICAgICAgICAgICB0ZW1wLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsICsg6Kej5p6QLFxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgbGV0IOWAkuW6jyA9IHBhcnNlLuWAkuW6jyA/IHBhcnNlLuWAkuW6jyA6IGZhbHNlO1xcXFxuICAgICAgICB2YXIgcmVzdWx0cyA9IGxpc3RzLmxlbmd0aCA/IGxpc3RzIDogW3RlbXBdO1xcXFxuICAgICAgICBpZiAo5YCS5bqPKSB7XFxcXG4gICAgICAgICAgICByZXN1bHRzID0gcmVzdWx0cy5tYXAoeCA9PiB4LnJldmVyc2UoKSk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcXFxuICAgICAgICBpZiAocmVzdWx0cy5zb21lKHggPT4geC5sZW5ndGggPiAwKSkge1xcXFxuICAgICAgIC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gdGhpcy5nZXRUYWJzKGl0ZW0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcHV0TXlWYXIocGxheSArIGkgKyAnX3RhYnMnLCB0YWJzKTtcXFxcbiAgICAgICAgICAgIGlmIChpdGVtLkFqYXgpIHtcXFxcbiAgICAgICAgICAgICAgICBpZiAobW9kZSA9PSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFicyh0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0pO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFiczIodGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLCBpdGVtLCBwZSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCdlcl9odG1sJywgaHRtbCk7XFxcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2VyX3VybCcsIE1ZX1VSTCk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHMgPSBmdW5jKGdldE15VmFyKCdlcl8nICsgaXRlbS7nsbvlnossICcwJyksIE1ZX1VSTCk7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIHZhciBsaXN0cyA9IHRoaXMuZ2V0TGlzdHMoaXRlbSwgcGxheSArIGkpO1xcXFxuXFxcXG5cXFxcbiAgICAgICAgICAgICAgICBpZiAobGlzdHMuc29tZSh4ID0+IHgubGVuZ3RoID4gMCkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1vZGUgPT0gMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzKHRhYnMsIGl0ZW0u57G75Z6LLCBwbGF5ICsgaSwgaXRlbSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4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Y3QgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFxcXFxcIl9kdW9zZWxlY3RcXFxcXFxcIikgPyBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFxcXFxcIl9kdW9zZWxlY3RcXFxcXFxcIikgOiBbXTtcXFxcbiAgICAgICAgICAgIGlmIChkdW9zZWxlY3QuZmluZEluZGV4KHggPT4geC51cmwgPT09IGRhdGF1cmwpID09IC0xKSB7XFxcXG4gICAgICAgICAgICAgICAgZHVvc2VsZWN0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogZGF0YXRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGRhdGF1cmxcXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIGR1b3NlbGVjdCA9IHVuaXF1ZShkdW9zZWxlY3QpXFxcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShkYXRhdXJsLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBg4oCc4oCc4oCd4oCdPHNwYW4gc3R5bGU9XFxcXFxcXCJjb2xvcjojRkY1NzMzXFxcXFxcXCI+YCArIGRhdGF0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgZnVuY3Rpb24gcmVtb3ZlQnlWYWx1ZShhcnIsIHZhbCkge1xcXFxuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFycltpXVsndXJsJ10gPT0gdmFsKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyLnNwbGljZShpLCAxKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAg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xcXFxcXFwiKSk7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAg5LiA57qnLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaChpdGVtLmpvaW4oXFxcXFxcXCIsXFxcXFxcXCIpKTtcXFxcbiAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICAvL2xvZyhjYXRlZ29yaWVzKVxcXFxuICAgICAgfSk7XFxcXG4gICAgICBpZiAo5oqY5Y+g54q25oCBKSB7XFxcXG4gICAgICAgIGlmIChwYWdlID09IDEpIHtcXFxcbiAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IGZvbGQgPT09IFxcXFxcXFwiMVxcXFxcXFwiID8g5oqY5Y+gIDog5bGV5byALFxcXFxuICAgICAgICAgICAgdXJsOiAkKFxcXFxcXFwiI25vTG9hZGluZyNcXFxcXFxcIikubGF6eVJ1bGUoXFxcXG4gICAgICAgICAgICAgIChmb2xkLCB1LCBhbGwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihNWV9SVUxFLmdyb3VwLCBmb2xkID09PSBcXFxcXFxcIjFcXFxcXFxcIiA/IFxcXFxcXFwiMFxcXFxcXFwiIDogXFxcXFxcXCIxXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIC8qYWxsLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxcXG4gICAgICAgICAgICAgICAgfSk7Ki9cXFxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICBmb2xkLFxcXFxuICAgICAgICAgICAgICDnirbmgIEsXFxcXG4gICAgICAgICAgICAgIOWFqOa4hVxcXFxuICAgICAgICAgICAgKSxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInNjcm9sbF9idXR0b25cXFxcXFxcIixcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgIGxvbmdDbGljazogdGhpcy5hY3Rpb24oe1xcXFxuICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxcXG4gICAgICAgICAgICAgICAgYWxsOiDlhajmuIUsXFxcXG4gICAgICAgICAgICAgICAgY2w6IOa4hemZpCxcXFxcbiAgICAgICAgICAgICAgfSksXFxcXG4gICAgICAgICAgICB9LFxcXFxuICAgICAgICAgIH0pO1xcXFxuICAgICAgICB9XFxcXG4gICAgICB9XFxcXG4gICAgICBpZiAocGFnZSA9PSAxKSB7XFxcXG4gICAgICBjYXRlZ29yaWVzLmZvckVhY2goKGNhdGVnb3J5LCBpbmRleCkgPT4ge1xcXFxuICAgICAgICAvL2xvZyhjYXRlZ29yaWVzKVxcXFxuICAgICAgICBsZXQgc3ViX2NhdGVnb3JpZXMgPSBbXTtcXFxcbiAgICAgICAgLyppZiAo5bCP57G75a6a5L2NLmluY2x1ZGVzKFxcXFxcXFwiO1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NLnNwbGl0KFxcXFxcXFwiO1xcXFxcXFwiKVswXSk7XFxcXG4gICAgICAgICAgaWYgKHN1Yl9jYXRlZ29yaWVzLmxlbmd0aCA9PSAwKSB7XFxcXG4gICAgICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jS5zcGxpdChcXFxcXFxcIjtcXFxcXFxcIilbMV0pO1xcXFxuICAgICAgICAgIH1cXFxcbiAgICAgICAgfSBlbHNlIHsqL1xcXFxuICAgICA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OiDnirbmgIEsXFxcXG4gICAgICAgICAgICAgIGFsbGNsZWFyczog5YWo5riFLFxcXFxuICAgICAgICAgICAgfTtcXFxcblxcXFxuICAgICAgICAgICAgLy9sZXQgdXJsID0gcGQoaXRlbSwgX+Wkp+exu+mTvuaOpSk7XFxcXG4gICAgICAgICAgICBsZXQgdXJsID0gaXRlbS51cmw7XFxcXG4gICAgICAgICAgICAvKmlmICjlpKfnsbvlpITnkIYpIHtcXFxcbiAgICAgICAgICAgICAgdXJsID0g5LiA57qn5YiG57G75aSE55CGKHVybCk7XFxcXG4gICAgICAgICAgICB9Ki9cXFxcbiAgICAgICAgICAgIC8vbG9nKHVybClcXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxcXG4gICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInNjcm9sbF9idXR0b25cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgdXJsOiAkKFxcXFxcXFwiaGlrZXI6Ly9lbXB0eSNub0xvYWRpbmcjXFxcXFxcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgbmV3X2NhdGUgPSBbXTtcXFxcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmFsbGNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNh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xcXFxcXCIpWzBdLFxcXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcXFxcXCJAQFxcXFxcXFwiKVsxXSksXFxcXG4gICAgICAgICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXFxcbiAgICAgICAgICAgICAgICAgIC8vIGpzb24gPSBwZChpdGVtLCDliIbnsbvpk77mjqUpO1xcXFxuICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgIH0qL1xcXFxuICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxcXG4gICAgICAgICAgICAgIC8qdmFyIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQEAnKT97XFxcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEBAJylbMF0pLFxcXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVsxXSksXFxcXG4gICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7XFxcXG4gICAgICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICAgICAganNvbj3liIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAJyk/e1xcXFxuICAgICAgICAgICAgICAgICAgICB0eXBlOuWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVswXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVsxXSksXFxcXG4gICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7Ki9cXFxcbiAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgbGV0IHBhcmFtcyA9IHtcXFxcbiAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxcXG4gICAgICAgICAgICAgIGluZGV4OiBpbmRleCxcXFxcbiAgICAgICAgICAgICAga2V5OiBrZXksXFxcXG4gICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxcXG4gICAgICAgICAgICAgIGpzb246IGpzb24sXFxcXG4gICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxcXG4gICAgICAgICAgICAgIGFsbGNsZWFyczog5YWo5riFLFxcXFxuICAgICAgICAgICAgfTtcXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxcXG4gICAgICAgICAgICAgIHVybDogJChcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIiArIFxcXFxcXFwiI25vTG9hZGluZyNcXFxcXFxcIikubGF6eVJ1bGUoKHBhcmFtcykgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wW3BhcmFtcy5pbmRleF0gPSBwYXJhbXMua2V5LnRvU3RyaW5nKCk7XFxcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcXFxcXCJoZWFkLmNhdGVcXFxcXFxcIiwgSlNPTi5zdHJpbmdpZnkocGFyYW1zLmNhdGVfdGVtcCkpO1xcXFxuICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFxcXFxcImR0X1xcXFxcXFwiICsgcGFyYW1zLmpzb24udHlwZSwgcGFyYW1zLmpzb24udmFsdWUpO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgIH0sIHBhcmFtcyksXFxcXG4gICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInNjcm9sbF9idXR0b25cXFxcXFxcIixcXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJibGFua19ibG9ja1xcXFxcXFwiLFxcXFxuICAgICAgICAgIH0pO1xcXFxuICAgICAgICB9XFxcXG4gICAgICB9KTtcXFxcbiAgICB9XFxcXG4gICAgfSxcXFxcbiAgfTtcXFxcbiAgb2JqLumihOiuvihvcHRpb25zKTtcXFxcbiAgcmV0dXJuIG9iajtcXFxcbn1cXFxcblxcXFxuICAvLy7nirbmgIEoXFxcXFxcXCJ1cmxcXFxcXFxcIilcXFxcbiAgLy8u55WM6Z2iKGQpXFxcXG4gIC8vLua6kOeggSh4aHRtbClcXFxcbiAgLy8u5YWo5riFKFtcXFxcXFxcIjFcXFxcXFxcIiwgXFxcXFxcXCIyXFxcXFxcXCJdKVxcXFxuICAvLy7muIXpmaQoKVxcXFxuICAvLy7lvIDlkK/mipjlj6AoKVxcXFxuICAvLy7pobXnoIEocGFnZSlcXFxcbi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gICAgICB9XFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgdGl0bGU6IHRpdGxlLFxcXFxuICAgICAgICAgIGRlc2M6IGRlc2MsXFxcXG4gICAgICAgICAgcGljX3VybDogaW1nLFxcXFxuICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9laj91cmw9Jyt1cmwrJyNub0hpc3RvcnkjJyxcXFxcbiAgICAgICAgICBjb250ZW50OiBjb250ZW50LFxcXFxuICAgICAgICAgIGNvbF90eXBlOiBydWxlLmNvbF90eXBlLFxcXFxuICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxcXG4gICAgICAgICAgICBpbWc6IGltZyxcXFxcbiAgICAgICAgICAgIGlkOiBpZCxcXFxcbiAgICAgICAgICAgIGNsczogY2xzLFxcXFxuICAgICAgICAgIH0sXFxcXG4gICAgICAgIH0pO1xcXFxuICAgICAgICBpZiAoaSA9PSBsaXN0Lmxlbmd0aCAtIDEgJiYgc2hvdykge1xcXFxuICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJsaW5lXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICBpZDogXFxcXFxcXCJwYWdlbGluZVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICB9KTtcXFxcblxcXFxuICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLigJzigJzigJ3igJ08c21hbGw+5Yqg6L295LitLi4uPC9zbWFsbD5cXFxcXFxcIixcXFxcbiAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJ0ZXh0X2NlbnRlcl8xXFxcXFxcXCIsXFxcXG4gICAgICA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XRNeVZhcihcXFxcXFxcInlpX2ZpcnN0cGFnZVxcXFxcXFwiLCB0cnVlX3VybCk7XFxcXG4gICAgfVxcXFxuICAgIHRyeSB7XFxcXG4gICAgICB2YXIgbmV4dCA9IGV2YWwo5LiL5LiA6aG1KTtcXFxcbiAgICAgIC8vbG9nKFxcXFxcXFwibmV4dFxcXFxcXFwiKTtcXFxcbiAgICAgIC8vbG9nKCduZXh0OicrbmV4dCk7XFxcXG4gICAgfSBjYXRjaCB7XFxcXG4gICAgICBsb2coXFxcXFxcXCLlj6/og73kuI3lrZjlnKjkuIvkuIDpobXmiJbogIXkuIvkuIDpobXlrprkvY3mnInpl67pophcXFxcXFxcIik7XFxcXG4gICAgICBuZXh0ID0gXFxcXFxcXCJcXFxcXFxcIjtcXFxcbiAgICB9XFxcXG4gICAgaWYgKG5leHQgIT0gXFxcXFxcXCJcXFxcXFxcIikge1xcXFxuICAgICAgcHV0TXlWYXIo54q25oCBLCBuZXh0KTtcXFxcbiAgICB9XFxcXG59XFxcIn1dXCIsXCJwcm94eVwiOlwiXCJ9IiwicGljVXJsIjoiaHR0cHM6Ly9pMi52emFuLmNjL2xpdmUvMC91cGxvYWQvaW1hZ2UvanBnLzIwMjMvOS8yMS8xODI0NTdmY2M3ZmRiNGFjZGI0NGZiOWNjNDU5ZDNiNzU2OTBhYS5qcGdAUmVmZXJlcj0iLCJ0aXRsZSI6IuWwgeelnuesrOS4gOmDqO+8muacneatjOmjjuS6kSJ9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement