xiaomianao666

小程序:TVB云播❀

Sep 6th, 2024
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@TVB云播❀@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6ImJvZHkmJi5teXVpLWNvbnRlbnRfX2xpc3QmJmEsLTEmJlRleHQuanM6J+abtOaWsOiHs++8micraW5wdXQiLCJ0aXRsZSI6IlRWQuS6keaSreKdgCIsImF1dGhvciI6IlIiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IyNodHRwOi8vd3d3LnR2eWIwMy5jb20vIiwidmVyc2lvbiI6MjAyMzEwMjQsImNvbF90eXBlIjoibW92aWVfMyIsImNsYXNzX25hbWUiOiIiLCJ0eXBlIjoidmlkZW8iLCJjbGFzc191cmwiOiIiLCJhcmVhX25hbWUiOiIiLCJhcmVhX3VybCI6IiIsInNvcnRfbmFtZSI6IiIsInllYXJfbmFtZSI6IiIsInNvcnRfdXJsIjoiIiwieWVhcl91cmwiOiIiLCJmaW5kX3J1bGUiOiJqczpcbnZhciBkID0gW107XG5cbk1ZX1VSTCA9IE1ZX1VSTC5yZXBsYWNlKCdoaWtlcjovL2VtcHR5IyMnLCAnJyk7XG52YXIgaHRtbCA9IGZldGNoKE1ZX1VSTCk7XG4vKlxuY29uc3QgaG9zdCA9ICdodHRwOi8vb2Z0ZW5zLnRvcC8nO1xudmFyIGh0bWwgPSBmZXRjaChob3N0LCB7XG4gICAgaGVhZGVyczoge1xuICAgICAgICAnVXNlci1BZ2VudCc6IE1PQklMRV9VQVxuICAgIH1cbn0pOyovXG5cbi8v6L2u5pKtXG52YXIg6L2u5pKt5YiX6KGoID0gJy5zd2lwZXItY29udGFpbmVyJiYuc3dpcGVyLXNsaWRlJztcbnZhciDova7mkq3moIfpopggPSAnLm5hbWUmJlRleHQnO1xudmFyIOi9ruaSreWbvueJhyA9ICdhJiZzdHlsZSc7XG52YXIg6L2u5pKt6ZO+5o6l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+B56CB6aqM6K+BJyxcbiAgICAgICAgZGVzYzogJ+mqjOivgeaIkOWKn+WQjuivt+aJi+WKqOS4i+aLieWIt+aWsCcsXG4gICAgICAgIHVybDogJCgnaGlrZXI6Ly9lbXB0eScpLnJ1bGUoKCkgPT4ge1xuICAgICAgICAgICAgdmFyIGQgPSBbXTtcbiAgICAgICAgICAgIHZhciBpbWdsaW4gPSAnaHR0cDovL3d3dy50dnliMDMuY29tL2luZGV4LnBocC92ZXJpZnkvaW5kZXguaHRtbD9yPScgKyBNYXRoLnJhbmRvbSgpO1xuICAgICAgICAgICAgLy/lj5blm77niYdjb29raWVcbiAgICAgICAgICAgIHZhciBjb2sgPSBKU09OLnBhcnNlKGZldGNoQ29va2llKGltZ2xpbiwge1xuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcbiAgICAgICAgICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiBNT0JJTEVfVUFcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsXG4gICAgICAgICAgICAgICAgd2l0aEhlYWRlcnM6IHRydWVcbiAgICAgICAgICAgIH0pKS5qb2luKCc7Jyk7XG5cbiAgICAgICAgICAgIC8v5pi+56S66aqM6K+B56CBXG4gICAgICAgICAgICBkLnB1c2goe1xuICAgICAgICAgICAgICAgIHBpY191cmw6IGltZ2xpbiArICdAVXNlci1BZ2VudD0nICsgTU9CSUxFX1VBICsgJ0BDb29raWU9JyArIGNvayxcbiAgICAgICAgICAgICAgICB1cmw6ICQoJycpLmxhenlSdWxlKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlZnJlc2hQYWdlKCk7XG4gICAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdwaWNfMV9mdWxsJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAvL+i+k+WFpeahhlxuICAgICAgICAgICAgZC5wdXNoKHtcbiAgICAgICAgICAgICAgICB0aXRsZTogJycsXG4gICAgICAgICAgICAgICAgdXJsOiBcIid0b2FzdDovL+S9oOi+k+WFpeeahOaYrycgKyBpbnB1dFwiLFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XG4gICAgICAgICAgICAgICAgICAgIG9uQ2hhbmdlOiBcInB1dE15VmFyKCfpqozor4HnoIEnLGlucHV0KVwiLFxuICAgICAgICAgICAgICAgICAgICB0aXRsZVZpc2libGU6IGZhbHNlXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2lucHV0J1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBkLnB1c2goe1xuICAgICAgICAgICAgICAgIHRpdGxlOiAn5Y+R6YCBJyxcbiAgICAgICAgICAgICAgICB1cmw6ICQoTVlfVVJMKS5sYXp5UnVsZSgoY29rKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBjb2QgPSBnZXRNeVZhcign6aqM6K+B56CBJyk7XG4gICAgICAgICAgICAgICAgICAgIHZhciBodG1sID0gSlNPTi5wYXJzZShmZXRjaCgnaHR0cDovL3d3dy50dnliMDMuY29tL2luZGV4LnBocC9hamF4L3ZlcmlmeV9jaGVjaz90eXBlPXNlYXJjaCZ2ZXJpZnk9JyArIGNvZCwge1xuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdYLVJlcXVlc3RlZC1XaXRoJzogJ1hNTEh0dHBSZXF1ZXN0JyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnVXNlci1BZ2VudCc6IE1PQklMRV9VQSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ29va2llJzogY29rXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogJycsXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xuICAgICAgICAgICAgICAgICAgICB9KSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChodG1sLmNvZGUgPT0gMSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbSgnZmxjb29rJywgY29rKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2sodHJ1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJ0b2FzdDovL+mqjOivgeaIkOWKn+OAglwiXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJ0b2FzdDovL+mqjOivgeWksei0pe+8gVwiXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LCBjb2spLFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8yJ1xuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBzZXRSZXN1bHQoZCk7XG4gICAgICAgIH0pLFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnXG4gICAgfSk7XG59XG52YXIgbGlzdCA9IHBkZmEoaHRtbCwgJyNzZWFyY2hMaXN0JiZsaScpO1xuZm9yICh2YXIgaiBpbiBsaXN0KSB7XG52YXIgdGl0bGUgPSBwZGZoKGxpc3Rbal0sICdhJiZ0aXRsZScpO1xudmFyIGltZyA9IHBkKGxpc3Rbal0sICdhJiZkYXRhLW9yaWdpbmFsJyk7XG4gIGQucHVzaCh7XG4gICAgICAgdGl0bGU6IHRpdGxlLFxuICAgICAgIGRlc2M6IHBkZmgobGlzdFtqXSwgJy5waWMtdGFnJiZUZXh0JyksXG4gICAgICAgY29udGVudDogcGRmaChsaXN0W2pdLCAnLmRldGFpbCYmVGV4dCcpLFxuICAgICAgIGltZzogaW1nLFxuICAgICAgIHVybDogcGQobGlzdFtqXSwgJ2EmJmhyZWYnKSsnI2ltbWVyc2l2ZVRoZW1lIycgKyAnQHJ1bGU9anM6JC5yZXF1aXJlKFwiZWpcIiknLFx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mYWxzZScpIHtcXG4gICAgICAgIHVuUmVnaXN0ZXJUYXNrKGlkKVxcbiAgICAgICAgcmV0dXJuXFxuICAgIH1cXG4gICAgXFxuICAgIC8vbG9nKGRhdGEpXFxuXFxuICAgIGxldCBvYmogPSB7XFxuICAgICAgICBkYXRhOiBkYXRhLFxcbiAgICB9O1xcblxcbiAgICByZWdpc3RlclRhc2soaWQsIHRpbWUsICQudG9TdHJpbmcoKG9iaixpZCkgPT4ge1xcbiAgICAgICAgdmFyIGRhdGEgPSBvYmouZGF0YTtcXG4gICAgICAgIHZhciBydW0gPSBnZXRNeVZhcigncm51bScpO1xcblxcbiAgICAgICAgdmFyIGkgPSBOdW1iZXIoZ2V0TXlWYXIoJ2Jhbm5lcmknLCAnMCcpKTtcXG4gICAgICAgIGlmIChydW0gIT0gJycpIHtcXG4gICAgICAgICAgICBpID0gTnVtYmVyKHJ1bSkgKyAxXFxuICAgICAgICAgICAgY2xlYXJNeVZhcigncm51bScpXFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGkgPSBpICsgMTtcXG4gICAgICAgIH1cXG4gICAgICAgIC8vbG9nKGkpXFxuICAgICAgICAvL2xvZyhkYXRhLmxlbmd0aClcXG5cXG4gICAgICAgIGlmIChpID4gZGF0YS5sZW5ndGggLSAxKSB7XFxuICAgICAgICAgICAgaSA9IDBcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBpdGVtID0gZGF0YVtpXTtcXG4gICAgICAgIC8vbG9nKGl0ZW0pXFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQrJ2JhcicsIHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgIGltZzogaXRlbS5pbWcsXFxuICAgICAgICAgICAgICAgIHVybDogaXRlbS51cmwsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaXRlbS5pbWcsXFxuICAgICAgICAgICAgICAgICAgICAvL25hbWU6IGl0ZW0udGl0bGUucmVwbGFjZSgvPFtePl0rPi9nLCAnJyksXFxuICAgICAgICAgICAgICAgICAgICAvL3NuYW1lOiBpdGVtLmV4dHJhLnNuYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgLy9zdHlwZTogaXRlbS5leHRyYS5zdHlwZSxcXG4gICAgICAgICAgICAgICAgICAgIC8vc3VybDogaXRlbS51cmwsXFxuICAgICAgICAgICAgICAgICAgICAvL2ltZzppdGVtLmltZyxcXG4gICAgICAgICAgICAgICAgICAgIC8vcGFnZVRpdGxlOiBpdGVtLnRpdGxlLnJlcGxhY2UoLzxbXj5dKz4vZywgJycpLFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coZS5tZXNzYWdlKVxcbiAgICAgICAgICAgIHVuUmVnaXN0ZXJUYXNrKGlkKVxcbiAgICAgICAgfVxcbiAgICAgICAgcHV0TXlWYXIoJ2Jhbm5lcmknLCBpKTtcXG5cXG4gICAgfSwgb2JqLGlkKSlcXG59XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLikaDkuIDnuqfpobXpnaJcIixcInBhdGhcIjpcInlpXCIsXCJydWxlXCI6XCJ2YXIgSWNvbl9wcmVmaXggPSAnaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tb3JlLyc7XFxuXFxuLy/nrZvpgIlcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfnrZvpgIknLFxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9zaGFpP3BhZ2U9ZnlwYWdlI25vSGlzdG9yeSMnLFxcbiAgICAgICAgICAgIHBpY191cmw6IEljb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uICAgICAgICAgICAgdGl0bGU6IGdldE15VmFyKCd3ZWVrJywgbm93X1dlZWspID09PSBpdCA/ICfimIAnICsgJ+KAnOKAnOKAneKAnTxiPjxmb250IGNvbG9yPSNGQTcyOTg+JyArIGl0ICsgJzwvZm9udD48L2I+JyA6IGl0LnJlcGxhY2UoJ+WRqCcsJycpLFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMjbm9IaXN0b3J5IycpLmxhenlSdWxlKChpdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwid2Vla1xcXCIsIGl0KTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgIH0sIGl0KSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiXFxuICAgICAgICB9KTtcXG4gICAgfSlcXG5cXG5sZXQgY2hvc2Vfd2VlayA9IGdldE15VmFyKCd3ZWVrJywgbm93X1dlZWspO1xcbnZhciB3a1RvbnVtID0gZnVuY3Rpb24od2spIHtcXG4gICAgICAgIGlmICgv5ZGofOaYn+acny8udGVzdCh3aykpIHtcXG4gICAgICAgICAgICB3ayA9IHdrLnJlcGxhY2UoL+WRqHzmmJ/mnJ8vLCBcXFwiXFxcIilcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBtYXAgPSB7XFxuICAgICAgICAgICAgXFxcIuaXpVxcXCI6IDYsXFxuICAgICAgICAgICAgXFxcIuS4gFxcXCI6IDAsXFxuICAgICAgICAgICAgXFxcIuS6jFxcXCI6IDEsXFxuICAgICAgICAgICAgXFxcIuS4iVxcXCI6IDIsXFxuICAgICAgICAgICAgXFxcIuWbm1xcXCI6IDMsXFxuICAgICAgICAgICAgXFxcIuS6lFxcXCI6IDQsXFxuICAgICAgICAgICAgXFxcIuWFrVxcXCI6IDVcXG4gICAgICAgIH07XFxuICAgICAgICByZXR1cm4gbWFwW3drXVxcbiAgICB9XFxuICAgIGxldCB3a19udW0gPSB3a1RvbnVtKGNob3NlX3dlZWspO1xcbi8vbG9nKHdrX251bSlcXG5mb3IgKHZhciBrID0gMDsgayA8PSA2OyBrKyspIHtcXG4gICAgZXZhbCgndmFyIHdrJyArIGsgKyAnPXBkZmEoaHRtbCwgXFxcIi5tb2R1bGUtbWFpbiwnICsgKGs9PTA/MDprKSArICcmJi5tb2R1bGUtaXRlbSwwOjEyXFxcIik7Jyk7Ly/mmJ/mnJ/liJfooahcXG4gICAgaWYgKHdrX251bSA9PSBrKSB7XFxuICAgICAgICBldmFsKCd3aycraykuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICB2YXIgdXJsbCA9IE1ZX0hPTUUgKyBwZGZoKGl0ZW0sICdhJiZocmVmJykgKyAnI2ltbWVyc2l2ZVRoZW1lIyc7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoaXRlbSwg5qCH6aKYKSxcXG4gICAgICAgICAgICAgICAgZGVzYzogcGRmaChpdGVtLCDmj4/ov7ApLFxcbiAgICAgICAgICAgICAgICBpbWc6IHBkZmgoaXRlbSwg5Zu+54mHKSArIFxcXCJAUmVmZXJlcj1cXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6ICdoaWtlcjovL3BhZ2UvZWojbm9IaXN0b3J5IyNpbW1lcnNpdmVUaGVtZSMnLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmxsLFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoaXRlbSwg5qCH6aKYKSxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogcGRmaChpdGVtLCDlm77niYcpICsgXFxcIkBSZWZlcmVyPVxcXCIsXFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIGN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YzogcGRmaChsaXN0W2pdLCDmj4/ov7ApLFxcbiAgICAgICAgICAgICAgICBpbWc6IHBkKGxpc3Rbal0sIOWbvueJhykgKyBcXFwiQFJlZmVyZXI9XFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBwZChsaXN0W2pdLOmTvuaOpSkgKyAnI2ltbWVyc2l2ZVRoZW1lI0BydWxlPWpzOiQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2VqXFxcIiknLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzMnLFxcbiAgICAgICAgICAgICAgICBleHRyYTp7XFxuICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwZGZoKGxpc3Rbal0sIOagh+mimCksXFxuICAgICAgICAgICAgICAgICAgIGltZzogcGQobGlzdFtqXSwg5Zu+54mHKSArIFxcXCJAUmVmZXJlcj1cXFwiLFxcbiAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgfVxcblwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfMV92ZXJ0aWNhbF9waWNcIixcIm5hbWVcIjpcIuKRpeabtOaWsOmhtemdolwiLFwicGF0aFwiOlwiZ3hcIixcInJ1bGVcIjpcImpzOlxcbnZhciBkID0gW107XFxuY29uc3QgYmFzZV91cmwgPSBcXFwiaHR0cDovL3d3dy50dnliMDMuY29tL2xhYmVsL25ldy5odG1sXFxcIjtcXG5cXG5sZXQgdHJ1ZV91cmwgPSBnZXRNeVZhcihNWV9SVUxFLnVybCwgYmFzZV91cmwpO1xcbk1ZX1VSTD10cnVlX3VybDtcXG52YXIgaHRtbD1mZXRjaCh0cnVlX3VybClcXG4vL2xvZyhodG1sKVxcblxcbmQucHVzaCh7XFxuICAgIHRpdGxlOic8Yj48c3BhbiBzdHlsZT1cXFwiY29sb3I6ICNGQTcyOThcXFwiPuacgOi/keabtOaWsFxcXFx0XFxcXHRcXFxcdFxcXFx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JdGVtKCdkc2hvdycpLnRpdGxlO1xcbiAgICAgICAgdmFyIGR0aXRsZSA9IGZpbmRJdGVtKCdkY29udGVudCcpLnRpdGxlO1xcbiAgICAgICAgaWYgKGRzID09ICcwJykge1xcbiAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKG1hcmssICcxJylcXG4gICAgICAgICAgdXBkYXRlSXRlbSgnZGNvbnRlbnQnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IGR0aXRsZS5yZXBsYWNlKC9cXFxcPi4qP1xcXFw8LywnPicrZGMrJzwnKVxcbiAgICAgICAgICAgIC5yZXBsYWNlKC8oY29sb3I9XFxcIikuKj8oXFxcIikvLCckMScrY3Muc2hvdysnJDInKVxcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgdXBkYXRlSXRlbSgnZHNob3cnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoJ+WxleW8gCcsICfmlLbotbcnKSAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICB9KTtcXG5cXG5cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0obWFyaywgJzAnKVxcbiAgICAgICAgICB1cGRhdGVJdGVtKCdkY29udGVudCcsIHtcXG4gICAgICAgICAgICB0aXRsZTogZHRpdGxlLnJlcGxhY2UoL1xcXFw+Lio/XFxcXDwvLCc+JytzZGMrJzwnKVxcbiAgICAgICAgICAgIC5yZXBsYWNlKC8oY29sb3I9XFxcIikuKj8oXFxcIikvLCckMScrY3MuaGlkZSsnJDInKVxcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgdXBkYXRlSXRlbSgnZHNob3cnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoJ+aUtui1tycsICflsZXlvIAnKSAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHV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BzdHlsZS5mb3JFYWNoKCh4LCBpKSA9PiB7XFxuICAgICAgICB2YXIgbGVmdCA9IFtdO1xcbiAgICAgICAgdmFyIHJpZ2h0ID0gW107XFxuICAgICAgICB2YXIgc3RyID0gdGV4dEFycmF5W2ldO1xcbiAgICAgICAgT2JqZWN0LmtleXMoeCkuZm9yRWFjaChrID0+IHtcXG4gICAgICAgICAgICBzd2l0Y2ggKGspIHtcXG4gICAgICAgICAgICAgICAgY2FzZSAnY29sb3InOlxcbiAgICAgICAgICAgICAgICAgICAgbGVmdC5wdXNoKCc8Zm9udCBjb2xvcj1cXFwiJyArIHhba10gKyAnXFxcIj4nKTtcXG4gICAgICAgICAgICAgICAgICAgIHJpZ2h0LnB1c2goJzwvZm9udD4nKTtcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICAgICAgbGVmdC5wdXNoKGA8JHtrfT5gKTtcXG4gICAgICAgICAgICAgICAgICAgIHJpZ2h0LnB1c2goYDwvJHtrfT5gKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICBsaXN0W2ldID0gbGVmdC5qb2luKCcnKSArIHN0ciArIHJpZ2h0LmpvaW4oJycpO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgIHJldHVybiBsaXN0O1xcbiAgICAgIH1cXG4gICAgICB0aXRsZXM9dGV4dEFycmF5KGZpcnN0SGFsZix0aXRsZXMpO1xcbiAgICAgIGRlc2NzPXRleHRBcnJheShzZWNvbmRIYWxmLGRlc2NzKTtcXG4gICAgICBcXG4gICAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6J+KAnOKAnOKAneKAnScrdGl0bGVzWzBdKydcXFxcbicrdGl0bGVzLnNsaWNlKDEsMykuam9pbignXFxcXG4nKSxcXG4gICAgICAgIGRlc2M6J+K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1bmMgIT0gdW5kZWZpbmVkICYmICQuZnVuYy5jb25zdHJ1Y3RvciA9PSBGdW5jdGlvbikge1xcbiAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3BpY18xJyxcXG4gICAgICAgICAgICBpbWc6ICdodHRwczovL2ltZy5uaWNreWFtLmNvbS9maWxlL2ZlNDFhN2ExNzQ0YTNhODE5NGRmMi5naWYnLFxcbiAgICAgICAgICAgIHVybDogJ3RvYXN0Oi8vbG9hZGluZycsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgIGNsczogc2hzb3J0XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICB4bGlzdCA9ICQuZnVuYyhpLCBpbmZvKTtcXG4gICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19saXN0JywgeGxpc3QpO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIHBsYXlzID0geGxpc3QubWFwKHggPT4ge1xcbiAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgIHVybDogeC51cmwsXFxuICAgICAgICAgICAgY29sX3R5cGU6IGNvbCxcXG4gICAgICAgICAgICBwaWM6IHBpYyxcXG4gICAgICAgICAgICBleHRyYTogT2JqZWN0LmFzc2lnbih7fSwgZXh0cmEsIHtcXG4gICAgICAgICAgICAgIGlkOiB4LnVybC5yZXBsYWNlKC9AbGF6eVJ1bGVbXFxcXHNcXFxcU10rL2csICcnKSxcXG4gICAgICAgICAgICAgIGNsczogY2xzLFxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgICAgICBpZiAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19z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AgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKC8jKFxcXFx3Kyk/L2csIGxpbmVjKSxcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoLyMoXFxcXHcrKT8vZywgJyMnKSxcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaIkOWKn++8gSc7XFxuICAgICAgfSwgdmFyaSwgc2hzb3J0LCBpLCBjdXN0b20u57q/6Lev6YCJ5LitLCBpbmZvKVxcbiAgICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyAoZ2V0TXlWYXIodmFyaSwgJzAnKSA9PSBpID8gdGFic1tpXS5mb250Y29sb3IoY3VzdG9tLue6v+i3r+mAieS4rSkgOiB0YWJzW2ldLmZvbnRjb2xvcignIycpKSxcXG4gICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgY29sX3R5cGU6IGN1c3RvbS7nur/ot6/moLflvI8sXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBjbHM6IHNoc29ydCArICdfdGFiJyxcXG4gICAgICAgICAgaWQ6IHNoc29ydCArICdfdGFiXycgKyBpLFxcbiAgICAgICAgfVxcbiAgICAgIH0pXFxuICAgIH1cXG4gICAgZC5wdXNoKHtcXG4gICAgICBjb2xfdHlwZTogY3VzdG9tLuWIhuWJsuagt+W8jyxcXG4gICAgICBleHRyYToge1xcbiAgICAgICAgaWQ6IHNoc29ydCArICdfbGluZScsXFxuICAgICAgfVxcbiAgICB9KVxcbiAgfSxcXG4gIHB1c2hUYWI6IGZ1bmN0aW9uICh2YXJpLCBzaHNvcnQpIHtcXG4gICAgYWRkTGlzdGVuZXIoJ29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vbGQnLCAnMScpID09ICcwJykge1xcbiAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXG4gICAgICAgIH1cXG4gICAgICAgIHZhciB0aXRsZXMgPSBwb2JqWyfpgInmjqgnXTtcXG4gICAgICAgIHZhciBwY2ZnID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19wdXNoY2ZnJywgJ3t9Jyk7XFxuICAgICAgICBwY2ZnWydvYmonXSA9IHBvYmo7XFxuICAgICAgICB2YXIg6YCJ5o6oID0gcGNmZ1sn6YCJ5o6oJ10gPyBwY2ZnWyfpgInmjqgnXSA6IGZhbHNlO1xcbiAgICAgICAgaWYgKOmAieaOqCkge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHMnLCB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSxcXG4gICAgICAgICAgfSlcXG4gICAgICAgICAgcGNmZ1sn6YCJ5o6oJ10gPSBmYWxzZTtcXG4gICAgICAgICAgcGNmZ1sncGxheWxpc3QnXS5tYXAoKHgpID0+IHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHRvJywge1xcbiAgICAgICAgICAgIHRpdGxlOiAn5o6o6YCB5pys6aG1PT5UVkJveCcsXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCArICdfZHVvc2VsZWN0Jyk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfcHVzaHMnLCB7XFxuICAgICAgICAgICAgdGl0bGU6ICfigJzig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3J0ICsgXFxcIl9saXN0XFxcIiwgJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXCIkXFxcIiArIHgudXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpKS5qb2luKFxcXCIjXFxcIik7XFxuICAgICAgICAgICAgdmFyIHRhYnMgPSBbdGFic1tnZXRNeVZhcih2YXJpLCAnMCcpXV07XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgLy9sb2cocGxzKVxcbiAgICAgICAgICAvL2xvZyh0YWJzKVxcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKOmAieaOqCkge1xcbiAgICAgICAgICB2YXIgcGxzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgXFxcIl9kdW9zZWxlY3RcXFwiLCAnW10nKS5tYXAoeCA9PiB4LnRpdGxlICsgXFxcIiRcXFwiICsgeC51cmwpLmpvaW4oXFxcIiNcXFwiKTtcXG4gICAgICAgICAgaWYgKHBscy5sZW5ndGggPT0gMCkge1xcbiAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/pgInmi6nkuLrnqbonO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIHZhciB0YWJzID0gWyfmkq3mlL7liJfooagnXTtcXG4gICAgICAgIH1cXG5cXG4gICAgICAgIHZhciBpbmZvID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX2luZm8nLCAne30nKTtcXG4gICAgICAgIHZhciBkZXNjID0gaW5mb1snZGVzYyddO1xcbiAgICAgICAgdmFyIOaOqOmAgSA9IHtcXG4gICAgICAgICAgXFxcIm5hbWVcXFwiOiBnZXRQYWdlVGl0bGUoKSxcXG4gICAgICAgICAgXFxcImNvbnRlbnRcXFwiOiBkZXNjIHx8ICcnLFxcbiAgICAgICAgICBcXFwicGljXFxcIjogaW5mb1snaW1nJ10gfHwgJycsXFxuICAgICAgICAgIFxcXCJmcm9tXFxcIjogdGFicy5qb2luKCckJCQnKSxcXG4gICAg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gICAgICAgICBjb2wgPSBjbHNbc2hzb3J0XS5jb2xfdHlwZTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCDmjInpkq7moLflvI8gPSBhbGxfY29scy5tYXAoKGl0KSA9PiB7XFxuICAgICAgICAgIHJldHVybiBpdCA9PT0gY29sID8gJ+Keoe+4jycgKyBpdCA6IGl0O1xcbiAgICAgICAgfSk7XFxuICAgICAgICBsZXQgdGlwcyA9ICfor7fpgInmi6npgInpm4bmjInpkq7moLflvI8nO1xcbiAgICAgICAgcmV0dXJuICQo5oyJ6ZKu5qC35byPLCAyLCB0aXBzKS5zZWxlY3QoKHNoc29ydCwgY2xzKSA9PiB7XFxuICAgICAgICAgIGlucHV0ID0gaW5wdXQucmVwbGFjZSgv4p6h77iPL2csICcnKTtcXG4gICAgICAgICAgLypzdG9yYWdlMC5zZXRJdGVtKCfmjInpkq7moLflvI8nLCBpbnB1dCk7Ki9cXG4gICAgICAgICAgbGV0IG9sZElkcyA9IChmaW5kSXRlbXNCeUNscyhzaHNvcnQpIHx8IFtdKS5tYXAoaXQgPT4gaXQuZXh0cmEuaWQpOyAvL+iAgeWFg+e0oGlkc1xcbiAgICAgICAgICBvbGRJZHMuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHgsIHtcXG4gICAgICAgICAgICAgIGNvbF90eXBlOiBpbnB1dFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3suWIh+aNoumAiembhuaMiemSruagt+W8j+S4ujonICsgaW5wdXQ7XFxuICAgICAgICB9LCBzaHNvcnQsIGNscyk7XFxuICAgICAgfSwgc2hzb3J0LCBjdXN0b20pXFxuICAgIH1dXFxuICB9LFxcbiAgc2V0VGFiczogZnVuY3Rpb24gKHRhYnMsIHZhcmksIHNoc29ydCwgcGFyc2UpIHtcXG4gICAgbGV0IGN1c3RvbSA9IHBhcnNlLuiHquWumuS5iT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jbHNsaXN0ID0gJC5kYXRhQ29udmVydChjbHNsaXN0cyk7XFxuXFxuICAgICAgICB2YXIgdGl0bGVzID0gW2Ake2N1c3RvbS7mraPluo/popzoibJ9XFxcIj7mraPluo9gLCBgJHtjdXN0b20u6YCG5bqP6aKc6ImyfVxcXCI+6YCG5bqPYF07XFxuXFxuICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgIG5ld2Nsc2xpc3QucmV2ZXJzZSgpO1xcbiAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIG5ld2Nsc2xpc3QpO1xcblxcbiAgICAgICAgdmFyIG9iaiA9IGZpbmRJdGVtKHNoc29ydCArICdfYXZhdGFyJylcXG5cXG4gICAgICAgIGlmIChjb25mID09ICcxJykge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMV0sIHRpdGxlc1swXSksXFxuICAgICAgICAgIH0pXFxuICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYXZhdGFyJywge1xcbiAgICAgICAgICAgIHRpdGxlOiBvYmoudGl0bGUucmVwbGFjZSh0aXRsZXNbMF0sIHRpdGxlc1sxXSksXFxuICAgICAgICAgIH0pXFxuICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcxJyk7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5o6S5bqP5oiQ5YqfJztcXG4gICAgICB9LCBzaHNvcnQsIHZhcmksIGN1c3RvbSksXFxuICAgICAgY29sX3R5cGU6ICdhdmF0YXInLFxcbiAgICAgIGltZzogY3VzdG9tLuWbvuaghyxcXG4gICAgICB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lzdHMgPSBbXTtcXG4gICAgdmFyIGNvbnRzID0gW107XFxuICAgIGlmICh0eXBlb2YgcGFyc2Uu6YCJ6ZuGID09ICdvYmplY3QnKSB7XFxuICAgICAgY29udHMgPSBwYXJzZS7pgInpm4Y7XFxuICAgIH1cXG4gICAgaWYgKGNvbnRzLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgdHJ5IHtcXG4gICAgICAgIGNvbnRzID0gcGRmYShodG1sLCBwYXJzZS7pgInpm4YpO1xcbiAgICAgIH0gY2F0Y2gge1xcbiAgICAgICAgdG9hc3QoJ+mAiembhuWumuS9jeacieivrycpXFxuICAgICAgfVxcbiAgICB9XFxuXFxuICAgIGxldCDmm7/mjaLlh73mlbAgPSAnJztcXG4gICAgdmFyIOmAiembhuWQjeensCA9IHBhcnNlLumAiembhuWQjeensCA/IHBhcnNlLumAiembhuWQjeensCA6ICdhJiZUZXh0JztcXG4gICAgaWYgKOmAiembhuWQjeensC5pbmNsdWRlcygnQEAnKSkge1xcbiAgICAgIOmAiembhuWQjeensCA9IHBhcnNlLumAiembhuWQjeensC5zcGxpdCgnQEAnKVswXTtcXG4gICAgICDmm7/mjaLlh73mlbAgPSBwYXJzZS7pgInpm4blkI3np7Auc3BsaXQoJ0BAJylbMV07XFxuICAgIH1cXG5cXG4gICAgdmFyIOmAiembhumTvuaOpSA9IHBhcnNlLumAiembhumTvuaOpSA/IHBhcnNlLumAiembhumTvuaOpSA6ICdhJiZocmVmJztcXG4gICAgdmFyIOino+aekCA9IHBhcnNlLuino+aekCA/IHBhcnNlLuino+aekCA6ICcnO1xcbiAgICB2YXIgdGVtcCA9IFtdO1xcblxcbiAgICBmb3IgKHZhciBpIGluIGNvbnRzKSB7XFxuICAgICAgaWYgKHBhcnNlLumAiembhuWIl+ihqCAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgIGlmIChwYXJzZS7pgInpm4bliJfooaggPT0gJ29iamVjdCcpIHtcXG4gICAgICAgICAgbGlzdHMucHVzaChjb250c1tpXS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcbiAgICAgICAgICAgICAgdXJsOiB4LnVybCArIOino+aekCxcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgIH0pKVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgbGlzdHMucHVzaChwZGZhKGNvbnRzW2ldLCBwYXJzZS7pgInpm4bliJfooagpLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoeCwg6YCJ6ZuG5ZCN56ewKSxcXG4gICAgICAgICAgICAgIHVybDogcGQoeCwg6YCJ6ZuG6ZO+5o6lKSArIOino+aekCxcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgIH0pKVxcbiAgICAgICAgfVxcbiAgICAgIH0gZWxzZSB7XFxuICAgICAgICB2YXIgdXJsID0gcGQoY29udHNbaV0sIOmAiembhumTvuaOpSk7XFxuICAgICAgICBpZiAoIemAiembhumTvuaOpS5pbmNsdWRlcygnaHJlZicpKSB7XFxuICAgICAgICAgIHVybCA9IHBkZmgoY29udHNbaV0sIOmAiembhumTvuaOpSk7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgdGl0bGUgPSBwZGZoKGNvbnRzW2ldLCDpgInpm4blkI3np7ApO1xcbiAgICAgICAgdGl0bGUgPSDmm7/mjaLlh73mlbAgIT0gJycgPyB0aGlzLmV2YWxSZSh0aXRsZSwg5pu/5o2i5Ye95pWwKSA6IHRpdGxlO1xcbiAgICAgICAgdGVtcC5wdXNoKHtcXG4gICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICB1cmw6IHVybCArIOino+aekCxcXG4gICAgICAgIH0pXFxuICAgICAgfVxcbiAgICB9XFxuICAgIGxldCDlgJLluo8gPSBwYXJzZS7lgJLluo8gPyBwYXJzZS7lgJLluo8gOiBmYWx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c2UuZm9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcbiAgICAgIHZhciB0YWJzID0gW3sgdGl0bGU6ICfkuLvnur8nIH1dO1xcbiAgICAgIGlmIChpdGVtLue6v+i3ryAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgIHRhYnMgPSB0aGlzLmdldFRhYnMoaXRlbSk7XFxuICAgICAgfVxcbiAgICAgIHB1dE15VmFyKHBsYXkgKyBpICsgJ190YWJzJywgdGFicy5tYXAoeCA9PiB4LnRpdGxlKSk7XFxuXFxuICAgICAgaWYgKGl0ZW0u5Yqo5oCB5pWw5o2uKSB7XFxuICAgICAgICBpZiAobW9kZSA9PSAxKSB7XFxuICAgICAgICAgIHRoaXMuc2V0VGFicyh0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgdGhpcy5zZXRUYWJzMih0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksIGl0ZW0sIHBlKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHB1dE15VmFyKCdlcl9odG1sJywgaHRtbCk7XFxuICAgICAgICBwdXRNeVZhcignZXJfdXJsJywgTVlfVVJMKTtcXG4gICAgICAgIHZhciBpbmZvID0geyBwYXJzZTogaXRlbSwgbWFyazogcGxheSArIGksIHVybDogTVlfVVJMIH07XFxuICAgICAgICBpZiAodGFicy5zb21lKHggPT4geC51cmwpKSB7XFxuICAgICAgICAgIGluZm9bJ3VybHMnXSA9IHRhYnMubWFwKHggPT4geC51cmwpO1xcbiAgICAgICAgfVxcblxcbiAgICAgICAgdmFyIGxpc3RzID0gZnVuYyhnZXRNeVZhcignZXJfJyArIGl0ZW0u57G75Z6LLCAnMCcpLCBpbmZvKTtcXG4gICAgICB9IGVsc2Uge1xcbiAgICAgICAgdmFyIGxpc3RzID0gdGhpcy5nZXRMaXN0cyhpdGVtLCBwbGF5ICsgaSk7XFxuXFxuICAgICAgICBpZiAobGlzdHM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KSArIFxcXCI8L2I+XFxcIixcXG4gICAgICAgIG9wZW46IHRydWUsXFxuICAgICAgICBzdGF0ZTogTVlfUlVMRS51cmwsXFxuICAgICAgICBzZWFyY2g6IGZhbHNlLFxcbiAgICAgICAgY2xlYXJzOiBbXSxcXG4gICAgICAgIGNsZWFyYWxsOiBbXFxcInlpX2ZpcnN0cGFnZVxcXCJdLFxcbiAgICAgICAgZGVidWc6IGZhbHNlLFxcblxcbiAgICAgICAg6aKE6K6+KHBhcmFtKSB7XFxuICAgICAgICAgICAgaWYgKHBhcmFtID09IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICBwYXJhbSA9IFtdO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBPYmplY3Qua2V5cyhwYXJhbSkuZm9yRWFjaCgocHJvcGVydHkpID0+IHtcXG4gICAgICAgICAgICAgICAgLy8g5a+55q+P5Liq5bGe5oCn5ZCN5omn6KGM5pON5L2cXFxuICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gcGFyYW1bcHJvcGVydHldOyAvLyDojrflj5blsZ7mgKflgLxcXG4gICAgICAgICAgICAgICAgLy8g5Zyo6L+Z6YeM5omn6KGM5oKo55qE5pON5L2cXFxuICAgICAgICAgICAgICAgIHRoaXNbcHJvcGVydHldID0gdmFsdWU7XFxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlYnVnKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhwcm9wZXJ0eSArIFxcXCI6XFxcIiArIHZhbHVlKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGV2YWxKU1J1bGUoaXRlbSxcXG4gICAgICAgICAgICBqc1J1bGUpIHtcXG4gICAgICAgICAgICBsZXQgcnVsZSA9IGpzUnVsZS5yZXBsYWNlKFxcXCJAanM6XFxcIixcXG4gICAgICAgICAgICAgICAgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIHJ1bGUgPSBydWxlLnRyaW0oKTtcXG4gICAgICAgICAgICAvL2xvZygkLnN0cmluZ2lmeShydWxlKSlcXG4gICAgICAgICAgICBsZXQgaW5wdXQgPSBpdGVtO1xcbiAgICAgICAgICAgIGlmIChydWxlLnN0YXJ0c1dpdGgoXFxcIihcXFwiKSkge1xcbiAgICAgICAgICAgICAgICBldmFsKFxcXCJyZXN1bHQgPSBcXFwiICsgcnVsZSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgLyoqXFxuICAgICAgICAgICAgICAgICAqIOi/mOWOn+aIkCAkLnRvU3RyaW5nKC4uLikg55qE5pyA57uI57uT5p6c77yM6L6+5Yiw5pyA57uI5aSE55CG5pa55byP6Lef5LiK6Z2i55qEIGlmIOS4gOiHtOeahOebrueahFxcbiAgICAgICAgICAgICAgICAgKi9cXG4gICAgICAgICAgICAgICAgZXZhbChcXFwicmVzdWx0ID0gXFxcIiArIFxcXCIoKCkgPT4ge1xcXCIgKyBydWxlICsgXFxcIn0pKClcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdCB8fCBcXFwiXFxcIjtcXG4gICAgICAgIH0sXFxuICAgICAgICBnZXRUaXRsZShzcmMsIGNhdGVnb3J5KSB7XFxuICAgICAgICAgICAgbGV0IHRpdGxlID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgbGV0IHRpdGxlUnVsZSA9IGNhdGVnb3J5IHx8IFxcXCJhJiZUZXh0XFxcIjtcXG4gICAgICAgICAgICBpZiAodGl0bGVSdWxlLnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgICAgICB0aXRsZSA9IHRoaXMuZXZhbEpTUnVsZShzcmMsIHRpdGxlUnVsZSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSBwYXJzZURvbUZvckh0bWwoc3JjLCB0aXRsZVJ1bGUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gdGl0bGUgfHwgXFxcIlxcXCI7XFxuICAgICAgICB9LFxcbiAgICAgICAgZ2V0VXJsKHNyYywgY2F0ZWdvcnkpIHtcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgbGV0IHVybFJ1bGUgPSBjYXRlZ29yeS7pk77mjqUgfHwgXFxcImEmJmhyZWZcXFwiO1xcbiAgICAgICAgICAgIGlmICh1cmxSdWxlLnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgICAgICB1cmwgPSB0aGlzLmV2YWxKU1J1bGUoc3JjLCB1cmxSdWxlKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB1cmwgPSBwZChzcmMsIHVybFJ1bGUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAodHlwZW9mIGNhdGVnb3J5LumTvuaOpeWkhOeQhiA9PSBcXFwiZnVuY3Rpb25cXFwiKSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IGNhdGVnb3J5LumTvuaOpeWkhOeQhih1cmwpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gdXJsIHx8IFxcXCJcXFwiO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGlzTnVsbChwYXJhbSkge1xcbiAgICAgICAgICAgIGlmIChwYXJhbSA9PSBudWxsKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XFxuICAgICAgICB9LFxcbiAgICAgICAgaXNCb29sZWFuKHZhcmlhYmxlKSB7XFxuICAgICAgICAgICAgaWYgKHR5cGVvZiB2YXJpYWJsZSAhPT0gXFxcImJvb2xlYW5cXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi5byA5ZCv5oqY5Y+g6K+35Lyg5YWl5biD5bCU5YC8XFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSxcXG4gICAgICAgIOa4hemZpChsaXN0KSB7XFxuICAgICAgICAgICAgaWYgKHRoaXMuaXNOdWxsKGxpc3QpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAobGlzdC5jb25zdHJ1Y3RvciA9PSBTdHJpbmcpIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLmuIXpmaTmiqXplJk66K+35Lyg5YiX6KGoXFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHRoaXMuY2xlYXJzID0gbGlzdDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDlhajmuIUobGlzdCkge1xcbiAgICAgICAgICAgIGlmICh0aGlzLmlzTnVsbChsaXN0KSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdmFyIGMgPSB0aGlzLmNsZWFyYWxsO1xcbiAgICAgICAgICAgIGxpc3QgPSBjLmNvbmNhdChsaXN0KTtcXG4gICAgICAgICAgICB0aGlzLmNsZWFyYWxsID0gbGlzdDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDmupDnoIEoaW5wdXQpIHtcXG4gICAgICAgICAgICB0aGlzLmh0bWwgPSBpbnB1dDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDnlYzpnaIoaW5wdXQpIHtcXG4gICAgICAgICAgICB0aGlzLmxheW91dCA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOmhteeggShpbnB1dCkge1xcbiAgICAgICAgICAgIHRoaXMucGFnZSA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOeKtuaAgShpbnB1dCkge1xcbiAgICAgICAgICAgIHRoaXMuc3RhdGUgPSBpbnB1dDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDlvIDlkK/mkJzntKIoaW5wdXQpIHtcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIGlucHV0ID0gdHJ1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGhpcy5zZWFyY2ggPSBpbnB1dDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDlvIDlkK/mipjlj6AoaW5wdXQpIHtcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIGlucHV0ID0gdHJ1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGhpcy5pc0Jvb2xlYW4oaW5wdXQpO1xcbiAgICAgICAgICAgIHRoaXMub3BlbiA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIHNldFRpdGxlKGssIGksIHQpIHtcXG4gICAgICAgICAgICByZXR1cm4gayA9PSBpID8gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyB0LmZvbnRjb2xvcih0aGlzLuWIhuexu+minOiJsikgOiB0O1xcbiAgICAgICAgfSxcXG4gICAgICAgIGFjdGlvbihvYmopIHtcXG4gICAgICAgICAgICByZXR1cm4gW3tcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmuIXpmaTnirbmgIFcXFwiLFxcbiAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygob2JqKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsb2cob2JqKTtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIob2JqLnN0YXRlKTtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignY2F0ZV9idXR0b24nKTtcXG4gICAgICAgICAgICAgICAgICAgIG9iai5hbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIG9iai5jbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgfSwgb2JqKSxcXG4gICAgICAgICAgICB9LCBdO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGNoZWNrUGFyYW0oKSB7XFxuICAgICAgICAgICAgdmFyIG9iaiA9IHt9O1xcbiAgICAgICAgICAgIGlmICh0aGlzLnBhZ2UgPT0gMCAmJiB0eXBlb2YgcGFnZSA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuivt+S8oOWFpemhteeggVxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcGFnZSA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLpobXnoIFcXFwiXSA9IHRoaXMucGFnZTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIG9ialtcXFwi6aG156CBXFxcIl0gPSBwYWdlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLmh0bWwgPT0gXFxcImVtcHR5XFxcIiAmJiB0eXBlb2YgaHRtbCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuivt+S8oOWFpea6kOeggVxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgaHRtbCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLmupDnoIFcXFwiXSA9IHRoaXMuaHRtbDtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIG9ialtcXFwi5rqQ56CBXFxcIl0gPSBodG1sO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLmxheW91dCA9PSBcXFwidW5kZWZpbmVkXFxcIiAmJiB0eXBlb2YgZCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuivt+S8oOWFpeeVjOmdolxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLnlYzpnaJcXFwiXSA9IHRoaXMubGF5b3V0O1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLnlYzpnaJcXFwiXSA9IGQ7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIG9iajtcXG4gICAgICAgIH0sXFxuICAgICAgICDliJvlu7rliqjmgIHliIbnsbsocnVsZU9iaikge1xcbiAgICAgICAgICAgIGxldCBpdGVtcyA9IFtdO1xcbiAgICAgICAgICAgIGxldCBjYXRlcyA9IFtdO1xcbiAgICAgICAgICAgIGlmIChydWxlT2JqID09IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICBydWxlT2JqID0gW107XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIC8v5Yid5aeL5YyW5Y+Y6YeP5byA5aeLXFxuICAgICAgICAgICAgY29uc3QgcGFyYW0gPSB0aGlzLmNoZWNrUGFyYW0oKTtcXG4gICAgICAgICAgICBjb25zdCBwYWdlID0gcGFyYW0u6aG156CBO1xcbiAgICAgICAgICAgIGNvbnN0IGh0bWwgPSBwYXJhbS7mupDnoIE7XFxuICAgICAgICAgICAgY29uc3QgZCA9IHBhcmFtLueVjOmdojtcXG4gICAgICAgICAgICBjb25zdCDnirbmgIEgPSB0aGlzLnN0YXRlO1xcbiAgICAgICAgICAgIGNvbnN0IHNlYXJjaCA9IHRoaXMuc2VhcmNoO1xcbiAgICAgICAgICAgIGNvbnN0IGVtcHR5ID0gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgIGNvbnN0IOaKmOWPoOeKtuaAgSA9IHRoaXMub3BlbjtcXG4gICAgICAgICAgICB2YXIg5bGV5byAID0gdGhpcy7lsZXlvIA7XFxuICAgICAgICAgICAgdmFyIOaKmOWPoCA9IHRoaXMu5oqY5Y+gO1xcbiAgICAgICAgICAgIHZhciDlhajmuIUgPSB0aGlzLmNsZWFyYWxsO1xcbiAgICAgICAgICAgIHZhciDmuIXpmaQgPSB0aGlzLmNsZWFycztcXG4gICAgICAgICAgICAvL+WIneWni+WMluWPmOmHj+e7k+adn1xcbiAgICAgICAgICAgIGxldCBpbml0X2NhdGUgPSBuZXcgQXJyYXkoMjApLmZpbGwoXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICBjb25zdCBmb2xkID0gZ2V0TXlWYXIoTVlfUlVMRS5ncm91cCwgXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICBjb25zdCBjYXRlX3RlbXAgPSBKU09OLnBhcnNlKFxcbiAgICAgICAgICAgICAgICBnZXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkoaW5pdF9jYXRlKSlcXG4gICAgICAgICAgICApO1xcbiAgICAgICAgICAgIGlmIChzZWFyY2ggJiYgcGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiJ2hpa2VyOi8vc2VhcmNoP3J1bGU9XFxcIiArIE1ZX1JVTEUudGl0bGUgKyBcXFwiJnM9JytpbnB1dFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFwi5pCc57Si5YWz6ZSu6K+NXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGdldE15VmFyKFxcXCJrZXl3b3JkXFxcIiwgXFxcIlxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2hhbmdlOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImtleXdvcmRcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgY29uc3QgY2F0ZWdvcmllcyA9IFtdO1xcbiAgICAgICAgICAgIHJ1bGVPYmouZm9yRWFjaCgoeCkgPT4ge1xcbiAgICAgICAgICAgICAgICB2YXIgbGlzdCA9IFtdO1xcbiAgICAgICAgICAgICAgICAvL2xvZyh4KVxcbiAgICAgICAgICAgICAgICBpZiAoeC5qc29uICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICAgICAgeC5qc29uLm1hcChrID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXRlZ29yaWVzLnB1c2goSlNPTi5zdHJpbmdpZnkoaykucmVwbGFjZSgvXlxcXFxbfFxcXFxdJC9nLCAnJykpXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgLy9jYXRlZ29yaWVzLnB1c2goeC5qc29uKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh4LuS4gOe6p+WumuS9jSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHgu5LiA57qn5a6a5L2NLnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3QgPSB0aGlzLmV2YWxKU1J1bGUoaHRtbCwgeC7kuIDnuqflrprkvY0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gcGRmYShodG1sLCB4LuS4gOe6p+WumuS9jSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKHgu5aSn57G75a6a5L2NKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoeC7lpKfnsbvlrprkvY0uc3RhcnRzV2l0aChcXFwiQGpzOlxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuWkp+exu+WumuS9jSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3QgPSBbcGRmYShodG1sLCB4LuWkp+exu+WumuS9jSkuam9pbignXFxcXG4nKV07XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgLy8tLemineWkluWkhOeQhi0tXFxuICAgICAgICAgICAgICAgIGlmICgoJ+WinuWKoCcgaW4geCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh4LuWinuWKoC5jb25zdHJ1Y3RvciA9PSBTdHJpbmcpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB4LuWinuWKoCA9IGV2YWwoeC7lop7liqApO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgc2xpc3QgPSB4LuWinuWKoC5jb25jYXQoc2xpc3QpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICgoJ+ihpeWFhScgaW4geCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh4LuihpeWFhS5jb25zdHJ1Y3RvciA9PSBTdHJpbmcpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB4LuihpeWFhSA9IGV2YWwoeC7ooaXlhYUpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgc2xpc3QgPSBzbGlzdC5jb25jYXQoeC7ooaXlhYUpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vLS3pop3lpJblpITnkIYtLVxcbiAgICAgICAgICAgICAgICB2YXIg5LiA57qnID0gbGlzdC5tYXAoKHMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBzbGlzdCA9IFtdO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEoXFxcIuWwj+exu1xcXCIgaW4geCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB4LuWwj+exuyA9IFxcXCJib2R5JiZhOm5vdCg6bWF0Y2hlcyjpppbpobUpKTpub3QoYTpub3QoW2hyZWZdKSlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHgu5bCP57G7LnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNsaXN0ID0gdGhpcy5ldmFsSlNSdWxlKHMsIHgu5bCP57G7KTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2xpc3QgPSBwZGZhKHMsIHgu5bCP57G7KTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHZhciDlrprkvY0gPSBzbGlzdC5tYXAoKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLmdldFRpdGxlKGl0ZW0sIHgu5qCH6aKYKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdXJsID0gdGhpcy5nZXRVcmwoaXRlbSwgeCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG9iaiA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHVybFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KG9iaik7XFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiDlrprkvY07XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAvL2xvZyjkuIDnuqcpXFxuICAgICAgICAgICAgICAgIC8vbG9nKOS4gOe6py5sZW5ndGgpXFxuICAgICAgICAgICAgICAgIGlmICjkuIDnuqcubGVuZ3RoID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaCjkuIDnuqcuam9pbihcXFwiXFxcXG5cXFwiKSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICDkuIDnuqcuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaChpdGVtLmpvaW4oXFxcIixcXFwiKSk7XFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAvL2xvZyhjYXRlZ29yaWVzKVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGlmICjmipjlj6DnirbmgIEpIHtcXG4gICAgICAgICAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGZvbGQgPT09IFxcXCIxXFxcIiA/IOaKmOWPoCA6IOWxleW8gCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0aXRsZSwgZm9sZCwgdSwgYWxsLCBleHBzKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZm9sZCA9IGdldE15VmFyKE1ZX1JVTEUuZ3JvdXAsIGZvbGQpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFvlsZXlvIAsIOaKmOWPoF0gPSBleHBzO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZvbGQgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjeCA9IGZpbmRJdGVtc0J5Q2xzKHRpdGxlICsgJ2NhdGVfYnV0dG9uJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2NhdGVfYnV0dG9uJywgY3gpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyh0aXRsZSArICdjYXRlX2J1dHRvbicpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY3ggPSBzdG9yYWdlMC5nZXRNeVZhcignY2F0ZV9idXR0b24nLCBbXSkubWFwKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4Wydjb2xfdHlwZSddID0geFsnY29sX3R5cGUnXSA/IHhbJ2NvbF90eXBlJ10gOiB4Wyd0eXBlJ107XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcih0aXRsZSArICdjYXRlX2xpbmUnLCBjeClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qYWxsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOyovXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHRpdGxlICsgJ2NhdGVfZXhwJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBmb2xkID09IDEgPyDlsZXlvIAgOiDmipjlj6AsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoTVlfUlVMRS5ncm91cCwgZm9sZCA9PT0gXFxcIjFcXFwiID8gXFxcIjBcXFwiIDogXFxcIjFcXFwiKTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgTVlfUlVMRS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9sZCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAg54q25oCBLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICDlhajmuIUsIFvlsZXlvIAsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDmipjlj6BcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICApLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9leHAnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IHRoaXMuYWN0aW9uKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGw6IOWFqOa4hSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsOiDmuIXpmaQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMuZm9yRWFjaCgoY2F0ZWdvcnksIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhjYXRlZ29yeSlcXG4gICAgICAgICAgICAgICAgICAgIGxldCBzdWJfY2F0ZWdvcmllcyA9IFtdO1xcbiAgICAgICAgICAgICAgICAgICAgLyppZiAo5bCP57G75a6a5L2NLmluY2x1ZGVzKFxcXCI7XFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMgPSBwZGZhKGNhdGVnb3J5LCDlsI/nsbvlrprkvY0uc3BsaXQoXFxcIjtcXFwiKVswXSk7XFxuICAgICAgICAgICAgICAgICAgICAgIGlmIChzdWJfY2F0ZWdvcmllcy5sZW5ndGggPT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NLnNwbGl0KFxcXCI7XFxcIilbMV0pO1xcbiAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeyovXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhpbmRleClcXG4gICAgICAgICAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gSlNPTi5wYXJzZShgWyR7Y2F0ZWdvcnl9XWApO1xcbiAgICAgICAgICAgICAgICAgICAgLy9sb2coc3ViX2NhdGVnb3JpZXMpXFxuICAgICAgICAgICAgICAgICAgICAvLyBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jSk7XFxuICAgICAgICAgICAgICAgICAgICAvL31cXG4gICAgICAgICAgICAgICAgICAgIGlmIChpbmRleCA9PT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8v5aSn57G7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbGV0IHRpdGxlID0gcGRmaChpdGVtLCBf5aSn57G75qCH6aKYKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gaXRlbS50aXRsZTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiDmjpLpmaQgIT0gXFxcInVuZGVmaW5lZFxcXCIgJiYg5o6S6ZmkICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3UmVnRXhwKOaOkumZpCwgXFxcImdcXFwiKSwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBqc29uID0gJydcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGtleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhcnM6IOa4hemZpCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb246IGpzb24sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbGV0IHVybCA9IHBkKGl0ZW0sIF/lpKfnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qaWYgKOWkp+exu+WkhOeQhikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IOS4gOe6p+WIhuexu+WkhOeQhih1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2codXJsKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKFxcXCJoaWtlcjovL2VtcHR5I25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBuZXdfY2F0ZSA9IFtdO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdjYXRlX2J1dHRvbicpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wLmZvckVhY2goKGNhdGUsIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdfY2F0ZS5wdXNoKGluZGV4ID09PSAwID8gcGFyYW1zLmtleS50b1N0cmluZygpIDogXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJoZWFkLmNhdGVcXFwiLCBKU09OLnN0cmluZ2lmeShuZXdfY2F0ZSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImR0X1xcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcyksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBNWV9SVUxFLnRpdGxlICsgJ2NhdGVfbGluZScsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy/lsI/nsbtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGV4dHJhcG9zID0gZmFsc2U7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qaWYgKGl0ZW0uaW5jbHVkZXMoJ3R5cGU9XFxcIkBleHRyYVxcXCInKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhcG9zID0gdHJ1ZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xvZygn6ZmE5Yqg5a6a5L2NJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSovXFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChleHRyYXBvcykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gcGRmaChpdGVtLCBcXFwiYSYmVGV4dFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiDmjpLpmaQgIT0gXFxcInVuZGVmaW5lZFxcXCIgJiYg5o6S6ZmkICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIFxcXCJhJiZzdGF0ZVxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIFxcXCJhJiZ2YWx1ZVxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdmFyIHRpdGxlID0gcGRmaChpdGVtLCDliIbnsbvmoIfpopgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gaXRlbS50aXRsZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOaOkumZpCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUucmVwbGFjZShuZXcgUmVnRXhwKOaOkumZpCwgXFxcImdcXFwiKSwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGpzb24gPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qc3dpdGNoICh0cnVlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ug5YiG57G76ZO+5o6lLmluY2x1ZGVzKFxcXCJAQEBcXFwiKTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAQFxcXCIpWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBAXFxcIilbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ug5YiG57G76ZO+5o6lLmluY2x1ZGVzKFxcXCJAQFxcXCIpOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAXFxcIilbMF0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAXFxcIilbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGpzb24gPSBwZChpdGVtLCDliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSovXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKnZhciBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEBAJyk/e1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVswXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOuWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVswXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTsqL1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBpbmRleCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb246IGpzb24sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVzLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eVxcXCIgKyBcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2NhdGVfYnV0dG9uJyk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXBbcGFyYW1zLmluZGV4XSA9IHBhcmFtcy5rZXkudG9TdHJpbmcoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIsIEpTT04uc3RyaW5naWZ5KHBhcmFtcy5jYXRlX3RlbXApKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhcmFtcy5qc29uLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJkdF9cXFwiICsgcGFyYW1zLmpzb24udHlwZSwgcGFyYW1zLmpzb24udmFsdWUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcyksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9idXR0b24nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXRlcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9idXR0b24nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoZm9sZCA9PT0gXFxcIjFcXFwiIHx8IOaKmOWPoOeKtuaAgSA9PSBmYWxzZSkge1xcbiAgICAgICAgICAgICAgICBpdGVtcyA9IGl0ZW1zLmNvbmNhdChjYXRlcyk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChmb2xkID09PSBcXFwiMFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2NhdGVfYnV0dG9uJywgY2F0ZXMpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0eXBlb2Ygc2V0UHJlUmVzdWx0ICE9ICd1bmRlZmluZWQnKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW1zID0gZC5jb25jYXQoaXRlbXMpO1xcbiAgICAgICAgICAgICAgICAvL+a4heepuue7p+aJv+aVsOe7hFxcbiAgICAgICAgICAgICAgICBkLmxlbmd0aCA9IDA7XFxuICAgICAgICAgICAgICAgIHNldFByZVJlc3VsdChpdGVtcyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaXRlbXMuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaChpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LFxcbiAgICB9O1xcbiAgICBvYmou6aKE6K6+KG9wdGlvbnMpO1xcbiAgICByZXR1cm4gb2JqO1xcbn1cXG5cXG52YXIg54q25oCBID1cXG4gICAgdHlwZW9mIOeKtuaAgeagh+iusCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDnirbmgIHmoIforrAgIT0gXFxcIlxcXCIgPyDnirbmgIHmoIforrAgOiBNWV9SVUxFLnVybDtcXG5cXG5sZXQgZHRfZGVidWcgPSBmYWxzZTtcXG5cXG5hZGRMaXN0ZW5lcihcXG4g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cXG4gICAgICAgICAgICBocmVmID0gcGQoaXRlbSwgcnVsZS51cmwpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaHJlZiA9IHJ1bGUuaW10ID8gaHJlZiArIFxcXCIjaW1tZXJzaXZlVGhlbWUjXFxcIiA6IGhyZWY7XFxuICAgICAgICByZXR1cm4gaHJlZjtcXG4gICAgfSxcXG4gICAgc2V0Q29udGVudDogZnVuY3Rpb24oaXRlbSwgaW5wdXQpIHtcXG4gICAgICAgIGxldCBvdXRwdXQgPSBcXFwiXFxcIjtcXG4gICAgICAgIGlmIChpbnB1dCA9PSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICByZXR1cm4gb3V0cHV0O1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGlucHV0LnN0YXJ0c1dpdGgoXFxcInBkXFxcIikpIHtcXG4gICAgICAgICAgICBvdXRwdXQgPSBldmFsKGlucHV0KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgb3V0cHV0ID0gcGRmaChpdGVtLCBpbnB1dCk7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gb3V0cHV0O1xcbiAgICB9LFxcbiAgICByZWZyZXNoOiBmdW5jdGlvbigpIHtcXG4gICAgICAgIGFkZExpc3RlbmVyKFxcbiAgICAgICAgICAgIFxcXCJvblJlZnJlc2hcXFwiLFxcbiAgICAgICAgICAgICQudG9TdHJpbmcoKHUpID0+IHtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwieWlsaXN0XFxcIik7XFxuICAgICAgICAgICAgICAgIC8vdmFyIHAgPSBzdG9yYWdlMC5nZXRNeVZhcignc3BhZ2UnLCAnJyk7XFxuICAgICAgICAgICAgICAgIC8vcHV0TXlWYXIodSwgcCk7XFxuICAgICAgICAgICAgfSwg54q25oCBKVxcbiAgICAgICAgKTtcXG4gICAgfSxcXG4gICAgZ2V0Qm9vbGVhblZhbHVlOiBmdW5jdGlvbih2YWx1ZSwgZGVmYXVs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XJsfWBcXG4gICAgICAgICk7XFxuICAgICAgICBsb2coJy0tLS0tLS0tLS0nICsgKGkgKyAxKSArICc66LCD6K+V57uT5p2fLS0tLS0tLS0tLScpO1xcbiAgICB9LFxcbiAgICBqc29uTGlzdDogZnVuY3Rpb24oYXJyLCBqc29uLCBydWxlKSB7XFxuICAgICAgICBpZiAoanNvbi5jb25zdHJ1Y3RvciAhPSBPYmplY3QpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBqc29uID0gSlNPTi5wYXJzZShqc29uKTtcXG4gICAgICAgICAgICB9IGNhdGNoIHt9XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoanNvbltydWxlLmxpc3RdID09IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgIGFyci5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuaXoOWGheWuuTwvc21hbGw+PC9mb250PicsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge30sXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgcmV0dXJuO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIGRlYnVnID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5kZWJ1ZywgZmFsc2UpO1xcbiAgICAgICAgdmFyIGVtcHR5ID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5lbXB0eSk7XFxuICAgICAgICBpZiAoZGVidWcpIHtcXG4gICAgICAgICAgICBsb2coJ+WumuS9jeWIl+ihqDonICsgcnVsZS5saXN0KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGpzb25bcnVsZS5saXN0XS5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxuICAgICAgICAgICAgdmFyIHRpdGxlID0gZXZhbChydWxlLnRpdGxlKTtcXG4gICAgICAgICAgICB2YXIgZGVzYyA9IGV2YWwocnVsZS5kZXNjKTtcXG4gICAgICAgICAgICB2YXIgY29udGVudCA9IGV2YWwocnVsZS5jb250ZW50KTtcXG4gICAgICAgICAgICB2YXIgaW1nID0gZXZhbChydWxlLmltZykgKyBydWxlLnJlZjtcXG4gICAgICAgICAgICB2YXIgaHJlZiA9IGV2YWwocnVsZS51cmwpO1xcbiAgICAgICAgICAgIHZhciB1cmwgPSBydWxlLmltdCA/IGhyZWYgKyBcXFwiI2ltbWVyc2l2ZVRoZW1lI1xcXCIgOiBocmVmO1xcbiAgICAgICAgICAgIHZhciBsYXp5ID0gcnVsZS5sYXp5ID8gcnVsZS5sYXp5IDogXFxcIlxcXCI7XFxuXFxuICAgICAgICAgICAgdmFyIGRkID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IGltZyxcXG4gICAgICAgICAgICAgICAgdXJsOiAoZW1wdHkgPyBcXFwiaGlrZXI6Ly9lbXB0eSMjXFxcIiA6ICcnKSArIHVybCxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHJ1bGUuY29sX3R5cGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICB9O1xcblxcbiAgICAgICAgICAgIGlmIChkZWJ1Zykge1xcbiAgICAgICAgICAgICAgICB2YXIgcnggPSB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2MsXFxuICAgICAgICAgICAgICAgICAgICBpbWcsXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgIHRoaXMuZGVidWdsb2coaSwgaXRlbSwgcnVsZSwgcngpO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBpZiAobGF6eSAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICBkZFtcXFwidXJsXFxcIl0gPSBocmVmICsgbGF6eTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYXJyLnB1c2goZGQpO1xcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIHJ1bGVMaXN0OiBmdW5jdGlvbihhcnIsIGh0bWwsIHJ1bGUpIHtcXG4gICAgICAgIHZhciBsaXN0ID0gcGRmYShodG1sLFxcbiAgICAgICAgICAgIHJ1bGUubGlzdCk7XFxuICAgICAgICB2YXIgZGVidWcgPSB0aGlzLmdldEJvb2xlYW5WYWx1ZShydWxlLmRlYnVnLFxcbiAgICAgICAgICAgIGZhbHNlKTtcXG4gICAgICAgIHZhciBlbXB0eSA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZW1wdHkpO1xcbiAgICAgICAgaWYgKGRlYnVnKSB7XFxuICAgICAgICAgICAgbG9nKCflrprkvY3liJfooag6JyArIHJ1bGUubGlzdCk7XFxuICAgICAgICB9XFxuICAgICAgICBsaXN0LmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS50aXRsZSk7XFxuICAgICAgICAgICAgdmFyIGRlc2MgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS5kZXNjKTtcXG4gICAgICAgICAgICB2YXIgaW1nID0gdGhpcy5pbWdIYW5kbGUoaXRlbSwgcnVsZSk7XFxuICAgICAgICAgICAgdmFyIHVybCA9IHRoaXMudXJsSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcbiAgICAgICAgICAgIHZhciBjb250ZW50ID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuY29udGVudCk7XFxuXFxuICAgICAgICAgICAgaWYgKGRlYnVnKSB7XFxuICAgICAgICAgICAgICAgIHZhciByeCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYyxcXG4gICAgICAgICAgICAgICAgICAgIGltZyxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICB1cmxcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgdGhpcy5kZWJ1Z2xvZyhpLCBpdGVtLCBydWxlLCByeCk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIHZhciBsYXp5ID0gcnVsZS5sYXp5ID8gcnVsZS5sYXp5IDogXFxcIlxcXCI7XFxuICAgICAgICAgICAgdmFyIGRkID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IGltZyxcXG4gICAgICAgICAgICAgICAgdXJsOiAoZW1wdHkgPyBcXFwiaGlrZXI6Ly9lbXB0eSMjXFxcIiA6ICcnKSArIHVybCxcXG4gICAgICAgICAgICAgICAgY29udGVudDogY29udGVudCxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHJ1bGUuY29sX3R5cGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGlmIChsYXp5ICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGRkW1xcXCJ1cmxcXF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W51bVxcXCIpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKFxcXCJwYWdlbGluZVxcXCIpO1xcbiAgICAgICAgICAgICAgICB2YXIgaWQgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgdmFyIGNscyA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS50aXRsZSk7XFxuICAgICAgICAgICAgICAgIHZhciBkZXNjID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuZGVzYyk7XFxuICAgICAgICAgICAgICAgIHZhciBpbWcgPSB0aGlzLmltZ0hhbmRsZShpdGVtLCBydWxlKTtcXG4gICAgICAgICAgICAgICAgdmFyIHVybCA9IHRoaXMudXJsSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICB2YXIgY29udGVudCA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmNvbnRlbnQpO1xcblxcbiAgICAgICAgICAgICAgICBpZiAoZGVidWcpIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciByeCA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXNjLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybFxcbiAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVidWdsb2coaSwgaXRlbSwgcnVsZSwgcngpO1xcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWQgPSBcXFwibGFzdGlkX1xcXCIgKyBwYWdlO1xcbiAgICAgICAgICAgICAgICAgICAgY2xzID0gXFxcImxhc3RtYXJrXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGltZy5yZXBsYWNlKC8uKj91cmxcXFxcPSguKj8pLyxcXFwiJDFcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogKGVtcHR5ID8gXFxcImhpa2VyOi8vZW1wdHkjI1xcXCIgOiAnJykgKyB1cmwgKyAnQHJ1bGU9anM6JC5yZXF1aXJlKFxcXCJlalxcXCIpJyxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaW1nOiBpbWcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGlkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogY2xzLFxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSAmJiBzaG93KSB7XFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbGluZVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzbWFsbD7liqDovb3kuK0uLi48L3NtYWxsPlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogXFxcInBhZ2VudW1cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKFxcXCJwYWdlbnVtXFxcIiwge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXCJncmV5XFxcIj48c21hbGw+5Yiw5bqV5LqGPC9zbWFsbD48L2ZvbnQ+JyxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogXFxcImxhc3RcXFwiLFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGxpc3QubGVuZ3RoID09IDAgJiYgcGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIixcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXCJncmV5XFxcIj48c21hbGw+5peg5YaF5a65PC9zbWFsbD48L2ZvbnQ+JyxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7fSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmICh0aGlzLm5leHRQYWdlKCkpIHtcXG4gICAgICAgICAgICAvL2xvZygndCcpO1xcbiAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCd5aV9pc25leHQnLCAndCcpO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAvL2xvZygnZicpO1xcbiAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCd5aV9pc25leHQnLCAnZicpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGF1dG8pIHtcXG4gICAgICAgICAgICAvL2NyZWF0ZU5leHRQYWdlKCk7XFxuICAgICAgICAgICAgYXV0b1BhZ2UoKTtcXG4gICAgICAgIH1cXG4gICAgfSxcXG59O1xcblxcbnZhciBleHRNZXRob2QgPSB7XFxuICAgIFRvUGFyYW1zOiBmdW5jdGlvbigpIHtcXG4gICAgICAgIHZhciBqc29uID0gYXJndW1lbnRzWzBdO1xcbiAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGpzb24pXFxuICAgICAgICAgICAgLm1hcCgoa2V5KSA9PiBrZXkgKyBcXFwiPVxcXCIgKyBqc29uW2tleV0pXFxuICAgICAgICAgICAgLmpvaW4oXFxcIiZcXFwiKTtcXG4gICAgfSxcXG4gICAg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AgICAgICAgcmV0dXJuIGRpY3Q7XFxuICAgIH0sXFxuICAgIGlzRXF1YWw6IGZ1bmN0aW9uKHgsIHkpIHtcXG4gICAgICAgIGNvbnN0IG9rID0gT2JqZWN0LmtleXMsXFxuICAgICAgICAgICAgdHggPSB0eXBlb2YgeCxcXG4gICAgICAgICAgICB0eSA9IHR5cGVvZiB5O1xcbiAgICAgICAgcmV0dXJuIHggJiYgeSAmJiB0eCA9PT0gXFxcIm9iamVjdFxcXCIgJiYgdHggPT09IHR5ID9cXG4gICAgICAgICAgICBvayh4KS5sZW5ndGggPT09IG9rKHkpLmxlbmd0aCAmJlxcbiAgICAgICAgICAgIG9rKHgpLmV2ZXJ5KChrZXkpID0+IHRoaXMuaXNFcXVhbCh4W2tleV0sIHlba2V5XSkpIDogeCA9PT0geTtcXG4gICAgfSxcXG4gICAgZmluZERpZmZlcmVudEluZGV4OiBmdW5jdGlvbihzdHIxLCBzdHIyKSB7XFxuICAgICAgICBjb25zdCBkaWZmQ2hhcnMgPSBbXTtcXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyMi5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgIGlmIChzdHIxW2ldICE9PSBzdHIyW2ldKSB7XFxuICAgICAgICAgICAgICAgIGRpZmZDaGFycy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIGluZGV4OiBpLFxcbiAgICAgICAgICAgICAgICAgICAgczE6IHN0cjFbaV0sXFxuICAgICAgICAgICAgICAgICAgICBzMjogc3RyMltpXSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIGRpZmZDaGFycztcXG4gICAgfSxcXG4gICAgcmVwbGFjZUNoYXJBdDogZnVuY3Rpb24oc3RyLCBpbmRleCwgcmVwbGFjZW1lbnQpIHtcXG4gICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0gc3RyLmxlbmd0aCkge1xcbiAgICAgICAgICAgIHJldHVybiBzdHI7XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZyhpbmRleClcXG4gICAgICAgIGNvbnN0IGFyciA9IHN0ci5zcGxpdChcXFwiXFxcIik7XFxuICAgICAgICBhcnJbaW5kZXhdID0gcmVwbGFjZW1lbnQ7XFxuICAgICAgICByZXR1cm4gYXJyLmpvaW4oXFxcIlxcXCIpO1xcbiAgICB9LFxcbiAgICBnZXRPYmplY3RLZXlzRGlmZjogZnVuY3Rpb24ob2JqMSwgb2JqMikge1xcbiAgICAgICAgY29uc3QgZGlmZmVyZW50S2V5cyA9IFtdO1xcbiAgICAgICAgZm9yIChsZXQga2V5IGluIG9iajEpIHtcXG4gICAgICAgICAgICBpZiAoIW9iajIuaGFzT3duUHJvcGVydHkoa2V5KSB8fCBvYmoxW2tleV0gIT09IG9iajJba2V5XSkge1xcbiAgICAgICAgICAgICAgICBkaWZmZXJlbnRLZXlzLnB1c2goa2V5KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBmb3IgKGxldCBrZXkgaW4gb2JqMikge1xcbiAgICAgICAgICAgIGlmICghb2JqMS5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XFxuICAgICAgICAgICAgICAgIGRpZmZlcmVudEtleXMucHVzaChrZXkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBkaWZmZXJlbnRLZXlzO1xcbiAgICB9LFxcbiAgICBnZXROZXh0VXJsOiBmdW5jdGlvbihzb3VyY2UsIHRhcmdldCwgcGFyYW1zKSB7XFxuICAgICAgICB2YXIgdTEgPSB0aGlzLnVybFBhcnNlKHNvdXJjZSk7XFxuICAgICAgICB2YXIgdTIgPSB0aGlzLnVybFBhcnNlKHRhcmdldCk7XFxuICAgICAgICB2YXIgcGEgPSB1bmRlZmluZWQ7XFxuICAgICAgICBpZiAodHlwZW9mIHBhcmFtcyA9PSBcXFwib2JqZWN0XFxcIikge1xcbiAgICAgICAgICAgIHBhID0gcGFyYW1zLmhhc093blByb3BlcnR5KFxcXCLnibnlvoFcXFwiKSA/IHBhcmFtcy7nibnlvoEgOiB1bmRlZmluZWQ7XFxuICAgICAgICB9XFxuICAgICAgICB2YXIgbmV4dHVybCA9IHNvdXJjZTtcXG4gICAgICAgIHZhciBjYSA9IE9iamVjdC5rZXlzKHUyLlBhcmFtcykubGVuZ3RoID09IDAgPyBcXFwiXFxcIiA6IFxcXCI/XFxcIjtcXG4gICAgICAgIGlmIChwYSAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICB2YXIgcnMgPSBTdHJpbmcodTIuUGF0aCkucmVwbGFjZShuZXcgUmVnRXhwKHBhKSwgXFxcIiQxZnlwYWdlXFxcIik7XFxuICAgICAgICAgICAgbmV4dHVybCA9IHUyLkhvc3RzICsgcnMgKyBjYSArIHRoaXMuVG9QYXJhbXModTIuUGFyYW1zKTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgaWYgKHRoaXMuaXNFcXVhbCh1MS5QYXJhbXMsIHUyLlBhcmFtcykpIHtcXG4gICAgICAgICAgICAgICAgaWYgKGR0X2RlYnVnKSB7XFxuICAgICAgICAgICAgICAgICAgICBsb2codTEuUGF0aCk7XFxuICAgICAgICAgICAgICAgICAgICBsb2codTIuUGF0aCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIGRmID0gdGhpcy5maW5kRGlmZmVyZW50SW5kZXgoU3RyaW5nKHUxLlBhdGgpLCBTdHJpbmcodTIuUGF0aCkpO1xcbiAgICAgICAgICAgICAgICBpZiAoZHRfZGVidWcpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhkZik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKGRmLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcmUgPSBkZlswXS5pbmRleDtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBmID0gZGYuZmlsdGVyKCh4KSA9PiAvXFxcXGQrLy50ZXN0KHguczIpKTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciByZSA9IGZbMF0uaW5kZXg7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIGVxID0gdGhpcy5yZXBsYWNlQ2hhckF0KFN0cmluZyh1Mi5QYXRoKSwgcmUsIFxcXCJmeXBhZ2VcXFwiKTtcXG4gICAgICAgICAgICAgICAgbmV4dHVybCA9IHUyLkhvc3RzICsgZXEgKyBjYSArIHRoaXMuVG9QYXJhbXModTIuUGFyYW1zKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB2YXIgZXAgPSB0aGlzLmdldE9iamVjdEtleXNEaWZmKHUxLlBhcmFtcywgdTIuUGFyYW1zKVxcbiAgICAgICAgICAgICAgICBpZiAoZXAubGVuZ3RoID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIHUxLlBhcmFtc1tlcFswXV0gPSAnZnlwYWdlJ1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKGVwKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB2YXIgZXEgPSBTdHJpbmcodTEuUGF0aCkucmVwbGFjZSgvXFxcXGQrLywgXFxcImZ5cGFnZVxcXCIpO1xcbiAgICAgICAgICAgICAgICBuZXh0dXJsID0gdTEuSG9zdHMgKyBlcSArIGNhICsgdGhpcy5Ub1BhcmFtcyh1MS5QYXJhbXMpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIC8vbG9nKCduZXh0OicrbmV4dHVybClcXG4gICAgICAgIHJldHVybiBuZXh0dXJsO1xcbiAgICB9LFxcbn07XFxuXFxuZnVuY3Rpb24gZ2V0VHJ1ZWxpbm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xcIik7XFxuICAgICAgICAgICAgbmV4dCA9IFxcXCJcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKG5leHQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICB2YXIgbnh1cmwgPSBleHRNZXRob2QuZ2V0TmV4dFVybCh0cnVlX3VybCwgbmV4dCwgb2JqKTtcXG4gICAgICAgICAgICAvL2xvZyhcXFwibnh1cmw6XFxcIiArIG54dXJsKTtcXG4gICAgICAgICAgICBwdXRNeVZhcijnirbmgIEsIG54dXJsKTtcXG4gICAgICAgICAgICBwdXRNeVZhcihcXFwieWlfcGFnZXVybFxcXCIsIG54dXJsKTtcXG4gICAgICAgIH1cXG4gICAgfVxcbn1cXG5cXG5mdW5jdGlvbiBhdXRvUGFnZSgpIHtcXG4gICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgcHV0TXlWYXIoXFxcInlpX2ZpcnN0cGFnZVxcXCIsIHRydWVfdXJsKTtcXG4gICAgfVxcbiAgICB0cnkge1xcbiAgICAgICAgdmFyIG5leHQgPSBldmFsKOS4i+S4gOmhtSk7XFxuICAgICAgICAvL2xvZyhcXFwibmV4dFxcXCIpO1xcbiAgICAgICAgLy9sb2coJ25leHQ6JytuZXh0KTtcXG4gICAgfSBjYXRjaCB7XFxuICAgICAgICBsb2coXFxcIuWPr+iDveS4jeWtmOWcqOS4i+S4gOmhteaIluiAheS4i+S4gOmhteWumuS9jeaciemXrumimFxcXCIpO1xcbiAgICAgICAgbmV4dCA9IFxcXCJcXFwiO1xcbiAgICB9XFxuICAgIGlmIChuZXh0ICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICBwdXRNeVZhcijnirbmgIEsIG5leHQpO1xcbiAgICB9XFxufVwifV0iLCJpY29uIjoiaHR0cDovL3d3dy50dnliMDMuY29tL2Zhdmljb24uaWNvIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment