Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥【完结】唐毅彩妆大师课@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuWkuOWFi+WIl+ihqEFQSVwiLFwicGF0aFwiOlwiUXVhcmtTaGFyZUFwaVwiLFwicnVsZVwiOlwianM6XFxuLy9AYXV0aG9yIExveURnSWtcXG5sZXQgaHR0cFJlcXVlc3QgPSAkLnJlcXVpcmUoXFxcImh0dHBSZXF1ZXN0XFxcIik7XFxuY29uc3QgYmFzZVVybCA9IFxcXCJodHRwczovL3Bhbi5xdWFyay5jblxcXCI7XFxuXFxuZnVuY3Rpb24gUXVhcmtTaGFyZUFwaShzaGFyZUlkLCBzaGFyZVB3ZCkge1xcbiAgICB0aGlzLnNoYXJlSWQgPSBzaGFyZUlkO1xcbiAgICB0aGlzLnNoYXJlUHdkID0gc2hhcmVQd2Q7XFxuICAgIHRoaXMucmVmcmVzaENhbGxCYWNrID0gKCgpID0+IHZvaWQgMCk7XFxuICAgIC8vdGhpcy5zaGFyZVRva2VuID0gc2hhcmVUb2tlbiB8fCB0aGlzLmdldFNoYXJlVG9rZW4oKTtcXG59XFxuT2JqZWN0LmFzc2lnbihRdWFya1NoYXJlQXBpLnByb3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fSBjYXRjaCAoZXJyKSB7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgZXJyID0gdGhpcy5lcnJvclR5cGVDYWxsYmFjayhlcnIsIHJlcyk7XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcblxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAodGhpcy5yZXRyeUNvdW50KSB7XFxuICAgICAgICAgICAgICAgIGxldCB0cnlSZXN1bHQgPSB0aGlzLmVycm9yQ2FsbGJhY2tXaXRoUmV0cnkoZXJyLCByZXMsIHRoaXMpO1xcbiAgICAgICAgICAgICAgICBpZiAodHJ5UmVzdWx0KSB7XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnJldHJ5Q291bnQtLTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0YXJ0KHRvSnNvbik7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnJldHJ5Q291bnQgPSAwO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXJyb3JDYWxsYmFjayhlcnIsIHJlcyk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lcnJvckNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHNldE9wdGlvbnMob3B0aW9ucykge1xcbiAgICAgICAgdGhpcy5vcHRpb25zID0gT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucywge1xcbiAgICAgICAgICAgIHdpdGhIZWFkZXJzOiB0cnVlXFxuICAgICAgICB9KTtcXG4gICAgICAgIHJldHVybiB0aGlzO1xcbiAgICB9LFxcbiAgICBtZXJnZUhlYWRBbmRCb2R5KG9wdGlvbnMpIHtcXG4gICAgICAgIG9wdGlvbnMgPSBvc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gICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFwiYWNjb3VudFxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLljp/nlLvkuIvovb3nur/nqItcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKGdldEl0ZW0oXFxcInNwZWVkVGhyZWFkXFxcIiwgXFxcIjEwXFxcIiksIFxcXCLor7fovpPlhaUzLTMy5LmL6Ze055qE5pW05pWwXFxcIikuaW5wdXQoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHNwZWVkVGhyZWFkID0gcGFyc2VJbnQoaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNwZWVkVGhyZWFkIDwgMyB8fCBzcGVlZFRocmVhZCA+IDMyKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruS4jeWQiOazlVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFN0cmluZyhzcGVlZFRocmVhZCkpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLlpI3liLbliIbkuqvpk77mjqVcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBidWlsZFVybChcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY24vcy9cXFwiICsgc2hhcmVJZCwge1xcbiAgICAgICAgICAgICAgICAgICAgcGFzc2NvZGU6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHNoYXJl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GlzdC5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgLy/liKTmlq3mmK/lkKbmlofku7blpLlcXG4gICAgICAgIGlmIChpdGVtLmRpcikge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi8J+TglxcXCIgKyBpdGVtLmZpbGVfbmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogJC5kYXRlRm9ybWF0KGl0ZW0udXBkYXRlZF9hdCwgJ3l5eXktTU0tZGQnKSArICcgICcgKyBpdGVtLmluY2x1ZGVfaXRlbXMgKyAn6aG5ICAnLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBcXFwiaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tZXNzeS8yNy5zdmdcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL3BhZ2UvcXVhcmtMaXN0P3BhZ2U9ZnlwYWdlXFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLFxcbiAgICAgICAgICAgICAgICAgICAgZmlsZUlkOiBpdGVtLmZpZCxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZ2V0SGVhZChpdGVtLm9ial9jYXRlZ29yeSkgKyBpdGVtLmZpbGVfbmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYz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ICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBpdGVtLmZpZCxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBjbHM6ICdwbGF5bGlzdCAnICsgaXRlbS5vYmpfY2F0ZWdvcnlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgICAgICBcXG4gICAgfSk7XFxufSBjYXRjaCAoZSkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IGUubWVzc2FnZSxcXG4gICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknLFxcbiAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBpZiAoZS5tZXNzYWdlLmluY2x1ZGVzKFxcXCLmj5Dlj5bnoIFcXFwiKSkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIui+k+WFpeaPkOWPlueggVxcXCIsXFxuICAgICAgICAgICAgdXJsOiAkKCkuaW5wdXQoKE1ZX1BBUkFNUykgPT4ge1xcbiAgICAgICAgICAgICAgICBzZXRQYWdlUGFyYW1zKE9iamVjdC5hc3NpZ24oe30sIE1ZX1BBUkFNUywge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IGlucHV0XFxuICAgICAgICAgICAgICAgIH0pKTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICB9LCBNWV9QQVJBTVMpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCJcXG4gICAgICAgIH0pO1xcbiAgICB9XFxufVxcbnNldFJlc3VsdChkKTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcInBsYXlcIixcInBhdGhcIjpcInBsYXlcIixcInJ1bGVcIjpcImpzOlxcbmNvbnN0IGNvb2tpZSA9IGdldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgXFxcIlxcXCIpO1xcbmxldCBodHRwUmVxdWVzdCA9ICQucmVxdWlyZShcXFwiaHR0cFJlcXVlc3RcXFwiKTtcXG5cXG5mdW5jdGlvbiBDb29raWVNYW5hZ2UoY29va2llKSB7XFxuICAgIHRoaXMuY29va2llID0ge307XFxuICAgIHRoaXMuYWRkKGNvb2tpZSk7XFxufVxcbk9iamVjdC5hc3NpZ24oQ29va2llTWFuYWdlLnByb3RvdHlwZSwge1xcbiAgICBhZGQoY29va2llKSB7XFxuICAgICAgICBsZXQgY29va2llcyA9IFtdO1xcbiAgICAgICAgaWYgKHR5cGVvZiBjb29raWUgPT09IFxcXCJzdHJpbmdcXFwiKSB7XFxuICAgICAgICAgICAgY29va2llcyA9IGNvb2tpZS5zcGxpdChcXFwiO1xcXCIpO1xcbiAgICAgICAgfSBlbHNlIGlmIChBcnJheS5pc0FycmF5KGNvb2tpZSkpIHtcXG4gICAgICAgICAgICBjb29raWVzID0gY29va2llO1xcbiAgICAgICAgfVxcbiAgICAgICAgY29va2llcy5mb3JFYWNoKHYgPT4ge1xcbiAgICAgICAgICAgIHYgPSB2LnNwbGl0KFxcXCI9XFxcIik7XFxuICAgICAgICAgICAgaWYgKHYubGVuZ3RoIDwgMikgcmV0dXJuO1xcbiAgICAgICAgICAgIHRoaXMuY29va2llW3ZbMF0udHJpbSgpXSA9IHZbMV0udHJpbSgpO1xcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIGdldCgpIHtcXG4gICAgICAgIHJldHVybiBPYmplY3QuZW50cmllcyh0aGlzLmNvb2tpZSkubWF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7IGkrKykge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgcmVzID0gdGFzayh0YXNrX2lkLCBpICsgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIGlmIChyZXMuZGF0YS5zdGF0dXMgPT09IDIpIHtcXG4gICAgICAgICAgICAgICAgd2FpdFNsZWVwKDEwMDApO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzLmRhdGEuc2F2ZV9hcy5zYXZlX2FzX3RvcF9maWRzWzBdO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB3YWl0U2xlZXAoMzAwICogKGkgKyAxKSk7XFxuICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICB9XFxuICAgIHJldHVybiB2b2lkKDApO1xcbn1cXG5cXG5mdW5jdGlvbiBxdWVyeVRhc2tTdGF0dXModGFza19pZCkge1xcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IDY7IGkrKykge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgcmVzID0gdGFzayh0YXNrX2lkLCBpICsgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIGlmIChyZXMuZGF0YS5zdGF0dXMgPT09IDIpIHtcXG4gICAgICAgICAgICAgICAgd2FpdFNsZWVwKDEwMDApO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgd2FpdFNsZWVwKDMwMCk7XFxuICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICB9XFxuICAgIHJldHVybiBmYWxzZTtcXG59XFxuXFxuZnVuY3Rpb24gZ2V0UHJldmlld1ZpZGVvKGZpZCkge1xcbiAgICByZXR1cm4gcmVxdWVzdEh0dHAoXFxcImh0dHBzOi8vZHJpdmUucXVhcmsuY24vMS9jbG91ZGRyaXZlL2ZpbGUvdjIvcGxheT9wcj11Y3BybyZmcj1wY1xcXCIpLmJvZHkoe1xcbiAgICAgICAgXFx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xuICAgICAgICBsZXQgcGxheUhlYWRlciA9IHtcXG4gICAgICAgICAgICBSZWZlcmVyOiBcXFwiaHR0cDovL3Bhbi5xdWFyay5jbi9cXFwiLFxcbiAgICAgICAgICAgIGNvb2tpZTogcGxheUNvb2tpZSxcXG4gICAgICAgICAgICBcXFwiVXNlci1BZ2VudFxcXCI6IFxcXCJjb20uc3R1Yi5TdHViQXBwLzEuMy4wIChMaW51eDtBbmRyb2lkIDE0KSBBbmRyb2lkWE1lZGlhMy8xLjEuMVxcXCJcXG4gICAgICAgIH07XFxuICAgICAgICBsZXQgcGxheUhlYWRlcnMgPSBPYmplY3QuYXNzaWduKHt9LCBwbGF5SGVhZGVyLCB7XFxuICAgICAgICAgICAgXFxcIlVzZXItQWdlbnRcXFwiOiBcXFwiTG9nU3RhdGlzdGljXFxcIlxcbiAgICAgICAgfSk7XFxuICAgICAgICBpZiAoY2F0ZWdvcnkgPT0gXFxcInZpZGVvXFxcIikge1xcbiAgICAgICAgICAgIGxldCBwbGF5TW9kZSA9IGdldEl0ZW0oXFxcInF1YXJrX3BsYXlNb2RlXFxcIiwgXFxcIui9rOeggVxcXCIpO1xcbiAgICAgICAgICAgIGlmIChwbGF5TW9kZSA9PT0gXFxcIui9rOeggVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvUmVzID0gZ2V0UHJldmlld1ZpZGVvKGFzZmlkKTtcXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvTGlzdCA9IHZpZGVvUmVzLmRhdGEudmlkZW9fbGlzdDtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW10sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbXVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICB2aWRlb0xpc3QuZmlsdGVyKHYgPT4gdi5hY2Nlc3NhYmxlKS5mb3JFYWNoKHYgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QubmFtZXMucHVzaCh2LnJlc29sdXRpb24pO1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QudXJscy5wdXNoKHYudmlkZW9faW5mby51cmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0LmhlYWRlcnMucHVzaChwbGF5SGVhZGVycyk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHBsYXlMaXN0KTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheVVybCA9IGdldERvd25sb2FkVXJsKGFzZmlkKS5kYXRhWzBdLmRvd25sb2FkX3VybDtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtcXFwi5Y6f55S7XFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbcGxheVVybCArIFxcXCIjaXNWaWRlbz10cnVlIyNmYXN0UGxheU1vZGUjI3RocmVhZHM9XFxcIiArIGdldEl0ZW0oXFxcInNwZWVkVGhyZWFkXFxcIiwgXFxcIjEwXFxcIikgKyBcXFwiI1xcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3BsYXlIZWFkZXJzXVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxuICAgICAgICAgICAgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgaWYgKGNhdGVnb3J5ID09PSAnYXVkaW8nKSB7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXFxcIumfs+mikVxcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtwbGF5SGVhZGVyXSxcXG4gICAgICAgICAgICAgICAgICAgIGx5cmljOiBcXFwiXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChjYXRlZ29yeSA9PT0gJ2ltYWdlJykge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChwbGF5VXJsLCBwbGF5SGVhZGVyKS5pbWFnZSgpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHBsYXlIZWFkZXIgPSBPYmplY3Qua2V5cyhwbGF5SGVhZGVyKS5tYXAoa2V5ID0+IGtleSArIFxcXCJAXFxcIiArIFN0cmluZyhwbGF5SGVhZGVyW2tleV0pLnJlcGxhY2UoLzsvZywgXFxcIu+8m++8m1xcXCIpKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJkb3dubG9hZDovL1xcXCIgKyBwbGF5VXJsICsgXFxcIjt7XFxcIiArIHBsYXlIZWFkZXIuam9pbihcXFwiJiZcXFwiKSArIFxcXCJ9XFxcIjtcXG4gICAgICAgICAgICB9XFxuICA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odHRwczovL3Bhbi5xdWFyay5jblxcXCIpIHx8IFxcXCJcXFwiKTtcXG4gICAgICAgIGxldCBjb29raWUgPSBnZXRNeVZhcihcXFwiY29va2llXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgaWYgKCQucmVxdWlyZShcXFwidG9vbFxcXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xcbiAgICAgICAgICAgIHNldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgY29va2llKTtcXG4gICAgICAgICAgICBiYWNrKCk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+eZu+W9leaIkOWKn1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pyq55m75b2VXFxcIjtcXG4gICAgfSksXFxuICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ08c21hbGw+54K55Ye75aS05YOP5Y+v5Lul6YCA5Ye66LSm5Y+36YeN5paw55m75b2VPC9zbWFsbD5cXFwiLFxcbiAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiXFxufSk7XFxuZC5wdXNoKHtcXG4gICAgY29sX3R5cGU6IFxcXCJsaW5lX2JsYW5rXFxcIlxcbn0pO1xcbmQucHVzaCh7XFxuICAgIGNvbF90eXBlOiBcXFwieDVfd2Vidmlld19zaW5nbGVcXFwiLFxcbiAgICB1cmw6IFxcXCJodHRwczovL3Bhbi5xdWFyay5jblxcXCIsXFxuICAgIGRlc2M6IFxcXCJsaXN0JiZzY3JlZW4tMTUwXFxcIixcXG4gICAgZXh0cmE6IHtcXG4gICAgICAgIHVhOiBQQ19VQSxcXG4gICAgICAgIGpzOiAkLnRvU3RyaW5nKCh0aXRsZSkgPT4ge1xcbiAgICAgICAgICAgIGxldCBjb29raWUgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICBzZXRJbnRlcnZhbCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgIGNvb2tpZSA9IGZi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KS5jb25maXJtKCgpID0+IHt9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKGZldGNoKFxcXCJmaWxlOi8vXFxcIiArIHBhdGgpKTtcXG4gICAgICAgICAgICAgICAgbGV0IGNvb2tpZSA9IGpzb24uY29va2llO1xcbiAgICAgICAgICAgICAgICBpZiAoJC5yZXF1aXJlKFxcXCJ0b29sXFxcIikuaXNMb2dpbkNvb2tpZShjb29raWUpKSB7XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJxdWFya0Nvb2tpZVxcXCIsIGNvb2tpZSk7XFxuICAgICAgICAgICAgICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7miJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL0Nvb2tpZeagvOW8j+mUmeivr1xcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/ojrflj5blpLHotKXlhbHkuqvmlofku7bmjZ/lnY9cXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgcmV0dXJuICQoXFxcIuacquajgOa1i+WIsFRWQk9Y55qEQ29va2ll5paH5Lu2XFxcXG7or7fkvb/nlKjov4flkI7lho3lsJ3or5VcXFwiKS5jb25maXJtKCgpID0+IHt9KTtcXG4gICAgICAgIH1cXG4gICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWkjeWItkNvb2tpZVxcXCIpIHtcXG4gICAgICAgIGxldCBjb29raWUgPSBnZXRJdGVt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xuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlSWQsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGdldEhlYWQoaXRlbS5vYmpfY2F0ZWdvcnkpICsgaXRlbS5maWxlX25hbWUsXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLnVwZGF0ZWRfYXQsICd5eXl5LU1NLWRkJykgKyAnICAnICsgZm9ybWF0U2l6ZShpdGVtLnNpemUpLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBpdGVtLnRodW1ibmFpbCxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsQ2FjaGUgPSBzdG9yYWdlMC5nZXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwge30pO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBsYXlVcmxDYWNoZVtmaWRdKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsYXlVcmxDYWNoZVtmaWRdO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gJC5yZXF1aXJlKFxcXCJwbGF5XFxcIikuZ2V0UGxheVVybChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwbGF5VXJsQ2FjaGVbZmlkXSA9IHVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwgcGxheVVybENhY2hlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBpdGVtLmZpZCwgaXRlbS5zaGFyZV9maWRfdG9rZW4sIHNoYXJlSWQsIHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSwgaXRlbS5vYmpfY2F0ZWdvcnkpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiAncGxheWxpc3QgJyArIGl0ZW0ub2JqX2NhdGVnb3J5XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICAgICAgXFxuICAgIH0pO1xcbn0gY2F0Y2ggKGUpIHtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBlLm1lc3NhZ2UsXFxuICAgICAgICB1cmw6ICdoaWtlcjovL2VtcHR5JyxcXG4gICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBm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XFxcXCJcXFxcXFxcIiksXFxcXG4gICAgICAgICAgICBwZGlyX2ZpZDogZmlsZUlkIHx8IFxcXFxcXFwiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBmb3JjZTogMCxcXFxcbiAgICAgICAgICAgIF9wYWdlOiBwYWdlLFxcXFxuICAgICAgICAgICAgX3NpemU6IDEwMCxcXFxcbiAgICAgICAgICAgIF9mZXRjaF9iYW5uZXI6IDEsXFxcXG4gICAgICAgICAgICBfZmV0Y2hfc2hhcmU6IDEsXFxcXG4gICAgICAgICAgICBfZmV0Y2hfdG90YWw6IDEsXFxcXG4gICAgICAgICAgICBfc29ydDogXFxcXFxcXCJmaWxlX3R5cGU6YXNjLFxcXFxcXFwiICsgb3JkZXJCeVxcXFxuICAgICAgICB9KS5lcnJvcldpdGhSZXRyeSgoZXJyLCByZXMsIGh0dHApID0+IHtcXFxcbiAgICAgICAgICAgIGlmIChKU09OLnBhcnNlKHJlcy5ib2R5KS5tZXNzYWdlLmluY2x1ZGVzKCdzdG9rZW4nKSkge1xcXFxuICAgICAgICAgICAgICAgIGh0dHAubWVyZ2VIZWFkQW5kQm9keSh7XFxcXG4gICAgICAgICAgICAgICAgICAgIGJ1aWxkVXJsOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9rZW46IGVuY29kZVVSSUNvbXBvbmVudCh0aGlzLmdldFNoYXJlVG9rZW4oKXx8XFxcXFxcXCJcXFxcXFxcIilcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KS5zdGFydCh0cnVlKTtcXFxcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcXFxcbiAgICB9XFxcXG59KTtcXFxcbiQuZXhwb3J0cyA9IFF1YXJrU2hhcmVBcGk7XFxcIn0se1xcXCJjb2xfdHlwZVxcXCI6XFx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XFxcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdHJ5UmVzdWx0ID0gdGhpcy5lcnJvckNhbGxiYWNrV2l0aFJldHJ5KGVyciwgcmVzLCB0aGlzKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAodHJ5UmVzdWx0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdGFydCh0b0pzb24pO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVycm9yQ2FsbGJhY2soZXJyLCByZXMpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXJyb3JDYWxsYmFjayhlcnIsIHJlcyk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LFxcXFxuICAgIHNldE9wdGlvbnMob3B0aW9ucykge1xcXFxuICAgICAgICB0aGlzLm9wdGlvbnMgPSBPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zLCB7XFxcXG4gICAgICAgICAgICB3aXRoSGVhZGVyczogdHJ1ZVxcXFxuICAgICAgICB9KTtcXFxcbiAgICAgICAgcmV0dXJuIHRoaXM7XFxcXG4gICAgfSxcXFxcbiAgICBtZXJnZUhlYWRBbmRCb2R5KG9wdGlvbnMpIHtcXFxcbiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307XFxcXG4gICAgICAgIE9iamVjdC5hc3Np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zaGFyZUlkLFxcXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLFxcXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGl0ZW0uZmlkLFxcXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKGl0ZW0ub2JqX2NhdGVnb3J5KSArIGl0ZW0uZmlsZV9uYW1lLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLnVwZGF0ZWRfYXQsICd5eXl5LU1NLWRkJykgKyAnICAnICsgZm9ybWF0U2l6ZShpdGVtLnNpemUpLFxcXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IGl0ZW0udGh1bWJuYWlsLFxcXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsQ2FjaGUgPSBzdG9yYWdlMC5nZXRNeVZhcihcXFxcXFxcInBsYXlVcmxDYWNoZVxcXFxcXFwiLCB7fSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwbGF5VXJsQ2FjaGVbZmlkXSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsYXlVcmxDYWNoZVtmaWRdO1xcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9ICQucmVxdWlyZShcXFxcXFxcInBsYXlcXFxcXFxcIikuZ2V0UGxheVVybChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXlVcmxDYWNoZVtmaWRdID0gdXJsO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcXFxcXCJwbGF5VXJsQ2FjaGVcXFxcXFxcIiwgcGxheVVybENhY2hlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmw7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9LCBpdGVtLmZpZCwgaXRlbS5zaGFyZV9maWRfdG9rZW4sIHNoYXJlSWQsIHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSwgaXRlbS5vYmpfY2F0ZWdvcnkpLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5maWQsXFxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogJ3BsYXlsaXN0ICcgKyBpdGVtLm9ial9jYXRlZ29yeVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgXFxcXG4gICAgfSk7XFxcXG59IGNhdGNoIChlKSB7XFxcXG4gICAgZC5wdXNoKHtcXFxcbiAgICAgICAgdGl0bGU6IGUubWVzc2FnZSxcXFxcbiAgICAgICAgdXJsOiAnaGlrZXI6Ly9lbXB0eScsXFxcXG4gICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxcXG4gICAgICAgIGV4dHJ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ZU1hbmFnZShjb29raWUpIHtcXFxcbiAgICB0aGlzLmNvb2tpZSA9IHt9O1xcXFxuICAgIHRoaXMuYWRkKGNvb2tpZSk7XFxcXG59XFxcXG5PYmplY3QuYXNzaWduKENvb2tpZU1hbmFnZS5wcm90b3R5cGUsIHtcXFxcbiAgICBhZGQoY29va2llKSB7XFxcXG4gICAgICAgIGxldCBjb29raWVzID0gW107XFxcXG4gICAgICAgIGlmICh0eXBlb2YgY29va2llID09PSBcXFxcXFxcInN0cmluZ1xcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICBjb29raWVzID0gY29va2llLnNwbGl0KFxcXFxcXFwiO1xcXFxcXFwiKTtcXFxcbiAgICAgICAgfSBlbHNlIGlmIChBcnJheS5pc0FycmF5KGNvb2tpZSkpIHtcXFxcbiAgICAgICAgICAgIGNvb2tpZXMgPSBjb29raWU7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgY29va2llcy5mb3JFYWNoKHYgPT4ge1xcXFxuICAgICAgICAgICAgdiA9IHYuc3BsaXQoXFxcXFxcXCI9XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgaWYgKHYubGVuZ3RoIDwgMikgcmV0dXJuO1xcXFxuICAgICAgICAgICAgdGhpcy5jb29raWVbdlswXS50cmltKCldID0gdlsxXS50cmltKCk7XFxcXG4gICAgICAgIH0pO1xcXFxuICAgIH0sXFxcXG4gICAgZ2V0KCkge1xcXFxuICAgICAgICByZXR1cm4gT2JqZWN0LmVudHJpZXModGhpcy5jb29raWUpLm1hcCh2ID0+IHZbMF0gKyBcXFxcXFxcIj1cXFxcXFxcIiArIHZbMV0pLmpvaW4oXFxcXFxcXCI7XFxcXFxcXCIpO1xcXFxuICAgIH1cXFxcbn0pO1xcXFxuY29uc3QgY29va2llTWFuYWdlID0gbmV3IENvb2tpZU1hbmFnZShjb29raWUpO1xcXFxuXFxcXG5mdW5jdGlvbiB3YWl0U2xlZXAodGltZSkge1xcXFxuICAgIGphdmEubGFuZy5UaH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IsXFxcXG4gICAgICAgIHRhc2tfaWQ6IHRhc2tfaWQsXFxcXG4gICAgICAgIHJldHJ5X2luZGV4OiByZXRyeV9pbmRleFxcXFxuICAgIH0pLnN0YXJ0KHRydWUpO1xcXFxufVxcXFxuXFxcXG5mdW5jdGlvbiBxdWVyeVRhc2sodGFza19pZCkge1xcXFxuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgOTsgaSsrKSB7XFxcXG4gICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICBsZXQgcmVzID0gdGFzayh0YXNrX2lkLCBpICsgXFxcXFxcXCJcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICBpZiAocmVzLmRhdGEuc3RhdHVzID09PSAyKSB7XFxcXG4gICAgICAgICAgICAgICAgd2FpdFNsZWVwKDEwMDApO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiByZXMuZGF0YS5zYXZlX2FzLnNhdmVfYXNfdG9wX2ZpZHNbMF07XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB3YWl0U2xlZXAoMzAwICogKGkgKyAxKSk7XFxcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxcXG4gICAgfVxcXFxuICAgIHJldHVybiB2b2lkKDApO1xcXFxufVxcXFxuXFxcXG5mdW5jdGlvbiBxdWVyeVRhc2tTdGF0dXModGFza19pZCkge1xcXFxuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgNjsgaSsrKSB7XFxcXG4gICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICBsZXQgcmVzID0gdGFzayh0YXNrX2lkLCBpICsgXFxcXFxcXCJcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICBpZiAocmVzLmRhdGEuc3RhdHVzID09PSAyKSB7XFxcXG4gICAgICAgICAgICAgICAgd2FpdFNsZWVwKDEwMDApO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgd2FpdFN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xcXCIpIHtcXFxcbiAgICAgICAgICAgIGxldCBwbGF5TW9kZSA9IGdldEl0ZW0oXFxcXFxcXCJxdWFya19wbGF5TW9kZVxcXFxcXFwiLCBcXFxcXFxcIui9rOeggVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgIGlmIChwbGF5TW9kZSA9PT0gXFxcXFxcXCLovaznoIFcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIGxldCB2aWRlb1JlcyA9IGdldFByZXZpZXdWaWRlbyhhc2ZpZCk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvTGlzdCA9IHZpZGVvUmVzLmRhdGEudmlkZW9fbGlzdDtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW10sXFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtdXFxcXG4gICAgICAgICAgICAgICAgfTtcXFxcbiAgICAgICAgICAgICAgICB2aWRlb0xpc3QuZmlsdGVyKHYgPT4gdi5hY2Nlc3NhYmxlKS5mb3JFYWNoKHYgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC5uYW1lcy5wdXNoKHYucmVzb2x1dGlvbik7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0LnVybHMucHVzaCh2LnZpZGVvX2luZm8udXJsICsgXFxcXFxcXCIjaXNWaWRlbz10cnVlI1xcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QuaGVhZGVycy5wdXNoKHBsYXlIZWFkZXJzKTtcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcGxheVVybCA9IGdldERvd25sb2FkVXJsKGFzZmlkKS5kYXRhWzBdLmRvd25sb2FkX3VybDtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXFxcXFxcXCLljp/nlLtcXFxcXFxcIl0sXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsICsgXFxcXFxcXCIjaXNWaWRlbz10cnVlIyNmYXN0UGxheU1vZGUjI3RocmVhZHM9XFxcXFxcXCIgKyBnZXRJdGVtKFxcXFxcXFwic3BlZWRUaHJlYWRcXFxcXFxcIiwgXFxcXFxcXCIxMFxcXFxcXFwiKSArIFxcXFxcXFwiI1xcXFxcXFwiXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3BsYXlIZWFkZXJzXVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxcXG4gICAgICAgICAgICBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXFxcbiAgICAgICAgICAgIGlmIChjYXRlZ29yeSA9PT0gJ2F1ZGlvJykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtcXFxcXFxcIumfs+mikVxcXFxcXFwiXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFxcXFxcIiNpc1ZpZGVvPXRydWUjXFxcXFxcXCJdLFxcXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbcGxheUhlYWRlcl0sXFxcXG4gICAgICAgICAgICAgICAgICAgIGx5cmljOiBcXFxcXFxcIlxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNhdGVnb3J5ID09PSAnaW1hZ2UnKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQocGxheVVybCwgcGxheUhlYWRlcikuaW1hZ2UoKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcGxheUhlYWRlciA9IE9iamVjdC5rZXlzKHBsYXlIZWFkZXIpLm1hcChrZXkgPT4ga2V5ICsgXFxcXFxcXCJAXFxcXFxcXCIgKyBTdHJpbmcocGxheUhlYWRlcltrZXldKS5yZXBsYWNlKC87L2csIFxcXFxcXFwi77yb77ybXFxcXFxcXCIpKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJkb3dubG9hZDovL1xcXFxcXFwiICsgcGxheVVybCArIFxcXFxcXFwiO3tcXFxcXFxcIiArIHBsYXlIZWFkZXIuam9pbihcXFxcXFxcIiYmXFxcXFxcXCIpICsgXFxcXFxcXCJ9XFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgIGlmIChlLm1lc3NhZ2UuaW5jbHVkZXMoXFxcXFxcXCJyZXF1aXJlIGxvZ2luXFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICB0b2FzdChcXFxcXFxcIuacqueZu+W9leaIlueZu+W9lei/h+acn++8jOivt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IGNvb2tpZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8vQ29va2ll5qC85byP6ZSZ6K+vXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSl5YWx5Lqr5paH5Lu25o2f5Z2PXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gJChcXFxcXFxcIuacquajgOa1i+WIsFRWQk9Y55qEQ29va2ll5paH5Lu2XFxcXFxcXFxu6K+35L2/55So6L+H5ZCO5YaN5bCd6K+VXFxcXFxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcXFxcXCLlpI3liLZDb29raWVcXFxcXFxcIikge1xcXFxuICAgICAgICBsZXQgY29va2llID0gZ2V0SXRlbShcXFxcXFxcInF1YXJrQ29va2llXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpO1xcXFxuICAgICAgICBpZiAoY29va2llKSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJjb3B5Oi8vXFxcXFxcXCIgKyBjb29raWU7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+acqueZu+W9lVxcXFxcXFwiO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSBlbHNlIHtcXFxcbiAgICAgICAgY2xlYXJJdGVtKFxcXFxcXFwicXVhcmtDb29raWVcXFxcXFxcIik7XFxcXG4gICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+mAgOWHuueZu+W9lVxcXFxcXFwiO1xcXFxuICAgIH1cXFxcbn0sICQuaW1wb3J0UGFyYW0pO1xcXCJ9XVwiLFwicHJveHlcIjpcIlwifSIsInBpY1VybCI6Imh0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vbWVzc3kvMjcuc3ZnIiwidGl0bGUiOiLjgJDlroznu5PjgJHllJDmr4XlvanlpoblpKfluIjor74ifQ==
Add Comment
Please, Sign In to add comment