Content-Type: multipart/related; start=; boundary=----------nCJOUr6ZQo8RzugzPUZTVa Content-Location: https://e.mail.ru/attaches-viewer/?id=13730392450000000353&_av=13730392450000000353%3B0%3B8&x-email=viva-zas%40mail.ru Subject: =?utf-8?Q?Musijezdov.pdf=20-=20Re:=20-=20viva-zas@mail.ru=20-=20=D0=9F=D0=BE=D1=87=D1=82=D0=B0=20Mail.Ru?= MIME-Version: 1.0 ------------nCJOUr6ZQo8RzugzPUZTVa Content-Disposition: inline; filename=default.htm Content-Type: text/html; charset=utf-8; name=default.htm Content-ID: Content-Location: https://e.mail.ru/attaches-viewer/?id=13730392450000000353&_av=13730392450000000353%3B0%3B8&x-email=viva-zas%40mail.ru Content-Transfer-Encoding: 8bit Загрузка... - viva-zas@mail.ru - Почта Mail.Ru
Закрыть 
все вложения

------------nCJOUr6ZQo8RzugzPUZTVa Content-Disposition: inline; filename=ajs.min.js Content-Type: application/x-javascript; name=ajs.min.js Content-Location: https://img.imgsmail.ru/p/0.13.3b/js/ajs.min.js?v=1377502689 Content-Transfer-Encoding: Base64 dm9pZCBmdW5jdGlvbigpeyJ1c2Ugc3RyaWN0IjtmdW5jdGlvbiB1KFope3ZhciBh PW51bGwsZixjLGg9Wi5sZW5ndGgsZCxnPVtdO2ZvcihmPTA7ZjxoOysrZilpZigo ZD1aW2ZdKSYmZC5hanMmJmQgaW5zdGFuY2VvZiBzKWZvcihhPTAsYz1kLmxlbmd0 aDthPGM7KythKWcucHVzaChkW2FdKTtlbHNlInN0cmluZyI9PT10eXBlb2YgZCYm KGQ9Yi5jcmVhdGVUZXh0Tm9kZShkKSksZC5ub2RlVHlwZSYmZy5wdXNoKGQpO2lm KDE9PT0oaD1nLmxlbmd0aCkpYT1nWzBdO2Vsc2UgZm9yKGE9Yi5jcmVhdGVEb2N1 bWVudEZyYWdtZW50KCksZj0wO2Y8aDsrK2YpYS5hcHBlbmRDaGlsZChnW2ZdKTty ZXR1cm4gYX1mdW5jdGlvbiBuKGEsYixmLGMsa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19LF9vblNjcm9s bDpmdW5jdGlvbigpe3RoaXMuX2Rvd249ITE7dGhpcy5fZGVsYXllZEhpZGVFbmQo KX0sX2ZpcmVBY3RpdmVFdmVudDpmdW5jdGlvbihhKXtyZXR1cm4gdGhpcy5maXJl VHJpZ2dlcih7dHlwZToic3VnZ2VzdHM6YWN0aXZlIisKKGE/IkluIjoiT3V0Iil9 KX19KTtxLnByb3RvdHlwZS5nZXRTdWdnZXN0V29yZHM9cS5wcm90b3R5cGUuZ2V0 RmluZFdvcmRzO24udWkuc3VnZ2VzdD1xfShkb2N1bWVudCx0aGlzLmFqcyx0aGlz LmFqcy4kKTsK ------------nCJOUr6ZQo8RzugzPUZTVa Content-Disposition: inline; filename=cookie.js Content-Type: application/x-javascript; name=cookie.js Content-Location: https://img.imgsmail.ru/p/js/cookie.js Content-Transfer-Encoding: Base64 Ly8gPT1DbG9zdXJlQ29tcGlsZXI9PQ0KLy8gQGNvbXBpbGF0aW9uX2xldmVsIFNJ TVBMRV9PUFRJTUlaQVRJT05TDQovLyBAd2FybmluZ19sZXZlbCBWRVJCT1NFDQov LyBAanNjb21wX3dhcm5pbmcgbWlzc2luZ1Byb3BlcnRpZXMNCi8vIEBvdXRwdXRf ZmlsZV9uYW1lIGNvb2tpZS5taW4uanMNCi8vIEBjaGVja190eXBlcw0KLy8gPT0v Q2xvc3VyZUNvbXBpbGVyPT0NCg0KLyoqDQogKiBNYWlsLlJ1IFMtY29va2llIHBh cnNlciBwbHVnaW4NCiAqIENvcHlyaWdodCAoYykgMjAxMiBNYWlsLlJ1DQogKi8N CihmdW5jdGlvbihnbG9iYWwpIHsNCg0KLyoqDQogKiBAcGFyYW0ge3N0cmluZ30g bmFtZSBjb29raWUgbmFtZQ0KICogQHBhcmFtIHsoc3RyaW5nfCopPX0gdmFsdWUg Y29va2llIHZhbHVlDQogKiBAcGFyYW0ge09iamVjdD19IG9wdGlvbnMgT3B0aW9u cw0KICogQHJldHVybiB7KHN0cmluZ3x1bmRlZmluZ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CQkNCgkJcmV0dXJuIHZhbHVlOw0KCX0NCgllbHNl IHsNCgkJaWYgKChkb2N1bWVudC5jb29raWUgfHwgIiIpICE9PSAiIikgew0KCQkJ dmFsdWUgPSAoZG9jdW1lbnQuY29va2llLm1hdGNoKG5ldyBSZWdFeHAoIig/Ol58 ICkiICsgbmFtZSArICJcXD0oXFxTKikoPzo7IHwkKSIpKSB8fCBbXSlbMV07DQoJ CQlyZXR1cm4gdmFsdWUgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHZhbHVlIC8qZGVj b2RlVVJJQ29tcG9uZW50KHZhbHVlKSovOw0KCQl9DQoJfQ0KDQp9DQoNCi8vZXhw b3J0DQp2YXIgbWFpbF9nbG9iYWxfbmFtZXNwYWNlID0gZ2xvYmFsWyJtJHBvcnRh bCJdOw0KaWYoIW1haWxfZ2xvYmFsX25hbWVzcGFjZSltYWlsX2dsb2JhbF9uYW1l c3BhY2UgPSBnbG9iYWxbIm0kcG9ydGFsIl0gPSB7fTsNCg0KbWFpbF9nbG9iYWxf bmFtZXNwYWNlWyJjb29raWUiXSA9IGNvb2tpZTsNCg0KDQp9KSh3aW5kb3cpOw0K ------------nCJOUr6ZQo8RzugzPUZTVa Content-Disposition: inline; filename=s_cookie.js Content-Type: application/x-javascript; name=s_cookie.js Content-Location: https://img.imgsmail.ru/p/js/s_cookie.js Content-Transfer-Encoding: Base64 Ly8gPT1DbG9zdXJlQ29tcGlsZXI9PQ0KLy8gQGNvbXBpbGF0aW9uX2xldmVsIFNJ TVBMRV9PUFRJTUlaQVRJT05TDQovLyBAd2FybmluZ19sZXZlbCBWRVJCT1NFDQov LyBAanNjb21wX3dhcm5pbmcgbWlzc2luZ1Byb3BlcnRpZXMNCi8vIEBvdXRwdXRf ZmlsZV9uYW1lIHNfY29va2llLm1pbi5qcw0KLy8gQGNoZWNrX3R5cGVzDQovLyA9 PS9DbG9zdXJlQ29tcGlsZXI9PQ0KDQovKioNCiAqIE1haWwuUnUgUy1jb29raWUg cGF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QkJdGhpc1sic2V0 R2xvYmFsIl0gPSBmdW5jdGlvbihmaWVsZE5hbWUsIGZpZWxkVmFsdWUpIHsNCgkJ CQlpZihmaWVsZFZhbHVlID09IHZvaWQgMClfdGhyb3dfbm9WYWx1ZV9FcnJvcigp Ow0KDQoJCQkJU19jb29raWVfc2V0X2dldF9yZW1vdmUoZmllbGROYW1lLCBmaWVs ZFZhbHVlKTsNCg0KCQkJCXJldHVybiBfZ2V0R2xvYmFsKGZpZWxkTmFtZSk7DQoJ CQl9Ow0KDQoJCQl0aGlzWyJyZW1vdmVHbG9iYWwiXSA9IGZ1bmN0aW9uKGZpZWxk TmFtZSkgew0KCQkJCXZhciByZXN1bHQgPSBfZ2V0R2xvYmFsKGZpZWxkTmFtZSk7 DQoNCgkJCQlTX2Nvb2tpZV9zZXRfZ2V0X3JlbW92ZShmaWVsZE5hbWUsIG51bGwp Ow0KDQoJCQkJcmV0dXJuIHJlc3VsdDsNCgkJCX07DQoJCX07DQoJfQ0KDQoJcmV0 dXJuIGluc3RhbmNlOw0KfQ0KDQovL2V4cG9ydA0KdmFyIG1haWxfZ2xvYmFsX25h bWVzcGFjZSA9IGdsb2JhbFsibSRwb3J0YWwiXTsNCmlmKCFtYWlsX2dsb2JhbF9u YW1lc3BhY2UpbWFpbF9nbG9iYWxfbmFtZXNwYWNlID0gZ2xvYmFsWyJtJHBvcnRh bCJdID0ge307DQoNCm1haWxfZ2xvYmFsX25hbWVzcGFjZVsiU19Db29raWUiXSA9 IFNfQ29va2llOw0KDQoNCn0pKHdpbmRvdyk7DQo= ------------nCJOUr6ZQo8RzugzPUZTVa Content-Disposition: inline; filename=core.js Content-Type: application/x-javascript; name=core.js Content-Location: https://js.imgsmail.ru/ts/1377502689/images/js/ru/build/core.js Content-Transfer-Encoding: Base64 LyogMjAxMy0wOC0yNiAxMTozODo0NSAqLwoKCi8vIGRhdGEvcnUvaW1hZ2VzL2pz L3J1L2J1aWxkL2NvcmUuanMgc3RhcnQKCi8vIEBid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CBzaG91bGQgYmUg c2VyaWFsaXplZCwKICAgICAgICAgICAgb3IgdW5kZWZpbmVkIGlmIG5vdGhpbmcg c2hvdWxkIGJlIHNlcmlhbGl6ZWQuIFRoZSB0b0pTT04gbWV0aG9kCiAgICAgICAg ICAgIHdpbGwgYmUgcGFzc2VkIHRoZSBrZXkgYXNzb2NpYXRlZCB3aXRoIHRoZSB2 YWx1ZSwgYW5kIHRoaXMgd2lsbCBiZQogICAgICAgICAgICBib3VuZCB0byB0aGUg dmFsdWUKCiAgICAgICAgICAgIEZvciBleGFtcGxlLCB0aGlzIHdvdWxkIHNlcmlh bGl6ZSBEYXRlcyBhcyBJU08gc3RyaW5ncy4KCiAgICAgICAgICAgICAgICBEYXRl LnByb3RvdHlwZS50b0pTT04gPSBmdW5jdGlvbiAoa2V5KSB7CiAgICAgICAgICAg ICAgICAgICAgZnVuY3Rpb24gZihuKSB7CiAgICAgICAgICAgICAgICAgICAgICAg IC8vIEZvcm1hdCBpbnRlZ2VycyB0byBoYXZlIGF0IGxlYXN0IHR3byBkaWdpdHMu CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuIDwgMTAgPyAnMCcgKyBu IDogbjsKICAgICAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgICAg IHJldHVybiB0aGlzLmdldFVUQ0Z1bGxZZWFyKCkgICArICctJyArCiAgICAgICAg ICAgICAgICAgICAgICAgICBmKHRoaXMuZ2V0VVRDTW9udGgoKSArIDEpICsgJy0n ICsKICAgICAgICAgICAgICAgICAgICAgICAgIGYodGhpcy5nZXRVVENEYXRlKCkp ICAgICAgKyAnVCcgKwogICAgICAgICAgICAgICAgICAgICAgICAgZih0aGlzLmdl dFVUQ0hvdXJzKCkpICAgICArICc6JyArCiAgICAgICAgICAgICAgICAgICAgICAg ICBmKHRoaXMuZ2V0VVRDTWludXRlcygpKSAgICsgJzonICsKICAgICAgICAgICAg ICAgICAgICAgICAgIGYodGhpcy5nZXRVVENTZWNvbmRzKCk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FeGFtcGxlOgoKICAgICAgICAgICAgLy8gUGFyc2UgdGhl IHRleHQuIFZhbHVlcyB0aGF0IGxvb2sgbGlrZSBJU08gZGF0ZSBzdHJpbmdzIHdp bGwKICAgICAgICAgICAgLy8gYmUgY29udmVydGVkIHRvIERhdGUgb2JqZWN0cy4K CiAgICAgICAgICAgIG15RGF0YSA9IEpTT04ucGFyc2UodGV4dCwgZnVuY3Rpb24g KGtleSwgdmFsdWUpIHsKICAgICAgICAgICAgICAgIHZhciBhOwogICAgICAgICAg ICAgICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gJ3N0cmluZycpIHsKICAgICAgICAg ICAgICAgICAgICBhID0KL14oXGR7NH0pLShcZHsyfSktKFxkezJ9KVQoXGR7Mn0p OihcZHsyfSk6KFxkezJ9KD86XC5cZCopPylaJC8uZXhlYyh2YWx1ZSk7CiAgICAg ICAgICAgICAgICAgICAgaWYgKGEpIHsKICAgICAgICAgICAgICAgICAgICAgICAg cmV0dXJuIG5ldyBEYXRlKERhdGUuVVRDKCthWzFdLCArYVsyXSAtIDEsICthWzNd LCArYVs0XSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICthWzVdLCArYVs2 XSkpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAg ICAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKICAgICAgICAgICAgfSk7CgogICAg ICAgICAgICBteURhdGEgPSBKU09OLnBhcnNlKCdbIkRhdGUoMDkvMDkvMjAwMSki XScsIGZ1bmN0aW9uIChrZXksIHZhbHVlKSB7CiAgICAgICAgICAgICAgICB2YXIg ZDsKICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcn ICYmCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlLnNsaWNlKDAsIDUpID09 PSAnRGF0ZSgnICYmCiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlLnNsaWNl KC0xKSA9PT0gJyknKSB7Ci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c3QsIHRvSlNPTiwgdG9TdHJpbmcsIHZhbHVl T2YKKi8KCgovLyBDcmVhdGUgYSBKU09OIG9iamVjdCBvbmx5IGlmIG9uZSBkb2Vz IG5vdCBhbHJlYWR5IGV4aXN0LiBXZSBjcmVhdGUgdGhlCi8vIG1ldGhvZHMgaW4g YSBjbG9zdXJlIHRvIGF2b2lkIGNyZWF0aW5nIGdsb2JhbCB2YXJpYWJsZXMuCgpp ZiAoIXRoaXMuSlNPTikgewogICAgdGhpcy5KU09OID0ge307Cn0KCihmdW5jdGlv biAoKSB7CgogICAgZnVuY3Rpb24gZihuKSB7CiAgICAgICAgLy8gRm9ybWF0IGlu dGVnZXJzIHRvIGhhdmUgYXQgbGVhc3QgdHdvIGRpZ2l0cy4KICAgICAgICByZXR1 cm4gbiA8IDEwID8gJzAnICsgbiA6IG47CiAgICB9CgogICAgaWYgKHR5cGVvZiBE YXRlLnByb3RvdHlwZS50b0pTT04gIT09ICdmdW5jdGlvbicpIHsKCiAgICAgICAg RGF0ZS5wcm90b3R5cGUudG9KU09OID0gZnVuY3Rpb24gKGtleSkgewoKICAgICAg ICAgICAgcmV0dXJuIGlzRmluaXRlKHRoaXMudmFsdWVPZigpKSA/CiAgICAgICAg ICAgICAgICAgICB0aGlzLmdldFVUQ0Z1bGxZZWFyKCkgICArICctJyArCiAgICAg ICAgICAgICAgICAgZih0aGlzLmdldFVUQ01vbnRoKCkgKyAxKSArICctJyArCiAg ICAgICAgICAgICAgICAgZih0aGlzLmdldFVUQ0RhdGUoKSkgICAgICArICdUJyAr CiAgICAgICAgICAgICAgICAgZih0aGlzLmdldFVUQ0hvdXJzKCkpICAgICArICc6 JyArCiAgICAgICAgICAgICAgICAgZih0aGlzLmdldFVUQ01pbnV0ZXMoKSkgICAr ICc6JyArCiAgICAgICAgICAgICAgICAgZih0aGlzLmdldFVUQ1NlY29uZHMoKSkg ICArICdaJyA6IG51bGw7CiAgICAgICAgfTsKCiAgICAgICAgU3RyaW5nLnByb3Rv d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gogICAgdmFyIGdhcCwKICAgICAgICBpbmRlbnQs CiAgICAgICAgbWV0YSA9IHsgICAgLy8gdGFibGUgb2YgY2hhcmFjdGVyIHN1YnN0 aXR1dGlvbnMKICAgICAgICAgICAgJ1xiJzogJ1xcYicsCiAgICAgICAgICAgICdc dCc6ICdcXHQnLAogICAgICAgICAgICAnXG4nOiAnXFxuJywKICAgICAgICAgICAg J1xmJzogJ1xcZicsCiAgICAgICAgICAgICdccic6ICdcXHInLAogICAgICAgICAg ICAnIicgOiAnXFwiJywKICAgICAgICAgICAgJ1xcJzogJ1xcXFwnCiAgICAgICAg fSwKICAgICAgICByZXA7CgoKICAgIGZ1bmN0aW9uIHF1b3RlKHN0cmluZykgewoK Ly8gSWYgdGhlIHN0cmluZyBjb250YWlucyBubyBjb250cm9sIGNoYXJhY3RlcnMs IG5vIHF1b3RlIGNoYXJhY3RlcnMsIGFuZCBubwovLyBiYWNrc2xhc2ggY2hhcmFj dGVycywgdGhlbiB3ZSBjYW4gc2FmZWx5IHNsYXAgc29tZSBxdW90ZXMgYXJvdW5k IGl0LgovLyBPdGhlcndpc2Ugd2UgbXVzdCBhbHNvIHJlcGxhY2UgdGhlIG9mZmVu ZGluZyBjaGFyYWN0ZXJzIHdpdGggc2FmZSBlc2NhcGUKLy8gc2VxdWVuY2VzLgoK ICAgICAgICBlc2NhcGFibGUubGFzdEluZGV4ID0gMDsKICAgICAgICByZXR1cm4g ZXNjYXBhYmxlLnRlc3Qoc3RyaW5nKSA/CiAgICAgICAgICAgICciJyArIHN0cmlu Zy5yZXBsYWNlKGVzY2FwYWJsZSwgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAg ICAgIHZhciBjID0gbWV0YVthXTsKICAgICAgICAgICAgICAgIHJldHVybiB0eXBl b2YgYyA9PT0gJ3N0cmluZycgPyBjIDoKICAgICAgICAgICAgICAgICAgICAnXFx1 JyArICgnMDAwMCcgKyBhLmNoYXJDb2RlQXQoMCkudG9TdHJpbmcoMTYpKS5z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IHJldHVybiAnbnVsbCc7CiAgICAgICAgICAgIH0KCi8vIE1ha2UgYW4gYXJy YXkgdG8gaG9sZCB0aGUgcGFydGlhbCByZXN1bHRzIG9mIHN0cmluZ2lmeWluZyB0 aGlzIG9iamVjdCB2YWx1ZS4KCiAgICAgICAgICAgIGdhcCArPSBpbmRlbnQ7CiAg ICAgICAgICAgIHBhcnRpYWwgPSBbXTsKCi8vIElzIHRoZSB2YWx1ZSBhbiBhcnJh eT8KCiAgICAgICAgICAgIGlmIChPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmFw cGx5KHZhbHVlKSA9PT0gJ1tvYmplY3QgQXJyYXldJykgewoKLy8gVGhlIHZhbHVl IGlzIGFuIGFycmF5LiBTdHJpbmdpZnkgZXZlcnkgZWxlbWVudC4gVXNlIG51bGwg YXMgYSBwbGFjZWhvbGRlcgovLyBmb3Igbm9uLUpTT04gdmFsdWVzLgoKICAgICAg ICAgICAgICAgIGxlbmd0aCA9IHZhbHVlLmxlbmd0aDsKICAgICAgICAgICAgICAg IGZvciAoaSA9IDA7IGkgPCBsZW5ndGg7IGkgKz0gMSkgewogICAgICAgICAgICAg ICAgICAgIHBhcnRpYWxbaV0gPSBzdHIoaSwgdmFsdWUpIHx8ICdudWxsJzsKICAg ICAgICAgICAgICAgIH0KCi8vIEpvaW4gYWxsIG9mIHRoZSBlbGVtZW50cyB0b2dl dGhlciwgc2VwYXJhdGVkIHdpdGggY29tbWFzLCBhbmQgd3JhcCB0aGVtIGluCi8v IGJyYWNrZXRzLgoKICAgICAgICAgICAgICAgIHYgPSBwYXJ0aWFsLmxlbmd0aCA9 PT0gMCA/ICdbXScgOgogICAgICAgICAgICAgICAgICAgIGdhcCA/ICdbXG4nICsg Z2FwICsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnRpYWwuam9pbign LFxuJyArIGdhcCkgKyAnXG4nICsKICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBtaW5kICsgJ10nIDoKICAgICAgICAgICAgICAgICAgICAgICAgICAnWycg KyBwYXJ0aWFsLmpvaW4oJywnKSArICddJzsKICAgICAgICAgICAgICAgIGdhcCA9 IG1pbmQ7CiAgICAgICAgICAgICAgICByZXR1cm4gdjsKICAgICAgICAgICAgfQoK Ly8gSWYgdGhlIHJlcGxhY2VyIGlzIGFuIGFycmF5LCB1c2UgaXQgdG8gc2VsZWN0 IHRoZSBtZW1iZXJzIHRvIGJlIHN0cmluZ2lmaWVkLgoKICAgICAgICAgICAgaWYg KHJlcCAmJiB0eXBlb2YgcmVwID09PSAnb2JqZWN0JykgewogICAgICAgICAgICAg ICAgbGVuZ3RoID0gcmVwLmxlbmd0aDsKICAgICAgICAgICAgICAgIGZvciAoaSA9 IDA7IGkgPCBsZW5ndGg7IGkgKz0gMSkgewogICAgICAgICAgICAgICAgICAgIGsg PSByZXBbaV07CiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBrID09PSAn c3RyaW5nJykgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gc3RyKGssIHZh bHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYpIHsKICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHBhcnRpYWwucHVzaChxdW90ZShrKSArIChnYXAg PyAnOiAnIDogJzonKSArIHYpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAg ICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAg ICB9IGVsc2UgewoKLy8gT3RoZXJ3aXNlLCBpdGVyYXRlIHRocm91Z2ggYWxsIG9m IHRoZSBrZXlzIGluIHRoZSBvYmplY3QuCgogICAgICAgICAgICAgICAgZm9yIChr IGluIHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNP d25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAg ICAgICB2ID0gc3RyKGssIHZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAg aWYgKHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnRpYWwucHVz aChxdW90ZShrKSArIChnYXAgPyAnOiAnIDogJzonKSArIHYpOwogICAgICAgICAg ICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAg ICAgICAgfQogICAgICAgICAgICB9CgovLyBKb2luIGFsbCBvZiB0aGUgbWVtYmVy IHRleHRzIHRvZ2V0aGVyLCBzZXBhcmF0ZWQgd2l0aCBjb21tYXMsCi8vIGFuZCB3 cmFwIHRoZW0gaW4gYnJhY2VzLgoKICAgICAgICAgICAgdiA9IHBhcnRpYWwubGVu Z3RoID09PSAwID8gJ3t9JyA6CiAgICAgICAgICAgICAgICBnYXAgPyAne1xuJyAr IGdhcCArIHBhcnRpYWwuam9pbignLFxuJyArIGdhcCkgKyAnXG4nICsKICAgICAg ICAgICAgICAgICAgICAgICAgbWluZCArICd9JyA6ICd7JyArIHBhcnRpYWwuam9p bignLCcpICsgJ30nOwogICAgICAgICAgICBnYXAgPSBtaW5kOwogICAgICAgICAg ICByZXR1cm4gdjsKICAgICAgICB9CiAgICB9CgovLyBJZiB0aGUgSlNPTiBvYmpl Y3QgZG9lcyBub3QgeWV0IGhhdmUgYSBzdHJpbmdpZnkgbWV0aG9kLCBnaXZlIGl0 IG9uZS4KCiAgICBpZiAodHlwZW9mIEpTT04uc3RyaW5naWZ5ICE9PSAnZnVuY3Rp b24nKSB7CiAgICAgICAgSlNPTi5zdHJpbmdpZnkgPSBmdW5jdGlvbiAodmFsdWUs IHJlcGxhY2VyLCBzcGFjZSkgewoKLy8gVGhlIHN0cmluZ2lmeSBtZXRob2QgdGFr ZXMgYSB2YWx1ZSBhbmQgYW4gb3B0aW9uYWwgcmVwbGFjZXIsIGFuZCBhbiBvcHRp b25hbAovLyBzcGFjZSBwYXJhbWV0ZXIsIGFuZCByZXR1cm5zIGEgSlNPTiB0ZXh0 LiBUaGUgcmVwbGFjZXIgY2FuIG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jdXJzaXZlbHkgd2FsayB0aGUgcmVzdWx0 aW5nIHN0cnVjdHVyZSBzbwovLyB0aGF0IG1vZGlmaWNhdGlvbnMgY2FuIGJlIG1h ZGUuCgogICAgICAgICAgICAgICAgdmFyIGssIHYsIHZhbHVlID0gaG9sZGVyW2tl eV07CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09 PSAnb2JqZWN0JykgewogICAgICAgICAgICAgICAgICAgIGZvciAoayBpbiB2YWx1 ZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0Lmhhc093blBy b3BlcnR5LmNhbGwodmFsdWUsIGspKSB7CiAgICAgICAgICAgICAgICAgICAgICAg ICAgICB2ID0gd2Fsayh2YWx1ZSwgayk7CiAgICAgICAgICAgICAgICAgICAgICAg ICAgICBpZiAodiAhPT0gdW5kZWZpbmVkKSB7CiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgdmFsdWVba10gPSB2OwogICAgICAgICAgICAgICAgICAgICAg ICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBk ZWxldGUgdmFsdWVba107CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAg ICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAg ICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gcmV2aXZlci5j YWxsKGhvbGRlciwga2V5LCB2YWx1ZSk7CiAgICAgICAgICAgIH0KCgovLyBQYXJz aW5nIGhhcHBlbnMgaW4gZm91ciBzdGFnZXMuIEluIHRoZSBmaXJzdCBzdGFnZSwg d2UgcmVwbGFjZSBjZXJ0YWluCi8vIFVuaWNvZGUgY2hhcmFjdGVycyB3aXRoIGVz Y2FwZSBzZXF1ZW5jZXMuIEphdmFTY3JpcHQgaGFuZGxlcyBtYW55IGNoYXJhY3Rl cnMKLy8gaW5jb3JyZWN0bHksIGVpdGhlciB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XN0ICYmICQuYWpheFNldHRpbmdzLnhocigpLndpdGhDcmVk ZW50aWFscyA9PT0gdW5kZWZpbmVkKSB7CiAgICAgICAgJC5hamF4VHJhbnNwb3J0 KGZ1bmN0aW9uIChzKSB7CiAgICAgICAgICAgIGlmIChzLmNyb3NzRG9tYWluICYm IHMuYXN5bmMpIHsKICAgICAgICAgICAgICAgIGlmIChzLnRpbWVvdXQpIHsKICAg ICAgICAgICAgICAgICAgICBzLnhkclRpbWVvdXQgPSBzLnRpbWVvdXQ7CiAgICAg ICAgICAgICAgICAgICAgZGVsZXRlIHMudGltZW91dDsKICAgICAgICAgICAgICAg IH0KICAgICAgICAgICAgICAgIHZhciB4ZHI7CiAgICAgICAgICAgICAgICByZXR1 cm4gewogICAgICAgICAgICAgICAgICAgIHNlbmQ6IGZ1bmN0aW9uIChoZWFkZXJz LCBjb21wbGV0ZUNhbGxiYWNrKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGZ1 bmN0aW9uIGNhbGxiYWNrKHN0YXR1cywgc3RhdHVzVGV4dCwgcmVzcG9uc2VzLCBy ZXNwb25zZUhlYWRlcnMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhk ci5vbmxvYWQgPSB4ZHIub25lcnJvciA9IHhkci5vbnRpbWVvdXQgPSAkLm5vb3A7 CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ZHIgPSBudWxsOwogICAgICAg ICAgICAgICAgICAgICAgICAgICAgY29tcGxldGVDYWxsYmFjayhzdGF0dXMsIHN0 YXR1c1RleHQsIHJlc3BvbnNlcywgcmVzcG9uc2VIZWFkZXJzKTsKICAgICAgICAg ICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB4ZHIgPSBu ZXcgWERvbWFpblJlcXVlc3QoKTsKICAgICAgICAgICAgICAgICAgICAgICAgLy8g WERvbWFpblJlcXVlc3Qgb25seSBzdXBwb3J0cyBHRVQgYW5kIFBPU1Q6CiAgICAg ICAgICAgICAgICAgICAgICAgIGlmIChzLnR5cGUgPT09ICdERUxFVEUnKSB7CiAg ICAgICAgICAgICAgICAgICAgICAgICAgICBzLnVybCA9IHMudXJsICsgKC9cPy8u dGVzdChzLnVybCkgPyAnJicgOiAnPycpICsKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAnX21ldGhvZD1ERUxFVEUnOwogICAgICAgICAgICAgICAgICAg ICAgICAgICAgcy50eXBlID0gJ1BPU1QnOwogICAgICAgICAgICAgICAgICAgICAg ICB9IGVsc2UgaWYgKHMudHlwZSA9PT0gJ1BVVCcpIHsKICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHMudXJsID0gcy51cmwgKyAoL1w/Ly50ZXN0KHMudXJsKSA/ ICcmJyA6ICc/JykgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICdf bWV0aG9kPVBVVCc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzLnR5cGUg PSAnUE9TVCc7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAg ICAgICAgICAgICAgeGRyLm9wZW4ocy50eXBlLCBzLnVybCk7CiAgICAgICAgICAg ICAgICAgICAgICAgIHhkci5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAg ICAgICAgICAgICAgICAgICAgICBjYWxsYmFjaygKICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAyMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgJ09LJywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB7dGV4dDog eGRyLnJlc3BvbnNlVGV4dH0sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgJ0NvbnRlbnQtVHlwZTogJyArIHhkci5jb250ZW50VHlwZQogICAgICAgICAg ICAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsK ICAgICAgICAgICAgICAgICAgICAgICAgeGRyLm9uZXJyb3IgPSBmdW5jdGlvbiAo KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjayg0MDQsICdO b3QgRm91bmQnKTsKICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAg ICAgICAgICAgICAgICAgaWYgKHMueGRyVGltZW91dCkgewogICAgICAgICAgICAg ICAgICAgICAgICAgICAgeGRyLm9udGltZW91dCA9IGZ1bmN0aW9uICgpIHsKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjaygwLCAndGltZW91 dCcsIDEpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfTsKICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHhkci50aW1lb3V0ID0gcy54ZHJUaW1lb3V0Owog ICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAg IHhkci5zZW5kKChzLmhhc0NvbnRlbnQgJiYgcy5kYXRhKSB8fCBudWxsKTsKICAg ICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGFib3J0OiBm dW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh4ZHIpIHsK ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHhkci5vbmVycm9yID0gJC5ub29w KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4ZHIuYWJvcnQoKTsKICAg ICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAg ICAgICAgICAgICAgIH07CiAgICAgICAgICAgIH0KICAgICAgICB9KTsKICAgIH0K fSkpOwogCgovLyBkYXRhL3J1L2ltYWdlcy9qcy9ydS9qc0NvcmUvanF1ZXJ5L2px dWVyeS54ZHItdHJhbnNwb3J0LmpzIGVuZAoKLy8gZGF0YS9ydS9pbWFnZXMvanMv cnUvanNDb3JlL2pxdWVyeS9qcXVlcnkudHBsLmpzIHN0YXJ0CgoKLy8gU2ltcGxl IEphdmFTY3JpcHQgVGVtcGxhdGluZwoJLy8gSm9obiBSZXN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IGZ1bmN0aW9uIChMKSB7IEwuaXNWaXNpYmxlKCkgJiYgTC5oaWRl KCk7IH0pOyB9CgkJfSkKCQkubWV0aG9kcyh7CgoJCS8vIExFR08KCQlfX2NvbnN0 cnVjdDogZnVuY3Rpb24gKCRCb3gsIG9wdHMpLypWb2lkKi8KCQl7CgkJCUxpZ2h0 Qm94LmNvdW50Kys7CgoJCQkkRSh0aGlzLCB7CgoJCQkJLy8g77+977+977+977+9 77+977+977+977+9IO+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/vQoJCQkJICBw b3NpdGlvbjoJCQknZml4ZWQnCgkJCQksIHBUb3A6CQkJCSc1MCUnCgkJCQksIHBM ZWZ0OgkJCSc1MCUnCgkJCQksIHpJbmRleDoJCQkzMDAwMAoKCQkJCS8vIO+/ve+/ ve+/ve+/ve+/ve+/ve+/ve+/ve+/vQoJCQkJLCBmYWRlTm9kZToJCQkwCQkJLy8g 77+977+977+977+977+977+977+977+977+977+9IO+/ve+/ve+/vSDvv73vv73v v73vv73vv73vv73vv73vv73vv70g77+977+977+9IENTUyBSdWxlcywKCQkJCQkJ CQkJCQkJCS8vIO+/ve+/ve+/vSDvv73vv70g77+977+977+977+977+977+977+9 IO+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/vSBmYWRlQ29sb3IsIGZhZGVPcGFjaXR5 IO+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/vQoJCQkJLCBmYWRl Q29sb3I6CQknIzAwMCcJLy8g77+977+977+977+9IO+/ve+/ve+/ve+/ve+/ve+/ ve+/ve+/ve+/ve+/ve+/vQoJCQkJLCBmYWRlT3BhY2l0eToJCTAuNgkJLy8g77+9 77+977+977+977+977+977+977+977+977+977+977+9IO+/ve+/ve+/ve+/ve+/ ve+/ve+/ve+/ve+/ve+/vQoKCQkJCSwgc2Nyb2xsV2lkdGg6CQkwCgoJCQkJLCBo aWRlU2VsZWN0czoJCTEJCQkvLyDvv73vv73vv73vv73vv73vv73vv73vv70g77+9 77+977+9IFNFTEVDVCfvv70g77+977+977+9IO+/ve+/ve+/ve+/ve+/ve+/ve+/ ve+/ve+/ve+/ve+/vSDvv73vv73vv73vv73vv70KCQkJCSwgaGlkZU9iamVjdHM6 CQkwCQkJLy8g77+977+977+977+977+977+977+977+9IO+/ve+/ve+/vSBPQkpF Q1Qn77+9IO+/ve+/ve+/vSDvv73vv73vv73vv73vv73vv73vv73vv73vv73vv73v v73vv70g77+977+977+977+977+9CgoJCQkJLCB2aXNpYmxlOgkJCTAJCQkvLyDv v73vv73vv73vv73vv73vv73vv73vv70g77+977+9IO+/ve+/ve+/ve+/ve+/ve+/ ve+/ve+/vSwgMCAtIO+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ vSwgMSAtIO+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/vQoJCQkJLCBkaXNh YmxlZEhpZGU6CQkwCQkJLy8g77+977+977+977+977+977+977+977+977+9IO+/ ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/ve+/vSDvv73vv73vv73vv73vv73v v73vv70g77+977+977+977+977+977+977+977+977+9CgkJCQksIGRpc2FibGVk U2hvdzoJCTAJCQkvLyDvv73vv73vv73vv73vv73vv73vv73vv73vv70g77+977+9 77+977+977+977+977+977+977+977+977+9IO+/ve+/ve+/ve+/ve+/ve+/ve+/ ve+/ve+/ve+/ve+/vSDvv73vv73vv73vv73vv73vv73vv73vv73vv70KCQkJCSwg ZGlzYWJsZToJCQkwCQkJLy8g77+977+977+977+977+977+977+977+9L++/ve+/ ve+/ve+/ve+/ve+/ve+/ve+/vQoJCQkJLCBjb250cm9sczoJCQkwCQkJLy8g77+9 77+977+977+977+977+977+9IO+/ve+/ve+/ve+/ve+/ve+/ve+/vSDvv73vv73v v70g77+977+977+977+977+977+977+977+977+977+9IChDU1MgUnVsZXMpCgkJ CQksIGxiQ29udHJvbHM6CQknLmxiLWNvbnRyb2xzJwoJCQl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CXJldHVybgl0aGlz Ll9jRGlzYWJsZTsKCQl9LAoKCQlodG1sOiBmdW5jdGlvbiAoaHRtbCkKCQl7CgkJ CSRGUyh0aGlzLiRCb3hbMF0pLnZpc2liaWxpdHkJPSAnaGlkZGVuJzsKCgkJCXRo aXMuJEJveAoJCQkJCS5odG1sKGh0bWwpCgkJCQkJLnByb2Nlc3NQbHVnaW5zKCkK CQkJOwoKCQkJdGhpcy5pbml0Q29udHJvbHModGhpcy4kQm94KTsKCQkJdGhpcy5m aXhQb3MoKTsKCgkJCSRGUyh0aGlzLiRCb3hbMF0pLnZpc2liaWxpdHkJPSAnJzsK CgkJCXJldHVybgl0aGlzOwoJCX0sCgoKCQlpc1Zpc2libGU6IGZ1bmN0aW9uICgp eyByZXR1cm4gdGhpcy52aXNpYmxlOyB9LAoKCgkJdG9nZ2xlOiBmdW5jdGlvbiAo Zi8qZm9yY2U6Qm9vbCA9IHVuZGVmaW5lZCovLCBzLypzaG93OkJvb2wgPSB1bmRl ZmluZWQqLykKCQl7CgkJCXZhcgoJCQkJICBkCT0gZGVmaW5lZChzLCAhdGhpcy52 aXNpYmxlKSA/ICcnIDogJ25vbmUnCgkJCQksIGUgPSAhZCA/ICdzaG93JyA6ICdo aWRlJwoJCQk7CgoJCQlpZiggdGhpcy5kaXNwYXRjaEV2ZW50KCdiZWZvcmUnICsg U3RyaW5nLnVjZmlyc3QoZSksIHRoaXMpICE9PSBmYWxzZSApCgkJCXsKCQkJCS8q KgoJCQkJICogQHRvZG8KCQkJCSAqIO+/ve+/ve+/ve+/vSDvv73vv73vv70g77+9 77+977+977+977+977+977+977+9LCDvv70g77+977+977+977+977+977+977+9 77+9IGYob3JjZSkg77+977+977+977+977+9CgkJCQkgKiDvv73vv73vv70g77+9 77+977+977+977+977+977+977+977+977+9IO+/ve+/ve+/ve+/ve+/ve+/ve+/ ve+/vSDvv73vv73vv70g77+977+977+977+977+977+977+977+9CgkJCQkgKi8K CQkJCSRGUyh0aGlzLiRCb3hbM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