Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@久久漫画🌪️@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6Ii5hbnRob2xvZ3ktbGlzdC1wbGF5JiZhLC0xJiZUZXh0LmpzOifmm7TmlrDoh7PvvJonK2lucHV0IiwidGl0bGUiOiLkuYXkuYXmvKvnlLvwn4yq77iPIiwiYXV0aG9yIjoiIiwidXJsIjoiaGlrZXI6Ly9lbXB0eSMjYm9va2xpc3QvP3BhZ2U9ZnlwYWdlIiwidmVyc2lvbiI6MSwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJjYXJ0b29uIiwiY2xhc3NfdXJsIjoiIiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6IFxudmFyIGQgPSBbXTtcbnZhciBob3N0ID0gY29uZmlnLmhvc3Rcbk1ZX1VSTD1ob3N0K01ZX1VSTC5yZXBsYWNlKCdoaWtlcjovL2VtcHR5IyMnLCcnKTtcbnZhciBodG1sID0gZmV0Y2goTVlfVVJMKTsgXG5yYyhmZXRjaFBDKCdodHRwczovL2dpdGVlLmNvbS9taXN0eXdhdGVyL2hpa2VyX2luZm8vcmF3L21hc3Rlci9naXRodWJwcm94eS5qc29uJykgKyAnaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL21pc3R5d2F0ZXIvaGlrZXIvbWFpbi9mJywgMjQpO1xudmFyIGh0bSA9IGZldGNoKCdodHRwOi8vd3d3Lm14c21oMDEudG9wLycpO1xuLy/moIfpopgs5o+P6L+wLOWbvueJhyzpk77mjqVcbnZhciDmoIfpopggPSAnLmNvbWljLW5hbWUmJlRleHQnO1xudmFyIOaPj+i/sC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JpJywgJzAnKSk7XFxuICAgICAgICBpZiAocnVtICE9ICcnKSB7XFxuICAgICAgICAgICAgaSA9IE51bWJlcihydW0pICsgMVxcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoJ3JudW0nKVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBpID0gaSArIDE7XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZyhpKVxcbiAgICAgICAgLy9sb2coZGF0YS5sZW5ndGgpXFxuXFxuICAgICAgICBpZiAoaSA+IGRhdGEubGVuZ3RoIC0gMSkge1xcbiAgICAgICAgICAgIGkgPSAwXFxuICAgICAgICB9XFxuICAgICAgICB2YXIgaXRlbSA9IGRhdGFbaV07XFxuICAgICAgICAvL2xvZyhpdGVtKVxcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKGlkKydiYXInLCB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgICAgICBpbWc6IGl0ZW0uaW1nLFxcbiAgICAgICAgICAgICAgICB1cmw6IGl0ZW0udXJsLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgLy9uYW1lOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLFxcbiAgICAgICAgICAgICAgICAgICAgLy9zbmFtZTogaXRlbS5leHRyYS5zbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIC8vc3R5cGU6IGl0ZW0uZXh0cmEuc3R5cGUsXFxuICAgICAgICAgICAgICAgICAgICAvL3N1cmw6IGl0ZW0udXJsLFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6aXRlbS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGltZzppdGVtLmltZyxcXG4gICAgICAgICAgICAgICAgICAgIC8vcGFnZVRpdGxlOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLF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XG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGAke3RpdGxlfWAsXFxuICAgICAgICAgICAgY29sX3R5cGU6IHNlbGVzLmNvbF90eXBlLFxcbiAgICAgICAgICAgIGltZzogZXZhbChzZWxlcy5pbWcpLFxcbiAgICAgICAgICAgIC8vaG90OiAgZXZhbChzZWxlcy5kMSksXFxuICAgICAgICAgICAgZGVzYzogZXZhbChzZWxlcy5kMSksXFxuICAgICAgICAgICAgdXJsOiBldmFsKHNlbGVzLnVybCkgKyAnI2ltbWVyc2l2ZVRoZW1lIycrJ0BydWxlPWpzOiQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2VqXFxcIiknLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogc3RpdGxlLFxcbiAgICAgICAgICAgICAgICBzdGF0ZTpkZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgIH0pXFxufVxcblxcblxcbnZhciByYW5rcyA9IFsn5qac5Y2VOicsICfmlrDnlarmppwnLCAn5Lq65rCU5qacJywgJ+WujOe7k+amnCddXFxuXFxudmFyIHJpbmRleCA9IGdldE15VmFyKCdyaW5kZXgnLCAnMScpXFxuXFxucmFua3MubWFwKCh4LCBpKSA9PiB7XFxuICAgIHZhciB0aXRsZSA9IGkgPT0gcmluZGV4ID8gYOKAnOKAnOKAneKAnTxzbWFsbD48Yj48Zm9udCBjb2xvcj1cXFwiIzFFOTBGRlxcXCI+JHt4fTwvZm9udD48L2I+PC9zbWFsbD5gIDogYOKAnOKAnOKAneKAnTxzbWFsbD4ke3h9PC9zbWFsbD5gXFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfNCcsXFxuICAgICAgICB1cmw6ICQoJycpLmxhenlSdWxlKChpKSA9PiB7XFxuICAgICAgICAgICAgcHV0TXlWYXIoJ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lSXRlbSgnZGNvbnRlbnQnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IGR0aXRsZS5yZXBsYWNlKC9cXFxcPi4qP1xcXFw8LywnPicrZGMrJzwnKVxcbiAgICAgICAgICAgIC5yZXBsYWNlKC8oY29sb3I9XFxcIikuKj8oXFxcIikvLCckMScrY3Muc2hvdysnJDInKVxcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgdXBkYXRlSXRlbSgnZHNob3cnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoJ+WxleW8gCcsICfmlLbotbcnKSAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICB9KTtcXG5cXG5cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0obWFyaywgJzAnKVxcbiAgICAgICAgICB1cGRhdGVJdGVtKCdkY29udGVudCcsIHtcXG4gICAgICAgICAgICB0aXRsZTogZHRpdGxlLnJlcGxhY2UoL1xcXFw+Lio/XFxcXDwvLCc+JytzZGMrJzwnKVxcbiAgICAgICAgICAgIC5yZXBsYWNlKC8oY29sb3I9XFxcIikuKj8oXFxcIikvLCckMScrY3MuaGlkZSsnJDInKVxcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgdXBkYXRlSXRlbSgnZHNob3cnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoJ+aUtui1tycsICflsZXlvIAnKSAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICB9LG1hcmssIGRlc2MsIHNkZXNjLGNvbG9ycyksXFxuICAgICAgZXh0cmE6IHtcXG4gICAgICAgIGlkOiAnZHNob3cnLFxcbiAgICAgIH1cXG4gICAgfSlcXG4gICAgdmFyIHNjPXN0b3JhZ2UwLmdldEl0ZW0obWFyayw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xuICBzZXRDdXN0b206IGZ1bmN0aW9uIChvYmosIGltZyxjb2xvcnMpIHtcXG4gICAgdmFyIGFycmF5ID0gW107XFxuICAgIGlmIChvYmouY29uc3RydWN0b3IgPT0gQXJyYXkpIHtcXG4gICAgICBhcnJheSA9IG9iajtcXG4gICAgfVxcbiAgICB2YXIgdGl0bGVzID0gW107XFxuICAgIHZhciBkZXNjcyA9IFtdO1xcbiAgICBpZigndGl0bGVzJyBpbiBvYmope1xcbiAgICAgIHRpdGxlcz1vYmoudGl0bGVzO1xcbiAgICB9XFxuICAgIGlmKCdkZXNjcycgaW4gb2JqKXtcXG4gICAgICBkZXNjcz1vYmouZGVzY3M7XFxuICAgIH1cXG4gICAgXFxuICAgIGlmKHRpdGxlcy5sZW5ndGg9PTAmJmRlc2NzLmxlbmd0aD09MCl7XFxuICAgIGFycmF5ID0gdGhpcy5zdHJDb252ZXJ0KGFycmF5KTtcXG4gICAgc3dpdGNoIChhcnJheS5sZW5ndGgpIHtcXG4gICAgICBjYXNlIDI6XFxuICAgICAgICB0aXRsZXMgPSBhcnJheVswXTtcXG4gICAgICAgIGRlc2NzID0gYXJyYXlbMV07XFxuICAgICAgICBicmVhaztcXG4gICAgICBjYXNlIDM6XFxuICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAxKTtcXG4gICAgICAgIGRlc2NzID0gYXJyYXkuc2xpY2UoMSk7XFxuICAgICAgICBicmVhaztcXG4gICAgICBjYXNlIDQ6XFxuICAgICAgY2FzZSA1OlxcbiAgICAgICAgdGl0bGVzID0gYXJyYXkuc2xpY2UoMCwgMik7XFxuICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDIpO1xcbiAgICAgICAgYnJlYWs7XFxuICAgICAgY2FzZSA2OlxcbiAgICAgICAgdGl0bGVzID0gYXJyYXkuc2xpY2UoMCwgMyk7XFxuICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDMpO1xcbiAgICAgICAgYnJlYWs7XFxuICAgICA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oIC8gMik7IFxcbiAgICAgIHZhciBmaXJzdEhhbGYgPSBjb2xvcl9saXN0LnNsaWNlKDAsIG1pZEluZGV4KTtcXG4gICAgICB2YXIgc2Vjb25kSGFsZiA9IGNvbG9yX2xpc3Quc2xpY2UobWlkSW5kZXgpO1xcbiAgICAgICAgICAgXFxuICAgICAgZnVuY3Rpb24gdGV4dEFycmF5KHN0eWxlLHRleHRBcnJheSkge1xcbiAgICAgICAgdmFyIGxpc3Q9W107XFxuICAgICAgICBzdHlsZS5mb3JFYWNoKCh4LCBpKSA9PiB7XFxuICAgICAgICB2YXIgbGVmdCA9IFtdO1xcbiAgICAgICAgdmFyIHJpZ2h0ID0gW107XFxuICAgICAgICB2YXIgc3RyID0gdGV4dEFycmF5W2ldO1xcbiAgICAgICAgT2JqZWN0LmtleXMoeCkuZm9yRWFjaChrID0+IHtcXG4gICAgICAgICAgICBzd2l0Y2ggKGspIHtcXG4gICAgICAgICAgICAgICAgY2FzZSAnY29sb3InOlxcbiAgICAgICAgICAgICAgICAgICAgbGVmdC5wdXNoKCc8Zm9udCBjb2xvcj1cXFwiJyArIHhba10gKyAnXFxcIj4nKTtcXG4gICAgICAgICAgICAgICAgICAgIHJpZ2h0LnB1c2goJzwvZm9udD4nKTtcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICAgICAgbGVmdC5wdXNoKGA8JHtrfT5gKTtcXG4gICAgICAgICAgICAgICAgICAgIHJpZ2h0LnB1c2goYDwvJHtrfT5gKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICBsaXN0W2ldID0gbGVmdC5qb2luKCcnKSArIHN0ciArIHJpZ2h0LmpvaW4oJycpO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgIHJldHVybiBsaXN0O1xcbiAgICAgIH1cXG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uY2xzO1xcbiAgICAgICAgICB2YXIgcGljID0gcGxpc3Rbc2hzb3J0XS5waWM7XFxuICAgICAgICAgIHZhciBleHRyYSA9IHBsaXN0W3Noc29ydF0uZXh0cmE7XFxuICAgICAgICAgIC8vbG9nKGV4dHJhKVxcbiAgICAgICAgfVxcbiAgICAgICAgcHV0TXlWYXIodmFyaSwgaSk7XFxuXFxuICAgICAgICB2YXIgeGxpc3QgPSBsaXN0c1tpXTtcXG4gICAgICAgIGlmICgkLmZ1bmMgIT0gdW5kZWZpbmVkICYmICQuZnVuYy5jb25zdHJ1Y3RvciA9PSBGdW5jdGlvbikge1xcbiAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3BpY18xJyxcXG4gICAgICAgICAgICBpbWc6ICdodHRwczovL2ltZy5uaWNreWFtLmNvbS9maWxlL2ZlNDFhN2ExNzQ0YTNhODE5NGRmMi5naWYnLFxcbiAgICAgICAgICAgIHVybDogJ3RvYXN0Oi8vbG9hZGluZycsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgIGNsczogc2hzb3J0XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICB4bGlzdCA9ICQuZnVuYyhpLCBpbmZvKTtcXG4gICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19saXN0JywgeGxpc3QpO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIHBsYXlzID0geGxpc3QubWFwKHggPT4ge1xcbiAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgIHVybDogeC51cmwsXFxuICAgICAgICAgICAgY29sX3R5cGU6IGNvbCxcXG4gICAgICAgICAgICBwaWM6IHBpYyxcXG4gICA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ScsIHBsYXlzKTtcXG5cXG4gICAgICAgIHZhciB0YWJ4ID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXG4gICAgICAgIHRhYnguZm9yRWFjaCgoeCwgaWkpID0+IHtcXG4gICAgICAgICAgdmFyIHRpdGxlID0geC50aXRsZTtcXG4gICAgICAgICAgaWYgKGkgPT0gaWkpIHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKC8jKFxcXFx3Kyk/L2csIGxpbmVjKSxcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoLyMoXFxcXHcrKT8vZywgJyMnKSxcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaIkOWKn++8gSc7XFxuICAgICAgfSwgdmFyaSwgc2hzb3J0LCBpLCBjdXN0b20u57q/6Lev6YCJ5LitLCBpbmZvKVxcbiAgICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyAoZ2V0TXlWYXIodmFyaSwgJzAnKSA9PSBpID8gdGFic1tpXS5mb250Y29sb3IoY3VzdG9tLue6v+i3r+mAieS4rSkgOiB0YWJzW2ldLmZvbnRjb2xvcignIycpKSxcXG4gICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgY29sX3R5cGU6IGN1c3RvbS7nur/ot6/moLflvI8sXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBjbHM6IHNoc29ydCArICdfdGFiJyxcXG4gICAgICAgICAgaWQ6IHNoc29ydCArICdfdGFiXycgKyBpLFxcbiAgICAgICAgf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YXJpKSA9PiB7XFxuICAgICAgICBpZiAoZ2V0TXlWYXIodmFyaSArICdmb2xkJywgJzEnKSA9PSAnMCcpIHtcXG4gICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxuICAgICAgICB9XFxuXFxuICAgICAgICB2YXIgdGl0bGVzID0gcG9ialsn5Y2V5o6oJ107XFxuICAgICAgICB2YXIgcGNmZyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfcHVzaGNmZycsICd7fScpO1xcbiAgICAgICAgcGNmZ1snb2JqJ10gPSBwb2JqO1xcbiAgICAgICAgdmFyIOWNleaOqCA9IHBjZmdbJ+WNleaOqCddID8gcGNmZ1sn5Y2V5o6oJ10gOiBmYWxzZTtcXG5cXG4gICAgICAgIGlmICjljZXmjqgpIHtcXG4gICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2gnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSxcXG4gICAgICAgICAgfSlcXG4gICAgICAgICAgcGNmZ1sn5Y2V5o6oJ10gPSBmYWxzZTtcXG4gICAgICAgICAgcGNmZ1sncGxheWxpc3QnXS5tYXAoKHgpID0+IHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgIHVybDogeC51cmwsXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgfSlcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcbiAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIHRpdGxlc1sxXSxcXG4gICAgICAgICAgfSlcXG4gICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2hzJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfpgInmjqgnXVswXSxcXG4gICAgICAgICAgfSl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Noc29ydCArICdfcHVzaHRvJywge1xcbiAgICAgICAgICAgIHRpdGxlOiAn5o6o6YCB5pys6aG1PT5UVkJveCcsXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCArICdfZHVvc2VsZWN0Jyk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHMnLCB7XFxuICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgdGl0bGVzWzFdLFxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICBwY2ZnWyfpgInmjqgnXSA9IHRydWU7XFxuICAgICAgICAgIHBjZmdbJ+WNleaOqCddID0gZmFsc2U7XFxuICAgICAgICAgIHZhciBwbGF5bGlzdCA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J10gPSBwbGF5bGlzdDtcXG4gICAgICAgICAgbGV0IElkcyA9IHBsYXlsaXN0Lm1hcChpdCA9PiBpdC5leHRyYS5pZCk7XFxuICAgICAgICAgIElkcy5mb3JFYWNoKHggPT4ge1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGZpbmRJdGVtKHgpLnRpdGxlO1xcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeCwge1xcbiAgICAgICAgICAgICAgdXJsOiAkLm1zbSh0aXRsZSwgeCwgc2hzb3J0KSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgfSk7XFxuICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19wdXNoJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBwb2JqWyfljZXmjqgnXVswXSxcXG4gICAgICAgICAgfSlcXG4gICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX3B1c2h0bycsIHtcXG4gICAgICAgICAgICB0aXRsZTogJ+aOqOmAgemAieS4rT0+VFZCb3gnLF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zb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgIGlmIChnZXRNeVZhcignZXJfJyArIHZhcmkgKyAnZm9sZCcsICcxJykgPT0gJzAnKSB7XFxuICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lsZXlvIDmiY3og73mk43kvZwnO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIGNsc2xpc3RzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgIHZhciBuZXdjbHNsaXN0ID0gJC5kYXRhQ29udmVydChjbHNsaXN0cyk7XFxuXFxuICAgICAgICB2YXIgdGl0bGVzID0gW2Ake2N1c3RvbS7mraPluo/popzoibJ9XFxcIj7mraPluo9gLCBgJHtjdXN0b20u6YCG5bqP6aKc6ImyfVxcXCI+6YCG5bqPYF07XFxuXFxuICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgIG5ld2Nsc2xpc3QucmV2ZXJzZSgpO1xcbiAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIG5ld2Nsc2xpc3QpO1xcblxcbiAgICAgICAgdmFyIG9iaiA9IGZpbmRJdGVtKHNoc29ydCArICdfYXZhdGFyJylcXG5cXG4gICAgICAgIGlmIChjb25mID09ICcxJykge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMV0sIHRpdGxlc1swXSksXFxuICAgICAgICAgIH0pXFxuICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMF0sIHRpdGxlc1sxXSksXFxu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Dnur/ot6/pk77mjqUpO1xcbiAgICAgIH1cXG4gICAgfVxcbiAgICAvL2xvZyh0YWJzKTtcXG4gICAgcmV0dXJuIHRhYnM7XFxuICB9LFxcbiAgZ2V0TGlzdHM6IGZ1bmN0aW9uIChwYXJzZSwgc2hzb3J0LCBoKSB7XFxuICAgIGh0bWwgPSBoIHx8IGh0bWw7XFxuICAgIHNoc29ydCA9IHNoc29ydCA/IHNoc29ydCA6ICdzaHNvcnQnO1xcbiAgICB2YXIgbGlzdHMgPSBbXTtcXG4gICAgdmFyIGNvbnRzID0gW107XFxuICAgIGlmICh0eXBlb2YgcGFyc2Uu6YCJ6ZuGID09ICdvYmplY3QnKSB7XFxuICAgICAgY29udHMgPSBwYXJzZS7pgInpm4Y7XFxuICAgIH1cXG4gICAgaWYgKGNvbnRzLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgdHJ5IHtcXG4gICAgICAgIGNvbnRzID0gcGRmYShodG1sLCBwYXJzZS7pgInpm4YpO1xcbiAgICAgIH0gY2F0Y2gge1xcbiAgICAgICAgdG9hc3QoJ+mAiembhuWumuS9jeacieivrycpXFxuICAgICAgfVxcbiAgICB9XFxuXFxuICAgIGxldCDmm7/mjaLlh73mlbAgPSAnJztcXG4gICAgdmFyIOmAiembhuWQjeensCA9IHBhcnNlLumAiembhuWQjeensCA/IHBhcnNlLumAiembhuWQjeensCA6ICdhJiZUZXh0JztcXG4gICAgaWYgKOmAiembhuWQjeensC5pbmNsdWRlcygnQEAnKSkge1xcbiAgICAgIOmAiembhuWQjeensCA9IHBhcnNlLumAiembhuWQjeensC5zcGxpdCgnQEAnKVswXTtcXG4gICAgICDmm7/mjaLlh73mlbAgPSBwYXJzZS7pgInpm4blkI3np7Auc3BsaXQoJ0BAJylbMV07XFxuICAgIH1cXG5cXG4gICAgdmFyIOmAiembhumTvuaOpSA9IHBhcnNlLumAiembhumTvuaOpSA/IHBhcnNlLumAiembhumTvuaOpSA6ICdhJiZocmVmJztcXG4gICAgdmFyIOino+aekCA9IHBhcnNlLuino+aekCA/IHBhcnNlLuino+aekCA6ICcnO1xcbiAgICB2YXIgdGVtcCA9IFtdO1xcblxcbiAgICBmb3IgKHZhciBpIGluIGNvbnRzKSB7XFxuICAgICAgaWYgKHBhcnNlLumAiembhuWIl+ihqCAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgIGlmIChwYXJzZS7pgInpm4bliJfooaggPT0gJ29iamVjdCcpIHtcXG4gICAgICAgICAgbGlzdHMucHVzaChjb250c1tpXS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgICAgdXJsOiB4LnVybCArIOino+aekCxcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgIH0pKVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgbGlzdHMucHVzaChwZGZhKGNvbnRzW2ldLCBwYXJzZS7pgInpm4bliJfooagpLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgdGl0bGU6IHNwKHBkZmgoeCwg6YCJ6ZuG5ZCN56ewKSksXFxuICAgICAgICAgICAgICB1cmw6IHBkKHgsIOmAiembhumTvuaOpSkgKyDop6PmnpAsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICB9KSlcXG4gICAgICAgIH1cXG4gICAgICB9IGVsc2Uge1xcbiAgICAgICAgdmFyIHVybCA9IHBkKGNvbnRzW2ldLCDpgInpm4bpk77mjqUpO1xcbiAgICAgICAgaWYgKCHpgInpm4bpk77mjqUuaW5jbHVkZXMoJ2hyZWYnKSkge1xcbiAgICAgICAgICB1cmwgPSBwZGZoKGNvbnRzW2ldLCDpgInpm4bpk77mjqUpO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IHRpdGxlID0gc3AocGRmaChjb250c1tpXSwg6YCJ6ZuG5ZCN56ewKSk7XFxuICAgICAgICB0aXRsZSA9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