Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@Quark.简@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoiUXVhcmsu566AIiwiYXV0aG9yIjoiQExveURnSWsiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IyMiLCJ2ZXJzaW9uIjoxOCwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxubGV0IGQgPSBbXTtcblxubGV0IGNvb2tpZSA9IGdldEl0ZW0oXCJxdWFya0Nvb2tpZVwiLCBcIlwiKTtcblxuaWYgKCEkLnJlcXVpcmUoXCJ0b29sXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xuICAgIGNsZWFySXRlbShcInF1YXJrQ29va2llXCIpO1xuICAgIGQucHVzaCh7XG4gICAgICAgIHRpdGxlOiAnPGZvbnQgY29sb3I9XCIjMTNCNjFCXCI+4paQIDwvZm9udD48Yj7muKnppqjmj5DnpLo8Yj4nLFxuICAgICAgICBjb2xfdHlwZTogXCJyaWNoX3RleHRcIixcbiAgICB9KTtcbiAgICBkLnB1c2goe1xuICAgICAgICB1cmw6ICQucmVxdWlyZShcImFjY291bnRcIiwgdHJ1ZSksXG4gICAgICAgIGNvbF90eXBlOiBcInRleHRfMVwiLFxuICAgICAgICB0aXRsZTogXCLmnKrmo4DmtYvliLDnmbvlvZXkv6Hmga/vvIzngrnmiJHot7PovaznmbvlvZXotKblj7fpobXpnaLvvIzojrflj5ZRdWFyayBDb29raWXlkI7mlrnlj6/kvb/nlKhcIixcbiAgICAgICAgZXh0cmE6IHt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nRoaXMudXJsLCBvcHRpb25zKSk7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIGlmIChyZXMuc3RhdHVzQ29kZSA+PSAyMDAgJiYgcmVzLnN0YXR1c0NvZGUgPD0gMzAwKSB7XFxuICAgICAgICAgICAgICAgIGxldCBib2R5ID0gcmVzLmJvZHk7XFxuICAgICAgICAgICAgICAgIGlmICh0b0pzb24pIHtcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSBKU09OLnBhcnNlKGJvZHkpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1Y2Nlc3NDYWxsYmFjayhib2R5LCByZXMpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihTdHJpbmcocmVzLnN0YXR1c0NvZGUpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlcnIpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBlcnIgPSB0aGlzLmVycm9yVHlwZUNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHRyeVJlc3VsdCA9IHRoaXMuZXJyb3JDYWxsYmFja1dpdGhSZXRyeShlcnIsIHJlcywgdGhpcyk7XFxuICAgICAgICAgICAgICAgIGlmICh0cnlSZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQodG9Kc29uKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lcnJvckNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVycm9yQ2FsbGJhY2soZXJyLCByZXMpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAgc2V0T3B0aW9ucyhvcHRpb25zKSB7XFxuICAgICAgICB0aGlzLm9wdGlvbnMgPSBPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zLCB7XFxuICAgICAgICAgICAgd2l0aEhlYWRlcnM6IHRydWVcXG4gICAgICAgIH0pO1xcbiAgICAgICAgcmV0dXJuIHRoaXM7XFxuICAgIH0sXFxuICAgIG1lcmdlSGVhZEFuZEJvZHkob3B0aW9ucykge1xcbiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307XFxuICAgICAgICBPYmplY3QuYXNzaWduKHRoaXMub3B0aW9ucy5oZWFkZXJzfHx7fSwgb3B0aW9ucy5oZWFkZXJzKTtcXG4gICAgICAgIGlmICh0eXBlb2YgdGhpcy5vcHRpb25zLmJvZHkgPT09IFxcXCJvYmplY3RcXFwiICYmIHR5cGVvZiBvcHRpb25zLmJvZHkgPT09IFxcXCJvYmplY3RcXFwiKSB7XFxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbih0aGlzLm9wdGlvbnMuYm9keXx8e30sIG9wdGlvbnMuYm9keSk7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAodHlwZW9mIG9wdGlvbnMuYnVpbGRVcmwgPT09IFxcXCJvYmplY3RcXFwiKSB7XFxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbih0aGlzLmJ1aWxkUGFyYW18fHt9LCBvcHRpb25zLmJ1aWxkVXJsKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiB0aGlzO1xcbiAgICB9XFxufSk7XFxuXFx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bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVRva2VuOiBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKGl0ZW0ub2JqX2NhdGVnb3J5KSArIGl0ZW0uZmlsZV9uYW1lLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAkLmRhdGVGb3JtYXQoaXRlbS51cGRhdGVkX2F0LCAneXl5eS1NTS1kZCcpICsgJyAgJyArIGZvcm1hdFNpemUoaXRlbS5zaXplKSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogaXRlbS50aHVtYm5haWwsXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGxheVVybENhY2hlID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcInBsYXlVcmxDYWNoZVxcXCIsIHt9KTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwbGF5VXJsQ2FjaGVbZmlkXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwbGF5VXJsQ2FjaGVbZmlkXTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9ICQucmVxdWlyZShcXFwicGxheVxcXCIpLmdldFBsYXlVcmwoZmlkLCBmaWRfdG9rZW4sIHB3ZF9pZCwgc3Rva2VuLCBjYXRlZ29yeSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxheVVybENhY2hlW2ZpZF0gPSB1cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcInBsYXlVcmxDYWNoZVxcXCIsIHBsYXlVcmxDYWNoZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybDtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgaXRlbS5maWQsIGl0ZW0uc2hhcmVfZmlkX3Rva2VuLCBzaGFyZUlkLCBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksIGl0ZW0ub2JqX2NhdGVnb3J5KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogJ3BsYXlsaXN0ICcgKyBpdGVtLm9ial9jYXRlZ29yeVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgICAgIFxcbiAgICB9KTtcXG59IGNhdGNoIChlKSB7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogZS5tZXNzYWdlLFxcbiAgICAgICAgdXJsOiAnaGlrZXI6Ly9lbXB0eScsXFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGlm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tcXG4gICAgICAgICAgICBjb29raWVzID0gY29va2llLnNwbGl0KFxcXCI7XFxcIik7XFxuICAgICAgICB9IGVsc2UgaWYgKEFycmF5LmlzQXJyYXkoY29va2llKSkge1xcbiAgICAgICAgICAgIGNvb2tpZXMgPSBjb29raWU7XFxuICAgICAgICB9XFxuICAgICAgICBjb29raWVzLmZvckVhY2godiA9PiB7XFxuICAgICAgICAgICAgdiA9IHYuc3BsaXQoXFxcIj1cXFwiKTtcXG4gICAgICAgICAgICBpZiAodi5sZW5ndGggPCAyKSByZXR1cm47XFxuICAgICAgICAgICAgdGhpcy5jb29raWVbdlswXS50cmltKCldID0gdlsxXS50cmltKCk7XFxuICAgICAgICB9KTtcXG4gICAgfSxcXG4gICAgZ2V0KCkge1xcbiAgICAgICAgcmV0dXJuIE9iamVjdC5lbnRyaWVzKHRoaXMuY29va2llKS5tYXAodiA9PiB2WzBdICsgXFxcIj1cXFwiICsgdlsxXSkuam9pbihcXFwiO1xcXCIpO1xcbiAgICB9XFxufSk7XFxuY29uc3QgY29va2llTWFuYWdlID0gbmV3IENvb2tpZU1hbmFnZShjb29raWUpO1xcblxcbmZ1bmN0aW9uIHdhaXRTbGVlcCh0aW1lKSB7XFxuICAgIGphdmEubGFuZy5UaHJlYWQuc2xlZXAodGltZSB8fCA2MDApO1xcbn1cXG5cXG5mdW5jdGlvbiByZXF1ZXN0SHR0cCh1cmwpIHtcXG4gICAgcmV0dXJuIG5ldyBodHRwUmVxdWVzdCh1cmwpXFxuICAgICAgICAuc3VjY2VzcygoYm9keSwgcmVzKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGJvZHkuc3RhdHVzICE9PSAyMDApIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGJvZHkubWVzc2FnZSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGNvb2tpZU1hbmFnZS5hZGQocmVzLmhlYWRlcnNbXFxcInNldC1jb29raWVcXFwiXSk7XFxuICAgICAgIC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CBcXFwi6L2s56CBXFxcIik7XFxuICAgICAgICAgICAgaWYgKHBsYXlNb2RlID09PSBcXFwi6L2s56CBXFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgdmlkZW9SZXMgPSBnZXRQcmV2aWV3VmlkZW8oYXNmaWQpO1xcbiAgICAgICAgICAgICAgICBsZXQgdmlkZW9MaXN0ID0gdmlkZW9SZXMuZGF0YS52aWRlb19saXN0O1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW10sXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtdXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgIHZpZGVvTGlzdC5maWx0ZXIodiA9PiB2LmFjY2Vzc2FibGUpLmZvckVhY2godiA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC5uYW1lcy5wdXNoKHYucmVzb2x1dGlvbik7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC51cmxzLnB1c2godi52aWRlb19pbmZvLnVybCArIFxcXCIjaXNWaWRlbz10cnVlI1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QuaGVhZGVycy5wdXNoKHBsYXlIZWFkZXJzKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsID0gZ2V0RG93bmxvYWRVcmwoYXNmaWQpLmRhdGFbMF0uZG93bmxvYWRfdXJsO1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW1xcXCLljp/nlLtcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsICsgXFxcIiNpc1ZpZGVvPXRydWUjI2Zhc3RQbGF5TW9kZSMjdGhyZWFkcz1cXFwiICsgZ2V0SXRlbShcXFwic3BlZWRUaHJlYWRcXFwiLCBcXFwiMTBcXFwiKSArIFxcXCIjXFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbcGxheUhlYWRlcnNdXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgcGxheVVybCA9IGdldERvd25sb2FkVXJsKGFzZmlkKS5kYXRhWzBdLmRvd25sb2FkX3VybDtcXG4gICAgICAgICAgICBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXG4gICAgICAgICAgICBpZiAoY2F0ZWdvcnkgPT09ICdhdWRpbycpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtcXFwi6Z+z6aKRXFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbcGxheVVybCArIFxcXCIjaXNWaWRlbz10cnVlI1xcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3BsYXlIZWFkZXJdLFxcbiAgICAgICAgICAgICAgICAgICAgbHlyaWM6IFxcXCJcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHBsYXlMaXN0KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNhdGVnb3J5ID09P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CT1jojrflj5ZDb29raWVcXFwiKSB7XFxuICAgICAgICBsZXQgcGF0aCA9IFxcXCIvc3RvcmFnZS9lbXVsYXRlZC8wL1RWLy5xdWFya191c2VyXFxcIjtcXG4gICAgICAgIGlmIChmaWxlRXhpc3QoXFxcImZpbGU6Ly9cXFwiICsgcGF0aCkpIHtcXG4gICAgICAgICAgICBpZiAoIW5ldyBqYXZhLmlvLkZpbGUocGF0aCkuY2FuUmVhZCgpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXCLmsqHmnInmnYPpmZDor7vlj5ZDb29raWXmlofku7bvvIzor7fmiZPlvIDmiYDmnInmlofku7bmnYPpmZBcXFxcbua1t+mYlOiuvue9ri0+5pu05aSa5Yqf6IO9LT7lhoXpg6jmlofku7bnrqHnkIYtPuWPs+S4iuinklxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoZmV0Y2goXFxcImZpbGU6Ly9cXFwiICsgcGF0aCkpO1xcbiAgICAgICAgICAgICAgICBsZXQgY29va2llID0ganNvbi5jb29raWU7XFxuICAgICAgICAgICAgICAgIGlmICgkLnJlcXVpcmUoXFxcInRvb2xcXFwiKS5pc0xvZ2luQ29va2llKGNvb2tpZSkpIHtcXG4gICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgY29va2llKTtcXG4gICAgICAgICAgICAgICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vQ29va2ll5qC85byP6ZSZ6K+vXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iOt+WPluWksei0peWFseS6q+aWh+S7tuaNn+Wdj1xcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gJChcXFwi5pyq5qOA5rWL5YiwVFZCT1jnmoRDb29raWXmlofku7ZcXFxcbuivt+S9v+eUqOi/h+WQjuWGjeWwneivlVxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcbiAgICAgICAgfVxcbiAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi5aSN5Yi2Q29va2llXFxcIikge1xcbiAgICAgICAgbGV0IGNvb2tpZSA9IGdldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgaWYgKGNvb2tpZSkge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBjb29raWU7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mnKrnmbvlvZVcXFwiO1xcbiAgICAgICAgfVxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgY2xlYXJJdGVtKFxcXCJxdWFya0Nvb2tpZVxcXCIpO1xcbiAgICAgICAgaXNyICYmIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6YCA5Ye655m75b2VXFxcIjtcXG4gICAgfVxcbn0sICQuaW1wb3J0UGFyYW0pO1wifV0iLCJpY29uIjoiIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment