Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥我喜欢的音乐@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIumhtemdolwiLFwicGF0aFwiOlwiQ29uZmlnLnZpZXdcIixcInJ1bGVcIjpcImNvbnN0IGVtcHR5ID0gJ2hpa2VyOi8vZW1wdHknXFxuY29uc3QgbXluYW1lID0gJ+eugOWNlemfs+S5kCdcXG5cXG5jb25zdCBDb2xvciA9ICh0ZXN0KSA9PiB7XFxuICAgIHJldHVybiB0ZXN0LmZvbnRjb2xvcignI0ZBNzI5OCcpO1xcbn1cXG5cXG5jb25zdCBTcHJpbmdHcmVlbiA9ICh0ZXN0KSA9PiB7XFxuICAgIHJldHVybiB0ZXN0LmZvbnRjb2xvcignIzNDQjM3MScpO1xcbn1cXG5cXG5jb25zdCBTdHJvbmcgPSAodGVzdCkgPT4ge1xcbiAgICByZXR1cm4gJzxzdHJvbmc+JyArIHRlc3QgKyAnPC9zdHJvbmc+JztcXG59XFxuXFxuY29uc3QgU21hbGwgPSAodGVzdCkgPT4ge1xcbiAgICByZXR1cm4gJzxzbWFsbD4nICsgdGVzdCArICc8L3NtYWxsPic7XFxufVxcblxcbmNvbnN0IEdyYXkgP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JzogTmV0RWFzZVVybCxcXG4gICAgICAgICAgICAnQ29va2llJzogJ05NVElEPTAwT1E1VmktNE5LVEdmb2dFdW5vVUxoMFF5OFBNc0FBQUdFYktvLVlnOyBvcz1wYydcXG4gICAgICAgIH0sXFxuICAgICAgICBib2R5OiBib2R5LFxcbiAgICAgICAgbWV0aG9kOiBtZXRob2RcXG4gICAgfSlcXG4gICAgcmV0dXJuIEpTT04ucGFyc2UoTmV0RWFzZU1hcClcXG59XFxuXFxuY29uc3QgVGVuY2VudENvbmZpZyA9IChtaWQpID0+IHtcXG4gICAgVGVuY2VudFVybCA9IG1pZDtcXG4gICAgaWYgKHR5cGVvZiBtaWQgPT0gXFxcIm51bWJlclxcXCIpIHtcXG4gICAgICAgIGJvZHkgPSB7XFxuICAgICAgICAgICAgXFxcIlNvbmdsaXN0XFxcIjoge1xcbiAgICAgICAgICAgICAgICBcXFwibW9kdWxlXFxcIjogXFxcIm11c2ljLnNyZkRpc3NJbmZvLkRpc3NJbmZvXFxcIixcXG4gICAgICAgICAgICAgICAgXFxcIm1ldGhvZFxcXCI6IFxcXCJDZ2lHZXREaXNzXFxcIixcXG4gICAgICAgICAgICAgICAgXFxcInBhcmFtXFxcIjoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcImRpcmlkXFxcIjogMCxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJmcm9tXFxcIjogMTUsXFxuICAgICAgICAgICAgICAgICAgICBcXFwiY3R4XFxcIjogMCxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJvbmx5c29uZ2xpc3RcXFwiOiAwLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIm9yZGVybGlzdFxcXCI6IDEsXFxuICAgICAgICAgICAgICAgICAgICBcXFwidGFnXFxcIjogMSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJyZWNfZmxhZ1xcXCI6IDEsXFxuICAgICAgICAgICAgICAgICAgICBcXFwiZGlzc3RpZFxcXCI6IG1pZCxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJuZXdfZm9ybWF0XFxcIjogMSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJob3N0X3VpblxcXCI6IDAsXFxuICAgICAgICAgICAgICAgICAgICBcXFwib3B0eXBlXFxcIjogMixcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJlbmNfaG9zdF91aW5cXFwiOiBcXFwiMFxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgXFxcImNvbW1cXFwiOiB7XFxuICAgICAgICAgICAgICAgIFxcXCJjdFxcXCI6IFxcXCIxXFxcIixcXG4gICAgICAgICAgICAgICAgXFxcInZcXFwiOiBcXFwiOTBcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiY3ZcXFwiOiBcXFwiMTAxODA1XFxcIixcXG4gICAgICAgICAgICAgICAgXFxcImd6aXBcXFwiOiBcXFwiMFxcXCJcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBUZW5jZW50VXJsID0gJ2h0dHA6Ly91Ni55LnFxLmNvbS9jZ2ktYmluL211c2ljdS5mY2c/ZGF0YT0nICsgZXNjYXBlKEpTT04uc3RyaW5naWZ5KGJvZHkpKVxcbiAgICB9XFxuICAgIFRlbmNlbnRNYXAgPSByZXF1ZXN0KFRlbmNlbnRVcmwsIHtcXG4gICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3kucXEuY29tL3BvcnRhbC9wbGF5ZXIuaHRtbCdcXG4gICAgICAgIH1cXG4gICAgfSkucmVwbGFjZSgvY2FsbGJhY2tcXFxcKHxNdXNpY0pzb25DYWxsYmFja1xcXFwofGpzb25DYWxsYmFja1xcXFwofFxcXFwpJC9nLCAnJylcXG4gICAgcmV0dXJuIEpTT04ucGFyc2UoVGVuY2VudE1hcClcXG59XFxuXFxuY29uc3QgS3dtdXNpY2NhckNvbmZpZyA9IChLd211c2ljY2FyVX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GVhZGVyczoge1xcbiAgICAgICAgICAgICdSZWZlcmVyJzogTWlndUhvc3RcXG4gICAgICAgIH1cXG4gICAgfSlcXG4gICAgcmV0dXJuIEpTT04ucGFyc2UoTWlndU1hcClcXG59XFxuXFxuY29uc3QgZ2V0U2VsZWN0TWFwID0gKE11c2ljTWFwLCBTZWxlY3RNYXAsIGksIG1pZCwgbmFtZSkgPT4ge1xcbiAgICBzd2l0Y2ggKGdldEl0ZW0oJ2dldFVwTWFwJywgU2VsZWN0TWFwW1NlbGVjdE1hcC5sZW5ndGggLSAxXSkpIHtcXG4gICAgICAgIGNhc2UgU2VsZWN0TWFwWzBdOlxcbiAgICAgICAgICAgIGdldENvcHkgPSBnZXRNeVZhcignQnVpbGRNdXNpYycsIE11c2ljTWFwWzBdKSArICdcXFxcbuatjOWNleWQjeensO+8micgKyBuYW1lICsgJ1xcXFxu5q2M5Y2V6K+G5Yir77yaJyArIGJhc2U2NEVuY29kZSgnJyArIG1pZCArICcnKVxcbiAgICAgICAgICAgIGNvcHkoZ2V0Q29weSlcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgICAgIGNhc2UgU2VsZWN0TWFwWzFdOlxcbiAgICAgICAgICAgIHJldHVybiAkKGVtcHR5KS5sYXp5UnVsZSgoZW1wdHksIE11c2ljTWFwLCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdNdXNpY01hcENvbmZpcm0nLCBNdXNpY01hcClcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2luZGV4Q29uZmlybScsIGkpXFxuICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmrYzljZXliKDpmaRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcIuehruWumuWlveS6huWQl++8jOivpeatjOWNleWwhuWIoOmZpFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgTXVzaWNNYXAgPSBzdG9yYWdlMC5nZXRNeVZhcignTXVzaWNNYXBDb25maXJtJylcXG4gICAgICAgICAgICAgICAgICAgICAgICBpID0gZ2V0TXlWYXIoJ2luZGV4Q29uZmlybScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIGRhdGFNYXApXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChnZXRNeVZhcignQnVpbGRNdXNpYycsIE11c2ljTWFwWzBdKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzBdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZE11c2ljLk5ldEVhc2Uuc3BsaWNlKGksIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsxXTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRNdXNpYy5UZW5jZW50LnNwbGljZShpLCAxKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMl06XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTXVzaWMuS3dtdXNpY2Nhci5zcGxpY2UoaSwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzNdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZE11c2ljLkt1Z291LnNwbGljZShpLCAxKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTXVzaWMuTWlndS5zcGxpY2UoaSwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+WIoOmZpOaIkOWKnycpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXG4gICAgICAgICAgICB9LCBlbXB0eSwgTXVzaWNNYXAsIGkpXFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICBjYXNlIFNlbGVjdE1hcFsyXTpcXG4gICAgICAgICAgICBwdXRNeVZhcignZ2V0TW92ZScsIGkpXFxuICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgIHJldHVybiAkKGVtcHR5ICsgJyNhdXRvQ2FjaGUjZnlwYWdlJykucnVsZSgobWlkLCBNdXNpY01hcCwgbXluYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgIGxldCBwYWdlID0gTVlfUEFHRVxcbiAgICAgICAgICAgICAgICBsZXQgbGF5b3V0ID0gW107XFxuICAgICAgICAgICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ0J1aWxkTXVzaWMnLCBNdXNpY01hcFswXSkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMF06XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBOZXRFYXNlTWFwID0gJy9hcGkvdjYvcGxheWxpc3QvZGV0YWlsP2lkPScgKyBtaWQgKyAnJm49MTAwMCZsaW1pdD0xMDAwJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBOZXRFYXNlTWFwID0gTmV0RWFzZUNvbmZpZyhOZXRFYXNlTWFwLCAnJywgJ0dFVCcpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOZXRFYXNlUGFyc2UobGF5b3V0LCBOZXRFYXNlTWFwLnBsYXlsaXN0LnRyYWNrcylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBSaWNoKFNtYWxsKEdyYXkoJ++9nu+9nu+9nicgKyBOZXRFYXNlTWFwLm1lc3NhZ2UgKyAn772e772e772eJykpKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGVtcHR5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMV06XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZW5jZW50TWFwID0gVGVuY2VudENvbmZpZyhtaWQpLlNvbmdsaXN0LmRhdGEuc29uZ2xpc3RcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgVGVuY2VudFBhcnNlKGxheW91dCwgVGVuY2VudE1hcClcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzJdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIEt3bXVzaWNjYXJVcmwgPSAnbXVzaWMvcGxheWxpc3QvJyArIG1pZCArICc/cG49JyArIHBhZ2UgKyAnJnJuPTIwJnVhPSZpcD0nXFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgS3dtdXNpY2Nhck1hcCA9IEt3bXVzaWNjYXJDb25maWcoS3dtdXNpY2NhclVybCkubXVzaWNMaXN0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEt3bXVzaWNjYXJQYXJzZShsYXlvdXQsIEt3bXVzaWNjYXJNYXApXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn57Of57OVQVBJ5bSp5rqD5LqGJylcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzNdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEt1Z291VXJsID0gJ2h0dHBzOi8vbS5rdWdvdS5jb20vcGxpc3QvbGlzdC8nICsgbWlkICsgJy8/anNvbj10cnVlJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS3Vnb3VNYXAgPSBKU09OLnBhcnNlKHJlcXVlc3QoS3Vnb3VVcmwpKS5saXN0Lmxpc3QuaW5mb1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS3Vnb3VQYXJzZShsYXlvdXQsIEt1Z291TWFwKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBwZGZoKHJlcXVlc3QobWlkKSwgJ2JvZHkmJnNjcmlwdCwyJiZIdG1sJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pZCA9IG1pZC5tYXRjaCgvd2luZG93XFxcXC5cXFxcJG91dHB1dCA9IChbXFxcXFNcXFxcc10uKik7LylbMV1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEt1Z291TWFwID0gSlNPTi5wYXJzZShtaWQpLmluZm8uc29uZ3NcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEt1Z291UGFyc2UobGF5b3V0LCBLdWdvdU1hcClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgTWlndVVybCA9ICdNSUdVTTMuMC9yZXNvdXJjZS9wbGF5bGlzdC9zb25nL3YyLjA/cGFnZU5vPScgKyBwYWdlICsgJyZwYWdlU2l6ZT01MCZwbGF5bGlzdElkPScgKyBtaWRcXG4gICAgICAgICAgICAgICAgICAgICAgICBNaWd1TWFwID0gTWlndUNvbmZpZyhNaWd1VXJsKS5kYXRhLnNvbmdMaXN0XFxuICAgICAgICAgICAgICAgICAgICAgICAgTWlndVBhcnNlKGxheW91dCwgTWlndU1hcClcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzZXRSZXN1bHQobGF5b3V0KTtcXG4gICAgICAgICAgICB9LCBtaWQsIE11c2ljTWFwLCBteW5hbWUpXFxuICAgIH1cXG4gICAgcmV0dXJuIGVtcHR5XFxufVxcblxcbmNvbnN0IGdldEltcG9ydCA9IChNdXNpY01hcCwgaW5wdXQpID0+IHtcXG4gICAgbGV0IGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgIGxldCBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxuICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcbiAgICBsZXQgTmV0RWFzZSA9IGRhdGFNYXAuQnVpbGRNdXNpYy5OZXRFYXNlXFxuICAgIGxldCBUZW5jZW50ID0gZGF0YU1hcC5CdWlsZE11c2ljLlRlbmNlbnRcXG4gICAgbGV0IEt3bXVzaWNjYXIgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuS3dtdXNpY2NhclxcbiAgICBsZXQgS3Vnb3UgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuS3Vnb3VcXG4gICAgbGV0IE1pZ3UgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuTWlndVxcbiAgICB0cnkge1xcbiAgICAgICAgc3dpdGNoIChnZXRNeVZhcignQnVpbGRNdXNpYycsIE11c2ljTWFwWzBdKSkge1xcbiAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMF06XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdGFydHNXaXRoKE11c2ljTWFwWzBdKSkge1xcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gaW5wdXQubWF0Y2goL1tBLVphLXowLTkrLz1dKyQvKVswXVxcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gYmFzZTY0RGVjb2RlKG1pZClcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dC5zZWFyY2goJ211c2ljLjE2MycpID49IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIG1pZCA9IGlucHV0Lm1hdGNoKC8ocGxheWxpc3RcXFxcL3xpZD0pKFxcXFxkKykvKVsyXVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIE5ldEVhc2VNYXAgPSAnL2FwaS92Ni9wbGF5bGlzdC9kZXRhaWw/aWQ9JyArIG1pZCArICcmbj0xMDAwJmxpbWl0PTEwMDAnXFxuICAgICAgICAgICAgICAgIE5ldEVhc2VNYXAgPSBOZXRFYXNlQ29uZmlnKE5ldEVhc2VNYXAsICcnLCAnR0VUJykucGxheWxpc3RcXG4gICAgICAgICAgICAgICAgQnJlYWsgPSB0cnVlXFxuICAgICAgICAgICAgICAgIE5ldEVhc2UuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLm1pZCA9PSBOZXRFYXNlTWFwLmlkKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+atjOWNlemHjeWkjeWvvOWFpeS6huWTpicpXFxuICAgICAgICAgICAgICAgICAgICAgICAgQnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBpZiAoQnJlYWspIHtcXG4gICAgICAgICAgICAgICAgICAgIE5ldEVhc2UucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogTmV0RWFzZU1hcC5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpY1VybDogTmV0RWFzZU1hcC5jb3ZlckltZ1VybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQ6IE5ldEVhc2VNYXAuaWRcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlIE11c2ljTWFwWzFdOlxcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQuc3RhcnRzV2l0aChNdXNpY01hcFsxXSkpIHtcXG4gICAgICAgICAgICAgICAgICAgIG1pZCA9IGlucHV0Lm1hdGNoKC9bQS1aYS16MC05Ky89XSskLylbMF1cXG4gICAgICAgICAgICAgICAgICAgIG1pZCA9IGJhc2U2NERlY29kZShtaWQpXFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQuc2VhcmNoKCdxcS5jb20nKSA+PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBtaWQgPSBpbnB1dC5tYXRjaCgvaWQ9KFxcXFxkKykvKVsxXVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIFRlbmNlbnRNYXAgPSBUZW5jZW50Q29uZmlnKE51bWJlcihtaWQpKS5Tb25nbGlzdC5kYXRhLmRpcmluZm9cXG4gICAgICAgICAgICAgICAgQnJlYWsgPSB0cnVlXFxuICAgICAgICAgICAgICAgIFRlbmNlbnQuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLm1pZCA9PSBUZW5jZW50TWFwLmlkKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+atjOWNlemHjeWkjeWvvOWFpeS6huWTpicpXFxuICAgICAgICAgICAgICAgICAgICAgICAgQnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBpZiAoQnJlYWspIHtcXG4gICAgICAgICAgICAgICAgICAgIFRlbmNlbnQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogVGVuY2VudE1hcC50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwaWNVcmw6IFRlbmNlbnRNYXAucGljdXJsLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZDogVGVuY2VudE1hcC5pZFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMl06XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdGFydHNXaXRoKE11c2ljTWFwWzJdKSkge1xcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gaW5wdXQubWF0Y2goL1tBLVphLXowLTkrLz1dKyQvKVswXVxcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gYmFzZTY0RGVjb2RlKG1pZClcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dC5zZWFyY2goJ2t1d28uY24nKSA+PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBtaWQgPSBpbnB1dC5tYXRjaCgvKHBsYXlsaXN0XFxcXC98cGxheWxpc3RfZGV0YWlsXFxcXC8pKFxcXFxkKykvKVsyXVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIEt3bXVzaWNjYXJVcmwgPSAnbXVzaWMvcGxheWxpc3QvJyArIG1pZCArICc/cG49MSZybj0yMCZ1YT0maXA9J1xcbiAgICAgICAgICAgICAgICBLd211c2ljY2FyTWFwID0gS3dtdXNpY2NhckNvbmZpZyhLd211c2ljY2FyVXJsKVxcbiAgICAgICAgICAgICAgICBCcmVhayA9IHRydWVcXG4gICAgICAgICAgICAgICAgS3dtdXNpY2Nhci5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0ubWlkID09IEt3bXVzaWNjYXJNYXAuaWQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn5q2M5Y2V6YeN5aSN5a+85YWl5LqG5ZOmJylcXG4gICAgICAgICAgICAgICAgICAgICAgICBCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIGlmIChCcmVhaykge1xcbiAgICAgICAgICAgICAgICAgICAgS3dtdXNpY2Nhci5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBLd211c2ljY2FyTWFwLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGljVXJsOiBLd211c2ljY2FyTWFwLnBpYyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQ6IEt3bXVzaWNjYXJNYXAuaWRcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlIE11c2ljTWFwWzNdOlxcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN0YXJ0c1dpdGgoTXVzaWNNYXBbM10pKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgSW5wdXQgPSBpbnB1dC5tYXRjaCgvW0EtWmEtejAtOSsvPV0rJC8pWzBdXFxuICAgICAgICAgICAgICAgICAgICAgICAgSW5wdXQgPSBiYXNlNjREZWNvZGUoSW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWlkID0gcGRmaChyZXF1ZXN0KElucHV0KSwgJ2JvZHkmJnNjcmlwdCwyJiZIdG1sJylcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBtaWQubWF0Y2goL3dpbmRvd1xcXFwuXFxcXCRvdXRwdXQgPSAoW1xcXFxTXFxcXHNdLiopOy8pWzFdXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0LnNlYXJjaCgna3Vnb3UuY29tJykgPj0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIElucHV0ID0gaW5wdXQubWF0Y2goLyhodHRwc3xodHRwKSguKmxpbmspLylbMF1cXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBwZGZoKHJlcXVlc3QoSW5wdXQpLCAnYm9keSYmc2NyaXB0LDImJkh0bWwnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZCA9IG1pZC5tYXRjaCgvd2luZG93XFxcXC5cXFxcJG91dHB1dCA9IChbXFxcXFNcXFxcc10uKik7LylbMV1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIEt1Z291TWFwID0gSlNPTi5wYXJzZShtaWQpLmluZm8ubGlzdGluZm9cXG4gICAgICAgICAgICAgICAgICAgIEJyZWFrID0gdHJ1ZVxcbiAgICAgICAgICAgICAgICAgICAgS3Vnb3UuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5taWQgPT0gSW5wdXQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+atjOWNlemHjeWkjeWvvOWFpeS6huWTpicpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJyZWFrID0gZmFsc2VcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKEJyZWFrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgS3Vnb3UucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IEt1Z291TWFwLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpY1VybDogS3Vnb3VNYXAucGljLnJlcGxhY2UoJ3tzaXplfScsICc0MDAnKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkOiBJbnB1dFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQuc3RhcnRzV2l0aChNdXNpY01hcFszXSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBpbnB1dC5tYXRjaCgvW0EtWmEtejAtOSsvPV0rJC8pWzBdXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWlkID0gYmFzZTY0RGVjb2RlKG1pZClcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQuc2VhcmNoKCdrdWdvdS5jb20nKSA+PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbWlkID0gaW5wdXQubWF0Y2goLyhcXFxcL2xpc3RcXFxcLykoLiopXFxcXC8vKVsyXVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgS3Vnb3VVcmwgPSAnaHR0cHM6Ly9tM3dzLmt1Z291LmNvbS9wbGlzdC9saXN0LycgKyBtaWRcXG4gICAgICAgICAgICAgICAgICAgIEt1Z291TWFwID0gcmVxdWVzdChLdWdvdVVybClcXG4gICAgICAgICAgICAgICAgICAgIEJyZWFrID0gdHJ1ZVxcbiAgICAgICAgICAgICAgICAgICAgS3Vnb3UuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5taWQgPT0gbWlkKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfmrYzljZXph43lpI3lr7zlhaXkuoblk6YnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIGlmIChCcmVhaykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIEt1Z291LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBwZGZoKEt1Z291TWFwLCAnLmNvbnRlbnQmJnAmJlRleHQnKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljVXJsOiBwZGZoKEt1Z291TWFwLCAnLmNvbnRlbnQmJmltZyYmX3NyYycpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWQ6IG1pZFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdGFydHNXaXRoKE11c2ljTWFwWzRdKSkge1xcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gaW5wdXQubWF0Y2goL1tBLVphLXowLTkrLz1dKyQvKVswXVxcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gYmFzZTY0RGVjb2RlKG1pZClcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dC5zZWFyY2goJ21pZ3UuY24nKSA+PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQuc3RhcnRzV2l0aCgn5YiG5LqrJykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBpbnB1dC5tYXRjaCgvKGh0dHBzfGh0dHApLiooXFxcXHcpLylbMF1cXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBKU09OLnBhcnNlKHJlcXVlc3QobWlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9ubHlIZWFkZXJzOiB0cnVlXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSkpLnVybFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZCA9IG1pZC5tYXRjaCgvKGlkPSkoXFxcXGQrKS8pWzJdXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZCA9IGlucHV0Lm1hdGNoKC8ocGxheWxpc3RcXFxcLykoXFxcXGQrKS8pWzJdXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgTWlndVVybCA9ICdNSUdVTTMuMC9yZXNvdXJjZS9wbGF5bGlzdC92Mi4wP3BsYXlsaXN0SWQ9JyArIG1pZFxcbiAgICAgICAgICAgICAgICBNaWd1TWFwID0gTWlndUNvbmZpZyhNaWd1VXJsKS5kYXRhXFxuICAgICAgICAgICAgICAgIEJyZWFrID0gdHJ1ZVxcbiAgICAgICAgICAgICAgICBNaWd1LmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5taWQgPT0gTWlndU1hcC5tdXNpY0xpc3RJZCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfmrYzljZXph43lpI3lr7zlhaXkuoblk6YnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIEJyZWFrID0gZmFsc2VcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgaWYgKEJyZWFrKSB7XFxuICAgICAgICAgICAgICAgICAgICBNaWd1LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IE1pZ3VNYXAudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGljVXJsOiBNaWd1TWFwLmltZ0l0ZW0uaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZDogTWlndU1hcC5tdXNpY0xpc3RJZFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIG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L3BsYXlsaXN0L2RldGFpbD9pZD0nICsgbWlkICsgJyZuPTEwMDAmbGltaXQ9MTAwMCdcXG4gICAgICAgICAgICAgICAgICAgICAgICBOZXRFYXNlTWFwID0gTmV0RWFzZUNvbmZpZyhOZXRFYXNlTWFwLCAnJywgJ0dFVCcpXFxuICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgTmV0RWFzZVBhcnNlKGxheW91dCwgTmV0RWFzZU1hcC5wbGF5bGlzdC50cmFja3MpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ4nICsgTmV0RWFzZU1hcC5tZXNzYWdlICsgJ++9nu+9nu+9nicpKSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGVtcHR5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICAgICAgICBUZW5jZW50TWFwID0gVGVuY2VudENvbmZpZyhtaWQpLlNvbmdsaXN0LmRhdGEuc29uZ2xpc3RcXG4gICAgICAgICAgICAgICAgICAgICAgICBUZW5jZW50UGFyc2UobGF5b3V0LCBUZW5jZW50TWFwKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHNldFJlc3VsdChsYXlvdXQpO1xcbiAgICAgICAgICAgIH0sIE11c2ljTWFwLCBtaWQsIG15bmFtZSlcXG4gICAgfVxcbiAgICByZXR1cm4gZW1wdHlcXG59XFxuXFxuY29uc3QgZ2V0U2VsZWN0TGlzdE1hcCA9IChTZWxlY3RNYXAsIGksIGl0ZW0pID0+IHtcXG4gICAgc3dpdGNoIChnZXRJdGVtKCdnZXRVcE1hcCcsIFNlbGVjdE1hcFtTZWxlY3RNYXAubGVuZ3RoIC0gMV0pKSB7XFxuICAgICAgICBjYXNlIFNlbGVjdE1hcFswXTpcXG4gICAgICAgICAgICBnZXRDb3B5ID0gc2hhcmVQYXN0ZShiYXNlNjRFbmNvZGUoSlNPTi5zdHJpbmdpZnkoaXRlbSkpKSArICdcXFxcblxcXFxu6Ieq5bu65q2M5Y2V77yaJyArIGl0ZW0ubmFtZVxcbiAgICAgICAgICAgIGNvcHkoZ2V0Q29weSlcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgICAgIGNhc2UgU2VsZWN0TWFwWzFdOlxcbiAgICAgICAgICAgIHB1dE15VmFyKCdpbmRleENvbmZpcm0nLCBpKVxcbiAgICAgICAgICAgIHJldHVybiAkKGVtcHR5KS5sYXp5UnVsZSgoZW1wdHkpID0+IHtcXG4gICAgICAgICAgICAgICAgY29uZmlybSh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuatjOWNleWIoOmZpFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFwi56Gu5a6a5aW95LqG5ZCX77yM6K+l5q2M5Y2V5bCG5Yig6ZmkXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGNvbmZpcm06ICgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpID0gZ2V0TXlWYXIoJ2luZGV4Q29uZmlybScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIGRhdGFNYXApXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3Quc3BsaWNlKGksIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfliKDpmaTmiJDlip8nKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5XFxuICAgICAgICAgICAgfSwgZW1wdHkpXFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICBjYXNlIFNlbGVjdE1hcFsyXTpcXG4gICAgICAgICAgICBwdXRNeVZhcignZ2V0TW92ZScsIGkpXFxuICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICBjYXNlIFNlbGVjdE1hcFszXTpcXG4gICAgICAgICAgICByZXR1cm4gJChlbXB0eSkucnVsZSgoaSwgaXRlbSwgbXluYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgIGxldCBsYXlvdXQgPSBbXTtcXG4gICAgICAgICAgICAgICAgZ2V0RWRpdFBhcnNlKGxheW91dCwgaSwgaXRlbSlcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxuICAgICAgICAgICAgfSwgaSwgaXRlbSwgbXluYW1lKVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICByZXR1cm4gJChlbXB0eSkucnVsZSgoaSwgbXluYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgIGxldCBsYXlvdXQgPSBbXTtcXG4gICAgICAgICAgICAgICAgQnVpbGRMaXN0UGFyc2UobGF5b3V0LCBpKVxcbiAgICAgICAgICAgICAgICBzZXRSZXN1bHQobGF5b3V0KTtcXG4gICAgICAgICAgICB9LCBpLCBteW5hbWUpXFxuICAgIH1cXG4gICAgcmV0dXJuIGVtcHR5XFxufVxcblxcbmNvbnN0IGdldFNlbGVjdExpc3RJbXBvcnQgPSAoaW5wdXQpID0+IHtcXG4gICAgbGV0IGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgIGxldCBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxuICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcbiAgICBsZXQgQnVpbGRMaXN0ID0gZGF0YU1hcC5CdWlsZExpc3RcXG4gICAgaWYgKGlucHV0LmluZGV4T2YoJ+iHquW7uuatjOWNlScpID4gMCkge1xcbiAgICAgICAgaW5wdXQgPSBpbnB1dC5tYXRjaCgvKGh0dHBzfGh0dHApLiooXFxcXHcpLylbMF1cXG4gICAgICAgIGRhdGEgPSBwYXJzZVBhc3RlKGlucHV0KVxcbiAgICAgICAgZGF0YSA9IGJhc2U2NERlY29kZShkYXRhKVxcbiAgICAgICAgZXZhbCgnZGF0YSA9JyArIGRhdGEpXFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcign6Ieq5bu65q2M5Y2VJywgZGF0YSlcXG4gICAgICAgIEJyZWFrID0gdHJ1ZVxcbiAgICAgICAgQnVpbGRMaXN0LmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgICAgICBpZiAoaXRlbS5uYW1lID09IGRhdGEubmFtZSkge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleCcsIGkpXFxuICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmrYzljZXopobnm5ZcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcIuehruWumuWlveS6huWQl++8jOivpeatjOWNleWwhuimhuebllxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgQnVpbGRMaXN0ID0gZGF0YU1hcC5CdWlsZExpc3RcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IHN0b3JhZ2UwLmdldE15VmFyKCfoh6rlu7rmrYzljZUnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIEJ1aWxkTGlzdFtnZXRNeVZhcignQnJlYWtJbmRleCcpXSA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZGF0YS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNzOiBkYXRhLnBpY3MsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEuZGF0YVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIEJyZWFrID0gZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgaWYgKEJyZWFrKSB7XFxuICAgICAgICAgICAgQnVpbGRMaXN0LnB1c2goe1xcbiAgICAgICAgICAgICAgICBuYW1lOiBkYXRhLm5hbWUsXFxuICAgICAgICAgICAgICAgIHBpY3M6IGRhdGEucGljcyxcXG4gICAgICAgICAgICAgICAgZGF0YTogZGF0YS5kYXRhXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxuICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICB9XFxuICAgIH0gZWxzZSB7XFxuICAgICAgICB0b2FzdCgn5a+85YWl5aSx6LSlJylcXG4gICAgfVxcbn1cXG5cXG5jb25zdCBnZXRCYXNlUGFyc2UgPSAoKSA9PiB7XFxuICAgIE11c2ljTWFwID0gWyfmiJHnmoTmrYzljZUnLCAn5q2M5Y2V5pS26JePJywgJ+iHquW7uuatjOWNlScsICfpn7PkuZDoj5zljZUnXTtcXG4gICAgY29uc3QgbGF5b3V0ID0gW107XFxuICAgIGdldFNlYXJjaFBhcnNlKGxheW91dClcXG4gICAgTXVzaWNNYXAuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogaXRlbSA9PSBnZXRNeVZhcignTXVzaWNNYXAnLCBNdXNpY01hcFswXSkgPyBSaWNoKFN0cm9uZyhDb2xvcihpdGVtKSkpIDogaXRlbSxcXG4gICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGl0ZW0sIGVtcHR5LCBteW5hbWUsIE11c2ljTWFwKSA9PiB7XFxuICAgICAgICAgICAgICAgIHN3aXRjaCAoaXRlbSkge1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFtNdXNpY01hcC5sZW5ndGggLSAxXTpcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cE1hcCA9IFsn5q2M5Y2V5qC35byPJ11cXG4gICAgICAgICAgICAgICAgICAgICAgICB1cHNNYXAgPSBzdG9yYWdlMC5nZXRNeVZhcignU2VhcmNoTXVzaWNNYXAnLCBbJ+iBmuWQiOaQnOe0oiddKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2VNYXAgPSBzdG9yYWdlMC5nZXRNeVZhcignU2VsZWN0TWFwJylcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cE1hcCA9IHN0b3JhZ2VNYXAuY29uY2F0KHVwc01hcC5jb25jYXQodXBNYXApKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKHVwTWFwLCAyLCAn5bey6YCJ5oupLScgKyAnWycgKyBnZXRJdGVtKCdnZXRVcE1hcCcsIHN0b3JhZ2VNYXBbc3RvcmFnZU1hcC5sZW5ndGggLSAxXSkgKyAnXScpLnNlbGVjdCgodXBNYXAsIGVtcHR5LCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChpbnB1dCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB1cE1hcFt1cE1hcC5sZW5ndGggLSAxXTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChnZXRDb2xUeXBlcygpLCAyLCAn5bey6YCJ5oupLScgKyAnWycgKyBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJykgKyAnXScpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oJ2dldENvbFR5cGVzJywgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfliIfmjaLmoLflvI8tJyArIGlucHV0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHVwTWFwW3VwTWFwLmxlbmd0aCAtIDJdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bk1hcCA9IFsn6IGa5ZCI5pCc57SiJ11cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5zTWFwID0gWyfljp/nlJ/mkJzntKInXVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3RvcmFnZTAuZ2V0TXlWYXIoJ1NlYXJjaE11c2ljTWFwJywgZnVuTWFwKVswXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIGZ1bk1hcFswXTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdTZWFyY2hNdXNpY01hcCcsIGZ1bnNNYXApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignU2VhcmNoTXVzaWNNYXAnLCBmdW5NYXApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAn5Yib5bu65q2M5Y2VJzpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChlbXB0eSkucnVsZSgobXluYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZSgn5Yib5bu65q2M5Y2VJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGxheW91dCA9IFtdO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDcmVhdGVMaXN0UGFyc2UobGF5b3V0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQobGF5b3V0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oJ2dldFVwTWFwJywgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+WIh+aNouaWueazlS0nICsgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXBNYXAsIGVtcHR5LCBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdNdXNpY01hcCcsIGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFySXRlbSgnZ2V0VXBNYXAnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSwgaXRlbSwgZW1wdHksIG15bmFtZSwgTXVzaWNNYXApLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcXG4gICAgICAgIH0pXFxuICAgIH0pXFxuICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxuICAgIH0pXFxuICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ011c2ljTWFwJywgTXVzaWNNYXBbMF0pKSB7XFxuICAgICAgICBjYXNlIE11c2ljTWFwWz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ICAgICAgICAgICAgcHV0TXlWYXIoJ011c2ljTXlNYXAnLCBpdGVtKTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcbiAgICAgICAgICAgIH0sIGl0ZW0sIGVtcHR5KSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nXFxuICAgICAgICB9KVxcbiAgICB9KVxcbiAgICBhZGRMaXN0ZW5lcignb25SZWZyZXNoJywgJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfms6jplIAnLCAnMCcpKSB7XFxuICAgICAgICAgICAgY2FzZSAnMCc6XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfms6jplIAnLCAxKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+azqOmUgCcsIDApO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgIH1cXG4gICAgfSkpO1xcbiAgICBzd2l0Y2ggKGdldE15VmFyKCdNdXNpY015TWFwJywgTXVzaWNNYXBbMF0pKSB7XFxuICAgICAgICBjYXNlIE11c2ljTWFwWzBdOlxcbiAgICAgICAgICAgIGdldE5ldEVhc2VQYXJzZShsYXlvdXQsIGRhdGFNYXAsIE11c2ljTWFwKVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICBnZXRUZW5jZW50UGFyc2UobGF5b3V0LCBkYXRhTWFwLCBNdXNpY01hcClcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgfVxcbn1cXG5cXG5jb25zdCBnZXRCdWlsZE11c2ljUGFyc2UgPSAobGF5b3V0KSA9PiB7XFxuICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2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wLCBTZWxlY3RNYXAsIGksIG1pZCwgbmFtZSlcXG4gICAgICAgIH0sIE11c2ljTWFwLCBTZWxlY3RNYXAsIGksIGl0ZW0ubWlkLCBpdGVtLm5hbWUsIG15bmFtZSlcXG4gICAgICAgIGlmIChnZXRNeVZhcignZ2V0TW92ZScsICcnKSkge1xcbiAgICAgICAgICAgIGlmIChnZXRNeVZhcignZ2V0TW92ZScsICcnKSA9PSBpKSB7XFxuICAgICAgICAgICAgICAgIG5hbWUgPSBSaWNoKFNtYWxsKFNwcmluZ0dyZWVuKG5hbWUpKSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgc2VsZWN0ID0gJChlbXB0eSkubGF6eVJ1bGUoKE11c2ljTWFwLCBpLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIHJlYWRGaWxlKGRvd24pKVxcbiAgICAgICAgICAgICAgICBpbmRleCA9IE51bWJlcihnZXRNeVZhcignZ2V0TW92ZScpKVxcbiAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCdCdWlsZE11c2ljJywgTXVzaWNNYXBbMF0pKSB7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzBdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGdldE1vdmUoZGF0YU1hcC5CdWlsZE11c2ljLk5ldEVhc2UsIGluZGV4LCBpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsxXTpcXG4gICAgICAgICAgICAgICAgICAgICAgICBnZXRNb3ZlKGRhdGFNYXAuQnVpbGRNdXNpYy5UZW5jZW50LCBpbmRleCwgaSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMl06XFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TW92ZShkYXRhTWFwLkJ1aWxkTXVzaWMuS3dtdXNpY2NhciwgaW5kZXgsIGkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzNdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGdldE1vdmUoZGF0YU1hcC5CdWlsZE11c2ljLkt1Z291LCBpbmRleCwgaSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TW92ZShkYXRhTWFwLkJ1aWxkTXVzaWMuTWlndSwgaW5kZXgsIGkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdnZXRNb3ZlJylcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcbiAgICAgICAgICAgIH0sIE11c2ljTWFwLCBpLCBteW5hbWUpXFxuICAgICAgICB9XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IG5hbWUsXFxuICAgICAgICAgICAgaW1nOiBpdGVtLnBpY1VybCxcXG4gICAgICAgICAgICB1cmw6IHNlbGVjdCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2NhcmRfcGljXzMnLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5q2M5Y2V5YiG5LqrJyxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChNdXNpY01hcCwgbWlkLCBuYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29weSA9IGdldE15VmFyKCdCdWlsZE11c2ljJywgTXVzaWNNYXBbMF0pICsgJ1xcXFxu5q2M5Y2V5ZCN56ew77yaJyArIG5hbWUgKyAnXFxcXG7mrYzljZXor4bliKvvvJonICsgYmFzZTY0RW5jb2RlKCcnICsgbWlkICsgJycpXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29weShnZXRDb3B5KVxcbiAgICAgICAgICAgICAgICAgICAgfSwgTXVzaWNNYXAsIGl0ZW0ubWlkLCBpdGVtLm5hbWUpXFxuICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5Yig6Zmk5q2M5Y2VJyxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChNdXNpY01hcCwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdNdXNpY01hcENvbmZpcm0nLCBNdXNpY01hcClcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignaW5kZXhDb25maXJtJywgaSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmrYzljZXliKDpmaRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFwi56Gu5a6a5aW95LqG5ZCX77yM6K+l5q2M5Y2V5bCG5Yig6ZmkXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXVzaWNNYXAgPSBzdG9yYWdlMC5nZXRNeVZhcignTXVzaWNNYXBDb25maXJtJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBnZXRNeVZhcignaW5kZXhDb25maXJtJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ0J1aWxkTXVzaWMnLCBNdXNpY01hcFswXSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzBdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTXVzaWMuTmV0RWFzZS5zcGxpY2UoaSwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsxXTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZE11c2ljLlRlbmNlbnQuc3BsaWNlKGksIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMl06XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRNdXNpYy5Ld211c2ljY2FyLnNwbGljZShpLCAxKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzNdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTXVzaWMuS3Vnb3Uuc3BsaWNlKGksIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRNdXNpYy5NaWd1LnNwbGljZShpLCAxKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+WIoOmZpOaIkOWKnycpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH0sIE11c2ljTWFwLCBpKVxcbiAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+e9rumhtuatjOWNlScsXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygobmFtZSwgTXVzaWNNYXApID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgcmVhZEZpbGUoZG93bikpXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChnZXRNeVZhcignQnVpbGRNdXNpYycsIE11c2ljTWFwWzBdKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzBdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGRhdGFNYXAuQnVpbGRNdXNpYy5OZXRFYXNlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsxXTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuVGVuY2VudFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMl06XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZGF0YU1hcC5CdWlsZE11c2ljLkt3bXVzaWNjYXJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzNdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGRhdGFNYXAuQnVpbGRNdXNpYy5LdWdvdVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZGF0YU1hcC5CdWlsZE11c2ljLk1pZ3VcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgb2JqID0ge307XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5uYW1lID09PSBuYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmogPSBpdGVtO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5zcGxpY2UoaW5kZXgsIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEudW5zaGlmdChvYmopO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXG4gICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0ubmFtZSwgTXVzaWNNYXApXFxuICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn572u5bqV5q2M5Y2VJyxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChuYW1lLCBNdXNpY01hcCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyByZWFkRmlsZShkb3duKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCdCdWlsZE11c2ljJywgTXVzaWNNYXBbMF0pKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMF06XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZGF0YU1hcC5CdWlsZE11c2ljLk5ldEVhc2VcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzFdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGRhdGFNYXAuQnVpbGRNdXNpYy5UZW5jZW50XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsyXTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuS3dtdXNpY2NhclxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbM106XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZGF0YU1hcC5CdWlsZE11c2ljLkt1Z291XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuTWlndVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBvYmogPSB7fTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLmZvckVhY2goKGl0ZW0sIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLm5hbWUgPT09IG5hbWUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iaiA9IGl0ZW07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnNwbGljZShpbmRleCwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5wdXNoKG9iaik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgfSwgaXRlbS5uYW1lLCBNdXNpY01hcClcXG4gICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9KVxcbiAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ+atjOWNleWvvOWFpScsXFxuICAgICAgICBpbWc6ICdodHRwczovL21pc3N1by5ydS9maWxlLzFlYjYyMTlkYjg2MzI0MjhhMjM5Ni5qcGcnLFxcbiAgICAgICAgdXJsOiAkKCd7e2NsaXBib2FyZH19JykuaW5wdXQoKE11c2ljTWFwLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ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ICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgcmV0dXJuIGdldFNlbGVjdExpc3RNYXAoU2VsZWN0TWFwLCBpLCBpdGVtKVxcbiAgICAgICAgfSwgU2VsZWN0TWFwLCBpLCBpdGVtLCBteW5hbWUpXFxuICAgICAgICBpZiAoZ2V0TXlWYXIoJ2dldE1vdmUnLCAnJykpIHtcXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoJ2dldE1vdmUnLCAnJykgPT0gaSkge1xcbiAgICAgICAgICAgICAgICBuYW1lID0gUmljaChTbWFsbChTcHJpbmdHcmVlbihuYW1lKSkpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHNlbGVjdCA9ICQoZW1wdHkpLmxhenlSdWxlKChpLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIHJlYWRGaWxlKGRvd24pKVxcbiAgICAgICAgICAgICAgICBpbmRleCA9IE51bWJlcihnZXRNeVZhcignZ2V0TW92ZScpKVxcbiAgICAgICAgICAgICAgICBnZXRNb3ZlKGRhdGFNYXAuQnVpbGRMaXN0LCBpbmRleCwgaSlcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdnZXRNb3ZlJylcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcbiAgICAgICAgICAgIH0sIGksIG15bmFtZSlcXG4gICAgICAgIH1cXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogbmFtZSxcXG4gICAgICAgICAgICBpbWc6IGl0ZW0ucGljcyxcXG4gICAgICAgICAgICB1cmw6IHNlbGVjdCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2NhcmRfcGljXzMnLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5q2M5Y2V5YiG5LqrJyxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29weSA9IHNoYXJlUGFzdGUoYmFzZTY0RW5jb2RlKEpTT04uc3RyaW5naWZ5KGl0ZW0pKSkgKyAnXFxcXG5cXFxcbuiHquW7uuatjOWNle+8micgKyBpdGVtLm5hbWVcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb3B5KGdldENvcHkpXFxuICAgICAgICAgICAgICAgICAgICB9LCBpdGVtKVxcbiAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+WIoOmZpOatjOWNlScsXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdpbmRleENvbmZpcm0nLCBpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuatjOWNleWIoOmZpFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLnoa7lrprlpb3kuoblkJfvvIzor6XmrYzljZXlsIbliKDpmaRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gZ2V0TXlWYXIoJ2luZGV4Q29uZmlybScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcCA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIGRhdGFNYXApXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdC5zcGxpY2UoaSwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+WIoOmZpOaIkOWKnycpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH0sIGkpXFxuICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn572u6aG25q2M5Y2VJyxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChuYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIHJlYWRGaWxlKGRvd24pKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBvYmogPSB7fTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdC5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5uYW1lID09PSBuYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmogPSBpdGVtO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3Quc3BsaWNlKGluZGV4LCAxKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdC51bnNoaWZ0KG9iaik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgfSwgaXRlbS5uYW1lKVxcbiAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+e9ruW6leatjOWNlScsXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygobmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyByZWFkRmlsZShkb3duKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgb2JqID0ge307XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3QuZm9yRWFjaCgoaXRlbSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0ubmFtZSA9PT0gbmFtZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2JqID0gaXRlbTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0LnNwbGljZShpbmRleCwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3QucHVzaChvYmopO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXG4gICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0ubmFtZSlcXG4gICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9KVxcbiAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICB0aXRsZTogJ+atjOWNleWvvOWFpScsXFxuICAgICAgICBpbWc6ICdodHRwczovL21pc3N1by5ydS9maWxlLzFlYjYyMTlkYjg2MzI0MjhhMjM5Ni5qcGcnLFxcbiAgICAgICAgdXJsOiAkKCd7e2NsaXBib2FyZH19JykuaW5wdXQoKG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgcmV0dXJuIGdldFNlbGVjdExpc3RJbXBvcnQoaW5wdXQpXFxuICAgICAgICB9LCBteW5hbWUpLFxcbiAgICAgICAgY29sX3R5cGU6ICdjYXJkX3BpY18zJ1xcbiAgICB9KVxcbn1cXG5cXG5jb25zdCBnZXROZXRFYXNlUGFyc2UgPSAobGF5b3V0LCBkYXRhTWFwLCBNdXNpY01hcCkgPT4ge1xcbiAgICBOZXRFYXNlTWFwID0gZGF0YU1hcC5OZXRFYXNlXFxuICAgIGlmIChOZXRFYXNlTWFwID09IG51bGwgfHwgTmV0RWFzZU1hcC5sZW5ndGggPT0gMCkge1xcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAn5p+lXFxcXG7or6InLFxcbiAgICAgICAgICAgIGRlc2M6IFxcXCLovpPlhaXlhbPplK7or43mn6Xor6LnlKjmiLdcXFwiLFxcbiAgICAgICAgICAgIHVybDogJC50b1N0cmluZygoZW1wdHkpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+WFs+mUruivjScsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcbiAgICAgICAgICAgIH0sIGVtcHR5KSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2lucHV0JyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICB0eXBlOiAndGV4dGFyZWEnLFxcbiAgICAgICAgICAgICAgICBoZWlnaHQ6IDMsXFxuICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoJ+WFs+mUruivjScpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmIChnZXRNeVZhcign5YWz6ZSu6K+NJywgJycpICE9ICcnKSB7XFxuICAgICAgICAgICAgcGF0aCA9ICcvd2VhcGkvc2VhcmNoL2dldCdcXG4gICAgICAgICAgICBib2R5ID0ge1xcbiAgICAgICAgICAgICAgICBcXFwic1xcXCI6IGdldE15VmFyKCflhbPplK7or40nKSxcXG4gICAgICAgICAgICAgICAgXFxcInR5cGVcXFwiOiAxMDAyLFxcbiAgICAgICAgICAgICAgICBcXFwibGltaXRcXFwiOiAzMCxcXG4gICAgICAgICAgICAgICAgXFxcIm9mZnNldFxcXCI6IDBcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZGF0YSA9IE5ldEVhc2VDb25maWcocGF0aCwgYm9keSwgJ1BPU1QnKVxcbiAgICAgICAgICAgIGRhdGEucmVzdWx0LnVzZXJwcm9maWxlcy5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5uaWNrbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaXRlbS5hdmF0YXJVcmwsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQoZW1wdHkpLmxhenlSdWxlKChlbXB0eSwgdXNlcklkKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YSA9JyArIGRhdGEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5OZXRFYXNlID0gW11cXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhLk5ldEVhc2UucHVzaCh1c2VySWQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlK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pZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ3N3aXRjaCcpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldE15U2VsZWN0TWFwKE11c2ljTWFwLCBTZWxlY3RNYXAsIG1pZCwgbmFtZSwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICB9LCBNdXNpY01hcCwgU2VsZWN0TWFwLCBpdGVtLmlkLCBpdGVtLm5hbWUsIG15bmFtZSksXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2NhcmRfcGljXzMnLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmrYzljZXliIbkuqsnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoTXVzaWNNYXAsIG1pZCwgbmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29weSA9IGdldE15VmFyKCdNdXNpY015TWFwJywgTXVzaWNNYXBbMF0pICsgJ1xcXFxu5q2M5Y2V5ZCN56ew77yaJyArIG5hbWUgKyAnXFxcXG7mrYzljZXor4bliKvvvJonICsgYmFzZTY0RW5jb2RlKCcnICsgbWlkICsgJycpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3B5KGdldENvcHkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE11c2ljTWFwLCBpdGVtLmlkLCBpdGVtLm5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgaWYgKGdldE15VmFyKCfms6jplIAnLCAnMCcpID09IDEpIHtcXG4gICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBSaWNoKFNtYWxsKEdyYXkoJ++9nu+9nu+9nuazqOmUgOe7keWumu+9nu+9nu+9nicpKSksXFxuICAgICAgICAgICAgICAgIHVybDogJChlbXB0eSkubGF6eVJ1bGUoKGVtcHR5KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgICAgICAgICAgZGF0YSA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YSA9JyArIGRhdGEpXFxuICAgICAgICAgICAgICAgICAgICBkYXRhLk5ldEVhc2UgPSBbXVxcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcign5rOo6ZSAJylcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcbiAgICAgICAgICAgICAgICB9LCBlbXB0eSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgIH1cXG59XFxuXFxuY29uc3QgZ2V0VGVuY2VudFBhcnNlID0gKGxheW91dCwgZGF0YU1hcCwgTXVzaWNNYXApID0+IHtcXG4gICAgVGVuY2VudE1hcCA9IGRhdGFNYXAuVGVuY2VudFxcbiAgICBpZiAoVGVuY2VudE1hcCA9PSBudWxsIHx8IFRlbmNlbnRNYXAubGVuZ3RoID09IDApIHtcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICBkZXNjOiBcXFwi6K+36L6T5YWl5oKo55qEUVHlj7dcXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIHR5cGU6ICd0ZXh0YXJlYScsXFxuICAgICAgICAgICAgICAgIGhlaWdodDogMyxcXG4gICAgICAgICAgICAgICAgb25DaGFuZ2U6IFxcXCJzZXRJdGVtKCdRUScsIGlucHV0KVxcXCIsXFxuICAgICAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgdGl0bGU6IFJpY2goU3Ryb25nKEdyYXkoJ+e7keWumui0puWPtycpKSksXFxuICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoZW1wdHkpID0+IHtcXG4gICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgZGF0YSA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICAgICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXG4gICAgICAgICAgICAgICAgZGF0YS5UZW5jZW50ID0gW11cXG4gICAgICAgICAgICAgICAgZGF0YS5UZW5jZW50LnB1c2goZ2V0SXRlbSgnUVEnKSlcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcbiAgICAgICAgICAgIH0sIGVtcHR5KSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgIH0gZWxzZSB7XFxuICAgICAgICBUZW5jZW50VXJsID0gJ2h0dHA6Ly9jLnkucXEuY29tL3JzYy9mY2dpLWJpbi9mY2dfdXNlcl9jcmVhdGVkX2Rpc3M/aG9zdHVpbj0nICsgZGF0YU1hcC5UZW5jZW50WzBdICsgJyZzaXplPTEwMDAmZm9ybWF0PWpzb24nXFxuICAgICAgICBUZW5jZW50TWFwID0gVGVuY2VudENvbmZpZyhUZW5jZW50VXJsKVxcbiAgICAgICAgU2VsZWN0TWFwID0gWyfmrYzljZXliIbkuqsnLCAn5p+l55yL5YaF5a65J11cXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdTZWxlY3RNYXAnLCBTZWxlY3RNYXApXFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIFRlbmNlbnRNYXAgPSBUZW5jZW50TWFwLmRhdGEuZGlzc2xpc3RcXG4gICAgICAgICAgICBUZW5jZW50TWFwID0gVGVuY2VudE1hcC5maWx0ZXIoaXRlbSA9PiBpdGVtLnRpZCAhPSAwKVxcbiAgICAgICAgICAgIGlmIChUZW5jZW50TWFwLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgVGVuY2VudE1hcC5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLmRpc3NfbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbWc6IGl0ZW0uZGlzc19jb3ZlcixcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoZW1wdHkgKyAnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoTXVzaWNNYXAsIFNlbGVjdE1hcCwgbWlkLCBuYW1lLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignc3dpdGNoJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldE15U2VsZWN0TWFwKE11c2ljTWFwLCBTZWxlY3RNYXAsIG1pZCwgbmFtZSwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgTXVzaWNNYXAsIFNlbGVjdE1hcCwgaXRlbS50aWQsIGl0ZW0uZGlzc19uYW1lLCBteW5hbWUpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnY2FyZF9waWNfMycsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmrYzljZXliIbkuqsnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKE11c2ljTWFwLCBtaWQsIG5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb3B5ID0gZ2V0TXlWYXIoJ011c2ljTXlNYXAnLCBNdXNpY01hcFswXSkgKyAnXFxcXG7mrYzljZXlkI3np7DvvJonICsgbmFtZSArICdcXFxcbuatjOWNleivhuWIq++8micgKyBiYXNlNjRFbmNvZGUoJycgKyBtaWQgKyAnJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3B5KGdldENvcHkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBNdXNpY01hcCwgaXRlbS50aWQsIGl0ZW0uZGlzc19uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFJpY2goU21hbGwoR3JheSgn772e772e772e5ZWl5Lmf5rKh5pyJ55WZ5LiL772e772e772eJykpKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogZW1wdHksXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ4nICsgVGVuY2VudE1hcC5tZXNzYWdlICsgJ++9nu+9nu+9nicpKSksXFxuICAgICAgICAgICAgICAgIHVybDogZW1wdHksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgICAgICBpZiAoZ2V0TXlWYXIoJ+azqOmUgCcsICcwJykgPT0gMSkge1xcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFJpY2goU21hbGwoR3JheSgn772e772e772e5rOo6ZSA57uR5a6a772e772e772eJykpKSxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoZW1wdHkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICBkYXRhID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXG4gICAgICAgICAgICAgICAgICAgIGRhdGEuVGVuY2VudCA9IFtdXFxuICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCfms6jplIAnKVxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5XFxuICAgICAgICAgICAgICAgIH0sIGVtcHR5KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgfVxcbn1cXG5cXG5jb25zdCBnZXRDb25maXJtID0gKCkgPT4ge1xcbiAgICBpZiAoIWdldE15VmFyKCflpLHotKUnKSkge1xcbiAgICAgICAgY29uZmlybSh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLmkJzntKLmrYzmm7JcXFwiLFxcbiAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLoi6XlhY3ll4XlpLHotKXvvIzlsIbmkJzntKLmrYzmm7JcXFwiLFxcbiAgICAgICAgICAgIGNvbmZpcm06ICgpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+Wksei0pScsIHRydWUpO1xcbiAgICAgICAgICAgICAgICB0b2FzdCgnZW1tbX4nKTtcXG4gICAgICAgICAgICAgICAgamF2YS5sYW5nLlRocmVhZC5zbGVlcCgzMDAwKTtcXG4gICAgICAgICAgICAgICAgdG9hc3QoJ+S4i+asoemHjeWQr++8jOWwhumHjeaWsOaLieWQr+W8ueeqlycpXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICBjYW5jZWw6ICgpID0+IHtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+Wksei0pScsIGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgdG9hc3QoJ+S/uuS4jeimgeODvSjiiafQlOKJpinjg45+Jyk7XFxuICAgICAgICAgICAgICAgIGphdmEubGFuZy5UaHJlYWQuc2xlZXAoMzAwMCk7XFxuICAgICAgICAgICAgICAgIHRvYXN0KCfkuIvmrKHph43lkK/vvIzlsIbph43mlrDmi4nlkK/lvLnnqpcnKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgIH1cXG59XFxuXFxuY29uc3QgZ2V0SW5jbHVkZWRQYXJzZSA9IChsYXlvdXQpID0+IHtcXG4gICAgZ2V0Q29uZmlybSgpXFxuICAgIGFkZExpc3RlbmVyKCdvblJlZnJlc2gnLCAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ+abtOWkmicsICcwJykpIHtcXG4gICAgICAgICAgICBjYXNlICcwJzpcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+abtOWkmicsIDEpO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcign5pu05aSaJywgMCk7XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgfVxcbiAgICB9KSk7XFxuICAgIGFkZExpc3RlbmVyKCdvbkNsb3NlJywgKCkgPT4ge1xcbiAgICAgICAgY2xlYXJNeVZhcign5pu05aSaJylcXG4gICAgfSlcXG4gICAgU2VsZWN0TWFwID0gWyfmlLblvZXmrYzmm7InLCAn6IGG5ZCs5q2M5puyJ11cXG4gICAgaWYgKGdldE15VmFyKCfmm7TlpJonLCAnMCcpID09IDEgJiYgTVlfUEFHRSA9PSAxKSB7XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lX2JsYW5rJ1xcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIHRpdGxlOiBSaWNoKFNtYWxsKEdyYXkoJ++9nu+9nu+9nuabtOWkmumAiemhue+9nu+9nu+9nicpKSksXFxuICAgICAgICAgICAgdXJsOiAkKFNlbGVjdE1hcCwgMSwgJ+W3sumAieaLqS0nICsgJ1snICsgZ2V0TXlWYXIoJ+abtOWkmuWKn+iDvScsIFNlbGVjdE1hcFtTZWxlY3RNYXAubGVuZ3RoIC0gMV0pICsgJ10nKS5zZWxlY3QoKGVtcHR5KSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfmm7TlpJrlip/og70nLCBpbnB1dClcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXG4gICAgICAgICAgICB9LCBlbXB0eSksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVml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uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICBsZXQgbGF5b3V0ID0gW107XFxuICAgICAgICAgICAgICAgIENyZWF0ZUxpc3RQYXJzZShsYXlvdXQpXFxuICAgICAgICAgICAgICAgIHNldFJlc3VsdChsYXlvdXQpO1xcbiAgICAgICAgICAgIH0sIG15bmFtZSlcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICBkYXRhID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgZXZhbCgnZGF0YSA9JyArIGRhdGEpXFxuICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0LmZvckVhY2goKEl0ZW0sIHgpID0+IHtcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09IEl0ZW0ubmFtZSkge1xcbiAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSB0cnVlXFxuICAgICAgICAgICAgICAgICAgICBpbmRleCA9IHhcXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCfoh6rlu7rmrYzljZUnLCBpdGVtKVxcbiAgICAgICAgICAgICAgICAgICAgSXRlbS5kYXRhLmZvckVhY2goKEl0ZW1zLCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEl0ZW1zLm1pZCA9PSBpdGVtLmlkICYmIEl0ZW1zLmlkID09ICduZXRlYXNlJykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleCcsIGluZGV4KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleHMnLCBpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5pS25b2V6KaG55uWXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLnoa7lrprlpb3kuoblkJfvvIzmrYzmm7LlsIbopobnm5bljp/mnInnmoRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIGRhdGFNYXApXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IEJ1aWxkTGlzdCA9IGRhdGFNYXAuQnVpbGRMaXN0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0ID0gQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4JyldLmRhdGFcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IHN0b3JhZ2UwLmdldE15VmFyKCfoh6rlu7rmrYzljZUnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnQgPSBkYXRhLmFyLm1hcCh0YWcgPT4gdGFnLm5hbWUpLmpvaW4oJ+OAgScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4cycpXSA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZGF0YS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250OiBjb250LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNzOiBkYXRhLmFsLnBpY1VybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkOiBkYXRhLmlkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ25ldGVhc2UnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn6KaG55uW5oiQ5YqfJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGlmIChnZXRCcmVhaykge1xcbiAgICAgICAgICAgICAgICBjb250ID0gaXRlbS5hci5tYXAodGFnID0+IHRhZy5uYW1lKS5qb2luKCfjgIEnKVxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdFtpbmRleF0uZGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWU6IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnQ6IGNvbnQsXFxuICAgICAgICAgICAgICAgICAgICBwaWNzOiBpdGVtLmFsLnBpY1VybCxcXG4gICAgICAgICAgICAgICAgICAgIG1pZDogaXRlbS5pZCxcXG4gICAgICAgICAgICAgICAgICAgIGlkOiAnbmV0ZWFzZSdcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcbiAgICAgICAgICAgICAgICB0b2FzdCgn5pS25b2V5oiQ5YqfJylcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgIH1cXG59XFxuXFxuY29uc3QgZ2V0SW5jbHVkZWRUZW5jZW50ID0gKGl0ZW0sIGlucHV0KSA9PiB7XFxuICAgIHN3aXRjaCAoaW5wdXQpIHtcXG4gICAgICAgIGNhc2UgJ+WIm+W7uuatjOWNlSc6XFxuICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLnJ1bGUoKG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ+WIm+W7uuatjOWNlScpXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgIGxldCBsYXlvdXQgPSBbXTtcXG4gICAgICAgICAgICAgICAgQ3JlYXRlTGlzdFBhcnNlKGxheW91dClcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxuICAgICAgICAgICAgfSwgbXluYW1lKVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgIGRhdGEgPSByZWFkRmlsZShkb3duKTtcXG4gICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXG4gICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgZGF0YS5CdWlsZExpc3QuZm9yRWFjaCgoSXRlbSwgeCkgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gSXRlbS5uYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IHRydWVcXG4gICAgICAgICAgICAgICAgICAgIGluZGV4ID0geFxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ+iHquW7uuatjOWNlScsIGl0ZW0pXFxuICAgICAgICAgICAgICAgICAgICBJdGVtLmRhdGEuZm9yRWFjaCgoSXRlbXMsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoSXRlbXMubWlkID09IGl0ZW0ubWlkICYmIEl0ZW1zLmlkID09ICd0ZW5jZW50Jykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleCcsIGluZGV4KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleHMnLCBpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5pS25b2V6KaG55uWXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLnoa7lrprlpb3kuoblkJfvvIzmrYzmm7LlsIbopobnm5bljp/mnInnmoRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIGRhdGFNYXApXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IEJ1aWxkTGlzdCA9IGRhdGFNYXAuQnVpbGRMaXN0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0ID0gQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4JyldLmRhdGFcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IHN0b3JhZ2UwLmdldE15VmFyKCfoh6rlu7rmrYzljZUnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gJydcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5zdWJ0aXRsZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9IGRhdGEuc3VidGl0bGUgKyAnLSdcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luZ2VyID0gZGF0YS5zaW5nZXIubWFwKHRhZyA9PiB0YWcubmFtZSkuam9pbign44CBJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbWcgPSAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmFsYnVtLm1pZCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbWcgPSAnaHR0cHM6Ly95Lmd0aW1nLmNuL211c2ljL3Bob3RvX25ldy9UMDAyUjMwMHgzMDBNMDAwJyArIGRhdGEuYWxidW0ubWlkICsgJy5qcGcnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJ1aWxkTGlzdFtnZXRNeVZhcignQnJlYWtJbmRleHMnKV0gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGRhdGEudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnQ6IHN1YnRpdGxlICsgc2luZ2VyLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNzOiBpbWcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pZDogZGF0YS5taWQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAndGVuY2VudCdcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfopobnm5bmiJDlip8nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgaWYgKGdldEJyZWFrKSB7XFxuICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gJydcXG4gICAgICAgICAgICAgICAgaWYgKGl0ZW0uc3VidGl0bGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gaXRlbS5zdWJ0aXRsZSArICctJ1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHNpbmdlciA9IGl0ZW0uc2luZ2VyLm1hcCh0YWcgPT4gdGFnLm5hbWUpLmpvaW4oJ+OAgScpXFxuICAgICAgICAgICAgICAgIGltZyA9ICdodHRwczovL21pc3N1by5ydS9maWxlLzUxZTc4NWQzNGFiYTgxZjYxOTk0Zi5qcGcnXFxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmFsYnVtLm1pZCkge1xcbiAgICAgICAgICAgICAgICAgICAgaW1nID0gJ2h0dHBzOi8veS5ndGltZy5jbi9tdXNpYy9waG90b19uZXcvVDAwMlIzMDB4MzAwTTAwMCcgKyBpdGVtLmFsYnVtLm1pZCArICcuanBnJ1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0W2luZGV4XS5kYXRhLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnQ6IHN1YnRpdGxlICsgc2luZ2VyLFxcbiAgICAgICAgICAgICAgICAgICAgcGljczogaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgbWlkOiBpdGVtLm1pZCxcXG4gICAgICAgICAgICAgICAgICAgIGlkOiAndGVuY2VudCdcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcbiAgICAgICAgICAgICAgICB0b2FzdCgn5pS25b2V5oiQ5YqfJylcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgIH1cXG59XFxuXFxuY29uc3QgZ2V0SW5jbHVkZWRLd211c2ljY2FyID0gKGl0ZW0sIHBpY3MsIGlucHV0KSA9PiB7XFxuICAgIHN3aXRjaCAoaW5wdXQpIHtcXG4gICAgICAgIGNhc2UgJ+WIm+W7uuatjOWNlSc6XFxuICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLnJ1bGUoKG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ+WIm+W7uuatjOWNlScpXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgIGxldCBsYXlvdXQgPSBbXTtcXG4gICAgICAgICAgICAgICAgQ3JlYXRlTGlzdFBhcnNlKGxheW91dClcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxuICAgICAgICAgICAgfSwgbXluYW1lKVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgIGRhdGEgPSByZWFkRmlsZShkb3duKTtcXG4gICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXG4gICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgZGF0YS5CdWlsZExpc3QuZm9yRWFjaCgoSXRlbSwgeCkgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gSXRlbS5uYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IHRydWVcXG4gICAgICAgICAgICAgICAgICAgIGluZGV4ID0geFxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ+iHquW7uuatjOWNlScsIGl0ZW0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignS3dtdXNpY1BpY3MnLCBwaWNzKVxcbiAgICAgICAgICAgICAgICAgICAgSXRlbS5kYXRhLmZvckVhY2goKEl0ZW1zLCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEl0ZW1zLm1pZCA9PSBpdGVtLmlkICYmIEl0ZW1zLmlkID09ICdrdXdvJykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleCcsIGluZGV4KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleHMnLCBpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5pS25b2V6KaG55uWXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLnoa7lrprlpb3kuoblkJfvvIzmrYzmm7LlsIbopobnm5bljp/mnInnmoRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIGRhdGFNYXApXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IEJ1aWxkTGlzdCA9IGRhdGFNYXAuQnVpbGRMaXN0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0ID0gQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4JyldLmRhdGFcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IHN0b3JhZ2UwLmdldE15VmFyKCfoh6rlu7rmrYzljZUnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gJydcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5hcnRpc3RfbmFtZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9IGRhdGEuYXJ0aXN0X25hbWUgKyAnLSdcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luZ2VyID0gJydcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5hbGJ1bV9uYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpbmdlciA9IGRhdGEuYWxidW1fbmFtZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3RbZ2V0TXlWYXIoJ0JyZWFrSW5kZXhzJyldID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBkYXRhLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnQ6IHN1YnRpdGxlICsgc2luZ2VyLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNzOiBnZXRNeVZhcignS3dtdXNpY1BpY3MnKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkOiBkYXRhLmlkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ2t1d28nXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn6KaG55uW5oiQ5YqfJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGlmIChnZXRCcmVhaykge1xcbiAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9ICcnXFxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmFydGlzdF9uYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9IGl0ZW0uYXJ0aXN0X25hbWUgKyAnLSdcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzaW5nZXIgPSAnJ1xcbiAgICAgICAgICAgICAgICBpZiAoaXRlbS5hbGJ1bV9uYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICBzaW5nZXIgPSBpdGVtLmFsYnVtX25hbWVcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdFtpbmRleF0uZGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWU6IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnQ6IHN1YnRpdGxlICsgc2luZ2VyLFxcbiAgICAgICAgICAgICAgICAgICAgcGljczogcGljcyxcXG4gICAgICAgICAgICAgICAgICAgIG1pZDogaXRlbS5pZCxcXG4gICAgICAgICAgICAgICAgICAgIGlkOiAna3V3bydcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcbiAgICAgICAgICAgICAgICB0b2FzdCgn5pS25b2V5oiQ5YqfJylcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgIH1cXG59XFxuXFxuY29uc3QgZ2V0SW5jbHVkZWRLdWdvdSA9IChkYXRlLCBpdGVtLCBpLCBpbnB1dCkgPT4ge1xcbiAgICBzd2l0Y2ggKGlucHV0KSB7XFxuICAgICAgICBjYXNlICfliJvlu7rmrYzljZUnOlxcbiAgICAgICAgICAgIHJldHVybiAkKGVtcHR5KS5ydWxlKChteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKCfliJvlu7rmrYzljZUnKVxcbiAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICBsZXQgbGF5b3V0ID0gW107XFxuICAgICAgICAgICAgICAgIENyZWF0ZUxpc3RQYXJzZShsYXlvdXQpXFxuICAgICAgICAgICAgICAgIHNldFJlc3VsdChsYXlvdXQpO1xcbiAgICAgICAgICAgIH0sIG15bmFtZSlcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICBkYXRhID0gcmVhZEZpbGUoZG93bik7XFxuICAgICAgICAgICAgZXZhbCgnZGF0YSA9JyArIGRhdGEpXFxuICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0LmZvckVhY2goKEl0ZW0sIHgpID0+IHtcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09IEl0ZW0ubmFtZSkge1xcbiAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSB0cnVlXFxuICAgICAgICAgICAgICAgICAgICBpbmRleCA9IHhcXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCfoh6rlu7rmrYzljZUnLCBpdGVtKVxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ+iHquW7ulBsYXknLCBkYXRlW2ldKVxcbiAgICAgICAgICAgICAgICAgICAgSXRlbS5kYXRhLmZvckVhY2goKEl0ZW1zLCBsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEl0ZW1zLm1pZC5oYXNoID09IGRhdGVbaV0uaGFzaCAmJiBJdGVtcy5pZCA9PSAna3Vnb3UnKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4JywgaW5kZXgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4cycsIGwpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmlLblvZXopobnm5ZcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcIuehruWumuWlveS6huWQl++8jOatjOabsuWwhuimhuebluWOn+acieeahFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgQnVpbGRMaXN0ID0gZGF0YU1hcC5CdWlsZExpc3RcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3QgPSBCdWlsZExpc3RbZ2V0TXlWYXIoJ0JyZWFrSW5kZXgnKV0uZGF0YVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ+iHquW7uuatjOWNlScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGUgPSBzdG9yYWdlMC5nZXRNeVZhcign6Ieq5bu6UGxheScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4cycpXSA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZGF0ZS5maWxlbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljczogZGF0YS5pbWcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pZDogZGF0ZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdrdWdvdSdcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfopobnm5bmiJDlip8nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgaWYgKGdldEJyZWFrKSB7XFxuICAgICAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0W2luZGV4XS5kYXRhLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogZGF0ZVtpXS5maWxlbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIHBpY3M6IGl0ZW0uaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgbWlkOiBkYXRlW2ldLFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6ICdrdWdvdSdcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcbiAgICAgICAgICAgICAgICB0b2FzdCgn5pS25b2V5oiQ5YqfJylcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgIH1cXG59XFxuXFxuY29uc3QgZ2V0SW5jbHVkZWRNaWd1ID0gKGl0ZW0sIGlucHV0KSA9PiB7XFxuICAgIHN3aXRjaCAoaW5wdXQpIHtcXG4gICAgICAgIGNhc2UgJ+WIm+W7uuatjOWNlSc6XFxuICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLnJ1bGUoKG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ+WIm+W7uuatjOWNlScpXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgIGxldCBsYXlvdXQgPSBbXTtcXG4gICAgICAgICAgICAgICAgQ3JlYXRlTGlzdFBhcnNlKGxheW91dClcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxuICAgICAgICAgICAgfSwgbXluYW1lKVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcbiAgICAgICAgICAgIGRhdGEgPSByZWFkRmlsZShkb3duKTtcXG4gICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXG4gICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgZGF0YS5CdWlsZExpc3QuZm9yRWFjaCgoSXRlbSwgeCkgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gSXRlbS5uYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IHRydWVcXG4gICAgICAgICAgICAgICAgICAgIGluZGV4ID0geFxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ+iHquW7uuatjOWNlScsIGl0ZW0pXFxuICAgICAgICAgICAgICAgICAgICBJdGVtLmRhdGEuZm9yRWFjaCgoSXRlbXMsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoSXRlbXMubWlkLmNvcHlyaWdodElkID09IGl0ZW0uY29weXJpZ2h0SWQgJiYgSXRlbXMuaWQgPT0gJ21pZ3UnKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4JywgaW5kZXgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4cycsIGkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmlLblvZXopobnm5ZcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcIuehruWumuWlveS6huWQl++8jOatjOabsuWwhuimhuebluWOn+acieeahFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgQnVpbGRMaXN0ID0gZGF0YU1hcC5CdWlsZExpc3RcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3QgPSBCdWlsZExpc3RbZ2V0TXlWYXIoJ0JyZWFrSW5kZXgnKV0uZGF0YVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ+iHquW7uuatjOWNlScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgTWlndUZpbGwgPSAodXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghL14oaHR0cHM/KS8udGVzdCh1cmwpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImh0dHA6Ly9kLm11c2ljYXBwLm1pZ3UuY24vXFxcIiArIHVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VidGl0bGUgPSAnJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmFsYnVtKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gZGF0YS5hbGJ1bSArICctJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaW5nZXIgPSBkYXRhLnNpbmdlckxpc3QubWFwKHRhZyA9PiB0YWcubmFtZSkuam9pbign44CBJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3RbZ2V0TXlWYXIoJ0JyZWFrSW5kZXhzJyldID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBkYXRhLnNvbmdOYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250OiBzdWJ0aXRsZSArIHNpbmdlcixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljczogTWlndUZpbGwoZGF0YS5pbWcxKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkOiBkYXRhLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ21pZ3UnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn6KaG55uW5oiQ5YqfJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGlmIChnZXRCcmVhaykge1xcbiAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9ICcnXFxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmFsYnVtKSB7XFxuICAgICAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9IGl0ZW0uYWxidW0gKyAnLSdcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzaW5nZXIgPSBpdGVtLnNpbmdlckxpc3QubWFwKHRhZyA9PiB0YWcubmFtZSkuam9pbign44CBJylcXG4gICAgICAgICAgICAgICAgZGF0YS5CdWlsZExpc3RbaW5kZXhdLmRhdGEucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lOiBpdGVtLnNvbmdOYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgY29udDogc3VidGl0bGUgKyBzaW5nZXIsXFxuICAgICAgICAgICAgICAgICAgICBwaWNzOiBNaWd1RmlsbChpdGVtLmltZzEpLFxcbiAgICAgICAgICAgICAgICAgICAgbWlkOiBpdGVtLFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6ICdtaWd1J1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhKSwgMCk7XFxuICAgICAgICAgICAgICAgIHRvYXN0KCfmlLblvZXmiJDlip8nKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBicmVhaztcXG4gICAgfVxcbn1cXG5cXG5jb25zdCBOZXRFYXNlUGFyc2UgPSAobGF5b3V0LCBkYXRhKSA9PiB7XFxuICAgIGdldEluY2x1ZGVkUGFyc2UobGF5b3V0KVxcbiAgICB0cnkge1xcbiAgICAgICAgaWYgKGRhdGEubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgIGRhdGEuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICAgICAgc2luZ2VyID0gaXRlbS5hci5tYXAodGFnID0+IHRhZy5uYW1lKS5qb2luKCfjgIEnKVxcbiAgICAgICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogc2luZ2VyLFxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLmFsLnBpY1VybCxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJChlbXB0eSkubGF6eVJ1bGUoKGl0ZW0sIG15bmFtZSwgU2VsZWN0TWFwKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfmm7TlpJrlip/og70nLCBTZWxlY3RNYXBbMV0pKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU2VsZWN0TWFwWzBdOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SW5jbHVkZWRGdW4oKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRJbmNsdWRlZE5ldEVhc2UoaXRlbSwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldE5ldEVhc2VQbGF5ZXIoaXRlbS5pZCwgaXRlbS5uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUsIFNlbGVjdE1hcCksXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogZ2V0SXRlbSgnZ2V0Q29sVHlwZXMnLCAnY2FyZF9waWNfMycpLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmlLblvZXmrYzmm7InLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgbXluYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SW5jbHVkZWRGdW4oKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRJbmNsdWRlZE5ldEVhc2UoaXRlbSwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5pCc57SiID0+ICcgKyBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChuYW1lLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0Q29uZmlybVNlYXJjaChuYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLm5hbWUsIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFJpY2goU21hbGwoR3JheSgn772e772e772e5ZWl5Lmf5rKh5pyJ55WZ5LiL772e772e772eJykpKSxcXG4gICAgICAgICAgICAgICAgdXJsOiBlbXB0eSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgdG9hc3QoJ+WIsOW6leS6huWTpicpXFxuICAgIH1cXG59XFxuXFxuY29uc3QgVGVuY2VudFBhcnNlID0gKGxheW91dCwgZGF0YSkgPT4ge1xcbiAgICBnZXRJbmNsdWRlZFBhcnNlKGxheW91dClcXG4gICAgaWYgKGRhdGEubGVuZ3RoID4gMCkge1xcbiAgICAgICAgZGF0YS5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgIHN1YnRpdGxlID0gJydcXG4gICAgICAgICAgICBpZiAoaXRlbS5zdWJ0aXRsZSkge1xcbiAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9IGl0ZW0uc3VidGl0bGUgKyAnLSdcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgc2luZ2VyID0gaXRlbS5zaW5nZXIubWFwKHRhZyA9PiB0YWcubmFtZSkuam9pbign44CBJylcXG4gICAgICAgICAgICBpbWcgPSAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJ1xcbiAgICAgICAgICAgIGlmIChpdGVtLmFsYnVtLm1pZCkge1xcbiAgICAgICAgICAgICAgICBpbWcgPSAnaHR0cHM6Ly95Lmd0aW1nLmNuL211c2ljL3Bob3RvX25ldy9UMDAyUjMwMHgzMDBNMDAwJyArIGl0ZW0uYWxidW0ubWlkICsgJy5qcGcnXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgIGRlc2M6IHN1YnRpdGxlICsgc2luZ2VyLFxcbiAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoaXRlbSwgbXluYW1lLCBTZWxlY3RNYXApID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfmm7TlpJrlip/og70nLCBTZWxlY3RNYXBbMV0pKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTZWxlY3RNYXBbMF06XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWRUZW5jZW50KGl0ZW0sIGlucHV0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldFRlbmNlbnRQbGF5ZXIoaXRlbS5taWQsIGl0ZW0udGl0bGUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sIGl0ZW0sIG15bmFtZSwgU2VsZWN0TWFwKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IGdldEl0ZW0oJ2dldENvbFR5cGVzJywgJ2NhcmRfcGljXzMnKSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmlLblvZXmrYzmm7InLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SW5jbHVkZWRGdW4oKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCh1cE1hcCwgaW5kZXgsICfmlLblvZXmrYzmm7InKS5zZWxlY3QoKGl0ZW0sIG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRJbmNsdWRlZFRlbmNlbnQoaXRlbSwgaW5wdXQpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmkJzntKIgPT4gJyArIGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0Q29uZmlybVNlYXJjaChuYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0udGl0bGUsIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSlcXG4gICAgfSBlbHNlIHtcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ7llaXkuZ/msqHmnInnlZnkuIvvvZ7vvZ7vvZ4nKSkpLFxcbiAgICAgICAgICAgIHVybDogZW1wdHksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9XFxufVxcblxcbmNvbnN0IEt3bXVzaWNjYXJQYXJzZSA9IChsYXlvdXQsIGRhdGEpID0+IHtcXG4gICAgZ2V0SW5jbHVkZWRQYXJzZShsYXlvdXQpXFxuICAgIHRyeSB7XFxuICAgICAgICBpZiAoZGF0YS5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgZGF0YXMgPSBkYXRhXFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKCdzd2l0Y2gnLCAnMCcpID09ICcxJykge1xcbiAgICAgICAgICAgICAgICBkYXRhID0gZGF0YS5tYXAoaXRlbSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gS3dtdXNpY2NhckNvbmZpZygnbXVzaWMvaW5mby8nICsgaXRlbS5pZCkuaW5mb1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBkYXRhLmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgc3VidGl0bGUgPSAnJ1xcbiAgICAgICAgICAgICAgICBpZiAoZGF0YXNbaV0uYXJ0aXN0X25hbWUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gZGF0YXNbaV0uYXJ0aXN0X25hbWUgKyAnLSdcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzaW5nZXIgPSAnJ1xcbiAgICAgICAgICAgICAgICBpZiAoZGF0YXNbaV0uYWxidW1fbmFtZSkge1xcbiAgICAgICAgICAgICAgICAgICAgc2luZ2VyID0gZGF0YXNbaV0uYWxidW1fbmFtZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBkYXRhc1tpXS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogc3VidGl0bGUgKyBzaW5nZXIsXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGl0ZW0ucGljIHx8ICdodHRwczovL21pc3N1by5ydS9maWxlLzUxZTc4NWQzNGFiYTgxZjYxOTk0Zi5qcGcnLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoaXRlbSwgcGljcywgbXluYW1lLCBTZWxlY3RNYXApID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ+abtOWkmuWKn+iDvScsIFNlbGVjdE1hcFsxXSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTZWxlY3RNYXBbMF06XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJbmNsdWRlZEZ1bigpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCh1cE1hcCwgaW5kZXgsICfmlLblvZXmrYzmm7InKS5zZWxlY3QoKGl0ZW0sIHBpY3MsIG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldEluY2x1ZGVkS3dtdXNpY2NhcihpdGVtLCBwaWNzLCBpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIHBpY3MsIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0S3dtdXNpY2NhclBsYXllcihpdGVtLmlkKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9LCBkYXRhc1tpXSwgaXRlbS5waWMsIG15bmFtZSwgU2VsZWN0TWFwKSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJyksXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aUtuW9leatjOabsicsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtLCBwaWNzLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJbmNsdWRlZEZ1bigpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCh1cE1hcCwgaW5kZXgsICfmlLblvZXmrYzmm7InKS5zZWxlY3QoKGl0ZW0sIHBpY3MsIG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldEluY2x1ZGVkS3dtdXNpY2NhcihpdGVtLCBwaWNzLCBpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIHBpY3MsIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZGF0YXNbaV0sIGl0ZW0ucGljLCBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aQnOe0oiA9PiAnICsgZGF0YXNbaV0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRDb25maXJtU2VhcmNoKG5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRhdGFzW2ldLm5hbWUsIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgIHRvYXN0KCfns5/ns5VBUEnltKnmuoPkuoYnKVxcbiAgICB9XFxufVxcblxcbmNvbnN0IEt1Z291UGFyc2UgPSAobGF5b3V0LCBkYXRhKSA9PiB7XFxuICAgIGdldEluY2x1ZGVkUGFyc2UobGF5b3V0KVxcbiAgICBpZiAoZGF0YS5sZW5ndGggPiAwKSB7XFxuICAgICAgICBsZXQgS3Vnb3VNYXAgPSBkYXRhLm1hcChpdGVtID0+IHtcXG4gICAgICAgICAgICByZXR1cm4gS3Vnb3VDb25maWcoaXRlbSlcXG4gICAgICAgIH0pXFxuICAgICAgICBLdWdvdU1hcC5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZGF0YVtpXS5maWxlbmFtZSxcXG4gICAgICAgICAgICAgICAgaW1nOiBpdGVtLmltZyB8fCAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJyxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoZGF0YSwgaXRlbSwgbXluYW1lLCBTZWxlY3RNYXAsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfmm7TlpJrlip/og70nLCBTZWxlY3RNYXBbMV0pKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTZWxlY3RNYXBbMF06XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChkYXRhLCBpdGVtLCBpLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWRLdWdvdShkYXRhLCBpdGVtLCBpLCBpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZGF0YSwgaXRlbSwgaSwgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRLdWdvdVBsYXllcihkYXRhW2ldLCBkYXRhW2ldLmZpbGVuYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBkYXRhLCBpdGVtLCBteW5hbWUsIFNlbGVjdE1hcCwgaSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJyksXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5pS25b2V5q2M5puyJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoZGF0YSwgaXRlbSwgbXluYW1lLCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChkYXRhLCBpdGVtLCBpLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWRLdWdvdShkYXRhLCBpdGVtLCBpLCBpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZGF0YSwgaXRlbSwgaSwgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRhdGEsIGl0ZW0sIG15bmFtZSwgaSlcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aQnOe0oiA9PiAnICsgZGF0YVtpXS5maWxlbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygobmFtZSwgbXluYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRDb25maXJtU2VhcmNoKG5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgZGF0YVtpXS5maWxlbmFtZSwgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9KVxcbiAgICB9XFxufVxcblxcbmNvbnN0IE1pZ3VQYXJzZSA9IChsYXlvdXQsIGRhdGEpID0+IHtcXG4gICAgZ2V0SW5jbHVkZWRQYXJzZShsYXlvdXQpXFxuICAgIGlmIChkYXRhLmxlbmd0aCA+IDApIHtcXG4gICAgICAgIGRhdGEuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICBzdWJ0aXRsZSA9ICcnXFxuICAgICAgICAgICAgaWYgKGl0ZW0uYWxidW0pIHtcXG4gICAgICAgICAgICAgICAgc3VidGl0bGUgPSBpdGVtLmFsYnVtICsgJy0nXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHNpbmdlciA9IGl0ZW0uc2luZ2VyTGlzdCB8fCBpdGVtLnNpbmdlcnNcXG4gICAgICAgICAgICBzaW5nZXIgPSBzaW5nZXIubWFwKHRhZyA9PiB0YWcubmFtZSkuam9pbign44CBJylcXG4gICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnNvbmdOYW1lIHx8IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogc3VidGl0bGUgKyBzaW5nZXIsXFxuICAgICAgICAgICAgICAgIGltZzogTWlndUZpbGwoaXRlbS5pbWcxIHx8IGl0ZW0uaW1nSXRlbXNbMF0uaW1nKSxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoaXRlbSwgbXluYW1lLCBTZWxlY3RNYXApID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfmm7TlpJrlip/og70nLCBTZWxlY3RNYXBbMV0pKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTZWxlY3RNYXBbMF06XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWRNaWd1KGl0ZW0sIGlucHV0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldE1pZ3VQbGF5ZXIoaXRlbSwgKGl0ZW0uc29uZ05hbWUgfHwgaXRlbS5uYW1lKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lLCBTZWxlY3RNYXApLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogZ2V0SXRlbSgnZ2V0Q29sVHlwZXMnLCAnY2FyZF9waWNfMycpLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aUtuW9leatjOabsicsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0sIG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJbmNsdWRlZEZ1bigpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKHVwTWFwLCBpbmRleCwgJ+aUtuW9leatjOabsicpLnNlbGVjdCgoaXRlbSwgbXluYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldEluY2x1ZGVkTWlndShpdGVtLCBpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aQnOe0oiA9PiAnICsgKGl0ZW0uc29uZ05hbWUgfHwgaXRlbS5uYW1lKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygobmFtZSwgbXluYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRDb25maXJtU2VhcmNoKG5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgKGl0ZW0uc29uZ05hbWUgfHwgaXRlbS5uYW1lKSwgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9KVxcbiAgICB9XFxufVxcblxcbmNvbnN0IGdldEJ1aWxkTGlzdE1hcCA9IChTZWxlY3RNYXAsIGluZGV4LCBpdGVtLCBpbmRleHMpID0+IHtcXG4gICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgZGF0YSA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXG4gICAgaWYgKGRhdGEuQnVpbGRMaXN0ID09IG51bGwpIHtcXG4gICAgICAgIGRhdGEuQnVpbGRMaXN0ID0gW11cXG4gICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGEpLCAwKTtcXG4gICAgICAgIGV2YWwoJ2RhdGEgPScgKyByZWFkRmlsZShkb3duKSlcXG4gICAgfVxcbiAgICBwdXRNeVZhcignaW5kZXhDb25maXJtJywgaW5kZXgpXFxuICAgIHB1dE15VmFyKCdpbmRleHNDb25maXJtJywgaW5kZXhzKVxcbiAgICBzd2l0Y2ggKGdldE15VmFyKCfmlLblvZXlip/og70nLCBTZWxlY3RNYXBbU2VsZWN0TWFwLmxlbmd0aCAtIDFdKSkge1xcbiAgICAgICAgY2FzZSBTZWxlY3RNYXBbMF06XFxuICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLmxhenlSdWxlKChlbXB0eSkgPT4ge1xcbiAgICAgICAgICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5q2M5puy5Yig6ZmkXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLnoa7lrprlpb3kuoblkJfvvIzor6XmrYzmm7LlsIbliKDpmaRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gZ2V0TXlWYXIoJ2luZGV4Q29uZmlybScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXhzID0gZ2V0TXlWYXIoJ2luZGV4c0NvbmZpcm0nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcCA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4c10uZGF0YS5zcGxpY2UoaW5kZXgsIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfliKDpmaTmiJDlip8nKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5XFxuICAgICAgICAgICAgfSwgZW1wdHkpXFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICBjYXNlIFNlbGVjdE1hcFsxXTpcXG4gICAgICAgICAgICBwdXRNeVZhcignZ2V0TW92ZScsIGluZGV4KVxcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgY2FzZSBTZWxlY3RNYXBbMl06XFxuICAgICAgICAgICAgbmFtZXMgPSBkYXRhLkJ1aWxkTGlzdC5tYXAoaXQgPT4gaXQubmFtZSlcXG4gICAgICAgICAgICB1cE1hcCA9IG5hbWVzLmNvbmNhdChbJ+WIm+W7uuatjOWNlSddKVxcbiAgICAgICAgICAgIGluZGV4ID0gMVxcbiAgICAgICAgICAgIGlmICh1cE1hcC5sZW5ndGggPiAyKSB7XFxuICAgICAgICAgICAgICAgIGluZGV4ID0gMlxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gJCh1cE1hcCwgaW5kZXgsIFNlbGVjdE1hcFsyXSkuc2VsZWN0KChteW5hbWUsIGVtcHR5KSA9PiB7XFxuICAgICAgICAgICAgICAgIHN3aXRjaCAoaW5wdXQpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ+WIm+W7uuatjOWNlSc6XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLnJ1bGUoKG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ+WIm+W7uuatjOWNlScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBsYXlvdXQgPSBbXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgQ3JlYXRlTGlzdFBhcnNlKGxheW91dClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgcmVhZEZpbGUoZG93bikpXFxuICAgICAgICAgICAgICAgICAgICAgICAgSW5kZXggPSBnZXRNeVZhcignaW5kZXhDb25maXJtJylcXG4gICAgICAgICAgICAgICAgICAgICAgICBJbmRleHMgPSBnZXRNeVZhcignaW5kZXhzQ29uZmlybScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgaXRlbSA9IGRhdGFNYXAuQnVpbGRMaXN0W0luZGV4c10uZGF0YVtJbmRleF1cXG4gICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3QuZm9yRWFjaCgoSXRlbSwgeCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gSXRlbS5uYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IHRydWVcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0geFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ+iHquW7uuatjOWNlScsIGl0ZW0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJdGVtLmRhdGEuZm9yRWFjaCgoSXRlbXMsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoSXRlbXMubmFtZSA9PSBpdGVtLm5hbWUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ0JyZWFrSW5kZXgnLCBpbmRleClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ0JyZWFrSW5kZXhzJywgaSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuaUtuW9leimhuebllxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFwi56Gu5a6a5aW95LqG5ZCX77yM5q2M5puy5bCG6KaG55uW5Y6f5pyJ55qEXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm06ICgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgcmVhZEZpbGUoZG93bikpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW5kZXggPSBnZXRNeVZhcignaW5kZXhDb25maXJtJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJbmRleHMgPSBnZXRNeVZhcignaW5kZXhzQ29uZmlybScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBnZXRNeVZhcignQnJlYWtJbmRleCcpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXhzID0gZ2V0TXlWYXIoJ0JyZWFrSW5kZXhzJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgQnVpbGRMaXN0ID0gZGF0YU1hcC5CdWlsZExpc3RcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3QgPSBCdWlsZExpc3RbaW5kZXhdLmRhdGFcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3RbaW5kZXhzXSA9IHN0b3JhZ2UwLmdldE15VmFyKCfoh6rlu7rmrYzljZUnKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJbmRleHMgIT0gaW5kZXgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3RbSW5kZXhzXS5kYXRhLnNwbGljZShJbmRleCwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfopobnm5bmiJDlip8nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGdldEJyZWFrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W0luZGV4c10uZGF0YS5zcGxpY2UoSW5kZXgsIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4XS5kYXRhLnB1c2goaXRlbSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn5pu05o2i5oiQ5YqfJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSwgbXluYW1lLCBlbXB0eSlcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLmxhenlSdWxlKChpdGVtLCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgc3dpdGNoIChpdGVtLmlkKSB7XFxuICAgICAgICAgICAgICAgICAgICBjYXNlICduZXRlYXNlJzpcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0TmV0RWFzZVBsYXllcihpdGVtLm1pZCwgaXRlbS5uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICBjYXNlICd0ZW5jZW50JzpcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0VGVuY2VudFBsYXllcihpdGVtLm1pZCwgaXRlbS5uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICBjYXNlICdrdXdvJzpcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0S3dtdXNpY2NhclBsYXllcihpdGVtLm1pZClcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICAgICAgY2FzZSAna3Vnb3UnOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRLdWdvdVBsYXllcihpdGVtLm1pZCwgaXRlbS5uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgICAgICBjYXNlICdtaWd1JzpcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0TWlndVBsYXllcihpdGVtLm1pZCwgaXRlbS5uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxuICAgIH1cXG4gICAgcmV0dXJuIGVtcHR5XFxufVxcblxcbmNvbnN0IEJ1aWxkTGlzdFBhcnNlID0gKGxheW91dCwgaW5kZXgpID0+IHtcXG4gICAgZ2V0Q29uZmlybSgpXFxuICAgIFNlbGVjdE1hcCA9IFsn5Yig6Zmk5q2M5puyJywgJ+atjOabsuenu+WKqCcsICfmm7TmjaLmrYzljZUnLCAn6IGG5ZCs5q2M5puyJ11cXG4gICAgYWRkTGlzdGVuZXIoJ29uUmVmcmVzaCcsICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgc3dpdGNoIChnZXRNeVZhcign5pu05aSaJywgJzAnKSkge1xcbiAgICAgICAgICAgIGNhc2UgJzAnOlxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcign5pu05aSaJywgMSk7XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfmm7TlpJonLCAwKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICB9XFxuICAgIH0pKTtcXG4gICAgYWRkTGlzdGVuZXIoJ29uQ2xvc2UnLCAoKSA9PiB7XFxuICAgICAgICBjbGVhck15VmFyKCfmm7TlpJonKVxcbiAgICB9KVxcbiAgICBpZiAoZ2V0TXlWYXIoJ+abtOWkmicsICcwJykgPT0gMSkge1xcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiAnbGluZV9ibGFuaydcXG4gICAgICAgIH0sIHtcXG4gICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ7mm7TlpJrpgInpobnvvZ7vvZ7vvZ4nKSkpLFxcbiAgICAgICAgICAgIHVybDogJChTZWxlY3RNYXAsIDIsICflt7LpgInmi6ktJyArICdbJyArIGdldE15VmFyKCfmlLblvZXlip/og70nLCBTZWxlY3RNYXBbU2VsZWN0TWFwLmxlbmd0aCAtIDFdKSArICddJykuc2VsZWN0KChlbXB0eSkgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcign5pS25b2V5Yqf6IO9JywgaW5wdXQpXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5XFxuICAgICAgICAgICAgfSwgZW1wdHkpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIGNvbF90eXBlOiAnbGluZV9ibGFuaydcXG4gICAgICAgIH0pXFxuICAgIH1cXG4gICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgZGF0YU1hcCA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXG4gICAgZGF0YSA9IGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4XS5kYXRhXFxuICAgIGlmIChkYXRhLmxlbmd0aCAhPSAwKSB7XFxuICAgICAgICBkYXRhLmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgICAgICBuYW1lID0gaXRlbS5uYW1lXFxuICAgICAgICAgICAgc2VsZWN0ID0gJChlbXB0eSArICcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChTZWxlY3RNYXAsIGksIGl0ZW0sIGluZGV4LCBteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcignc3dpdGNoJylcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGdldEJ1aWxkTGlzdE1hcChTZWxlY3RNYXAsIGksIGl0ZW0sIGluZGV4KVxcbiAgICAgICAgICAgIH0sIFNlbGVjdE1hcCwgaSwgaXRlbSwgaW5kZXgsIG15bmFtZSlcXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoJ2dldE1vdmUnLCAnJykpIHtcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKCdnZXRNb3ZlJywgJycpID09IGkpIHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWUgPSBSaWNoKFNtYWxsKFNwcmluZ0dyZWVuKG5hbWUpKSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzZWxlY3QgPSAkKGVtcHR5KS5sYXp5UnVsZSgoaW5kZXgsIGksIG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXG4gICAgICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgcmVhZEZpbGUoZG93bikpXFxuICAgICAgICAgICAgICAgICAgICBpbmRleHMgPSBOdW1iZXIoZ2V0TXlWYXIoJ2dldE1vdmUnKSlcXG4gICAgICAgICAgICAgICAgICAgIGdldE1vdmUoZGF0YU1hcC5CdWlsZExpc3RbaW5kZXhdLmRhdGEsIGluZGV4cywgaSlcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2dldE1vdmUnKVxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXG4gICAgICAgICAgICAgICAgfSwgaW5kZXgsIGksIG15bmFtZSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogbmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogaXRlbS5jb250LFxcbiAgICAgICAgICAgICAgICBpbWc6IGl0ZW0ucGljcyB8fCAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJyxcXG4gICAgICAgICAgICAgICAgdXJsOiBzZWxlY3QsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJyksXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5pCc57SiID0+ICcgKyBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIG15bmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0Q29uZmlybVNlYXJjaChuYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0ubmFtZSwgbXluYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5Yig6ZmkJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaW5kZXgsIGluZGV4cykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignaW5kZXhDb25maXJtJywgaW5kZXgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdpbmRleHNDb25maXJtJywgaW5kZXhzKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5q2M5puy5Yig6ZmkXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXCLnoa7lrprlpb3kuoblkJfvvIzor6XmrYzmm7LlsIbliKDpmaRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0gZ2V0TXlWYXIoJ2luZGV4Q29uZmlybScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXhzID0gZ2V0TXlWYXIoJ2luZGV4c0NvbmZpcm0nKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcCA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4c10uZGF0YS5zcGxpY2UoaW5kZXgsIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfliKDpmaTmiJDlip8nKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpLCBpbmRleClcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+e9rumhticsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIGluZGV4cykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIHJlYWRGaWxlKGRvd24pKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgb2JqID0ge307XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4c10uZGF0YS5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0ubmFtZSA9PT0gbmFtZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iaiA9IGl0ZW07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3RbaW5kZXhzXS5kYXRhLnNwbGljZShpbmRleCwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4c10uZGF0YS51bnNoaWZ0KG9iaik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbS5uYW1lLCBpbmRleClcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+e9ruW6lScsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIGluZGV4cykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIHJlYWRGaWxlKGRvd24pKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgb2JqID0ge307XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4c10uZGF0YS5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0ubmFtZSA9PT0gbmFtZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iaiA9IGl0ZW07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3RbaW5kZXhzXS5kYXRhLnNwbGljZShpbmRleCwgMSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4c10uZGF0YS5wdXNoKG9iaik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbS5uYW1lLCBpbmRleClcXG4gICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSlcXG4gICAgfSBlbHNlIHtcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ7llaXkuZ/msqHmnInlk6bvvZ7vvZ7vvZ4nKSkpLFxcbiAgICAgICAgICAgIHVybDogZW1wdHksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9XFxufVxcblxcbmNvbnN0IENyZWF0ZUxpc3RQYXJzZSA9IChsYXlvdXQpID0+IHtcXG4gICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgZGVzYzogXFxcIuivt+i+k+WFpeatjOWNleWQjeensFxcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgdHlwZTogJ3RleHRhcmVhJyxcXG4gICAgICAgICAgICBoZWlnaHQ6IDMsXFxuICAgICAgICAgICAgb25DaGFuZ2U6IFxcXCJzZXRJdGVtKCflkI3np7AnLCBpbnB1dClcXFwiLFxcbiAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSwge1xcbiAgICAgICAgZGVzYzogXFxcIuivt+i+k+WFpeatjOWNleWwgemdou+8iOmdnuW/heWhq++8iVxcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgdHlwZTogJ3RleHRhcmVhJyxcXG4gICAgICAgICAgICBoZWlnaHQ6IDMsXFxuICAgICAgICAgICAgb25DaGFuZ2U6IFxcXCJzZXRJdGVtKCflsIHpnaInLCBpbnB1dClcXFwiLFxcbiAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSwge1xcbiAgICAgICAgdGl0bGU6IFJpY2goU3Ryb25nKEdyYXkoJ+WIm+W7uuatjOWNlScpKSksXFxuICAgICAgICB1cmw6ICQoZW1wdHkpLmxhenlSdWxlKChlbXB0eSkgPT4ge1xcbiAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgZGF0YSA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICAgICAgICAgIGV2YWwoJ2RhdGEgPScgKyBkYXRhKVxcbiAgICAgICAgICAgIHBpY3MgPSBnZXRJdGVtKCflsIHpnaInKVxcbiAgICAgICAgICAgIG5hbWUgPSBnZXRJdGVtKCflkI3np7AnKVxcbiAgICAgICAgICAgIGdldEJyZWFrID0gdHJ1ZVxcbiAgICAgICAgICAgIGlmIChuYW1lICE9IHVuZGVmaW5lZCAmJiBuYW1lICE9ICcnKSB7XFxuICAgICAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0LmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAobmFtZSA9PSBpdGVtLm5hbWUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoZ2V0QnJlYWspIHtcXG4gICAgICAgICAgICAgICAgaWYgKHBpY3MgPT0gdW5kZWZpbmVkIHx8IHBpY3MgPT0gJycpIHtcXG4gICAgICAgICAgICAgICAgICAgIHBpY3MgPSAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJ1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGRhdGFNdXNpYyA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWU6IG5hbWUsXFxuICAgICAgICAgICAgICAgICAgICBwaWNzOiBwaWNzLFxcbiAgICAgICAgICAgICAgICAgICAgZGF0YTogW11cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdC5wdXNoKGRhdGFNdXNpYylcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRvYXN0KCfliJvlu7rlpLHotKXvvIHvvIEnKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBiYWNrKClcXG4gICAgICAgICAgICByZXR1cm4gZW1wdHlcXG4gICAgICAgIH0sIGVtcHR5KSxcXG4gICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgfVxcbiAgICB9KVxcbn1cXG5cXG5jb25zdCBnZXRFZGl0UGFyc2UgPSAobGF5b3V0LCBpLCBpdGVtKSA9PiB7XFxuICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgIGRlc2M6IGl0ZW0ubmFtZSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICB0eXBlOiAndGV4dGFyZWEnLFxcbiAgICAgICAgICAgIGhlaWdodDogMyxcXG4gICAgICAgICAgICBvbkNoYW5nZTogXFxcInNldEl0ZW0oJ+WQjeensCcsIGlucHV0KVxcXCIsXFxuICAgICAgICAgICAgdGl0bGVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgfVxcbiAgICB9LCB7XFxuICAgICAgICBkZXNjOiBpdGVtLnBpY3MsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgdHlwZTogJ3RleHRhcmVhJyxcXG4gICAgICAgICAgICBoZWlnaHQ6IDMsXFxuICAgICAgICAgICAgb25DaGFuZ2U6IFxcXCJzZXRJdGVtKCflsIHpnaInLCBpbnB1dClcXFwiLFxcbiAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSwge1xcbiAgICAgICAgdGl0bGU6IFJpY2goU3Ryb25nKEdyYXkoJ+ehruiupOS/ruaUuScpKSksXFxuICAgICAgICB1cmw6ICQoZW1wdHkpLmxhenlSdWxlKChlbXB0eSwgaSkgPT4ge1xcbiAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxuICAgICAgICAgICAgZGF0YSA9IHJlYWRGaWxlKGRvd24pO1xcbiAgICAgICAgICAgIGV2YWwoJ2RhdGEgPScgKyBkYXRhKVxcbiAgICAgICAgICAgIHBpY3MgPSBnZXRJdGVtKCflsIHpnaInKVxcbiAgICAgICAgICAgIG5hbWUgPSBnZXRJdGVtKCflkI3np7AnKVxcbiAgICAgICAgICAgIGdldEJyZWFrID0gdHJ1ZVxcbiAgICAgICAgICAgIGluZGV4ID0gJydcXG4gICAgICAgICAgICBpZiAobmFtZSAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICAgICAgZGF0YS5CdWlsZExpc3QuZm9yRWFjaCgoaXRlbSwgeCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKG5hbWUgPT0gaXRlbS5uYW1lKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0geFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGdldEJyZWFrIHx8IGluZGV4ID09IGkpIHtcXG4gICAgICAgICAgICAgICAgaWYgKHBpY3MgPT0gdW5kZWZpbmVkIHx8IHBpY3MgPT0gJycpIHtcXG4gICAgICAgICAgICAgICAgICAgIHBpY3MgPSBkYXRhLkJ1aWxkTGlzdFtpXS5waWNzXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKG5hbWUgPT0gJycpIHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWUgPSBkYXRhLkJ1aWxkTGlzdFtpXS5uYW1lXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgZGF0YS5CdWlsZExpc3RbaV0ubmFtZSA9IG5hbWVcXG4gICAgICAgICAgICAgICAgZGF0YS5CdWlsZExpc3RbaV0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Db25maWcobXVzaWNVcmwsICcnLCAnR0VUJylcXG4gICAgbHlzaWNVcmwgPSAnL2FwaS9zb25nL2x5cmljP29zPW9zeCZpZD0nICsgbWlkICsgJyZsdj0tMSZrdj0tMSZ0dj0tMSdcXG4gICAgbHlzaWNNYXAgPSBOZXRFYXNlQ29uZmlnKGx5c2ljVXJsLCAnJywgJ0dFVCcpXFxuICAgIGlmIChtdXNpY01hcC5kYXRhWzBdLnVybCkge1xcbiAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICB1cmxzOiBbbXVzaWNNYXAuZGF0YVswXS51cmxdLFxcbiAgICAgICAgICAgIGx5cmljOiBseXNpY01hcC5scmMubHlyaWNcXG4gICAgICAgIH0pXFxuICAgIH1cXG4gICAgcmV0dXJuIGdldENvbmZpcm1TZWFyY2gobmFtZSlcXG59XFxuXFxuY29uc3QgZ2V0VGVuY2VudFBsYXllciA9IChtaWQsIG5hbWUpID0+IHtcXG4gICAgbGV0IHR5cGVNYXAgPSB7XFxuICAgICAgICBtNGE6IHtcXG4gICAgICAgICAgICBzOiAnQzQwMCcsXFxuICAgICAgICAgICAgZTogJy5tNGEnLFxcbiAgICAgICAgfSxcXG4gICAgICAgIDEyODoge1xcbiAgICAgICAgICAgIHM6ICdNNTAwJyxcXG4gICAgICAgICAgICBlOiAnLm1wMycsXFxuICAgICAgICB9LFxcbiAgICAgICAgMzIwOiB7XFxuICAgICAgICAgICAgczogJ004MDAnLFxcbiAgICAgICAgICAgIGU6ICcubXAzJyxcXG4gICAgICAgIH0sXFxuICAgICAgICBhcGU6IHtcXG4gICAgICAgICAgICBzOiAnQTAwMCcsXFxuICAgICAgICAgICAgZTogJy5hcGUnLFxcbiAgICAgICAgfSxcXG4gICAgICAgIGZsYWM6IHtcXG4gICAgICAgICAgICBzOiAnRjAwMCcsXFxuICAgICAgICAgICAgZTogJy5mbGFjJyxcXG4gICAgICAgIH0sXFxuICAgIH07XFxuICAgIGxldCB0aW1lID0gbmV3IERhdGUoKS5nZXRUaW1lKClcXG4gICAgbGV0IGd1aWQgPSAoTWF0aC5yYW5kb20oKSAqIDEwMDAwMDAwKS50b0ZpeGVkKDApO1xcbiAgICBsZXQgdHlwZU9iaiA9IHR5cGVNYXBbJzEyOCddO1xcbiAgICBsZXQgZmlsZSA9IHR5cGVPYmoucyArIG1pZCArIG1pZCArIHR5cGVPYmouZTtcXG4gICAgbGV0IHVybCA9IHtcXG4gICAgICAgICctJzogJ2dldHBsYXlzb25ndmtleScsXFxuICAgICAgICBnX3RrOiA1MzgxLFxcbiAgICAgICAgaG9zdFVpbjogMCxcXG4gICAgICAgIGZvcm1hdDogJ2pzb24nLFxcbiAgICAgICAgaW5DaGFyc2V0OiAndXRmOCcsXFxuICAgICAgICBvdXRDaGFyc2V0OiAndXRmLTjCrGljZT0wJyxcXG4gICAgICAgIHBsYXRmb3JtOiAneXFxLmpzb24nLFxcbiAgICAgICAgbmVlZE5ld0NvZGU6IDAsXFxuICAgICAgICBkYXRhOiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgcmVxXzA6IHtcXG4gICAgICAgICAgICAgICAgbW9kdWxlOiAndmtleS5HZXRWa2V5U2VydmVyJyxcXG4gICAgICAgICAgICAgICAgbWV0aG9kOiAnQ2dpR2V0VmtleScsXFxuICAgICAgICAgICAgICAgIHBhcmFtOiB7XFxuICAgICAgICAgICAgICAgICAgICBmaWxlbmFtZTogW2ZpbGVdLFxcbiAgICAgICAgICAgICAgICAgICAgZ3VpZDogZ3VpZCxcXG4gICAgICAgICAgICAgICAgICAgIHNvbmdtaWQ6IFttaWRdLFxcbiAgICAgICAgICAgICAgICAgICAgc29uZ3R5cGU6IFswXSxcXG4gICAgICAgICAgICAgICAgICAgIHVpbjogJycsXFxuICAgICAgICAgICAgICAgICAgICBsb2dpbmZsYWc6IDEsXFxuICAgICAgICAgICAgICAgICAgICBwbGF0Zm9ybTogJzIwJyxcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIGNvbW06IHtcXG4gICAgICAgICAgICAgICAgdWluOiAnJyxcXG4gICAgICAgICAgICAgICAgZm9ybWF0OiAnanNvbicsXFxuICAgICAgICAgICAgICAgIGN0OiAxOSxcXG4gICAgICAgICAgICAgICAgY3Y6IDAsXFxuICAgICAgICAgICAgICAgIGF1dGhzdDogJycsXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgIH0pLFxcbiAgICB9XFxuICAgIGxldCByZXN1bHQgPSBidWlsZFVybCgnaHR0cHM6Ly91LnkucXEuY29tL2NnaS1iaW4vbXVzaWN1LmZjZycsIHVybClcXG4gICAgcmVzdWx0ID0gSlNPTi5wYXJzZShmZXRjaChyZXN1bHQpKVxcbiAgICBsZXQgcHVybCA9ICcnO1xcbiAgICBsZXQgZG9tYWluID0gJyc7XFxuICAgIGlmIChyZXN1bHQucmVxXzAgJiYgcmVzdWx0LnJlcV8wLmRhdGEgJiYgcmVzdWx0LnJlcV8wLmRhdGEubWlkdXJsaW5mbykge1xcbiAgICAgICAgcHVybCA9IHJlc3VsdC5yZXFfMC5kYXRhLm1pZHVybGluZm9bMF0ucHVybDtcXG4gICAgfVxcbiAgICBpZiAoZG9tYWluID09PSAnJykge1xcbiAgICAgICAgZG9tYWluID0gcmVzdWx0LnJlcV8wLmRhdGEuc2lwLmZpbmQoaSA9PiAhaS5zdGFydHNXaXRoKCdodHRwOi8vd3MnKSkgfHwgcmVzdWx0LnJlcV8wLmRhdGEuc2lwWzBdO1xcbiAgICB9XFxuICAgIGxldCBseXJpY3MgPSAnaHR0cDovL2MueS5xcS5jb20vbHlyaWMvZmNnaS1iaW4vZmNnX3F1ZXJ5X2x5cmljX25ldy5mY2c/c29uZ21pZD0nICsgbWlkICsgJyZwY2FjaGV0aW1lPScgKyB0aW1lICsgJyZnX3RrPTUzODEmbG9naW5VaW49MCZob3N0VWluPTAmaW5DaGFyc2V0PXV0Zjgmb3V0Q2hhcnNldD11dGY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XNpY01hcCcsIGZ1bk1hcClbMF0pIHtcXG4gICAgICAgIGNhc2UgZnVuTWFwWzBdOlxcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfwn5SNJyxcXG4gICAgICAgICAgICAgICAgZGVzYzogXFxcIuivt+i+k+WFpeatjOabsuWQjeensC/lhbPplK7or41cXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6ICdcXFwiaGlrZXI6Ly9zZWFyY2g/cz1cXFwiK2lucHV0JyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJpbnB1dFxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBydWxlczogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBbXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgc2VhcmNoTWFwID0gWyfnvZHmmJMnLCAn6IW+6K6vJywgJ+mFt+aIkScsICfphbfni5cnLCAn5ZKq5ZKVJ107XFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3N3aXRjaCcsICcxJylcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWFyY2hNYXAuZm9yRWFjaCgoTWFwLCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwidGl0bGVcXFwiOiBNYXAgKyAn6Z+z5LmQJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJzZWFyY2hfdXJsXFxcIjogXFxcImhpa2VyOi8vZW1wdHk/c2VhcmNoVGVybXM9KiomcGFnZT1meXBhZ2UmaW5kZXg9XFxcIiArIGksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwic2VhcmNoRmluZFxcXCI6IFxcXCJqczogJC5yZXF1aXJlKCdoaWtlcjovL3BhZ2UvU2VhcmNoLnZpZXc/cnVsZT3nroDljZXpn7PkuZAnKTtcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KGRhdGEpO1xcbiAgICAgICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGdldE15VmFyKFxcXCJzZWFyY2hLZXlcXFwiLCBcXFwiXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBvbkNoYW5nZTogXFxcInB1dE15VmFyKCdzZWFyY2hLZXknLGlucHV0KVxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiAn8J+UjScsXFxuICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLor7fovpPlhaXmrYzmm7LlkI3np7Av5YWz6ZSu6K+NXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiAkLnRvU3RyaW5nKChteW5hbWUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBrZXl3b3JkcyA9IGlucHV0LnRyaW0oKTtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdzd2l0Y2gnLCAnMScpXFxuICAgICAgICAgICAgICAgICAgICBpZiAoa2V5d29yZHMpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9TZWFyY2hzLnZpZXc/cnVsZT1cXFwiICsgbXluYW1lICsgXFxcIiZwYWdlPWZ5cGFnZSZzZWFyY2hUZXJtcz1cXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KGtleXdvcmRzKTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+ivt+i+k+WFpeWFs+mUruivjVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sIG15bmFtZSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBnZXRNeVZhcihcXFwic2VhcmNoS2V5XFxcIiwgXFxcIlxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgb25DaGFuZ2U6IFxcXCJwdXRNeVZhcignc2VhcmNoS2V5JyxpbnB1dClcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICB9XFxufVxcblxcbmNvbnN0IGdldFNlYXJjaHNQYXJzZSA9IChsYXlvdXQsIHBhZ2UpID0+IHtcXG4gICAgYWRkTGlzdGVuZXIoJ29uQ2xvc2UnLCAoKSA9PiB7XFxuICAgICAgICBjbGVhck15VmFyKCdzZWFyY2hNYXAnKVxcbiAgICAgICAgY2xlYXJNeVZhcignc3dpdGNoJylcXG4gICAgfSlcXG4gICAgaW5kZXhzID0gZ2V0TXlWYXIoJ3NlYXJjaE1hcCcsICcwJylcXG4gICAga2V5d29yZCA9IGRlY29kZVVSSUNvbXBvbmVudChnZXRQYXJhbShcXFwic2VhcmNoVGVybXNcXFwiKSk7XFxuICAgIHNldFBhZ2VUaXRsZShcXFwi44CMXFxcIiArIGtleXdvcmQgKyBcXFwi44CNI1xcXCIgKyBwYWdlKTtcXG4gICAgaWYgKHBhZ2UgPT09IDEpIHtcXG4gICAgICAgIHNlYXJjaE1hcCA9IFsn572R5piTJywgJ+iFvuiurycsICfphbfmiJEnLCAn6YW354uXJywgJ+WSquWSlSddO1xcbiAgICAgICAgc2VhcmNoTWFwLmZvckVhY2goKGl0ZW0sIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogaW5kZXggPT0gaW5kZXhzID8gUmljaChTdHJvbmcoQ29sb3IoaXRlbSkpKSA6IGl0ZW0sXFxuICAgICAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZW1wdHksIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignc2VhcmNoTWFwJywgaW5kZXgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eTtcXG4gICAgICAgICAgICAgICAgfSwgZW1wdHksIGluZGV4KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0XzUnXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0pXFxuICAgIH1cXG4gICAgZ2V0U2VhcmNoU2VsZWN0aW9uKGxheW91dCwgaW5kZXhzLCBrZXl3b3JkLCBwYWdlKVxcbn1cXG5cXG5jb25zdCBnZXRTZWFyY2hTZWxlY3Rpb24gPSAobGF5b3V0LCBpbmRleCwga2V5d29yZCwgcGFnZSkgPT4ge1xcbiAgICBzd2l0Y2ggKGluZGV4KSB7XFxuICAgICAgICBjYXNlICcwJzpcXG4gICAgICAgICAgICBwYXRoID0gJy93ZWFwaS9jbG91ZHNlYXJjaC9nZXQvd2ViP2NzcmZfdG9rZW49J1xcbiAgICAgICAgICAgIGJvZHkgPSB7XFxuICAgICAgICAgICAgICAgICdzJzoga2V5d29yZCxcXG4gICAgICAgICAgICAgICAgJ2xpbWl0JzogMzAsXFxuICAgICAgICAgICAgICAgICd0eXBlJzogMSxcXG4gICAgICAgICAgICAgICAgJ29mZnNldCc6IChwYWdlIC0gMSkgKiAzMCxcXG4gICAgICAgICAgICAgICAgJ2NzcmZfdG9rZW4nOiAnJ1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBkYXRhID0gTmV0RWFzZUNvbmZpZyhwYXRoLCBib2R5LCAnUE9TVCcpLnJlc3VsdC5zb25nc1xcbiAgICAgICAgICAgIE5ldEVhc2VQYXJzZShsYXlvdXQsIGRhdGEpXFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICBjYXNlICcxJzpcXG4gICAgICAgICAgICBwYXRoID0gJ2h0dHBzOi8vdS55LnFxLmNvbS9jZ2ktYmluL211c2ljdS5mY2cnXFxuICAgICAgICAgICAgYm9keSA9IHtcXG4gICAgICAgICAgICAgICAgXFxcInJlcV8xXFxcIjoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIm1ldGhvZFxcXCI6IFxcXCJEb1NlYXJjaEZvclFRTXVzaWNEZXNrdG9wXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJtb2R1bGVcXFwiOiBcXFwibXVzaWMuc2VhcmNoLlNlYXJjaENnaVNlcnZpY2VcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcInBhcmFtXFxcIjoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJudW1fcGVyX3BhZ2VcXFwiOiAyMCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwicGFnZV9udW1cXFwiOiBwYWdlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJxdWVyeVxcXCI6IGtleXdvcmQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcInNlYXJjaF90eXBlXFxcIjogMFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGRhdGEgPSByZXF1ZXN0KHBhdGgsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly95LnFxLmNvbSdcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgYm9keTogYm9keSxcXG4gICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGRhdGEgPSBKU09OLnBhcnNlKGRhdGEpLnJlcV8xLmRhdGEuYm9keS5zb25nLmxpc3RcXG4gICAgICAgICAgICBUZW5jZW50UGFyc2UobGF5b3V0LCBkYXRhKVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgY2FzZSAnMic6XFxuICAgICAgICAgICAgcGF0aCA9ICdzZWFyY2gvbXVzaWM/a2V5PScgKyBrZXl3b3JkICsgJyZwbj0nICsgcGFnZVxcbiAgICAgICAgICAgIGRhdGEgPSBLd211c2ljY2FyQ29uZmlnKHBhdGgpXFxuICAgICAgICAgICAgS3dtdXNpY2NhclBhcnNlKGxheW91dCwgZGF0YSlcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgICAgIGNhc2UgJzMnOlxcbiAgICAgICAgICAgIHBhdGggPSAnaHR0cDovL21vYmlsZWNkbi5rdWdvdS5jb20vYXBpL3YzL3NlYXJjaC9zb25nP2Zvcm1hdD1qc29uJmtleXdvcmQ9JyArIGtleXdvcmQgKyAnJnBhZ2U9JyArIHBhZ2UgKyAnJnBhZ2VzaXplPTIwJnNob3d0eXBlPTEnXFxuICAgICAgICAgICAgZGF0YSA9IEpTT04ucGFyc2UocmVxdWVzdChwYXRoKSkuZGF0YS5pbmZvXFxuICAgICAgICAgICAgS3Vnb3VQYXJzZShsYXlvdXQsIGRhdGEpXFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICBjYXNlICc0JzpcXG4gICAgICAgICAgICBwYXRoID0gJ2h0dHA6Ly9wZC5tdXNpY2FwcC5taWd1LmNuL01JR1VNMi4wL3YxLjAvY29udGVudC9zZWFyY2hfYW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gICAgICAgcmV0dXJuICQoZW1wdHkpLmxhenlSdWxlKChlbXB0eSwgTXVzaWNNYXAsIGkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignTXVzaWNNYXBDb25maXJtJywgTXVzaWNNYXApXFxcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2luZGV4Q29uZmlybScsIGkpXFxcXG4gICAgICAgICAgICAgICAgY29uZmlybSh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuatjOWNleWIoOmZpFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIuehruWumuWlveS6huWQl++8jOivpeatjOWNleWwhuWIoOmZpFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBNdXNpY01hcCA9IHN0b3JhZ2UwLmdldE15VmFyKCdNdXNpY01hcENvbmZpcm0nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGdldE15VmFyKCdpbmRleENvbmZpcm0nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChnZXRNeVZhcignQnVpbGRNdXNpYycsIE11c2ljTWFwWzBdKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMF06XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRNdXNpYy5OZXRFYXNlLnNwbGljZShpLCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzFdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTXVzaWMuVGVuY2VudC5zcGxpY2UoaSwgMSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsyXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZE11c2ljLkt3bXVzaWNjYXIuc3BsaWNlKGksIDEpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbM106XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRNdXNpYy5LdWdvdS5zcGxpY2UoaSwgMSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZE11c2ljLk1pZ3Uuc3BsaWNlKGksIDEpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn5Yig6Zmk5oiQ5YqfJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcXFxuICAgICAgICAgICAgfSwgZW1wdHksIE11c2ljTWFwLCBpKVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGNhc2UgU2VsZWN0TWFwWzJdOlxcXFxuICAgICAgICAgICAgcHV0TXlWYXIoJ2dldE1vdmUnLCBpKVxcXFxuICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgIHJldHVybiAkKGVtcHR5ICsgJyNhdXRvQ2FjaGUjZnlwYWdlJykucnVsZSgobWlkLCBNdXNpY01hcCwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICBsZXQgcGFnZSA9IE1ZX1BBR0VcXFxcbiAgICAgICAgICAgICAgICBsZXQgbGF5b3V0ID0gW107XFxcXG4gICAgICAgICAgICAgICAgc3dpdGNoIChnZXRNeVZhcignQnVpbGRNdXNpYycsIE11c2ljTWFwWzBdKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzBdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldEVhc2VNYXAgPSAnL2FwaS92Ni9wbGF5bGlzdC9kZXRhaWw/aWQ9JyArIG1pZCArICcmbj0xMDAwJmxpbWl0PTEwMDAnXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgTmV0RWFzZU1hcCA9IE5ldEVhc2VDb25maWcoTmV0RWFzZU1hcCwgJycsICdHRVQnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldEVhc2VQYXJzZShsYXlvdXQsIE5ldEVhc2VNYXAucGxheWxpc3QudHJhY2tzKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFJpY2goU21hbGwoR3JheSgn772e772e772eJyArIE5ldEVhc2VNYXAubWVzc2FnZSArICfvvZ7vvZ7vvZ4nKSkpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBlbXB0eSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzFdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRlbmNlbnRNYXAgPSBUZW5jZW50Q29uZmlnKG1pZCkuU29uZ2xpc3QuZGF0YS5zb25nbGlzdFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRlbmNlbnRQYXJzZShsYXlvdXQsIFRlbmNlbnRNYXApXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsyXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIEt3bXVzaWNjYXJVcmwgPSAnbXVzaWMvcGxheWxpc3QvJyArIG1pZCArICc/cG49JyArIHBhZ2UgKyAnJnJuPTIwJnVhPSZpcD0nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEt3bXVzaWNjYXJNYXAgPSBLd211c2ljY2FyQ29uZmlnKEt3bXVzaWNjYXJVcmwpLm11c2ljTGlzdFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEt3bXVzaWNjYXJQYXJzZShsYXlvdXQsIEt3bXVzaWNjYXJNYXApXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+ezn+ezlUFQSeW0qea6g+S6hicpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFszXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYWdlID09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBLdWdvdVVybCA9ICdodHRwczovL20ua3Vnb3UuY29tL3BsaXN0L2xpc3QvJyArIG1pZCArICcvP2pzb249dHJ1ZSdcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS3Vnb3VNYXAgPSBKU09OLnBhcnNlKHJlcXVlc3QoS3Vnb3VVcmwpKS5saXN0Lmxpc3QuaW5mb1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBLdWdvdVBhcnNlKGxheW91dCwgS3Vnb3VNYXApXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBwZGZoKHJlcXVlc3QobWlkKSwgJ2JvZHkmJnNjcmlwdCwyJiZIdG1sJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkID0gbWlkLm1hdGNoKC93aW5kb3dcXFxcXFxcXC5cXFxcXFxcXCRvdXRwdXQgPSAoW1xcXFxcXFxcU1xcXFxcXFxcc10uKik7LylbMV1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS3Vnb3VNYXAgPSBKU09OLnBhcnNlKG1pZCkuaW5mby5zb25nc1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBLdWdvdVBhcnNlKGxheW91dCwgS3Vnb3VNYXApXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBNaWd1VXJsID0gJ01JR1VNMy4wL3Jlc291cmNlL3BsYXlsaXN0L3NvbmcvdjIuMD9wYWdlTm89JyArIHBhZ2UgKyAnJnBhZ2VTaXplPTUwJnBsYXlsaXN0SWQ9JyArIG1pZFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgTWlndU1hcCA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XaXRoKE11c2ljTWFwWzBdKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBtaWQgPSBpbnB1dC5tYXRjaCgvW0EtWmEtejAtOSsvPV0rJC8pWzBdXFxcXG4gICAgICAgICAgICAgICAgICAgIG1pZCA9IGJhc2U2NERlY29kZShtaWQpXFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dC5zZWFyY2goJ211c2ljLjE2MycpID49IDEpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gaW5wdXQubWF0Y2goLyhwbGF5bGlzdFxcXFxcXFxcL3xpZD0pKFxcXFxcXFxcZCspLylbMl1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgTmV0RWFzZU1hcCA9ICcvYXBpL3Y2L3BsYXlsaXN0L2RldGFpbD9pZD0nICsgbWlkICsgJyZuPTEwMDAmbGltaXQ9MTAwMCdcXFxcbiAgICAgICAgICAgICAgICBOZXRFYXNlTWFwID0gTmV0RWFzZUNvbmZpZyhOZXRFYXNlTWFwLCAnJywgJ0dFVCcpLnBsYXlsaXN0XFxcXG4gICAgICAgICAgICAgICAgQnJlYWsgPSB0cnVlXFxcXG4gICAgICAgICAgICAgICAgTmV0RWFzZS5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5taWQgPT0gTmV0RWFzZU1hcC5pZCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+atjOWNlemHjeWkjeWvvOWFpeS6huWTpicpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBCcmVhayA9IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIGlmIChCcmVhaykge1xcXFxuICAgICAgICAgICAgICAgICAgICBOZXRFYXNlLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogTmV0RWFzZU1hcC5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGljVXJsOiBOZXRFYXNlTWFwLmNvdmVySW1nVXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWlkOiBOZXRFYXNlTWFwLmlkXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsxXTpcXFxcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQuc3RhcnRzV2l0aChNdXNpY01hcFsxXSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gaW5wdXQubWF0Y2goL1tBLVphLXowLTkrLz1dKyQvKVswXVxcXFxuICAgICAgICAgICAgICAgICAgICBtaWQgPSBiYXNlNjREZWNvZGUobWlkKVxcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQuc2VhcmNoKCdxcS5jb20nKSA+PSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG1pZCA9IGlucHV0Lm1hdGNoKC9pZD0oXFxcXFxcXFxkKykvKVsxXVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBUZW5jZW50TWFwID0gVGVuY2VudENvbmZpZyhOdW1iZXIobWlkKSkuU29uZ2xpc3QuZGF0YS5kaXJpbmZvXFxcXG4gICAgICAgICAgICAgICAgQnJlYWsgPSB0cnVlXFxcXG4gICAgICAgICAgICAgICAgVGVuY2VudC5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5taWQgPT0gVGVuY2VudE1hcC5pZCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+atjOWNlemHjeWkjeWvvOWFpeS6huWTpicpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBCcmVhayA9IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIGlmIChCcmVhaykge1xcXFxuICAgICAgICAgICAgICAgICAgICBUZW5jZW50LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogVGVuY2VudE1hcC50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpY1VybDogVGVuY2VudE1hcC5waWN1cmwsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQ6IFRlbmNlbnRNYXAuaWRcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICBjYXNlIE11c2ljTWFwWzJdOlxcXFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dC5zdGFydHNXaXRoKE11c2ljTWFwWzJdKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBtaWQgPSBpbnB1dC5tYXRjaCgvW0EtWmEtejAtOSsvPV0rJC8pWzBdXFxcXG4gICAgICAgICAgICAgICAgICAgIG1pZCA9IGJhc2U2NERlY29kZShtaWQpXFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dC5zZWFyY2goJ2t1d28uY24nKSA+PSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG1pZCA9IGlucHV0Lm1hdGNoKC8ocGxheWxpc3RcXFxcXFxcXC98cGxheWxpc3RfZGV0YWlsXFxcXFxcXFwvKShcXFxcXFxcXGQrKS8pWzJdXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIEt3bXVzaWNjYXJVcmwgPSAnbXVzaWMvcGxheWxpc3QvJyArIG1pZCArICc/cG49MSZybj0yMCZ1YT0maXA9J1xcXFxuICAgICAgICAgICAgICAgIEt3bXVzaWNjYXJNYXAgPSBLd211c2ljY2FyQ29uZmlnKEt3bXVzaWNjYXJVcmwpXFxcXG4gICAgICAgICAgICAgICAgQnJlYWsgPSB0cnVlXFxcXG4gICAgICAgICAgICAgICAgS3dtdXNpY2Nhci5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5taWQgPT0gS3dtdXNpY2Nhck1hcC5pZCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+atjOWNlemHjeWkjeWvvOWFpeS6huWTpicpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBCcmVhayA9IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIGlmIChCcmVhaykge1xcXFxuICAgICAgICAgICAgICAgICAgICBLd211c2ljY2FyLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogS3dtdXNpY2Nhck1hcC5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGljVXJsOiBLd211c2ljY2FyTWFwLnBpYyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZDogS3dtdXNpY2Nhck1hcC5pZFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbM106XFxcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN0YXJ0c1dpdGgoTXVzaWNNYXBbM10pKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBJbnB1dCA9IGlucHV0Lm1hdGNoKC9bQS1aYS16MC05Ky89XSskLylbMF1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIElucHV0ID0gYmFzZTY0RGVjb2RlKElucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWlkID0gcGRmaChyZXF1ZXN0KElucHV0KSwgJ2JvZHkmJnNjcmlwdCwyJiZIdG1sJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZCA9IG1pZC5tYXRjaCgvd2luZG93XFxcXFxcXFwuXFxcXFxcXFwkb3V0cHV0ID0gKFtcXFxcXFxcXFNcXFxcXFxcXHNdLiopOy8pWzFdXFxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQuc2VhcmNoKCdrdWdvdS5jb20nKSA+PSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBJbnB1dCA9IGlucHV0Lm1hdGNoKC8oaHR0cHN8aHR0cCkoLipsaW5rKS8pWzBdXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBwZGZoKHJlcXVlc3QoSW5wdXQpLCAnYm9keSYmc2NyaXB0LDImJkh0bWwnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWlkID0gbWlkLm1hdGNoKC93aW5kb3dcXFxcXFxcXC5cXFxcXFxcXCRvdXRwdXQgPSAoW1xcXFxcXFxcU1xcXFxcXFxcc10uKik7LylbMV1cXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICBLdWdvdU1hcCA9IEpTT04ucGFyc2UobWlkKS5pbmZvLmxpc3RpbmZvXFxcXG4gICAgICAgICAgICAgICAgICAgIEJyZWFrID0gdHJ1ZVxcXFxuICAgICAgICAgICAgICAgICAgICBLdWdvdS5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0ubWlkID09IElucHV0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+atjOWNlemHjeWkjeWvvOWFpeS6huWTpicpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgQnJlYWsgPSBmYWxzZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoQnJlYWspIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIEt1Z291LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IEt1Z291TWFwLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljVXJsOiBLdWdvdU1hcC5waWMucmVwbGFjZSgne3NpemV9JywgJzQwMCcpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pZDogSW5wdXRcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0LnN0YXJ0c1dpdGgoTXVzaWNNYXBbM10pKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBpbnB1dC5tYXRjaCgvW0EtWmEtejAtOSsvPV0rJC8pWzBdXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBiYXNlNjREZWNvZGUobWlkKVxcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0LnNlYXJjaCgna3Vnb3UuY29tJykgPj0gMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWlkID0gaW5wdXQubWF0Y2goLyhcXFxcXFxcXC9saXN0XFxcXFxcXFwvKSguKilcXFxcXFxcXC8vKVsyXVxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIEt1Z291VXJsID0gJ2h0dHBzOi8vbTN3cy5rdWdvdS5jb20vcGxpc3QvbGlzdC8nICsgbWlkXFxcXG4gICAgICAgICAgICAgICAgICAgIEt1Z291TWFwID0gcmVxdWVzdChLdWdvdVVybClcXFxcbiAgICAgICAgICAgICAgICAgICAgQnJlYWsgPSB0cnVlXFxcXG4gICAgICAgICAgICAgICAgICAgIEt1Z291LmZvckVhY2goaXRlbSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5taWQgPT0gbWlkKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+atjOWNlemHjeWkjeWvvOWFpeS6huWTpicpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgQnJlYWsgPSBmYWxzZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoQnJlYWspIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIEt1Z291LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IHBkZmgoS3Vnb3VNYXAsICcuY29udGVudCYmcCYmVGV4dCcpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpY1VybDogcGRmaChLdWdvdU1hcCwgJy5jb250ZW50JiZpbWcmJl9zcmMnKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWQ6IG1pZFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQuc3RhcnRzV2l0aChNdXNpY01hcFs0XSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbWlkID0gaW5wdXQubWF0Y2goL1tBLVphLXowLTkrLz1dKyQvKVswXVxcXFxuICAgICAgICAgICAgICAgICAgICBtaWQgPSBiYXNlNjREZWNvZGUobWlkKVxcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQuc2VhcmNoKCdtaWd1LmNuJykgPj0gMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQuc3RhcnRzV2l0aCgn5YiG5LqrJykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZCA9IGlucHV0Lm1hdGNoKC8oaHR0cHN8aHR0cCkuKihcXFxcXFxcXHcpLylbMF1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG1pZCA9IEpTT04ucGFyc2UocmVxdWVzdChtaWQsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvbmx5SGVhZGVyczogdHJ1ZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSkpLnVybFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWlkID0gbWlkLm1hdGNoKC8oaWQ9KShcXFxcXFxcXGQrKS8pWzJdXFxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtaWQgPSBpbnB1dC5tYXRjaCgvKHBsYXlsaXN0XFxcXFxcXFwvKShcXFxcXFxcXGQrKS8pWzJdXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgTWlndVVybCA9ICdNSUdVTTMuMC9yZXNvdXJjZS9wbGF5bGlzdC92Mi4wP3BsYXlsaXN0SWQ9JyArIG1pZFxcXFxuICAgICAgICAgICAgICAgIE1pZ3VNYXAgPSBNaWd1Q29uZmlnKE1pZ3VVcmwpLmRhdGFcXFxcbiAgICAgICAgICAgICAgICBCcmVhayA9IHRydWVcXFxcbiAgICAgICAgICAgICAgICBNaWd1LmZvckVhY2goaXRlbSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLm1pZCA9PSBNaWd1TWFwLm11c2ljTGlzdElkKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn5q2M5Y2V6YeN5aSN5a+85YWl5LqG5ZOmJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgaWYgKEJyZWFrKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIE1pZ3UucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBNaWd1TWFwLnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGljVXJsOiBN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1bGUoKE11c2ljTWFwLCBtaWQsIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgbGV0IGxheW91dCA9IFtdO1xcXFxuICAgICAgICAgICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ011c2ljTXlNYXAnLCBNdXNpY01hcFswXSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFswXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIE5ldEVhc2VNYXAgPSAnL2FwaS92Ni9wbGF5bGlzdC9kZXRhaWw/aWQ9JyArIG1pZCArICcmbj0xMDAwJmxpbWl0PTEwMDAnXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBOZXRFYXNlTWFwID0gTmV0RWFzZUNvbmZpZyhOZXRFYXNlTWFwLCAnJywgJ0dFVCcpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldEVhc2VQYXJzZShsYXlvdXQsIE5ldEVhc2VNYXAucGxheWxpc3QudHJhY2tzKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFJpY2goU21hbGwoR3JheSgn772e772e772eJyArIE5ldEVhc2VNYXAubWVzc2FnZSArICfvvZ7vvZ7vvZ4nKSkpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGVtcHR5LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBUZW5jZW50TWFwID0gVGVuY2VudENvbmZpZyhtaWQpLlNvbmdsaXN0LmRhdGEuc29uZ2xpc3RcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFRlbmNlbnRQYXJzZShsYXlvdXQsIFRlbmNlbnRNYXApXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxcXG4gICAgICAgICAgICB9LCBNdXNpY01hcCwgbWlkLCBteW5hbWUpXFxcXG4gICAgfVxcXFxuICAgIHJldHVybiBlbXB0eVxcXFxufVxcXFxuXFxcXG5jb25zdCBnZXRTZWxlY3RMaXN0TWFwID0gKFNlbGVjdE1hcCwgaSwgaXRlbSkgPT4ge1xcXFxuICAgIHN3aXRjaCAoZ2V0SXRlbSgnZ2V0VXBNYXAnLCBTZWxlY3RNYXBbU2VsZWN0TWFwLmxlbmd0aCAtIDFdKSkge1xcXFxuICAgICAgICBjYXNlIFNlbGVjdE1hcFswXTpcXFxcbiAgICAgICAgICAgIGdldENvcHkgPSBzaGFyZVBhc3RlKGJhc2U2NEVuY29kZShKU09OLnN0cmluZ2lmeShpdGVtKSkpICsgJ1xcXFxcXFxcblxcXFxcXFxcbuiHquW7uuatjOWNle+8micgKyBpdGVtLm5hbWVcXFxcbiAgICAgICAgICAgIGNvcHkoZ2V0Q29weSlcXFxcbiAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICBjYXNlIFNlbGVjdE1hcFsxXTpcXFxcbiAgICAgICAgICAgIHB1dE15VmFyKCdpbmRleENvbmZpcm0nLCBpKVxcXFxuICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLmxhenlSdWxlKChlbXB0eSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLmrYzljZXliKDpmaRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcXFxcXCLnoa7lrprlpb3kuoblkJfvvIzor6XmrYzljZXlsIbliKDpmaRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGdldE15VmFyKCdpbmRleENvbmZpcm0nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3Quc3BsaWNlKGksIDEpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfliKDpmaTmiJDlip8nKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5XFxcXG4gICAgICAgICAgICB9LCBlbXB0eSlcXFxcbiAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICBjYXNlIFNlbGVjdE1hcFsyXTpcXFxcbiAgICAgICAgICAgIHB1dE15VmFyKCdnZXRNb3ZlJywgaSlcXFxcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGNhc2UgU2VsZWN0TWFwWzNdOlxcXFxuICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLnJ1bGUoKGksIGl0ZW0sIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgbGV0IGxheW91dCA9IFtdO1xcXFxuICAgICAgICAgICAgICAgIGdldEVkaXRQYXJzZShsYXlvdXQsIGksIGl0ZW0pXFxcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxcXG4gICAgICAgICAgICB9LCBpLCBpdGVtLCBteW5hbWUpXFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgIHJldHVybiAkKGVtcHR5KS5ydWxlKChpLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgIGxldCBsYXlvdXQgPSBbXTtcXFxcbiAgICAgICAgICAgICAgICBCdWlsZExpc3RQYXJzZShsYXlvdXQsIGkpXFxcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxcXG4gICA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iBcXFxcXFxcIuehruWumuWlveS6huWQl++8jOivpeatjOWNleWwhuimhuebllxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBCdWlsZExpc3QgPSBkYXRhTWFwLkJ1aWxkTGlzdFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBzdG9yYWdlMC5nZXRNeVZhcign6Ieq5bu65q2M5Y2VJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIEJ1aWxkTGlzdFtnZXRNeVZhcignQnJlYWtJbmRleCcpXSA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBkYXRhLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljczogZGF0YS5waWNzLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEuZGF0YVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgIH1cXF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XFxcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbTXVzaWNNYXAubGVuZ3RoIC0gMV06XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cE1hcCA9IFsn5q2M5Y2V5qC35byPJ11cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwc01hcCA9IHN0b3JhZ2UwLmdldE15VmFyKCdTZWFyY2hNdXNpY01hcCcsIFsn6IGa5ZCI5pCc57SiJ10pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlTWFwID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ1NlbGVjdE1hcCcpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cE1hcCA9IHN0b3JhZ2VNYXAuY29uY2F0KHVwc01hcC5jb25jYXQodXBNYXApKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIDIsICflt7LpgInmi6ktJyArICdbJyArIGdldEl0ZW0oJ2dldFVwTWFwJywgc3RvcmFnZU1hcFtzdG9yYWdlTWFwLmxlbmd0aCAtIDFdKSArICddJykuc2VsZWN0KCh1cE1hcCwgZW1wdHksIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoaW5wdXQpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSB1cE1hcFt1cE1hcC5sZW5ndGggLSAxXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKGdldENvbFR5cGVzKCksIDIsICflt7LpgInmi6ktJyArICdbJyArIGdldEl0ZW0oJ2dldENvbFR5cGVzJywgJ2NhcmRfcGljXzMnKSArICddJykuc2VsZWN0KCgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKCdnZXRDb2xUeXBlcycsIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfliIfmjaLmoLflvI8tJyArIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIHVwTWFwW3VwTWFwLmxlbmd0aCAtIDJdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuTWFwID0gWyfogZrlkIjmkJzntKInXVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZnVuc01hcCA9IFsn5Y6f55Sf5pCc57SiJ11cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3RvcmFnZTAuZ2V0TXlWYXIoJ1NlYXJjaE11c2ljTWFwJywgZnVuTWFwKVswXSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgZnVuTWFwWzBdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignU2VhcmNoTXVzaWNNYXAnLCBmdW5zTWFwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ1NlYXJjaE11c2ljTWFwJywgZnVuTWFwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJ+WIm+W7uuatjOWNlSc6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChlbXB0eSkucnVsZSgobXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKCfliJvlu7rmrYzljZUnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGxheW91dCA9IFtdO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENyZWF0ZUxpc3RQYXJzZShsYXlvdXQpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oJ2dldFVwTWFwJywgaW5wdXQpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn5YiH5o2i5pa55rOVLScgKyBpbnB1dClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVwTWFwLCBlbXB0eSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignTXVzaWNNYXAnLCBpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFySXRlbSgnZ2V0VXBNYXAnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0sIGl0ZW0sIGVtcHR5LCBteW5hbWUsIE11c2ljTWFwKSxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9KVxcXFxuICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgY29sX3R5cGU6ICdibGFua19ibG9jaydcXFxcbiAgICB9KVxcXFxuICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ011c2ljTWFwJywgTXVzaWNNYXBbMF0pKSB7XFxcXG4gICAgICAgIGNhc2UgTXVzaWNNYXBbMF06XFxcXG4gICAgICAgICAgICBnZXRNeU11c2ljUGFyc2UobGF5b3V0KVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGNhc2UgTXVzaWNNYXBbMV06XFxcXG4gICAgICAgICAgICBnZ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AgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcXFxuICAgICAgICAgICAgfSwgaXRlbSwgZW1wdHkpLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJ1xcXFxuICAgICAgICB9KVxcXFxuICAgIH0pXFxcXG4gICAgYWRkTGlzdGVuZXIoJ29uUmVmcmVzaCcsICQudG9TdHJpbmcoKCkgPT4ge1xcXFxuICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfms6jplIAnLCAnMCcpKSB7XFxcXG4gICAgICAgICAgICBjYXNlICcwJzpcXFxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcign5rOo6ZSAJywgMSk7XFxcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICBkZWZhdWx0OlxcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfms6jplIAnLCAwKTtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgfVxcXFxuICAgIH0pKTtcXFxcbiAgICBzd2l0Y2ggKGdldE15VmFyKCdNdXNpY015TWFwJywgTXVzaWNNYXBbMF0pKSB7XFxcXG4gICAgICAgIGNhc2UgTXVzaWNNYXBbMF06XFxcXG4gICAgICAgICAgICBnZXROZXRFYXNlUGFyc2UobGF5b3V0LCBkYXRhTWFwLCBNdXNpY01hcClcXFxcbiAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICBkZWZhdWx0OlxcXFxuICAgICAgICAgICAgZ2V0VGVuY2VudFBhcnNlKGxheW91dCwgZGF0YU1hcCwgTXVzaWNNYXApXFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICB9XFxcXG59XFxcXG5cXFxcbmNvbnN0IGdldEJ1aWxkTXVzaWNQYXJzZSA9IChsYXlvdXQpID0+IHtcXFxcbiAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1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gbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgY2xlYXJNeVZhcignc3dpdGNoJylcXFxcbiAgICAgICAgICAgIHJldHVybiBnZXRTZWxlY3RNYXAoTXVzaWNNYXAsIFNlbGVjdE1hcCwgaSwgbWlkLCBuYW1lKVxcXFxuICAgICAgICB9LCBNdXNpY01hcCwgU2VsZWN0TWFwLCBpLCBpdGVtLm1pZCwgaXRlbS5uYW1lLCBteW5hbWUpXFxcXG4gICAgICAgIGlmIChnZXRNeVZhcignZ2V0TW92ZScsICcnKSkge1xcXFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKCdnZXRNb3ZlJywgJycpID09IGkpIHtcXFxcbiAgICAgICAgICAgICAgICBuYW1lID0gUmljaChTbWFsbChTcHJpbmdHcmVlbihuYW1lKSkpXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBzZWxlY3QgPSAkKGVtcHR5KS5sYXp5UnVsZSgoTXVzaWNNYXAsIGksIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgcmVhZEZpbGUoZG93bikpXFxcXG4gICAgICAgICAgICAgICAgaW5kZXggPSBOdW1iZXIoZ2V0TXlWYXIoJ2dldE1vdmUnKSlcXFxcbiAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCdCdWlsZE11c2ljJywgTXVzaWNNYXBbMF0pKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMF06XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBnZXRNb3ZlKGRhdGFNYXAuQnVpbGRNdXNpYy5OZXRFYXNlLCBpbmRleCwgaSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzFdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TW92ZShkYXRhTWFwLkJ1aWxkTXVzaWMuVGVuY2VudCwgaW5kZXgsIGkpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsyXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGdldE1vdmUoZGF0YU1hcC5CdWlsZE11c2ljLkt3bXVzaWNjYXIsIGluZGV4LCBpKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbM106XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBnZXRNb3ZlKGRhdGFNYXAuQnVpbGRNdXNpYy5LdWdvdSwgaW5kZXgsIGkpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGdldE1vdmUoZGF0YU1hcC5CdWlsZE11c2ljLk1pZ3UsIGluZGV4LCBpKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdnZXRNb3ZlJylcXFxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXFxcbiAgICAgICAgICAgIH0sIE11c2ljTWFwLCBpLCBteW5hbWUpXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IG5hbWUsXFxcXG4gICAgICAgICAgICBpbWc6IGl0ZW0ucGljVXJsLFxcXFxuICAgICAgICAgICAgdXJsOiBzZWxlY3QsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2NhcmRfcGljXzMnLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcXFxuICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmrYzljZXliIbkuqsnLFxcXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoTXVzaWNNYXAsIG1pZCwgbmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29weSA9IGdldE15VmFyKCdCdWlsZE11c2ljJywgTXVzaWNNYXBbMF0pICsgJ1xcXFxcXFxcbuatjOWNleWQjeensO+8micgKyBuYW1lICsgJ1xcXFxcXFxcbuatjOWNleivhuWIq++8micgKyBiYXNlNjRFbmNvZGUoJycgKyBtaWQgKyAnJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvcHkoZ2V0Q29weSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgTXVzaWNNYXAsIGl0ZW0ubWlkLCBpdGVtLm5hbWUpXFxcXG4gICAgICAgICAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+WIoOmZpOatjOWNlScsXFxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChNdXNpY01hcCwgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ011c2ljTWFwQ29uZmlybScsIE11c2ljTWFwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2luZGV4Q29uZmlybScsIGkpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLmrYzljZXliKDpmaRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIuehruWumuWlveS6huWQl++8jOivpeatjOWNleWwhuWIoOmZpFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm06ICgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXVzaWNNYXAgPSBzdG9yYWdlMC5nZXRNeVZhcignTXVzaWNNYXBDb25maXJtJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA9IGdldE15VmFyKCdpbmRleENvbmZpcm0nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCdCdWlsZE11c2ljJywgTXVzaWNNYXBbMF0pKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzBdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRNdXNpYy5OZXRFYXNlLnNwbGljZShpLCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsxXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTXVzaWMuVGVuY2VudC5zcGxpY2UoaSwgMSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMl06XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZE11c2ljLkt3bXVzaWNjYXIuc3BsaWNlKGksIDEpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzNdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRNdXNpYy5LdWdvdS5zcGxpY2UoaSwgMSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZE11c2ljLk1pZ3Uuc3BsaWNlKGksIDEpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+WIoOmZpOaIkOWKnycpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIE11c2ljTWFwLCBpKVxcXFxuICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfnva7pobbmrYzljZUnLFxcXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygobmFtZSwgTXVzaWNNYXApID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIHJlYWRGaWxlKGRvd24pKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChnZXRNeVZhcignQnVpbGRNdXNpYycsIE11c2ljTWFwWzBdKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMF06XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuTmV0RWFzZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzFdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZGF0YU1hcC5CdWlsZE11c2ljLlRlbmNlbnRcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsyXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGRhdGFNYXAuQnVpbGRNdXNpYy5Ld211c2ljY2FyXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbM106XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuS3Vnb3VcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGRhdGFNYXAuQnVpbGRNdXNpYy5NaWd1XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG9iaiA9IHt9O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLm5hbWUgPT09IG5hbWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2JqID0gaXRlbTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5zcGxpY2UoaW5kZXgsIDEpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS51bnNoaWZ0KG9iaik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgaXRlbS5uYW1lLCBNdXNpY01hcClcXFxcbiAgICAgICAgICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn572u5bqV5q2M5Y2VJyxcXFxcbiAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIE11c2ljTWFwKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyByZWFkRmlsZShkb3duKSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ0J1aWxkTXVzaWMnLCBNdXNpY01hcFswXSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzBdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZGF0YU1hcC5CdWlsZE11c2ljLk5ldEVhc2VcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNdXNpY01hcFsxXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGRhdGFNYXAuQnVpbGRNdXNpYy5UZW5jZW50XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTXVzaWNNYXBbMl06XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuS3dtdXNpY2NhclxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE11c2ljTWFwWzNdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gZGF0YU1hcC5CdWlsZE11c2ljLkt1Z291XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhTWFwLkJ1aWxkTXVzaWMuTWlndVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBvYmogPSB7fTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuZm9yRWFjaCgoaXRlbSwgaW5kZXgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5uYW1lID09PSBuYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iaiA9IGl0ZW07XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuc3BsaWNlKGluZGV4LCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XFxcXG4gICAgICAgICAgICAgICAgICAgICA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aSkge1xcXFxuICAgICAgICAgICAgICAgIG5hbWUgPSBSaWNoKFNtYWxsKFNwcmluZ0dyZWVuKG5hbWUpKSlcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHNlbGVjdCA9ICQoZW1wdHkpLmxhenlSdWxlKChpLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIHJlYWRGaWxlKGRvd24pKVxcXFxuICAgICAgICAgICAgICAgIGluZGV4ID0gTnVtYmVyKGdldE15VmFyKCdnZXRNb3ZlJykpXFxcXG4gICAgICAgICAgICAgICAgZ2V0TW92ZShkYXRhTWFwLkJ1aWxkTGlzdCwgaW5kZXgsIGkpXFxcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcXFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2dldE1vdmUnKVxcXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcXFxuICAgICAgICAgICAgfSwgaSwgbXluYW1lKVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiBuYW1lLFxcXFxuICAgICAgICAgICAgaW1nOiBpdGVtLnBpY3MsXFxcXG4gICAgICAgICAgICB1cmw6IHNlbGVjdCxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnY2FyZF9waWNfMycsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxcXG4gICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+atjOWNleWIhuS6qycsXFxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBnZXRDb3B5ID0gc2hhcmVQYXN0ZShiYXNlNjRFbmNvZGUoSlNPTi5zdHJpbmdpZnkoaXRlbSkpKSArICdcXFxcXFxcXG5cXFxcXFxcXG7oh6rlu7rmrYzljZXvvJonICsgaXRlbS5uYW1lXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb3B5KGdldENvcHkpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0pXFxcXG4gICAgICAgICAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+WIoOmZpOatjOWNlScsXFxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignaW5kZXhDb25maXJtJywgaSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuatjOWNleWIoOmZpFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXFxcXFwi56Gu5a6a5aW95LqG5ZCX77yM6K+l5q2M5Y2V5bCG5Yig6ZmkXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpID0gZ2V0TXlWYXIoJ2luZGV4Q29uZmlybScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIGRhdGFNYXApXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0LnNwbGljZShpLCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn5Yig6Zmk5oiQ5YqfJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgaSlcXFxcbiAgICAgICAgICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn572u6aG25q2M5Y2VJyxcXFxcbiAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YU1hcCA9JyArIHJlYWRGaWxlKGRvd24pKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG9iaiA9IHt9O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3QuZm9yRWFjaCgoaXRlbSwgaW5kZXgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5uYW1lID09PSBuYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iaiA9IGl0ZW07XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0LnNwbGljZShpbmRleCwgMSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdC51bnNoaWZ0KG9iaik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgaXRlbS5uYW1lKVxcXFxuICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfnva7lupXmrYzljZUnLFxcXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygobmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgcmVhZEZpbGUoZG93bikpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgb2JqID0ge307XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdC5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLm5hbWUgPT09IG5hbWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2JqID0gaXRlbTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3Quc3BsaWNlKGluZGV4LCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0LnB1c2gob2JqKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLm5hbWUpXFxcXG4gICAgICAgICAgICAgICAgfV1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSlcXFxcbiAgICB9KVxcXFxuICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgdGl0bGU6ICfmrYzljZXlr7zlhaUnLFxcXFxuICAgICAgICBpbWc6ICdodHRwczovL21pc3N1by5ydS9maWxlLzFlYjYyMTlkYjg2MzI0MjhhMjM5Ni5qcGcnLFxcXFxuICAgICAgICB1cmw6ICQoJ3t7Y2xpcGJvYXJkfX0nKS5pbnB1dCgobXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgcmV0dXJuIGdldFNlbGVjdExpc3RJbXBvcnQoaW5wdXQpXFxcXG4gICAgICAgIH0sIG15bmFtZSksXFxcXG4gICAgICAgIGNvbF90eXBlOiAnY2FyZF9waWNfMydcXFxcbiAgICB9KVxcXFxufVxcXFxuXFxcXG5jb25zdCBnZXROZXRFYXNlUGFyc2UgPSAobGF5b3V0LCBkYXRhTWFwLCBNdXNpY01hcCkgPT4ge1xcXFxuICAgIE5ldEVhc2VNYXAgPSBkYXRhTWFwLk5ldEVhc2VcXFxcbiAgICBpZiAoTmV0RWFzZU1hcCA9PSBudWxsIHx8IE5ldEVhc2VNYXAubGVuZ3RoID09IDApIHtcXFxcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6ICfmn6VcXFxcXFxcXG7or6InLFxcXFxuICAgICAgICAgICAgZGVzYzogXFxcXFxcXCLovpPlhaXlhbPplK7or43mn6Xor6LnlKjmiLdcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIHVybDogJC50b1N0cmluZygoZW1wdHkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcign5YWz6ZSu6K+NJywgaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcXFxuICAgICAgICAgICAgfSwgZW1wdHkpLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdpbnB1dCcsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIHR5cGU6ICd0ZXh0YXJlYScsXFxcXG4gICAgICAgICAgICAgICAgaGVpZ2h0OiAzLFxcXFxuICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoJ+WFs+mUruivjScpXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pXFxcXG4gICAgICAgIGlmIChnZXRNeVZhcign5YWz6ZSu6K+NJywgJycpICE9ICcnKSB7XFxcXG4gICAgICAgICAgICBwYXRoID0gJy93ZWFwaS9zZWFyY2gvZ2V0J1xcXFxuICAgICAgICAgICAgYm9keSA9IHtcXFxcbiAgICAgICAgICAgICAgICBcXFxcXFxcInNcXFxcXFxcIjogZ2V0TXlWYXIoJ+WFs+mUruivjScpLFxcXFxuICAgICAgICAgICAgICAgIFxcXFxcXFwidHlwZVxcXFxcXFwiOiAxMDAyLFxcXFxuICAgICAgICAgICAgICAgIFxcXFxcXFwibGltaXRcXFxcXFxcIjogMzAsXFxcXG4gICAgICAgICAgICAgICAgXFxcXFxcXCJvZmZzZXRcXFxcXFxcIjogMFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgZGF0YSA9IE5ldEVhc2VDb25maWcocGF0aCwgYm9keSwgJ1BPU1QnKVxcXFxuICAgICAgICAgICAgZGF0YS5yZXN1bHQudXNlcnByb2ZpbGVzLmZvckVhY2goaXRlbSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5uaWNrbmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLmF2YXRhclVybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoZW1wdHksIHVzZXJJZCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGEgPScgKyBkYXRhKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5OZXRFYXNlID0gW11cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEuTmV0RWFzZS5wdXNoKHVzZXJJZClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGEpLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcXFxuICAgICAgICAgICAgICAgICAgICB9LCBlbXB0eSwgaXRlbS51c2VySWQpLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcidcXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgfVxcXFxuICAgIH0gZWxzZSB7XFxcXG4gICAgICAgIE5ldEVhc2VNYXAgPSAnL2FwaS91c2VyL3BsYXlsaXN0P29mZnNldD0wJnVpZD0nICsgZGF0YU1hcC5OZXRFYXNlWzBdICsgJyZsaW1pdD0xMDAwJ1xcXFxuICAgICAgICBOZXRFYXNlTWFwID0gTmV0RWFzZUNvbmZpZyhOZXRFYXNlTWFwLCAnJywgJ0dFVCcpLnBsYXlsaXN0XFxcXG4gICAgICAgIFNlbGVjdE1hcCA9IFsn5q2M5Y2V5YiG5LqrJywgJ+afpeeci+WGheWuuSddXFxcXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdTZWxlY3RNYXAnLCBTZWxlY3RNYXApXFxcXG4gICAgICAgIE5ldEVhc2VNYXAuZm9yRWFjaChpdGVtID0+IHtcXFxcbiAgICAgICAgICAgIGlmIChpdGVtLm5hbWUuc2VhcmNoKCfllpzmrKLnmoTpn7PkuZAnKSA8IDEpIHtcXFxcbiAgICAgICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGltZzogaXRlbS5jb3ZlckltZ1VybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5ICsgJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKE11c2ljTWFwLCBTZWxlY3RNYXAsIG1pZCwgbmFtZSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignc3dpdGNoJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRNeVNlbGVjdE1hcChNdXNpY01hcCwgU2VsZWN0TWFwLCBtaWQsIG5hbWUsIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICB9LCBNdXNpY01hcCwgU2VsZWN0TWFwLCBpdGVtLmlkLCBpdGVtLm5hbWUsIG15bmFtZSksXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnY2FyZF9waWNfMycsXFxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5q2M5Y2V5YiG5LqrJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoTXVzaWNNYXAsIG1pZCwgbmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb3B5ID0gZ2V0TXlWYXIoJ011c2ljTXlNYXAnLCBNdXNpY01hcFswXSkgKyAnXFxcXFxcXFxu5q2M5Y2V5ZCN56ew77yaJyArIG5hbWUgKyAnXFxcXFxcXFxu5q2M5Y2V6K+G5Yir77yaJyArIGJhc2U2NEVuY29kZSgnJyArIG1pZCArICcnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3B5KGdldENvcHkpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgTXVzaWNNYXAsIGl0ZW0uaWQsIGl0ZW0ubmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1dXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KVxcXFxuICAgICAgICBpZiAoZ2V0TXlWYXIoJ+azqOmUgCcsICcwJykgPT0gMSkge1xcXFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBSaWNoKFNtYWxsKEdyYXkoJ++9nu+9nu+9nuazqOmUgOe7keWumu+9nu+9nu+9nicpKSksXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoZW1wdHkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgZGF0YSA9IHJlYWRGaWxlKGRvd24pO1xcXFxuICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXFxcbiAgICAgICAgICAgICAgICAgICAgZGF0YS5OZXRFYXNlID0gW11cXFxcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcXFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCfms6jplIAnKVxcXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcXFxuICAgICAgICAgICAgICAgIH0sIGVtcHR5KSxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcbiAgICB9XFxcXG59XFxcXG5cXFxcbmNvbnN0IGdldFRlbmNlbnRQYXJzZSA9IChsYXlvdXQsIGRhdGFNYXAsIE11c2ljTWFwKSA9PiB7XFxcXG4gICAgVGVuY2VudE1hcCA9IGRhdGFNYXAuVGVuY2VudFxcXFxuICAgIGlmIChUZW5jZW50TWFwID09IG51bGwgfHwgVGVuY2VudE1hcC5sZW5ndGggPT0gMCkge1xcXFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxcXG4gICAgICAgICAgICBkZXNjOiBcXFxcXFxcIuivt+i+k+WFpeaCqOeahFFR5Y+3XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJpbnB1dFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICB0eXBlOiAndGV4dGFyZWEnLFxcXFxuICAgICAgICAgICAgICAgIGhlaWdodDogMyxcXFxcbiAgICAgICAgICAgICAgICBvbkNoYW5nZTogXFxcXFxcXCJzZXRJdGVtKCdRUScsIGlucHV0KVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2VcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgdGl0bGU6IFJpY2goU3Ryb25nKEdyYXkoJ+e7keWumui0puWPtycpKSksXFxcXG4gICAgICAgICAgICB1cmw6ICQoZW1wdHkpLmxhenlSdWxlKChlbXB0eSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICAgICAgZGF0YSA9IHJlYWRGaWxlKGRvd24pO1xcXFxuICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGEgPScgKyBkYXRhKVxcXFxuICAgICAgICAgICAgICAgIGRhdGEuVGVuY2VudCA9IFtdXFxcXG4gICAgICAgICAgICAgICAgZGF0YS5UZW5jZW50LnB1c2goZ2V0SXRlbSgnUVEnKSlcXFxcbiAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eVxcXFxuICAgICAgICAgICAgfSwgZW1wdHkpLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pXFxcXG4gICAgfSBlbHNlIHtcXFxcbiAgICAgICAgVGVuY2VudFVybCA9ICdodHRwOi8vYy55LnFxLmNvbS9yc2MvZmNnaS1iaW4vZmNnX3VzZXJfY3JlYXRlZF9kaXNzP2hvc3R1aW49JyArIGRhdGFNYXAuVGVuY2VudFswXSArICcmc2l6ZT0xMDAwJmZvcm1hdD1qc29uJ1xcXFxuICAgICAgICBUZW5jZW50TWFwID0gVGVuY2VudENvbmZpZyhUZW5jZW50VXJsKVxcXFxuICAgICAgICBTZWxlY3RNYXAgPSBbJ+atjOWNleWIhuS6qycsICfmn6XnnIvlhoXlrrknXVxcXFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignU2VsZWN0TWFwJywgU2VsZWN0TWFwKVxcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgVGVuY2VudE1hcCA9IFRlbmNlbnRNYXAuZGF0YS5kaXNzbGlzdFxcXFxuICAgICAgICAgICAgVGVuY2VudE1hcCA9IFRlbmNlbnRNYXAuZmlsdGVyKGl0ZW0gPT4gaXRlbS50aWQgIT0gMClcXFxcbiAgICAgICAgICAgIGlmIChUZW5jZW50TWFwLmxlbmd0aCA+IDApIHtcXFxcbiAgICAgICAgICAgICAgICBUZW5jZW50TWFwLmZvckVhY2goaXRlbSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLmRpc3NfbmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGltZzogaXRlbS5kaXNzX2NvdmVyLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5ICsgJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKE11c2ljTWFwLCBTZWxlY3RNYXAsIG1pZCwgbmFtZSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdzd2l0Y2gnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRNeVNlbGVjdE1hcChNdXNpY01hcCwgU2VsZWN0TWFwLCBtaWQsIG5hbWUsIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgTXVzaWNNYXAsIFNlbGVjdE1hcCwgaXRlbS50aWQsIGl0ZW0uZGlzc19uYW1lLCBteW5hbWUpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdjYXJkX3BpY18zJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5q2M5Y2V5YiG5LqrJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKE11c2ljTWFwLCBtaWQsIG5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldENvcHkgPSBnZXRNeVZhcignTXVzaWNNeU1hcCcsIE11c2ljTWFwWzBdKSArICdcXFxcXFxcXG7mrYzljZXlkI3np7DvvJonICsgbmFtZSArICdcXFxcXFxcXG7mrYzljZXor4bliKvvvJonICsgYmFzZTY0RW5jb2RlKCcnICsgbWlkICsgJycpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3B5KGdldENvcHkpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIE11c2ljTWFwLCBpdGVtLnRpZCwgaXRlbS5kaXNzX25hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfV1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBSaWNoKFNtYWxsKEdyYXkoJ++9nu+9nu+9nuWVpeS5n+ayoeacieeVmeS4i++9nu+9nu+9nicpKSksXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogZW1wdHksXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ4nICsgVGVuY2VudE1hcC5tZXNzYWdlICsgJ++9nu+9nu+9nicpKSksXFxcXG4gICAgICAgICAgICAgICAgdXJsOiBlbXB0eSxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgaWYgKGdldE15VmFyKCfms6jplIAnLCAnMCcpID09IDEpIHtcXFxcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ7ms6jplIDnu5HlrprvvZ7vvZ7vvZ4nKSkpLFxcXFxuICAgICAgICAgICAgICAgIHVybDogJChlbXB0eSkubGF6eVJ1bGUoKGVtcHR5KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICAgICAgICAgIGRhdGEgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgZXZhbCgnZGF0YSA9JyArIGRhdGEpXFxcXG4gICAgICAgICAgICAgICAgICAgIGRhdGEuVGVuY2VudCA9IFtdXFxcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGEpLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcign5rOo6ZSAJylcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXFxcbiAgICAgICAgICAgICAgICB9LCBlbXB0eSksXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICB9XFxcXG4gICAgfVxcXFxufVxcXFxuXFxcXG5jb25zdCBnZXRDb25maXJtID0gKCkgPT4ge1xcXFxuICAgIGlmICghZ2V0TXlWYXIoJ+Wksei0pScpKSB7XFxcXG4gICAgICAgIGNvbmZpcm0oe1xcXFxuICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5pCc57Si5q2M5puyXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIuiLpeWFjeWXheWksei0pe+8jOWwhuaQnOe0ouatjOabslxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCflpLHotKUnLCB0cnVlKTtcXFxcbiAgICAgICAgICAgICAgICB0b2FzdCgnZW1tbX4nKTtcXFxcbiAgICAgICAgICAgICAgICBqYXZhLmxhbmcuVGhyZWFkLnNsZWVwKDMwMDApO1xcXFxuICAgICAgICAgICAgICAgIHRvYXN0KCfkuIvmrKHph43lkK/vvIzlsIbph43mlrDmi4nlkK/lvLnnqpcnKVxcXFxuICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgIGNhbmNlbDogKCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCflpLHotKUnLCBmYWxzZSk7XFxcXG4gICAgICAgICAgICAgICAgdG9hc3QoJ+S/uuS4jeimgeODvSjiiafQlOKJpinjg45+Jyk7XFxcXG4gICAgICAgICAgICAgICAgamF2YS5sYW5nLlRocmVhZC5zbGVlcCgzMDAwKTtcXFxcbiAgICAgICAgICAgICAgICB0b2FzdCgn5LiL5qyh6YeN5ZCv77yM5bCG6YeN5paw5ouJ5ZCv5by556qXJylcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSlcXFxcbiAgICB9XFxcXG59XFxcXG5cXFxcbmNvbnN0IGdldEluY2x1ZGVkUGFyc2UgPSAobGF5b3V0KSA9PiB7XFxcXG4gICAgZ2V0Q29uZmlybSgpXFxcXG4gICAgYWRkTGlzdGVuZXIoJ29uUmVmcmVzaCcsICQudG9TdHJpbmcoKCkgPT4ge1xcXFxuICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfmm7TlpJonLCAnMCcpKSB7XFxcXG4gICAgICAgICAgICBjYXNlICcwJzpcXFxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcign5pu05aSaJywgMSk7XFxcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICBkZWZhdWx0OlxcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfmm7TlpJonLCAwKTtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgfVxcXFxuICAgIH0pKTtcXFxcbiAgICBhZGRMaXN0ZW5lcignb25DbG9zZScsICgpID0+IHtcXFxcbiAgICAgICAgY2xlYXJNeVZhcign5pu05aSaJylcXFxcbiAgICB9KVxcXFxuICAgIFNlbGVjdE1hcCA9IFsn5pS25b2V5q2M5puyJywgJ+iBhuWQrOatjOabsiddXFxcXG4gICAgaWYgKGdldE15VmFyKCfmm7TlpJonLCAnMCcpID09IDEgJiYgTVlfUEFHRSA9PSAxKSB7XFxcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnbGluZV9ibGFuaydcXFxcbiAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgdGl0bGU6IFJpY2goU21hbGwoR3JheSgn772e772e772e5pu05aSa6YCJ6aG5772e772e772eJykpKSxcXFxcbiAgICAgICAgICAgIHVybDogJChTZWxlY3RNYXAsIDEsICflt7LpgInmi6ktJyArICdbJyArIGdldE15VmFyKCfmm7TlpJrlip/og70nLCBTZWxlY3RNYXBbU2VsZWN0TWFwLmxlbmd0aCAtIDFdKSArICddJykuc2VsZWN0KChlbXB0eSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfmm7TlpJrlip/og70nLCBpbnB1dClcXFxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5XFxcXG4gICAgICAgICAgICB9LCBlbXB0eSksXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lX2JsYW5rJ1xcXFxuICAgICAgICB9KVxcXFxuICAgIH1cXFxcbn1cXFxcblxcXFxuY29uc3QgZ2V0SW5jbHVkZWRGdW4gPSAoKSA9PiB7XFxcXG4gICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL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sdChsYXlvdXQpO1xcXFxuICAgICAgICAgICAgfSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgZGF0YSA9IHJlYWRGaWxlKGRvd24pO1xcXFxuICAgICAgICAgICAgZXZhbCgnZGF0YSA9JyArIGRhdGEpXFxcXG4gICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxcXG4gICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdC5mb3JFYWNoKChJdGVtLCB4KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09IEl0ZW0ubmFtZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IHRydWVcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5kZXggPSB4XFxcXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCfoh6rlu7rmrYzljZUnLCBpdGVtKVxcXFxuICAgICAgICAgICAgICAgICAgICBJdGVtLmRhdGEuZm9yRWFjaCgoSXRlbXMsIGkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJdGVtcy5taWQgPT0gaXRlbS5pZCAmJiBJdGVtcy5pZCA9PSAnbmV0ZWFzZScpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleCcsIGluZGV4KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4cycsIGkpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybSh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuaUtuW9leimhuebllxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIuehruWumuWlveS6huWQl++8jOatjOabsuWwhuimhuebluWOn+acieeahFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBCdWlsZExpc3QgPSBkYXRhTWFwLkJ1aWxkTGlzdFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0ID0gQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4JyldLmRhdGFcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ+iHquW7uuatjOWNlScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ID0gZGF0YS5hci5tYXAodGFnID0+IHRhZy5uYW1lKS5qb2luKCfjgIEnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4cycpXSA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBkYXRhLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udDogY29udCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNzOiBkYXRhLmFsLnBpY1VybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWQ6IGRhdGEuaWQsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICduZXRlYXNlJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+imhuebluaIkOWKnycpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgaWYgKGdldEJyZWFrKSB7XFxcXG4gICAgICAgICAgICAgICAgY29udCA9IGl0ZW0uYXIubWFwKHRhZyA9PiB0YWcubmFtZSkuam9pbign44CBJylcXFxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdFtpbmRleF0uZGF0YS5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogaXRlbS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb250OiBjb250LFxcXFxuICAgICAgICAgICAgICAgICAgICBwaWNzOiBpdGVtLmFsLnBpY1VybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgbWlkOiBpdGVtLmlkLFxcXFxuICAgICAgICAgICAgICAgICAgICBpZDogJ25ldGVhc2UnXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgdG9hc3QoJ+aUtuW9leaIkOWKnycpXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICB9XFxcXG59XFxcXG5cXFxcbmNvbnN0IGdldEluY2x1ZGVkVGVuY2VudCA9IChpdGVtLCBpbnB1dCkgPT4ge1xcXFxuICAgIHN3aXRjaCAoaW5wdXQpIHtcXFxcbiAgICAgICAgY2FzZSAn5Yib5bu65q2M5Y2VJzpcXFxcbiAgICAgICAgICAgIHJldHVybiAkKGVtcHR5KS5ydWxlKChteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBzZXRQYWdlVGl0bGUoJ+WIm+W7uuatjOWNlScpXFxcXG4gICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICBsZXQgbGF5b3V0ID0gW107XFxcXG4gICAgICAgICAgICAgICAgQ3JlYXRlTGlzdFBhcnNlKGxheW91dClcXFxcbiAgICAgICAgICAgICAgICBzZXRSZXN1bHQobGF5b3V0KTtcXFxcbiAgICAgICAgICAgIH0sIG15bmFtZSlcXFxcbiAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICBkZWZhdWx0OlxcXFxuICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgIGRhdGEgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgIGV2YWwoJ2RhdGEgPScgKyBkYXRhKVxcXFxuICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcXFxuICAgICAgICAgICAgZGF0YS5CdWlsZExpc3QuZm9yRWFjaCgoSXRlbSwgeCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBJdGVtLm5hbWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSB0cnVlXFxcXG4gICAgICAgICAgICAgICAgICAgIGluZGV4ID0geFxcXFxuICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcign6Ieq5bu65q2M5Y2VJywgaXRlbSlcXFxcbiAgICAgICAgICAgICAgICAgICAgSXRlbS5kYXRhLmZvckVhY2goKEl0ZW1zLCBpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoSXRlbXMubWlkID09IGl0ZW0ubWlkICYmIEl0ZW1zLmlkID09ICd0ZW5jZW50Jykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4JywgaW5kZXgpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ0JyZWFrSW5kZXhzJywgaSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5pS25b2V6KaG55uWXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXFxcXFwi56Gu5a6a5aW95LqG5ZCX77yM5q2M5puy5bCG6KaG55uW5Y6f5pyJ55qEXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm06ICgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IEJ1aWxkTGlzdCA9IGRhdGFNYXAuQnVpbGRMaXN0XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3QgPSBCdWlsZExpc3RbZ2V0TXlWYXIoJ0JyZWFrSW5kZXgnKV0uZGF0YVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBzdG9yYWdlMC5nZXRNeVZhcign6Ieq5bu65q2M5Y2VJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gJydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLnN1YnRpdGxlKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VidGl0bGUgPSBkYXRhLnN1YnRpdGxlICsgJy0nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaW5nZXIgPSBkYXRhLnNpbmdlci5tYXAodGFnID0+IHRhZy5uYW1lKS5qb2luKCfjgIEnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW1nID0gJ2h0dHBzOi8vbWlzc3VvLnJ1L2ZpbGUvNTFlNzg1ZDM0YWJhODFmNjE5OTRmLmpwZydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmFsYnVtLm1pZCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGltZyA9ICdodHRwczovL3kuZ3RpbWcuY24vbXVzaWMvcGhvdG9fbmV3L1QwMDJSMzAweDMwME0wMDAnICsgZGF0YS5hbGJ1bS5taWQgKyAnLmpwZydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJ1aWxkTGlzdFtnZXRNeVZhcignQnJlYWtJbmRleHMnKV0gPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZGF0YS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250OiBzdWJ0aXRsZSArIHNpbmdlcixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNzOiBpbWcsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkOiBkYXRhLm1pZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogJ3RlbmNlbnQnXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdCgn6KaG55uW5oiQ5YqfJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICBpZiAoZ2V0QnJlYWspIHtcXFxcbiAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9ICcnXFxcXG4gICAgICAgICAgICAgICAgaWYgKGl0ZW0uc3VidGl0bGUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgc3VidGl0bGUgPSBpdGVtLnN1YnRpdGxlICsgJy0nXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHNpbmdlciA9IGl0ZW0uc2luZ2VyLm1hcCh0YWcgPT4gdGFnLm5hbWUpLmpvaW4oJ+OAgScpXFxcXG4gICAgICAgICAgICAgICAgaW1nID0gJ2h0dHBzOi8vbWlzc3VvLnJ1L2ZpbGUvNTFlNzg1ZDM0YWJhODFmNjE5OTRmLmpwZydcXFxcbiAgICAgICAgICAgICAgICBpZiAoaXRlbS5hbGJ1bS5taWQpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1nID0gJ2h0dHBzOi8veS5ndGltZy5jbi9tdXNpYy9waG90b19uZXcvVDAwMlIzMDB4MzAwTTAwMCcgKyBpdGVtLmFsYnVtLm1pZCArICcuanBnJ1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdFtpbmRleF0uZGF0YS5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogaXRlbS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udDogc3VidGl0bGUgKyBzaW5nZXIsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBpY3M6IGltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgbWlkOiBpdGVtLm1pZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6ICd0ZW5jZW50J1xcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcXFxuICAgICAgICAgICAgICAgIHRvYXN0KCfmlLblvZXmiJDlip8nKVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgfVxcXFxufVxcXFxuXFxcXG5jb25zdCBnZXRJbmNsdWRlZEt3bXVzaWNjYXIgPSAoaXRlbSwgcGljcywgaW5wdXQpID0+IHtcXFxcbiAgICBzd2l0Y2ggKGlucHV0KSB7XFxcXG4gICAgICAgIGNhc2UgJ+WIm+W7uuatjOWNlSc6XFxcXG4gICAgICAgICAgICByZXR1cm4gJChlbXB0eSkucnVsZSgobXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKCfliJvlu7rmrYzljZUnKVxcXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgbGV0IGxheW91dCA9IFtdO1xcXFxuICAgICAgICAgICAgICAgIENyZWF0ZUxpc3RQYXJzZShsYXlvdXQpXFxcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxcXG4gICAgICAgICAgICB9LCBteW5hbWUpXFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICBkYXRhID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXFxcbiAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0LmZvckVhY2goKEl0ZW0sIHgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gSXRlbS5uYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGdldEJyZWFrID0gdHJ1ZVxcXFxuICAgICAgICAgICAgICAgICAgICBpbmRleCA9IHhcXFxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ+iHquW7uuatjOWNlScsIGl0ZW0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdLd211c2ljUGljcycsIHBpY3MpXFxcXG4gICAgICAgICAgICAgICAgICAgIEl0ZW0uZGF0YS5mb3JFYWNoKChJdGVtcywgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEl0ZW1zLm1pZCA9PSBpdGVtLmlkICYmIEl0ZW1zLmlkID09ICdrdXdvJykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4JywgaW5kZXgpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ0JyZWFrSW5kZXhzJywgaSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5pS25b2V6KaG55uWXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXFxcXFwi56Gu5a6a5aW95LqG5ZCX77yM5q2M5puy5bCG6KaG55uW5Y6f5pyJ55qEXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm06ICgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IEJ1aWxkTGlzdCA9IGRhdGFNYXAuQnVpbGRMaXN0XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3QgPSBCdWlsZExpc3RbZ2V0TXlWYXIoJ0JyZWFrSW5kZXgnKV0uZGF0YVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBzdG9yYWdlMC5nZXRNeVZhcign6Ieq5bu65q2M5Y2VJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gJydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkYXRhLmFydGlzdF9uYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VidGl0bGUgPSBkYXRhLmFydGlzdF9uYW1lICsgJy0nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaW5nZXIgPSAnJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEuYWxidW1fbmFtZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpbmdlciA9IGRhdGEuYWxidW1fbmFtZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4cycpXSA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBkYXRhLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udDogc3VidGl0bGUgKyBzaW5nZXIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljczogZ2V0TXlWYXIoJ0t3bXVzaWNQaWNzJyksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWlkOiBkYXRhLmlkLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiAna3V3bydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfopobnm5bmiJDlip8nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgIGlmIChnZXRCcmVhaykge1xcXFxuICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gJydcXFxcbiAgICAgICAgICAgICAgICBpZiAoaXRlbS5hcnRpc3RfbmFtZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9IGl0ZW0uYXJ0aXN0X25hbWUgKyAnLSdcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgc2luZ2VyID0gJydcXFxcbiAgICAgICAgICAgICAgICBpZiAoaXRlbS5hbGJ1bV9uYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHNpbmdlciA9IGl0ZW0uYWxidW1fbmFtZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdFtpbmRleF0uZGF0YS5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogaXRlbS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb250OiBzdWJ0aXRsZSArIHNpbmdlcixcXFxcbiAgICAgICAgICAgICAgICAgICAgcGljczogcGljcyxcXFxcbiAgICAgICAgICAgICAgICAgICAgbWlkOiBpdGVtLmlkLFxcXFxuICAgICAgICAgICAgICAgICAgICBpZDogJ2t1d28nXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgdG9hc3QoJ+aUtuW9leaIkOWKnycpXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICB9XFxcXG59XFxcXG5cXFxcbmNvbnN0IGdldEluY2x1ZGVkS3Vnb3UgPSAoZGF0ZSwgaXRlbSwgaSwgaW5wdXQpID0+IHtcXFxcbiAgICBzd2l0Y2ggKGlucHV0KSB7XFxcXG4gICAgICAgIGNhc2UgJ+WIm+W7uuatjOWNlSc6XFxcXG4gICAgICAgICAgICByZXR1cm4gJChlbXB0eSkucnVsZSgobXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKCfliJvlu7rmrYzljZUnKVxcXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgbGV0IGxheW91dCA9IFtdO1xcXFxuICAgICAgICAgICAgICAgIENyZWF0ZUxpc3RQYXJzZShsYXlvdXQpXFxcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxcXG4gICAgICAgICAgICB9LCBteW5hbWUpXFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICBkYXRhID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXFxcbiAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0LmZvckVhY2goKEl0ZW0sIHgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gSXRlbS5uYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGdldEJyZWFrID0gdHJ1ZVxcXFxuICAgICAgICAgICAgICAgICAgICBpbmRleCA9IHhcXFxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ+iHquW7uuatjOWNlScsIGl0ZW0pXFxcXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCfoh6rlu7pQbGF5JywgZGF0ZVtpXSlcXFxcbiAgICAgICAgICAgICAgICAgICAgSXRlbS5kYXRhLmZvckVhY2goKEl0ZW1zLCBsKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoSXRlbXMubWlkLmhhc2ggPT0gZGF0ZVtpXS5oYXNoICYmIEl0ZW1zLmlkID09ICdrdWdvdScpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleCcsIGluZGV4KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4cycsIGwpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybSh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuaUtuW9leimhuebllxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIuehruWumuWlveS6huWQl++8jOatjOabsuWwhuimhuebluWOn+acieeahFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBCdWlsZExpc3QgPSBkYXRhTWFwLkJ1aWxkTGlzdFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0ID0gQnVpbGRMaXN0W2dldE15VmFyKCdCcmVha0luZGV4JyldLmRhdGFcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ+iHquW7uuatjOWNlScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGF0ZSA9IHN0b3JhZ2UwLmdldE15VmFyKCfoh6rlu7pQbGF5JylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJ1aWxkTGlzdFtnZXRNeVZhcignQnJlYWtJbmRleHMnKV0gPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogZGF0ZS5maWxlbmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNzOiBkYXRhLmltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWQ6IGRhdGUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdrdWdvdSdcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfopobnm5bmiJDlip8nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgIGlmIChnZXRCcmVhaykge1xcXFxuICAgICAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0W2luZGV4XS5kYXRhLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICBuYW1lOiBkYXRlW2ldLmZpbGVuYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICBwaWNzOiBpdGVtLmltZyxcXFxcbiAgICAgICAgICAgICAgICAgICAgbWlkOiBkYXRlW2ldLFxcXFxuICAgICAgICAgICAgICAgICAgICBpZDogJ2t1Z291J1xcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcXFxuICAgICAgICAgICAgICAgIHRvYXN0KCfmlLblvZXmiJDlip8nKVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgfVxcXFxufVxcXFxuXFxcXG5jb25zdCBnZXRJbmNsdWRlZE1pZ3UgPSAoaXRlbSwgaW5wdXQpID0+IHtcXFxcbiAgICBzd2l0Y2ggKGlucHV0KSB7XFxcXG4gICAgICAgIGNhc2UgJ+WIm+W7uuatjOWNlSc6XFxcXG4gICAgICAgICAgICByZXR1cm4gJChlbXB0eSkucnVsZSgobXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKCfliJvlu7rmrYzljZUnKVxcXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgbGV0IGxheW91dCA9IFtdO1xcXFxuICAgICAgICAgICAgICAgIENyZWF0ZUxpc3RQYXJzZShsYXlvdXQpXFxcXG4gICAgICAgICAgICAgICAgc2V0UmVzdWx0KGxheW91dCk7XFxcXG4gICAgICAgICAgICB9LCBteW5hbWUpXFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICBkYXRhID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXFxcbiAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0LmZvckVhY2goKEl0ZW0sIHgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gSXRlbS5uYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGdldEJyZWFrID0gdHJ1ZVxcXFxuICAgICAgICAgICAgICAgICAgICBpbmRleCA9IHhcXFxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ+iHquW7uuatjOWNlScsIGl0ZW0pXFxcXG4gICAgICAgICAgICAgICAgICAgIEl0ZW0uZGF0YS5mb3JFYWNoKChJdGVtcywgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKEl0ZW1zLm1pZC5jb3B5cmlnaHRJZCA9PSBpdGVtLmNvcHlyaWdodElkICYmIEl0ZW1zLmlkID09ICdtaWd1Jykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4JywgaW5kZXgpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ0JyZWFrSW5kZXhzJywgaSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5pS25b2V6KaG55uWXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IFxcXFxcXFwi56Gu5a6a5aW95LqG5ZCX77yM5q2M5puy5bCG6KaG55uW5Y6f5pyJ55qEXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm06ICgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IEJ1aWxkTGlzdCA9IGRhdGFNYXAuQnVpbGRMaXN0XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3QgPSBCdWlsZExpc3RbZ2V0TXlWYXIoJ0JyZWFrSW5kZXgnKV0uZGF0YVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBzdG9yYWdlMC5nZXRNeVZhcign6Ieq5bu65q2M5Y2VJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IE1pZ3VGaWxsID0gKHVybCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghL14oaHR0cHM/KS8udGVzdCh1cmwpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImh0dHA6Ly9kLm11c2ljYXBwLm1pZ3UuY24vXFxcXFxcXCIgKyB1cmw7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybDtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9ICcnXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YS5hbGJ1bSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gZGF0YS5hbGJ1bSArICctJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2luZ2VyID0gZGF0YS5zaW5nZXJMaXN0Lm1hcCh0YWcgPT4gdGFnLm5hbWUpLmpvaW4oJ+OAgScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBCdWlsZExpc3RbZ2V0TXlWYXIoJ0JyZWFrSW5kZXhzJyldID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGRhdGEuc29uZ05hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udDogc3VidGl0bGUgKyBzaW5nZXIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljczogTWlndUZpbGwoZGF0YS5pbWcxKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtaWQ6IGRhdGEsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6ICdtaWd1J1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+imhuebluaIkOWKnycpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgaWYgKGdldEJyZWFrKSB7XFxcXG4gICAgICAgICAgICAgICAgc3VidGl0bGUgPSAnJ1xcXFxuICAgICAgICAgICAgICAgIGlmIChpdGVtLmFsYnVtKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlID0gaXRlbS5hbGJ1bSArICctJ1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBzaW5nZXIgPSBpdGVtLnNpbmdlckxpc3QubWFwKHRhZyA9PiB0YWcubmFtZSkuam9pbign44CBJylcXFxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdFtpbmRleF0uZGF0YS5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogaXRlbS5zb25nTmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udDogc3VidGl0bGUgKyBzaW5nZXIsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBpY3M6IE1pZ3VGaWxsKGl0ZW0uaW1nMSksXFxcXG4gICAgICAgICAgICAgICAgICAgIG1pZDogaXRlbSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6ICdtaWd1J1xcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YSksIDApO1xcXFxuICAgICAgICAgICAgICAgIHRvYXN0KCfmlLblvZXmiJDlip8nKVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgfVxcXFxufVxcXFxuXFxcXG5jb25zdCBOZXRFYXNlUGFyc2UgPSAobGF5b3V0LCBkYXRhKSA9PiB7XFxcXG4gICAgZ2V0SW5jbHVkZWRQYXJzZShsYXlvdXQpXFxcXG4gICAgdHJ5IHtcXFxcbiAgICAgICAgaWYgKGRhdGEubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgZGF0YS5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgICAgIHNpbmdlciA9IGl0ZW0uYXIubWFwKHRhZyA9PiB0YWcubmFtZSkuam9pbign44CBJylcXFxcbiAgICAgICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHNpbmdlcixcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLmFsLnBpY1VybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoaXRlbSwgbXluYW1lLCBTZWxlY3RNYXApID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfmm7TlpJrlip/og70nLCBTZWxlY3RNYXBbMV0pKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTZWxlY3RNYXBbMF06XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWROZXRFYXNlKGl0ZW0sIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldE5ldEVhc2VQbGF5ZXIoaXRlbS5pZCwgaXRlbS5uYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUsIFNlbGVjdE1hcCksXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJyksXFxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5pS25b2V5q2M5puyJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWROZXRFYXNlKGl0ZW0sIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5pCc57SiID0+ICcgKyBpdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0Q29uZmlybVNlYXJjaChuYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0ubmFtZSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfV1cXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBSaWNoKFNtYWxsKEdyYXkoJ++9nu+9nu+9nuWVpeS5n+ayoeacieeVmeS4i++9nu+9nu+9nicpKSksXFxcXG4gICAgICAgICAgICAgICAgdXJsOiBlbXB0eSxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcbiAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgIHRvYXN0KCfliLDlupXkuoblk6YnKVxcXFxuICAgIH1cXFxcbn1cXFxcblxcXFxuY29uc3QgVGVuY2VudFBhcnNlID0gKGxheW91dCwgZGF0YSkgPT4ge1xcXFxuICAgIGdldEluY2x1ZGVkUGFyc2UobGF5b3V0KVxcXFxuICAgIGlmIChkYXRhLmxlbmd0aCA+IDApIHtcXFxcbiAgICAgICAgZGF0YS5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgc3VidGl0bGUgPSAnJ1xcXFxuICAgICAgICAgICAgaWYgKGl0ZW0uc3VidGl0bGUpIHtcXFxcbiAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9IGl0ZW0uc3VidGl0bGUgKyAnLSdcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHNpbmdlciA9IGl0ZW0uc2luZ2VyLm1hcCh0YWcgPT4gdGFnLm5hbWUpLmpvaW4oJ+OAgScpXFxcXG4gICAgICAgICAgICBpbWcgPSAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJ1xcXFxuICAgICAgICAgICAgaWYgKGl0ZW0uYWxidW0ubWlkKSB7XFxcXG4gICAgICAgICAgICAgICAgaW1nID0gJ2h0dHBzOi8veS5ndGltZy5jbi9tdXNpYy9waG90b19uZXcvVDAwMlIzMDB4MzAwTTAwMCcgKyBpdGVtLmFsYnVtLm1pZCArICcuanBnJ1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6IHN1YnRpdGxlICsgc2luZ2VyLFxcXFxuICAgICAgICAgICAgICAgIGltZzogaW1nLFxcXFxuICAgICAgICAgICAgICAgIHVybDogJChlbXB0eSkubGF6eVJ1bGUoKGl0ZW0sIG15bmFtZSwgU2VsZWN0TWFwKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ+abtOWkmuWKn+iDvScsIFNlbGVjdE1hcFsxXSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU2VsZWN0TWFwWzBdOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCh1cE1hcCwgaW5kZXgsICfmlLblvZXmrYzmm7InKS5zZWxlY3QoKGl0ZW0sIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWRUZW5jZW50KGl0ZW0sIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0VGVuY2VudFBsYXllcihpdGVtLm1pZCwgaXRlbS50aXRsZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lLCBTZWxlY3RNYXApLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJyksXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmlLblvZXmrYzmm7InLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0sIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SW5jbHVkZWRGdW4oKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKHVwTWFwLCBpbmRleCwgJ+aUtuW9leatjOabsicpLnNlbGVjdCgoaXRlbSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRJbmNsdWRlZFRlbmNlbnQoaXRlbSwgaW5wdXQpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aQnOe0oiA9PiAnICsgaXRlbS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChuYW1lLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRDb25maXJtU2VhcmNoKG5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLnRpdGxlLCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgIH1dXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9IGVsc2Uge1xcXFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxcXG4gICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ7llaXkuZ/msqHmnInnlZnkuIvvvZ7vvZ7vvZ4nKSkpLFxcXFxuICAgICAgICAgICAgdXJsOiBlbXB0eSxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KVxcXFxuICAgIH1cXFxcbn1cXFxcblxcXFxuY29uc3QgS3dtdXNpY2NhclBhcnNlID0gKGxheW91dCwgZGF0YSkgPT4ge1xcXFxuICAgIGdldEluY2x1ZGVkUGFyc2UobGF5b3V0KVxcXFxuICAgIHRyeSB7XFxcXG4gICAgICAgIGlmIChkYXRhLmxlbmd0aCA+IDApIHtcXFxcbiAgICAgICAgICAgIGRhdGFzID0gZGF0YVxcXFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKCdzd2l0Y2gnLCAnMCcpID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhLm1hcChpdGVtID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEt3bXVzaWNjYXJDb25maWcoJ211c2ljL2luZm8vJyArIGl0ZW0uaWQpLmluZm9cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgZGF0YS5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgc3VidGl0bGUgPSAnJ1xcXFxuICAgICAgICAgICAgICAgIGlmIChkYXRhc1tpXS5hcnRpc3RfbmFtZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBzdWJ0aXRsZSA9IGRhdGFzW2ldLmFydGlzdF9uYW1lICsgJy0nXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHNpbmdlciA9ICcnXFxcXG4gICAgICAgICAgICAgICAgaWYgKGRhdGFzW2ldLmFsYnVtX25hbWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgc2luZ2VyID0gZGF0YXNbaV0uYWxidW1fbmFtZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBkYXRhc1tpXS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBzdWJ0aXRsZSArIHNpbmdlcixcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLnBpYyB8fCAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoaXRlbSwgcGljcywgbXluYW1lLCBTZWxlY3RNYXApID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfmm7TlpJrlip/og70nLCBTZWxlY3RNYXBbMV0pKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBTZWxlY3RNYXBbMF06XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBwaWNzLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWRLd211c2ljY2FyKGl0ZW0sIHBpY3MsIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBwaWNzLCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldEt3bXVzaWNjYXJQbGF5ZXIoaXRlbS5pZClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgZGF0YXNbaV0sIGl0ZW0ucGljLCBteW5hbWUsIFNlbGVjdE1hcCksXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJyksXFxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5pS25b2V5q2M5puyJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgcGljcywgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEluY2x1ZGVkRnVuKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBwaWNzLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0SW5jbHVkZWRLd211c2ljY2FyKGl0ZW0sIHBpY3MsIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBwaWNzLCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgZGF0YXNbaV0sIGl0ZW0ucGljLCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmkJzntKIgPT4gJyArIGRhdGFzW2ldLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0Q29uZmlybVNlYXJjaChuYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRhdGFzW2ldLm5hbWUsIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1dXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgfVxcXFxuICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgdG9hc3QoJ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CwgJ+aUtuW9leatjOabsicpLnNlbGVjdCgoZGF0YSwgaXRlbSwgaSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRJbmNsdWRlZEt1Z291KGRhdGEsIGl0ZW0sIGksIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRhdGEsIGl0ZW0sIGksIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0S3Vnb3VQbGF5ZXIoZGF0YVtpXSwgZGF0YVtpXS5maWxlbmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSwgZGF0YSwgaXRlbSwgbXluYW1lLCBTZWxlY3RNYXAsIGkpLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJyksXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmlLblvZXmrYzmm7InLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGRhdGEsIGl0ZW0sIG15bmFtZSwgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SW5jbHVkZWRGdW4oKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKHVwTWFwLCBpbmRleCwgJ+aUtuW9leatjOabsicpLnNlbGVjdCgoZGF0YSwgaXRlbSwgaSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRJbmNsdWRlZEt1Z291KGRhdGEsIGl0ZW0sIGksIGlucHV0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRhdGEsIGl0ZW0sIGksIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGRhdGEsIGl0ZW0sIG15bmFtZSwgaSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmkJzntKIgPT4gJyArIGRhdGFbaV0uZmlsZW5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygobmFtZSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0Q29uZmlybVNlYXJjaChuYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgZGF0YVtpXS5maWxlbmFtZSwgbXluYW1lKVxcXFxuICAgICAg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uICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGdldE15VmFyKCfmm7TlpJrlip/og70nLCBTZWxlY3RNYXBbMV0pKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFNlbGVjdE1hcFswXTpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJbmNsdWRlZEZ1bigpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQodXBNYXAsIGluZGV4LCAn5pS25b2V5q2M5puyJykuc2VsZWN0KChpdGVtLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldEluY2x1ZGVkTWlndShpdGVtLCBpbnB1dClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldE1pZ3VQbGF5ZXIoaXRlbSwgKGl0ZW0uc29uZ05hbWUgfHwgaXRlbS5uYW1lKSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lLCBTZWxlY3RNYXApLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBnZXRJdGVtKCdnZXRDb2xUeXBlcycsICdjYXJkX3BpY18zJyksXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfmlLblvZXmrYzmm7InLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0sIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0SW5jbHVkZWRGdW4oKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKHVwTWFwLCBpbmRleCwgJ+aUtuW9leatjOabsicpLnNlbGVjdCgoaXRlbSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRJbmNsdWRlZE1pZ3UoaXRlbSwgaW5wdXQpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aQnOe0oiA9PiAnICsgKGl0ZW0uc29uZ05hbWUgfHwgaXRlbS5uYW1lKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChuYW1lLCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmln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ubGF6eVJ1bGUoKGVtcHR5KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgY29uZmlybSh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuatjOabsuWIoOmZpFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIuehruWumuWlveS6huWQl++8jOivpeatjOabsuWwhuWIoOmZpFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmRleCA9IGdldE15VmFyKCdpbmRleENvbmZpcm0nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXhzID0gZ2V0TXlWYXIoJ2luZGV4c0NvbmZpcm0nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyBkYXRhTWFwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3RbaW5kZXhzXS5kYXRhLnNwbGljZShpbmRleCwgMSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+WIoOmZpOaIkOWKnycpO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXFxcbiAgICAgICAgICAgIH0sIGVtcHR5KVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGNhc2UgU2VsZWN0TWFwWzFdOlxcXFxuICAgICAgICAgICAgcHV0TXlWYXIoJ2dldE1vdmUnLCBpbmRleClcXFxcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGNhc2UgU2VsZWN0TWFwWzJdOlxcXFxuICAgICAgICAgICAgbmFtZXMgPSBkYXRhLkJ1aWxkTGlzdC5tYXAoaXQgPT4gaXQubmFtZSlcXFxcbiAgICAgICAgICAgIHVwTWFwID0gbmFtZXMuY29uY2F0KFsn5Yib5bu65q2M5Y2VJ10pXFxcXG4gICAgICAgICAgICBpbmRleCA9IDFcXFxcbiAgICAgICAgICAgIGlmICh1cE1hcC5sZW5ndGggPiAyKSB7XFxcXG4gICAgICAgICAgICAgICAgaW5kZXggPSAyXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gJCh1cE1hcCwgaW5kZXgsIFNlbGVjdE1hcFsyXSkuc2VsZWN0KChteW5hbWUsIGVtcHR5KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgc3dpdGNoIChpbnB1dCkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjYXNlICfliJvlu7rmrYzljZUnOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoZW1wdHkpLnJ1bGUoKG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZSgn5Yib5bu65q2M5Y2VJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBsYXlvdXQgPSBbXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBDcmVhdGVMaXN0UGFyc2UobGF5b3V0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChsYXlvdXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyByZWFkRmlsZShkb3duKSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIEluZGV4ID0gZ2V0TXlWYXIoJ2luZGV4Q29uZmlybScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBJbmRleHMgPSBnZXRNeVZhcignaW5kZXhzQ29uZmlybScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpdGVtID0gZGF0YU1hcC5CdWlsZExpc3RbSW5kZXhzXS5kYXRhW0luZGV4XVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3QuZm9yRWFjaCgoSXRlbSwgeCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBJdGVtLm5hbWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSB0cnVlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0geFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcign6Ieq5bu65q2M5Y2VJywgaXRlbSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgSXRlbS5kYXRhLmZvckVhY2goKEl0ZW1zLCBpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoSXRlbXMubmFtZSA9PSBpdGVtLm5hbWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignQnJlYWtJbmRleCcsIGluZGV4KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdCcmVha0luZGV4cycsIGkpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybSh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuaUtuW9leimhuebllxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIuehruWumuWlveS6huWQl++8jOatjOabsuWwhuimhuebluWOn+acieeahFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyByZWFkRmlsZShkb3duKSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEluZGV4ID0gZ2V0TXlWYXIoJ2luZGV4Q29uZmlybScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJbmRleHMgPSBnZXRNeVZhcignaW5kZXhzQ29uZmlybScpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleCA9IGdldE15VmFyKCdCcmVha0luZGV4JylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4cyA9IGdldE15VmFyKCdCcmVha0luZGV4cycpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgQnVpbGRMaXN0ID0gZGF0YU1hcC5CdWlsZExpc3RcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJ1aWxkTGlzdCA9IEJ1aWxkTGlzdFtpbmRleF0uZGF0YVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnVpbGRMaXN0W2luZGV4c10gPSBzdG9yYWdlMC5nZXRNeVZhcign6Ieq5bu65q2M5Y2VJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChJbmRleHMgIT0gaW5kZXgpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdFtJbmRleHNdLmRhdGEuc3BsaWNlKEluZGV4LCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoZG93biwgSlNPTi5zdHJpbmdpZnkoZGF0YU1hcCksIDApO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+imhuebluaIkOWKnycpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QnJlYWsgPSBmYWxzZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0QnJlYWspIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdFtJbmRleHNdLmRhdGEuc3BsaWNlKEluZGV4LCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4XS5kYXRhLnB1c2goaXRlbSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+abtOaNouaIkOWKnycpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9LCBteW5hbWUsIGVtcHR5KVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICByZXR1cm4gJChlbXB0eSkubGF6eVJ1bGUoKGl0ZW0sIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9Db25maWcudmlldz9ydWxlPScgKyBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgc3dpdGNoIChpdGVtLmlkKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ25ldGVhc2UnOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldE5ldEVhc2VQbGF5ZXIoaXRlbS5taWQsIGl0ZW0ubmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3RlbmNlbnQnOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldFRlbmNlbnRQbGF5ZXIoaXRlbS5taWQsIGl0ZW0ubmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2t1d28nOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldEt3bXVzaWNjYXJQbGF5ZXIoaXRlbS5taWQpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVha1xcXFxuICAgICAgICAgICAgICAgICAgICBjYXNlICdrdWdvdSc6XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0S3Vnb3VQbGF5ZXIoaXRlbS5taWQsIGl0ZW0ubmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ21pZ3UnOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldE1pZ3VQbGF5ZXIoaXRlbS5taWQsIGl0ZW0ubmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSwgaXRlbSwgbXluYW1lKVxcXFxuICAgIH1cXFxcbiAgICByZXR1cm4gZW1wdHlcXFxcbn1cXFxcblxcXFxuY29uc3QgQnVpbGRMaXN0UGFyc2UgPSAobGF5b3V0LCBpbmRleCkgPT4ge1xcXFxuICAgIGdldENvbmZpcm0oKVxcXFxuICAgIFNlbGVjdE1hcCA9IFsn5Yig6Zmk5q2M5puyJywgJ+atjOabsuenu+WKqCcsICfmm7TmjaLmrYzljZUnLCAn6IGG5ZCs5q2M5puyJ11cXFxcbiAgICBhZGRMaXN0ZW5lcignb25SZWZyZXNoJywgJC50b1N0cmluZygoKSA9PiB7XFxcXG4gICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ+abtOWkmicsICcwJykpIHtcXFxcbiAgICAgICAgICAgIGNhc2UgJzAnOlxcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfmm7TlpJonLCAxKTtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+abtOWkmicsIDApO1xcXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSkpO1xcXFxuICAgIGFkZExpc3RlbmVyKCdvbkNsb3NlJywgKCkgPT4ge1xcXFxuICAgICAgICBjbGVhck15VmFyKCfmm7TlpJonKVxcXFxuICAgIH0pXFxcXG4gICAgaWYgKGdldE15VmFyKCfmm7TlpJonLCAnMCcpID09IDEpIHtcXFxcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lX2JsYW5rJ1xcXFxuICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ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ID0gJChlbXB0eSArICcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChTZWxlY3RNYXAsIGksIGl0ZW0sIGluZGV4LCBteW5hbWUpID0+IHtcXFxcbiAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ3N3aXRjaCcpXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGdldEJ1aWxkTGlzdE1hcChTZWxlY3RNYXAsIGksIGl0ZW0sIGluZGV4KVxcXFxuICAgICAgICAgICAgfSwgU2VsZWN0TWFwLCBpLCBpdGVtLCBpbmRleCwgbXluYW1lKVxcXFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKCdnZXRNb3ZlJywgJycpKSB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKCdnZXRNb3ZlJywgJycpID09IGkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZSA9IFJpY2goU21hbGwoU3ByaW5nR3JlZW4obmFtZSkpKVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBzZWxlY3QgPSAkKGVtcHR5KS5sYXp5UnVsZSgoaW5kZXgsIGksIG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvQ29uZmlnLnZpZXc/cnVsZT0nICsgbXluYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgcmVhZEZpbGUoZG93bikpXFxcXG4gICAgICAgICAgICAgICAgICAgIGluZGV4cyA9IE51bWJlcihnZXRNeVZhcignZ2V0TW92ZScpKVxcXFxuICAgICAgICAgICAgICAgICAgICBnZXRNb3ZlKGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4XS5kYXRhLCBpbmRleHMsIGkpXFxcXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignZ2V0TW92ZScpXFxcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXFxcbiAgICAgICAgICAgICAgICB9LCBpbmRleCwgaSwgbXluYW1lKVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBuYW1lLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6IGl0ZW0uY29udCxcXFxcbiAgICAgICAgICAgICAgICBpbWc6IGl0ZW0ucGljcyB8fCAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJyxcXFxcbiAgICAgICAgICAgICAgICB1cmw6IHNlbGVjdCxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogZ2V0SXRlbSgnZ2V0Q29sVHlwZXMnLCAnY2FyZF9waWNfMycpLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxcXG4gICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5pCc57SiID0+ICcgKyBpdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygobmFtZSwgbXluYW1lKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL0NvbmZpZy52aWV3P3J1bGU9JyArIG15bmFtZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ2V0Q29uZmlybVNlYXJjaChuYW1lKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbS5uYW1lLCBteW5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5Yig6ZmkJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpbmRleCwgaW5kZXhzKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2luZGV4Q29uZmlybScsIGluZGV4KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdpbmRleHNDb25maXJtJywgaW5kZXhzKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLmrYzmm7LliKDpmaRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcXFxcXCLnoa7lrprlpb3kuoblkJfvvIzor6XmrYzmm7LlsIbliKDpmaRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogKCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBnZXRNeVZhcignaW5kZXhDb25maXJtJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4cyA9IGdldE15VmFyKCdpbmRleHNDb25maXJtJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgZGF0YU1hcClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4c10uZGF0YS5zcGxpY2UoaW5kZXgsIDEpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfliKDpmaTmiJDlip8nKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpLCBpbmRleClcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6ICfnva7pobYnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKG5hbWUsIGluZGV4cykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkb3duID0gJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv566A5Y2V6Z+z5LmQLmpzJ1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2YWwoJ2RhdGFNYXAgPScgKyByZWFkRmlsZShkb3duKSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgb2JqID0ge307XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3RbaW5kZXhzXS5kYXRhLmZvckVhY2goKGl0ZW0sIGluZGV4KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLm5hbWUgPT09IG5hbWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iaiA9IGl0ZW07XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdFtpbmRleHNdLmRhdGEuc3BsaWNlKGluZGV4LCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhTWFwLkJ1aWxkTGlzdFtpbmRleHNdLmRhdGEudW5zaGlmdChvYmopO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGFNYXApLCAwKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0ubmFtZSwgaW5kZXgpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn572u5bqVJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChuYW1lLCBpbmRleHMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmFsKCdkYXRhTWFwID0nICsgcmVhZEZpbGUoZG93bikpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG9iaiA9IHt9O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFNYXAuQnVpbGRMaXN0W2luZGV4c10uZGF0YS5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5uYW1lID09PSBuYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmogPSBpdGVtO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3RbaW5kZXhzXS5kYXRhLnNwbGljZShpbmRleCwgMSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YU1hcC5CdWlsZExpc3RbaW5kZXhzXS5kYXRhLnB1c2gob2JqKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXZlRmlsZShkb3duLCBKU09OLnN0cmluZ2lmeShkYXRhTWFwKSwgMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLm5hbWUsIGluZGV4KVxcXFxuICAgICAgICAgICAgICAgICAgICB9XVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH0pXFxcXG4gICAgfSBlbHNlIHtcXFxcbiAgICAgICAgbGF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AgICAgaGVpZ2h0OiAzLFxcXFxuICAgICAgICAgICAgb25DaGFuZ2U6IFxcXFxcXFwic2V0SXRlbSgn5bCB6Z2iJywgaW5wdXQpXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICB0aXRsZVZpc2libGU6IGZhbHNlXFxcXG4gICAgICAgIH1cXFxcbiAgICB9LCB7XFxcXG4gICAgICAgIHRpdGxlOiBSaWNoKFN0cm9uZyhHcmF5KCfliJvlu7rmrYzljZUnKSkpLFxcXFxuICAgICAgICB1cmw6ICQoZW1wdHkpLmxhenlSdWxlKChlbXB0eSkgPT4ge1xcXFxuICAgICAgICAgICAgZG93biA9ICdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+eugOWNlemfs+S5kC5qcydcXFxcbiAgICAgICAgICAgIGRhdGEgPSByZWFkRmlsZShkb3duKTtcXFxcbiAgICAgICAgICAgIGV2YWwoJ2RhdGEgPScgKyBkYXRhKVxcXFxuICAgICAgICAgICAgcGljcyA9IGdldEl0ZW0oJ+WwgemdoicpXFxcXG4gICAgICAgICAgICBuYW1lID0gZ2V0SXRlbSgn5ZCN56ewJylcXFxcbiAgICAgICAgICAgIGdldEJyZWFrID0gdHJ1ZVxcXFxuICAgICAgICAgICAgaWYgKG5hbWUgIT0gdW5kZWZpbmVkICYmIG5hbWUgIT0gJycpIHtcXFxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdC5mb3JFYWNoKGl0ZW0gPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAobmFtZSA9PSBpdGVtLm5hbWUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChnZXRCcmVhaykge1xcXFxuICAgICAgICAgICAgICAgIGlmIChwaWNzID09IHVuZGVmaW5lZCB8fCBwaWNzID09ICcnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBpY3MgPSAnaHR0cHM6Ly9taXNzdW8ucnUvZmlsZS81MWU3ODVkMzRhYmE4MWY2MTk5NGYuanBnJ1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBkYXRhTXVzaWMgPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG5hbWU6IG5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBpY3M6IHBpY3MsXFxcXG4gICAgICAgICAgICAgICAgICAgIGRhdGE6IFtdXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0LnB1c2goZGF0YU11c2ljKVxcXFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIEpTT04uc3RyaW5naWZ5KGRhdGEpLCAwKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgdG9hc3QoJ+WIm+W7uuWksei0pe+8ge+8gScpXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBiYWNrKClcXFxcbiAgICAgICAgICAgIHJldHVybiBlbXB0eVxcXFxuICAgICAgICB9LCBlbXB0eSksXFxcXG4gICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxcXG4gICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXFxcbiAgICAgICAgfVxcXFxuICAgIH0pXFxcXG59XFxcXG5cXFxcbmNvbnN0IGdldEVkaXRQYXJzZSA9IChsYXlvdXQsIGksIGl0ZW0pID0+IHtcXFxcbiAgICBsYXlvdXQucHVzaCh7XFxcXG4gICAgICAgIGRlc2M6IGl0ZW0ubmFtZSxcXFxcbiAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiaW5wdXRcXFxcXFxcIixcXFxcbiAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgIHR5cGU6ICd0ZXh0YXJlYScsXFxcXG4gICAgICAgICAgICBoZWlnaHQ6IDMsXFxcXG4gICAgICAgICAgICBvbkNoYW5nZTogXFxcXFxcXCJzZXRJdGVtKCflkI3np7AnLCBpbnB1dClcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2VcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sIHtcXFxcbiAgICAgICAgZGVzYzogaXRlbS5waWNzLFxcXFxuICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJpbnB1dFxcXFxcXFwiLFxcXFxuICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgdHlwZTogJ3RleHRhcmVhJyxcXFxcbiAgICAgICAgICAgIGhlaWdodDogMyxcXFxcbiAgICAgICAgICAgIG9uQ2hhbmdlOiBcXFxcXFxcInNldEl0ZW0oJ+WwgemdoicsIGlucHV0KVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgdGl0bGVWaXNpYmxlOiBmYWxzZVxcXFxuICAgICAgICB9XFxcXG4gICAgfSwge1xcXFxuICAgICAgICB0aXRsZTogUmljaChTdHJvbmcoR3JheSgn56Gu6K6k5L+u5pS5JykpKSxcXFxcbiAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoZW1wdHksIGkpID0+IHtcXFxcbiAgICAgICAgICAgIGRvd24gPSAnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/nroDljZXpn7PkuZAuanMnXFxcXG4gICAgICAgICAgICBkYXRhID0gcmVhZEZpbGUoZG93bik7XFxcXG4gICAgICAgICAgICBldmFsKCdkYXRhID0nICsgZGF0YSlcXFxcbiAgICAgICAgICAgIHBpY3MgPSBnZXRJdGVtKCflsIHpnaInKVxcXFxuICAgICAgICAgICAgbmFtZSA9IGdldEl0ZW0oJ+WQjeensCcpXFxcXG4gICAgICAgICAgICBnZXRCcmVhayA9IHRydWVcXFxcbiAgICAgICAgICAgIGluZGV4ID0gJydcXFxcbiAgICAgICAgICAgIGlmIChuYW1lICE9IHVuZGVmaW5lZCkge1xcXFxuICAgICAgICAgICAgICAgIGRhdGEuQnVpbGRMaXN0LmZvckVhY2goKGl0ZW0sIHgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKG5hbWUgPT0gaXRlbS5uYW1lKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBnZXRCcmVhayA9IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmRleCA9IHhcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGdldEJyZWFrID0gZmFsc2VcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChnZXRCcmVhayB8fCBpbmRleCA9PSBpKSB7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHBpY3MgPT0gdW5kZWZpbmVkIHx8IHBpY3MgPT0gJycpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcGljcyA9IGRhdGEuQnVpbGRMaXN0W2ldLnBpY3NcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKG5hbWUgPT0gJycpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZSA9IGRhdGEuQnVpbGRMaXN0W2ldLm5hbWVcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgZGF0YS5CdWlsZExpc3RbaV0ubmFtZSA9IG5hbWVcXFxcbiAgICAgICAgICAgICAgICBkYXRhLkJ1aWxkTGlzdFtpXS5waWNzID0gcGljc1xcXFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKGRvd24sIE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10nXFxcXG4gICAgbXVzaWNNYXAgPSBOZXRFYXNlQ29uZmlnKG11c2ljVXJsLCAnJywgJ0dFVCcpXFxcXG4gICAgbHlzaWNVcmwgPSAnL2FwaS9zb25nL2x5cmljP29zPW9zeCZpZD0nICsgbWlkICsgJyZsdj0tMSZrdj0tMSZ0dj0tMSdcXFxcbiAgICBseXNpY01hcCA9IE5ldEVhc2VDb25maWcobHlzaWNVcmwsICcnLCAnR0VUJylcXFxcbiAgICBpZiAobXVzaWNNYXAuZGF0YVswXS51cmwpIHtcXFxcbiAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHtcXFxcbiAgICAgICAgICAgIHVybHM6IFttdXNpY01hcC5kYXRhWzBdLnVybF0sXFxcXG4gICAgICAgICAgICBseXJpYzogbHlzaWNNYXAubHJjLmx5cmljXFxcXG4gICAgICAgIH0pXFxcXG4gICAgfVxcXFxuICAgIHJldHVybiBnZXRDb25maXJtU2VhcmNoKG5hbWUpXFxcXG59XFxcXG5cXFxcbmNvbnN0IGdldFRlbmNlbnRQbGF5ZXIgPSAobWlkLCBuYW1lKSA9PiB7XFxcXG4gICAgbGV0IHR5cGVNYXAgPSB7XFxcXG4gICAgICAgIG00YToge1xcXFxuICAgICAgICAgICAgczogJ0M0MDAnLFxcXFxuICAgICAgICAgICAgZTogJy5tNGEnLFxcXFxuICAgICAgICB9LFxcXFxuICAgICAgICAxMjg6IHtcXFxcbiAgICAgICAgICAgIHM6ICdNNTAwJyxcXFxcbiAgICAgICAgICAgIGU6ICcubXAzJyxcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAgMzIwOiB7XFxcXG4gICAgICAgICAgICBzOiAnTTgwMCcsXFxcXG4gICAgICAgICAgICBlOiAnLm1wMycsXFxcXG4gICAgICAgIH0sXFxcXG4gICAgICAgIGFwZToge1xcXFxuICAgICAgICAgICAgczogJ0EwMDAnLFxcXFxuICAgICAgICAgICAgZTogJy5hcGUnLFxcXFxuICAgICAgICB9LFxcXFxuICAgICAgICBmbGFjOiB7XFxcXG4gICAgICAgICAgICBzOiAnRjAwMCcsXFxcXG4gICAgICAgICAgICBlOiAnLmZsYWMnLFxcXFxuICAgICAgICB9LFxcXFxuICAgIH07XFxcXG4gICAgbGV0IHRpbWUgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKVxcXFxuICAgIGxldCBndWlkID0gKE1hdGgucmFuZG9tKCkgKiAxMDAwMDAwMCkudG9GaXhlZCgwKTtcXFxcbiAgICBsZXQgdHlwZU9iaiA9IHR5cGVNYXBbJzEyOCddO1xcXFxuICAgIGxldCBmaWxlID0gdHlwZU9iai5zICsgbWlkICsgbWlkICsgdHlwZU9iai5lO1xcXFxuICAgIGxldCB1cmwgPSB7XFxcXG4gICAgICAgICctJzogJ2dldHBsYXlzb25ndmtleScsXFxcXG4gICAgICAgIGdfdGs6IDUzODEsXFxcXG4gICAgICAgIGhvc3RVaW46IDAsXFxcXG4gICAgICAgIGZvcm1hdDogJ2pzb24nLFxcXFxuICAgICAgICBpbkNoYXJzZXQ6ICd1dGY4JyxcXFxcbiAgICAgICAgb3V0Q2hhcnNldDogJ3V0Zi04wqxpY2U9MCcsXFxcXG4gICAgICAgIHBsYXRmb3JtOiAneXFxLmpzb24nLFxcXFxuICAgICAgICBuZWVkTmV3Q29kZTogMCxcXFxcbiAgICAgICAgZGF0YTogSlNPTi5zdHJpbmdpZnkoe1xcXFxuICAgICAgICAgICAgcmVxXzA6IHtcXFxcbiAgICAgICAgICAgICAgICBtb2R1bGU6ICd2a2V5LkdldFZrZXlTZXJ2ZXInLFxcXFxuICAgICAgICAgICAgICAgIG1ldGhvZDogJ0NnaUdldFZrZXknLFxcXFxuICAgICAgICAgICAgICAgIHBhcmFtOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVuYW1lOiBbZmlsZV0sXFxcXG4gICAgICAgICAgICAgICAgICAgIGd1aWQ6IGd1aWQsXFxcXG4gICAgICAgICAgICAgICAgICAgIHNvbmdtaWQ6IFttaWRdLFxcXFxuICAgICAgICAgICAgICAgICAgICBzb25ndHlwZTogWzBdLFxcXFxuICAgICAgICAgICAgICAgICAgICB1aW46ICcnLFxcXFxuICAgICAgICAgICAgICAgICAgICBsb2dpbmZsYWc6IDEsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBsYXRmb3JtOiAnMjAnLFxcXFxuICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgY29tbToge1xcXFxuICAgICAgICAgICAgICAgIHVpbjogJycsXFxcXG4gICAgICAgICAgICAgICAgZm9ybWF0OiAnanNvbicsXFxcXG4gICAgICAgICAgICAgICAgY3Q6IDE5LFxcXFxuICAgICAgICAgICAgICAgIGN2OiAwLFxcXFxuICAgICAgICAgICAgICAgIGF1dGhzdDogJycsXFxcXG4gICAgICAgICAgICB9LFxcXFxuICAgICAgICB9KSxcXFxcbiAgICB9XFxcXG4gICAgbGV0IHJlc3VsdCA9IGJ1aWxkVXJsKCdodHRwczovL3UueS5xcS5jb20vY2dpLWJpbi9tdXNpY3UuZmNnJywgdXJsKVxcXFxuICAgIHJlc3VsdCA9IEpTT04ucGFyc2UoZmV0Y2gocmVzdWx0KSlcXFxcbiAgICBsZXQgcHVybCA9ICcnO1xcXFxuICAgIGxldCBkb21haW4gPSAnJztcXFxcbiAgICBpZiAocmVzdWx0LnJlcV8wICYmIHJlc3VsdC5yZXFfMC5kYXRhICYmIHJlc3VsdC5yZXFfMC5kYXRhLm1pZHVybGluZm8pIHtcXFxcbiAgICAgICAgcHVybCA9IHJlc3VsdC5yZXFfMC5kYXRhLm1pZHVybGluZm9bMF0ucHVybDtcXFxcbiAgICB9XFxcXG4gICAgaWYgKGRvbWFpbiA9PT0gJycpIHtcXFxcbiAgICAgICAgZG9tYWluID0gcmVzdWx0LnJlcV8wLmRhdGEuc2lwLmZpbmQoaSA9PiAhaS5zdGFydHNXaXRoKCdodHRwOi8vd3MnKSkgfHwgcmVzdWx0LnJlcV8wLm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aWd1Q29uZmlnKGx5cmljVXJsKVxcXFxuICAgIGlmIChNaWd1TXVzaWMuc2VhcmNoKCdLZXknKSA+PSAxKSB7XFxcXG4gICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeSh7XFxcXG4gICAgICAgICAgICB1cmxzOiBbTWlndU11c2ljXSxcXFxcbiAgICAgICAgICAgIGx5cmljOiBNaWd1THlyaWMubHlyaWNcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9XFxcXG4gICAgcmV0dXJuIGdldENvbmZpcm1TZWFyY2gobmFtZSlcXFxcbn1cXFxcblxcXFxuY29uc3QgZ2V0U2VhcmNoUGFyc2UgPSAobGF5b3V0KSA9PiB7XFxcXG4gICAgZnVuTWFwID0gWyfogZrlkIjmkJzntKInXVxcXFxuICAgIHN3aXRjaCAoc3RvcmFnZTAuZ2V0TXlWYXIoJ1NlYXJjaE11c2ljTWFwJywgZnVuTWFwKVswXSkge1xcXFxuICAgICAgICBjYXNlIGZ1bk1hcFswXTpcXFxcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogJ/CflI0nLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6IFxcXFxcXFwi6K+36L6T5YWl5q2M5puy5ZCN56ewL+WFs+mUruivjVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIHVybDogJ1xcXFxcXFwiaGlrZXI6Ly9zZWFyY2g/cz1cXFxcXFxcIitpbnB1dCcsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiaW5wdXRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBydWxlczogJC50b1N0cmluZygoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IFtdO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHNlYXJjaE1hcCA9IFsn572R5piTJywgJ+iFvuiurycsICfphbfmiJEnLCAn6YW354uXJywgJ+WSquWSlSddO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3N3aXRjaCcsICcxJylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlYXJjaE1hcC5mb3JFYWNoKChNYXAsIGkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInRpdGxlXFxcXFxcXCI6IE1hcCArICfpn7PkuZAnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInNlYXJjaF91cmxcXFxcXFxcIjogXFxcXFxcXCJoaWtlcjovL2VtcHR5P3NlYXJjaFRlcm1zPSoqJnBhZ2U9ZnlwYWdlJmluZGV4PVxcXFxcXFwiICsgaSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJzZWFyY2hGaW5kXFxcXFxcXCI6IFxcXFxcXFwianM6ICQucmVxdWlyZSgnaGlrZXI6Ly9wYWdlL1NlYXJjaC52aWV3P3J1bGU9566A5Y2V6Z+z5LmQJyk7XFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoZGF0YSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pLFxcXFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGdldE15VmFyKFxcXFxcXFwic2VhcmNoS2V5XFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgICAgICAgICBvbkNoYW5nZTogXFxcXFxcXCJwdXRNeVZhcignc2VhcmNoS2V5JyxpbnB1dClcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfwn5SNJyxcXFxcbiAgICAgICAgICAgICAgICBkZXNjOiBcXFxcXFxcIuivt+i+k+WFpeatjOabsuWQjeensC/lhbPplK7or41cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICB1cmw6ICQudG9TdHJpbmcoKG15bmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQga2V5d29yZHMgPSBpbnB1dC50cmltKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCdzd2l0Y2gnLCAnMScpXFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChrZXl3b3Jkcykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9wYWdlL1NlYXJjaHMudmlldz9ydWxlPVxcXFxcXFwiICsgbXluYW1lICsgXFxcXFxcXCImcGFnZT1meXBhZ2Umc2VhcmNoVGVybXM9XFxcXFxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQoa2V5d29yZHMpO1xcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/or7fovpPlhaXlhbPplK7or41cXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0sIG15bmFtZSksXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiaW5wdXRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBkZWZhdWx0Vm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kpKSA6IGl0ZW0sXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChlbXB0eSwgaW5kZXgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ3NlYXJjaE1hcCcsIGluZGV4KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcXFxuICAgICAgICAgICAgICAgIH0sIGVtcHR5LCBpbmRleCksXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0XzUnXFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICB9KVxcXFxuICAgIH1cXFxcbiAgICBnZXRTZWFyY2hTZWxlY3Rpb24obGF5b3V0LCBpbmRleHMsIGtleXdvcmQsIHBhZ2UpXFxcXG59XFxcXG5cXFxcbmNvbnN0IGdldFNlYXJjaFNlbGVjdGlvbiA9IChsYXlvdXQsIGluZGV4LCBrZXl3b3JkLCBwYWdlKSA9PiB7XFxcXG4gICAgc3dpdGNoIChpbmRleCkge1xcXFxuICAgICAgICBjYXNlICcwJzpcXFxcbiAgICAgICAgICAgIHBhdGggPSAnL3dlYXBpL2Nsb3Vkc2VhcmNoL2dldC93ZWI/Y3NyZl90b2tlbj0nXFxcXG4gICAgICAgICAgICBib2R5ID0ge1xcXFxuICAgICAgICAgICAgICAgICdzJzoga2V5d29yZCxcXFxcbiAgICAgICAgICAgICAgICAnbGltaXQnOiAzMCxcXFxcbiAgICAgICAgICAgICAgICAndHlwZSc6IDEsXFxcXG4gICAgICAgICAgICAgICAgJ29mZnNldCc6IChwYWdlIC0gMSkgKiAzMCxcXFxcbiAgICAgICAgICAgICAgICAnY3NyZl90b2tlbic6ICcnXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBkYXRhID0gTmV0RWFzZUNvbmZpZyhwYXRoLCBib2R5LCAnUE9TVCcpLnJlc3VsdC5zb25nc1xcXFxuICAgICAgICAgICAgTmV0RWFzZVBhcnNlKGxheW91dCwgZGF0YSlcXFxcbiAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICBjYXNlICcxJzpcXFxcbiAgICAgICAgICAgIHBhdGggPSAnaHR0cHM6Ly91LnkucXEuY29tL2NnaS1iaW4vbXVzaWN1LmZjZydcXFxcbiAgICAgICAgICAgIGJvZHkgPSB7XFxcXG4gICAgICAgICAgICAgICAgXFxcXFxcXCJyZXFfMVxcXFxcXFwiOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwibWV0aG9kXFxcXFxcXCI6IFxcXFxcXFwiRG9TZWFyY2hGb3JRUU11c2ljRGVza3RvcFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIm1vZHVsZVxcXFxcXFwiOiBcXFxcXFxcIm11c2ljLnNlYXJjaC5TZWFyY2hDZ2lTZXJ2aWNlXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicGFyYW1cXFxcXFxcIjoge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJudW1fcGVyX3BhZ2VcXFxcXFxcIjogMjAsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInBhZ2VfbnVtXFxcXFxcXCI6IHBhZ2UsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInF1ZXJ5XFxcXFxcXCI6IGtleXdvcmQsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInNlYXJjaF90eXBlXFxcXFxcXCI6IDBcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGRhdGEgPSByZXF1ZXN0KHBhdGgsIHtcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8veS5xcS5jb20nXFxcXG4gICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICBib2R5OiBib2R5LFxcXFxuICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnXFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgZGF0YSA9IEpTT04ucGFyc2UoZGF0YSkucmVxXzEuZGF0YS5ib2R5LnNvbmcubGlzdFxcXFxuICAgICAgICAgICAgVGVuY2VudFBhcnNlKGxheW91dCwgZGF0YSlcXFxcbiAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICBjYXNlICcyJzpcXFxcbiAgICAgICAgICAgIHBhdGggPSAnc2VhcmNoL211c2ljP2tleT0nICsga2V5d29yZCArICcmcG49JyArIHBhZ2VcXFxcbiAgICAgICAgICAgIGRhdGEgPSBLd211c2ljY2FyQ29uZmlnKHBhdGgpXFxcXG4gICAgICAgICAgICBLd211c2ljY2FyUGFyc2UobGF5b3V0LCBkYXRhKVxcXFxuICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgIGNhc2UgJzMnOlxcXFxuICAgICAgICAgICAgcGF0aCA9ICdodHRwOi8vbW9iaWxlY2RuLmt1Z291LmNvbS9hcGkvdjMvc2VhcmNoL3Nvbmc/Zm9ybWF0PWpzb24ma2V5d29yZD0nICsga2V5d29yZCArICcmcGFnZT0nICsgcGFnZSArICcmcGFnZXNpemU9MjAmc2hvd3R5cGU9MSdcXFxcbiAgICAgICAgICAgIGRhdGEgPSBKU09OLnBhcnNlKHJlcXVlc3QocGF0aCkpLmRhdGEuaW5mb1xcXFxuICAgICAgICAgICAgS3Vnb3VQYXJzZShsYXlvdXQsIGRhdGEpXFxcXG4gICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgY2FzZSAnNCc6XFxcXG4gICAgICAgICAgICBwYXRoID0gJ2h0dHA6Ly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