Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@奇热777✌︎@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6ImJvZHkmJi5wbGF5ZXImJi5zd2lwZXItd3JhcHBlciYmYSYmVGV4dC5qczon5pu05paw6Iez77yaJytpbnB1dCIsInRpdGxlIjoi5aWH54OtNzc34pyM77iOIiwiYXV0aG9yIjoiUiIsInVybCI6Imhpa2VyOi8vZW1wdHkjI2h0dHBzOi8vbS5xaXJlNzc3LmNvbS8iLCJ2ZXJzaW9uIjoyMDIzMTAwOCwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxudmFyIGQgPSBbXTtcblxuTVlfVVJMID0gTVlfVVJMLnJlcGxhY2UoJ2hpa2VyOi8vZW1wdHkjIycsICcnKTtcbnZhciBodG1sID0gZmV0Y2goTVlfVVJMKTtcbi8qXG5jb25zdCBob3N0ID0gJ2h0dHA6Ly9vZnRlbnMudG9wLyc7XG52YXIgaHRtbCA9IGZldGNoKGhvc3QsIHtcbiAgICBoZWFkZXJzOiB7XG4gICAgICAgICdVc2VyLUFnZW50JzogTU9CSUxFX1VBXG4gICAgfVxufSk7Ki9cblxuXG5cbnZhciB0YWJzID0gW1wi55S15b2xXCIsXCLnlLXop4bliadcIiwgXCLliqjmvKtcIiwgXCLnu7zoibpcIl07XG52YXIgdXJscyA9IFtcIi9kaWFueWluZ1wiLFwiL2RpYW5zaGlqdVwiLCBcIi9kb25nbWFuXCIsIFwiL3pvbmd5aVwiXTtcbnZhciBwaWNzID0gW1wiMTMwLnN2Z1wiLFwi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uaW1nLFxcbiAgICAgICAgfVxcbiAgICB9KVxcblxcbiAgICBpZiAoc3RhcnQgPT0gZmFsc2UgfHwgZ2V0TXlWYXIoJ2JlbnN0YXJ0JywgJ3RydWUnKSA9PSAnZmFsc2UnKSB7XFxuICAgICAgICB1blJlZ2lzdGVyVGFzayhpZClcXG4gICAgICAgIHJldHVyblxcbiAgICB9XFxuICAgIFxcbiAgICAvL2xvZyhkYXRhKVxcblxcbiAgICBsZXQgb2JqID0ge1xcbiAgICAgICAgZGF0YTogZGF0YSxcXG4gICAgfTtcXG5cXG4gICAgcmVnaXN0ZXJUYXNrKGlkLCB0aW1lLCAkLnRvU3RyaW5nKChvYmosaWQpID0+IHtcXG4gICAgICAgIHZhciBkYXRhID0gb2JqLmRhdGE7XFxuICAgICAgICB2YXIgcnVtID0gZ2V0TXlWYXIoJ3JudW0nKTtcXG5cXG4gICAgICAgIHZhciBpID0gTnVtYmVyKGdldE15VmFyKCdiYW5uZXJpJywgJzAnKSk7XFxuICAgICAgICBpZiAocnVtICE9ICcnKSB7XFxuICAgICAgICAgICAgaSA9IE51bWJlcihydW0pICsgMVxcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoJ3JudW0nKVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBpID0gaSArIDE7XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZyhpKVxcbiAgICAgICAgLy9sb2coZGF0YS5sZW5ndGgpXFxuXFxuICAgICAgICBpZiAoaSA+IGRhdGEubGVuZ3RoIC0gMSkge1xcbiAgICAgICAgICAgIGkgPSAwXFxuICAgICAgICB9XFxuICAgICAgICB2YXIgaXRlbSA9IGRhdGFbaV07XFxuICAgICAgICAvL2xvZyhpdGVtKVxcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKGlkKydiYXInLCB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgICAgICBpbWc6IGl0ZW0uaW1nLFxcbiAgICAgICAgICAgICAgICB1cmw6IGl0ZW0udXJsLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGl0ZW0uaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgLy9uYW1lOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLFxcbiAgICAgICAgICAgICAgICAgICAgLy9zbmFtZTogaXRlbS5leHRyYS5zbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIC8vc3R5cGU6IGl0ZW0uZXh0cmEuc3R5cGUsXFxuICAgICAgICAgICAgICAgICAgICAvL3N1cmw6IGl0ZW0udXJsLFxcbiAgICAgICAgICAgICAgICAgICAgLy9pbWc6aXRlbS5pbWcsXFxuICAgICAgICAgICAgICAgICAgICAvL3BhZ2VUaXRsZTogaXRlbS50aXRsZS5yZXBsYWNlKC88W14+XSs+L2csICcnKSxcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgbG9nKGUubWVzc2FnZSlcXG4gICAgICAgICAgICB1blJlZ2lzdGVyVGFzayhpZClcXG4gICAgICAgIH1cXG4gICAgICAgIHB1dE15VmFyKCdiYW5uZXJpJywgaSk7XFxuXFxuICAgIH0sIG9iaixpZCkpXFxufVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi4pGg5LiA57qn6aG16Z2iXCIsXCJwYXRoXCI6XCJ5aVwiLFwicnVsZVwiOlwidmFyIEljb25fcHJlZml4ID0gJ2h0dHBzOi8vcmF3LmZhc3RnaXQub3JnL2xzMTI1NzgxMDAzL2xtdHViaWFvL21haW4vbW9yZS8nO1xcbi8qXFxuLy/liLfmlrAgICAgICAgXFxuICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfliLfmlrAnLFxcbiAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIt+aWsOaIkOWKnycgIFxcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIHBpY191cmw6IEljb25fcHJlZml4ICsgJzE0LnBuZycrIFxcXCJAUmVmZXJlcj1cXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaWNvbl81XFxcIlxcbiAgICAgICAgfSk7XFxuXFxuLy/nrZvpgIlcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfnrZvpgIknLFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9zaGFpP3BhZ2U9ZnlwYWdlI25vSGlzdG9yeSMnLFxcbiAgICAgICAgICAgIHBpY191cmw6IEljb25fcHJlZml4ICsgJzMxLnBuZycgKyBcXFwiQFJlZmVyZXI9XFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgICAgIH0pO1xcblxcbi8v5pCc57SiXFxuICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfmkJzntKInLFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9zcycsXFxuICAgICAgICAgICAgcGljX3VybDogSWNvbl9wcmVmaXggKyAnNy5wbmcnICsgXFxcIkBSZWZlcmVyPVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJpY29uXzVcXFwiXFxuICAgICAgICB9KTtcXG5cXG4vL+abtOaWsFxcbiAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+abtOaWsCcsXFxuICAgICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL2d4JyxcXG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biBjdXN0b21EYXRhKGN1c3RvbSkge1xcbiAgICBPYmplY3Qua2V5cyhjdXN0b20pLmZvckVhY2goKGspID0+IHtcXG4gICAgICAgIHRoaXNba10gPSBjdXN0b21ba107XFxuICAgIH0pXFxufVxcblxcbmxldCBFcmppID0ge1xcbiAgICDpgJrlhY06ICQoJycpLmxhenlSdWxlKCgpID0+IHtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBKU09OLnBhcnNlKHJlcXVlc3QoaW5wdXQpLm1hdGNoKC9yIHBsYXllcl8uKj89KC4qPyk8LylbMV0pXFxuICAgICAgICAgICAgdmFyIHVybCA9IGh0bWwudXJsXFxuICAgICAgICAgICAgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gdW5lc2NhcGUodXJsKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMicpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gdW5lc2NhcGUoYmFzZTY0RGVjb2RlKHVybCkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoL20zdTh8bXA0Ly50ZXN0KHVybCkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHVybFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidmlkZW86Ly9cXFwiICsgaW5wdXRcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ2aWRlbzovL1xcXCIgKyBpbnB1dFxcbiAgICAgICAgfVxcbiAgICB9KSxcXG4gICAgdXBkYXRhOiBmdW5jdGlvbihydWxlLCBoZWFkZXJzKSB7XFxuICAgICAgICBoZWFkZXJzID0gaGVhZGVycyAhPSB1bmRlZmluZWQgPyBoZWFkZXJzIDoge307XFxuICAgICAgICBzZXRMYXN0Q2hhcHRlclJ1bGUoJ2pzOicgKyAkLnRvU3RyaW5nKCh1cmwsIHJ1bGUsIGhlYWRlcnMpID0+IHtcXG4gICAgICAgICAgICB2YXIgaHRtbCA9IGZldGNoKHVybCwgaGVhZGVycyk7XFxuICAgICAgICAgICAgc2V0UmVzdWx0KGV2YWwocnVsZSkpXFxuICAgICAgICB9LCBNWV9VUkwsIHJ1bGUsIGhlYWRlcnMpKVxcbiAgICB9LFxcbiAgICBjbG9zZTogZnVuY3Rpb24obGlzdCwgc29ydHMpIHtcXG4gICAgICAgIGFkZExpc3RlbmVyKCdvbkNsb3NlJywgJC50b1N0cmluZygobGlzdCwgc29ydHMpID0+IHtcXG4gICAgICAgICAgICBsaXN0Lm1hcCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcignZXJfJyArIHggKyAnZm9sZCcpO1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdlcl8nICsgeCk7XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHNvcnRzOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcigncGxheWxpc3RfJyArIGkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBjbGVhck15VmFyKCdlcl9wbGF5bGlzdHMnKTtcXG4gICAgICAgIH0sIGxpc3QsIHNvcnRzKSlcXG4gICAgfSxcXG4gICAgZGF0YUNvbnZlcnQ6IGZ1bmN0aW9uKGRhdGEpIHtcXG4gICAgICAgIHZhciBuZXdjbHNsaXN0ID0gZGF0YS5tYXAoZnVuY3Rpb24ob2JqKSB7XFxuICAgICAgICAgICAgdmFyIG5ld09iaiA9IE9iamVjdC5hc3NpZ24oe30sIG9iaik7XFxuICAgICAgICAgICAgaWYgKG5ld09iai5oYXNPd25Qcm9wZXJ0eSgndHlwZScpKSB7XFxuICAgICAgICAgICAgICAgIG5ld09iai5jb2xfdHlwZSA9IG5ld09iai50eX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FwiJiMzOTtcXFwiKTtcXG4gICAgICAgIGRlc2MgPSBkZXNjLnJlcGxhY2UoL1xcXFxyXFxcXG4vZywgXFxcIjxicj5cXFwiKTtcXG5cXG4gICAgICAgIGZ1bmN0aW9uIHN1YnN0cihzdHIsIG1heExlbmd0aCkge1xcbiAgICAgICAgICAgIGxldCBsZW4gPSAwO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGlmIChzdHIuY2hhckNvZGVBdChpKSA+IDI1NSkge1xcbiAgICAgICAgICAgICAgICAgICAgbGVuICs9IDI7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBsZW4rKztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAobGVuID4gbWF4TGVuZ3RoKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RyLnNsaWNlKDAsIGkpICsgJy4uLic7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHN0cjtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBzZGVzYyA9IHN1YnN0cihkZXNjLCBudW0pO1xcbiAgICAgICAgdmFyIGxhenkgPSAkKGAjbm9Mb2FkaW5nI2ApLmxhenlSdWxlKChkYywgc2RjLCBtKSA9PiB7XFxuICAgICAgICAgICAgdmFyIHNob3cgPSBzdG9yYWdlMC5nZXRJdGVtKG0sICcwJyk7XFxuICAgICAgICAgICAgdmFyIHRpdGxlID0gZmluZEl0ZW0oJ2Rlc2MnKS50aXRsZTtcXG4gICAgICAgICAgICB2YXIgcmUgPSAvKDxcXFxcL3NtYWxsPjxicj4uKj8+KS4rL2c7XFxuICAgICAgICAgICAgdmFyIGV4cCA9ICflsZXlvIA6JztcXG4gICAgICAgICAgICB2YXIgcmV0ID0gJ+aUtui1tzonO1xcbiAgICAgICAgICAgIGlmIChzaG93ID09ICcxJykge1xcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKCdkZXNjJywge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UocmV0LCBleHApXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UocmUsICckMScgKyBzZGMgKyAnPC9zbWFsbD4nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8oPFxcXFwvc21hbGw+PGJyPjxmb250IGNvbG9yPVxcXCIpLio/KFxcXCI+KS8sICckMSM4QTJCRTIkMicpLy/mlLbotbfpopzoibJcXG5cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShtLCAnMCcpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rlc2MnLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShleHAsIHJldClcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZSwgJyQxJyArIGRjICsgJzwvc21hbGw+JylcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvKDxcXFxcL3NtYWxsPjxicj48Zm9udCBjb2xvcj1cXFwiKS4qPyhcXFwiPikvLCAnJDEjMDA4MDAwJDInKS8v5bGV5byA6aKc6ImyXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0obSwgJzEnKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGBoaWtlcjovL2VtcHR5YFxcbiAgICAgICAgfSwgZGVzYywgc2Rlc2MsIG1hcmspXFxuICAgICAgICB2YXIgc2MgPSBzdG9yYWdlMC5nZXRJdGVtKG1hcmssICcwJykgPT0gJzAnID8gJ+WxleW8gDonIDogJ+aUtui1tzonO1xcbiAgICAgICAgdmFyIGRjID0gc3RvcmFnZTAuZ2V0SXRlbShtYXJrLCAnMCcpID09ICcwJyA/IHNkZXNjIDogZGVzYztcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICcnICsgJzxiPjxmb250IGNvbG9yPVxcXCIjMDk4QUMxXFxcIj7iiLcgICAgICAgICAgICAgICAgICAgICAg5Ymn5oOF566A5LuLXFx0PC9mb250PjwvYj4nICsgXFxcIjxzbWFsbD48YSBzdHlsZT0ndGV4dC1kZWNvcmF0aW9uOiBub25lOycgaHJlZj0nXFxcIiArIGxhenkgKyBcXFwiJz5cXFwiICsgc2MgKyAnPC9hPjwvc21hbGw+PGJyPjxmb250IGNvbG9yPVxcXCIjOEEyQkUyXFxcIj4nICsgYCR7ZGN9YCArICc8L3NtYWxsPicsLy/pu5jorqTpopzoibJcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3JpY2hfdGV4dCcsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6ICdkZXNjJyxcXG4gICAgICAgICAgICAgICAgbGluZVNwYWNpbmc6IDYsXFxuICAgICAgICAgICAgICAgIHRleHRTaXplOiAxNSxcXG4gICAgICAgICAgICAgICAgbGluZVZpc2libGU6IHRydWUsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfSxcXG5cXG5cXG4vL+a1t+aKpVxcbiAgICBzdHJDb252ZXJ0OiBmdW5jdGlvbihhcnIpIHtcXG4gICAgICAgIHJldHVybiBhcnIubWFwKHggPT4ge1xcbiAgICAgICAgICAgIHN0ciA9IHg7XFxuICAgICAgICAgICAgaWYgKC8o5a+85ryUfOS4u+a8lHznsbvlnosp77yaLy50ZXN0KHN0cikpIHtcXG4gICAgICAgICAgICAgICAgc3RyID0gc3RyLnNwbGl0KCcvJykubWFwKCh2YWwsIGluZGV4KSA9PiAoaW5kZXggPT09IDAgPyAnJyA6ICcnKSArIHZhbCkuc2xpY2UoMCwgNSkuam9pbignICcpLnJlcGxhY2UoLyAkLywgJycpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gc3RyXFxuICAgICAgICB9KVxcbiAgICB9LFxcbiAgICBzZXRDb250ZW50OiBmdW5jdGlvbihvYmopIHtcXG4gICAgICAgIC8vbG9nKG9iailcXG4gICAgICAgIHZhciBjb250ZW50cyA9IG9iai5tYWluO1xcbiAgICAgICAgdmFyIHNvcnRPcmRlciA9IG9iai5zb3J0O1xcbiAgICAgICAgdmFyIGltZyA9IG9iai5pbWc7XFxuICAgICAgICB2YXIgdGV4dHMgPSBjb250ZW50cy5tYXAoeCA9PiBwZGZoKHgsICdUZXh0JykpO1xcblxcbiAgICAgICAgdmFyIGFycmF5ID0gdGV4dHMuc29ydCgoYSwgYikgPT4ge1xcbiAgICAgICAgICAgIGNvbnN0IGluZGV4QSA9IHNvcnRPcmRlci5pbmRleE9mKGEuc3Vic3RyKDAsIDIpKTtcXG4gICAgICAgICAgICBjb25zdCBpbmRleEIgPSBzb3J0T3JkZXIuaW5kZXhPZihiLnN1YnN0cigwLCAyKSk7XFxuICAgICAgICAgICAgcmV0dXJuIGluZGV4QSAtIGluZGV4QjtcXG4gICAgICAgIH0pXFxuICAgICAgICB2YXIgcmVnZXggPSBuZXcgUmVnRXhwKCcoJyArIHNvcnRPcmRlci5qb2luKCd8JykgKyAnKScpO1xcbiAgICAgICAgYXJyYXkgPSBhcnJheS5maWx0ZXIoZnVuY3Rpb24oaXRlbSkge1xcbiAgICAgICAgICAgIHJldHVybiByZWdleC50ZXN0KGl0ZW0pO1xcbiAgICAgICAgfSk7XFxuICAgICAgICAvL2xvZyhhcnJheSlcXG5cXG4gICAgICAgIC8vYXJyYXkgPSBzb3J0T3JkZXIubGVuZ3RoPT0wP2FycmF5OnRoaXMuc3RyQ29udmVydChhcnJheSk7XFxuICAgICAgICBhcnJheSA9IHRoaXMuc3RyQ29udmVydChhcnJheSk7XFxuXFxuICAgICAgICBpZiAoYXJyYXkubGVuZ3RoID4gNikge1xcbiAgICAgICAgICAgIGFycmF5ID0gYXJyYXkuc2xpY2UoMCwgNik7XFxuICAgICAgICB9XFxuXFxuICAgICAgICB2YXIgdGl0bGVzID0gW107XFxuICAgICAgICB2YXIgZGVzY3MgPSBbXTtcXG5cXG4gICAgICAgIHN3aXRjaCAoYXJyYXkubGVuZ3RoKSB7XFxuICAgICAgICAgICAgY2FzZSA0OlxcbiAgICAgICAgICAgIGNhc2UgNTpcXG4gICAgICAgICAgICAgICAgdGl0bGVzID0gYXJyYXkuc2xpY2UoMCwgMik7XFxuICAgICAgICAgICAgICAgIGRlc2NzID0gYXJyYXkuc2xpY2UoMik7XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIGNhc2UgNjpcXG4gICAgICAgICAgICAgICAgdGl0bGVzID0gYXJyYXkuc2xpY2UoMCwgMyk7XFxuICAgICAgICAgICAgICAgIGRlc2NzID0gYXJyYXkuc2xpY2UoMyk7XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgfVxcbiAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2VyX2luZm8nLCB7XFxuICAgICAgICAgICAgZGVzYzogZGVzY3Muam9pbignXFxcXG4nKSxcXG4gICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgIH0pXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAvLyB0aXRsZTogIHRoaXMuc21hbGwoIHRpdGxlc1swXSArICdcXFxcbicgK3RpdGxlcy5zbGljZSgxLCAzKS5qb2luKCdcXFxcbicpLCdyZWQnKSxcXG4gICAgICAgICAgICAvL2Rlc2M6IHRoaXMuc21hbGwoZGVzY3Muam9pbignXFxcXG4nKSwnI0ZGN0YwMCcpLFxcbiAgICAgICAgICAgdGl0bGU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xcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAyKTtcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgyKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSA2OlxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAzKTtcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgzKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICB9XFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfaW5mbycsIHtcXG4gICAgICAgICAgICBkZXNjOiBkZXNjcy5qb2luKCdcXFxcbicpLFxcbiAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgfSlcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSArICdcXFxcbicgKyB0aGlzLnNtYWxsKHRpdGxlcy5zbGljZSgxLCAzKS5qb2luKCdcXFxcbicpKSxcXG4gICAgICAgICAgICBkZXNjOiB0aGlzLnNtYWxsKGRlc2NzLmpvaW4oJ1xcXFxuJykpLFxcbiAgICAgICAgICAgIHBpY191cmw6IGltZyArICdAUmVmZXJlcj0nLFxcbiAgICAgICAgICAgIHVybDogTVlfVVJMLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnbW92aWVfMV92ZXJ0aWNhbF9waWNfYmx1cicsXFxuICAgICAgICB9KVxcbiAgICB9LFxcbiAgICBpc0NvbG9yOiBmdW5jdGlvbih0ZXh0KSB7XFxuICAgICAgICBjb25zdCByZWdleCA9IC9eIyhbMC05QS1GYS1mXXszfXxbMC05QS1GYS1mXXs2fSkkfF4oW2Etel0rKSQvaTtcXG4gICAgICAgIHJldHVybiByZWdleC50ZXN0KHRleHQpO1xcbiAgICB9LFxcbiAgICBnZXRQcmVzZXQ6IGZ1bmN0aW9uK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iAgICBjcmVhdGVQTGlzdDogZnVuY3Rpb24odGFicywgdmFyaSwgc2hzb3J0LCBjdXN0b20pIHtcXG4gICAgICAgIHZhcmkgPSBcXFwiZXJfXFxcIiArIHZhcmk7XFxuICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHRhYnMubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICB2YXIgdXJsID0gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgodmFyaSwgc2hzb3J0LCBpLCBsaW5lYykgPT4ge1xcblxcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCAnW10nKTtcXG5cXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHZhcmkgKyAnZm9sZCcsICcxJykgPT0gJzAnKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgYnRuID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19idXR0b24nKTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBmb2xkcyA9IFsnPGZvbnQgY29sb3I9XFxcIiNEM0QzRDNcXFwiPuKYtycsICc8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+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+S4ujonICsgaW5wdXQ7XFxuICAgICAgICAgICAgICAgIH0sIHNoc29ydCwgY2xzKTtcXG4gICAgICAgICAgICB9LCBzaHNvcnQsIGN1c3RvbSlcXG4gICAgICAgIH1dXFxuICAgIH0sXFxuICAgIHNldFRhYnM6IGZ1bmN0aW9uKHRhYnMsIHZhcmksIHNoc29ydCwgcGFyc2UpIHtcXG4gICAgICAgIGxldCBjdXN0b20gPSBwYXJzZS7oh6rlrprkuYk7XFxuICAgICAgICBjdXN0b20gPSB0aGlzLmdldFByZXNldChjdXN0b20pO1xcbiAgICAgICAgc2hzb3J0ID0gc2hzb3J0ID8gc2hzb3J0IDogJ3Noc29ydCc7XFxuICAgICAgICB2YXIgdGl0bGUgPSAoZ2V0T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uW6j2BdO1xcblxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgbmV3Y2xzbGlzdC5yZXZlcnNlKCk7XFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihzaHNvcnQgKyAnX2xpbmUnLCBuZXdjbHNsaXN0KTtcXG5cXG4gICAgICAgICAgICAgICAgdmFyIG9iaiA9IGZpbmRJdGVtKHNoc29ydCArICdfYXZhdGFyJylcXG5cXG4gICAgICAgICAgICAgICAgaWYgKGNvbmYgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMV0sIHRpdGxlc1swXSksXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1swXSwgdGl0bGVzWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMScpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/liIfmjaLmjpLluo/miJDlip8nO1xcbiAgICAgICAgICAgIH0sIHNoc29ydCwgdmFyaSwgY3VzdG9tKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcicsXFxuICAgICAgICAgICAgaW1nOiBjdXN0b20u5Zu+5qCHLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX2F2YXRhcicsXFxuICAgICAgICAgICAgICAgIGxvbmdDbGljazogdGhpcy5zZXRMb25nY2xpY2soc2hzb3J0KSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgdmFyIOaKmOWPoCA9ICfigJzigJzigJ3igJ08Yj4nICsgJ+KYtycuZm9udGNvbG9yKFxcXCIjRDNEM0QzXFxcIik7XFxuICAgICAgICB2YXIg5bGV5byAID0gJ+KAnOKAnOKAneKAnTxiPicgKyAn4piwJy5mb250Y29sb3IoXFxcIiNGRkE1MDBcXFwiKTtcXG4gICAgICAgIHZhciBmb2xkbmFtZSA9ICdlcl8nICsgdmFyaSArICdmb2xkJztcXG4gICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuICAgICAgICBpZiAodHlwZW9mKHBhcnNlWyfmjqjpgIEnXSkgIT0gJ3VuZGVmaW5lZCcgJiYgcGFyc2VbJ+aOqOmAgSddKVxcbiAgICAgICAgICAgIHRoaXMucHVzaFRhYignZXJfJyArIHZhcmksIHNoc29ydCk7XFxuXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBmb2xkID09PSAnMCcgPyDmipjlj6AgOiDlsZXlvIAsXFxuICAgICAgICAgICAgY29sX3R5cGU6IGN1c3RvbS7nur/ot6/moLflvI8sXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChmb2xkbmFtZSwgc2hzb3J0KSA9PiB7XFxuICAgICAgICAgICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXG4gICAgICAgICAgICAgICAgdmFyIGJ0biA9IGZpbmRJdGVtKHNoc29ydCArICdfYnV0dG9uJyk7XFxuICAgICAgICAgICAgICAgIHZhciBmb2xkcyA9IFsnPGZvbnQgY29sb3I9XFxcIiNEM0QzRDNcXFwiPuKYtycsICc8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJ107XFxuXFxuICAgICAgICAgICAgICAgIGlmIChmb2xkID09ICcwJykge1xcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgY3MgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2NscycpO1xcbiAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKG9iai5leHRyYS5pZCwgY3MpO1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMF0sIGZvbGRzWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgJzAnKTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwY2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBjeCA9ICQuZGF0YUNvbnZlcnQocGNscyk7XFxuICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2NscycsIGN4KTtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMV0sIGZvbGRzWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovLycgKyAoZm9sZCA9PT0gJzEnID8gJ+aUtui1tycgOiAn5bGV5byAJyk7XFxuICAgICAgICAgICAgfSwgZm9sZG5hbWUsIHNoc29ydCksXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYnV0dG9uJyxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgdGhpcy5jcmVhdGVQTGlzdCh0YWJzLCB2YXJpLCBzaHNvcnQsIGN1c3RvbSk7XFxuICAgIH0sXFxuICAgIHNldFRhYnMyOiBmdW5jdGlvbih0YWJzLCB2YXJpLCBzaHNvcnQsIHBhcnNlLCBleHApIHtcXG4gICAgICAgIGxldCBjdXN0b20gPSBwYXJzZS7oh6rlrprkuYk7XFxuICAgICAgICBjdXN0b20gPSB0aGlzLmdldFByZXNldChjdXN0b20pO1xcblxcbiAgICAgICAgc2hzb3J0ID0gc2hzb3J0ID8gc2hzb3J0IDogJ3Noc29ydCc7XFxuICAgICAgICB2YXIgdGl0bGUgPSAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKSA9PSAnMScpID8gJzxiPjxzcGFuIHN0eWxlPVxcXCJjb2xvcjonICsgY3VzdG9tLumAhuW6j+minOiJsiArICdcXFwiPumAhuW6jzwvc3Bhbj48L2I+JyA6ICc8Yj48c3BhbiBzdHlsZT1cXFwiY29sb3I6JyArIGN1c3RvbS7mraPluo/popzoibIgKyAnXFxcIj7mraPluo88L3NwYW4+PC9iPidcXG5cXG4gICAgICAgIHZhciDmipjlj6AgPSAnPGI+5oqY5Y+gJy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IGNzID0gW2JjbHNdLmNvbmNhdCh0Y2xzLCBbbGNsc10sIHBjbHMpO1xcblxcbiAgICAgICAgICAgICAgICBpZiAocHVzaCkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQgKyAnX3B1c2h0YWInKTtcXG4gICAgICAgICAgICAgICAgICAgIGNzID0gcGNscy5jb25jYXQoY3MpO1xcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIHZhciBjeCA9ICQuZGF0YUNvbnZlcnQoY3MpO1xcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2NscycsIGN4KTtcXG4gICAgICAgICAgICAgICAgaWYgKHB1c2gpIHtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQgKyAnX3B1c2h0YWInKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKGJjbHMuZXh0cmEuaWQpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0ob2JqLmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBvYmouZGVzYy5yZXBsYWNlKCflsZXlvIA8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJywgJ+aKmOWPoDxmb250IGNvbG9yPVxcXCIjRDNEM0QzXFxcIj7imLcnKSxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzAnKSB7XFxuICAgICAgICAgICAgICAgIHZhciBjcyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfY2xzJyk7XFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihzaHNvcnQgKyAnX2F2YXRhcicsIGNzKTtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShvYmouZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IG9iai5kZXNjLnJlcGxhY2UoJ+aKmOWPoDxmb250IGNvbG9yPVxcXCIjRDNEM0QzXFxcIj7imLcnLCAn5bGV5byAPGZvbnQgY29sb3I9XFxcIiNGRkE1MDBcXFwiPuKYsCcpLFxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgZm9sZCA9PT0gJzEnID8gJzAnIDogJzEnKTtcXG4gICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyArIChmb2xkID09PSAnMScgPyAn5pS26LW3JyA6ICflsZXlvIAnKTtcXG4gICAgICAgIH0sIGZvbGRuYW1lLCBzaHNvcnQsIChwYXJzZVsn5o6o6YCBJ10gPyB0cnVlIDogZmFsc2UpKTtcXG4gICAgICAgIHZhciBkZXNjID0gKGZvbGQgPT09ICcwJyA/IOaKmOWPoCA6IOWxleW8gCkgKyAnXFxcXHQnO1xcblxcbiAgICAgICAgaWYgKGV4cC5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICAgIHVybCA9ICdoaWtlcjovL2VtcHR5JztcXG4gICAgICAgICAgICBkZXNjID0gJyc7XFxuICAgICAgICB9XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiB2YXJpICsgJzpcXFxcdFxcXFx0JyArICflhbEnICsgU3RyaW5nKHRhYnMubGVuZ3RoKS5mb250Y29sb3IoJyM0NjgyQjQnKSArICfmnaHnur/ot68nLFxcbiAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdhdmF0YXInLFxcbiAgICAgICAgICAgIGltZzogY3VzdG9tLuWbvuaghyxcXG4gICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19hdmF0YXInLFxcbiAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IHRoaXMuc2V0TG9uZ2NsaWNrKHNoc29ydCksXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmICh0eXBlb2YocGFyc2VbJ+aOqOmAgSddKSAhPSAndW5kZWZpbmVkJyAmJiBwYXJzZVsn5o6o6YCBJ10pXFxuICAgICAgICAgICAgdGhpcy5wdXNoVGFiKCdlcl8nICsgdmFyaSwgc2hzb3J0KTtcXG5cXG4gICAgICAgIGlmIChmb2xkID09ICcwJykge1xcbiAgICAgICAgICAgIHJldHVyblxcbiAgICAgICAgfVxcblxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyB0aXRsZSxcXG4gICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHZhcmksIHNoc29ydCwgY3VzdG9tKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBjb25mID0gZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgICAgICAgICAgdmFyIGNsc2xpc3RzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgdmFyIG5ld2Nsc2xpc3QgPSAkLmRhdGFDb252ZXJ0KGNsc2xpc3RzKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgIG5ld2Nsc2xpc3QucmV2ZXJzZSgpO1xcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywgbmV3Y2xzbGlzdCk7XFxuXFxuICAgICAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2J1dHRvbicpXFxuICAgICAgICAgICAgICAgIHZhciB0aXRsZXMgPSBbYCR7Y3VzdG9tLuato+W6j+minOiJsn1cXFwiPuato+W6j2AsIGAke2N1c3RvbS7pgIbluo/popzoibJ9XFxcIj7pgIbluo9gXTtcXG5cXG4gICAgICAgICAgICAgICAgaWYgKGNvbmYgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYnV0dG9uJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMV0sIHRpdGxlc1swXSksXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19idXR0b24nLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1swXSwgdGl0bGVzWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMScpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5o6S5bqP5oiQ5YqfJ1xcbiAgICAgICAgICAgIH0sIHZhcmksIHNoc29ydCwgY3VzdG9tKSxcXG4gICAgIC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QgPSBsaXN0c1tpbmRleF07XFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKHNoc29ydCArICdfc29ydCcpID09ICcxJyAmJiBsaXN0cy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIGxpc3QgPSBsaXN0c1tpbmRleF0ucmV2ZXJzZSgpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG5cXG4gICAgICAgIGlmICjmoLflvI8gPT0gJycpIHtcXG4gICAgICAgICAgICDmoLflvI8gPSBsaXN0Lmxlbmd0aCA+IDMgPyAndGV4dF80JyA6ICd0ZXh0XzInXFxuICAgICAgICB9XFxuICAgICAgICBcXG4gICAgICAgIHZhciBleHRyYSA9ICcnO1xcblxcbiAgICAgICAgaWYgKHBhcnNlLmV4dHJhICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgIGV4dHJhID0gcGFyc2UuZXh0cmFcXG4gICAgICAgIH1cXG5cXG4gICAgICAgIGlmIChsaXN0Lmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICB2YXIgcGxpc3QgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9Jyk7XFxuICAgICAgICAgICAgaWYgKCFwbGlzdC5oYXNPd25Qcm9wZXJ0eShzaHNvcnQpKSB7XFxuICAgICAgICAgICAgICAgIHBsaXN0W3Noc29ydF0gPSB7fTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XVsnY2xzJ10gPSBzaHNvcnQ7XFxuICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XVsnY29sX3R5cGUnXSA9IOagt+W8jztcXG4gICAgICAgICAgICBwbGlzdFtzaHNvcnRdWydwaWMnXSA9IOWbvuaghzsgXFxuICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XVsnZXh0cmEnXT1leHRyYTsgICAgICAgICAgIFxcbiAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9wbGF5bGlzdHMnLCBwbGlzdCk7XFxuICAgICAgICB9XFxuICAgICAgICBcXG5cXG4gICAgICAgIGZvciAodmFyIGogaW4gbGlzdCkge1xcbiAgICAgICAgICAgIGxldCBsdCA9IHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGxpc3Rbal0udGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogbGlzdFtqXS51cmwsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiDmoLflvI8sXFxuICAgICAgICAgICAgICAgIHBpYzog5Zu+5qCHLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGxpc3Rbal0udXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQsICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICBsdFsnZXh0cmEnXSA9IE9iamVjdC5hc3NpZ24oe30sIGx0WydleHRyYSddLCBleHRyYSk7XFxuICAgICAgICAgICAgZC5wdXNoKGx0KTtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAgZXZhbFJlOiBmdW5jdGlvbihpbnB1dCwg5Ye95pWwKSB7XFxuICAgICAgICBsZXQgcmVzdWx0ID0gaW5wdXQ7XFxuICAgICAgICByZXN1bHQgPSBldmFsKCdpbnB1dCcgKyDlh73mlbApO1xcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcXG4gICAgfSxcXG4gICAgZ2V0VGFiczogZnVuY3Rpb24ocGFyc2UpIHtcXG4gICAgICAgIHZhciB0YWJzID0gW107XFxuICAgICAgICB2YXIgYXJ0cyA9IFtdO1xcbiAgICAgICAgaWYgKHR5cGVvZiBwYXJzZS7nur/ot68gPT0gJ29iamVjdCcpIHtcXG4gICAgICAgICAgICBhcnRzID0gcGFyc2Uu57q/6LevO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGFydHMubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICBhcnRzID0gcGRmYShodG1sLCBwYXJzZS7nur/ot68pO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIOe6v+i3r+WQjSA9IHBhcnNlLue6v+i3r+WQjeensDtcXG4gICAgICAgIHZhciDmm7/mjaLlh73mlbAgPSAnJztcXG4gICAgICAgIGlmIChwYXJzZS7nur/ot6/lkI3np7AuaW5jbHVkZXMoJ0BAJykpIHtcXG4gICAgICAgICAgICDnur/ot6/lkI0gPSBwYXJzZS7nur/ot6/lkI3np7Auc3BsaXQoJ0BAJylbMF07XFxuICAgICAgICAgICAg5pu/5o2i5Ye95pWwID0gcGFyc2Uu57q/6Lev5ZCN56ewLnNwbGl0KCdAQCcpWzFdO1xcbiAgICAgICAgfVxcbiAgICAgICAgZm9yICh2YXIgaSBpbiBhcnRzKSB7XFxuICAgICAgICAgICAgbGV0IGxpbmVuYW1lID0gJyc7XFxuICAgICAgICAgICAgaWYgKOe6v+i3r+WQjSA9PSAnJykge1xcbiAgICAgICAgICAgICAgICBsaW5lbmFtZSA9IGFydHNbaV07XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgbGluZW5hbWUgPSBwZGZoKGFydHNbaV0sIOe6v+i3r+WQjSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICjmm7/mjaLlh73mlbAgIT0gJycpIHtcXG4gICAgICAgICAgICAgICAgbGluZW5hbWUgPSB0aGlzLmV2YWxSZShsaW5lbmFtZSwg5pu/5o2i5Ye95pWwKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGFicy5wdXNoKGxpbmVuYW1lKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiB0YWJzO1xcbiAgICB9LFxcbiAgICBnZXRMaXN0czogZnVuY3Rpb24ocGFyc2UsIHNoc29ydCkge1xcbiAgICAgICAgc2hz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AgdmFyIHRlbXAgPSBbXTtcXG5cXG4gICAgICAgIGZvciAodmFyIGkgaW4gY29udHMpIHtcXG4gICAgICAgICAgICBpZiAocGFyc2Uu6YCJ6ZuG5YiX6KGoICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICBpZiAocGFyc2Uu6YCJ6ZuG5YiX6KGoID09ICdvYmplY3QnKSB7XFxuICAgICAgICAgICAgICAgICAgICBsaXN0cy5wdXNoKGNvbnRzW2ldLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogeC50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCArIOino+aekCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9KSlcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxpc3RzLnB1c2gocGRmYShjb250c1tpXSwgcGFyc2Uu6YCJ6ZuG5YiX6KGoKS5yZXZlcnNlKCkubWFwKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwZGZoKHgsIOmAiembhuWQjeensCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogcGQoeCwg6YCJ6ZuG6ZO+5o6lKSArIOino+aekCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9KSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHZhciB1cmwgPSBwZChjb250c1tpXSwg6YCJ6ZuG6ZO+5o6lKTtcXG4gICAgICAgICAgICAgICAgaWYgKCHpgInpm4bpk77mjqUuaW5jbHVkZXMoJ2hyZWYnKSkge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsID0gcGRmaChjb250c1tpXSwg6YCJ6ZuG6ZO+5o6lKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSBwZGZoKGNvbnRzW2ldLCDpgInpm4blkI3np7ApO1xcbiAgICAgICAgICAgICAgICB0aXRsZSA9IOabv+aNouWHveaVsCAhPSAnJyA/IHRoaXMuZXZhbFJlKHRpdGxlLCDmm7/mjaLlh73mlbApIDogdGl0bGU7XFxuICAgICAgICAgICAgICAgIHRlbXAucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCArIOino+aekCxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBsZXQg5YCS5bqPID0gcGFyc2Uu5YCS5bqPID8gcGFyc2Uu5YCS5bqPIDogZmFsc2U7XFxuICAgICAgICB2YXIgcmVzdWx0cyA9IGxpc3RzLmxlbmd0aCA/IGxpc3RzIDogW3RlbXBdO1xcbiAgICAgICAgaWYgKOWAkuW6jykge1xcbiAgICAgICAgICAgIHJlc3VsdHMgPSByZXN1bHRzLm1hcCh4ID0+IHgucmV2ZXJzZSgpKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXG4gICAgICAgIGlmIChyZXN1bHRzLnNvbWUoeCA9PiB4Lmxlbmd0aCA+IDApKSB7XFxuICAgICAgICAgICAgaWYgKCFwbGlzdC5oYXNPd25Qcm9wZXJ0eShzaHNvcnQpKSB7XFxuICAgICAgICAgICAgICAgIHBsaXN0W3Noc29ydF0gPSB7fTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XVsnbGVuZ3RoJ10gPSByZXN1bHRzLmxlbmd0aDtcXG4gICAgICAgIH07XFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfcGxheWxpc3RzJywgcGxpc3QpO1xcbiAgICAgICAgcmV0dXJuIHJlc3VsdHM7XFxuICAgIH0sXFxuICAgIGdldFBsYXllcnM6IGZ1bmN0aW9uKHBhcnNlLCBtb2RlLCBmdW5jKSB7XFxuICAgICAgICAvL2xvZyhtb2RlKVxcbiAgICAgICAgdmFyIHBsYXkgPSAnZXJfcGxheWxpc3RfJztcXG4gICAgICAgIHRoaXMucHJlTG9hZChmdW5jKTtcXG4gICAgICAgIHRoaXMuY2xvc2UocGFyc2UubWFwKHggPT4geC7nsbvlnospLCBwYXJzZS5sZW5ndGgpO1xcbiAgICAgICAgbW9kZSA9IG1vZGUgPyBtb2RlIDogMTtcXG5cXG4gICAgICAgIGxldCBwZSA9IFsxXTtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgcGUgPSBwYXJzZS5tYXAoeCA9PiBwZGZhKGh0bWwsIHgu57q/6LevKS5sZW5ndGgpLmZpbHRlcih5ID0+IHkgPiAwKTtcXG4gICAgICAgIH0gY2F0Y2gge31cXG5cXG5cXG4gICAgICAgIHBhcnNlLmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgICAgICB2YXIgdGFicyA9IFsn5Li757q/J107XFxuICAgICAgICAgICAgaWYgKGl0ZW0u57q/6LevICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICB0YWJzID0gdGhpcy5nZXRUYWJzKGl0ZW0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBwdXRNeVZhcihwbGF5ICsgaSArICdfdGFicycsIHRhYnMpO1xcbiAgICAgICAgICAgIGlmIChpdGVtLkFqYXgpIHtcXG4gICAgICAgICAgICAgICAgaWYgKG1vZGUgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzKHRhYnMsIGl0ZW0u57G75Z6LLCBwbGF5ICsgaSwgaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhYnMyKHRhYnMsIGl0ZW0u57G75Z6LLCBwbGF5ICsgaSwgaXRlbSwgcGUpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCdlcl9odG1sJywgaHRtbCk7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCdlcl91cmwnLCBNWV9VUkwpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHMgPSBmdW5jKGdldE15VmFyKCdlcl8nICsgaXRlbS7nsbvlnossICcwJyksIE1ZX1VSTCk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdmFyIGxpc3RzID0gdGhpcy5nZXRMaXN0cyhpdGVtLCBwbGF5ICsgaSk7XFxuXFxuXFxuICAgICAgICAgICAgICAgIGlmIChsaXN0cy5zb21lKHggPT4geC5sZW5ndGggPiAwKSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1vZGUgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFicyh0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhYnMyKHRhYnMsIGl0ZW0u57G75Z6LLCBwbGF5ICsgaSwgaXRlbSwgcGUpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChnZXRNeVZhcignZXJfJyArIGl0ZW0u57G75Z6LICsgJ2ZvbGQnLCAnMScpID09ICcxJykge1xcbiAgICAgICAgICAgICAgICB0aGlzLnNldExpc3RzKGxpc3RzLCBnZXRNeVZhcignZXJfJyArIGl0ZW0u57G75Z6LLCAnMCcpLCBwbGF5ICsgaSwgaXRlbSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0pXFxuICAgIH1cXG59XFxuXFxuXFxubGV0IE1ldGhvZHMgPSB7XFxuICAgIC8v5aSa6YCJ5qih5Z2XXFxuICAgIE11bHRpU2VsZWN0TW9kZTogZnVuY3Rpb24obmFtZSwgaWQsIHNoc29ydCkge1xcbiAgICAgICAgcmV0dXJuICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGRhdGF0aXRsZSwgZGF0YXVybCwgc2hzb3J0KSA9PiB7XFxuICAgICAgICAgICAgZnVuY3Rpb24gdW5pcXVlKGFycikge1xcbiAgICAgICAgICAgICAgICBjb25zdCByZXMgPSBuZXcgTWFwKClcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGFyci5maWx0ZXIoKGEpID0+ICFyZXMuaGFzKGEudXJsKSAmJiByZXMuc2V0KGEudXJsLCAxKSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGR1b3NlbGVjdCA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArIFxcXCJfZHVvc2VsZWN0XFxcIikgPyBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFwiX2R1b3NlbGVjdFxcXCIpIDogW107XFxuICAgICAgICAgICAgaWYgKGR1b3NlbGVjdC5maW5kSW5kZXgoeCA9PiB4LnVybCA9PT0gZGF0YXVybCkgPT0gLTEpIHtcXG4gICAgICAgICAgICAgICAgZHVvc2VsZWN0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGRhdGF0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogZGF0YXVybFxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBkdW9zZWxlY3QgPSB1bmlxdWUoZHVvc2VsZWN0KVxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGRhdGF1cmwsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBg4oCc4oCc4oCd4oCdPHNwYW4gc3R5bGU9XFxcImNvbG9yOiNGRjU3MzNcXFwiPmAgKyBkYXRhdGl0bGUsXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJlbW92ZUJ5VmFsdWUoYXJyLCB2YWwpIHtcXG4gICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFycltpXVsndXJsJ10gPT0gdmFsKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyci5zcGxpY2UoaSwgMSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZW1vdmVCeVZhbHVlKGR1b3NlbGVjdCwgZGF0YXVybClcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShkYXRhdXJsLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogZGF0YXRpdGxlXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyBcXFwiX2R1b3NlbGVjdFxcXCIsIGR1b3NlbGVjdCk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgfSwgbmFtZSwgaWQsIHNoc29ydClcXG4gICAg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7XFxuICAgICAgcmV0dXJuIHRoaXM7XFxuICAgIH0sXFxuICAgIOeKtuaAgShpbnB1dCkge1xcbiAgICAgIHRoaXMuc3RhdGUgPSBpbnB1dDtcXG4gICAgICByZXR1cm4gdGhpcztcXG4gICAgfSxcXG4gICAg5byA5ZCv5pCc57SiKCkge1xcbiAgICAgIHRoaXMuc2VhcmNoID0gdHJ1ZTtcXG4gICAgICByZXR1cm4gdGhpcztcXG4gICAgfSxcXG4gICAg5byA5ZCv5oqY5Y+gKGlucHV0KSB7XFxuICAgICAgaWYgKGlucHV0ID09IHVuZGVmaW5lZCkge1xcbiAgICAgICAgaW5wdXQgPSB0cnVlO1xcbiAgICAgIH1cXG4gICAgICB0aGlzLmlzQm9vbGVhbihpbnB1dCk7XFxuICAgICAgdGhpcy5vcGVuID0gaW5wdXQ7XFxuICAgICAgcmV0dXJuIHRoaXM7XFxuICAgIH0sXFxuICAgIHNldFRpdGxlKGssIGksIHQpIHtcXG4gICAgICByZXR1cm4gayA9PSBpID8gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyB0LmZvbnRjb2xvcih0aGlzLuWIhuexu+minOiJsikgOiB0O1xcbiAgICB9LFxcbiAgICBhY3Rpb24ob2JqKSB7XFxuICAgICAgcmV0dXJuIFtcXG4gICAgICAgIHtcXG4gICAgICAgICAgdGl0bGU6IFxcXCLmuIXpmaTnirbmgIFcXFwiLFxcbiAgICAgICAgICBqczogJC50b1N0cmluZygob2JqKSA9PiB7XFxuICAgICAgICAgICAgbG9nKG9iaik7XFxuICAgICAgICAgICAgY2xlYXJNeVZhcihvYmouc3RhdGUpO1xcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIpO1xcbiAgICAgICAgICAgIG9iai5hbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBvYmouY2wuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICB9LCBvYmopLFxcbiAgICAgICAgfSxcXG4gICAgICBdO1xcbiAgICB9LFxcbiAgICBjaGVja1BhcmFtKCkge1xcbiAgICAgIHZhciBvYmogPSB7fTtcXG4gICAgICBpZiAodGhpcy5wYWdlID09IDAgJiYgdHlwZW9mIHBhZ2UgPT0gXFxcInVuZGVmaW5lZFxcXCIpIHtcXG4gICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6K+35Lyg5YWl6aG156CBXFxcIik7XFxuICAgICAgfSBlbHNlIHtcXG4gICAgICAgIGlmICh0eXBlb2YgcGFnZSA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICBvYmpbXFxcIumhteeggVxcXCJdID0gdGhpcy5wYWdlO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgb2JqW1xcXCLpobXnoIFcXFwiXSA9IHBhZ2U7XFxuICAgICAgICB9XFxuICAgICAgfVxcbiAgICAgIGlmICh0aGlzLmh0bWwgPT0gXFxcImVtcHR5XFxcIiAmJiB0eXBlb2YgaHRtbCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLor7fkvKDlhaXmupDnoIFcXFwiKTtcXG4gICAgICB9IGVsc2Uge1xcbiAgICAgICAgaWYgKHR5cGVvZiBodG1sID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgIG9ialtcXFwi5rqQ56CBXFxcIl0gPSB0aGlzLmh0bWw7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICBvYmpbXFxcIua6kOeggVxcXCJdID0gaHRtbDtcXG4gICAgICAgIH1cXG4gICAgICB9XFxuICAgICAgaWYgKHRoaX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XG4gICAgICAgICAgICBzbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShzLCB4LuWwj+exuyk7XFxuICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgc2xpc3QgPSBwZGZhKHMsIHgu5bCP57G7KTtcXG4gICAgICAgICAgfVxcbiAgICAgICAgICB2YXIg5a6a5L2NID0gc2xpc3QubWFwKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgdmFyIHRpdGxlID0gdGhpcy5nZXRUaXRsZShpdGVtLCB4Luagh+mimCk7XFxuICAgICAgICAgICAgdmFyIHVybCA9IHRoaXMuZ2V0VXJsKGl0ZW0sIHgpO1xcbiAgICAgICAgICAgIHZhciBvYmogPSB7IHRpdGxlOiB0aXRsZSwgdXJsOiB1cmwgfTtcXG4gICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkob2JqKTtcXG4gICAgICAgICAgfSk7XFxuICAgICAgICAgIHJldHVybiDlrprkvY07XFxuICAgICAgICB9KTtcXG4gICAgICAgIC8vbG9nKOS4gOe6pylcXG4gICAgICAgIC8vbG9nKOS4gOe6py5sZW5ndGgpXFxuICAgICAgICBpZiAo5LiA57qnLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgIGNhdGVnb3JpZXMucHVzaCjkuIDnuqcuam9pbihcXFwiXFxcXG5cXFwiKSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICDkuIDnuqcuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaChpdGVtLmpvaW4oXFxcIixcXFwiKSk7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgLy9sb2coY2F0ZWdvcmllcylcXG4gICAgICB9KTtcXG4gICAgICBpZiAo5oqY5Y+g54q25oCBKSB7XFxuICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGZvbGQgPT09IFxcXCIxXFxcIiA/IOaKmOWPoCA6IOWxleW8gCxcXG4gICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoXFxuICAgICAgICAgICAgICAoZm9sZCwgdSwgYWxsKSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKE1ZX1JVTEUuZ3JvdXAsIGZvbGQgPT09IFxcXCIxXFxcIiA/IFxcXCIwXFxcIiA6IFxcXCIxXFxcIik7XFxuICAgICAgICAgICAgICAgIC8qYWxsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KTsqL1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgZm9sZCxcXG4gICAgICAgICAgICAgIOeKtuaAgSxcXG4gICAgICAgICAgICAgIOWFqOa4hVxcbiAgICAgICAgICAgICksXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgbG9uZ0NsaWNrOiB0aGlzLmFjdGlvbih7XFxuICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICAgIGFsbDog5YWo5riFLFxcbiAgICAgICAgICAgICAgICBjbDog5riF6ZmkLFxcbiAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgfVxcbiAgICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICBjYXRlZ29yaWVzLmZvckVhY2goKGNhdGVnb3J5LCBpbmRleCkgPT4ge1xcbiA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FxcIlxcXCIpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQganNvbj0nJ1xcbiAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXG4gICAgICAgICAgICBcXG4gICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcbiAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICBrZXk6IGtleSxcXG4gICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICBjbGVhcnM6IOa4hemZpCxcXG4gICAgICAgICAgICAgIGpzb246IGpzb24sXFxuICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxuICAgICAgICAgICAgfTtcXG5cXG4gICAgICAgICAgICAvL2xldCB1cmwgPSBwZChpdGVtLCBf5aSn57G76ZO+5o6lKTtcXG4gICAgICAgICAgICBsZXQgdXJsID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgLyppZiAo5aSn57G75aSE55CGKSB7XFxuICAgICAgICAgICAgICB1cmwgPSDkuIDnuqfliIbnsbvlpITnkIYodXJsKTtcXG4gICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAvL2xvZyh1cmwpXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxuICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgICAgdXJsOiAkKFxcXCJoaWtlcjovL2VtcHR5I25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBuZXdfY2F0ZSA9IFtdO1xcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmFsbGNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXAuZm9yRWFjaCgoY2F0ZSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICBuZXdfY2F0ZS5wdXNoKGluZGV4ID09PSAwID8gcGFyYW1zLmtleS50b1N0cmluZygpIDogXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJoZWFkLmNhdGVcXFwiLCBKU09OLnN0cmluZ2lmeShuZXdfY2F0ZSkpO1xcbiAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJkdF9cXFwiICsgcGFyYW1zLmpzb24udHlwZSwgcGFyYW1zLmpzb24udmFsdWUpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHBhcmFtcy5zdGF0ZSwgcGFyYW1zLmpzb24pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKHRydWUpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgfSwgcGFyYW1zKSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgfSk7XFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIGlmIChmb2xkID09PSBcXFwiMVxcXCIgfHwg5oqY5Y+g54q25oCBID09IGZhbHNlKSB7XFxuICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzLmZvckVhY2goKGl0ZW0sIGtleSkgPT4ge1xcbiAgICAgICAgICAgIHZhciBleHRyYXBvcyA9IGZhbHNlO1xcbiAgICAgICAgICAgIC8qaWYgKGl0ZW0uaW5jbHVkZXMoJ3R5cGU9XFxcIkBleHRyYVxcXCInKSkge1xcbiAgICAgICAgICAgICAgZXh0cmFwb3MgPSB0cnVlO1xcbiAgICAgICAgICAgICAgLy9sb2coJ+mZhOWKoOWumuS9jScpXFxuICAgICAgICAgICAgfSovXFxuXFxuICAgICAgICAgICAgaWYgKGV4dHJhcG9zKSB7XFxuICAgICAgICAgICAgICB2YXIgdGl0bGUgPSBwZGZoKGl0ZW0sIFxcXCJhJiZUZXh0XFxcIik7XFxuICAgICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDmjpLpmaQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICB2YXIganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgdHlwZTogcGRmaChpdGVtLCBcXFwiYSYmc3RhdGVcXFwiKSxcXG4gICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwgXFxcImEmJnZhbHVlXFxcIiksXFxuICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAvL3ZhciB0aXRsZSA9IHBkZmgoaXRlbSwg5YiG57G75qCH6aKYKTtcXG4gICAgICAgICAgICAgIHZhciB0aXRsZSA9IGl0ZW0udGl0bGU7XFxuICAgICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDmjpLpmaQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICB2YXIganNvbiA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgLypzd2l0Y2ggKHRydWUpIHtcXG4gICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoXFxcIkBAQFxcXCIpOlxcbiAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBAXFxcIilbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQEBcXFwiKVsxXSksXFxuICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoXFxcIkBAXFxcIik6XFxuICAgICAgICAgICAgICAgICAganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBcXFwiKVswXSxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBcXFwiKVsxXSksXFxuICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAgICAgLy8ganNvbiA9IHBkKGl0ZW0sIOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAgIC8qdmFyIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICB0eXBlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzFdKSxcXG4gICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICB0eXBlOuWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVswXSxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMV0pLFxcbiAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTsqL1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcbiAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICBpbmRleDogaW5kZXgsXFxuICAgICAgICAgICAgICBrZXk6IGtleSxcXG4gICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICBqc29uOiBqc29uLFxcbiAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXG4gICAgICAgICAgICAgIGFsbGNsZWFyczog5YWo5riFLFxcbiAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxuICAgICAgICAgICAgICB1cmw6ICQoXFxcImhpa2VyOi8vZW1wdHlcXFwiICsgXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKHBhcmFtcykgPT4ge1xcbiAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcFtwYXJhbXMuaW5kZXhdID0gcGFyYW1zLmtleS50b1N0cmluZygpO1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkocGFyYW1zLmNhdGVfdGVtcCkpO1xcbiAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJkdF9cXFwiICsgcGFyYW1zLmpzb24udHlwZSwgcGFyYW1zLmpzb24udmFsdWUpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHBhcmFtcy5zdGF0ZSwgcGFyYW1zLmpzb24pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJld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gICB2YXIgdGl0bGUgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS50aXRsZSk7XFxuICAgICAgICB2YXIgZGVzYyA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmRlc2MpO1xcbiAgICAgICAgdmFyIGltZyA9IHRoaXMuaW1nSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcbiAgICAgICAgdmFyIHVybCA9IHRoaXMudXJsSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcbiAgICAgICAgdmFyIGNvbnRlbnQgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS5jb250ZW50KTtcXG4gICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSkge1xcbiAgICAgICAgICBpZCA9IFxcXCJsYXN0aWRfXFxcIiArIHBhZ2U7XFxuICAgICAgICAgIGNscyA9IFxcXCJsYXN0bWFya1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgIHBpY191cmw6IGltZyxcXG4gICAgICAgICAgdXJsOiAnaGlrZXI6Ly9wYWdlL2VqP3VybD0nK3VybCsnI25vSGlzdG9yeSMnLFxcbiAgICAgICAgICBjb250ZW50OiBjb250ZW50LFxcbiAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXG4gICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgaW1nOiBpbWcsXFxuICAgICAgICAgICAgaWQ6IGlkLFxcbiAgICAgICAgICAgIGNsczogY2xzLFxcbiAgICAgICAgICB9LFxcbiAgICAgICAgfSk7XFxuICAgICAgICBpZiAoaSA9PSBsaXN0Lmxlbmd0aCAtIDEgJiYgc2hvdykge1xcbiAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOi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