Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@狂人短剧@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6ImpzOlxudmFyIGNocCA9IFtdO1xudHJ5IHtcbiAgICB2YXIgaHRtbCA9IGdldFJlc0NvZGUoKTtcbiAgICB2YXIgY29udHMgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICdib2R5JiYuc29ydC1saXN0Jyk7XG4gICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjb250cy5sZW5ndGg7IGkrKykge1xuICAgICAgICB2YXIgbGlzdCA9IHBkZmEoY29udHNbaV0sICdib2R5JiZsaScpO1xuICAgICAgICBjaHAucHVzaChsaXN0Lmxlbmd0aCk7XG4gICAgfSAgICAgXG59IGNhdGNoIChlKSB7fVxuc2V0UmVzdWx0KCfmm7TmlrDoh7M6JyArIChNYXRoLm1heC5hcHBseShudWxsLCBjaHApKSk7IiwidGl0bGUiOiLni4Lkurrnn63liaciLCJhdXRob3IiOiJSIiwidXJsIjoiaGlrZXI6Ly9lbXB0eSMjaHR0cHM6Ly93d3cua3BrdWFuZy5mdW4vdm9kdHlwZS8zNi9pbmRleC1meXBhZ2UuaHRtbCIsInZlcnNpb24iOjEsImNvbF90eXBlIjoibW92aWVfMyIsImNsYXNzX25hbWUiOiIiLCJ0eXBlIjoidmlkZW8iLCJjbGFzc191cmwiOiIiLCJhcmVhX25hbWUiOiIiLCJhcmVhX3VybCI6IiIsInNvcnRfbmFtZSI6IiIsInllYXJfbmFtZSI6IiIsInNvcnRfdXJsIjoiIiwieWVhcl91cmwiOiIiLCJmaW5kX3J1bGUiOiJqczpcbnZhciBkID0gW107XG5hZGRMaXN0ZW5lcihcIm9uQ2xvc2VcIiwgJC50b1N0cmluZygoKSA9PiB7XG4gICAgbGV0IGtleXMgPSBsaXN0TXlWYXJLZXlzKCk7XG4gICAgZm9yIChsZXQgaXQgb2Yga2V5cykge1xuICAgICAgICB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hpa2VyOi8vZW1wdHknKS5ydWxlKCgpID0+IHtcbiAgICAgICAgICAgIHZhciBpdGVtcyA9IFtdO1xuICAgICAgICAgICAgLy92YXIgY29rID0gZmV0Y2goJ2hpa2VyOi8vZmlsZXMvY2FjaGUvSldfc2lndUNvb2tpZS50eHQnLCB7fSk7XG4gICAgICAgICAgICB2YXIgY29rID0gSlNPTi5wYXJzZShmZXRjaENvb2tpZSgnaHR0cHM6Ly9zaWd1eXkuY2MvaW5kZXgucGhwL3ZlcmlmeS9pbmRleC5odG1sP3I9JyArIE1hdGgucmFuZG9tKCksIHtcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XG4gICAgICAgICAgICAgICAgICAgICdYLVJlcXVlc3RlZC1XaXRoJzogJ1hNTEh0dHBSZXF1ZXN0JyxcbiAgICAgICAgICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBNT0JJTEVfVUFcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsXG4gICAgICAgICAgICAgICAgd2l0aEhlYWRlcnM6IHRydWVcbiAgICAgICAgICAgIH0pKS5qb2luKCc7Jyk7XG4gICAgICAgICAgICAvL2xvZyhjb2spO1xuICAgICAgICAgICAgdmFyIGltZyA9ICdodHRwczovL3NpZ3V5eS5jYy9pbmRleC5waHAvdmVyaWZ5L2luZGV4Lmh0bWw/cj0nICsgTWF0aC5yYW5kb20oKSArICdAVXNlci1BZ2VudD0nICsgTU9CSUxFX1VBICsgJ0BDb29raWU9JyArIGNvaztcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xuICAgICAgICAgICAgICAgIHBpY191cmw6IGltZyxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJycpLmxhenlSdWxlKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlZnJlc2hQYWdlKCk7XG4gICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICAgZGVzYzogJzAnLFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAncGljXzFfZnVsbCdcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcbiAgICAgICAgICAgICAgICB0aXRsZTogJycsXG4gICAgICAgICAgICAgICAgdXJsOiBcIid0b2FzdDovL+S9oOi+k+WFpeeahOaYrycgKyBpbnB1dFwiLFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XG4gICAgICAgICAgICAgICAgICAgIG9uQ2hhbmdlOiBcInB1dFZhcignc3Ppqozor4HnoIEnLGlucHV0KVwiLFxuICAgICAgICAgICAgICAgICAgICB0aXRsZVZpc2libGU6IGZhbHNlXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2lucHV0J1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xuICAgICAgICAgICAgICAgIHRpdGxlOiAn5Y+R6YCBJyxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJycpLmxhenlSdWxlKChjb2spID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvZCA9IGdldFZhcignc3Ppqozor4HnoIEnKTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGpzb24gPSBKU09OLnBhcnNlKGZldGNoKCdodHRwczovL3NpZ3V5eS5jYy9pbmRleC5waHAvYWpheC92ZXJpZnlfY2hlY2s/dHlwZT1zZWFyY2gmdmVyaWZ5PScgKyBjb2QsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnWC1SZXF1ZXN0ZWQtV2l0aCc6ICdYTUxIdHRwUmVxdWVzdCcsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBNT0JJTEVfVUEsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ0Nvb2tpZSc6IGNva1xuICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6ICcnLFxuICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoanNvbi5jb2RlID09IDEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlRmlsZSgnaGlrZXI6Ly9maWxlcy9jYWNoZS9KV19zaWd1Q29va2llLnR4dCcsIGNvayk7XG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrKHRydWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwidG9hc3Q6Ly/pqozor4HmiJDlip/jgIJcIlxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy9yZWZyZXNoUGFnZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFwidG9hc3Q6Ly/pqozor4HlpLHotKXvvIzor7fph43or5XvvIFcIlxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB9LCBjb2spLFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8yJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBzZXRIb21lUmVzdWx0KHtcbiAgICAgICAgICAgICAgICBkYXRhOiBpdGVtc1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pLFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfMSdcbiAgICB9KTtcbn0gZWxzZSB7XG4gICAgdmFyIGxpc3QgPSBwZGZhKGh0bWwsICdib2R5JiYudWstdGV4dC1jZW50ZXInKTtcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgdmFyIEwgPSBsaXN0W2ldO1xuICAgICAgICB2YXIgdGl0bGUgPSBwYXJzZURvbUZvckh0bWwoTCwgJ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MSkgKyAn77yPJyArIGNvbnRzLmxlbmd0aCArICcgICAgICAgICAgJyxcbiAgICAgICAgICAgIHVybDogXCJoaWtlcjovL2VtcHR5QGxhenlSdWxlPS5qczpwdXRWYXIoJ3Noc29ydCcsIGdldFZhcignc2hzb3J0JywnMScpPT0nMSc/JzAnOicxJyk7cmVmcmVzaFBhZ2UoKTsnaGlrZXI6Ly9lbXB0eSdcIixcbiAgICAgICAgICAgIGNvbF90eXBlOiAnYXZhdGFyJyxcbiAgICAgICAgICAgIGltZzogYXZhdGFyXG4gICAgICAgIH0pO1xuXG4gICAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgbGlzdC5sZW5ndGg7IGorKykge1xuICAgICAgICAgICAgdmFyIGptID0gcGRmaChsaXN0W2pdLCAnYSYmVGV4dCcpLnJlcGxhY2UoL+esrHzpm4Z86K+dfOacny9nLCAnJykucmVwbGFjZSgv6aKE5ZGKL2csICfwn5OiJyk7XG4gICAgICAgICAgICB2YXIgdXJsID0gcGQobGlzdFtqXSwgJ2EmJmhyZWYnKTtcbiAgICAgICAgICAgIGlmIChsaXN0Lmxlbmd0aCA8PSAyKSB7XG4gICAgICAgICAgICAgICAgdmFyIGNvbCA9ICd0ZXh0XzInXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHZhciBjb2wgPSBqbS5sZW5ndGggPiA0ID8gJ3RleHRfMicgOiAndGV4dF80J1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZC5wdXNoKHtcbiAgICAgICAgICAgICAgICB0aXRsZTogam0sXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwgKyBsYXp5LFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBjb2wsXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcbiAgICAgICAgICAgICAgICAgICAgaWQ6IHVybCxcbiAgICAgICAgICAgICAgICAgICAgYmxvY2tSdWxlczogW1xuICAgICAgICAgICAgICAgICAgICAgICAgXCIuanBnXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBcIi5qcGVnXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBcIi5wbmdcIixcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiLm1wNFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCIubTN1OFwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgXCIuZ2lmXCJcbiAgICAgICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfVxufVxucmVzLmRhdGEgPSBkO1xuc2V0SG9tZVJlc3VsdChyZXMpOyIsInNkZXRhaWxfY29sX3R5cGUiOiJtb3ZpZV8xIiwic2RldGFpbF9maW5kX3J1bGUiOiIqIiwidWEiOiJtb2JpbGUiLCJwcmVSdWxlIjoiIiwicGFnZXMiOiJbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuS4gOe6p+WIhuexu+WIl+ihqFwiLFwicGF0aFwiOlwieWlcIixcInJ1bGVcIjpcImpzOlxcbi8qXFxu5LiA57qn5bCB6KOFIFxcbuWKqOaAgeWIhuexuyDliJfooajliJvlu7og6Ieq5Yqo5LiL5LiA6aG1XFxudmVyIDIwMjMwNzEwIDEuMFxcbiovXFxuZnVuY3Rpb24gZHluYW1pY0NsYXNzKG9wdGlvbnMpIHtcXG4gIGNvbnN0IG9iaiA9IHtcXG4gICAgLy/pu5jorqTlgLxcXG4gICAgbGF5b3V0OiBcXFwidW5kZWZpbmVkXFxcIixcXG4gICAgaHRtbDogXFxcImVtcHR5XFxcIixcXG4gICAgcGFnZTogMCxcXG4gICAg5YiG57G76aKc6ImyOiBcXFwiI0ZBNzI5OFxcXCIsXFxuICAgIOaKmOWPoDogXFxcIuKAnOKAnOKAneKAnTxiPlxcXCIgKyBcXFwi4oioXFxcIi5mb250Y29sb3IoXFxcIiMxYWFkMTlcXFwiKSArIFxcXCI8L2I+XFxcIixcXG4gICAg5bGV5by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cbiAgICBzZXRUaXRsZShrLCBpLCB0KSB7XFxuICAgICAgcmV0dXJuIGsgPT0gaSA/IFxcXCLigJzigJzigJ3igJ1cXFwiICsgdC5mb250Y29sb3IodGhpcy7liIbnsbvpopzoibIpIDogdDtcXG4gICAgfSxcXG4gICAgYWN0aW9uKG9iaikge1xcbiAgICAgIHJldHVybiBbXFxuICAgICAgICB7XFxuICAgICAgICAgIHRpdGxlOiBcXFwi5riF6Zmk54q25oCBXFxcIixcXG4gICAgICAgICAganM6ICQudG9TdHJpbmcoKG9iaikgPT4ge1xcbiAgICAgICAgICAgIGxvZyhvYmopO1xcbiAgICAgICAgICAgIGNsZWFyTXlWYXIob2JqLnN0YXRlKTtcXG4gICAgICAgICAgICBjbGVhck15VmFyKFxcXCJoZWFkLmNhdGVcXFwiKTtcXG4gICAgICAgICAgICBvYmouYWxsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgb2JqLmNsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgfSwgb2JqKSxcXG4gICAgICAgIH0sXFxuICAgICAgXTtcXG4gICAgfSxcXG4gICAgY2hlY2tQYXJhbSgpIHtcXG4gICAgICB2YXIgb2JqID0ge307XFxuICAgICAgaWYgKHRoaXMucGFnZSA9PSAwICYmIHR5cGVvZiBwYWdlID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuivt+S8oOWFpemhteeggVxcXCIpO1xcbiAgICAgIH0gZWxzZSB7XFxuICAgICAgICBpZiAodHlwZW9mIHBhZ2UgPT0gXFxcInVuZGVmaW5lZFxcXCIpIHtcXG4gICA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XFxuICAgICAgICAgIHRpdGxlOiBcXFwiXFxcIixcXG4gICAgICAgICAgdXJsOiBcXFwiJ2hpa2VyOi8vc2VhcmNoP3J1bGU9XFxcIiArIE1ZX1JVTEUudGl0bGUgKyBcXFwiJnM9JytpbnB1dFxcXCIsXFxuICAgICAgICAgIGRlc2M6IFxcXCLmkJzntKLlhbPplK7or41cXFwiLFxcbiAgICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGdldE15VmFyKFxcXCJrZXl3b3JkXFxcIiwgXFxcIlxcXCIpLFxcbiAgICAgICAgICAgIG9uQ2hhbmdlOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJrZXl3b3JkXFxcIiwgaW5wdXQpO1xcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICB9LFxcbiAgICAgICAgfSk7XFxuICAgICAgfVxcbiAgICAgIGNvbnN0IGNhdGVnb3JpZXMgPSBbXTtcXG4gICAgICBydWxlT2JqLmZvckVhY2goKHgpID0+IHtcXG4gICAgICAgIHZhciBsaXN0ID0gW107XFxuICAgICAgICBpZih4LuS4gOe6p+WumuS9jSl7XFxuICAgICAgICAgIGlmICh4LuS4gOe6p+WumuS9jS5zdGFydHNXaXRoKFxcXCJAanM6XFxcIikpIHtcXG4gICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuS4gOe6p+WumuS9jSk7XFxuICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgbGlzdCA9IHBkZmEoaHRtbCwgeC7kuIDnuqflrprkvY0pO1xcbiAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBpZih4LuWkp+exu+WumuS9jSl7XFxuICAgICAgICAgIGlmICh4LuWkp+exu+WumuS9jS5zdGFydHNXaXRoKFxcXCJAanM6XFxcIikpIHtcXG4gICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuWkp+exu+WumuS9jSk7XFxuICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgbGlzdCA9IFtwZGZhKGh0bWwsIHgu5aSn57G75a6a5L2NKS5qb2luKCdcXFxcbicpXTtcXG4gICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICB2YXIg5LiA57qnID0gbGlzdC5tYXAoKHMpID0+IHtcXG4gICAgICAgICAgdmFyIHNsaXN0ID0gW107XFxuICAgICAgICAgIGlmICghKFxcXCLlsI/nsbtcXFwiIGluIHgpKSB7XFxuICAgICAgICAgICAgeC7lsI/nsbsgPSBcXFwiYm9keSYmYTpub3QoOm1hdGNoZXMo6aaW6aG1KSk6bm90KGE6bm90KFtocmVmXSkpXFxcIjtcXG4gICAgICAgICAgfVxcbiAgICAgICAgICBpZiAoeC7lsI/nsbsuc3RhcnRzV2l0aChcXFwiQGpzOlxcXCIpKSB7XFxuICAgICAgICAgICAgc2xpc3QgPSB0aGlzLmV2YWxKU1J1bGUocywgeC7lsI/nsbspO1xcbiAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHNsaXN0ID0gcGRmYShzLCB4LuWwj+exuyk7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgdmFyIOWumuS9jSA9IHNsaXN0Lm1hcCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IHRoaXMuZ2V0VGl0bGUoaXRlbSwgeC7moIfpopgpO1xcbiAgICAgICAgICAgIHZhciB1cmwgPSB0aGlzLmdldFVybChpdGVtLCB4KTtcXG4gICAgICAgICAgICB2YXIgb2JqID0geyB0aXRsZTogdGl0bGUsIHVybDogdXJsIH07XFxuICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KG9iaik7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICByZXR1cm4g5a6a5L2NO1xcbiAgICAgICAgfSk7XFxuICAgICAgICAvL2xvZyjkuIDnuqcpXFxuICAgICAgICAvL2xvZyjkuIDnuqcubGVuZ3RoKVxcbiAgICAgICAgaWYgKOS4gOe6py5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICBjYXRlZ29yaWVzLnB1c2go5LiA57qnLmpvaW4oXFxcIlxcXFxuXFxcIikpO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAg5LiA57qnLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICBjYXRlZ29yaWVzLnB1c2goaXRlbS5qb2luKFxcXCIsXFxcIikpO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIC8vbG9nKGNhdGVnb3JpZXMpXFxuICAgICAgfSk7XFxuICAgICAgaWYgKOaKmOWPoOeKtuaAgSkge1xcbiAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBmb2xkID09PSBcXFwiMVxcXCIgPyDmipjlj6AgOiDlsZXlvIAsXFxuICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKFxcbiAgICAgICAgICAgICAgKGZvbGQsIHUsIGFsbCkgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihNWV9SVUxFLmdyb3VwLCBmb2xkID09PSBcXFwiMVxcXCIgPyBcXFwiMFxcXCIgOiBcXFwiMVxcXCIpO1xcbiAgICAgICAgICAgICAgICAvKmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSk7Ki9cXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgIGZvbGQsXFxuICAgICAgICAgICAgICDnirbmgIEsXFxuICAgICAgICAgICAgICDlhajmuIVcXG4gICAgICAgICAgICApLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgIGxvbmdDbGljazogdGhpcy5hY3Rpb24oe1xcbiAgICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgICBhbGw6IOWFqOa4hSxcXG4gICAgICAgICAgICAgICAgY2w6IOa4hemZpCxcXG4gICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgIH1cXG4gICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgY2F0ZWdvcmllcy5mb3JFYWNoKChjYXRlZ29yeSwgaW5kZXgpID0+IHtcXG4gICAgICAgIC8vbG9nKGNhdGVnb3JpZXMpXFxuICAgICAgICBsZXQgc3ViX2NhdGVnb3JpZXMgPSBbXTtcXG4gICAgICAgIC8qaWYgKOWwj+exu+WumuS9jS5pbmNsdWRlcyhcXFwiO1xcXCIpKSB7XFxuICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NLnNwbGl0KFxcXCI7XFxcIilbMF0pO1xcbiAgICAgICAgICBpZiAoc3ViX2NhdGVnb3JpZXMubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jS5zcGxpdChcXFwiO1xcXCIpWzFdKTtcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHsqL1xcbiAgICAgICAgLy9sb2coaW5kZXgpXFxuICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IEpTT04ucGFyc2UoYFske2NhdGVnb3J5fV1gKTtcXG4gICAgICAgIC8vIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NKTtcXG4gICAgICAgIC8vfVxcbiAgICAgICAgaWYgKGluZGV4ID09PSAwKSB7XFxuICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzLmZvckVhY2goKGl0ZW0sIGtleSkgPT4ge1xcblxcbiAgICAgICAgICAgIC8vbGV0IHRpdGxlID0gcGRmaChpdGVtLCBf5aSn57G75qCH6aKYKTtcXG4gICAgICAgICAgICBsZXQgdGl0bGUgPSBpdGVtLnRpdGxlO1xcbiAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOaOkumZpCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ld1JlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGpzb249JydcXG4gICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgXFxuICAgICAgICAgICAgbGV0IHBhcmFtcyA9IHtcXG4gICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcbiAgICAgICAgICAgICAgY2xlYXJzOiDmuIXpmaQsXFxuICAgICAgICAgICAgICBqc29uOiBqc29uLFxcbiAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXG4gICAgICAgICAgICAgIGFsbGNsZWFyczog5YWo5riFLFxcbiAgICAgICAgICAgIH07XFxuXFxuICAgICAgICAgICAgLy9sZXQgdXJsID0gcGQoaXRlbSwgX+Wkp+exu+mTvuaOpSk7XFxuICAgICAgICAgICAgbGV0IHVybCA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgIC8qaWYgKOWkp+exu+WkhOeQhikge1xcbiAgICAgICAgICAgICAgdXJsID0g5LiA57qn5YiG57G75aSE55CGKHVybCk7XFxuICAgICAgICAgICAgfSovXFxuICAgICAgICAgICAgLy9sb2codXJsKVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcbiAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eSNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKHBhcmFtcykgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgbmV3X2NhdGUgPSBbXTtcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wLmZvckVhY2goKGNhdGUsIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgbmV3X2NhdGUucHVzaChpbmRleCA9PT0gMCA/IHBhcmFtcy5rZXkudG9TdHJpbmcoKSA6IFxcXCIwXFxcIik7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkobmV3X2NhdGUpKTtcXG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtcy5qc29uLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiZHRfXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgIH0sIHBhcmFtcyksXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiLFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSBpZiAoZm9sZCA9PT0gXFxcIjFcXFwiIHx8IOaKmOWPoOeKtuaAgSA9PSBmYWxzZSkge1xcbiAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXG4gICAgICAgICAgICB2YXIgZXh0cmFwb3MgPSBmYWxzZTtcXG4gICAgICAgICAgICAvKmlmIChpdGVtLmluY2x1ZGVzKCd0eXBlPVxcXCJAZXh0cmFcXFwiJykpIHtcXG4gICAgICAgICAgICAgIGV4dHJhcG9zID0gdHJ1ZTtcXG4gICAgICAgICAgICAgIC8vbG9nKCfpmYTliqDlrprkvY0nKVxcbiAgICAgICAgICAgIH0qL1xcblxcbiAgICAgICAgICAgIGlmIChleHRyYXBvcykge1xcbiAgICAgICAgICAgICAgdmFyIH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AgICAgICAgICAgICAgdHlwZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAQFxcXCIpWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBAXFxcIilbMV0pLFxcbiAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIGNhc2Ug5YiG57G76ZO+5o6lLmluY2x1ZGVzKFxcXCJAQFxcXCIpOlxcbiAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXBlOiDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAXFxcIilbMF0sXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAXFxcIilbMV0pLFxcbiAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgICAgICAgIC8vIGpzb24gPSBwZChpdGVtLCDliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgfSovXFxuICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAvKnZhciBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEBAJyk/e1xcbiAgICAgICAgICAgICAgICAgICAgdHlwZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVswXSksXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAganNvbj3liIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAJyk/e1xcbiAgICAgICAgICAgICAgICAgICAgdHlwZTrliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMF0sXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzFdKSxcXG4gICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7Ki9cXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgbGV0IHBhcmFtcyA9IHtcXG4gICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxcbiAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcbiAgICAgICAgICAgICAganNvbjoganNvbixcXG4gICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcbiAgICAgICAgICAgICAgdXJsOiAkKFxcXCJoaWtlcjovL2VtcHR5XFxcIiArIFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmFsbGNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXBbcGFyYW1zLmluZGV4XSA9IHBhcmFtcy5rZXkudG9TdHJpbmcoKTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIsIEpTT04uc3RyaW5naWZ5KHBhcmFtcy5jYXRlX3RlbXApKTtcXG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtcy5qc29uLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiZHRfXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgfSwgcGFyYW1zKSxcXG4gICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiLFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICB9KTtcXG4gICAgfVxcbiAgICB9LFxcbiAgfTtcXG4gIG9iai7pooTorr4ob3B0aW9ucyk7XFxuICByZXR1cm4gb2JqO1xcbn1cXG5cXG4gIC8vLueKtuaAgShcXFwidXJsXFxcIilcXG4gIC8vLueVjOmdoihkKVxcbiAgLy8u5rqQ56CBKHhodG1sKVxcbiAgLy8u5YWo5riFKFt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IiArIHBhZ2U7XFxuICAgICAgICAgIGNscyA9IFxcXCJsYXN0bWFya1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgIHBpY191cmw6IGltZyxcXG4gICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eSMjXFxcIiArIHVybCxcXG4gICAgICAgICAgY29udGVudDogY29udGVudCxcXG4gICAgICAgICAgY29sX3R5cGU6IHJ1bGUuY29sX3R5cGUsXFxuICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgIGlkOiBpZCxcXG4gICAgICAgICAgICBjbHM6IGNscyxcXG4gICAgICAgICAgfSxcXG4gICAgICAgIH0pO1xcbiAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxICYmIHNob3cpIHtcXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICBpZDogXFxcInBhZ2VsaW5lXFxcIixcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzbWFsbD7liqDovb3kuK0uLi48L3NtYWxsPlxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbnVtXFxcIixcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICB9KTtcXG4gICAgfSBlbHNlIHtcXG4gICAgICB1cGRhdGVJdGVtKFxcXCJwYWdlbnVtXFxcIiwge1xcbiAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuWIsOW6leS6hjwvc21hbGw+PC9mb250PicsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBpZDogXFxcImxhc3RcXFwiLFxcbiAgICAgICAgfSxcXG4gICAgICB9KTtcXG4gICAgfVxcbiAgICBpZiAobGlzdC5sZW5ndGggPT0gMCAmJiBwYWdlID09IDEpIHtcXG4gICAgICBkLnB1c2goe1xcbiAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIixcXG4gICAgICB9KTtcXG4gICAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuaXoOWGheWuuTwvc21hbGw+PC9mb250PicsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge30sXFxuICAgICAgfSk7XFxuICAgIH1cXG4gICAgaWYodGhpcy5uZXh0UGFnZSgpKXtcXG4gICAgICAvL2xvZygndCcpO1xcbiAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ3lpX2lzbmV4dCcsJ3QnKTtcXG4gICAgfWVsc2V7XFxuICAgICAgLy9sb2coJ2YnKTtcXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCd5aV9pc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uICAgIGZvciAodmFyIGkgaW4gdXJscykge1xcbiAgICAgICAgaWYgIChjaGVjayh1cmxzW2ldKSl7XFxuICAgICAgICAgICAvLyBmeV9icmlkZ2VfYXBwLmxvZyh1cmxzW2ldKVxcbiAgICAgICAgICAgIHJldHVybiB1cmxzW2ldXFxuICAgICAgICB9XFxuICAgICAgICBpZih1cmxzW2ldLmluY2x1ZGVzKFxcXCJ1cmw9aHR0cFxcXCIpKXtcXG4gICAgICAgICAgICBsZXQgdSA9IHVybHNbaV0uc3BsaXQoXFxcInVybD1cXFwiKVsxXTtcXG4gICAgICAgICAgICBpZihjaGVjayh1KSl7XFxuICAgICAgICAgICAgICAgIHJldHVybiB1O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfVxcbn0pKVxcbnZhciBsYXp5ID0gXFxcIkBsYXp5UnVsZT0uanM6c2hvd0xvYWRpbmcoJ+ato+WcqOWXheaOouS4rSzor7fnqI3lkI4uLi4nKTsneDVSdWxlOi8vJytpbnB1dCsnQCcgKyBnZXRWYXIoJ194NScpXFxcIjtcIn1dIiwiaWNvbiI6Imh0dHBzOi8vaW5ld3MuZ3RpbWcuY29tL25ld3NhcHBfbHMvMC8xMTkyOTM4NzYwNi8wIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment