xiaomianao666

小程序:α

Jul 11th, 2024
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@α@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoizrEiLCJhdXRob3IiOiJ6ZXRhbHBoYSIsInVybCI6Imhpa2VyOi8vZW1wdHkjIyIsInZlcnNpb24iOjIwMjMxMTEzMDEsImNvbF90eXBlIjoibW92aWVfMyIsImNsYXNzX25hbWUiOiIiLCJ0eXBlIjoib3RoZXIiLCJjbGFzc191cmwiOiIiLCJhcmVhX25hbWUiOiIiLCJhcmVhX3VybCI6IiIsInNvcnRfbmFtZSI6IiIsInllYXJfbmFtZSI6IiIsInNvcnRfdXJsIjoiIiwieWVhcl91cmwiOiIiLCJmaW5kX3J1bGUiOiJqczpcbnZhciBkPVtdO1xuZC5wdXNoKHtcbiAgICB0aXRsZTon5bCB6KOF5LiA5Lqb5pa55rOVJyxcbiAgICBjb2xfdHlwZTondGV4dF8xJyxcbiAgICB1cmw6J2hpa2VyOi8vZW1wdHknXG59KVxuXG5cbnNldFJlc3VsdChkKSIsInNlYXJjaF91cmwiOiIiLCJncm91cCI6IuW3peWFtyIsInNlYXJjaEZpbmQiOiIiLCJkZXRhaWxfY29sX3R5cGUiOiJtb3ZpZV8xIiwiZGV0YWlsX2ZpbmRfcnVsZSI6IiIsInNkZXRhaWxfY29sX3R5cGUiOiJtb3ZpZV8xIiwic2RldGFpbF9maW5kX3J1bGUiOiIiLCJ1YSI6Im1vYmlsZSIsInByZVJ1bGUiOiIiLCJwYWdlcyI6Ilt7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5LqM57qnXCIsXCJwYXRoXCI6XCJlclwiLFwicnVsZVwiOlwianM6XFxuLyp2ZXIgMjAyMzA5MzAgMi4wXFxuICovXFxuY29uc3QgY3VzdG9tcyA9IHt9O1xcblxcbi8v6aKE6K6+XFxu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VtKCdkc2hvdycsIHtcXG4gICAgICAgICAgICB0aXRsZTogdGl0bGUucmVwbGFjZSgn5bGV5byAJywgJ+aUtui1tycpICAgICAgICAgICAgICAgICAgICAgICAgXFxuICAgICAgICAgIH0pO1xcblxcblxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShtYXJrLCAnMCcpXFxuICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rjb250ZW50Jywge1xcbiAgICAgICAgICAgIHRpdGxlOiBkdGl0bGUucmVwbGFjZSgvXFxcXD4uKj9cXFxcPC8sJz4nK3NkYysnPCcpXFxuICAgICAgICAgICAgLnJlcGxhY2UoLyhjb2xvcj1cXFwiKS4qPyhcXFwiKS8sJyQxJytjcy5oaWRlKyckMicpXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICB1cGRhdGVJdGVtKCdkc2hvdycsIHtcXG4gICAgICAgICAgICB0aXRsZTogdGl0bGUucmVwbGFjZSgn5pS26LW3JywgJ+WxleW8gCcpICAgICAgICAgICAgICAgICAgICAgICAgXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgIH0sbWFyaywgZGVzYywgc2Rlc2MsY29sb3JzKSxcXG4gICAgICBleHRyYToge1xcbiAgICAgICAgaWQ6ICdkc2hvdycsXFxuICAgICAgfVxcbiAgICB9KVxcbiAgICB2YXIgc2M9c3RvcmFnZTAuZ2V0SXRlbShtYXJrLCAnMCcpID09ICcwJyA/IHNkZXNjLmZvbnRjb2xvcihjb2xvcnMuaGlkZSkgOiBkZXNjLmZvbnRjb2xvcihjb2xvcnMuc2hvdyk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgdGl0bGU6c2MsXFxuICAgICAgY29sX3R5cGU6ICdyaWNoX3RleHQnLFxcbiAgICAgIGV4dHJhOiB7XFxuICAgICAgICBpZDogJ2Rjb250ZW50JyxcXG4g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ICAgICAgICB2YXIgbGlzdD1bXTtcXG4gICAgICAgIHN0eWxlLmZvckVhY2goKHgsIGkpID0+IHtcXG4gICAgICAgIHZhciBsZWZ0ID0gW107XFxuICAgICAgICB2YXIgcmlnaHQgPSBbXTtcXG4gICAgICAgIHZhciBzdHIgPSB0ZXh0QXJyYXlbaV07XFxuICAgICAgICBPYmplY3Qua2V5cyh4KS5mb3JFYWNoKGsgPT4ge1xcbiAgICAgICAgICAgIHN3aXRjaCAoaykge1xcbiAgICAgICAgICAgICAgICBjYXNlICdjb2xvcic6XFxuICAgICAgICAgICAgICAgICAgICBsZWZ0LnB1c2goJzxmb250IGNvbG9yPVxcXCInICsgeFtrXSArICdcXFwiPicpO1xcbiAgICAgICAgICAgICAgICAgICAgcmlnaHQucHVzaCgnPC9mb250PicpO1xcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICBsZWZ0LnB1c2goYDwke2t9PmApO1xcbiAgICAgICAgICAgICAgICAgICAgcmlnaHQucHVzaChgPC8ke2t9PmApO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgIGxpc3RbaV0gPSBsZWZ0LmpvaW4oJycpICsgc3RyICsgcmlnaHQuam9pbignJyk7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgcmV0dXJuIGxpc3Q7XFxuICAgICAgfVxcbiAgICAgIHRpdGxlcz10ZXh0QXJyYXkoZmlyc3RIYWxmLHRpdGxlcyk7XFxuICAgICAgZGVzY3M9dGV4dEFycmF5KHNlY29uZEhhbGYsZGVzY3MpO1xcbiAgICAgIFxcbiAgICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTon4oCc4oCc4oCd4oCdJyt0aXRsZXNbMF0rJ1xcXFxuJyt0aXRsZXMuc2xpY2UoMSwzKS5qb2luKCdcX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IGN1c3RvbSA9IGN1c3RvbXM7XFxuICAgIH0gZWxzZSB7XFxuICAgICAgY3VzdG9tID0gY3VzdG9tID8gY3VzdG9tIDoge31cXG4gICAgfVxcbiAgICBjdXN0b20u5q2j5bqP6aKc6ImyID0gKGN1c3RvbS7mraPluo/popzoibIgJiYgdGhpcy5pc0NvbG9yKGN1c3RvbS7mraPluo/popzoibIpKSA/IGN1c3RvbS7mraPluo/popzoibIgOiAnIzFBQUQxOSc7XFxuICAgIGN1c3RvbS7pgIbluo/popzoibIgPSAoY3VzdG9tLumAhuW6j+minOiJsiAmJiB0aGlzLmlzQ29sb3IoY3VzdG9tLumAhuW6j+minOiJsikpID8gY3VzdG9tLumAhuW6j+minOiJsiA6ICcjRkYwMDAwJztcXG4gICAgY3VzdG9tLuWbvuaghyA9IGN1c3RvbS7lm77moIcgPyBjdXN0b20u5Zu+5qCHIDogJ2h0dHBzOi8vaTIuMTAwMDI0Lnh5ei8yMDIzLzA2LzEwL2g0ejYyNy53ZWJwJztcXG4gICAgY3VzdG9tLue6v+i3r+mAieS4rSA9IGN1c3RvbS7nur/ot6/pgInkuK0gPyBjdXN0b20u57q/6Lev6YCJ5LitIDogJyMwMDhCOEInO1xcbiAgICBjdXN0b20u57q/6Lev5qC35byPID0gY3VzdG9tLue6v+i3r+agt+W8jyA/IGN1c3RvbS7nur/ot6/moLflvI8gOiAnc2Nyb2xsX2J1dHRvbic7XFxuICAgIGN1c3RvbS7liIblibLmoLflvI8gPSBjdXN0b20u5YiG5Ymy5qC35byPID8gY3VzdG9tLuWIhuWJsuagt+W8jyA6ICdibGFua19ibG9jayc7XFxuICAgIGN1c3RvbS7nroDku4vlsZXlvIAgPSBjdXN0b20u566A5LuL5bGV5byAID8gY3VzdG9tLueugOS7i+WxleW8gCA6ICdibGFjayc7XFxuICAgIGN1c3RvbS7nroDku4vmlLbotbcgPSBjdXN0b20u566A5LuL5pS26LW3ID8gY3VzdG9tLueugOS7i+aUtui1tyA6ICdncmV5JztcXG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c3RzW2ldO1xcbiAgICAgICAgaWYgKCQuZnVuYyAhPSB1bmRlZmluZWQgJiYgJC5mdW5jLmNvbnN0cnVjdG9yID09IEZ1bmN0aW9uKSB7XFxuICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywge1xcbiAgICAgICAgICAgIGNvbF90eXBlOiAncGljXzEnLFxcbiAgICAgICAgICAgIGltZzogJ2h0dHBzOi8vaW1nLm5pY2t5YW0uY29tL2ZpbGUvZmU0MWE3YTE3NDRhM2E4MTk0ZGYyLmdpZicsXFxuICAgICAgICAgICAgdXJsOiAndG9hc3Q6Ly9sb2FkaW5nJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgY2xzOiBzaHNvcnRcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgIH0pXFxuICAgICAgICAgIHhsaXN0ID0gJC5mdW5jKGksIGluZm8pO1xcbiAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCB4bGlzdCk7XFxuICAgICAgICB9XFxuICAgICAgICB2YXIgcGxheXMgPSB4bGlzdC5tYXAoeCA9PiB7XFxuICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgdGl0bGU6IHgudGl0bGUsXFxuICAgICAgICAgICAgdXJsOiB4LnVybCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogY29sLFxcbiAgICAgICAgICAgIHBpYzogcGljLFxcbiAgICAgICAgICAgIGV4dHJhOiBPYmplY3QuYXNzaWduKHt9LCBleHRyYSwge1xcbiAgICAgICAgICAgICAgaWQ6IHgudXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpLFxcbiAgICAgICAgICAgICAgY2xzOiBjbHMsXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSlcX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ICAgICAgIHZhciBwbHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFwiX2xpc3RcXFwiLCAnW10nKS5tYXAoeCA9PiB4LnRpdGxlICsgXFxcIiRcXFwiICsgeC51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxzXFxcXFNdKy9nLCAnJykpLmpvaW4oXFxcIiNcXFwiKTtcXG4gICAgICAgICAgICB2YXIgdGFicyA9IFt0YWJzW2dldE15VmFyKHZhcmksICcwJyldXTtcXG4gICAgICAgICAgfVxcbiAgICAgICAgICAvL2xvZyhwbHMpXFxuICAgICAgICAgIC8vbG9nKHRhYnMpXFxuICAgICAgICB9XFxuICAgICAgICBpZiAo6YCJ5o6oKSB7XFxuICAgICAgICAgIHZhciBwbHMgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyBcXFwiX2R1b3NlbGVjdFxcXCIsICdbXScpLm1hcCh4ID0+IHgudGl0bGUgKyBcXFwiJFxcXCIgKyB4LnVybCkuam9pbihcXFwiI1xcXCIpO1xcbiAgICAgICAgICBpZiAocGxzLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+mAieaLqeS4uuepuic7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgdmFyIHRhYnMgPSBbJ+aSreaUvuWIl+ihqCddO1xcbiAgICAgICAgfVxcblxcbiAgICAgICAgdmFyIGluZm8gPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfaW5mbycsICd7fScpO1xcbiAgICAgICAgdmFyIGRlc2MgPSBpbmZvWydkZXNjJ107XFxuICAgICAgICB2YXIg5o6o6YCBID0ge1xcbiAgICAgICAgICBcXFwibmFtZVxcXCI6IGdldFBhZ2VUaXRsZSgpLFxcbiAgICAgICAgICBcXFwiY29udGVudFxcXCI6IGRlc2MgfHwgJycsXFxuICAgICAgICAgIFxcXCJwaWNcXFwiOiBpbmZvWydpbWcnXSB8fCAnJyxcXG4gICAgICAgICA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ZW1wID0gW107XFxuXFxuICAgIGZvciAodmFyIGkgaW4gY29udHMpIHtcXG4gICAgICBpZiAocGFyc2Uu6YCJ6ZuG5YiX6KGoICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgaWYgKHBhcnNlLumAiembhuWIl+ihqCA9PSAnb2JqZWN0Jykge1xcbiAgICAgICAgICBsaXN0cy5wdXNoKGNvbnRzW2ldLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgdGl0bGU6IHgudGl0bGUsXFxuICAgICAgICAgICAgICB1cmw6IHgudXJsICsg6Kej5p6QLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgfSkpXFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICBsaXN0cy5wdXNoKHBkZmEoY29udHNbaV0sIHBhcnNlLumAiembhuWIl+ihqCkubWFwKHggPT4ge1xcbiAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICB0aXRsZTogcGRmaCh4LCDpgInpm4blkI3np7ApLFxcbiAgICAgICAgICAgICAgdXJsOiBwZCh4LCDpgInpm4bpk77mjqUpICsg6Kej5p6QLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgfSkpXFxuICAgICAgICB9XFxuICAgICAgfSBlbHNlIHtcXG4gICAgICAgIHZhciB1cmwgPSBwZChjb250c1tpXSwg6YCJ6ZuG6ZO+5o6lKTtcXG4gICAgICAgIGlmICgh6YCJ6ZuG6ZO+5o6lLmluY2x1ZGVzKCdocmVmJykpIHtcXG4gICAgICAgICAgdXJsID0gcGRmaChjb250c1tpXSwg6YCJ6ZuG6ZO+5o6lKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCB0aXRsZSA9IHBkZmgoY29udHNbaV0sIOmAiembhuWQjeensCk7XFxuICAgICAgICB0aXRsZSA9IOabv+aNouWHveaVsCAhPSAnJyA/IHRoaXMuZXZhbFJlKHRpdGxlLCDmm7/mjaLlh73mlbApIDog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dGgoJy8nKSkge1xcbiAgICAgICAgICAgICAgICB1cmwgPSBnZXRIb21lKHQpICsgdXJsO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gdXJsO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICB0eXBlOiB0eXBlLFxcbiAgICAgICAgICAgIHZhbHVlOiB2YWx1ZVxcbiAgICAgICAgfTtcXG4gICAgfSwgdHJ1ZV91cmwpXFxufSwge1xcbiAgICDkuIDnuqflrprkvY06ICcuc2l0ZS10YWJzJyxcXG4gICAg6ZO+5o6lOiAnQGpzOicgKyAkLnRvU3RyaW5nKCh0KSA9PiB7XFxuICAgICAgICB2YXIgdXJsID0gcGRmaChpbnB1dCwgJ2EmJmhyZWYnKTtcXG4gICAgICAgIGxldCB0eXBlID0gJ3RpbWUnO1xcbiAgICAgICAgbGV0IHZhbHVlID0gcGRmaChpbnB1dCwgJ2EmJmRhdGEtdHlwZScpO1xcbiAgICAgICAgaWYgKHZhbHVlID09ICcnICYmIHVybCAhPSBcXFwiamF2YXNjcmlwdDpcXFwiKSB7XFxuICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKCdqYXZhc2NyaXB0JykpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHBkKGlucHV0LCAnYSYmaHJlZicpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAodXJsLnN0YXJ0c1dpdGgoJy8nKSkge1xcbiAgICAgICAgICAgICAgICB1cmwgPSBnZXRIb21lKHQpICsgdXJsO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gdXJsO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICB0eXBlOiB0eXBlLFxcbiAgICAgICAgICAgIHZhbHVlOiB2YWx1ZVxcbiAgICAgICAgfTtcXG4gICAgfSwgdHJ1ZV91cmwpLFxcbiAgICAvL+WinuWK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KChwcm9wZXJ0eSkgPT4ge1xcbiAgICAgICAgICAgICAgICAvLyDlr7nmr4/kuKrlsZ7mgKflkI3miafooYzmk43kvZxcXG4gICAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBwYXJhbVtwcm9wZXJ0eV07IC8vIOiOt+WPluWxnuaAp+WAvFxcbiAgICAgICAgICAgICAgICAvLyDlnKjov5nph4zmiafooYzmgqjnmoTmk43kvZxcXG4gICAgICAgICAgICAgICAgdGhpc1twcm9wZXJ0eV0gPSB2YWx1ZTtcXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZGVidWcpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHByb3BlcnR5ICsgXFxcIjpcXFwiICsgdmFsdWUpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9LFxcbiAgICAgICAgZXZhbEpTUnVsZShpdGVtLFxcbiAgICAgICAgICAgIGpzUnVsZSkge1xcbiAgICAgICAgICAgIGxldCBydWxlID0ganNSdWxlLnJlcGxhY2UoXFxcIkBqczpcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiXFxcIik7XFxuICAgICAgICAgICAgcnVsZSA9IHJ1bGUudHJpbSgpO1xcbiAgICAgICAgICAgIC8vbG9nKCQuc3RyaW5naWZ5KHJ1bGUpKVxcbiAgICAgICAgICAgIGxldCBpbnB1dCA9IGl0ZW07XFxuICAgICAgICAgICAgaWYgKHJ1bGUuc3RhcnRzV2l0aChcXFwiKFxcXCIpKSB7XFxuICAgICAgICAgICAgICAgIGV2YWwoXFxcInJlc3VsdCA9IFxcXCIgKyBydWxlKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAvKipcXG4gICAgICAgICAgICAgICAgICog6L+Y5Y6f5oiQICQudG9TdHJpbmcoLi4uKSDnmoTmnIDnu4jnu5PmnpzvvIzovr7liLDmnIDnu4jlpITnkIbmlrnlvI/ot5/kuIr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iAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IHBkKHNyYywgdXJsUnVsZSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0eXBlb2YgY2F0ZWdvcnku6ZO+5o6l5aSE55CGID09IFxcXCJmdW5jdGlvblxcXCIpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gY2F0ZWdvcnku6ZO+5o6l5aSE55CGKHVybCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiB1cmwgfHwgXFxcIlxcXCI7XFxuICAgICAgICB9LFxcbiAgICAgICAgaXNOdWxsKHBhcmFtKSB7XFxuICAgICAgICAgICAgaWYgKHBhcmFtID09IG51bGwpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcXG4gICAgICAgIH0sXFxuICAgICAgICBpc0Jvb2xlYW4odmFyaWFibGUpIHtcXG4gICAgICAgICAgICBpZiAodHlwZW9mIHZhcmlhYmxlICE9PSBcXFwiYm9vbGVhblxcXCIpIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLlvIDlkK/mipjlj6Dor7fkvKDlhaXluIPlsJTlgLxcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LFxcbiAgICAgICAg5riF6ZmkKGxpc3QpIHtcXG4gICAgICAgICAgICBpZiAodGhpcy5pc051bGwobGlzdCkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChsaXN0LmNvbnN0cnVjdG9yID09IFN0cmluZykge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIua4hemZpOaKpemUmTror7fkvKDliJfooahcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGhpcy5jbGVhcnMgPSBsaXN0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOWFqOa4hShsaXN0KSB7XFxuICAgICAgICAgICAgaWYgKHRoaXMuaXNOdWxsKGxpc3QpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB2YXIgYyA9IHRoaXMuY2xlYXJhbGw7XFxuICAgICAgICAgICAgbGlzdCA9IGMuY29uY2F0KGxpc3QpO1xcbiAgICAgICAgICAgIHRoaXMuY2xlYXJhbGwgPSBsaXN0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOa6kOeggShpbnB1dCkge1xcbiAgICAgICAgICAgIHRoaXMuaHRtbCA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOeVjOmdoihpbnB1dCkge1xcbiAgICAgICAgICAgIHRoaXMubGF5b3V0ID0gaW5wdXQ7XFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICB9LFxcbiAgICAgICAg6aG156CBKGlucHV0KSB7XFxuICAgICAgICAgICAgdGhpcy5wYWdlID0gaW5wdXQ7XFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICB9LFxcbiAgICAgICAg54q25oCBKGlucHV0KSB7XFxuICAgICAgICAgICAgdGhpcy5zdGF0ZSA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOW8gOWQr+aQnOe0oihpbnB1dCkge1xcbiAgICAgICAgICAgIGlmIChpbnB1dCA9PSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICAgICAgaW5wdXQgPSB0cnVlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0aGlzLnNlYXJjaCA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOW8gOWQr+aKmOWPoChpbnB1dCkge1xcbiAgICAgICAgICAgIGlmIChpbnB1dCA9PSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICAgICAgaW5wdXQgPSB0cnVlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0aGlzLmlzQm9vbGVhbihpbnB1dCk7XFxuICAgICAgICAgICAgdGhpcy5vcGVuID0gaW5wdXQ7XFxuICAgICAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgICAgICB9LFxcbiAgICAgICAgc2V0VGl0bGUoaywgaSwgdCkge1xcbiAgICAgICAgICAgIHJldHVybiBrID09IGkgPyBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIHQuZm9udGNvbG9yKHRoaXMu5YiG57G76aKc6ImyKSA6IHQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgYWN0aW9uKG9iaikge1xcbiAgICAgICAgICAgIHJldHVybiBbe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIua4hemZpOeKtuaAgVxcXCIsXFxuICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChvYmopID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhvYmopO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihvYmouc3RhdGUpO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiaGVhZC5jYXRlXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdjYXRlX2J1dHRvbicpO1xcbiAgICAgICAgICAgICAgICAgICAgb2JqLmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgb2JqLmNsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICB9LCBvYmopLFxcbiAgICAgICAgICAgIH0sIF07XFxuICAgICAgICB9LFxcbiAgICAgICAgY2hlY2tQYXJhbSgpIHtcXG4gICAgICAgICAgICB2YXIgb2JqID0ge307XFxuICAgICAgICAgICAgaWYgKHRoaXMucGFnZSA9PSAwICYmIHR5cGVvZiBwYWdlID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6K+35Lyg5YWl6aG156CBXFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBwYWdlID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcIumhteeggVxcXCJdID0gdGhpcy5wYWdlO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLpobXnoIFcXFwiXSA9IHBhZ2U7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHRoaXMuaHRtbCA9PSBcXFwiZW1wdHlcXFwiICYmIHR5cGVvZiBodG1sID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6K+35Lyg5YWl5rqQ56CBXFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBodG1sID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcIua6kOeggVxcXCJdID0gdGhpcy5odG1sO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLmupDnoIFcXFwiXSA9IGh0bWw7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHRoaXMubGF5b3V0ID09IFxcXCJ1bmRlZmluZWRcXFwiICYmIHR5cGVvZiBkID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6K+35Lyg5YWl55WM6Z2iXFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBkID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcIueVjOmdolxcXCJdID0gdGhpcy5sYXlvdXQ7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBvYmpbXFxcIueVjOmdolxcXCJdID0gZDtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gb2JqO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOWIm+W7uuWKqOaAgeWIhuexuyhydWxlT2JqKSB7XFxuICAgICAgICAgICAgbGV0IGl0ZW1zID0gW107XFxuICAgICAgICAgICAgbGV0IGNhdGVzID0gW107XFxuICAgICAgICAgICAgaWYgKHJ1bGVPYmogPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIHJ1bGVPYmogPSBbXTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgLy/liJ3lp4vljJblj5jph4/lvIDlp4tcXG4gICAgICAgICAgICBjb25zdCBwYXJhbSA9IHRoaXMuY2hlY2tQYXJhbSgpO1xcbiAgICAgICAgICAgIGNvbnN0IHBhZ2Ug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FxuICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCInaGlrZXI6Ly9zZWFyY2g/cnVsZT1cXFwiICsgTVlfUlVMRS50aXRsZSArIFxcXCImcz0nK2lucHV0XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLmkJzntKLlhbPplK7or41cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJpbnB1dFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoXFxcImtleXdvcmRcXFwiLCBcXFwiXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgb25DaGFuZ2U6ICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwia2V5d29yZFxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBjb25zdCBjYXRlZ29yaWVzID0gW107XFxuICAgICAgICAgICAgcnVsZU9iai5mb3JFYWNoKCh4KSA9PiB7XFxuICAgICAgICAgICAgICAgIHZhciBsaXN0ID0gW107XFxuICAgICAgICAgICAgICAgIC8vbG9nKHgpXFxuICAgICAgICAgICAgICAgIGlmICh4Lmpzb24gIT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgICAgICB4Lmpzb24ubWFwKGsgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaChKU09OLnN0cmluZ2lmeShrKS5yZXBsYWNlKC9eXFxcXFt8XFxcXF0kL2csICcnKSlcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAvL2NhdGVnb3JpZXMucHVzaCh4Lmpzb24pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKHgu5LiA57qn5a6a5L2NKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoeC7kuIDnuqflrprkvY0uc3RhcnRzV2l0aChcXFwiQGpzOlxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuS4gOe6p+WumuS9jSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3QgPSBwZGZhKGh0bWwsIHgu5LiA57qn5a6a5L2NKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAoeC7lpKfnsbvlrprkvY0pIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh4LuWkp+exu+WumuS9jS5zdGFydHNXaXRoKFxcXCJAanM6XFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gdGhpcy5ldmFsSlNSdWxlKGh0bWwsIHgu5aSn57G75a6a5L2NKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGlzdCA9IFtwZGZhKGh0bWwsIHgu5aSn57G75a6a5L2NKS5qb2luKCdcXFxcbicpXTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAvLy0t6aKd5aSW5aSE55CGLS1cXG4gICAgICAgICAgICAgICAgaWYgKCgn5aKe5YqgJyBpbiB4KSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHgu5aKe5YqgLmNvbnN0cnVjdG9yID09IFN0cmluZykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHgu5aKe5YqgID0gZXZhbCh4LuWinuWKoCk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBzbGlzdCA9IHgu5aKe5YqgLmNvbmNhdChzbGlzdCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKCgn6KGl5YWFJyBpbiB4KSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHgu6KGl5YWFLmNvbnN0cnVjdG9yID09IFN0cmluZykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHgu6KGl5YWFID0gZXZhbCh4LuihpeWFhSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBzbGlzdCA9IHNsaXN0LmNvbmNhdCh4LuihpeWFhSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgLy8tLemineWkluWkhOeQhi0tXFxuICAgICAgICAgICAgICAgIHZhciDkuIDnuqcgPSBsaXN0Lm1hcCgocykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHNsaXN0ID0gW107XFxuICAgICAgICAgICAgICAgICAgICBpZiAoIShcXFwi5bCP57G7XFxcIiBpbiB4KSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHgu5bCP57G7ID0gXFxcImJvZHkmJmE6bm90KDptYXRjaGVzKOmmlumhtSkpOm5vdChhOm5vdChbaHJlZl0pKVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBpZiAoeC7lsI/nsbsuc3RhcnRzV2l0aChcXFwiQGpzOlxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2xpc3QgPSB0aGlzLmV2YWxKU1J1bGUocywgeC7lsI/nsbspO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzbGlzdCA9IHBkZmEocywgeC7lsI/nsbspO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgdmFyIOWumuS9jSA9IHNsaXN0Lm1hcCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IHRoaXMuZ2V0VGl0bGUoaXRlbSwgeC7moIfpopgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1cmwgPSB0aGlzLmdldFVybChpdGVtLCB4KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgb2JqID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdXJsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkob2JqKTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIOWumuS9jTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIC8vbG9nKOS4gOe6pylcXG4gICAgICAgICAgICAgICAgLy9sb2co5LiA57qnLmxlbmd0aClcXG4gICAgICAgICAgICAgICAgaWYgKOS4gOe6py5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKOS4gOe6py5qb2luKFxcXCJcXFxcblxcXCIpKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIOS4gOe6py5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5wdXNoKGl0ZW0uam9pbihcXFwiLFxcXCIpKTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vbG9nKGNhdGVnb3JpZXMpXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgaWYgKOaKmOWPoOeKtuaAgSkge1xcbiAgICAgICAgICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogZm9sZCA9PT0gXFxcIjFcXFwiID8g5oqY5Y+gIDog5bGV5byALFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZShcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRpdGxlLCBmb2xkLCB1LCBhbGwsIGV4cHMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoTVlfUlVMRS5ncm91cCwgZm9sZCk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgW+WxleW8gCwg5oqY5Y+gXSA9IGV4cHM7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZm9sZCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGN4ID0gZmluZEl0ZW1zQnlDbHModGl0bGUgKyAnY2F0ZV9idXR0b24nKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignY2F0ZV9idXR0b24nLCBjeCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHRpdGxlICsgJ2NhdGVfYnV0dG9uJyk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjeCA9IHN0b3JhZ2UwLmdldE15VmFyKCdjYXRlX2J1dHRvbicsIFtdKS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhbJ2NvbF90eXBlJ10gPSB4Wydjb2xfdHlwZSddID8geFsnY29sX3R5cGUnXSA6IHhbJ3R5cGUnXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHg7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHRpdGxlICsgJ2NhdGVfbGluZScsIGN4KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyphbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0odGl0bGUgKyAnY2F0ZV9leHAnLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGZvbGQgPT0gMSA/IOWxleW8gCA6IOaKmOWPoCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihNWV9SVUxFLmdyb3VwLCBmb2xkID09PSBcXFwiMVxcXCIgPyBcXFwiMFxcXCIgOiBcXFwiMVxcXCIpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9yZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBNWV9SVUxFLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb2xkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICDnirbmgIEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIOWFqOa4hSwgW+WxleW8gCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIOaKmOWPoFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBdLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICksXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogTVlfUlVMRS50aXRsZSArICdjYXRlX2V4cCcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogdGhpcy5hY3Rpb24oe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbDog5YWo5riFLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2w6IOa4hemZpCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgY2F0ZWdvcmllcy5mb3JFYWNoKChjYXRlZ29yeSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGNhdGVnb3J5KVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHN1Yl9jYXRlZ29yaWVzID0gW107XFxuICAgICAgICAgICAgICAgICAgICAvKmlmICjlsI/nsbvlrprkvY0uaW5jbHVkZXMoXFxcIjtcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jS5zcGxpdChcXFwiO1xcXCIpWzBdKTtcXG4gICAgICAgICAgICAgICAgICAgICAgaWYgKHN1Yl9jYXRlZ29yaWVzLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMgPSBwZGZhKGNhdGVnb3J5LCDlsI/nsbvlrprkvY0uc3BsaXQoXFxcIjtcXFwiKVsxXSk7XFxuICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ki9cXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGluZGV4KVxcbiAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMgPSBKU09OLnBhcnNlKGBbJHtjYXRlZ29yeX1dYCk7XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhzdWJfY2F0ZWdvcmllcylcXG4gICAgICAgICAgICAgICAgICAgIC8vIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGluZGV4ID09PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy/lpKfnsbtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sZXQgdGl0bGUgPSBwZGZoKGl0ZW0sIF/lpKfnsbvmoIfpopgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSBpdGVtLnRpdGxlO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDmjpLpmaQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUucmVwbGFjZShuZXdSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGpzb24gPSAnJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyczog5riF6ZmkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbjoganNvbixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sZXQgdXJsID0gcGQoaXRlbSwgX+Wkp+exu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1cmwgPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyppZiAo5aSn57G75aSE55CGKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsID0g5LiA57qn5YiG57G75aSE55CGKHVybCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0qL1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyh1cmwpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoXFxcImhpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5ld19jYXRlID0gW107XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2NhdGVfYnV0dG9uJyk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXAuZm9yRWFjaCgoY2F0ZSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld19jYXRlLnB1c2goaW5kZXggPT09IDAgPyBwYXJhbXMua2V5LnRvU3RyaW5nKCkgOiBcXFwiMFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIsIEpTT04uc3RyaW5naWZ5KG5ld19jYXRlKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiZHRfXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHBhcmFtcy5zdGF0ZSwgcGFyYW1zLmpzb24pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKHRydWUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9saW5lJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL+Wwj+exu1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzLmZvckVhY2goKGl0ZW0sIGtleSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZXh0cmFwb3MgPSBmYWxzZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyppZiAoaXRlbS5pbmNsdWRlcygndHlwZT1cXFwiQGV4dHJhXFxcIicpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFwb3MgPSB0cnVlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKCfpmYTliqDlrprkvY0nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ki9cXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGV4dHJhcG9zKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSBwZGZoKGl0ZW0sIFxcXCJhJiZUZXh0XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDmjpLpmaQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBqc29uID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHBkZmgoaXRlbSwgXFxcImEmJnN0YXRlXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwgXFxcImEmJnZhbHVlXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy92YXIgdGl0bGUgPSBwZGZoKGl0ZW0sIOWIhuexu+agh+mimCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSBpdGVtLnRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiDmjpLpmaQgIT0gXFxcInVuZGVmaW5lZFxcXCIgJiYg5o6S6ZmkICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIganNvbiA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLypzd2l0Y2ggKHRydWUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoXFxcIkBAQFxcXCIpOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBAXFxcIilbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQEBcXFwiKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoXFxcIkBAXFxcIik6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBcXFwiKVswXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBcXFwiKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8ganNvbiA9IHBkKGl0ZW0sIOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qdmFyIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzFdKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQCcpP3tcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU65YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpOyovXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHBhcmFtcyA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbjoganNvbixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKFxcXCJoaWtlcjovL2VtcHR5XFxcIiArIFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmFsbGNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignY2F0ZV9idXR0b24nKTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcFtwYXJhbXMuaW5kZXhdID0gcGFyYW1zLmtleS50b1N0cmluZygpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkocGFyYW1zLmNhdGVfdGVtcCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImR0X1xcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogTVlfUlVMRS50aXRsZSArICdjYXRlX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVzLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogTVlfUlVMRS50aXRsZSArICdjYXRlX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChmb2xkID09PSBcXFwiMVxcXCIgfHwg5oqY5Y+g54q25oCBID09IGZhbHNlKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW1zID0gaXRlbXMuY29uY2F0KGNhdGVzKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGZvbGQgPT09IFxcXCIwXFxcIikge1xcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignY2F0ZV9idXR0b24nLCBjYXRlcylcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHR5cGVvZiBzZXRQcmVSZXN1bHQgIT0gJ3VuZGVmaW5lZCcpIHtcXG4gICAgICAgICAgICAgICAgaXRlbXMgPSBkLmNvbmNhdChpdGVtcyk7XFxuICAgICAgICAgICAgICAgIC8v5riF56m657un5om/5pWw57uEXFxuICAgICAgICAgICAgICAgIGQubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICAgICAgc2V0UHJlUmVzdWx0KGl0ZW1zKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBpdGVtcy5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sXFxuICAgIH07XFxuICAgIG9iai7pooTorr4ob3B0aW9ucyk7XFxuICAgIHJldHVybiBvYmo7XFxufVxcblxcbnZhciDnirbmgIEgPVxcbiAgICB0eXBlb2Yg54q25oCB5qCH6K6wICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOeKtuaAgeagh+iusCAhPSBcXFwiXFxcIiA/IOeKtuaAgeagh+iusCA6IE1ZX1JVTEUudXJsO1xcblxcbmxldCBkdF9kZWJ1ZyA9IGZhbHNlO1xcblxcbmFkZExpc3RlbmVyKFxcbiAgICBcXFwib25DbG9zZVxcXCIsXFxuICAgICQudG9TdHJpbmcoKCkgPT4ge30pXFxuKTtcXG5cXG52YXIgQ3JlYXRlID0ge1xcbiAgICBuZXh0UGFnZTogZnVuY3Rpb24oKSB7XFxuICAgICAgICB2YXIgcmVzdWx0ID0gZmFsc2U7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHZhciBuZXh0ID0gZXZhbCjkuIvkuIDpobUpO1xcbiAgICAgICAgICAgIC8vbG9nKCduOicrbmV4dClcXG4gICAgICAgICAgICBpZiAobmV4dCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ+S4i+S4gOmhtemTvuaOpeS4uuepuicpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJlc3VsdCA9IHRydWU7XFxuICAgICAgICAgICAgaWYgKHRydWVfdXJsID09IG5leHQpIHtcXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIC8vbG9nKFxcXCLlj6/og73kuI3lrZjlnKjkuIvkuIDpobXmiJbogIXkuIvkuIDpobXlrprkvY3mnInpl67pophcXFwiKTtcXG4gICAgICAgICAgICBsb2coXFxcIumUmeivr+S/oeaBrzpcXFwiICsgZS5tZXNzYWdlKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmICgobmV4dCA9PSBcXFwiXFxcIiB8fCBuZXh0ID09IHVuZGVmaW5lZCkgJiYgcGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgbmV4dCA9IHRydWVfdXJsO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAvL3Jlc3VsdD1mYWxzZTtcXG4gICAgICAgICAgICBuZXh0ID0gZ2V0TXlWYXIo54q25oCBKTtcXG4gICAgICAgIH1cXG4gICAgICAgIC8vbG9nKCdsJyt0cnVlX3VybClcXG4gICAgICAgIC8vbG9nKCduJytuZXh0KVxcbiAgICAgICAgaWYgKHBhZ2UgIT0gMSkge1xcbiAgICAgICAgICAgIGlmICh0cnVlX3VybCA9PSBuZXh0ICYmICFyZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gdHJ1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gcmVzdWx0O1xcbiAgICAgICAgLy9wdXRNeVZhcijnirbmgIEsIG5leHQpO1xcbiAgICB9LFxcbiAgICBnZXRCYWNrSW1hZ2U6IGZ1bmN0aW9uKGltZ3VybCkge1xcbiAgICAgICAgdmFyIHJlc3VsdCA9IGltZ3VybDtcXG4gICAgICAgIHRy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GltZyk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGltZyA9IHBkZmgoaXRlbSwgcnVsZS5pbWcpO1xcbiAgICAgICAgICAgIGlmICghaW1nLnN0YXJ0c1dpdGgoXFxcImh0dHBcXFwiKSkge1xcbiAgICAgICAgICAgICAgICBpbWcgPSBwZChpdGVtLCBydWxlLmltZyk7XFxuICAgICAgICAgICAgICAgIGltZyA9IHRoaXMuaHR0cEhhbmRsZShpbWcpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBpbWcgKyBydWxlLnJlZjtcXG4gICAgfSxcXG4gICAgdXJsSGFuZGxlOiBmdW5jdGlvbihpdGVtLCBydWxlKSB7XFxuICAgICAgICB2YXIgaHJlZiA9IFxcXCJcXFwiO1xcbiAgICAgICAgaWYgKHJ1bGUudXJsLnN0YXJ0c1dpdGgoXFxcInBkXFxcIikpIHtcXG4gICAgICAgICAgICBocmVmID0gZXZhbChydWxlLnVybCk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGhyZWYgPSBwZChpdGVtLCBydWxlLnVybCk7XFxuICAgICAgICB9XFxuICAgICAgICBocmVmID0gcnVsZS5pbXQgPyBocmVmICsgXFxcIiNpbW1lcnNpdmVUaGVtZSNcXFwiIDogaHJlZjtcXG4gICAgICAgIHJldHVybiBocmVmO1xcbiAgICB9LFxcbiAgICBzZXRDb250ZW50OiBmdW5jdGlvbihpdGVtLCBpbnB1dCkge1xcbiAgICAgICAgbGV0IG91dHB1dCA9IFxcXCJcXFwiO1xcbiAgICAgICAgaWYgKGlucHV0ID09IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgIHJldHVybiBvdXRwdXQ7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoaW5wdXQuc3RhcnRzV2l0aChcXFwicGRcXFwiKSkge1xcbiAgICAgICAgICAgIG91dHB1dCA9IGV2YWwoaW5wdXQpO1xcbiAgICAgICAgfSBlb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HJcXFxcbicgK1xcbiAgICAgICAgICAgIGBcXFxcblxcXFx0dGl0bGXlrprkvY06ICAke3J1bGUudGl0bGV9ICAtLS0+IOe7k+aenDogICR7b2JqLnRpdGxlfWAgK1xcbiAgICAgICAgICAgIGBcXFxcblxcXFx0ZGVzY+WumuS9jTogICR7cnVsZS5kZXNjfSAgLS0tPiDnu5Pmnpw6ICAke29iai5kZXNjfWAgK1xcbiAgICAgICAgICAgIGBcXFxcblxcXFx0aW1n5a6a5L2NOiAgJHtydWxlLmltZ30gIC0tLT4g57uT5p6cOiAgJHtvYmouaW1nfWAgK1xcbiAgICAgICAgICAgIChydWxlLmNvbnRlbnQgIT0gdW5kZWZpbmVkID8gYFxcXFxuXFxcXHRjb250ZW505a6a5L2NOiAgJHtydWxlLmNvbnRlbnR9ICAtLS0+IOe7k+aenDogICR7b2JqLmNvbnRlbnR9YCA6ICcnKSArXFxuICAgICAgICAgICAgYFxcXFxuXFxcXHR1cmzlrprkvY06ICAke3J1bGUudXJsfSAgLS0tPiDnu5Pmnpw6ICAke29iai51cmx9YFxcbiAgICAgICAgKTtcXG4gICAgICAgIGxvZygnLS0tLS0tLS0tLScgKyAoaSArIDEpICsgJzrosIPor5Xnu5PmnZ8tLS0tLS0tLS0tJyk7XFxuICAgIH0sXFxuICAgIGpzb25MaXN0OiBmdW5jdGlvbihhcnIsIGpzb24sIHJ1bGUpIHtcXG4gICAgICAgIGlmIChqc29uLmNvbnN0cnVjdG9yICE9IE9iamVjdCkge1xcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGpzb24gPSBKU09OLnBhcnNlKGpzb24pO1xcbiAgICAgICAgICAgIH0gY2F0Y2gge31cXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChqc29uW3J1bGUubGlzdF0gPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgYXJyLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXCJncmV5XFxcIj48c21hbGw+5peg5YaF5a65PC9zbWFsbD48L2ZvbnQ+JyxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7fSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICByZXR1cm47XFxuICAgICAgICB9XFxuICAgICAgICB2YXIgZGVidWcgPSB0aGlzLmdldEJvb2xlYW5WYWx1ZShydWxlLmRlYnVnLCBmYWxzZSk7XFxuICAgICAgICB2YXIgZW1wdHkgPSB0aGlzLmdldEJvb2xlYW5WYWx1ZShydWxlLmVtcHR5KTtcXG4gICAgICAgIGlmIChkZWJ1Zykge1xcbiAgICAgICAgICAgIGxvZygn5a6a5L2N5YiX6KGoOicgKyBydWxlLmxpc3QpO1xcbiAgICAgICAgfVxcbiAgICAgICAganNvbltydWxlLmxpc3RdLmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSBldmFsKHJ1bGUudGl0bGUpO1xcbiAgICAgICAgICAgIHZhciBkZXNjID0gZXZhbChydWxlLmRlc2MpO1xcbiAgICAgICAgICAgIHZhciBjb250ZW50ID0gZXZhbChydWxlLmNvbnRlbnQpO1xcbiAgICAgICAgICAgIHZhciBpbWcgPSBldmFsKHJ1bGUuaW1nKSArIHJ1bGUucmVmO1xcbiAgICAgICAgICAgIHZhciBocmVmID0gZXZhbChydWxlLnVybCk7XFxuICAgICAgICAgICAgdmFyIHVybCA9IHJ1bGUuaW10ID8gaHJlZiArIFxcXCIjaW1tZXJzaXZlVGhlbWUjXFxcIiA6IGhyZWY7XFxuICAgICAgICAgICAgdmFyIGxhenkgPSBydWxlLmxhenkgPyBydWxlLmxhenkgOiBcXFwiXFxcIjtcXG5cXG4gICAgICAgICAgICB2YXIgZGQgPSB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgICAgICAgY29udGVudDogY29udGVudCxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogaW1nLFxcbiAgICAgICAgICAgICAgICB1cmw6IChlbXB0eSA/IFxcXCJoaWtlcjovL2VtcHR5IyNcXFwiIDogJycpICsgdXJsLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIH07XFxuXFxuICAgICAgICAgICAgaWYgKGRlYnVnKSB7XFxuICAgICAgICAgICAgICAgIHZhciByeCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYyxcXG4gICAgICAgICAgICAgICAgICAgIGltZyxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICB1cmxcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgdGhpcy5kZWJ1Z2xvZyhpLCBpdGVtLCBydWxlLCByeCk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGlmIChsYXp5ICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGRkW1xcXCJ1cmxcXFwiXSA9IGhyZWYgKyBsYXp5O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBhcnIucHVzaChkZCk7XFxuICAgICAgICB9KTtcXG4gICAgfSxcXG4gICAgcnVsZUxpc3Q6IGZ1bmN0aW9uKGFyciwgaHRtbCwgcnVsZSkge1xcbiAgICAgICAgdmFyIGxpc3QgPSBwZGZhKGh0bWwsXFxuICAgICAgICAgICAgcnVsZS5saXN0KTtcXG4gICAgICAgIHZhciBkZWJ1ZyA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZGVidWcsXFxuICAgICAgICAgICAgZmFsc2UpO1xcbiAgICAgICAgdmFyIGVtcHR5ID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5lbXB0eSk7XFxuICAgICAgICBpZiAoZGVidWcpIHtcXG4gICAgICAgICAgICBsb2coJ+WumuS9jeWIl+ihqDonICsgcnVsZS5saXN0KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxpc3QuZm9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLnRpdGxlKTtcXG4gICAgICAgICAgICB2YXIgZGVzYyA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmRlc2MpO1xcbiAgICAgICAgICAgIHZhciBpbWcgPSB0aGlzLmltZ0hhbmRsZShpdGVtLCBydWxlKTtcXG4gICAgICAgICAgICB2YXIgdXJsID0gdGhpcy51cmxIYW5kbGUoaXRlbSwgcnVsZSk7XFxuICAgICAgICAgICAgdmFyIGNvbnRlbnQgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS5jb250ZW50KTtcXG5cXG4gICAgICAgICAgICBpZiAoZGVidWcpIHtcXG4gICAgICAgICAgICAgICAgdmFyIHJ4ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjLFxcbiAgICAgICAgICAgICAgICAgICAgaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgY29udGVudCxcXG4gICAgICAgICAgICAgICAgICAgIHVybFxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICB0aGlzLmRlYnVnbG9nKGksIGl0ZW0sIHJ1bGUsIHJ4KTtcXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgdmFyIGxhenkgPSBydWxlLmxhenkgPyBydWxlLmxhenkgOiBcXFwiXFxcIjtcXG4gICAgICAgICAgICB2YXIgZGQgPSB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogaW1nLFxcbiAgICAgICAgICAgICAgICB1cmw6IChlbXB0eSA/IFxcXCJoaWtlcjovL2VtcHR5IyNcXFwiIDogJycpICsgdXJsLFxcbiAgICAgICAgICAgICAgICBjb250ZW50OiBjb250ZW50LFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgaWYgKGxhenkgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgZGRbXFxcInVybFxcXCJdID0gdXJsICsgbGF6eTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYXJyLnB1c2goZGQpO1xcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIExpc3Q6IGZ1bmN0aW9uKGFyciwgaHRtbCwgcnVsZSwgcGFyYW0pIHtcXG4gICAgICAgIHBhcmFtID0gcGFyYW0gPyBwYXJhbSA6IHt9O1xcbiAgICAgICAgdmFyIGF1dG8gPSBwYXJhbS5hdXRvID8gcGFyYW0uYXV0byA6IGZhbHNlO1xcbiAgICAgICAgdmFyIHNob3cgPSBwYXJhbS5zaG93ID8gcGFyYW0uc2hvdyA6IGZhbHNlO1xcbiAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICAgIC8vdGhpcy5zcGFnZS5zZXQodHJ1ZV91cmwpO1xcbiAgICAgICAgfVxcbiAgICAgICAgdGhpcy5yZW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ICAgICAgIHZhciBjb250ZW50ID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuY29udGVudCk7XFxuXFxuICAgICAgICAgICAgICAgIGlmIChkZWJ1Zykge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJ4ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2MsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsXFxuICAgICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWJ1Z2xvZyhpLCBpdGVtLCBydWxlLCByeCk7XFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZCA9IFxcXCJsYXN0aWRfXFxcIiArIHBhZ2U7XFxuICAgICAgICAgICAgICAgICAgICBjbHMgPSBcXFwibGFzdG1hcmtcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAoZW1wdHkgPyBcXFwiaGlrZXI6Ly9lbXB0eSMjXFxcIiA6ICcnKSArIHVybCxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaW1nOiBpbWcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGlkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogY2xzLFxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIGlmIChpID09IGxpc3QubGVuZ3RoIC0gMSAmJiBzaG93KSB7XFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbGluZVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzbWFsbD7liqDovb3kuK0uLi48L3NtYWxsPlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogXFxcInBhZ2VudW1cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKFxcXCJwYWdlbnVtXFxcIiwge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXCJncmV5XFxcIj48c21hbGw+5Yiw5bqV5LqGPC9zbWFsbD48L2ZvbnQ+JyxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogXFxcImxhc3RcXFwiLFxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGxpc3QubGVuZ3RoID09IDAgJiYgcGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIixcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxmb250IGNvbG9yPVxcXCJncmV5XFxcIj48c21hbGw+5peg5YaF5a65PC9zbWFsbD48L2ZvbnQ+JyxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7fSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmICh0aGlzLm5leHRQYWdlKCkpIHtcXG4gICAgICAgICAgICAvL2xvZygndCcpO1xcbiAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCd5aV9pc25leHQnLCAndCcpO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAvL2xvZygnZicpO1xcbiAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCd5aV9pc25leHQnLCAnZicpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGF1dG8pIHtcXG4gICAgICAgICAgICAvL2NyZWF0ZU5leHRQYWdlKCk7XFxuICAgICAgICAgICAgYXV0b1BhZ2UoKTtcXG4gICAgICAgIH1cXG4gICAgfSxcXG59O1xcblxcbnZhciBleHRNZXRob2QgPSB7XFxuICAgIFRvUGFyYW1zOiBmdW5jdGlvbigpIHtcXG4gICAgICAgIHZhciBqc29uID0gYXJndW1lbnRzWzBdO1xcbiAgICAgICAgcmV0dXJuIE9iamVjdC5rZXlzKGpzb24pXFxuICAgICAgICAgICAgLm1hcCgoa2V5KSA9PiBrZXkgKyBcXFwiPVxcXCIgKyBqc29uW2tleV0pXFxuICAgICAgICAgICAgLmpvaW4oXFxcIiZcXFwiKTtcXG4gICAgfSxcXG4gICAgdXJsUGFyc2U6IGZ1bmN0aW9uKHUpIHtcXG4gICAgICAgIHZhciBkaWN0ID0ge307XFxuICAgICAgICBkaWN0LlNvdXJjZSA9IHU7XFxuICAgICAgICBsZXQgcGFyYW1zID0gKHVybCkgPT4ge1xcbiAgICAgICAgICAgIGxldCBxdWVyeVBhcmFtcyA9IHt9O1xcbiAgICAgICAgICAgIGxldCByZWcgPSAvKFtePz0mXSspPShbXj89Jl0rKS9nO1xcbiAgICAgICAgICAgIHVybC5yZXBsYWNlKHJlZywgZnVuY3Rpb24oKSB7XFxuICAgICAgICAgICAgICAgIHF1ZXJ5UGFyYW1zW2FyZ3VtZW50c1sxXV0gPSBhcmd1bWVudHNbMl07XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgcmV0dXJuIHF1ZXJ5UGFyYW1zO1xcbiAgICAgICAgfTtcXG4gICAgICAgIHZhciBqYXZhVXJsID0gSmF2YUltcG9ydGVyKGphdmEubmV0LlVSTCk7XFxuICAgICAgICB3aXRoKGphdmFVcmwpIHtcXG4gICAg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vciAobGV0IGkgPSAwOyBpIDwgc3RyMi5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgIGlmIChzdHIxW2ldICE9PSBzdHIyW2ldKSB7XFxuICAgICAgICAgICAgICAgIGRpZmZDaGFycy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIGluZGV4OiBpLFxcbiAgICAgICAgICAgICAgICAgICAgczE6IHN0cjFbaV0sXFxuICAgICAgICAgICAgICAgICAgICBzMjogc3RyMltpXSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIGRpZmZDaGFycztcXG4gICAgfSxcXG4gICAgcmVwbGFjZUNoYXJBdDogZnVuY3Rpb24oc3RyLCBpbmRleCwgcmVwbGFjZW1lbnQpIHtcXG4gICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0gc3RyLmxlbmd0aCkge1xcbiAgICAgICAgICAgIHJldHVybiBzdHI7XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZyhpbmRleClcXG4gICAgICAgIGNvbnN0IGFyciA9IHN0ci5zcGxpdChcXFwiXFxcIik7XFxuICAgICAgICBhcnJbaW5kZXhdID0gcmVwbGFjZW1lbnQ7XFxuICAgICAgICByZXR1cm4gYXJyLmpvaW4oXFxcIlxcXCIpO1xcbiAgICB9LFxcbiAgICBnZXRPYmplY3RLZXlzRGlmZjogZnVuY3Rpb24ob2JqMSwgb2JqMikge1xcbiAgICAgICAgY29uc3QgZGlmZmVyZW50S2V5cyA9IFtdO1xcbiAgICAgICAgZm9yIChsZXQga2V5IGluIG9iajEpIHtcXG4gICAgICAgICAgICBpZiAoIW9iajIuaGFzT3duUHJvcGVydHkoa2V5KSB8fCBvYmoxW2tleV0gIT09IG9iajJba2V5XSkge1xcbiAgICAgICAgICAgICAgICBkaWZmZXJlbnRLZXlzLnB1c2goa2V5KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIC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bCh1MS5QYXJhbXMsIHUyLlBhcmFtcykpIHtcXG4gICAgICAgICAgICAgICAgaWYgKGR0X2RlYnVnKSB7XFxuICAgICAgICAgICAgICAgICAgICBsb2codTEuUGF0aCk7XFxuICAgICAgICAgICAgICAgICAgICBsb2codTIuUGF0aCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIGRmID0gdGhpcy5maW5kRGlmZmVyZW50SW5kZXgoU3RyaW5nKHUxLlBhdGgpLCBTdHJpbmcodTIuUGF0aCkpO1xcbiAgICAgICAgICAgICAgICBpZiAoZHRfZGVidWcpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhkZik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKGRmLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcmUgPSBkZlswXS5pbmRleDtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBmID0gZGYuZmlsdGVyKCh4KSA9PiAvXFxcXGQrLy50ZXN0KHguczIpKTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciByZSA9IGZbMF0uaW5kZXg7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIGVxID0gdGhpcy5yZXBsYWNlQ2hhckF0KFN0cmluZyh1Mi5QYXRoKSwgcmUsIFxcXCJmeXBhZ2VcXFwiKTtcXG4gICAgICAgICAgICAgICAgbmV4dHVybCA9IHUyLkhvc3RzICsgZXEgKyBjYSArIHRoaXMuVG9QYXJhbXModTIuUGFyYW1zKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB2YXIgZXAgPSB0aGlzLmdldE9iamVjdEtleXNEaWZmKHUxLlBhcmFtcywgdTIuUGFyYW1zKVxcbiAgICAgICAgICAgICAgICBpZiAoZXAubGVuZ3RoID09IDEpIHtcXG4gICAgICA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yIG5leHQgPSBldmFsKOS4i+S4gOmhtSk7XFxuICAgICAgICAvL2xvZyhcXFwibmV4dFxcXCIpO1xcbiAgICAgICAgLy9sb2coJ25leHQ6JytuZXh0KTtcXG4gICAgfSBjYXRjaCB7XFxuICAgICAgICBsb2coXFxcIuWPr+iDveS4jeWtmOWcqOS4i+S4gOmhteaIluiAheS4i+S4gOmhteWumuS9jeaciemXrumimFxcXCIpO1xcbiAgICAgICAgbmV4dCA9IFxcXCJcXFwiO1xcbiAgICB9XFxuICAgIGlmIChuZXh0ICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICBwdXRNeVZhcijnirbmgIEsIG5leHQpO1xcbiAgICB9XFxufVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi546v5aKD5bCB6KOFXCIsXCJwYXRoXCI6XCJyZXBhaXJcIixcInJ1bGVcIjpcImpzOlxcbi8qXFxuMjAyMy0xMC0xNSBieSDOsVxcbiovXFxuXFxudmFyIGRvY3VtZW50ID0ge307XFxudmFyIHdpbmRvdyA9IHtcXG4gICAgbG9jYXRpb246IHtcXG4gICAgICAgIHJlbG9hZDogZnVuY3Rpb24oKSB7XFxuICAgICAgICAgICAgcmV0dXJuO1xcbiAgICAgICAgfVxcbiAgICB9XFxufTtcXG5cXG4vLyDlrprkuYnkuIDkuKrlr7nosaHnlKjkuo7lrZjlgqggY29va2llIOWQjeensOWSjOWAvOeahOmUruWAvOWvuVxcbnZhciBjb29raWVzID0ge307XFxuT2JqZWN0LmRlZmluZVByb3BlcnR5KGRvY3VtZW50LCAnY29va2llJywge1xcbiAgICBlbnVtZXJhYmxlOiB0cnVlLFxcbiAgICBjb25maWd1cmFibGU6IHRydWUsXFxuICAgIGdldDogZnVuY3Rpb24oKSB7XFxuICAgICAgICByZXR1cm4gT2JqZWN0LmVudHJpZXMoY29va2llcykubWFwKChba2V5LCB2YWx1ZV0pID0+IGAke2tleX09JHt2YWx1ZX1gKS5qb2luKCc7ICcpO1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A9IFtwZGZhKGh0bWwsIOWkp+exu+WumuS9jSkuam9pbignXFxcXG4nKV0uY29uY2F0KHBkZmEoaHRtbCwg5ou85o6l5YiG57G7KSk7XFxuICAgIH1cXG4gICAgaWYgKHR5cGVvZiAo6ZmE5Yqg5a6a5L2NKSAhPSAndW5kZWZpbmVkJyAmJiDpmYTliqDlrprkvY0ubGVuZ3RoID4gMCkge1xcbiAgICAgICAg6ZmE5Yqg5a6a5L2NLmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgdmFyIOS4gOe6pyA9IHBkZmEoaHRtbCwgeC7kuIDnuqflrprkvY0pLm1hcChzID0+IHtcXG4gICAgICAgICAgICAgICAgdmFyIOWumuS9jSA9IHBkZmEocywgeC7lsI/nsbspLm1hcChxID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IHBkZmgocSwgeC7moIfpopgpO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHVybCA9ICdhJ1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHgu6ZO+5o6lLmluY2x1ZGVzKCdAQCcpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUgPSB4LumTvuaOpS5zcGxpdCgnQEAnKVswXVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlID0gcGRmaChxLCB4LumTvuaOpS5zcGxpdCgnQEAnKVsxXSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHgu6L2s5o2iID09IHRydWUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGA8bGkgZGF0YS10eXBlPVxcXCIke3N0YXRlfVxcXCIgZGF0YS12YWw9XFxcIiR7dmFsdWV9XFxcIj48YSBocmVmPVxcXCJcXFwiPiR7dGl0bGV9PC9hPjwvbGk+YFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBgPGEgdHlwZT1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xcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiJ2hpa2VyOi8vc2VhcmNoP3J1bGU9XFxcIiArIE1ZX1JVTEUudGl0bGUgKyBcXFwiJnM9JytpbnB1dFxcXCIsXFxuICAgICAgICAgICAgZGVzYzogXFxcIuaQnOe0ouWFs+mUruivjVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJpbnB1dFxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBnZXRNeVZhcigna2V5d29yZCcsICcnKSxcXG4gICAgICAgICAgICAgICAgb25DaGFuZ2U6ICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2tleXdvcmQnLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfVxcbiAgICBpZiAo5oqY5Y+g54q25oCBKSB7XFxuICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBmb2xkID09PSAnMScgPyDmipjlj6AgOiDlsZXlvIAsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgodGl0bGUsIGZvbGQsIHUsIGFsbCwgZXhwcykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIGZvbGQgPSBnZXRNeVZhcihNWV9SVUxFLmdyb3VwLCBmb2xkKTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBb5bGV5byALCDmipjlj6BdID0gZXhwcztcXG4gICAgICAgICAgICAgICAgICAgIGlmIChmb2xkID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgY3ggPSBmaW5kSXRlbXNCeUNscyh0aXRsZSArICdjYXRlX2J1dHRvbicpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdjYXRlX2J1dHRvbicsIGN4KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHModGl0bGUgKyAnY2F0ZV9idXR0b24nKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGN4ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2NhdGVfYnV0dG9uJywgW10pLm1hcCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgeFsnY29sX3R5cGUnXSA9IHhbJ2NvbF90eXBlJ10gPyB4Wydjb2xfdHlwZSddIDogeFsndHlwZSddO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geDtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIodGl0bGUgKyAnY2F0ZV9saW5lJywgY3gpXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAvKmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICB9KTsqL1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh0aXRsZSArICdjYXRlX2V4cCcsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogZm9sZCA9PSAxID8g5bGV5byAIDog5oqY5Y+gLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKE1ZX1JVTEUuZ3JvdXAsIGZvbGQgPT09IFxcXCIxXFxcIiA/IFxcXCIwXFxcIiA6IFxcXCIxXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICB9LCBNWV9SVUxFLnRpdGxlLCBmb2xkLCDnirbmgIEsIOWFqOa4hSwgW+WxleW8gCwg5oqY5Y+gXSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogTVlfUlVMRS50aXRsZSArICdjYXRlX2V4cCcsXFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmuIXpmaTnirbmgIEnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKCh4LCBhbGwsIGNsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoeCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2hlYWQuY2F0ZScpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwg54q25oCBLCDlhajmuIUsIOa4hemZpClcXG4gICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgIH1cXG4gICAg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moIfpopggPSAodHlwZW9mICjlpKfnsbvmoIfpopgpICE9ICd1bmRlZmluZWQnICYmIOWkp+exu+agh+mimCAhPSAnJykgPyDlpKfnsbvmoIfpopggOiDliIbnsbvmoIfpopg7XFxuXFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IHBkZmgoaXRlbSwgX+Wkp+exu+agh+mimCk7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgKOaOkumZpCkgIT0gJ3VuZGVmaW5lZCcgJiYg5o6S6ZmkICE9ICcnKSB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcbiAgICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsIGtleToga2V5LCBwYWdlOiBwYWdlLCBjbGVhcnM6IOa4hemZpCwgc3RhdGU6IOeKtuaAgSwgYWxsY2xlYXJzOiDlhajmuIVcXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICBsZXQgdXJsID0gcGQoaXRlbSwgX+Wkp+exu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgIGlmICjlpKfnsbvlpITnkIYpIHtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKOS4gOe6p+WIhuexu+WkhOeQhilcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKCQuc3RyaW5naWZ5KOS4gOe6p+WIhuexu+WkhOeQhikpXFxuICAgICAgICAgICAgICAgICAgICBsZXQgaW5wdXQgPSB1cmw7XFxuICAgICAgICAgICAgICAgICAgICBldmFsKFxcXCJyZXN1bHQgPSBcXFwiICsg5LiA57qn5YiG57G75aSE55CGKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHJlc3VsdClcXG4gICAgICAgICAgICAgICAgICAgIHVybCA9IHJlc3VsdDtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBzZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJCh1cmwgKyAnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5ld19jYXRlID0gW107XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wLmZvckVhY2goKGNhdGUsIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld19jYXRlLnB1c2goaW5kZXggPT09IDAgPyBwYXJhbXMua2V5LnRvU3RyaW5nKCkgOiBcXFwiMFxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkobmV3X2NhdGUpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfSwgcGFyYW1zKVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogTVlfUlVMRS50aXRsZSArICdjYXRlX2xpbmUnLFxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxuICAgICAgICAgICAgICAgIHZhciBleHRyYXBvcyA9IGZhbHNlO1xcbiAgICAgICAgICAgICAgICBpZiAoaXRlbS5pbmNsdWRlcygndHlwZT1cXFwiQGV4dHJhXFxcIicpKSB7XFxuICAgICAgICAgICAgICAgICAgICBleHRyYXBvcyA9IHRydWU7XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZygn6ZmE5Yqg5a6a5L2NJylcXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICBpZiAoZXh0cmFwb3MpIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IHBkZmgoaXRlbSwgJ2EmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgKOaOkumZpCkgIT0gJ3VuZGVmaW5lZCcgJiYg5o6S6ZmkICE9ICcnKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB2YXIganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sICdhJiZzdGF0ZScpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sICdhJiZ2YWx1ZScpLFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcblxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gcGRmaChpdGVtLCDliIbnsbvmoIfpopgpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiAo5o6S6ZmkKSAhPSAndW5kZWZpbmVkJyAmJiDmjpLpmaQgIT0gJycpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3IFJlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgIHZhciBqc29uID0gJyc7XFxuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHRydWUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIOWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEBAJyk6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdCgnQEBAJylbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAJyk6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiDliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMF0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSBwZChpdGVtLCDliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIC8qdmFyIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEBAJylbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgICAgICAganNvbj3liIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAJyk/e1xcbiAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOuWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVswXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7Ki9cXG5cXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcbiAgICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsIGluZGV4OiBpbmRleCwga2V5OiBrZXksIHBhZ2U6IHBhZ2UsIGpzb246IGpzb24sIHN0YXRlOiDnirbmgIEsIGFsbGNsZWFyczog5YWo5riFXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY2F0ZXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJCgnaGlrZXI6Ly9lbXB0eScgKyAnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zLmFsbGNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXBbcGFyYW1zLmluZGV4XSA9IHBhcmFtcy5rZXkudG9TdHJpbmcoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkocGFyYW1zLmNhdGVfdGVtcCkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbXMuanNvbi5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdkdF8nICsgcGFyYW1zLmpzb24udHlwZSwgcGFyYW1zLmpzb24udmFsdWUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHBhcmFtcy5zdGF0ZSwgcGFyYW1zLmpzb24pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfSwgcGFyYW1zKSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogTVlfUlVMRS50aXRsZSArICdjYXRlX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGNhdGVzLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsczogTVlfUlVMRS50aXRsZSArICdjYXRlX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgfSlcXG59XFxuXFxuXFxuaWYgKGZvbGQgPT09IFxcXCIxXFxcIiB8fCDmipjlj6DnirbmgIEgPT0gZmFsc2UpIHtcXG4gICAgaXRlbXMgPSBpdGVtcy5jb25jYXQoY2F0ZXMpO1xcbn1cXG5pZiAoZm9sZCA9PT0gXFxcIjBcXFwiKSB7XFxuICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdjYXRlX2J1dHRvbicsIGNhdGVzKVxcbn1cXG5pZiAodHlwZW9mIHNldFByZVJlc3VsdCAhPSAndW5kZWZpbmVkJykge1xcbiAgICBpdGVtcyA9IGQuY29uY2F0KGl0ZW1zKTtcXG4gICAgLy/muIXnqbrnu6fmib/mlbDnu4RcXG4gICAgZC5sZW5ndGggPSAwO1xcbiAgICBzZXRQcmVSZXN1bHQoaXRlbXMpO1xcbn0gZWxzZSB7XFxuICAgIGl0ZW1zLmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICBkLnB1c2goaXRlbSk7XFxuICAgIH0pXFxufVxcblwifV0iLCJpY29uIjoiIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment