Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- (function(window, document, undefined) {
- /**
- * @param {!Function} source
- * @param {string} name
- * @param {boolean} bool
- * @return {?}
- */
- function require(source, name, bool) {
- return function() {
- try {
- return source.apply(this, arguments);
- } catch (moduleLoader) {
- if (!bool) {
- load(moduleLoader, name);
- }
- }
- };
- }
- /**
- * @param {!Object} e
- * @param {string} node
- * @return {undefined}
- */
- function load(e, node) {
- var c;
- if (.01 > Math.random()) {
- try {
- var validPlugins = e && e.message || "";
- if (!(c = -1 < validPlugins.indexOf("network error occurred") || -1 < validPlugins.indexOf("send beacon") && -1 < validPlugins.indexOf("Content Security Policy"))) {
- (new Event).log("jserrs", k, e.message, node, result.href, "", "string" === typeof e.stack && e.stack.replace(/\n/g, "\\n"));
- }
- } catch (e) {
- }
- }
- }
- /**
- * @param {string} p
- * @param {?} record
- * @param {?} e
- * @param {string} d
- * @param {!Object} config
- * @return {?}
- */
- function init(p, record, e, d, config) {
- /**
- * @param {number} end
- * @return {undefined}
- */
- function find(end) {
- /** @type {number} */
- var start = (new Date).getTime();
- if (end && start < end) {
- fullPath = fullPath + (end - start + 20);
- }
- _.setTimeout(function() {
- find(start);
- }, 20, "timeCorrector");
- }
- /**
- * @return {?}
- */
- function ajax() {
- var tmp_step_diff = (new Date).getTime() + fullPath;
- if (tmp_step_diff < best_part_step_diff) {
- tmp_step_diff = best_part_step_diff + 10;
- }
- return best_part_step_diff = tmp_step_diff;
- }
- /**
- * @return {?}
- */
- function push() {
- return Math.round((ajax() - request) / 50);
- }
- /**
- * @param {!Array} b
- * @param {number} a
- * @return {undefined}
- */
- function r(b, a) {
- /** @type {number} */
- a = Math.max(0, Math.min(a, 65535));
- _.mergeArrays(b, [a >> 8, a & 255]);
- }
- /**
- * @param {!Array} obj
- * @param {number} id
- * @return {undefined}
- */
- function $(obj, id) {
- _.mergeArrays(obj, [id & 255]);
- }
- /**
- * @param {!Array} obj
- * @param {number} value
- * @return {undefined}
- */
- function test(obj, value) {
- /** @type {number} */
- value = Math.max(0, value | 0);
- for (; 127 < value;) {
- _.mergeArrays(obj, [value & 127 | 128]);
- /** @type {number} */
- value = value >> 7;
- }
- _.mergeArrays(obj, [value]);
- }
- /**
- * @param {!Array} n
- * @param {string} v
- * @return {undefined}
- */
- function cb(n, v) {
- if (255 < v.length) {
- v = v.substr(0, 255);
- }
- _.mergeArrays(n, [v.length]);
- /** @type {number} */
- var i = 0;
- for (; i < v.length; i++) {
- r(n, v.charCodeAt(i));
- }
- }
- /**
- * @param {!Array} a
- * @param {string} b
- * @return {undefined}
- */
- function m(a, b) {
- test(a, b.length);
- /** @type {number} */
- var i = 0;
- for (; i < b.length; i++) {
- test(a, b.charCodeAt(i));
- }
- }
- /**
- * @param {!Object} value
- * @return {?}
- */
- function notify(value) {
- if (!value.nodeName) {
- return value[j] = -1, null;
- }
- /** @type {number} */
- var i = +value[j];
- if (!isFinite(i) || 0 >= i) {
- return null;
- }
- if (value.attributes) {
- /** @type {!Object} */
- var parent = value;
- for (; parent;) {
- if (parent.attributes.__ym_wv_ign) {
- return null;
- }
- parent = parent.parentElement;
- }
- }
- /** @type {number} */
- parent = 64;
- /** @type {number} */
- var b = 0;
- var a = util.getElementParent(value);
- var inOther = a && a[j] ? a[j] : 0;
- if (0 > inOther) {
- /** @type {number} */
- inOther = 0;
- }
- var c = value.nodeName.toUpperCase();
- var params = typeMap[c];
- if (!params) {
- /** @type {number} */
- parent = parent | 2;
- }
- var s = util.getElementNeighborPosition(value);
- if (!s) {
- /** @type {number} */
- parent = parent | 4;
- }
- var obj = util.getElementRegion(value);
- if ((a = a ? util.getElementRegion(a) : null) && obj[0] == a[0] && obj[1] == a[1] && obj[2] == a[2] && obj[3] == a[3]) {
- /** @type {number} */
- parent = parent | 8;
- }
- json[i].pos = obj[0] + "x" + obj[1];
- json[i].size = obj[2] + "x" + obj[3];
- if (value.id && "string" == typeof value.id) {
- /** @type {number} */
- parent = parent | 32;
- }
- if (a = util.calcTextChecksum(value)) {
- /** @type {number} */
- parent = parent | 16;
- }
- var f = util.calcAttribChecksum(value);
- if (f) {
- /** @type {number} */
- b = b | 2;
- }
- a: {
- var n = util.getElementChildren(util.getElementParent(value), value.tagName);
- /** @type {number} */
- var i = 0;
- for (; i < n.length; i++) {
- if ((!n[i].id || "string" != typeof n[i].id) && util.calcAttribChecksum(n[i]) == f && util.calcTextChecksum(n[i]) == a) {
- /** @type {boolean} */
- n = true;
- break a;
- }
- }
- /** @type {boolean} */
- n = false;
- }
- if (n) {
- /** @type {number} */
- parent = parent | 1;
- var b = util.calcChildrenChecksum(value);
- }
- /** @type {!Array} */
- n = [];
- $(n, 1);
- test(n, i);
- $(n, parent);
- test(n, inOther);
- if (params) {
- $(n, params);
- } else {
- cb(n, c);
- }
- if (s) {
- test(n, s);
- }
- if (!(parent & 8)) {
- test(n, obj[0]);
- test(n, obj[1]);
- test(n, obj[2]);
- test(n, obj[3]);
- }
- if (parent & 32) {
- cb(n, value.id);
- }
- if (a) {
- r(n, a);
- }
- if (parent & 1) {
- r(n, b);
- }
- $(n, b);
- if (f) {
- r(n, f);
- }
- return n;
- }
- /**
- * @param {number} s
- * @param {string} hash
- * @param {!Object} el
- * @param {!Object} v
- * @param {?} h
- * @param {?} w
- * @return {?}
- */
- function constructor(s, hash, el, v, h, w) {
- var val;
- for (; el && (val = util.getElementSize(el)) && (!val[0] || !val[1]);) {
- el = util.getElementParent(el);
- }
- if (!el) {
- return null;
- }
- val = el[j];
- if (!val || 0 > val) {
- return null;
- }
- var torrent = {
- mousemove : 2,
- click : 32,
- dblclick : 33,
- mousedown : 4,
- mouseup : 30,
- touch : 12
- }[hash];
- if (!torrent) {
- return null;
- }
- var p = util.getElementXY(el);
- /** @type {!Array} */
- el = [];
- $(el, torrent);
- test(el, s);
- test(el, val);
- test(el, Math.max(0, v[0] - p[0]));
- test(el, Math.max(0, v[1] - p[1]));
- if (/^mouse(up|down)|click$/.test(hash)) {
- s = h || w;
- $(el, 2 > s ? 1 : s == (h ? 2 : 4) ? 4 : 2);
- }
- return el;
- }
- /**
- * @param {undefined} _
- * @param {number} prev
- * @param {!Object} p
- * @param {undefined} area
- * @return {?}
- */
- function value(_, prev, p, area) {
- prev = prev[j];
- if (!prev || 0 > prev) {
- return null;
- }
- /** @type {!Array} */
- var returnValue = [];
- $(returnValue, 31);
- test(returnValue, _);
- test(returnValue, prev);
- test(returnValue, p[0]);
- test(returnValue, p[1]);
- $(returnValue, 0);
- $(returnValue, 0);
- $(returnValue, area);
- return returnValue;
- }
- /**
- * @param {undefined} prev
- * @param {!Object} p
- * @return {?}
- */
- function c(prev, p) {
- /** @type {!Array} */
- var b = [];
- $(b, 3);
- test(b, prev);
- test(b, p[0]);
- test(b, p[1]);
- return b;
- }
- /**
- * @param {undefined} obj
- * @param {!Object} a
- * @param {number} b
- * @return {?}
- */
- function F(obj, a, b) {
- /** @type {!Array} */
- var res = [];
- b = b[j];
- if (!b || 0 > b) {
- return null;
- }
- $(res, 16);
- test(res, obj);
- test(res, a[0]);
- test(res, a[1]);
- test(res, b);
- return res;
- }
- /**
- * @param {undefined} message
- * @param {!Object} spec
- * @param {!Object} obj
- * @return {?}
- */
- function api(message, spec, obj) {
- /** @type {!Array} */
- var get = [];
- $(get, 28);
- test(get, message);
- test(get, spec[0]);
- test(get, spec[1]);
- test(get, obj[0]);
- test(get, obj[1]);
- return get;
- }
- /**
- * @param {number} b
- * @param {undefined} a
- * @param {undefined} parent
- * @param {!Object} input
- * @param {boolean} fn
- * @return {?}
- */
- function A(b, a, parent, input, fn) {
- /** @type {!Array} */
- var n = [];
- $(n, 38);
- test(n, b);
- r(n, a);
- $(n, parent);
- b = input[j];
- if (!b || 0 > b) {
- /** @type {number} */
- b = 0;
- }
- test(n, b);
- $(n, fn ? 1 : 0);
- return n;
- }
- /**
- * @param {undefined} a
- * @param {number} b
- * @return {?}
- */
- function L(a, b) {
- var c;
- if (0 == b.length) {
- /** @type {string} */
- var t = c = "";
- } else {
- if (100 >= b.length) {
- /** @type {number} */
- c = b;
- /** @type {string} */
- t = "";
- } else {
- if (200 >= b.length) {
- c = b.substr(0, 100);
- t = b.substr(100);
- } else {
- c = b.substr(0, 97);
- t = b.substr(b.length - 97);
- }
- }
- }
- /** @type {!Array} */
- var h = [];
- $(h, 29);
- test(h, a);
- m(h, c);
- m(h, t);
- return h;
- }
- /**
- * @param {undefined} fn
- * @return {?}
- */
- function E(fn) {
- /** @type {!Array} */
- var element = [];
- $(element, 27);
- test(element, fn);
- return element;
- }
- /**
- * @param {undefined} fn
- * @return {?}
- */
- function array(fn) {
- /** @type {!Array} */
- var schema = [];
- $(schema, 14);
- test(schema, fn);
- return schema;
- }
- /**
- * @param {undefined} s
- * @return {?}
- */
- function H(s) {
- /** @type {!Array} */
- var val = [];
- $(val, 15);
- test(val, s);
- return val;
- }
- /**
- * @param {undefined} s
- * @param {!Object} t
- * @return {?}
- */
- function y(s, t) {
- /** @type {!Array} */
- var o = [];
- $(o, 17);
- test(o, s);
- test(o, t[j]);
- return o;
- }
- /**
- * @param {undefined} fn
- * @param {!Object} range
- * @return {?}
- */
- function K(fn, range) {
- /** @type {!Array} */
- var value = [];
- $(value, 18);
- test(value, fn);
- test(value, range[j]);
- return value;
- }
- /**
- * @param {undefined} a
- * @param {!Object} obj
- * @param {?} key
- * @param {boolean} setting
- * @return {?}
- */
- function init(a, obj, key, setting) {
- /** @type {!Array} */
- var h = [];
- $(h, 39);
- test(h, a);
- test(h, obj[j]);
- cb(h, String(key));
- $(h, setting ? 1 : 0);
- return h;
- }
- /**
- * @param {!Object} d
- * @return {?}
- */
- function T(d) {
- var count = d[j];
- if (!count || 0 > count || !/^INPUT|SELECT|TEXTAREA$/.test(d.nodeName) || !d.form || on(d.form)) {
- return null;
- }
- var c = util.getFormNumber(d.form);
- if (0 > c) {
- return null;
- }
- var length = "INPUT" == d.nodeName ? {
- text : 0,
- color : 0,
- date : 0,
- datetime : 0,
- "datetime-local" : 0,
- email : 0,
- number : 0,
- range : 0,
- search : 0,
- tel : 0,
- time : 0,
- url : 0,
- month : 0,
- week : 0,
- password : 2,
- radio : 3,
- checkbox : 4,
- file : 6,
- image : 7
- }[d.type] : {
- SELECT : 1,
- TEXTAREA : 5
- }[d.nodeName];
- if ("number" != typeof length) {
- return null;
- }
- /** @type {number} */
- var timemodified = -1;
- var key = d.form.elements;
- var ll = key.length;
- /** @type {number} */
- var i = 0;
- /** @type {number} */
- var timemod = 0;
- for (; i < ll; i++) {
- if (key[i].name == d.name) {
- if (key[i] == d) {
- /** @type {number} */
- timemodified = timemod;
- break;
- }
- timemod++;
- }
- }
- if (0 > timemodified) {
- return null;
- }
- /** @type {!Array} */
- key = [];
- $(key, 7);
- test(key, count);
- test(key, c);
- test(key, length);
- m(key, d.name || "");
- test(key, timemodified);
- return key;
- }
- /**
- * @param {undefined} rule
- * @param {!Element} e
- * @return {?}
- */
- function thumb_click(rule, e) {
- var i = util.getFormNumber(e);
- if (0 > i) {
- return null;
- }
- var data = e.elements;
- var V = data.length;
- /** @type {!Array} */
- var obj = [];
- /** @type {number} */
- var v = 0;
- for (; v < V; v++) {
- if (!util.isEmptyField(data[v])) {
- var vs = data[v][j];
- if (vs && 0 < vs) {
- _.mergeArrays(obj, [vs]);
- }
- }
- }
- /** @type {!Array} */
- data = [];
- $(data, 11);
- test(data, rule);
- test(data, i);
- test(data, obj.length);
- /** @type {number} */
- i = 0;
- for (; i < obj.length; i++) {
- test(data, obj[i]);
- }
- return data;
- }
- /**
- * @return {?}
- */
- function cc() {
- /** @type {!Array} */
- var value = [];
- $(value, 13);
- return value;
- }
- /**
- * @param {!Function} x
- * @param {!Array} b
- * @param {string} opts
- * @return {undefined}
- */
- function replace(x, b, opts) {
- x = x.apply(window, b);
- model.append(x, opts);
- }
- /**
- * @param {string} v
- * @return {undefined}
- */
- function callback(v) {
- if (v[j]) {
- a: {
- var n = push();
- var message = v[j];
- if (0 < message) {
- /** @type {!Array} */
- var item = [];
- v = util.getElementRegion(v);
- var data = json[message];
- var index = v[0] + "x" + v[1];
- var size = v[2] + "x" + v[3];
- if (index != data.pos) {
- data.pos = index;
- $(item, 9);
- test(item, n);
- test(item, message);
- test(item, v[0]);
- test(item, v[1]);
- }
- if (size != data.size) {
- data.size = size;
- $(item, 10);
- test(item, n);
- test(item, message);
- test(item, v[2]);
- test(item, v[3]);
- }
- if (item.length) {
- /** @type {!Array} */
- n = item;
- break a;
- }
- }
- /** @type {null} */
- n = null;
- }
- } else {
- if (n = util.getElementParent(v)) {
- callback(n);
- }
- v[j] = i;
- json[i] = {};
- i++;
- n = notify(v);
- model.append(n, void 0);
- n = T(v);
- }
- model.append(n, void 0);
- }
- /**
- * @param {!Object} element
- * @param {boolean} array
- * @return {?}
- */
- function extend(element, array) {
- var rect = element && util.classNameExists(element, "(ym-disable-keys|-metrika-nokeys)");
- if (array && element) {
- rect = rect || !!util.getElementsByClassName("(ym-disable-keys|-metrika-nokeys)", element).length;
- }
- return rect;
- }
- /**
- * @param {!Object} a
- * @return {?}
- */
- function on(a) {
- return a && util.classNameExists(a, "(ym-disable-submit|-metrika-noform)");
- }
- /**
- * @param {!Object} e
- * @return {undefined}
- */
- function update(e) {
- var n = _this.getTarget(e);
- if (n && "SCROLLBAR" != n.nodeName) {
- if (/^INPUT|SELECT|TEXTAREA|BUTTON$/.test(n.tagName)) {
- if (n[j]) {
- callback(n);
- } else {
- var data = n.form;
- if (data) {
- data = data.elements;
- var nbElts = data.length;
- /** @type {number} */
- var i = 0;
- for (; i < nbElts; i++) {
- if (/^INPUT|SELECT|TEXTAREA|BUTTON$/.test(data[i].tagName) && !data[i][j]) {
- callback(data[i]);
- }
- }
- } else {
- callback(n);
- }
- }
- } else {
- callback(n);
- }
- replace(constructor, [push(), e.type, n, _this.getPos(e), e.which, e.button]);
- }
- }
- /**
- * @param {!Object} value
- * @return {undefined}
- */
- function up(value) {
- update(value);
- run();
- }
- /**
- * @param {!Object} e
- * @return {undefined}
- */
- function view(e) {
- var connectNumber = ajax();
- /** @type {number} */
- var timeSubmittedDiff = connectNumber - concurency;
- if (!(10 > timeSubmittedDiff)) {
- var xy = _this.getPos(e);
- /** @type {number} */
- var lightI = s[0] - xy[0];
- /** @type {number} */
- var lightJ = s[1] - xy[1];
- /** @type {number} */
- lightI = lightI * lightI + lightJ * lightJ;
- if (!(0 >= lightI || 16 > lightI && 100 > timeSubmittedDiff || 20 > timeSubmittedDiff && 256 > lightI)) {
- concurency = connectNumber;
- s = xy;
- update(e);
- }
- }
- }
- /**
- * @return {undefined}
- */
- function remove() {
- var newDeriv = util.getDocumentScroll();
- var connectNumber = ajax();
- if (!(10 > connectNumber - currentNumber || 10 > Math.abs(newDeriv[0] - deriv[0]) && 10 > Math.abs(newDeriv[1] - deriv[1]))) {
- currentNumber = connectNumber;
- deriv = newDeriv;
- replace(c, [push(), newDeriv]);
- }
- }
- /**
- * @param {!Object} el
- * @return {undefined}
- */
- function move(el) {
- if (el = _this.getTarget(el)) {
- /** @type {number} */
- var src = Math.random();
- /** @type {!Array} */
- var count = [el.scrollLeft, el.scrollTop];
- if (el.localId) {
- if (src = cache[el.localId], !src || 10 > Math.abs(count[0] - src[0]) && 10 > Math.abs(count[1] - src[1])) {
- return;
- }
- } else {
- for (; cache[src];) {
- /** @type {number} */
- src = Math.random();
- }
- /** @type {number} */
- el.localId = src;
- }
- /** @type {!Array} */
- cache[el.localId] = count;
- if (el !== document) {
- callback(el);
- replace(F, [push(), count, el]);
- }
- }
- }
- /**
- * @return {undefined}
- */
- function wrap() {
- replace(api, [push(), util.getViewportSize(), util.getDocumentSize()]);
- }
- /**
- * @return {undefined}
- */
- function ctx() {
- replace(cc, [], true);
- }
- /**
- * @param {!Object} event
- * @return {?}
- */
- function switchKey(event) {
- return (event.shiftKey ? 2 : 0) | (event.ctrlKey ? 4 : 0) | (event.altKey ? 1 : 0) | (event.metaKey ? 8 : 0) | (event.ctrlKey || event.altKey ? 16 : 0);
- }
- /**
- * @param {!Object} data
- * @return {?}
- */
- function setData(data) {
- return "INPUT" == data.tagName ? "password" == data.type || data.name && assert.test(data.name) || data.id && assert.test(data.id) : false;
- }
- /**
- * @param {!Object} options
- * @return {?}
- */
- function get(options) {
- if (!options) {
- return {
- ignore : true,
- forceRecord : false,
- isPrivate : false,
- privateFlag : false,
- recordData : true
- };
- }
- /** @type {boolean} */
- var useUTF8ForComment = "password" === options.type || assert.test(options.name) || assert.test(options.id);
- var useUTF8ForFileName = _.reduce(function(b, name) {
- return b || Y_Node.generalRegex.test(options[name]);
- }, false, ["className", "id", "name"]) || Y_Node.placeholderRegex.test(options.placeholder);
- var useCustomEncoding = Y_Node.forceRecordRegex.test(options.className);
- return {
- forceRecord : useCustomEncoding,
- ignore : useUTF8ForComment,
- isPrivate : useUTF8ForFileName,
- privateFlag : !useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment),
- recordData : useCustomEncoding || !(useUTF8ForFileName && config.get("isEU") || useUTF8ForComment)
- };
- }
- /**
- * @param {!Object} name
- * @param {?} count
- * @param {number} bbox
- * @return {undefined}
- */
- function show(name, count, bbox) {
- name = _this.getTarget(name);
- var prop = get(name);
- if (!(prop.ignore || !prop.forceRecord && (prop.isPrivate && config.get("isEU") || extend(name)))) {
- callback(name);
- replace(A, [push(), count, bbox, name, prop.privateFlag]);
- }
- }
- /**
- * @param {!Object} event
- * @return {undefined}
- */
- function handle(event) {
- var e = event.keyCode;
- var nCharCode = switchKey(event);
- if ({
- 3 : 1,
- 8 : 1,
- 9 : 1,
- 13 : 1,
- 16 : 1,
- 17 : 1,
- 18 : 1,
- 19 : 1,
- 20 : 1,
- 27 : 1,
- 33 : 1,
- 34 : 1,
- 35 : 1,
- 36 : 1,
- 37 : 1,
- 38 : 1,
- 39 : 1,
- 40 : 1,
- 45 : 1,
- 46 : 1,
- 91 : 1,
- 92 : 1,
- 93 : 1,
- 106 : 1,
- 110 : 1,
- 111 : 1,
- 144 : 1,
- 145 : 1
- }[e] || 112 <= e && 123 >= e || 96 <= e && 105 >= e || nCharCode & 16) {
- if (19 == e && 4 == (nCharCode & -17)) {
- /** @type {number} */
- e = 144;
- }
- show(event, e, nCharCode | 16);
- /** @type {boolean} */
- selfCompletionActive = false;
- _.setTimeout(function() {
- /** @type {boolean} */
- selfCompletionActive = true;
- }, 1, "wvl.keyDown");
- if (!(!(67 == e && nCharCode & 4) || nCharCode & 1 || nCharCode & 2)) {
- open();
- }
- }
- }
- /**
- * @param {!Object} event
- * @return {undefined}
- */
- function listener(event) {
- if (selfCompletionActive && !alreadyMarked && 0 !== event.which) {
- show(event, event.charCode || event.keyCode, switchKey(event));
- /** @type {boolean} */
- alreadyMarked = true;
- _.setTimeout(function() {
- /** @type {boolean} */
- alreadyMarked = false;
- }, 1, "vwl.keyPress");
- }
- }
- /**
- * @return {undefined}
- */
- function run() {
- if (window.getSelection) {
- try {
- /** @type {(Selection|null)} */
- var e = window.getSelection();
- } catch (yb) {
- return;
- }
- /** @type {string} */
- var b = e.toString();
- /** @type {(Node|null)} */
- var target = e.anchorNode;
- } else {
- if (document.selection && document.selection.createRange) {
- /** @type {(ControlRange|TextRange|null)} */
- e = document.selection.createRange();
- /** @type {string} */
- b = e.text;
- /** @type {(Element|null)} */
- target = e.parentElement();
- }
- }
- if ("string" == typeof b) {
- try {
- for (; target && 1 != target.nodeType;) {
- /** @type {(Node|null)} */
- target = target.parentNode;
- }
- } catch (yb) {
- return;
- }
- if (target) {
- e = get(target).privateFlag || extend(target, true);
- target = target.getElementsByTagName("*");
- /** @type {number} */
- var i = 0;
- for (; i < target.length && !e;) {
- e = get(target[i]).privateFlag || extend(target[i], true);
- i++;
- }
- if (b != button) {
- /** @type {string} */
- button = b;
- b = e ? _.map(function() {
- return Y_Node.obfuscatedSymbol;
- }, b.split("")).join("") : b;
- replace(L, [push(), b]);
- }
- }
- }
- }
- /**
- * @return {undefined}
- */
- function open() {
- if (!R) {
- /** @type {boolean} */
- R = true;
- if (button) {
- replace(E, [push()]);
- }
- _.setTimeout(function() {
- /** @type {boolean} */
- R = false;
- }, 1, "wvl.copy");
- }
- }
- /**
- * @return {undefined}
- */
- function scope() {
- if (!fetchDuration) {
- /** @type {boolean} */
- fetchDuration = true;
- replace(array, [push()]);
- }
- }
- /**
- * @return {undefined}
- */
- function hide() {
- if (fetchDuration) {
- /** @type {boolean} */
- fetchDuration = false;
- replace(H, [push()]);
- }
- }
- /**
- * @param {!Object} event
- * @return {undefined}
- */
- function handler(event) {
- if (!fetchDuration || event && !event.fromElement) {
- scope();
- }
- }
- /**
- * @param {!Object} event
- * @return {undefined}
- */
- function hover(event) {
- if (event && !event.toElement) {
- hide();
- }
- }
- /**
- * @param {!Object} e
- * @return {undefined}
- */
- function add(e) {
- if ((e = _this.getTarget(e)) && /^INPUT|SELECT|TEXTAREA|BUTTON$/.test(e.tagName)) {
- if (e[j]) {
- callback(e);
- } else {
- var data = e.form;
- if (data) {
- data = data.elements;
- var tldCount = data.length;
- /** @type {number} */
- var i = 0;
- for (; i < tldCount; i++) {
- if (/^INPUT|SELECT|TEXTAREA|BUTTON$/.test(data[i].tagName) && !data[i][j]) {
- callback(data[i]);
- }
- }
- } else {
- callback(e);
- }
- }
- replace(y, [push(), e]);
- }
- }
- /**
- * @param {!Object} e
- * @return {undefined}
- */
- function onResize(e) {
- if ((e = _this.getTarget(e)) && /^INPUT|SELECT|TEXTAREA|BUTTON$/.test(e.tagName)) {
- callback(e);
- replace(K, [push(), e]);
- }
- }
- /**
- * @param {!Object} element
- * @return {undefined}
- */
- function onClick(element) {
- if ((element = _this.getTarget(element)) && !setData(element) && !extend(element) && /^INPUT|SELECT|TEXTAREA$/.test(element.tagName)) {
- var options = get(element);
- var min = /^(checkbox|radio)$/.test(element.type) ? element.checked : element.value;
- min = options.recordData ? min : _.map(function() {
- return Y_Node.obfuscatedSymbol;
- }, min.split("")).join("");
- callback(element);
- replace(init, [push(), element, min, options.privateFlag]);
- }
- }
- /**
- * @param {!Object} target
- * @return {undefined}
- */
- function change(target) {
- if ((target = _this.getTarget(target)) && !on(target) && "FORM" == target.nodeName) {
- var elements = target.elements;
- /** @type {number} */
- var i = 0;
- for (; i < elements.length; i++) {
- if (!util.isEmptyField(elements[i])) {
- callback(elements[i]);
- }
- }
- replace(thumb_click, [push(), target], true);
- }
- }
- /**
- * @param {!Object} e
- * @return {undefined}
- */
- function start(e) {
- remove();
- if (e.touches && e.touches.length) {
- var cur = _this.getTarget(e);
- if (cur && cur != document) {
- callback(cur);
- /** @type {number} */
- var i = 0;
- for (; i < e.touches.length; i++) {
- replace(constructor, [push(), "touch", cur, [e.touches[i].pageX, e.touches[i].pageY], 0, 0]);
- }
- }
- }
- }
- /**
- * @param {!Object} e
- * @return {undefined}
- */
- function fn(e) {
- var b = _this.getTarget(e);
- if (b) {
- var c;
- if ("wheel" == e.type) {
- /** @type {number} */
- c = 0 < e.deltaY ? 1 : 0 > e.deltaY ? 2 : 0;
- } else {
- if ("mousewheel" == e.type) {
- /** @type {number} */
- c = 0 < e.wheelDelta ? 2 : 0 > e.wheelDelta ? 1 : 0;
- }
- }
- if (c) {
- callback(b);
- replace(value, [push(), b, _this.getPos(e), c]);
- }
- }
- }
- /**
- * @param {!Object} params
- * @return {undefined}
- */
- function f(params) {
- if ((params = _this.getTarget(params)) && "BODY" == params.tagName) {
- model.append([], true);
- }
- }
- var model = new Model({
- protocol : p,
- globalConfig : config,
- counterId : record,
- counterType : e,
- meta : {
- url : parse().href,
- hitId : d,
- timezone : offset,
- timestamp : date
- }
- });
- var lb = util.getBody();
- var typeMap = {
- A : 1,
- ABBR : 2,
- ACRONYM : 3,
- ADDRESS : 4,
- APPLET : 5,
- AREA : 6,
- B : 7,
- BASE : 8,
- BASEFONT : 9,
- BDO : 10,
- BIG : 11,
- BLOCKQUOTE : 12,
- BODY : 13,
- BR : 14,
- BUTTON : 15,
- CAPTION : 16,
- CENTER : 17,
- CITE : 18,
- CODE : 19,
- COL : 20,
- COLGROUP : 21,
- DD : 22,
- DEL : 23,
- DFN : 24,
- DIR : 25,
- DIV : 26,
- DL : 27,
- DT : 28,
- EM : 29,
- FIELDSET : 30,
- FONT : 31,
- FORM : 32,
- FRAME : 33,
- FRAMESET : 34,
- H1 : 35,
- H2 : 36,
- H3 : 37,
- H4 : 38,
- H5 : 39,
- H6 : 40,
- HEAD : 41,
- HR : 42,
- HTML : 43,
- I : 44,
- IFRAME : 45,
- IMG : 46,
- INPUT : 47,
- INS : 48,
- ISINDEX : 49,
- KBD : 50,
- LABEL : 51,
- LEGEND : 52,
- LI : 53,
- LINK : 54,
- MAP : 55,
- MENU : 56,
- META : 57,
- NOFRAMES : 58,
- NOSCRIPT : 59,
- OBJECT : 60,
- OL : 61,
- OPTGROUP : 62,
- OPTION : 63,
- P : 64,
- PARAM : 65,
- PRE : 66,
- Q : 67,
- S : 68,
- SAMP : 69,
- SCRIPT : 70,
- SELECT : 71,
- SMALL : 72,
- SPAN : 73,
- STRIKE : 74,
- STRONG : 75,
- STYLE : 76,
- SUB : 77,
- SUP : 78,
- TABLE : 79,
- TBODY : 80,
- TD : 81,
- TEXTAREA : 82,
- TFOOT : 83,
- TH : 84,
- THEAD : 85,
- TITLE : 86,
- TR : 87,
- TT : 88,
- U : 89,
- UL : 90,
- VAR : 91,
- NOINDEX : 100
- };
- var Y_Node = function() {
- /** @type {!Array<string>} */
- var sortedFolderIds = "first(-|\\.|_|\\s){0,2}name last(-|\\.|_|\\s){0,2}name zip postal phone address passport (bank|credit)(-|\\.|_|\\s){0,2}card card(-|\\.|_|\\s){0,2}number card(-|\\.|_|\\s){0,2}holder cvv card(-|\\.|_|\\s){0,2}exp card(-|\\.|_|\\s){0,2}name card.*month card.*year card.*month card.*year password email birth(-|\\.|_|\\s){0,2}(day|date) second(-|\\.|_|\\s){0,2}name third(-|\\.|_|\\s){0,2}name patronymic middle(-|\\.|_|\\s){0,2}name birth(-|\\.|_|\\s){0,2}place house street city flat state".split(" ");
- return {
- generalRegex : new RegExp("(" + sortedFolderIds.join("|") + ")", "i"),
- placeholderRegex : new RegExp("(" + sortedFolderIds.concat("\u0438\u043c\u044f;\u0444\u0430\u043c\u0438\u043b\u0438\u044f;\u043e\u0442\u0447\u0435\u0441\u0442\u0432\u043e;\u0438\u043d\u0434\u0435\u043a\u0441;\u0442\u0435\u043b\u0435\u0444\u043e\u043d;\u0430\u0434\u0440\u0435\u0441;\u043f\u0430\u0441\u043f\u043e\u0440\u0442;\u041d\u043e\u043c\u0435\u0440(-|\\.|_|\\s){0,2}\u043a\u0430\u0440\u0442\u044b;\u0434\u0430\u0442\u0430(-|\\.|_|\\s){0,2} \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f;\u0434\u043e\u043c;\u0443\u043b\u0438\u0446\u0430;\u043a\u0432\u0430\u0440\u0442\u0438\u0440\u0430;\u0433\u043e\u0440\u043e\u0434;\u043e\u0431\u043b\u0430\u0441\u0442\u044c".split(";")).join("|") +
- ")", "i"),
- forceRecordRegex : /ym-record-keys/i,
- obfuscatedSymbol : String.fromCharCode(8226),
- obfuscatedKeyCode : 88
- };
- }();
- /** @type {number} */
- var fullPath = 0;
- /** @type {number} */
- var best_part_step_diff = 0;
- find(0);
- /** @type {number} */
- var i = 1;
- /** @type {number} */
- var concurency = 0;
- /** @type {!Array} */
- var s = [0, 0];
- /** @type {number} */
- var currentNumber = 0;
- /** @type {!Array} */
- var deriv = [0, 0];
- var cache = {};
- /** @type {!RegExp} */
- var assert = /^(password|passwd|pswd)$/;
- /** @type {boolean} */
- var selfCompletionActive = true;
- /** @type {boolean} */
- var alreadyMarked = false;
- /** @type {string} */
- var button = "";
- /** @type {boolean} */
- var R = false;
- /** @type {boolean} */
- var fetchDuration = true;
- var request = ajax();
- /** @type {string} */
- var j = "metrikaId_" + Math.random();
- var json = {};
- /** @type {string} */
- var name = ":submit" + Math.random();
- if (!_.isMetrikaPlayer()) {
- self.on(document, "mousemove", view);
- self.on(document, "click,dblclick,mousedown", update);
- self.on(document, "mouseup", up);
- self.on(window, "scroll", remove);
- if ("onmousewheel" in document) {
- self.on(document, "mousewheel", fn);
- } else {
- self.on(document, "wheel", fn);
- }
- self.on(window, "beforeunload", ctx);
- if (!Cb) {
- self.on(window, "unload", ctx);
- }
- self.on(window, "resize", wrap);
- self.on(document, "keydown", handle);
- self.on(document, "keypress", listener);
- self.on(document, "copy", open);
- self.on(document, "touchmove,touchstart", start);
- if (lb) {
- self.on(document, "mouseleave", f);
- }
- if (document.attachEvent && !window.opera) {
- self.on(document, "focusin", handler);
- self.on(document, "focusout", hover);
- } else {
- self.on(window, "focus", scope);
- self.on(window, "blur", hide);
- self.on(document, "blur", hide);
- }
- if (document.addEventListener) {
- self.on(document, "scroll", move);
- self.on(document, "focus", add);
- self.on(document, "blur", onResize);
- self.on(document, "change", onClick);
- self.on(document, "submit", change);
- } else {
- if (document.attachEvent) {
- self.on(document, "focusin", add);
- self.on(document, "focusout", onResize);
- (function() {
- /** @type {!NodeList<Element>} */
- var data = document.getElementsByTagName("form");
- /** @type {number} */
- var i = 0;
- for (; i < data.length; i++) {
- /** @type {!NodeList<Element>} */
- var a = data[i].getElementsByTagName("*");
- /** @type {number} */
- var e = 0;
- for (; e < a.length; e++) {
- if (/^INPUT|SELECT|TEXTAREA$/.test(a[e].tagName)) {
- self.on(a[e], "change", onClick);
- }
- }
- self.on(data[i], "submit", change);
- }
- })();
- }
- }
- (function() {
- /** @type {!NodeList<Element>} */
- var form = document.getElementsByTagName("form");
- if (form.length) {
- /** @type {number} */
- var i = 0;
- for (; i < form.length; i++) {
- var url = form[i].submit;
- if ("function" === typeof url || "object" === typeof url && /^\s*function submit\(\)/.test(String(url))) {
- form[i][name] = url;
- /**
- * @return {?}
- */
- form[i].submit = function() {
- change({
- target : this
- });
- return this[name]();
- };
- }
- }
- }
- })();
- if ("0:0" !== util.getDocumentScroll().join(":")) {
- remove();
- }
- wrap();
- }
- return {
- start : function() {
- model.activate();
- },
- stop : function() {
- model.clear();
- self.un(document, "mousemove", view);
- self.un(document, "click", update);
- self.un(document, "dblclick", update);
- self.un(document, "mousedown", update);
- self.un(document, "mouseup", up);
- self.un(document, "mousewheel", fn);
- self.un(document, "wheel", fn);
- self.un(window, "scroll", remove);
- self.un(window, "beforeunload", ctx);
- self.un(window, "unload", ctx);
- self.un(window, "resize", wrap);
- self.un(document, "keydown", handle);
- self.un(document, "keypress", listener);
- self.un(document, "copy", open);
- self.un(document, "touchmove", start);
- self.un(document, "touchstart", start);
- if (lb) {
- self.un(document, "mouseleave", f);
- }
- self.un(document, "focusin", handler);
- self.un(document, "focusout", hover);
- self.un(window, "focus", scope);
- self.un(window, "blur", hide);
- self.un(document, "blur", hide);
- if (document.removeEventListener) {
- self.un(document, "scroll", move);
- self.un(document, "focus", add);
- self.un(document, "blur", onResize);
- self.un(document, "change", onClick);
- self.un(document, "submit", change);
- } else {
- if (document.detachEvent) {
- self.un(document, "focusin", add);
- self.un(document, "focusout", onResize);
- (function() {
- /** @type {!NodeList<Element>} */
- var remotes = document.getElementsByTagName("form");
- /** @type {number} */
- var i = 0;
- for (; i < remotes.length; i++) {
- /** @type {!NodeList<Element>} */
- var lsUDSNamesArr = remotes[i].getElementsByTagName("*");
- /** @type {number} */
- var n = 0;
- for (; n < lsUDSNamesArr.length; n++) {
- if (/^INPUT|SELECT|TEXTAREA$/.test(lsUDSNamesArr[n].tagName)) {
- self.un(lsUDSNamesArr[n], "change", onClick);
- }
- }
- self.un(remotes[i], "submit", change);
- }
- })();
- }
- }
- (function() {
- /** @type {!NodeList<Element>} */
- var form = document.getElementsByTagName("form");
- /** @type {number} */
- var i = 0;
- for (; i < form.length; i++) {
- if (form[i][name]) {
- form[i].submit = form[i][name];
- }
- }
- })();
- },
- uploadPages : function(size, page) {
- /**
- * @return {undefined}
- */
- function fn() {
- self.un(document, "DOMContentLoaded", fn);
- self.un(window, "load", fn);
- var hhmmssArr = size.split(/\n/);
- var n = parse().href;
- /** @type {!RegExp} */
- var query = /regexp:/;
- /** @type {number} */
- var i = 0;
- for (; i < hhmmssArr.length; i++) {
- var t = hhmmssArr[i];
- if (t) {
- if (query.test(t)) {
- t = callback(t.replace(query, ""));
- try {
- /** @type {!RegExp} */
- var text = new RegExp(t);
- } catch (Zb) {
- }
- if (text && text.test(n)) {
- ossService.uploadPage(page);
- break;
- }
- } else {
- if (-1 !== n.indexOf(t)) {
- ossService.uploadPage(page);
- break;
- }
- }
- }
- }
- }
- var ossService = this;
- if ("complete" === document.readyState) {
- fn();
- } else {
- self.on(document, "DOMContentLoaded", fn);
- self.on(window, "load", fn);
- }
- },
- uploadPage : require(function(exp) {
- if ("function" === typeof window.toStaticHTML && -1 < window.toStaticHTML.toString().indexOf("NoScript")) {
- return false;
- }
- /** @type {!Element} */
- var dialog = document.documentElement;
- if (dialog && 19E4 < ("" + dialog.innerHTML).length) {
- return false;
- }
- var req = window.XMLHttpRequest ? new window.XMLHttpRequest : new ActiveXObject("Msxml2.XMLHTTP");
- var user = util.getDocumentCharset();
- /** @type {string} */
- var mime = "text/html" + (user ? ";charset=" + user : "");
- var console = new ConsoleController({
- protocol : p,
- counterId : record,
- counterType : e
- });
- if ("html" === exp) {
- return exp = new RegExp("<script [^>]*?//" + options.host.replace(/\./g, "\\\\.") + "/watch/.*?\x3c/script>", "gi"), console.sendContent(util.getDocumentHTML().replace(exp, ""), mime, d, offset, date), true;
- }
- if (req) {
- req.open("get", parse().href, true);
- req.onreadystatechange = require(function() {
- if (4 === req.readyState) {
- var ext = req.getResponseHeader("content-type") || "";
- if (user && -1 === ext.indexOf("charset=")) {
- /** @type {string} */
- ext = mime;
- }
- console.sendContent(req.responseText, ext, d, offset, date);
- }
- }, "updatePage.1");
- if (req.overrideMimeType && user) {
- req.overrideMimeType(mime);
- }
- req.send(null);
- }
- return true;
- }, "uploadPage")
- };
- }
- /**
- * @return {?}
- */
- function parse() {
- var aliases = {};
- /** @type {!Array<string>} */
- var names = "hash host hostname href pathname port protocol search".split(" ");
- /** @type {number} */
- var len = names.length;
- /** @type {number} */
- var i = len;
- var a;
- var key;
- for (; i--;) {
- /** @type {string} */
- aliases[names[i]] = "";
- }
- try {
- /** @type {!Location} */
- a = window.location;
- /** @type {number} */
- i = len;
- for (; i--;) {
- /** @type {string} */
- key = names[i];
- aliases[key] = "" + a[key];
- }
- } catch (h) {
- if (result) {
- aliases = result;
- }
- }
- return aliases;
- }
- /**
- * @param {string} stdout
- * @return {?}
- */
- function callback(stdout) {
- return stdout ? ("" + stdout).replace(/^\s+/, "").replace(/\s+$/, "") : "";
- }
- /**
- * @return {?}
- */
- function runDouban() {
- return 0 == parse().hostname.search(/^(.*.)?((yandex(-team)?).(com?.)?[a-z]+|(auto|kinopoisk|beru).ru|ya.(ru|cc)|yadi.sk|yastatic.net|.*.yandex)$/);
- }
- /**
- * @param {!Object} uri
- * @return {?}
- */
- function split(uri) {
- return -1 !== ("" + window.navigator.userAgent).toLowerCase().search(uri);
- }
- /**
- * @param {!Object} body
- * @return {?}
- */
- function getUrl(body) {
- return callback(body && body.innerHTML && body.innerHTML.replace(/<\/?[^>]+>/gi, ""));
- }
- /**
- * @param {string} a
- * @param {!Array} b
- * @return {?}
- */
- function filter(a, b) {
- var i;
- if (!a || !b) {
- return false;
- }
- /** @type {!Array} */
- var drilldownLevelLabels = [];
- /** @type {number} */
- i = 0;
- for (; i < b.length; i++) {
- drilldownLevelLabels.push(b[i].replace(/\^/g, "\\^").replace(/\$/g, "\\$").replace(/\./g, "\\.").replace(/\[/g, "\\[").replace(/\]/g, "\\]").replace(/\|/g, "\\|").replace(/\(/g, "\\(").replace(/\)/g, "\\)").replace(/\?/g, "\\?").replace(/\*/g, "\\*").replace(/\+/g, "\\+").replace(/\{/g, "\\{").replace(/\}/g, "\\}"));
- }
- return (new RegExp("\\.(" + drilldownLevelLabels.join("|") + ")$", "i")).test(a);
- }
- /**
- * @param {!Object} e
- * @return {?}
- */
- function check(e) {
- e = e.target || e.srcElement;
- var undefined;
- if (!e) {
- return false;
- }
- if (3 == e.nodeType) {
- e = e.parentNode;
- }
- undefined = e && e.nodeName && e.nodeName.toString().toLowerCase();
- for (; e && e.parentNode && e.parentNode.nodeName && ("a" != undefined && "area" != undefined || !e.href);) {
- undefined = (e = e.parentNode) && e.nodeName && e.nodeName.toString().toLowerCase();
- }
- return e.href ? e : false;
- }
- /**
- * @param {string} str
- * @param {string} label
- * @return {?}
- */
- function get(str, label) {
- return (str ? str.replace(/^www\./, "") : "").toLowerCase() == (label ? label.replace(/^www\./, "") : "").toLowerCase();
- }
- /**
- * @param {string} a
- * @param {string} b
- * @return {?}
- */
- function cb(a, b) {
- /**
- * @param {string} code
- * @return {?}
- */
- function hash(code) {
- code = code.split(":");
- code = code[1] || "";
- code = code.replace(/^\/*/, "").replace(/^www\./, "");
- return code.split("/")[0];
- }
- return a && b ? hash(a) == hash(b) : a || b ? false : true;
- }
- /**
- * @return {?}
- */
- function getPerformaceInfo() {
- /** @type {!Performance} */
- var p = window.performance || window.webkitPerformance;
- /** @type {(PerformanceTiming|null)} */
- var t = p && p.timing;
- var start;
- /** @type {!Array} */
- var plevels = [];
- if (t && (start = t.navigationStart)) {
- /** @type {!Array} */
- plevels = [t.domainLookupEnd - t.domainLookupStart, t.connectEnd - t.connectStart, t.responseStart - t.requestStart, t.responseEnd - t.responseStart, t.fetchStart - start, t.redirectEnd - t.redirectStart, t.redirectCount || p.navigation && p.navigation.redirectCount];
- plevels.push(t.domInteractive && t.domLoading ? t.domInteractive - t.domLoading : null);
- plevels.push(t.domContentLoadedEventStart && t.domContentLoadedEventEnd ? t.domContentLoadedEventEnd - t.domContentLoadedEventStart : null);
- plevels.push(t.domComplete ? t.domComplete - start : null);
- plevels.push(t.loadEventStart ? t.loadEventStart - start : null);
- plevels.push(t.loadEventStart && t.loadEventEnd ? t.loadEventEnd - t.loadEventStart : null);
- plevels.push(t.domContentLoadedEventStart ? t.domContentLoadedEventStart - start : null);
- /** @type {number} */
- p = 0;
- for (; p < plevels.length; p++) {
- t = plevels[p];
- if (null !== t && (0 > t || 36E5 < t)) {
- /** @type {null} */
- plevels[p] = null;
- }
- }
- }
- return plevels;
- }
- /**
- * @param {?} el
- * @return {?}
- */
- function assign(el) {
- /** @type {!Array} */
- var buffer = [];
- var string = el._lastPerformanceTiming;
- var word = getPerformaceInfo();
- var strLen;
- if (string) {
- /** @type {number} */
- var i = 0;
- strLen = string.length;
- for (; i < strLen; i++) {
- if (null === word[i]) {
- buffer.push(word[i]);
- } else {
- buffer.push(string[i] === word[i] ? "" : word[i]);
- }
- }
- } else {
- buffer = word;
- }
- el._lastPerformanceTiming = word;
- return buffer.join(",");
- }
- /**
- * @param {!Object} elems
- * @return {?}
- */
- function map(elems) {
- return "first-contentful-paint" === elems.name;
- }
- /**
- * @return {?}
- */
- function draw() {
- /** @type {function(this:Performance, string): !Array<PerformanceEntry>} */
- var typeIncluded = window.performance && window.performance.getEntriesByType;
- var t = typeIncluded ? _.filter(map, window.performance.getEntriesByType("paint")) : [];
- if (t.length) {
- return t = t[0], Math.round(t.startTime);
- }
- if (typeIncluded) {
- return 0;
- }
- if ("object" == typeof window.chrome && window.chrome.loadTimes) {
- if (t = window.chrome.loadTimes(), t.requestTime && t.firstPaintTime && window.performance && window.performance.timing) {
- return Math.round(1E3 * t.firstPaintTime - window.performance.timing.navigationStart);
- }
- } else {
- if (window.performance && window.performance.timing && (t = window.performance.timing, t.navigationStart && t.msFirstPaint)) {
- return t.msFirstPaint - t.navigationStart;
- }
- }
- return null;
- }
- /** @type {boolean} */
- var data = false;
- try {
- var debounceDelay = function(d) {
- /**
- * @param {number} name
- * @return {?}
- */
- function exports(name) {
- if (Functions[name]) {
- return Functions[name].f;
- }
- var q = Functions[name] = {
- H : name,
- L : false,
- f : {}
- };
- d[name].call(q.f, q, q.f, exports);
- /** @type {boolean} */
- q.L = true;
- return q.f;
- }
- var Functions = {};
- /** @type {!Array} */
- exports.Z = d;
- exports.W = Functions;
- /**
- * @param {?} val
- * @return {?}
- */
- exports.H = function(val) {
- return val;
- };
- /**
- * @param {!Function} event
- * @param {!Function} fn
- * @return {undefined}
- */
- exports.B = function(event, fn) {
- if (!exports.C(event)) {
- Object.defineProperty(event, "a", {
- configurable : false,
- enumerable : true,
- get : fn
- });
- }
- };
- /**
- * @param {!Object} v
- * @return {?}
- */
- exports.X = function(v) {
- /** @type {function(): ?} */
- var op = v && v.a ? function() {
- return v["default"];
- } : function() {
- return v;
- };
- exports.B(op, op);
- return op;
- };
- /**
- * @param {!Function} obj
- * @return {?}
- */
- exports.C = function(obj) {
- return Object.prototype.hasOwnProperty.call(obj, "a");
- };
- /** @type {string} */
- exports.Y = "";
- return exports(exports.$ = 5);
- }([function(u, data) {
- /** @type {boolean} */
- data.a = true;
- u = function() {
- /**
- * @return {undefined}
- */
- function k() {
- this.m = window.ApplePaySession;
- }
- /**
- * @return {?}
- */
- k.prototype.g = function() {
- /** @type {boolean} */
- var txt = false;
- try {
- /** @type {boolean} */
- txt = window.self !== window.top;
- } catch (t) {
- }
- if (!this.m || "https:" !== result.protocol || txt) {
- return "";
- }
- /** @type {string} */
- txt = "";
- /** @type {number} */
- var value = 1;
- for (; 10 >= value; value++) {
- /** @type {string} */
- txt = txt + (this.m.supportsVersion(value) ? value : "0");
- }
- return txt + this.m.canMakePayments();
- };
- return k;
- }();
- /** @type {string} */
- data.u = u;
- }, function(value, color) {
- var c = this && this.V || function() {
- /** @type {function(!Object, ?): !Object} */
- var int64copy = Object.setPrototypeOf || {
- __proto__ : []
- } instanceof Array && function(d, b) {
- /** @type {!Object} */
- d.__proto__ = b;
- } || function(a, b) {
- var p;
- for (p in b) {
- if (b.hasOwnProperty(p)) {
- a[p] = b[p];
- }
- }
- };
- return function(d, b) {
- /**
- * @return {undefined}
- */
- function __() {
- /** @type {!Object} */
- this.constructor = d;
- }
- int64copy(d, b);
- d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __);
- };
- }();
- /** @type {boolean} */
- color.a = true;
- value = function() {
- /**
- * @param {!Array} object
- * @return {undefined}
- */
- function init(object) {
- /** @type {!Array} */
- this.D = object;
- /** @type {boolean} */
- this.h = true;
- /** @type {!Element} */
- this.canvas = document.createElement("canvas");
- if (!this.I()) {
- /** @type {boolean} */
- this.h = false;
- }
- }
- /**
- * @return {?}
- */
- init.prototype.I = function() {
- this.c = this.canvas.getContext(this.D);
- return !(!this.canvas.getContext || !this.c);
- };
- /**
- * @return {?}
- */
- init.prototype.g = function() {
- return this.h ? this.o() : this.id;
- };
- return init;
- }();
- var alpha = function(v) {
- /**
- * @return {?}
- */
- function e() {
- var t = v.call(this, "webgl") || this;
- if (t.h && !t.J()) {
- /** @type {boolean} */
- t.h = false;
- }
- return t;
- }
- c(e, v);
- /**
- * @return {?}
- */
- e.prototype.J = function() {
- var a = this.canvas.getContext && (this.canvas.getContext("webgl") || this.canvas.getContext("experimental-webgl"));
- return !!window.WebGLRenderingContext && !!a;
- };
- /**
- * @param {!Object} selector
- * @return {?}
- */
- e.prototype.j = function(selector) {
- var gl = this.c;
- gl.clearColor(0, 0, 0, 1);
- gl.enable(gl.DEPTH_TEST);
- gl.depthFunc(gl.LEQUAL);
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
- return "[" + selector[0] + ", " + selector[1] + "]";
- };
- /**
- * @param {!WebGLRenderingContext} gl
- * @return {?}
- */
- e.prototype.M = function(gl) {
- var anisotropy;
- var ext = gl.getExtension("EXT_texture_filter_anisotropic") || gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || gl.getExtension("MOZ_EXT_texture_filter_anisotropic");
- return ext ? (anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT), 0 === anisotropy && (anisotropy = 2), anisotropy) : null;
- };
- /**
- * @return {?}
- */
- e.prototype.o = function() {
- var gl = this.c;
- /** @type {!Array} */
- var drilldownLevelLabels = [];
- var glBuffer = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer);
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-.2, -.9, 0, .4, -.26, 0, 0, .732134444, 0]), gl.STATIC_DRAW);
- /** @type {number} */
- glBuffer.K = 3;
- /** @type {number} */
- glBuffer.O = 3;
- var program = gl.createProgram();
- var vertexShader = gl.createShader(gl.VERTEX_SHADER);
- gl.shaderSource(vertexShader, "attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}");
- gl.compileShader(vertexShader);
- var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
- gl.shaderSource(fragmentShader, "precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}");
- gl.compileShader(fragmentShader);
- gl.attachShader(program, vertexShader);
- gl.attachShader(program, fragmentShader);
- gl.linkProgram(program);
- gl.useProgram(program);
- program.R = gl.getAttribLocation(program, "attrVertex");
- program.P = gl.getUniformLocation(program, "uniformOffset");
- gl.enableVertexAttribArray(program.aa);
- gl.vertexAttribPointer(program.R, glBuffer.K, gl.FLOAT, false, 0, 0);
- gl.uniform2f(program.P, 1, 1);
- gl.drawArrays(gl.TRIANGLE_STRIP, 0, glBuffer.O);
- if (null != gl.canvas) {
- drilldownLevelLabels.push(gl.canvas.toDataURL());
- }
- drilldownLevelLabels.push("extensions:" + gl.getSupportedExtensions().join(";"));
- drilldownLevelLabels.push("webgl aliased line width range:" + this.j(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE)));
- drilldownLevelLabels.push("webgl aliased point size range:" + this.j(gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE)));
- drilldownLevelLabels.push("webgl alpha bits:" + gl.getParameter(gl.ALPHA_BITS));
- drilldownLevelLabels.push("webgl antialiasing:" + (gl.getContextAttributes().antialias ? "yes" : "no"));
- drilldownLevelLabels.push("webgl blue bits:" + gl.getParameter(gl.BLUE_BITS));
- drilldownLevelLabels.push("webgl depth bits:" + gl.getParameter(gl.DEPTH_BITS));
- drilldownLevelLabels.push("webgl green bits:" + gl.getParameter(gl.GREEN_BITS));
- drilldownLevelLabels.push("webgl max anisotropy:" + this.M(gl));
- drilldownLevelLabels.push("webgl max combined texture image units:" + gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS));
- drilldownLevelLabels.push("webgl max cube map texture size:" + gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE));
- drilldownLevelLabels.push("webgl max fragment uniform vectors:" + gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS));
- drilldownLevelLabels.push("webgl max render buffer size:" + gl.getParameter(gl.MAX_RENDERBUFFER_SIZE));
- drilldownLevelLabels.push("webgl max texture image units:" + gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS));
- drilldownLevelLabels.push("webgl max texture size:" + gl.getParameter(gl.MAX_TEXTURE_SIZE));
- drilldownLevelLabels.push("webgl max varying vectors:" + gl.getParameter(gl.MAX_VARYING_VECTORS));
- drilldownLevelLabels.push("webgl max vertex attribs:" + gl.getParameter(gl.MAX_VERTEX_ATTRIBS));
- drilldownLevelLabels.push("webgl max vertex texture image units:" + gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS));
- drilldownLevelLabels.push("webgl max vertex uniform vectors:" + gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS));
- drilldownLevelLabels.push("webgl max viewport dims:" + this.j(gl.getParameter(gl.MAX_VIEWPORT_DIMS)));
- drilldownLevelLabels.push("webgl red bits:" + gl.getParameter(gl.RED_BITS));
- drilldownLevelLabels.push("webgl renderer:" + gl.getParameter(gl.RENDERER));
- drilldownLevelLabels.push("webgl shading language version:" + gl.getParameter(gl.SHADING_LANGUAGE_VERSION));
- drilldownLevelLabels.push("webgl stencil bits:" + gl.getParameter(gl.STENCIL_BITS));
- drilldownLevelLabels.push("webgl vendor:" + gl.getParameter(gl.VENDOR));
- drilldownLevelLabels.push("webgl version:" + gl.getParameter(gl.VERSION));
- try {
- var extensionDebugRendererInfo = gl.getExtension("WEBGL_debug_renderer_info");
- if (extensionDebugRendererInfo) {
- drilldownLevelLabels.push("webgl unmasked vendor:" + gl.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL));
- drilldownLevelLabels.push("webgl unmasked renderer:" + gl.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL));
- }
- } catch (Y) {
- }
- if (!gl.getShaderPrecisionFormat) {
- return drilldownLevelLabels.join("~");
- }
- drilldownLevelLabels.push("webgl vertex shader high float precision:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision);
- drilldownLevelLabels.push("webgl vertex shader high float precision rangeMin:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).rangeMin);
- drilldownLevelLabels.push("webgl vertex shader high float precision rangeMax:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).rangeMax);
- drilldownLevelLabels.push("webgl vertex shader medium float precision:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision);
- drilldownLevelLabels.push("webgl vertex shader medium float precision rangeMin:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).rangeMin);
- drilldownLevelLabels.push("webgl vertex shader medium float precision rangeMax:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).rangeMax);
- drilldownLevelLabels.push("webgl vertex shader low float precision:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_FLOAT).precision);
- drilldownLevelLabels.push("webgl vertex shader low float precision rangeMin:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_FLOAT).rangeMin);
- drilldownLevelLabels.push("webgl vertex shader low float precision rangeMax:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_FLOAT).rangeMax);
- drilldownLevelLabels.push("webgl fragment shader high float precision:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision);
- drilldownLevelLabels.push("webgl fragment shader high float precision rangeMin:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).rangeMin);
- drilldownLevelLabels.push("webgl fragment shader high float precision rangeMax:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).rangeMax);
- drilldownLevelLabels.push("webgl fragment shader medium float precision:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision);
- drilldownLevelLabels.push("webgl fragment shader medium float precision rangeMin:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).rangeMin);
- drilldownLevelLabels.push("webgl fragment shader medium float precision rangeMax:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).rangeMax);
- drilldownLevelLabels.push("webgl fragment shader low float precision:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_FLOAT).precision);
- drilldownLevelLabels.push("webgl fragment shader low float precision rangeMin:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_FLOAT).rangeMin);
- drilldownLevelLabels.push("webgl fragment shader low float precision rangeMax:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_FLOAT).rangeMax);
- drilldownLevelLabels.push("webgl vertex shader high int precision:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_INT).precision);
- drilldownLevelLabels.push("webgl vertex shader high int precision rangeMin:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_INT).rangeMin);
- drilldownLevelLabels.push("webgl vertex shader high int precision rangeMax:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_INT).rangeMax);
- drilldownLevelLabels.push("webgl vertex shader medium int precision:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_INT).precision);
- drilldownLevelLabels.push("webgl vertex shader medium int precision rangeMin:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_INT).rangeMin);
- drilldownLevelLabels.push("webgl vertex shader medium int precision rangeMax:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_INT).rangeMax);
- drilldownLevelLabels.push("webgl vertex shader low int precision:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_INT).precision);
- drilldownLevelLabels.push("webgl vertex shader low int precision rangeMin:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_INT).rangeMin);
- drilldownLevelLabels.push("webgl vertex shader low int precision rangeMax:" + gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_INT).rangeMax);
- drilldownLevelLabels.push("webgl fragment shader high int precision:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_INT).precision);
- drilldownLevelLabels.push("webgl fragment shader high int precision rangeMin:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_INT).rangeMin);
- drilldownLevelLabels.push("webgl fragment shader high int precision rangeMax:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_INT).rangeMax);
- drilldownLevelLabels.push("webgl fragment shader medium int precision:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_INT).precision);
- drilldownLevelLabels.push("webgl fragment shader medium int precision rangeMin:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_INT).rangeMin);
- drilldownLevelLabels.push("webgl fragment shader medium int precision rangeMax:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_INT).rangeMax);
- drilldownLevelLabels.push("webgl fragment shader low int precision:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_INT).precision);
- drilldownLevelLabels.push("webgl fragment shader low int precision rangeMin:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_INT).rangeMin);
- drilldownLevelLabels.push("webgl fragment shader low int precision rangeMax:" + gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.LOW_INT).rangeMax);
- return drilldownLevelLabels.join("~");
- };
- return e;
- }(value);
- color.A = alpha;
- value = function(v) {
- /**
- * @return {?}
- */
- function m() {
- return v.call(this, "2d") || this;
- }
- c(m, v);
- /**
- * @return {?}
- */
- m.prototype.o = function() {
- var canvas = this.canvas;
- var ctx = this.c;
- /** @type {!Array} */
- var drilldownLevelLabels = [];
- /** @type {number} */
- canvas.width = 2E3;
- /** @type {number} */
- canvas.height = 200;
- /** @type {string} */
- canvas.style.display = "inline";
- ctx.rect(0, 0, 10, 10);
- ctx.rect(2, 2, 6, 6);
- drilldownLevelLabels.push("canvas winding:" + (false === ctx.isPointInPath(5, 5, "evenodd") ? "yes" : "no"));
- /** @type {string} */
- ctx.textBaseline = "alphabetic";
- /** @type {string} */
- ctx.fillStyle = "#f60";
- ctx.fillRect(125, 1, 62, 20);
- /** @type {string} */
- ctx.fillStyle = "#069";
- /** @type {string} */
- ctx.font = "11pt Arial";
- ctx.fillText("Cwm fjordbank glyphs vext quiz, \ud83d\ude03", 2, 15);
- /** @type {string} */
- ctx.fillStyle = "rgba(102, 204, 0, 0.2)";
- /** @type {string} */
- ctx.font = "18pt Arial";
- ctx.fillText("Cwm fjordbank glyphs vext quiz, \ud83d\ude03", 4, 45);
- /** @type {string} */
- ctx.globalCompositeOperation = "multiply";
- /** @type {string} */
- ctx.fillStyle = "rgb(255,0,255)";
- ctx.beginPath();
- ctx.arc(50, 50, 50, 0, 2 * Math.PI, true);
- ctx.closePath();
- ctx.fill();
- /** @type {string} */
- ctx.fillStyle = "rgb(0,255,255)";
- ctx.beginPath();
- ctx.arc(100, 50, 50, 0, 2 * Math.PI, true);
- ctx.closePath();
- ctx.fill();
- /** @type {string} */
- ctx.fillStyle = "rgb(255,255,0)";
- ctx.beginPath();
- ctx.arc(75, 100, 50, 0, 2 * Math.PI, true);
- ctx.closePath();
- ctx.fill();
- /** @type {string} */
- ctx.fillStyle = "rgb(255,0,255)";
- ctx.arc(75, 75, 75, 0, 2 * Math.PI, true);
- ctx.arc(75, 75, 25, 0, 2 * Math.PI, true);
- ctx.fill("evenodd");
- drilldownLevelLabels.push("canvas fp:" + canvas.toDataURL());
- return drilldownLevelLabels.join("~");
- };
- return m;
- }(value);
- /** @type {!Array} */
- color.S = value;
- }, function(max, value) {
- /** @type {boolean} */
- value.a = true;
- max = function() {
- /**
- * @return {undefined}
- */
- function bar() {
- /** @type {!Navigator} */
- this.b = window.navigator;
- }
- /**
- * @return {?}
- */
- bar.prototype.g = function() {
- return this.b.i ? this.b.i : this.b.N ? this.b.N : this.b.i ? this.b.i : "unknown";
- };
- return bar;
- }();
- /** @type {string} */
- value.v = max;
- }, function(a, b) {
- /**
- * @param {!Object} a
- * @param {!Array} c
- * @return {?}
- */
- function $(a, c) {
- /** @type {!Array} */
- a = [a[0] >>> 16, a[0] & 65535, a[1] >>> 16, a[1] & 65535];
- /** @type {!Array} */
- c = [c[0] >>> 16, c[0] & 65535, c[1] >>> 16, c[1] & 65535];
- /** @type {!Array} */
- var b = [0, 0, 0, 0];
- b[3] += a[3] * c[3];
- b[2] += b[3] >>> 16;
- b[3] &= 65535;
- b[2] += a[2] * c[3];
- b[1] += b[2] >>> 16;
- b[2] &= 65535;
- b[2] += a[3] * c[2];
- b[1] += b[2] >>> 16;
- b[2] &= 65535;
- b[1] += a[1] * c[3];
- b[0] += b[1] >>> 16;
- b[1] &= 65535;
- b[1] += a[2] * c[2];
- b[0] += b[1] >>> 16;
- b[1] &= 65535;
- b[1] += a[3] * c[1];
- b[0] += b[1] >>> 16;
- b[1] &= 65535;
- b[0] += a[0] * c[3] + a[1] * c[2] + a[2] * c[1] + a[3] * c[0];
- b[0] &= 65535;
- return [b[0] << 16 | b[1], b[2] << 16 | b[3]];
- }
- /**
- * @param {!Object} a
- * @param {!Object} b
- * @return {?}
- */
- function next(a, b) {
- /** @type {!Array} */
- a = [a[0] >>> 16, a[0] & 65535, a[1] >>> 16, a[1] & 65535];
- /** @type {!Array} */
- b = [b[0] >>> 16, b[0] & 65535, b[1] >>> 16, b[1] & 65535];
- /** @type {!Array} */
- var c = [0, 0, 0, 0];
- c[3] += a[3] + b[3];
- c[2] += c[3] >>> 16;
- c[3] &= 65535;
- c[2] += a[2] + b[2];
- c[1] += c[2] >>> 16;
- c[2] &= 65535;
- c[1] += a[1] + b[1];
- c[0] += c[1] >>> 16;
- c[1] &= 65535;
- c[0] += a[0] + b[0];
- c[0] &= 65535;
- return [c[0] << 16 | c[1], c[2] << 16 | c[3]];
- }
- /**
- * @param {!Object} m
- * @param {number} n
- * @return {?}
- */
- function normalize(m, n) {
- /** @type {number} */
- n = n % 64;
- if (32 === n) {
- return [m[1], m[0]];
- }
- if (32 > n) {
- return [m[0] << n | m[1] >>> 32 - n, m[1] << n | m[0] >>> 32 - n];
- }
- /** @type {number} */
- n = n - 32;
- return [m[1] << n | m[0] >>> 32 - n, m[0] << n | m[1] >>> 32 - n];
- }
- /**
- * @param {?} m
- * @param {number} n
- * @return {?}
- */
- function replace(m, n) {
- /** @type {number} */
- n = n % 64;
- return 0 === n ? m : 32 > n ? [m[0] << n | m[1] >>> 32 - n, m[1] << n] : [m[1] << n - 32, 0];
- }
- /**
- * @param {!Object} a
- * @param {!Array} b
- * @return {?}
- */
- function callback(a, b) {
- return [a[0] ^ b[0], a[1] ^ b[1]];
- }
- /**
- * @param {!Object} items
- * @return {?}
- */
- function toArray(items) {
- items = callback(items, [0, items[0] >>> 1]);
- items = $(items, [4283543511, 3981806797]);
- items = callback(items, [0, items[0] >>> 1]);
- items = $(items, [3301882366, 444984403]);
- return callback(items, [0, items[0] >>> 1]);
- }
- /** @type {boolean} */
- b.a = true;
- /**
- * @param {string} r
- * @param {!Object} value
- * @return {?}
- */
- b.hash = function(r, value) {
- r = r || "";
- value = value || 0;
- /** @type {number} */
- var c = r.length % 16;
- /** @type {number} */
- var d = r.length - c;
- /** @type {!Array} */
- var result = [0, value];
- /** @type {!Array} */
- value = [0, value];
- var b;
- var ret;
- /** @type {!Array} */
- var a = [2277735313, 289559509];
- /** @type {!Array} */
- var w = [1291169091, 658871167];
- /** @type {number} */
- var i = 0;
- for (; i < d; i = i + 16) {
- /** @type {!Array} */
- b = [r.charCodeAt(i + 4) & 255 | (r.charCodeAt(i + 5) & 255) << 8 | (r.charCodeAt(i + 6) & 255) << 16 | (r.charCodeAt(i + 7) & 255) << 24, r.charCodeAt(i) & 255 | (r.charCodeAt(i + 1) & 255) << 8 | (r.charCodeAt(i + 2) & 255) << 16 | (r.charCodeAt(i + 3) & 255) << 24];
- /** @type {!Array} */
- ret = [r.charCodeAt(i + 12) & 255 | (r.charCodeAt(i + 13) & 255) << 8 | (r.charCodeAt(i + 14) & 255) << 16 | (r.charCodeAt(i + 15) & 255) << 24, r.charCodeAt(i + 8) & 255 | (r.charCodeAt(i + 9) & 255) << 8 | (r.charCodeAt(i + 10) & 255) << 16 | (r.charCodeAt(i + 11) & 255) << 24];
- b = $(b, a);
- b = normalize(b, 31);
- b = $(b, w);
- result = callback(result, b);
- result = normalize(result, 27);
- result = next(result, value);
- result = next($(result, [0, 5]), [0, 1390208809]);
- ret = $(ret, w);
- ret = normalize(ret, 33);
- ret = $(ret, a);
- value = callback(value, ret);
- value = normalize(value, 31);
- value = next(value, result);
- value = next($(value, [0, 5]), [0, 944331445]);
- }
- /** @type {!Array} */
- b = [0, 0];
- /** @type {!Array} */
- ret = [0, 0];
- switch(c) {
- case 15:
- ret = callback(ret, replace([0, r.charCodeAt(i + 14)], 48));
- case 14:
- ret = callback(ret, replace([0, r.charCodeAt(i + 13)], 40));
- case 13:
- ret = callback(ret, replace([0, r.charCodeAt(i + 12)], 32));
- case 12:
- ret = callback(ret, replace([0, r.charCodeAt(i + 11)], 24));
- case 11:
- ret = callback(ret, replace([0, r.charCodeAt(i + 10)], 16));
- case 10:
- ret = callback(ret, replace([0, r.charCodeAt(i + 9)], 8));
- case 9:
- ret = callback(ret, [0, r.charCodeAt(i + 8)]);
- ret = $(ret, w);
- ret = normalize(ret, 33);
- ret = $(ret, a);
- value = callback(value, ret);
- case 8:
- b = callback(b, replace([0, r.charCodeAt(i + 7)], 56));
- case 7:
- b = callback(b, replace([0, r.charCodeAt(i + 6)], 48));
- case 6:
- b = callback(b, replace([0, r.charCodeAt(i + 5)], 40));
- case 5:
- b = callback(b, replace([0, r.charCodeAt(i + 4)], 32));
- case 4:
- b = callback(b, replace([0, r.charCodeAt(i + 3)], 24));
- case 3:
- b = callback(b, replace([0, r.charCodeAt(i + 2)], 16));
- case 2:
- b = callback(b, replace([0, r.charCodeAt(i + 1)], 8));
- case 1:
- b = callback(b, [0, r.charCodeAt(i)]);
- b = $(b, a);
- b = normalize(b, 31);
- b = $(b, w);
- result = callback(result, b);
- }
- result = callback(result, [0, r.length]);
- value = callback(value, [0, r.length]);
- result = next(result, value);
- value = next(value, result);
- result = toArray(result);
- value = toArray(value);
- result = next(result, value);
- value = next(value, result);
- return ("00000000" + (result[0] >>> 0).toString(16)).slice(-8) + ("00000000" + (result[1] >>> 0).toString(16)).slice(-8) + ("00000000" + (value[0] >>> 0).toString(16)).slice(-8) + ("00000000" + (value[1] >>> 0).toString(16)).slice(-8);
- };
- }, function(inW, b, require) {
- /** @type {boolean} */
- b.a = true;
- var _ = require(6);
- inW = function() {
- /**
- * @return {undefined}
- */
- function RegisteredUser() {
- }
- /**
- * @return {?}
- */
- RegisteredUser.prototype.g = function() {
- return _.s(navigator.plugins).sort(function(a, b) {
- return a.name > b.name ? 1 : 2;
- }).map(function(val) {
- return [val.name, val.description, _.s(val).map(function(navMimeType) {
- return [navMimeType.description, navMimeType.suffixes, navMimeType.type].join();
- }).join()].join();
- }).join();
- };
- return RegisteredUser;
- }();
- /** @type {number} */
- b.w = inW;
- }, function(type, o, get) {
- var extend = this && this.U || Object.assign || function(a) {
- var b;
- /** @type {number} */
- var i = 1;
- /** @type {number} */
- var argl = arguments.length;
- for (; i < argl; i++) {
- b = arguments[i];
- var prop;
- for (prop in b) {
- if (Object.prototype.hasOwnProperty.call(b, prop)) {
- a[prop] = b[prop];
- }
- }
- }
- return a;
- };
- /** @type {boolean} */
- o.a = true;
- var color = get(1);
- var data = get(4);
- var values = get(0);
- var parsed_sig = get(2);
- var g = get(3);
- type = function() {
- /**
- * @param {number} l
- * @return {undefined}
- */
- function init(l) {
- var o = this;
- /** @type {number} */
- this.l = l;
- this.G = {
- webGL : color.A,
- dnt : parsed_sig.v,
- plugins : data.w,
- applePay : values.u
- };
- this.l = extend({
- webGL : false,
- dnt : false,
- plugins : false,
- applePay : false
- }, l);
- /** @type {!Array<?>} */
- this.F = Object.keys(this.l).filter(function(index) {
- return o.l[index];
- }).map(function(name) {
- return new o.G[name];
- });
- }
- /**
- * @param {number} minor
- * @return {?}
- */
- init.prototype.toString = function(minor) {
- if (void 0 === minor) {
- /** @type {boolean} */
- minor = true;
- }
- var b = this.F.map(function(domFixtures) {
- /** @type {string} */
- var c = "";
- try {
- c = domFixtures.g();
- } catch (Ma) {
- }
- return c;
- });
- return minor ? [g.hash(b.join(""), 210)] : b.map(function(a) {
- return g.hash(a, 210);
- });
- };
- return init;
- }();
- /** @type {!Function} */
- o.T = type;
- /** @type {!Function} */
- o["default"] = type;
- }, function(a, pfs) {
- /** @type {boolean} */
- pfs.a = true;
- /**
- * @param {!Object} val
- * @return {?}
- */
- pfs.s = function(val) {
- return Array.prototype.slice.call(val);
- };
- }]);
- debounceDelay = debounceDelay["default"];
- } catch (Console_error) {
- data = {
- error : Console_error,
- scope : "fip"
- };
- }
- var options = {
- protocol : "https:",
- baseUrl : "mc.yandex.",
- yandexWhiteListTld : "ru ua by kz az kg lv md tj tm uz ee fr co.il com.ge com.am com.tr".split(" ")
- };
- /** @type {string} */
- options.host = options.baseUrl + "ru";
- /** @type {string} */
- options.cross = "L21ldHJpa2EvenpsYy5odG1s";
- var _ = {
- mixin : function(obj) {
- var i;
- var prop;
- /** @type {number} */
- i = 1;
- for (; i < arguments.length; i++) {
- if (arguments[i]) {
- for (prop in arguments[i]) {
- if (arguments[i].hasOwnProperty(prop)) {
- obj[prop] = arguments[i][prop];
- }
- }
- if (arguments[i].hasOwnProperty("toString")) {
- obj.toString = arguments[i].toString;
- }
- }
- }
- return obj;
- }
- };
- /**
- * @param {number} staticProps
- * @return {undefined}
- */
- var Class = function(staticProps) {
- staticProps = staticProps || {};
- _.mixin(this, staticProps);
- this._initComponent();
- };
- /**
- * @return {undefined}
- */
- Class.prototype._initComponent = function() {
- };
- /**
- * @param {!Object} obj
- * @return {?}
- */
- Class.inherit = function(obj) {
- obj = obj || {};
- var superclass = "function" == typeof this ? this : Object;
- if (!obj.hasOwnProperty("constructor")) {
- /**
- * @return {undefined}
- */
- obj.constructor = function() {
- superclass.apply(this, arguments);
- };
- }
- /**
- * @return {undefined}
- */
- var subclass = function() {
- };
- subclass.prototype = superclass.prototype;
- obj.constructor.prototype = new subclass;
- _.mixin(obj.constructor.prototype, obj);
- /** @type {function(): undefined} */
- obj.constructor.prototype.constructor = obj.constructor;
- obj.constructor.superclass = superclass.prototype;
- /** @type {function(!Object): ?} */
- obj.constructor.inherit = Class.inherit;
- return obj.constructor;
- };
- /**
- * @param {!Object} object
- * @param {!Function} callback
- * @param {?} context
- * @return {undefined}
- */
- _.forEachKey = function(object, callback, context) {
- var name;
- for (name in object) {
- if (object.hasOwnProperty(name)) {
- callback.call(context, name, object[name], object);
- }
- }
- };
- /**
- * @param {!Object} a
- * @param {!Object} b
- * @return {?}
- */
- _.isEqual = function(a, b) {
- /** @type {boolean} */
- var equal = true;
- _.forEachKey(a, function(key, undefined) {
- if (!(b.hasOwnProperty(key) && b[key] === undefined)) {
- /** @type {boolean} */
- equal = false;
- }
- });
- if (!equal) {
- return equal;
- }
- _.forEachKey(b, function(prop, undefined) {
- if (!(a.hasOwnProperty(prop) && a[prop] === undefined)) {
- /** @type {boolean} */
- equal = false;
- }
- });
- return equal;
- };
- /**
- * @param {string} name
- * @param {!Object} obj
- * @return {?}
- */
- _.getNativeFunction = function(name, obj) {
- var fn;
- obj = obj || window;
- return (fn = obj.constructor && obj.constructor.prototype && obj.constructor.prototype[name] || obj[name]) && "apply" in fn ? function() {
- return fn.apply(obj, arguments);
- } : function() {
- };
- };
- /**
- * @param {!Function} t
- * @param {number} cb
- * @param {string} fn
- * @return {?}
- */
- _.setTimeout = function(t, cb, fn) {
- return _.getNativeFunction("setTimeout")(require(t, fn || "setTimeout"), cb);
- };
- var self = Class.inherit({
- _initComponent : function() {
- self.superclass._initComponent.apply(this, arguments);
- /** @type {!Array} */
- this._listeners = [];
- },
- on : function(elem, event, callback, scope, handler) {
- handler = self._getOpts(handler);
- event = event.split(",");
- var pos = event.length;
- var ret = this._listeners;
- var p;
- /** @type {number} */
- p = 0;
- for (; p < pos; p++) {
- var type = event[p];
- var genOp = require(function(evt) {
- callback.call(scope || this, evt || window.event);
- }, "on" + type + handler.name);
- /** @type {!Array} */
- ret[ret.length] = [elem, type, callback, scope, handler, genOp];
- if (elem.addEventListener) {
- elem.addEventListener(type, genOp, self._prepOpts(handler));
- } else {
- if (elem.attachEvent) {
- elem.attachEvent("on" + type, genOp);
- }
- }
- }
- },
- un : function(eventName, event, callback, obj, container) {
- container = self._getOpts(container);
- var listeners = this._listeners;
- var j = listeners.length;
- var i;
- /** @type {number} */
- i = 0;
- for (; i < j; i++) {
- var li = listeners[i];
- if (li[0] == eventName && li[1] == event && li[2] == callback && li[3] == obj && _.isEqual(li[4], container)) {
- listeners.splice(i, 1);
- this._removeListener(eventName, event, li[5], container);
- break;
- }
- }
- },
- unAll : function() {
- var _ref = this._listeners;
- var max = _ref.length;
- var j;
- /** @type {number} */
- j = 0;
- for (; j < max; j++) {
- var url = _ref[j];
- this._removeListener(url[0], url[1], url[5], url[4]);
- }
- /** @type {number} */
- _ref.length = 0;
- },
- _removeListener : function(element, type, callback, eventName) {
- if (element.removeEventListener) {
- element.removeEventListener(type, callback, self._prepOpts(eventName));
- } else {
- if (element.detachEvent) {
- element.detachEvent("on" + type, callback);
- }
- }
- }
- });
- /**
- * @return {?}
- */
- self.supportsPassive = function() {
- if (self._supportsPassive !== undefined) {
- return self._supportsPassive;
- }
- /** @type {boolean} */
- self._supportsPassive = false;
- try {
- /** @type {!Object} */
- var options = Object.defineProperty({}, "passive", {
- get : function() {
- /** @type {boolean} */
- self._supportsPassive = true;
- }
- });
- window.addEventListener("test", null, options);
- } catch (b) {
- }
- return self._supportsPassive;
- };
- /**
- * @param {!Object} options
- * @return {?}
- */
- self._getOpts = function(options) {
- return _.mixin({
- capture : true,
- passive : true
- }, options || {});
- };
- /**
- * @param {!Object} value
- * @return {?}
- */
- self._prepOpts = function(value) {
- return self.supportsPassive() ? value : !!value.capture;
- };
- /**
- * @return {undefined}
- */
- self.on = function() {
- if (!self._instance) {
- self._instance = new self;
- }
- self._instance.on.apply(self._instance, arguments);
- };
- /**
- * @return {undefined}
- */
- self.un = function() {
- if (self._instance) {
- self._instance.un.apply(self._instance, arguments);
- }
- };
- var context = {
- UNLOAD_MS : 0,
- isPerfomance : window.performance && window.performance.timing && window.performance.timing.navigationStart && window.performance.now,
- getMs : function() {
- return 0 < this.UNLOAD_MS ? this.UNLOAD_MS : this.isPerfomance ? Math.round(window.performance.timing.navigationStart + window.performance.now()) : +new Date;
- }
- };
- self.on(window, "beforeunload,unload", function() {
- if (0 === context.UNLOAD_MS) {
- context.UNLOAD_MS = context.getMs();
- }
- });
- /**
- * @param {number} i
- * @return {?}
- */
- _.pad = function(i) {
- return (10 > i ? "0" : "") + i;
- };
- /**
- * @return {?}
- */
- context.getTimestamp = function() {
- /** @type {!Date} */
- var data = new Date;
- /** @type {!Array} */
- data = [data.getFullYear(), data.getMonth() + 1, data.getDate(), data.getHours(), data.getMinutes(), data.getSeconds()];
- /** @type {string} */
- var result = "";
- var i;
- /** @type {number} */
- i = 0;
- for (; i < data.length; i++) {
- /** @type {string} */
- result = result + _.pad(data[i]);
- }
- return result;
- };
- /**
- * @return {?}
- */
- context.getTimezone = function() {
- return -(new Date).getTimezoneOffset();
- };
- /**
- * @return {?}
- */
- context.getMinutes = function() {
- return Math.floor(this.getMs() / 1E3 / 60);
- };
- /**
- * @return {?}
- */
- context.getSeconds = function() {
- return Math.round(this.getMs() / 1E3);
- };
- /**
- * @param {string} a
- * @return {?}
- */
- _.isArray = function(a) {
- return "function" == typeof Array.isArray ? Array.isArray(a) : "[object Array]" == Object.prototype.toString.call(a);
- };
- /**
- * @param {!Array} a
- * @return {?}
- */
- _.mergeArrays = function(a) {
- var j;
- var i;
- /** @type {number} */
- var argsLength = arguments.length;
- /** @type {number} */
- j = 1;
- for (; j < argsLength; j++) {
- var c = arguments[j];
- if (_.isArray(c) || c && "[object Arguments]" === c.toString()) {
- /** @type {number} */
- i = 0;
- for (; i < c.length; i++) {
- a[a.length] = c[i];
- }
- }
- }
- return a;
- };
- /**
- * @param {!Function} fn
- * @param {undefined} callback
- * @param {?} context
- * @param {!Array} params
- * @param {string} name
- * @return {?}
- */
- _.defer = function(fn, callback, context, params, name) {
- return _.setTimeout(function() {
- fn.apply(context, params || []);
- }, callback, name);
- };
- /**
- * @param {!Function} f
- * @param {number} fn
- * @param {(Object|string)} scope
- * @param {string} callback
- * @return {?}
- */
- _.throttle = function(f, fn, scope, callback) {
- var data;
- var arguments_;
- var req;
- return function() {
- /** @type {!Arguments} */
- arguments_ = arguments;
- req = this;
- if (!data) {
- (function() {
- /** @type {null} */
- data = null;
- if (arguments_) {
- f.apply(scope || req, arguments_);
- /** @type {null} */
- arguments_ = null;
- data = _.setTimeout(arguments.callee, fn, callback);
- }
- })();
- }
- };
- };
- var A = Class.inherit({
- storage : null,
- storageKey : "dataBuffer",
- maxBufferSize : 255,
- flushTimeout : 1E4,
- startBufferTime : 0,
- active : true,
- meta : null,
- onFlush : function() {
- },
- onFlushCtx : null,
- bufferExpireTime : 864E5,
- _initComponent : function() {
- var summary;
- A.superclass._initComponent.apply(this, arguments);
- /** @type {!Array} */
- this._data = [];
- /** @type {number} */
- this._packetNumber = 0;
- /** @type {null} */
- this._flushTID = null;
- this._saveToStorageThrottled = _.throttle(this._saveToStorage, 300, this, "DataBuffer._saveToStorage");
- if (this.storage && (summary = this.storage.get(this.storageKey)) && summary.data && summary.meta && summary.time && summary.time + this.bufferExpireTime > +context.getMs()) {
- this.onFlush.call(this.onFlushCtx || this, this.dataFromStorage(summary.data), summary.meta, summary.pnum);
- }
- this.clear();
- },
- getFlushSize : function() {
- return this._data.length;
- },
- mergeData : function(data, source) {
- _.mergeArrays(data, source);
- },
- append : function(a, size) {
- this.mergeData(this._data, a);
- this._saveToStorageThrottled();
- if (this.active) {
- if (size || this.getFlushSize() >= this.maxBufferSize || this.getFlushSize() === this.maxChunkSize) {
- this._flush(size);
- }
- if (!this._flushTID) {
- this._flushTID = _.defer(this._flush, this.flushTimeout, this, [size], "DataBuffer._flush");
- }
- }
- },
- activate : function() {
- if (!this.active) {
- /** @type {boolean} */
- this.active = true;
- this.append([]);
- }
- },
- clear : function() {
- /** @type {number} */
- this._data.length = 0;
- /** @type {null} */
- this._flushTID = null;
- if (this.storage) {
- this.storage.remove(this.storageKey);
- }
- },
- _flush : function(callback) {
- if (!this.getFlushSize()) {
- return this.clear(), false;
- }
- this.onFlush.call(this.onFlushCtx || this, this._data, this.meta, this._packetNumber, callback);
- this._packetNumber++;
- this.clear();
- },
- dataFromStorage : function(a) {
- return a;
- },
- dataToStorage : function(a) {
- return a;
- },
- _saveToStorage : function() {
- if (this.storage && this._data.length) {
- this.storage.set(this.storageKey, {
- data : this.dataToStorage(this._data),
- meta : this.meta,
- pnum : this._packetNumber,
- time : context.getMs()
- });
- }
- }
- });
- var api = {
- storage : {},
- init : function() {
- var settee = this;
- require(function() {
- window.Ya = window.Ya || {};
- window.Ya._metrika = window.Ya._metrika || {};
- settee.storage = window.Ya._metrika;
- }, "", true)();
- return this;
- },
- setSafe : function(i, k) {
- var target = this;
- require(function() {
- if (target.storage[i] === undefined) {
- /** @type {string} */
- target.storage[i] = k;
- }
- }, "", true)();
- return this;
- },
- set : function(value, object) {
- require(function() {
- /** @type {string} */
- window.Ya._metrika[value] = object;
- }, "", true)();
- return this;
- },
- get : function(s, v) {
- return require(function() {
- var t = window.Ya._metrika[s];
- return t === undefined ? v : t;
- }, "", true)();
- }
- };
- /**
- * @param {!Function} task
- * @param {?} callback
- * @param {string} selector
- * @return {undefined}
- */
- _.async = function(task, callback, selector) {
- if (window.postMessage) {
- /** @type {string} */
- var data = "__ym__promise" + Math.random() + "_" + context.getMs();
- /**
- * @param {!Object} e
- * @return {undefined}
- */
- var fn = function(e) {
- if (e.data === data) {
- if (e.stopPropagation) {
- e.stopPropagation();
- }
- task.call(callback);
- self.un(window, "message", fn, null, {
- passive : false
- });
- }
- };
- self.on(window, "message", fn, null, {
- passive : false,
- name : ".async." + (selector || "")
- });
- window.postMessage(data, "*");
- } else {
- _.setTimeout(function() {
- task.call(callback);
- }, 0);
- }
- };
- var httpModule = Class.inherit({
- transports : [],
- globalConfig : api,
- postParams : [],
- isDisabled : function() {
- return this.globalConfig.get("oo");
- },
- send : function(str, data, c, name) {
- /** @type {!Array} */
- var values = [str];
- var item = this;
- var _client = c || function() {
- };
- if (item.isDisabled()) {
- _client.call(name);
- } else {
- (function run(i) {
- if (i < this.transports.length) {
- try {
- var self = new this.transports[i]({
- postParams : this.postParams,
- queryStringParams : this.queryStringParams
- });
- data["browser-info"] = self.logInfo(data["browser-info"]);
- (function map(i) {
- if (i >= values.length) {
- if (!self.blockNext()) {
- run.call(this, i + 1);
- }
- } else {
- self.request(values[i], data, function(a, message, value) {
- if (a) {
- _client.call(name, message, value);
- } else {
- _.async(function() {
- map.call(item, i + 1);
- });
- }
- }, this);
- }
- }).call(this, 0);
- } catch (moduleLoader) {
- load(moduleLoader, "send by " + (self && self.id));
- run.call(this, i + 1);
- }
- }
- }).call(this, 0);
- }
- }
- });
- var s = {};
- /**
- * @param {!Object} object
- * @return {?}
- */
- _.keys = function(object) {
- var i;
- /** @type {!Array} */
- var objKeys = [];
- for (i in object) {
- if (object.hasOwnProperty(i)) {
- objKeys.push(i);
- }
- }
- return objKeys;
- };
- /**
- * @param {!Function} op
- * @param {!Array} data
- * @return {?}
- */
- _.map = function(op, data) {
- var i;
- /** @type {!Array} */
- var result = [];
- /** @type {number} */
- i = 0;
- for (; i < data.length; i++) {
- result.push(op(data[i], i));
- }
- return result;
- };
- /**
- * @param {!Object} data
- * @param {!Object} doc
- * @return {?}
- */
- s.stringify = function(data, doc) {
- /** @type {!Array} */
- var c = [];
- var d = doc || {};
- var ids = {};
- var id = _.keys(data).length;
- var i;
- var j;
- if (d.lastOrdering !== undefined) {
- /** @type {number} */
- j = 1;
- for (; j <= doc.lastOrdering.length; j++) {
- ids[doc.lastOrdering[j - 1]] = id + j;
- }
- }
- if (d.firstOrdering !== undefined) {
- /** @type {number} */
- j = 0;
- for (; j < doc.firstOrdering.length; j++) {
- /** @type {number} */
- ids[doc.firstOrdering[j]] = j;
- }
- }
- for (i in data) {
- if (data.hasOwnProperty(i)) {
- if (d = data[i], _.isArray(d)) {
- /** @type {number} */
- j = 0;
- for (; j < d.length; j++) {
- c.push({
- key : i,
- value : encodeURIComponent(i) + "=" + encodeURIComponent(String(d[j]))
- });
- }
- } else {
- c.push({
- key : i,
- value : encodeURIComponent(i) + "=" + encodeURIComponent(String(d))
- });
- }
- }
- }
- c.sort(function(component, asset) {
- var tmp = ids[component.key];
- var target = ids[asset.key];
- if ("undefined" === typeof tmp) {
- tmp = id;
- }
- if ("undefined" === typeof target) {
- target = id;
- }
- return tmp - target;
- });
- return _.map(function(select_ele) {
- return select_ele.value;
- }, c).join("&");
- };
- /**
- * @param {!Array} c
- * @param {string} b
- * @return {?}
- */
- _.inArray = function(c, b) {
- var i;
- /** @type {number} */
- i = 0;
- for (; i < c.length; i++) {
- if (c[i] == b) {
- return true;
- }
- }
- return false;
- };
- var $ = Class.inherit({
- postParams : [],
- index : 0,
- blockNext : function() {
- return false;
- },
- logInfo : function(text) {
- var matches;
- if (text) {
- return text = (matches = text.match(/^ti:\d:/)) ? text.replace(matches[0], "") : text, "ti:" + this.index + ":" + text;
- }
- },
- _buildUrl : function(path, args) {
- var child = s.stringify(args, this.queryStringParams);
- return path + (-1 < path.indexOf("?") ? "&" : child ? "?" : "") + child;
- },
- _splitParams : function(obj) {
- var b = {};
- var metaData = {};
- _.forEachKey(obj, function(tag, value) {
- if (_.inArray(this.postParams, tag)) {
- metaData[tag] = value;
- } else {
- b[tag] = value;
- }
- }, this);
- return {
- get : b,
- post : metaData
- };
- },
- _parseResp : function(obj) {
- return obj;
- }
- });
- var inputs = $.inherit({
- id : "XHR",
- index : 7,
- method : "POST",
- withCredentials : true,
- request : function(service, data, test, conn) {
- var validatorSet = this;
- var f;
- if (/[^a-z0-9.:-]/.test(result.host) && window.opera && "function" === typeof window.opera.version) {
- var ppties = window.opera.version();
- if ("string" === typeof ppties && "12" === ppties.split(".")[0]) {
- return test.call(conn, false);
- }
- }
- if (window.XMLHttpRequest) {
- /** @type {!XMLHttpRequest} */
- var xhr = new XMLHttpRequest;
- if ("withCredentials" in xhr) {
- data = this._splitParams(data);
- service = this._buildUrl(service, data.get);
- try {
- xhr.open(this.method, service, true);
- } catch (G) {
- return test.call(conn, false);
- }
- xhr.withCredentials = this.withCredentials;
- this._setHeaders(xhr);
- xhr.send(this._preparePostParams(data));
- /**
- * @return {?}
- */
- xhr.onreadystatechange = function() {
- if (4 === xhr.readyState) {
- try {
- f = validatorSet._parseResp(xhr.responseText);
- } catch (G) {
- return test.call(conn, false);
- }
- test.apply(conn, [200 === xhr.status].concat(f));
- }
- };
- return;
- }
- }
- test.call(conn, false);
- },
- setMethod : function(method) {
- /** @type {!Object} */
- this.method = method;
- },
- _preparePostParams : function(a) {
- return s.stringify(a.post);
- },
- _setHeaders : function(xhr) {
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- }
- });
- var $scope = {};
- $scope.isAndroidWebView = require(function() {
- /** @type {string} */
- var uri_display = navigator.userAgent || "";
- return uri_display.match(/Android.*Version\/[0-9][0-9.]*\sChrome\/[0-9][0-9.]/) || uri_display.match(/Android.*Version\/[0-9][0-9.]*\s(?:Mobile\s)?Safari\/[0-9][0-9.]*\sChrome\/[0-9][0-9.]*/) || uri_display.match(/; wv\).*Chrome\/[0-9][0-9.]*\sMobile/);
- }, "isAndroidWebView");
- var fileTransport = $.inherit({
- id : "beacon",
- index : 1,
- request : function(uri, options, d, k) {
- if ("function" === typeof navigator.sendBeacon && !$scope.isAndroidWebView() && navigator.onLine) {
- options = this._splitParams(options);
- /** @type {number} */
- options.get["force-urlencoded"] = 1;
- d.call(k, navigator.sendBeacon(this._buildUrl(uri, options.get), s.stringify(options.post)));
- } else {
- d.call(k, false);
- }
- }
- });
- /**
- * @param {number} b
- * @param {number} a
- * @return {?}
- */
- _.random = function(b, a) {
- if (2 > arguments.length) {
- /** @type {number} */
- a = b;
- /** @type {number} */
- b = 0;
- }
- if (1 > arguments.length) {
- /** @type {number} */
- a = 1073741824;
- }
- return Math.floor(Math.random() * (a - b)) + b;
- };
- var ret = $.inherit({
- id : "form",
- index : 2,
- enctype : "application/x-www-form-urlencoded",
- htmlfileOnly : false,
- _initComponent : function() {
- ret.superclass._initComponent.apply(this, arguments);
- if (!("_htmlfile" in ret.prototype)) {
- ret.prototype._htmlfile = this._createHtmlfile();
- }
- this._doc = this._htmlfile || (this.htmlfileOnly ? null : document);
- },
- request : function(service, params, origin, listener) {
- var doc = this._doc;
- if (!doc) {
- return origin.call(listener, false);
- }
- params = this._splitParams(params);
- /** @type {string} */
- var protocol = "ifr" + _.random();
- var h = doc.createElement("div");
- /** @type {string} */
- h.style.position = "absolute";
- /** @type {string} */
- h.style.left = "-99999px";
- /** @type {string} */
- h.style.top = "-99999px";
- /** @type {!Array} */
- var keys = ['<iframe name="', protocol, '"></iframe>', '<form action="', this._buildUrl(service, params.get), '" method="post" target="', protocol, '" enctype="', this.enctype, '">'];
- _.forEachKey(params.post, function(index) {
- _.mergeArrays(keys, ['<input type="hidden" autocomplete="off" autocorrect="off"', ' autocapitalize="off" spellcheck="false" name="', index, '"/>']);
- });
- _.mergeArrays(keys, ["</form>"]);
- /** @type {string} */
- h.innerHTML = keys.join("");
- doc.body.appendChild(h);
- var form = h.getElementsByTagName("form")[0];
- _.forEachKey(params.post, function(name, initSBC) {
- /** @type {!Object} */
- form[name].value = initSBC;
- });
- form.submit();
- _.setTimeout(function() {
- doc.body.removeChild(h);
- }, 1E4, "TransportForm.request.2");
- return origin.call(listener, true, "tf.request");
- },
- _createHtmlfile : function() {
- try {
- if (window.ActiveXObject) {
- var doc = new ActiveXObject("htmlfile");
- doc.open();
- doc.write("<html><body></body></html>");
- doc.close();
- return doc;
- }
- } catch (b) {
- }
- return null;
- }
- });
- var Lb = ret.inherit({
- id : "htmlfile",
- index : 3,
- htmlfileOnly : true
- });
- var ReqRes = $.inherit({
- id : "img",
- index : 4,
- request : function(url, req, config, api) {
- url = this._buildUrl(url, req);
- /** @type {boolean} */
- var e = false;
- /** @type {!Element} */
- req = document.createElement("img");
- config = config || function() {
- };
- req.onload = require(function() {
- if (!e) {
- config.call(api, true);
- /** @type {boolean} */
- e = true;
- }
- }, "TransportImage.request");
- req.onerror = require(function() {
- if (!e) {
- config.call(api, false);
- /** @type {boolean} */
- e = true;
- }
- }, "TransportImage.request");
- /** @type {string} */
- req.src = url;
- if (this.timeout) {
- _.setTimeout(function() {
- if (!e) {
- config.call(api, false);
- /** @type {boolean} */
- e = true;
- }
- }, this.timeout, "ti.request");
- }
- }
- });
- var service = {
- stringify : function(arr) {
- try {
- /** @type {string} */
- var x = JSON.stringify(arr);
- } catch (c) {
- }
- return _.inArray(["{}", undefined], x) ? "null" : x;
- }
- };
- /**
- * @param {!Object} value
- * @return {?}
- */
- _.toJSON = function(value) {
- var position;
- if (value === undefined) {
- return "";
- }
- if (null === value) {
- return "null";
- }
- switch(value.constructor) {
- case Boolean:
- return value.toString();
- case Number:
- return isFinite(value) ? value.toString() : "null";
- case String:
- return '"' + value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"';
- case Array:
- /** @type {!Array} */
- var displayUsedBy = [];
- /** @type {number} */
- var key = 0;
- position = value.length;
- for (; key < position; key++) {
- displayUsedBy[displayUsedBy.length] = _.toJSON(value[key]);
- }
- return "[" + displayUsedBy.join(",") + "]";
- case Object:
- /** @type {!Array} */
- displayUsedBy = [];
- for (key in value) {
- if (value.hasOwnProperty(key) && value[key] !== undefined) {
- /** @type {string} */
- displayUsedBy[displayUsedBy.length] = _.toJSON(key) + ":" + _.toJSON(value[key]);
- }
- }
- return "{" + displayUsedBy.join(",") + "}";
- default:
- return service.stringify(value);
- }
- };
- var Array = Class.inherit({
- counterId : "",
- _initComponent : function() {
- Array.superclass._initComponent.apply(this, arguments);
- /** @type {null} */
- this._ls = null;
- try {
- /** @type {(Storage|null)} */
- this._ls = window.localStorage;
- } catch (a) {
- }
- },
- set : function(s, value) {
- if (this.isEnabled()) {
- try {
- if (!value || value && _.isArray(value) && !value.length) {
- this.remove(s);
- } else {
- this._ls.setItem(this._getLsKey(s), _.toJSON(value));
- }
- } catch (c) {
- }
- }
- },
- get : function(s) {
- if (this.isEnabled()) {
- try {
- return JSON.parse(this._ls.getItem(this._getLsKey(s)));
- } catch (b) {
- }
- }
- return null;
- },
- remove : function(obj) {
- if (this.isEnabled()) {
- try {
- this._ls.removeItem(this._getLsKey(obj));
- } catch (b) {
- }
- }
- },
- isEnabled : function() {
- return this._ls && window.JSON && "object" == typeof this._ls && "object" == typeof window.JSON;
- },
- getStorageId : function() {
- var a = this.get("lsid");
- if (!a) {
- /** @type {number} */
- a = Math.round(Math.random() * context.getMs());
- this.set("lsid", a);
- }
- return a;
- },
- clearStorageId : function() {
- this.remove("lsid");
- },
- _getLsKey : function(s) {
- return "_ym" + this.counterId + "_" + s;
- }
- });
- /**
- * @return {?}
- */
- _.getTld = function() {
- if (!this._tld) {
- var expRecords = result.hostname.split(".");
- this._tld = expRecords[expRecords.length - 1];
- }
- return this._tld;
- };
- var that = {
- abc : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
- tail : "+/=",
- tailSafe : "*-_"
- };
- var util = {
- removeNode : function(n) {
- var b = n && n.parentNode;
- if (b) {
- b.removeChild(n);
- }
- }
- };
- $scope.isSafariWebView = require(function() {
- /** @type {string} */
- var ua = navigator.userAgent || "";
- return navigator.vendor && -1 < navigator.vendor.indexOf("Apple") && (!ua.match(/Safari/) && ua.match(/Mobile/) || ua.match(/CFNetwork\/[0-9][0-9.]*.*Darwin\/[0-9][0-9.]*/) || -1 !== ua.indexOf("FB_IAB") || -1 !== ua.indexOf("FBAV") || -1 !== ua.indexOf("OKApp") || -1 !== ua.indexOf("GSA/"));
- }, "isSafariWebView");
- /**
- * @return {?}
- */
- $scope.isSafari = function() {
- try {
- return navigator.vendor && -1 < navigator.vendor.indexOf("Apple") && navigator.userAgent && !navigator.userAgent.match("CriOS");
- } catch (a) {
- }
- return false;
- };
- $scope.getMacOSVersion = require(function() {
- /** @type {(Array<string>|null)} */
- var a = navigator.userAgent.match(/Mac OS X ([0-9]+)_([0-9]+)_([0-9]+)/);
- return a ? [+a[1], +a[2], +a[2]] : [0, 0, 0];
- }, "", true);
- $scope.getPlatform = require(function() {
- return "" + navigator.platform;
- }, "", true);
- $scope.isIOS = require(function() {
- var a = $scope.getPlatform() || "";
- return "iPhone" === a || "iPad" === a;
- }, "", true);
- var open = {
- _storage : new Array,
- key : "zzlc",
- getZZ : function() {
- return this._storage.get(this.key) ? this._storage.get(this.key) : open.zz;
- },
- initZZ : function() {
- var me = this;
- var frame = $scope.getMacOSVersion();
- if (($scope.isIOS() || 10 <= frame[0] && 13 <= frame[2]) && $scope.isSafari() && !this.getZZ() && !$scope.isSafariWebView()) {
- frame = _.getNativeFunction("createElement", document)("iframe");
- /** @type {string} */
- frame.style.display = "none";
- /** @type {string} */
- frame.style.width = "1px";
- /** @type {string} */
- frame.style.height = "1px";
- /** @type {string} */
- frame.style.visibility = "hidden";
- /** @type {string} */
- frame.src = options.protocol + "//" + options.host + that.decode(options.cross);
- window.document.documentElement.appendChild(frame);
- self.on(window, "message", this.onMessage, this, {
- passive : false
- });
- this.frame = frame;
- this.timeout = _.setTimeout(function() {
- self.un(window, "message", me.onMessage, me, {
- passive : false
- });
- util.removeNode(me.frame);
- /** @type {string} */
- me.zz = "na";
- }, 3E3, "cd.initZZ");
- }
- },
- onMessage : function(task) {
- if (task.data && task.data.substr && "__ym__zz" === task.data.substr(0, 8)) {
- this.zz = task.data.substr(8);
- util.removeNode(this.frame);
- this._storage.set(this.key, this.zz);
- self.un(window, "message", this.onMessage, this, {
- passive : false
- });
- clearTimeout(this.timeout);
- }
- }
- };
- var Error = Class.inherit({
- counterId : "",
- onlyCurrentDomain : false,
- skipPrefix : false,
- _initComponent : function() {
- var i;
- Error.superclass._initComponent.apply(this, arguments);
- /** @type {null} */
- this._domain = null;
- if (!this.onlyCurrentDomain) {
- /** @type {!Array<string>} */
- var s = window.location.host.split(".");
- /** @type {number} */
- i = 2;
- for (;;) {
- if (i <= s.length) {
- if (this._domain = "." + s.slice(-i).join("."), i++, this.isEnabled()) {
- break;
- }
- } else {
- /** @type {null} */
- this._domain = null;
- break;
- }
- }
- }
- },
- create : function(a, b, prop) {
- /** @type {!Array} */
- a = [this._prepareName(a) + "=" + encodeURIComponent(b)];
- if (prop) {
- /** @type {!Date} */
- b = new Date;
- b.setTime(b.getTime() + 6E4 * prop);
- a.push("expires=" + b.toGMTString());
- }
- if (this._domain) {
- a.push("domain=" + this._domain);
- }
- a.push("path=/");
- try {
- /** @type {string} */
- document.cookie = a.join(";");
- } catch (d) {
- }
- },
- read : function(key) {
- try {
- /** @type {string} */
- var cookie = document.cookie;
- } catch (c) {
- }
- return cookie && cookie.match(new RegExp("(?:^|;\\s*)" + this._prepareName(key) + "=([^;]*)")) ? decodeURIComponent(RegExp.$1) : null;
- },
- erase : function(start) {
- this.create(start, "", -1);
- },
- isEnabled : function() {
- this.create("metrika_enabled", "1", 60);
- /** @type {boolean} */
- var enabled = !!this.read("metrika_enabled");
- this.erase("metrika_enabled");
- return enabled;
- },
- _prepareName : function(url) {
- return (this.skipPrefix ? "" : "_ym_") + url + (this.counterId ? "_" + this.counterId : "");
- }
- });
- /**
- * @param {string} s
- * @return {?}
- */
- Error.get = function(s) {
- return (new Error({
- onlyCurrentDomain : true
- })).read(s);
- };
- /**
- * @param {string} s
- * @param {string} b
- * @param {undefined} status
- * @return {?}
- */
- Error.set = function(s, b, status) {
- return (new Error({
- onlyCurrentDomain : true
- })).create(s, b, status);
- };
- /**
- * @return {?}
- */
- Error.isEnabled = function() {
- return (new Error({
- onlyCurrentDomain : true
- })).isEnabled();
- };
- var config = httpModule.inherit({
- protocol : "",
- host : options.host,
- queryStringParams : {
- firstOrdering : ["wmode", "callback", "cnt-class"],
- lastOrdering : ["browser-info"]
- },
- resource : "",
- counterId : "",
- counterType : 0,
- retry : false,
- transports : [fileTransport, inputs, ReqRes, Lb],
- _initComponent : function() {
- config.superclass._initComponent.apply(this, arguments);
- if (this.retry) {
- this._storage = new Array;
- }
- },
- send : function(n, a, e, data) {
- var p = this.globalConfig.get(img.globalKey);
- var helpers = this;
- if (p && 3 !== this.counterId) {
- p(function() {
- var text = helpers._registerRequest(n, a);
- helpers._sendSavedRequest(text, n, a, e, data);
- }, n);
- } else {
- p = helpers._registerRequest(n, a);
- helpers._sendSavedRequest(p, n, a, e, data);
- }
- },
- _sendSavedRequest : function(to, ns, data, t, d) {
- var cp = this.globalConfig.get("firstReqStatus");
- var model = ns.forceNoRedirect;
- if ("process" == cp) {
- this.globalConfig.set("firstReqCallbacks", _.mergeArrays(this.globalConfig.get("firstReqCallbacks") || [], [[this, arguments]]));
- } else {
- if (!cp) {
- this.globalConfig.set("firstReqStatus", "process");
- }
- if (this.counterType) {
- ns["cnt-class"] = this.counterType;
- }
- data.st = context.getSeconds();
- data.u = config._userID;
- data.fip = config.getFP();
- if (!data.fip) {
- delete data.fip;
- }
- data.zz = open.getZZ();
- if (!data.zz) {
- delete data.zz;
- }
- /** @type {string} */
- cp = [this.protocol, "//", this.host, "/", this.resource, "/", this.counterId, model ? "/1" : ""].join("");
- delete ns.forceNoRedirect;
- /** @type {!Array} */
- var p = [];
- if (data) {
- _.forEachKey(data, function(value, joinConfigName) {
- if ("t" != value) {
- _.mergeArrays(p, [value, joinConfigName]);
- }
- });
- if (data.t) {
- _.mergeArrays(p, ["t", data.t]);
- }
- }
- if (p.length) {
- /** @type {string} */
- ns["browser-info"] = p.join(":");
- }
- return config.superclass.send.call(this, cp, ns, function() {
- var layer_i;
- this.globalConfig.set("firstReqStatus", "complete");
- this._unregisterRequest(to);
- var crossfilterable_layers = this.globalConfig.get("firstReqCallbacks");
- this.globalConfig.set("firstReqCallbacks", null);
- if (crossfilterable_layers) {
- /** @type {number} */
- layer_i = 0;
- for (; layer_i < crossfilterable_layers.length; layer_i++) {
- crossfilterable_layers[layer_i][0]._sendSavedRequest.apply(crossfilterable_layers[layer_i][0], crossfilterable_layers[layer_i][1]);
- }
- }
- if (t) {
- t.apply(d, arguments);
- }
- }, this);
- }
- },
- _isRetryEnabled : function() {
- return this.retry && this._storage && this._storage.isEnabled();
- },
- _registerRequest : function(o, topic) {
- var id;
- if (this._isRetryEnabled()) {
- topic.rqnl = topic.rqnl || 0;
- topic.rqnl++;
- var json = this._storage.get("retryReqs") || {};
- /** @type {number} */
- id = 1;
- for (; json[id];) {
- id++;
- }
- json[id] = {
- protocol : this.protocol,
- host : this.host,
- resource : this.resource,
- counterId : this.counterId,
- counterType : this.counterType,
- postParams : this.postParams,
- params : o,
- browserInfo : topic,
- ghid : this.globalConfig.get("_globalMetrikaHitId"),
- time : context.getMs()
- };
- this._storage.set("retryReqs", json);
- return id;
- }
- },
- _unregisterRequest : function(n) {
- if (n && this._isRetryEnabled()) {
- var newValue = this._storage.get("retryReqs") || {};
- if (newValue[n]) {
- delete newValue[n];
- this._storage.set("retryReqs", newValue);
- }
- }
- },
- _getVersion : require(function() {
- return k;
- }, "", true)
- });
- config._storage = new Array;
- /** @type {string} */
- config._fipKey = "fip";
- /** @type {!Array} */
- config.fpFactors = ["webGL", "plugins", "applePay", "dnt"];
- /**
- * @return {undefined}
- */
- config.initFingerPrint = function() {
- /** @type {!Array} */
- var value = [];
- if ($scope.isSafari() && (navigator.userAgent.match(/Mac OS X[^_.]10[_.](13|12)/) || navigator.userAgent.match(/iPhone; CPU iPhone OS (11|10|12)/))) {
- var storage = config._storage;
- if (storage.get(this._fipKey)) {
- value = storage.get(this._fipKey);
- } else {
- value = new debounceDelay(_.reduce(function(a, howMany) {
- /** @type {number} */
- a[howMany] = 1;
- return a;
- }, {}, config.fpFactors));
- value = value.toString(false).join("-");
- storage.set(this._fipKey, value);
- }
- /** @type {!Array} */
- this._fingerPrint = value;
- }
- };
- /**
- * @return {?}
- */
- config.getFP = function() {
- return this._storage.get(this._fipKey) ? this._storage.get(this._fipKey) : config._fingerPrint;
- };
- /**
- * @return {undefined}
- */
- config.initCookie = function() {
- var node = new Error;
- var success = node.read("uid");
- var c = node.read("d");
- var l = context.getSeconds();
- if (!success) {
- /** @type {string} */
- success = l + "" + _.random();
- node.create("uid", success, 525600);
- node.create("d", l, 525600);
- } else {
- if (!c || 15768E3 < l - parseInt(c)) {
- node.create("uid", success, 525600);
- node.create("d", l, 525600);
- }
- }
- config._userID = success;
- };
- /**
- * @param {!Object} app
- * @return {undefined}
- */
- config.retransmit = function(app) {
- var storage = config._storage;
- var handlers = storage.get("retryReqs") || {};
- var res;
- storage.remove("retryReqs");
- _.forEachKey(handlers, function(b, options) {
- var d = context.getMs();
- if (!app.get("firstReqStatus")) {
- app.set("firstReqStatus", "complete");
- }
- if (options.ghid && options.ghid != app.get("_globalMetrikaHitId") && options.time && options.time + 864E5 > d && 500 < d - options.time && 2 >= options.browserInfo.rqnl) {
- res = new config({
- protocol : options.protocol,
- host : options.host,
- resource : options.resource,
- counterId : options.counterId,
- counterType : options.counterType,
- postParams : options.postParams || [],
- retry : true
- });
- res.send(options.params, options.browserInfo);
- }
- });
- };
- /**
- * @param {string} a
- * @return {?}
- */
- _.fletcher = function(a) {
- var c = a.length;
- /** @type {number} */
- var j = 0;
- /** @type {number} */
- var offset = 255;
- /** @type {number} */
- var _Position_OuterEnd = 255;
- var d;
- var h;
- var k;
- for (; c;) {
- d = 21 < c ? 21 : c;
- /** @type {number} */
- c = c - d;
- do {
- h = "string" == typeof a ? a.charCodeAt(j) : a[j];
- j++;
- if (255 < h) {
- /** @type {number} */
- k = h >> 8;
- /** @type {number} */
- h = h & 255;
- /** @type {number} */
- h = h ^ k;
- }
- offset = offset + h;
- _Position_OuterEnd = _Position_OuterEnd + offset;
- } while (--d);
- /** @type {number} */
- offset = (offset & 255) + (offset >> 8);
- /** @type {number} */
- _Position_OuterEnd = (_Position_OuterEnd & 255) + (_Position_OuterEnd >> 8);
- }
- /** @type {number} */
- a = (offset & 255) + (offset >> 8) << 8 | (_Position_OuterEnd & 255) + (_Position_OuterEnd >> 8);
- return 65535 == a ? 0 : a;
- };
- /**
- * @param {!Object} context
- * @param {string} value
- * @return {?}
- */
- that.encode = function(context, value) {
- /** @type {!Array<string>} */
- var BASE64_CODE = (that.abc + (value ? that.tailSafe : that.tail)).split("");
- var i = context.length;
- /** @type {!Array} */
- var e = [];
- /** @type {number} */
- var k = i - i % 3;
- var j;
- /** @type {number} */
- j = 0;
- for (; j < k; j = j + 3) {
- var c2 = (context[j] << 16) + (context[j + 1] << 8) + context[j + 2];
- _.mergeArrays(e, [BASE64_CODE[c2 >> 18 & 63], BASE64_CODE[c2 >> 12 & 63], BASE64_CODE[c2 >> 6 & 63], BASE64_CODE[c2 & 63]]);
- }
- switch(i - k) {
- case 1:
- /** @type {number} */
- c2 = context[k] << 4;
- _.mergeArrays(e, [BASE64_CODE[c2 >> 6 & 63], BASE64_CODE[c2 & 63], BASE64_CODE[64], BASE64_CODE[64]]);
- break;
- case 2:
- /** @type {number} */
- c2 = (context[k] << 10) + (context[k + 1] << 2);
- _.mergeArrays(e, [BASE64_CODE[c2 >> 12 & 63], BASE64_CODE[c2 >> 6 & 63], BASE64_CODE[c2 & 63], BASE64_CODE[64]]);
- }
- return e.join("");
- };
- /**
- * @param {!Array} array
- * @param {!Function} fn
- * @param {?} that
- * @return {?}
- */
- _.arrayEvery = function(array, fn, that) {
- var i;
- /** @type {number} */
- i = 0;
- for (; i < array.length; i++) {
- if (!fn.call(that, array[i], i, array)) {
- return false;
- }
- }
- return true;
- };
- /**
- * @param {?} value
- * @return {?}
- */
- _.is4Bytes = function(value) {
- return !_.arrayEvery((encodeURIComponent(value).match(/(%[A-F,\d]{2})+/g) || []).join("").split("%"), function(id_local) {
- return 240 > parseInt(id_local, 16);
- });
- };
- /**
- * @param {string} str
- * @param {number} num
- * @return {?}
- */
- _.trim = function(str, num) {
- /** @type {string} */
- str = String(str).replace(/^\s+|\s+$/g, "");
- if (num && str.length > num) {
- /** @type {string} */
- str = str.substr(0, num);
- }
- return str;
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- _.isFunction = function(fn) {
- return "function" === typeof fn;
- };
- /**
- * @param {string} value
- * @return {?}
- */
- _.isNumber = function(value) {
- return isFinite(value) && !isNaN(value) && "[object Number]" == Object.prototype.toString.call(value);
- };
- /**
- * @param {string} val
- * @return {?}
- */
- _.isString = function(val) {
- return "[object String]" == Object.prototype.toString.call(val);
- };
- /**
- * @param {!Array} ary
- * @param {string} val
- * @return {?}
- */
- _.arrayIndexOf = function(ary, val) {
- var i;
- /** @type {number} */
- i = 0;
- for (; i < ary.length; i++) {
- if (ary[i] === val) {
- return i;
- }
- }
- return -1;
- };
- /**
- * @return {undefined}
- */
- _.warning = function() {
- if (window.console && "function" === typeof window.console.warn) {
- console.warn.apply(console, arguments);
- }
- };
- /**
- * @param {!Object} value
- * @return {?}
- */
- _.isObject = function(value) {
- try {
- return value && null !== value && "[object Object]" == Object.prototype.toString.call(value);
- } catch (b) {
- return false;
- }
- };
- /** @type {!RegExp} */
- _._playerRegexp = /^.+\.mtproxy\.yandex\.net$/;
- /**
- * @return {?}
- */
- _.isMetrikaPlayer = function() {
- return "MetrikaPlayer" == window.name || this._playerRegexp.test(window.location.hostname);
- };
- /**
- * @return {?}
- */
- util.getDocumentCharset = function() {
- return ("" + (document.characterSet || document.charset || "")).toLowerCase();
- };
- /**
- * @return {?}
- */
- util.getBody = function() {
- /** @type {!NodeList<Element>} */
- var bodyPaths = document.getElementsByTagName("body");
- for (; 0 < bodyPaths.length;) {
- return bodyPaths[0];
- }
- };
- /**
- * @return {?}
- */
- util.getRootElement = function() {
- /** @type {!Element} */
- var d = document.documentElement;
- var f = util.getBody();
- return "CSS1Compat" == document.compatMode ? d : f || d;
- };
- /**
- * @return {?}
- */
- util.getViewportSize = function() {
- var container = util.getRootElement();
- return [container.clientWidth || window.innerWidth, container.clientHeight || window.innerHeight];
- };
- /**
- * @return {?}
- */
- util.getDocumentTitle = function() {
- /** @type {string} */
- var tmp = document.title;
- if ("string" != typeof tmp) {
- /** @type {string} */
- tmp = (tmp = document.getElementsByTagName("title")) && tmp.length ? tmp[0].innerHTML : "";
- }
- return tmp;
- };
- /** @type {string} */
- $scope._silverlightVersion = "";
- /**
- * @return {?}
- */
- $scope.getSilverlightVersion = function() {
- if (!$scope._silverlightVersion) {
- if (window.ActiveXObject) {
- try {
- var o = new ActiveXObject("AgControl.AgControl");
- /**
- * @param {!Function} a
- * @param {?} v
- * @param {number} i
- * @param {number} n
- * @return {undefined}
- */
- var a = function(a, v, i, n) {
- for (; u(a, v);) {
- v[i] += n;
- }
- v[i] -= n;
- };
- /**
- * @param {!Function} a
- * @param {!Array} b
- * @return {?}
- */
- var u = function(a, b) {
- return a.isVersionSupported(b[0] + "." + b[1] + "." + b[2] + "." + b[3]);
- };
- /** @type {!Array} */
- var label = [1, 0, 0, 0];
- a(o, label, 0, 1);
- a(o, label, 1, 1);
- a(o, label, 2, 1E4);
- a(o, label, 2, 1E3);
- a(o, label, 2, 100);
- a(o, label, 2, 10);
- a(o, label, 2, 1);
- a(o, label, 3, 1);
- /** @type {string} */
- $scope._silverlightVersion = label.join(".");
- } catch (e) {
- }
- } else {
- if (a = window.navigator, a = a.plugins && a.plugins["Silverlight Plug-In"]) {
- /** @type {string} */
- $scope._silverlightVersion = a.description;
- }
- }
- }
- return $scope._silverlightVersion || "";
- };
- /** @type {number} */
- $scope._flashVersion = 0;
- /**
- * @return {?}
- */
- $scope.getFlashVersion = function() {
- if (!$scope._flashVersion) {
- /** @type {!Navigator} */
- var n = window.navigator;
- if ("undefined" != typeof n.plugins && "object" == typeof n.plugins["Shockwave Flash"]) {
- /** @type {!Plugin} */
- var v = n.plugins["Shockwave Flash"];
- var a = v.version;
- if ((v = v.description) || a) {
- if (n = n.mimeTypes, "undefined" == typeof n || !n["application/x-shockwave-flash"] || n["application/x-shockwave-flash"].enabledPlugin) {
- if (a) {
- $scope._flashVersion = a;
- } else {
- if (v) {
- /** @type {string} */
- $scope._flashVersion = v.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".");
- }
- }
- }
- }
- } else {
- if ("undefined" != typeof window.ActiveXObject) {
- try {
- if (a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"), v = a.GetVariable("$version")) {
- $scope._flashVersion = v.split(" ")[1].replace(/,/g, ".").replace(/[^.\d]/g, "");
- }
- } catch (d) {
- }
- }
- }
- }
- return $scope._flashVersion;
- };
- /**
- * @return {?}
- */
- $scope.getLanguage = function() {
- var y = (window.navigator ? navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage : "").toLowerCase();
- return _.isString(y) ? y : "";
- };
- /**
- * @return {?}
- */
- $scope.getJavaEnabled = function() {
- try {
- return navigator.javaEnabled();
- } catch (a) {
- return false;
- }
- };
- /**
- * @param {string} str
- * @return {?}
- */
- _.fnv32a = function(str) {
- /** @type {number} */
- var hval = 2166136261;
- var stringLen;
- /** @type {number} */
- var i = 0;
- stringLen = str.length;
- for (; i < stringLen; ++i) {
- /** @type {number} */
- hval = hval ^ str.charCodeAt(i);
- /** @type {number} */
- hval = hval + ((hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 24));
- }
- return hval >>> 0;
- };
- /**
- * @return {?}
- */
- $scope.getFingerPrint = function() {
- /** @type {!Array} */
- var a = [];
- var i;
- if (navigator.plugins && navigator.plugins.length) {
- /** @type {number} */
- i = 0;
- for (; i < navigator.plugins.length; i++) {
- /** @type {!Plugin} */
- var item = navigator.plugins[i];
- _.mergeArrays(a, [item.name, item.version, item.description, item.filename]);
- }
- }
- if (navigator.mimeTypes && navigator.mimeTypes.length) {
- /** @type {number} */
- i = 0;
- for (; i < navigator.mimeTypes.length; i++) {
- /** @type {!MimeType} */
- item = navigator.mimeTypes[i];
- _.mergeArrays(a, [item.type, item.description, item.suffixes]);
- }
- }
- return _.fnv32a(a.join(";")) + "01";
- };
- /**
- * @return {?}
- */
- $scope.getNotificationPermission = function() {
- try {
- /** @type {string} */
- var permissionState = Notification.permission;
- } catch (b) {
- }
- switch(permissionState) {
- case "denied":
- return 1;
- case "granted":
- return 2;
- }
- };
- /**
- * @return {?}
- */
- $scope.isIframe = function() {
- try {
- return window.top != window.self;
- } catch (a) {
- return false;
- }
- };
- $scope._nMap = {
- other : "0",
- none : "1",
- unknown : "2",
- wifi : "3",
- ethernet : "4",
- bluetooth : "5",
- cellular : "6",
- wimax : "7",
- mixed : "8"
- };
- /**
- * @return {?}
- */
- $scope.netType = function() {
- /** @type {string} */
- var p = (navigator.connection || {
- type : ""
- }).type;
- return $scope._nMap[p] || p;
- };
- /**
- * @return {?}
- */
- $scope.getNavigationStart = function() {
- /** @type {!Performance} */
- var perf = window.performance || window.webkitPerformance;
- return perf && perf.timing && perf.timing.navigationStart;
- };
- /**
- * @return {?}
- */
- $scope.isSameOriginTopFrame = function() {
- try {
- return window.top.contentWindow || true;
- } catch (a) {
- return false;
- }
- };
- /**
- * @param {!Object} self
- * @return {?}
- */
- $scope.isDesktop = function(self) {
- var options = self.get("bt", {});
- if (self.get("bt") === undefined) {
- /** @type {(Promise<BatteryManager>|null)} */
- options.p = navigator.getBattery ? navigator.getBattery() : null;
- self.set("bt", options);
- if (options.p && options.p.then) {
- options.p.then(function(battery) {
- /** @type {boolean} */
- options.v = battery.charging && 0 === battery.chargingTime;
- });
- }
- }
- return options.v;
- };
- /**
- * @param {!Function} data
- * @return {undefined}
- */
- self.ready = function(data) {
- /** @type {string} */
- var readyState = document.readyState;
- if ("interactive" === readyState || "complete" === readyState) {
- _.setTimeout(data, 0, "evt::ready");
- } else {
- /**
- * @return {undefined}
- */
- var handler = function() {
- self.un(document, "DOMContentLoaded", handler);
- self.un(window, "load", handler);
- data();
- };
- self.on(document, "DOMContentLoaded", handler);
- self.on(window, "load", handler);
- }
- };
- var a = {
- url : options.protocol + "//" + options.host + "/metrika/",
- _value : null,
- init : function(s) {
- var newState = this._getLs().read("isad");
- this.globalConfig = s || api;
- if (newState) {
- this._set(newState);
- } else {
- if (!this._getReqStatus()) {
- this._send();
- }
- }
- },
- getVal : function() {
- return this._value;
- },
- _set : function(value) {
- this._value = "1" == value || "2" == value ? value : null;
- },
- _send : function() {
- var channel_collection = this;
- this._setReqStatus("process");
- self.ready(function() {
- /** @type {!Element} */
- var b = document.createElement("img");
- /**
- * @return {undefined}
- */
- b.onload = function() {
- channel_collection._saveReq(false);
- util.removeNode(this);
- };
- /**
- * @return {undefined}
- */
- b.onerror = function() {
- channel_collection._saveReq(true);
- util.removeNode(this);
- };
- /** @type {string} */
- b.src = channel_collection.url + String.fromCharCode(97, 100, 118, 101, 114, 116, 46, 103, 105, 102);
- if ($scope.isSafari()) {
- /** @type {string} */
- b.style.position = "absolute";
- /** @type {string} */
- b.style.visibility = "hidden";
- /** @type {string} */
- b.style.width = "0px";
- /** @type {string} */
- b.style.height = "0px";
- util.getRootElement().appendChild(b);
- }
- });
- },
- _saveReq : function(value) {
- /** @type {string} */
- this._value = value = value ? "1" : "2";
- this._setReqStatus("complete");
- this._getLs().create("isad", value, 1200);
- },
- _setReqStatus : function(fn) {
- try {
- this.globalConfig.set("adStatus", fn);
- } catch (b) {
- }
- },
- _getReqStatus : function() {
- try {
- return this.globalConfig.get("adStatus");
- } catch (a) {
- return "complete";
- }
- },
- _getLs : function() {
- if (!this._ls) {
- this._ls = new Error;
- }
- return this._ls;
- }
- };
- var base64 = {
- encode : function(s) {
- /** @type {!Array} */
- var buff = [];
- var l;
- /** @type {number} */
- var i = 0;
- l = s.length;
- for (; i < l; i++) {
- var c = s.charCodeAt(i);
- if (128 > c) {
- buff.push(c);
- } else {
- if (127 < c && 2048 > c) {
- buff.push(c >> 6 | 192);
- } else {
- buff.push(c >> 12 | 224);
- buff.push(c >> 6 & 63 | 128);
- }
- buff.push(c & 63 | 128);
- }
- }
- return buff;
- },
- decode : function(a) {
- /** @type {string} */
- var s = "";
- /** @type {number} */
- var i = 0;
- var c;
- var e;
- var f;
- for (; i < a.length;) {
- c = a.charCodeAt(i);
- if (128 > c) {
- /** @type {string} */
- s = s + String.fromCharCode(c);
- i++;
- } else {
- if (191 < c && 224 > c) {
- e = a.charCodeAt(i + 1);
- /** @type {string} */
- s = s + String.fromCharCode((c & 31) << 6 | e & 63);
- /** @type {number} */
- i = i + 2;
- } else {
- e = a.charCodeAt(i + 1);
- f = a.charCodeAt(i + 2);
- /** @type {string} */
- s = s + String.fromCharCode((c & 15) << 12 | (e & 63) << 6 | f & 63);
- /** @type {number} */
- i = i + 3;
- }
- }
- }
- return s;
- }
- };
- /**
- * @param {string} e
- * @param {string} isSelected
- * @return {?}
- */
- that.decode = function(e, isSelected) {
- /** @type {string} */
- var related_node_ids = that.abc + (isSelected ? that.tailSafe : that.tail);
- /** @type {number} */
- var i = 0;
- /** @type {string} */
- var output = "";
- var byte1;
- var byte2;
- var byte3;
- var WORK;
- var encoded4;
- for (; e.length % 4;) {
- /** @type {string} */
- e = e + "=";
- }
- do {
- /** @type {number} */
- byte1 = related_node_ids.indexOf(e.charAt(i++));
- /** @type {number} */
- byte2 = related_node_ids.indexOf(e.charAt(i++));
- /** @type {number} */
- WORK = related_node_ids.indexOf(e.charAt(i++));
- /** @type {number} */
- encoded4 = related_node_ids.indexOf(e.charAt(i++));
- if (0 > byte1 || 0 > byte2 || 0 > WORK || 0 > encoded4) {
- return null;
- }
- /** @type {number} */
- byte3 = byte1 << 18 | byte2 << 12 | WORK << 6 | encoded4;
- /** @type {number} */
- byte1 = byte3 >> 16 & 255;
- /** @type {number} */
- byte2 = byte3 >> 8 & 255;
- /** @type {number} */
- byte3 = byte3 & 255;
- /** @type {string} */
- output = 64 == WORK ? output + String.fromCharCode(byte1) : 64 == encoded4 ? output + String.fromCharCode(byte1, byte2) : output + String.fromCharCode(byte1, byte2, byte3);
- } while (i < e.length);
- return output;
- };
- /**
- * @param {!Function} fun
- * @param {string} val
- * @param {!Array} obj
- * @return {?}
- */
- _.reduce = function(fun, val, obj) {
- /** @type {number} */
- var i = 0;
- if (val == undefined) {
- val = obj[0];
- i++;
- }
- for (; i < obj.length;) {
- val = fun(val, obj[i]);
- i++;
- }
- return val;
- };
- /**
- * @param {!Function} func
- * @param {!Array} array
- * @return {?}
- */
- _.filter = function(func, array) {
- var i;
- /** @type {!Array} */
- var ret = [];
- /** @type {number} */
- i = 0;
- for (; i < array.length; i++) {
- if (func(array[i])) {
- ret.push(array[i]);
- }
- }
- return ret;
- };
- /**
- * @param {string} args
- * @return {?}
- */
- service.parse = function(args) {
- try {
- return JSON.parse(args);
- } catch (b) {
- return null;
- }
- };
- var Container = config.inherit({
- hitId : 0,
- trackHash : false,
- trimParams : false,
- webvisor : false,
- counter : null,
- counterNum : 0,
- resource : "watch",
- retry : true,
- paramsQueue : {
- paramsQueue : [],
- length : function() {
- return this.paramsQueue.length;
- },
- push : function(key) {
- this.paramsQueue.push(key);
- },
- _reduce : function(values) {
- return function(conf, extras) {
- _.arrayEvery(_.keys(extras), function(prop) {
- if (conf.hasOwnProperty(prop)) {
- return 1;
- }
- if (-1 == _.arrayIndexOf(values, prop)) {
- conf[prop] = extras[prop];
- delete extras[prop];
- }
- return 1;
- });
- return conf;
- };
- },
- _filter : function(filters) {
- return _.keys(filters).length;
- },
- mixin : function(obj) {
- var parameters = {};
- if (this.paramsQueue.length) {
- parameters = _.reduce(this._reduce(_.keys(obj)), {}, this.paramsQueue);
- this.paramsQueue = _.filter(this._filter, this.paramsQueue);
- }
- return _.mixin({}, obj, parameters);
- }
- },
- postParams : ["site-info"],
- countersNoTitle : "22836271 1143050 29626870 9928105 26128362 29850769".split(" "),
- fake : false,
- sendTitle : true,
- _initComponent : function() {
- Container.superclass._initComponent.apply(this, arguments);
- this._trackHash = this.trackHash;
- if ("0" === "" + this.counterType) {
- /** @type {boolean} */
- this.sendTitle = -1 === _.arrayIndexOf(this.countersNoTitle, "" + this.counterId);
- }
- },
- setTrackHash : function(prop) {
- /** @type {boolean} */
- this._trackHash = prop;
- },
- sendHit : function(options) {
- this._hitExt({
- url : options.url,
- title : options.title,
- referrer : options.referrer,
- vParams : options.vParams,
- modes : _.mixin(options.modes || {}, {
- ar : true,
- saveRef : true,
- pv : true
- }),
- callback : options.callback,
- ctx : options.ctx
- }, "hit");
- },
- sendExperiments : function(data) {
- this._hitExt({
- url : parse().href,
- title : "",
- referrer : "",
- modes : {
- ex : true,
- ar : true
- },
- experiments : data.experiments,
- callback : data.callback,
- ctx : data.ctx
- }, "exp");
- },
- sendPrerenderHit : function(data) {
- this._hitExt({
- url : data.url,
- title : data.title,
- referrer : data.referrer,
- modes : {
- ar : true,
- pq : true
- }
- }, "hit");
- },
- sendAjaxHit : function(data) {
- this._hitExt({
- url : data.url,
- title : data.title,
- referrer : data.referrer,
- modes : data.modes
- }, "hit");
- },
- sendParams : function(params, key, message) {
- this._hitExt({
- url : parse().href,
- title : "",
- referrer : "",
- forceNoRedirect : true,
- vParams : params,
- modes : {
- ar : true,
- pa : true,
- onlyData : true
- },
- callback : key,
- ctx : message
- }, "pa");
- },
- sendGoal : function(a, opts) {
- if (/[/&=?#]/.test(a)) {
- _.warning("Incorrect goal");
- } else {
- if (a) {
- var data = parse();
- this._hitExt({
- url : "goal://" + data.hostname + "/" + encodeURIComponent(a),
- title : util.getDocumentTitle(),
- referrer : data.href,
- forceNoRedirect : true,
- vParams : opts.vParams,
- modes : {
- ar : true
- },
- callback : opts.callback,
- ctx : opts.ctx
- }, "go");
- } else {
- _.warning("Empty goal");
- }
- }
- },
- sendClickLink : function(view) {
- this._hitExt({
- url : view.url,
- title : view.title,
- referrer : parse().href,
- modes : view.modes
- });
- },
- sendExtLink : function(options) {
- this._hitExt({
- url : options.url,
- title : options.title || "",
- referrer : parse().href,
- vParams : options.vParams,
- modes : {
- ar : true,
- ln : true,
- ut : up
- },
- callback : options.callback,
- ctx : options.ctx
- }, "cl");
- },
- sendFileUpload : function(options) {
- this._hitExt({
- url : options.url,
- title : options.title || "",
- referrer : parse().href,
- vParams : options.vParams,
- modes : {
- ar : true,
- ln : true,
- dl : true
- },
- callback : options.callback,
- ctx : options.ctx
- }, "fu");
- },
- sendNotBounce : function(className, context) {
- this._hitExt({
- url : parse().href,
- title : "",
- referrer : "",
- modes : {
- cl : className,
- ar : true,
- nb : true,
- onlyData : true
- },
- callback : context.callback,
- ctx : context.ctx
- }, "nb");
- },
- sendDevice : function(context) {
- this._hitExt({
- browserInfo : {
- di : context.data,
- dip : context.port
- },
- callback : context.callback,
- ctx : context.ctx
- }, "de");
- },
- _hitExt : function(data, key) {
- /**
- * @param {string} name
- * @param {!Object} a
- * @return {undefined}
- */
- function callback(name, a) {
- if (a) {
- /** @type {!Object} */
- body[name] = a;
- }
- }
- var header;
- var value;
- var g;
- var info = {};
- if (!_.isMetrikaPlayer()) {
- var item = data.modes || {};
- var res = data.browserInfo || {};
- var url = "undefined" !== typeof data.referrer ? data.referrer : message.lastReferrer;
- var v = data.url || "";
- var body = {};
- if (data.nohit) {
- callback("nohit", 1);
- }
- if (item.ar && !item.onlyData) {
- url = null === url || "" === url ? "" : this._prepareHitUrl(url);
- v = this._prepareHitUrl(data.url);
- }
- callback("forceNoRedirect", data.forceNoRedirect);
- callback("page-ref", _.trim(url, batch));
- callback("page-url", _.trim(v, batch));
- if (_.is4Bytes(data.title)) {
- callback("charset", "utf-8");
- }
- if (-1 != parse().hostname.search(/(?:^|\.)(?:ya|yandex)\.(?:\w+|com?\.\w+)$/)) {
- callback("ut", up);
- } else {
- if ("undefined" != typeof item.ut) {
- callback("ut", _.trim(item.ut, opts));
- }
- }
- callback("exp", data.experiments);
- if ((value = data.vParams) && value.__ym) {
- if (_.isNumber(value.__ym.turbo_page)) {
- info.tp = value.__ym.turbo_page;
- }
- if (_.isNumber(value.__ym.turbo_page_id)) {
- info.tpid = value.__ym.turbo_page_id;
- }
- }
- if ((!value || _.isObject(value) && !value.__ym && !value.__ymu) && this.paramsQueue.length() && _.inArray(["go", "hit", "pa"], key)) {
- value = this.paramsQueue.mixin(value);
- }
- if (value) {
- v = _.toJSON(value);
- if (this.trimParams && v.length > polymorphLimit) {
- /** @type {boolean} */
- g = true;
- } else {
- callback("site-info", v);
- }
- }
- if (item.saveRef) {
- message.lastReferrer = url;
- }
- info = function(date, handlers) {
- var options = {};
- _.forEachKey(handlers, function(operator, value) {
- if (-1 === _.arrayIndexOf(["", undefined, null], value)) {
- /** @type {string} */
- options[operator] = value;
- }
- });
- return _.mixin({}, date, options);
- }(info, {
- gdpr : img.getState(this.globalConfig),
- eu : this.globalConfig.get("isEU"),
- v : this._getVersion()
- });
- if (!this.fake) {
- header = this._getTechInfo(data.title, item, this.counterId, data.ts, data.tz, this._trackHash, this.hitId, this.webvisor, this.counter, data.nohit);
- }
- _.mixin(res, header, info);
- this.send(body, res, function() {
- if (g) {
- this.counter.params(value);
- }
- if (data.userParams) {
- this.counter.userParams(data.userParams);
- }
- if (_.isFunction(data.callback)) {
- data.callback.apply(data.ctx, arguments);
- }
- }, this);
- }
- },
- _prepareHitUrl : function(text) {
- var url = parse();
- var params = url.host;
- url = url.href;
- if (!_.isString(text)) {
- return url;
- }
- if (-1 != text.search(/^[a-z][\w.+-]+:\/\//i)) {
- return text;
- }
- var start = text.charAt(0);
- if ("?" == start) {
- return start = url.search(/\?/), -1 == start ? url + text : url.substr(0, start) + text;
- }
- if ("#" == start) {
- return start = url.search(/#/), -1 == start ? url + text : url.substr(0, start) + text;
- }
- if ("/" == start) {
- if (start = url.search(params), -1 != start) {
- return url.substr(0, start + params.length) + text;
- }
- } else {
- return params = url.split("/"), params[params.length - 1] = text, params.join("/");
- }
- return text;
- },
- _getTechInfo : function(type, data, c, i, row, name, s, index, target, propertiesToClear) {
- /**
- * @param {string} name
- * @param {!Object} value
- * @param {boolean} range
- * @return {undefined}
- */
- function $(name, value, range) {
- /** @type {string} */
- var id = "" + value;
- if (name && value && (range || -1 === id.indexOf(":"))) {
- /** @type {string} */
- clsNameMap[name] = id;
- }
- }
- /**
- * @param {string} status
- * @return {undefined}
- */
- function equal(status) {
- if (data[status]) {
- $(status, "1");
- }
- }
- var clsNameMap = {};
- data = data || {};
- i = i || context.getTimestamp();
- row = row || context.getTimezone();
- $("j", $scope.getJavaEnabled() ? "1" : "");
- var resolution = $scope.isDesktop(this.globalConfig);
- if (resolution !== undefined) {
- $("dp", resolution ? "1" : "0");
- }
- $("nt", $scope.netType());
- $("ns", $scope.getNavigationStart());
- if (screen) {
- $("s", screen.width + "x" + screen.height + "x" + (screen.colorDepth || screen.pixelDepth));
- }
- if (window.devicePixelRatio) {
- $("sk", window.devicePixelRatio);
- }
- if ($scope.isIframe()) {
- $("ifr", "1");
- $("sti", $scope.isSameOriginTopFrame() ? "1" : "0");
- }
- if (window.ia_document && window.ia_document.shareURL && window.ia_document.referrer) {
- $("iia", "1");
- }
- $("adb", a.getVal());
- $("f", $scope.getFlashVersion());
- $("l", $scope.getSilverlightVersion());
- $("fpr", $scope.getFingerPrint());
- $("cn", this.counterNum);
- if (!data.pa) {
- resolution = util.getViewportSize();
- $("w", resolution[0] + "x" + resolution[1]);
- }
- $("z", row);
- $("i", i);
- $("et", context.getSeconds());
- $("en", util.getDocumentCharset());
- $("c", navigator.cookieEnabled ? "1" : "");
- $("la", $scope.getLanguage());
- $("ntf", $scope.getNotificationPermission());
- if (!_.random(100)) {
- $("np", that.encode(base64.encode(_.trim($scope.getPlatform(), 100))));
- }
- if (name) {
- $("wh", "1");
- }
- /** @type {!Array<string>} */
- row = "ar ln dl cpf ad nb pa pq pv ex".split(" ");
- /** @type {number} */
- i = 0;
- for (; i < row.length; i++) {
- equal(row[i]);
- }
- /** @type {!Array<string>} */
- row = "va vt sn sa he fu".split(" ");
- if (data.nb) {
- row.push("cl");
- }
- /** @type {number} */
- i = 0;
- for (; i < row.length; i++) {
- /** @type {string} */
- name = row[i];
- $(name, data[name]);
- }
- row = new Array({
- counterId : c
- });
- if (row.isEnabled()) {
- c = row.getStorageId();
- i = row.get("reqNum");
- if (!propertiesToClear) {
- if (i) {
- i++;
- } else {
- /** @type {number} */
- i = 1;
- }
- }
- row.set("reqNum", i);
- if (row.get("reqNum") == i) {
- $("ls", c);
- $("rqn", i);
- } else {
- row.remove("reqNum");
- row.clearStorageId();
- if (1 < i) {
- $("ls", c);
- $("rqn", 0);
- }
- }
- }
- $("rn", _.random());
- $("hid", s);
- $("ds", assign(target));
- if (!target._firstPaint) {
- target._firstPaint = draw();
- $("fp", target._firstPaint);
- }
- if (index) {
- if (!window.name) {
- /** @type {number} */
- window.name = Math.round(65535 * Math.random());
- }
- if (s = +window.name) {
- if (0 > s) {
- /** @type {number} */
- s = s * -1;
- }
- /** @type {number} */
- s = s % 65535;
- }
- $("wn", s || _.fletcher(window.name));
- try {
- if (window.history) {
- $("hl", String(window.history.length));
- }
- } catch (Ma) {
- }
- }
- /** @type {string} */
- s = "";
- if (this.sendTitle) {
- s = this._getTitle(type);
- }
- $("t", s, true);
- return clsNameMap;
- },
- _getTitle : function(data) {
- data = "undefined" == typeof data ? (data = util.getDocumentTitle()) ? _.trim(data, depth) : "" : _.trim(data, depth);
- return data;
- }
- });
- /**
- * @param {!Array} s
- * @return {?}
- */
- _.array2Props = function(s) {
- var n = s.length;
- var HHgText = {};
- var t = HHgText;
- var i;
- /** @type {number} */
- i = 0;
- for (; i < n - 1; i++) {
- var k = s[i];
- t[k] = {};
- if (i < n - 2) {
- t = t[k];
- }
- }
- t[k] = s[n - 1];
- return HHgText;
- };
- var Event = Class.inherit({
- sampling : 1,
- counterId : 26302566,
- _initComponent : function() {
- Event.superclass._initComponent.apply(this, arguments);
- this._sender = new Container({
- protocol : "https:",
- counterId : this.counterId,
- retry : false,
- counter : {}
- });
- },
- log : function() {
- this.logParams(_.array2Props(arguments));
- },
- logParams : function(partKeys) {
- if (Math.random() < this.sampling) {
- this._sender.sendHit({
- url : result.href,
- title : "",
- referrer : "",
- vParams : partKeys
- });
- }
- }
- });
- var FirewallRule = config.inherit({
- resource : "webvisor",
- retry : true,
- postParams : ["wv-data"],
- sendPacket : function(name, callback, options, instance, data, type, id, cb) {
- if (!name || !name.length) {
- return false;
- }
- var mergeName = that.encode(name, true);
- if (0 == mergeName.indexOf("AAAAAAAAADw") && window.Error) {
- /** @type {!Error} */
- var error = Error();
- if ("string" == typeof error.stack) {
- (new Event({
- sampling : .1
- })).log("bad visor packet 5", 1);
- }
- }
- name = {
- rn : _.random(),
- "page-url" : callback,
- wmode : 0,
- "wv-type" : 0,
- "wv-hit" : options,
- "wv-part" : instance + 1,
- "wv-check" : _.fletcher(name),
- "wv-data" : mergeName
- };
- data = {
- v : this._getVersion(),
- z : data,
- i : type
- };
- return this.send(name, data, id, cb);
- }
- });
- var Model = A.inherit({
- protocol : "",
- counterId : "",
- counterType : "",
- meta : null,
- maxBufferSize : 7500,
- flushTimeout : 3E4,
- storageKey : "visorbuff",
- active : false,
- _initComponent : function() {
- this.storage = new Array({
- counterId : this.counterId
- });
- this._sender = new FirewallRule({
- globalConfig : this.globalConfig,
- protocol : this.protocol,
- counterId : this.counterId,
- counterType : this.counterType
- });
- Model.superclass._initComponent.apply(this, arguments);
- },
- onFlush : function(type, data, callback) {
- this._sender.sendPacket(type, data.url, data.hitId, callback, data.timezone, data.timestamp);
- }
- });
- var ConsoleController = config.inherit({
- resource : "webvisor",
- transports : [inputs, ret],
- postParams : ["wv-data"],
- sendContent : function(res, callback, content, req, e, context, body) {
- if (!res) {
- return false;
- }
- if (-1 < res.indexOf("\r")) {
- res = res.replace(/\r\n/g, "\n");
- }
- res = {
- "wv-type" : 1,
- "page-url" : parse().href,
- "wv-hit" : content,
- "wv-data" : that.encode(base64.encode(res))
- };
- return 245E3 < res["wv-data"].length ? false : this.send(res, {
- z : req,
- i : e,
- pct : callback || ""
- }, context, body);
- }
- });
- /**
- * @return {?}
- */
- util.getDocumentHTML = function() {
- /** @type {string} */
- var a = "";
- /** @type {!Element} */
- var e = document.documentElement;
- /** @type {string} */
- var elem = e.outerHTML;
- var j;
- var data;
- if (elem) {
- /** @type {string} */
- e = elem;
- } else {
- /** @type {!NamedNodeMap<Attr>} */
- elem = e.attributes;
- /** @type {string} */
- var token = "";
- /** @type {number} */
- j = 0;
- for (; j < elem.length; j++) {
- if (data = elem[j]) {
- /** @type {string} */
- token = token + (" " + data.name + '="' + (data.value || "") + '"');
- }
- }
- /** @type {string} */
- e = "<html" + token + ">" + e.innerHTML + "</html>";
- }
- if (elem = document.doctype) {
- /** @type {string} */
- a = elem.publicId ? ' PUBLIC "' + elem.publicId + '"' : "";
- /** @type {string} */
- token = elem.systemId ? ' "' + elem.systemId + '"' : "";
- /** @type {string} */
- a = "<!DOCTYPE " + elem.name + a + token + ">\n";
- }
- return a + e;
- };
- /**
- * @return {?}
- */
- util.getDocumentScroll = function() {
- var body = util.getBody();
- return [window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || body && body.scrollLeft || 0, window.pageYOffset || document.documentElement && document.documentElement.scrollTop || body && body.scrollTop || 0];
- };
- /**
- * @param {!HTMLElement} el
- * @return {?}
- */
- util.getElementParent = function(el) {
- if (!el || el == document.documentElement) {
- return null;
- }
- if (el == util.getBody()) {
- return document.documentElement;
- }
- /** @type {null} */
- var elExt = null;
- try {
- elExt = el.parentNode;
- } catch (c) {
- }
- return elExt;
- };
- /**
- * @param {!Node} element
- * @param {boolean} name
- * @return {?}
- */
- util.getElementChildren = function(element, name) {
- /** @type {!Array} */
- var defaultOptions = [];
- var childNodes;
- var e;
- var length;
- if (element && (childNodes = element.childNodes)) {
- /** @type {number} */
- var i = 0;
- length = childNodes.length;
- for (; i < length; i++) {
- var node = childNodes[i];
- if (!((e = "INPUT" == node.nodeName && node.type && "hidden" == node.type.toLocaleLowerCase()) || name && node.nodeName != name)) {
- _.mergeArrays(defaultOptions, [node]);
- }
- }
- }
- return defaultOptions;
- };
- /**
- * @param {!Object} target
- * @return {?}
- */
- util.getElementNeighborPosition = function(target) {
- var items = util.getElementParent(target);
- var i;
- if (items) {
- /** @type {number} */
- var d = 0;
- items = items.childNodes;
- var stripTerrain = target && target.nodeName;
- /** @type {number} */
- i = 0;
- for (; i < items.length; i++) {
- var river = items[i] && items[i].nodeName;
- if (stripTerrain == river) {
- if (target == items[i]) {
- return d;
- }
- d++;
- }
- }
- }
- return 0;
- };
- /**
- * @param {!Object} el
- * @return {?}
- */
- util.getElementXY = function(el) {
- var ctop;
- if (!el || !el.ownerDocument || "PARAM" == el.tagName || el == util.getBody() || el == document.documentElement) {
- return [0, 0];
- }
- if (el.getBoundingClientRect) {
- el = el.getBoundingClientRect();
- var offset = util.getDocumentScroll();
- return [Math.round(el.left + offset[0]), Math.round(el.top + offset[1])];
- }
- /** @type {number} */
- ctop = offset = 0;
- for (; el;) {
- offset = offset + el.offsetLeft;
- ctop = ctop + el.offsetTop;
- el = el.offsetParent;
- }
- return [offset, ctop];
- };
- /**
- * @return {?}
- */
- util.getDocumentSize = function() {
- var relElement = util.getRootElement();
- var cloneLengths = util.getViewportSize();
- return [Math.max(relElement.scrollWidth, cloneLengths[0]), Math.max(relElement.scrollHeight, cloneLengths[1])];
- };
- /**
- * @param {!HTMLElement} element
- * @return {?}
- */
- util.getElementSize = function(element) {
- var cssChanges;
- return element == util.getBody() || element == document.documentElement ? util.getDocumentSize() : (cssChanges = element.getBoundingClientRect && element.getBoundingClientRect()) ? [cssChanges.width, cssChanges.height] : [element.offsetWidth, element.offsetHeight];
- };
- /**
- * @param {string} container
- * @return {?}
- */
- util.getElementRegion = function(container) {
- var allBlock = util.getElementXY(container);
- container = util.getElementSize(container);
- return [allBlock[0], allBlock[1], container[0], container[1]];
- };
- /**
- * @param {!Object} a
- * @return {?}
- */
- util.calcChildrenChecksum = function(a) {
- var docstr = require(function() {
- return a.innerHTML;
- }, "", true)() || "";
- return _.fletcher(docstr.replace(/(<[^>]*>|[\u0000-\u0020])/g, ""));
- };
- /**
- * @param {!Element} b
- * @return {?}
- */
- util.getFormNumber = function(b) {
- /** @type {!NodeList<Element>} */
- var results = document.getElementsByTagName("form");
- var distance;
- /** @type {number} */
- var length = 0;
- /** @type {number} */
- distance = results.length;
- for (; length < distance; length++) {
- if (results[length] == b) {
- return length;
- }
- }
- return -1;
- };
- /**
- * @param {!Element} a
- * @return {?}
- */
- util.isEmptyField = function(a) {
- return "INPUT" == a.nodeName && "submit" != a.type && "image" != a.type && "hidden" != a.type ? "radio" == a.type || "checkbox" == a.type ? !a.checked : !a.value : "TEXTAREA" == a.nodeName ? !a.value : "SELECT" == a.nodeName ? 0 > a.selectedIndex : true;
- };
- /**
- * @param {!Object} items
- * @return {?}
- */
- util.calcTextChecksum = function(items) {
- /** @type {string} */
- var str2 = "";
- items = items.childNodes;
- var l;
- /** @type {number} */
- var i = 0;
- l = items.length;
- for (; i < l; i++) {
- if (items[i] && 3 == items[i].nodeType) {
- /** @type {string} */
- str2 = str2 + items[i].nodeValue;
- }
- }
- return _.fletcher(str2.replace(/[\u0000-\u0020]+/g, ""));
- };
- /**
- * @param {!Object} el
- * @return {?}
- */
- util.calcAttribChecksum = function(el) {
- /** @type {string} */
- var latestLineText = "";
- /** @type {!Array<string>} */
- var cells = "width height align title alt name".split(" ");
- var i;
- if ("IMG" == el.tagName) {
- latestLineText = latestLineText + el.src.toLowerCase();
- }
- if ("A" == el.tagName) {
- latestLineText = latestLineText + el.href.toLowerCase();
- }
- /** @type {string} */
- latestLineText = latestLineText + String(el.className || "").toLowerCase();
- /** @type {number} */
- i = 0;
- for (; i < cells.length; i++) {
- if (el.getAttribute) {
- /** @type {string} */
- latestLineText = latestLineText + String(el.getAttribute(cells[i]) || "").toLowerCase();
- }
- }
- return _.fletcher(latestLineText.replace(/[\u0000-\u0020]+/g, ""));
- };
- /**
- * @param {!Object} a
- * @param {string} fn
- * @return {?}
- */
- util.classNameExists = function(a, fn) {
- try {
- return (new RegExp("(?:^|\\s)" + fn + "(?:\\s|$)")).test(a.className);
- } catch (c) {
- return false;
- }
- };
- /**
- * @param {string} name
- * @param {string} context
- * @return {?}
- */
- util.getElementsByClassName = function(name, context) {
- var i;
- context = context || document;
- var files = context.getElementsByTagName("*");
- /** @type {!Array} */
- var result = [];
- /** @type {number} */
- i = 0;
- for (; i < files.length; i++) {
- if (util.classNameExists(files[i], name)) {
- result.push(files[i]);
- }
- }
- return result;
- };
- /**
- * @param {!Array} array
- * @param {!Function} fn
- * @param {?} that
- * @return {?}
- */
- _.arrayFilter = function(array, fn, that) {
- /** @type {!Array} */
- var ret = [];
- var i;
- /** @type {number} */
- i = 0;
- for (; i < array.length; i++) {
- if (fn.call(that, array[i], i, array)) {
- ret.push(array[i]);
- }
- }
- return ret;
- };
- /**
- * @param {!Array} b
- * @param {!Array} a
- * @return {?}
- */
- _.arrDiff = function(b, a) {
- return _.arrayFilter(b, function(type) {
- return -1 === _.arrayIndexOf(a, type);
- });
- };
- /**
- * @param {string} x
- * @param {number} value
- * @return {?}
- */
- _.encodeURIComponent = function(x, value) {
- /** @type {string} */
- x = String(x);
- if (value && x.length > value) {
- /** @type {string} */
- x = x.substr(0, value);
- }
- return (window.encodeURIComponent || window.escape)(x).replace(/\+/g, "%2B");
- };
- /**
- * @param {!Function} callback
- * @param {!Object} context
- * @return {?}
- */
- _.bind = function(callback, context) {
- /** @type {!Array<?>} */
- var headArgs = [].slice.call(arguments, 2);
- return function() {
- return callback.apply(context || this, headArgs.concat([].slice.call(arguments, 0)));
- };
- };
- /**
- * @param {?} id
- * @return {?}
- */
- _.clearTimeout = function(id) {
- return _.getNativeFunction("clearTimeout")(id);
- };
- /** @type {null} */
- _._urlParser = null;
- /**
- * @param {string} url
- * @return {?}
- */
- _.parseUrl = function(url) {
- if (!this._urlParser) {
- try {
- /** @type {!Element} */
- this._urlParser = document.createElement("a");
- } catch (b) {
- }
- }
- return this._urlParser ? (this._urlParser.href = url, {
- protocol : this._urlParser.protocol,
- host : this._urlParser.host,
- port : this._urlParser.port,
- hostname : this._urlParser.hostname,
- hash : this._urlParser.hash,
- search : this._urlParser.search,
- query : this._urlParser.search.replace(/^\?/, ""),
- pathname : this._urlParser.pathname || "/",
- path : (this._urlParser.pathname || "/") + this._urlParser.search,
- href : this._urlParser.href
- }) : {};
- };
- /**
- * @param {string} str
- * @return {?}
- */
- _.safeDecodeURIComponent = function(str) {
- try {
- return decodeURIComponent(str);
- } catch (b) {
- return "";
- }
- };
- /**
- * @return {?}
- */
- _.isDev = function() {
- return false;
- };
- var Cb = !split(/webkit/) && split(/gecko/);
- var Schema = Class.inherit({
- hid : 0,
- tz : 0,
- ts : 0,
- counterId : 0,
- counterType : 0,
- url : "",
- protocol : "",
- enabled : false,
- _initComponent : function() {
- if (this.isEnabled()) {
- var location = this._getStorage();
- var v = location.read("visorc");
- if ("b" !== v && "w" !== v) {
- /** @type {string} */
- v = "";
- }
- if (!location.isEnabled() || split("opera mini")) {
- /** @type {string} */
- v = "b";
- }
- this._vc = v;
- if ("b" !== v) {
- this._recorder = new init(this.protocol, this.counterId, this.counterType, this.hid, this.globalConfig);
- }
- Schema.superclass._initComponent.apply(this, arguments);
- }
- },
- start : function(value) {
- if (this.isEnabled() && this._recorder) {
- value = value || {};
- /** @type {number} */
- var b = +value.recp;
- if (!isFinite(b) || 0 > b || 1 < b) {
- /** @type {string} */
- var width = "w";
- }
- if (!width) {
- /** @type {string} */
- width = this.hid % 1E4 / 1E4 < b ? "w" : "b";
- }
- this._getStorage().create("visorc", width, 30);
- if ("w" === width) {
- this._recorder.start();
- b = value.arch_type;
- if ((value = value.urls) && b && "none" !== b) {
- this._recorder.uploadPages(value, b);
- }
- } else {
- this._recorder.stop();
- }
- }
- },
- stop : function() {
- if (this._recorder) {
- this._recorder.stop();
- }
- },
- isEnabled : function() {
- /** @type {boolean} */
- var probe = !this.globalConfig.get("oo");
- return this.enabled && probe;
- },
- getVc : function() {
- return this._vc;
- },
- _getStorage : function() {
- if (!this._storage) {
- this._storage = new Error({
- counterId : this.counterId
- });
- }
- return this._storage;
- }
- });
- /**
- * @param {?} data
- * @param {!Object} win
- * @return {?}
- */
- util.loadScript = function(data, win) {
- win = win || window;
- var options = _.mixin({
- type : "text/javascript",
- charset : "utf-8",
- async : true
- }, data);
- var document = win.document;
- var el = _.getNativeFunction("createElement", document);
- var s = el("script");
- if (s) {
- s.type = options.type;
- s.charset = options.charset;
- s.src = options.src;
- if (options.async) {
- /** @type {boolean} */
- s.async = true;
- }
- try {
- var container = document.getElementsByTagName("head")[0];
- if (!container) {
- var accordion4 = document.getElementsByTagName("html")[0];
- container = el("head");
- if (accordion4) {
- accordion4.appendChild(container);
- }
- }
- container.insertBefore(s, container.firstChild);
- return s;
- } catch (G) {
- }
- }
- };
- httpModule = $.inherit({
- id : "script",
- index : 6,
- request : function(url, obj, message, stream) {
- /** @type {boolean} */
- var inNext = false;
- var node = _.getNativeFunction("createElement", document)("script");
- if (this.timeout) {
- _.setTimeout(function() {
- if (!inNext) {
- /** @type {boolean} */
- inNext = true;
- util.removeNode(node);
- message.call(stream, false);
- }
- }, this.timeout, "ts.request");
- }
- if (!node) {
- return inNext = true, message.call(stream, false), false;
- }
- /** @type {string} */
- var key = "_ymjsp" + _.random();
- window[key] = require(function() {
- if (!inNext) {
- try {
- delete window[key];
- } catch (G) {
- window[key] = undefined;
- }
- message.apply(stream, _.mergeArrays([true], arguments));
- /** @type {boolean} */
- inNext = true;
- util.removeNode(node);
- }
- }, "transport.script");
- /** @type {string} */
- node.type = "text/javascript";
- node.src = this._buildUrl(url, _.mixin({
- wmode : 5,
- callback : key
- }, obj));
- /** @type {string} */
- node.async = "async";
- /** @type {!Element} */
- var head = document.getElementsByTagName("head")[0];
- if (!head) {
- /** @type {!Element} */
- head = document.createElement("head");
- document.documentElement.appendChild(head);
- }
- _.async(function() {
- head.insertBefore(node, head.firstChild);
- });
- /**
- * @return {undefined}
- */
- node.onerror = function() {
- /** @type {boolean} */
- inNext = true;
- message.call(stream, false);
- window[key] = undefined;
- };
- return true;
- }
- });
- var Access = inputs.inherit({
- id : "XHRhit",
- index : 10,
- _buildUrl : function(url, params) {
- /** @type {number} */
- params.wmode = 7;
- return Access.superclass._buildUrl.apply(this, [url, params]);
- },
- _parseResp : function(obj) {
- var key = service.parse(obj);
- if (!key) {
- throw "";
- }
- return _.map(function(letter) {
- return key[letter];
- }, _.keys(key));
- }
- });
- var Page = Container.inherit({
- transports : [Access, httpModule],
- trimParams : true,
- _initComponent : function() {
- Page.superclass._initComponent.apply(this, arguments);
- this._ilStorage = new Array({
- counterId : this.counterId
- });
- },
- postParams : [],
- checkYandexHost : function(url) {
- if (url) {
- a: {
- if (url = _.parseUrl(url).host.match(/(?:^|\.)(?:ya|yandex)\.(?:\w+|com?\.\w+)$/)) {
- if (url = url[0].split("yandex").reverse()[0].substring(1), -1 != _.arrayIndexOf(options.yandexWhiteListTld, url)) {
- break a;
- }
- }
- /** @type {boolean} */
- url = false;
- }
- if (url) {
- /** @type {string} */
- this.host = options.baseUrl + url;
- }
- }
- },
- sendHit : function(data) {
- var self = {};
- var i = this._ilStorage.get("il");
- if (data.visitColor) {
- self.vc = data.visitColor;
- }
- if (data.hasPrerender) {
- /** @type {number} */
- self.pr = 1;
- }
- if (i) {
- this._ilStorage.remove("il");
- self.ilt = that.encode(base64.encode(_.trim(i, end)));
- }
- this.checkYandexHost(data.referrer);
- this._hitExt({
- url : data.url,
- forceNoRedirect : data.forceNoRedirect,
- nohit : data.nohit,
- title : data.title,
- referrer : data.referrer,
- vParams : data.vParams,
- userParams : data.userParams,
- experiments : data.experiments,
- modes : data.modes,
- browserInfo : self,
- ts : data.ts,
- tz : data.tz,
- callback : data.callback,
- ctx : data.ctx
- }, "hit");
- }
- });
- var Ua = Class.inherit({
- cid : 3,
- cnt : 0,
- KEY_NAME : "wasSynced",
- _initComponent : function() {
- this._storage = new Array;
- this._cookie = new Error;
- },
- hit : function(cb, force) {
- var self = this;
- /** @type {boolean} */
- var obj = force === undefined ? true : false;
- var options = obj ? this._storage.get(this.KEY_NAME) : false;
- /** @type {!Array} */
- var g = [];
- var cb = this.globalConfig.get("fakeHit");
- if (cb) {
- return cb(function(fallbackReleases) {
- cb(fallbackReleases);
- });
- }
- if (!options && obj && (options = this._cookie.read(this.KEY_NAME))) {
- options = service.parse(options);
- }
- if (options && options.time + 864E5 > context.getMs()) {
- self.globalConfig.set("isEU", options.params.eu);
- cb(options);
- } else {
- this.globalConfig.set("fakeHit", function(a) {
- g.push(a);
- });
- this._getSender().sendHit({
- forceNoRedirect : this.forceNoRedirect,
- callback : function(obj, name) {
- var data = obj || {};
- options = {
- time : context.getMs(),
- params : data,
- bkParams : name
- };
- self.globalConfig.set("isEU", data.eu);
- self._storage.set(self.KEY_NAME, options);
- self._cookie.create(self.KEY_NAME, service.stringify(options), 1728);
- cb(options);
- self.globalConfig.set("fakeHit", function(requestParser) {
- requestParser(options);
- });
- _.arrayEvery(g, function(requestParser) {
- requestParser(options);
- return 1;
- });
- }
- });
- }
- },
- _getSender : function() {
- if (!this._sender) {
- this._sender = new Page({
- protocol : "https:",
- counterType : this.cnt,
- counterId : this.cid,
- sendTitle : false,
- globalConfig : this.globalConfig,
- fake : true
- });
- }
- return this._sender;
- }
- });
- var Uint8Array = Class.inherit({
- baseUrl : options.baseUrl,
- globalConfig : api,
- baseTld : "ru",
- partners : {
- "mc.beru.ru" : {
- regex : /^([^/]+\.)?beru\.ru$/,
- tld : "ru"
- },
- "mc.kinopoisk.ru" : {
- regex : /^([^/]+\.)?kinopoisk\.ru$/,
- tld : "ru"
- }
- },
- _initComponent : function() {
- var codes = this;
- Uint8Array.superclass._initComponent.apply(this, arguments);
- this.syncTlds = _.reduce(function(notifications, saveNotifs) {
- return saveNotifs(notifications);
- }, options.yandexWhiteListTld, [_.bind(_.filter, null, function(b) {
- return b !== codes.baseTld;
- }), _.bind(_.reduce, null, function(animations, i) {
- /** @type {!Array} */
- animations[i] = [i];
- return animations;
- }, {})]);
- _.forEachKey(this.partners, function(a, options) {
- if (options.regex.test(window.location.hostname)) {
- if (!this.syncTlds[options.tld]) {
- /** @type {!Array} */
- this.syncTlds[options.tld] = [];
- }
- this.syncTlds[options.tld].push(a);
- /** @type {boolean} */
- this._replaceBase[a] = true;
- }
- }, this);
- },
- _replaceBase : {},
- langToDomain : {
- ka : "ge",
- ro : "md",
- tg : "tj",
- tk : "tm",
- et : "ee",
- hy : "com.am",
- he : "co.li",
- ky : "kg",
- uk : "ua",
- be : "by",
- tr : "com.tr",
- kk : "kz"
- },
- sync : function(fn) {
- var self = this;
- var name = this._need();
- /** @type {boolean} */
- var d = -1 != parse().hostname.search(/(?:^|\.)(?:ya|yandex|beru|kinopoisk)\.(?:\w+|com?\.\w+)$/);
- if (!this._is() && name) {
- this._setStatus(true);
- if (d) {
- this._getCn().hit(function() {
- self._sync(name, fn);
- });
- } else {
- fn();
- }
- } else {
- fn();
- }
- if (d) {
- this._addMda();
- }
- },
- _addMda : function() {
- var a = new Error({
- skipPrefix : true
- });
- var cookie = new Error;
- var undefinedType = a.read("mda");
- if ("0" !== undefinedType && "1" !== undefinedType) {
- a.create("mda", "0", 1036800);
- }
- if (cookie.read("mda")) {
- cookie.erase("mda");
- }
- },
- _is : function() {
- try {
- return !!this.globalConfig.get("startSync");
- } catch (a) {
- return false;
- }
- },
- _setStatus : function(value) {
- try {
- this.globalConfig.set("startSync", value);
- } catch (b) {
- }
- },
- _need : function() {
- var i = this._getDomainByLang();
- var j = this._getTld();
- /** @type {!Array} */
- var data = [];
- var range;
- if (range = this.syncTlds[j]) {
- data.push.apply(data, range);
- }
- range = this.syncTlds[i];
- if (i !== j && range) {
- data.push.apply(data, range);
- }
- var subwikiListsCache = this._getLs().get("synced") || {};
- data = _.arrayFilter(data, function(wikiId) {
- return (subwikiListsCache[wikiId] || 1) + 1440 < context.getMinutes();
- });
- return data.length && data || false;
- },
- _sync : function(src, callback) {
- var j;
- /** @type {number} */
- var len2 = 0;
- /** @type {string} */
- var prefix = options.protocol + "//";
- var len = src.length;
- var config = this;
- if (0 < len) {
- callback = callback || function() {
- };
- /**
- * @return {undefined}
- */
- var success = function() {
- len2++;
- if (len === len2) {
- callback();
- }
- };
- var state = config._getLs();
- var reqres2 = new ReqRes({});
- /** @type {number} */
- j = 0;
- for (; j < len; j++) {
- (function(name) {
- reqres2.request(prefix + (config._replaceBase[name] ? name : config.baseUrl + name) + "/sync_cookie_image_check", {}, function(prop) {
- success();
- var dummy = context.getMinutes();
- if (!prop) {
- /** @type {number} */
- dummy = dummy - 1435;
- }
- prop = state.get("synced") || {};
- prop[name] = dummy;
- state.set("synced", prop);
- });
- })(src[j]);
- }
- } else {
- callback();
- }
- },
- _getCn : function() {
- if (!this._cn) {
- this._cn = new Ua({
- fake : true,
- globalConfig : this.globalConfig
- });
- }
- return this._cn;
- },
- _getLs : function() {
- if (!this._ls) {
- this._ls = new Array;
- }
- return this._ls;
- },
- _getTld : function() {
- var mask = _.getTld();
- return {
- am : "com.am",
- tr : "com.tr",
- ge : "com.ge",
- il : "co.il",
- "\u0440\u0444" : "ru",
- "xn--p1ai" : "ru",
- "\u0443\u043a\u0440" : "ua",
- "xn--j1amh" : "ua",
- "\u0431\u0435\u043b" : "by",
- "xn--90ais" : "by"
- }[mask] || mask;
- },
- _getDomainByLang : function() {
- if (!window.navigator) {
- return "ru";
- }
- try {
- var category = navigator.languages ? navigator.languages[0] : $scope.getLanguage();
- } catch (b) {
- }
- category = (category || "").toLowerCase().split("-")[0];
- return this.langToDomain[category] || "ru";
- }
- });
- var Request = inputs.inherit({
- id : "RawBodyXHR",
- index : 9,
- postParams : ["body"],
- _setHeaders : function() {
- },
- _preparePostParams : function(a) {
- return a.post.body || "";
- }
- });
- $scope.isAndroid = require(function() {
- /** @type {string} */
- var ua = navigator.userAgent.toLowerCase();
- var b = $scope.getPlatform() || "";
- return -1 < ua.indexOf("android") && -1 < ua.indexOf("mobile") && b.match(/^android|linux armv/i);
- }, "", true);
- var methods = {
- _url : options.protocol + "//" + options.host + "/user_storage_set?",
- _params : {},
- init : function(s) {
- this._params = s || {};
- },
- save : function(obj, edge) {
- this._getReq().request(this._url + s.stringify({
- key : obj,
- value : _.toJSON(edge)
- }));
- this._getLs().set(obj, edge);
- },
- get : function(id) {
- return {
- remote : this._params[id],
- local : this._getLs().get(id)
- };
- },
- getNum : function(obj) {
- obj = this.get(obj);
- return Math.max(+obj.remote || 0, +obj.local || 0);
- },
- _getLs : function() {
- if (!this._ls) {
- this._ls = new Array;
- }
- return this._ls;
- },
- _getReq : function() {
- if (!this._req) {
- this._req = new ReqRes;
- }
- return this._req;
- }
- };
- var store = {
- sync : require(function(rawData, inmediate_node, array, opt_eventSource) {
- var data = {
- t : 'UV|L7,!"T[rwe&D_>ZIb\\aW#98Y.PC6k'
- };
- this.globalConfig = opt_eventSource || api;
- if (this._enabled(rawData, inmediate_node, array)) {
- this._setStatus(true);
- var stream = new Request({
- method : "GET",
- withCredentials : false
- });
- var _editorActionRegInfo = this._getHosts();
- var l = _editorActionRegInfo.length;
- (function save(i) {
- var info = _editorActionRegInfo[i];
- if (i < l) {
- stream.request(info[0] + ":" + info[1] + "/p", data, function(key, value) {
- if (key) {
- this._save(key, value, info[1]);
- } else {
- save.call(this, i + 1);
- }
- }, this);
- } else {
- this._save(false);
- }
- }).call(this, 0);
- }
- }, "ds"),
- _getHosts : function() {
- /** @type {!Array} */
- var newNodeLists = [];
- var string = result.protocol;
- var pubStr = $scope.isIOS();
- if ($scope.isAndroid() || pubStr && "http:" === string) {
- newNodeLists.push(["http://127.0.0.1", "30102"], ["http://127.0.0.1", "29009"]);
- }
- if (pubStr && "https:" === string) {
- newNodeLists.push(["https://yandexmetrica.com", "30103"], ["https://yandexmetrica.com", "29010"]);
- }
- return newNodeLists;
- },
- _save : function(value, type, i) {
- var e = context.getMinutes();
- if (value) {
- (new Container({
- protocol : "https:",
- counterType : 0,
- counterId : 42822899,
- sendTitle : false,
- fake : true
- })).sendDevice({
- data : _.trim(type),
- port : i
- });
- } else {
- /** @type {number} */
- e = e - 45;
- }
- methods.save("ds", e);
- },
- _is : function() {
- try {
- return !!this.globalConfig.get("dSync");
- } catch (a) {
- return false;
- }
- },
- _enabled : function(el, node, rawData) {
- if (!(60 < context.getMinutes() - methods.getNum("ds")) || this._is() || _.isDev(this.globalConfig)) {
- return false;
- }
- /** @type {boolean} */
- el = 0 === node && 0 <= _.arrayIndexOf([39370095, 1282253, 29302335, 43653484, 41734944, 31048081, 16443139, 27737346, 41870499, 33911514, 30744873, 5564395, 2580487], el);
- el = runDouban() || !rawData && .1 >= Math.random() && el;
- rawData = $scope.isIOS() && el;
- return $scope.isAndroid() && el || rawData;
- },
- _setStatus : function(value) {
- try {
- this.globalConfig.set("dSync", value);
- } catch (b) {
- }
- }
- };
- var _this = {
- getPos : function(e) {
- var body = util.getRootElement();
- var nearby = util.getDocumentScroll();
- return [e.pageX || e.clientX + nearby[0] - (body.clientLeft || 0) || 0, e.pageY || e.clientY + nearby[1] - (body.clientTop || 0) || 0];
- },
- getTarget : function(e) {
- /** @type {null} */
- var el = null;
- try {
- if (el = e.target || e.srcElement) {
- if (!el.ownerDocument && el.documentElement) {
- el = el.documentElement;
- } else {
- if (el.ownerDocument !== document) {
- /** @type {null} */
- el = null;
- }
- }
- }
- } catch (c) {
- }
- return el;
- },
- getMouseButton : function(event) {
- return event.which || event.button == undefined ? event.which : event.button & 1 ? 1 : event.button & 2 ? 3 : event.button & 4 ? 2 : 0;
- },
- prevent : function(event) {
- event = event || window.event;
- if (event.preventDefault) {
- event.preventDefault();
- } else {
- /** @type {boolean} */
- event.returnValue = false;
- }
- }
- };
- _this.dispatchCustomEvent = require(function(type, element) {
- var event;
- element = element || document;
- if (event = _.getNativeFunction("createEvent", document)("Event")) {
- event.initEvent(type, false, false);
- _.getNativeFunction("dispatchEvent", element)(event);
- }
- }, "evt.dispatch");
- var message = {
- lastReferrer : null
- };
- var w = Class.inherit({
- counter : null,
- prefsEcommerce : null,
- status : {
- NEW : undefined,
- PENDING : 1,
- OK : 2,
- FAIL : 3
- },
- dataLayerName : "dataLayer",
- _initComponent : function() {
- /** @type {string} */
- var newSlideNum = "customArr";
- w.superclass._initComponent.apply(this, arguments);
- if (this.frameConnector) {
- this.frameConnector.addHandler("params", function(a, options) {
- if (this.counter && this.counter.params) {
- this.counter.params(options.data);
- }
- }, this);
- }
- this._overridePush(this.globalConfig.get("dataLayer"));
- if (this.prefsEcommerce || this.prefsUseDataLayer) {
- if (!this._overridePush(this.prefsEcommerce)) {
- if (_.isString(this.prefsEcommerce)) {
- this.dataLayerName = this.prefsEcommerce;
- }
- newSlideNum = this.dataLayerName;
- this._tryTimeout = _.bind(this._tryTimeout, this);
- this._tryTimeout();
- }
- this.counter._ecommerce = newSlideNum;
- }
- },
- _overridePush : function(obj) {
- if (obj && "function" == typeof obj.push) {
- var log = this;
- log._send(obj);
- /** @type {!Function} */
- var item = obj.push;
- /**
- * @return {?}
- */
- obj.push = function() {
- var new_length = item.apply(this, arguments);
- log._send([].slice.call(arguments, 0));
- return new_length;
- };
- return true;
- }
- return false;
- },
- _tryTimeout : function() {
- if (!this._overridePush(window[this.dataLayerName])) {
- _.setTimeout(this._tryTimeout, 1E3, "dlObserver");
- }
- },
- _callHandlers : function(data) {
- _.arrayEvery(w.handlers, function(src) {
- if (src && src.type) {
- _.arrayEvery(src.type.split(","), function(proxyValue) {
- if (proxyValue.replace(" ", "") === data.type && src.callback) {
- src.callback(data);
- }
- return 1;
- });
- }
- return 1;
- });
- },
- allowedEvents : "currencyCode add delete remove purchase checkout detail".split(" "),
- _convert : function(to, data) {
- var valid = _.keys(data);
- /** @type {boolean} */
- var v = false;
- var props = {
- transaction_id : "id",
- value : "revenue"
- };
- if (data.items) {
- var value = {};
- value[to] = {
- products : data.items
- };
- if (1 < valid.length) {
- value[to].actionField = _.reduce(function(event, i) {
- if (props[i]) {
- event[props[i]] = data[i];
- } else {
- if ("currency" === i) {
- v = data[i];
- } else {
- if ("items" !== i && data[i]) {
- event[i] = data[i];
- }
- }
- }
- return event;
- }, {}, valid);
- }
- if (v) {
- value.currencyCode = v;
- }
- return value;
- }
- },
- _checkGtag : function(l) {
- var geometries = {
- view_item : "detail",
- add_to_cart : "add",
- remove_from_cart : "remove",
- begin_checkout : "checkout",
- purchase : "purchase"
- };
- /** @type {!Array} */
- var _title_labels = [];
- if (l && "event" === l[0] && geometries[l[1]] && (l = this._convert(geometries[l[1]], l[2]))) {
- _title_labels.push(l);
- }
- return _title_labels;
- },
- _send : function(o) {
- /** @type {!Array} */
- var added = [];
- var a = this.allowedEvents;
- var d;
- var textWidth;
- /** @type {number} */
- var i = 0;
- textWidth = o.length;
- for (; i < textWidth; i++) {
- if ((d = o[i]) && d.ymetrikaEvent) {
- var data = d.ymetrikaEvent;
- this._callHandlers(data);
- if ("params" === data.type && data.data) {
- if (!data.sended) {
- /** @type {!Array} */
- data.sended = [];
- }
- if (data.counter) {
- if (this.counter && this.counter.params && this.counterId == data.counter) {
- this.counter.params(data.data);
- data.sended.push(this.counterId);
- }
- } else {
- _.forEachKey(this.globalConfig.get("counters"), function(clusterShardData, params) {
- var c = clusterShardData.split(":")[0];
- if (!_.inArray(data.sended, c) && params && params.params) {
- params.params(data.data);
- data.sended.push(c);
- }
- }, this);
- }
- if (data.status == this.status.NEW && data.parent && this.frameConnector && this.frameConnector.checkFrame(window.parent) && window.parent !== window) {
- this.frameConnector.sendToParents({
- type : "params",
- data : data.data
- }, function() {
- data.status = this.status.OK;
- }, this);
- data.status = this.status.PENDING;
- }
- }
- }
- if (d && d.ecommerce) {
- var item = {};
- /** @type {boolean} */
- var n = false;
- _.forEachKey(d.ecommerce, function(type, values) {
- if (0 <= _.arrayIndexOf(a, type)) {
- /** @type {boolean} */
- n = true;
- item[type] = values;
- }
- });
- if (n) {
- added.push(item);
- }
- }
- /** @type {!Array<?>} */
- added = added.concat(this._checkGtag(d));
- }
- if (added.length) {
- this.counter.params({
- __ym : {
- ecommerce : added
- }
- });
- }
- }
- });
- /** @type {!Array} */
- w.handlers = [];
- var request = {
- asyncChunk : 400,
- maxDuration : 20,
- restTime : 100,
- asyncBuffer : [],
- timeout : null,
- addAsyncItem : function(f, ctx, path, callparams, options) {
- var stream = this;
- this.asyncBuffer.push({
- fn : f,
- ctx : ctx,
- args : callparams || [],
- loggerName : options || ""
- });
- if (path) {
- stream.flushAsync(true);
- } else {
- clearTimeout(this.timeout);
- this.timeout = _.setTimeout(function() {
- stream.flushAsync();
- /** @type {null} */
- stream.timeout = null;
- }, this.restTime);
- }
- },
- chain : function(a, f, data, service) {
- var console = this;
- /**
- * @param {!Object} key
- * @return {?}
- */
- a.push = function(key) {
- throw 'Try to push in Executor when it started "' + key + '"';
- };
- (function fn(index, y, key) {
- console.addAsyncItem(function(i, b, validation) {
- b = a[i++](b);
- if (i <= a.length - 1) {
- fn(i, b, validation);
- }
- }, null, key, [index, y], service + "." + index);
- })(0, f, data);
- },
- callByTimeout : function(a, b) {
- /** @type {number} */
- var _startTime = +new Date;
- /** @type {number} */
- var currentTime = 0;
- var item = (b || 0) + 1;
- var dataHelpers = this;
- _.arrayEvery(this.asyncBuffer, function(options, idxC) {
- if (options.isExecuted) {
- return true;
- }
- require(function() {
- options.fn.apply(options.ctx, options.args);
- }, "AsyncExecutor." + options.loggerName)();
- /** @type {number} */
- currentTime = +new Date - _startTime;
- /** @type {boolean} */
- options.isExecuted = true;
- this.asyncBuffer.splice(idxC, 1);
- return a || 0 == this.asyncBuffer.length ? true : idxC >= this.asyncChunk || currentTime >= this.maxDuration ? (_.setTimeout(function() {
- dataHelpers.callByTimeout(a, item);
- }, this.restTime), false) : true;
- }, this);
- },
- flushAsync : function(a) {
- if (this.asyncBuffer.length) {
- this.callByTimeout(a);
- }
- }
- };
- /** @type {!Array<string>} */
- var value = "GDPR-ok GDPR-cross GDPR-cancel GDPR-skip GDPR-frame-skip GDPR-frame-ya GDPR-frame-noya GDPR-open-start GDPR-eu-skip GDPR-open-fail GDPR-open-success GDPR-cookie-success GDPR-cookie-fail GDPR-skip-login GDPR-skip-domain GDPR-skip-na GDPR-skip-eu-na GDPR-skip-wv".split(" ");
- /** @type {!Array} */
- var range = ["https://brozen.yandex.ru", "https://yabro1.zen-test.yandex.ru/yabro/index.html", "https://yabro2.zen-test.yandex.ru/yabro/index.html"];
- var img = Class.inherit({
- globalKey : "f1",
- MAX_SIZE : 1E6,
- isYAN : false,
- trigger : function(type) {
- this.globalConfig.get("dataLayer").push({
- ymetrikaEvent : {
- type : type
- }
- });
- },
- initCounter : function() {
- },
- enabled : runDouban() && -1 < window.location.href.indexOf("yagdprcheck=1"),
- _initComponent : function() {
- this._cookie = img.cookie;
- this._sender = new Ua({
- fake : true,
- globalConfig : this.globalConfig,
- forceNoRedirect : true
- });
- },
- realise : function(a, b) {
- this.initCounter.apply(window, a);
- this.globalConfig.set(this.globalKey, function(saveNotifs) {
- saveNotifs();
- });
- if (b.length) {
- request.chain(b.concat([function() {
- /** @type {!Array} */
- b = [];
- }]));
- }
- },
- showPopup : function(i, e, info, item, type) {
- var this_text = this;
- i = util.loadScript({
- src : "https://yastatic.net/q/global-notifications/cc/_lego-cc" + i + "." + e + ".js"
- });
- this_text.trigger("GDPR-open-start");
- /**
- * @param {?} event
- * @return {undefined}
- */
- i.onerror = function(event) {
- require(function() {
- throw event;
- }, "gdpr-popup")();
- this_text.trigger("GDPR-open-fail");
- this_text.realise(info, item);
- this_text.frameConnector.sendToChildren({
- type : "GDPR-ok"
- });
- };
- /**
- * @return {undefined}
- */
- i.onload = function() {
- this_text.trigger("GDPR-open-success");
- w.handlers = w.handlers.concat([{
- type : "GDPR-ok, GDPR-cross",
- callback : function(object) {
- if (!object.once) {
- type.create("gdpr", "0", 525600);
- this_text.realise(info, item);
- this_text.frameConnector.sendToChildren({
- type : "GDPR-ok"
- });
- /** @type {boolean} */
- object.once = true;
- }
- }
- }, {
- type : "GDPR-cancel",
- callback : function() {
- type.create("gdpr", "1");
- this_text.logCancel();
- this_text.frameConnector.sendToChildren({
- type : "GDPR-cancel"
- });
- }
- }]);
- };
- },
- askGDPR : function(rules, element, options, d, f, o) {
- if (_.inArray([null, ""], rules)) {
- this.showPopup(element, options, d, f, o);
- } else {
- if ("0" === rules) {
- this.trigger("GDPR-cookie-success");
- this.realise(d, f);
- } else {
- if ("1" === rules) {
- return this.trigger("GDPR-cookie-fail"), this.logCancel(), false;
- }
- }
- }
- },
- logCancel : function() {
- this._sender.hit(function() {
- }, false);
- },
- handle : function() {
- var hittable = this._sender;
- /** @type {!Array} */
- var options = [];
- var value = ($scope.getLanguage() || "").toLowerCase().split("-")[0];
- /** @type {string} */
- var d = "ontouchstart" in window ? "-touch" : "";
- var group = this._cookie;
- var rules = group.read("gdpr");
- var filename = group.read("yaGdprCheck");
- var _this = this;
- var escapeTable = this.globalConfig.get(this.globalKey);
- /** @type {!Arguments} */
- var r = arguments;
- /** @type {number} */
- options.size = 0;
- if (escapeTable) {
- return escapeTable(function() {
- _this.realise(r, options);
- });
- }
- if (!_.inArray("ru en kk be ky tr tt uk".split(" "), value)) {
- /** @type {string} */
- value = "en";
- }
- if (!this.enabled && ("0" === rules || $scope.isSafariWebView() || $scope.isAndroidWebView() || _.inArray(range, window.location.href.split("?")[0]) || !runDouban() || group.read("yandex_login") || this.disable)) {
- return group.read("yandex_login") ? this.trigger("GDPR-skip-login") : runDouban() ? "0" === rules ? this.trigger("GDPR-skip") : $scope.isSafariWebView() || $scope.isAndroidWebView() ? this.trigger("GDPR-skip-wv") : this.trigger("GDPR-skip-na") : this.trigger("GDPR-skip-domain"), this.realise(r, options);
- }
- this.globalConfig.set(this.globalKey, function(a, c) {
- /** @type {number} */
- var str = 0;
- try {
- /** @type {number} */
- str = JSON.stringify(c).length || 0;
- } catch (Y) {
- }
- if (options.size + str < _this.MAX_SIZE) {
- options.push(a);
- options.size += str;
- } else {
- _.warning("GDPR buffer is exceeded");
- }
- });
- hittable.hit(function(originalFunctionTypeObj) {
- if (originalFunctionTypeObj.params.eu || filename || _this.enabled) {
- if (_this.frameConnector && _this.frameConnector.addHandler("isYandex", function() {
- return {
- type : "isYandex",
- isYandex : runDouban()
- };
- }), _this.frameConnector.isIframe) {
- _this.frameConnector.sendToParents({
- type : "isYandex"
- }, function(a, c) {
- /** @type {boolean} */
- var d = false;
- clearTimeout(_takingTooLongTimeout);
- if (c[0].isYandex) {
- _this.trigger("GDPR-frame-ya");
- _this.frameConnector.addHandler("GDPR-ok", function() {
- if (!d) {
- group.create("gdpr", "0", 525600);
- _this.realise(c, options);
- /** @type {boolean} */
- d = true;
- }
- });
- _this.frameConnector.addHandler("GDPR-cancel", function() {
- group.create("gdpr", "1");
- });
- } else {
- _this.trigger("GDPR-frame-noya");
- _this.realise(c, options);
- }
- });
- var _takingTooLongTimeout = _.setTimeout(function() {
- _this.trigger("GDPR-frame-skip");
- _this.realise(r, options);
- }, 2E3);
- } else {
- _this.askGDPR(rules, d, value, r, options, group);
- }
- } else {
- return originalFunctionTypeObj.params.eu ? _this.trigger("GDPR-skip-eu-na") : _this.trigger("GDPR-eu-skip"), _this.realise(r, options);
- }
- });
- }
- });
- /** @type {string} */
- img.globalKey = "f1";
- img.cookie = new Error({
- skipPrefix : true
- });
- /**
- * @param {string} path
- * @return {?}
- */
- img.getState = function(path) {
- var mode = img.cookie.read("gdpr");
- path = _.reduce(function(result, event) {
- if (event.ymetrikaEvent && _.inArray(value, event.ymetrikaEvent.type)) {
- result.push(_.arrayIndexOf(value, event.ymetrikaEvent.type));
- }
- return result;
- }, [], path.get("dataLayer"));
- return path.length ? (path = path.join(","), mode && (path = path + ("-" + (_.inArray(["0", "1"], mode) ? mode : "2"))), path) : "";
- };
- var FACTORY = {
- init : function(options, port) {
- /** @type {!Element} */
- var img = document.createElement("img");
- if (options && options.account && options.tmsec && port) {
- /** @type {string} */
- img.src = "https://www.tns-counter.ru/V13a****" + options.account + "/ru/UTF-8/tmsec=" + options.tmsec + "/" + port;
- }
- }
- };
- /**
- * @return {?}
- */
- $scope.isIE = function() {
- return document && !document.addEventListener || false;
- };
- /**
- * @return {?}
- */
- $scope.isChromePdf = function() {
- var i;
- /** @type {!PluginArray} */
- var plugins = navigator.plugins;
- if (plugins && plugins.length) {
- /** @type {number} */
- i = 0;
- for (; i < plugins.length; i++) {
- if (/Chrome PDF Viewer/.test(plugins[i].name)) {
- return true;
- }
- }
- }
- return false;
- };
- var me = {};
- me._cookie = new Error({
- onlyCurrentDomain : true
- });
- me._check = require(function() {
- return -1 < window.location.href.indexOf("_ym_debug=1") || window._ym_debug || "1" === me._cookie.read("debug");
- });
- me.enabled = me._check();
- me.log = require(function() {
- if (-1 < result.href.indexOf("_ym_debug=1") || window._ym_debug) {
- this._cookie.create("debug", "1");
- }
- if (window.console && console.log && this._check()) {
- /** @type {boolean} */
- me.enabled = true;
- console.log.apply(console, arguments);
- }
- }, "DebugConsole.log");
- var SenderClass = config.inherit({
- resource : "clmap",
- retry : true,
- transports : [ReqRes],
- sendClick : function(event, targetElement, e, cb) {
- this.send({
- "page-url" : event,
- "pointer-click" : targetElement
- }, {}, e, cb);
- }
- });
- var KeepAlive = Class.inherit({
- filter : null,
- ignoreTags : [],
- quota : 0,
- isTrackHash : false,
- protocol : "",
- counterId : 0,
- counterType : 0,
- startTime : 0,
- MAX_LEN_PATH : 128,
- TIMEOUT_CLICK : 50,
- TIMEOUT_SAME_CLICKS : 1E3,
- DELTA_SAME_CLICKS : 2,
- tags : "A B BIG BODY BUTTON DD DIV DL DT EM FIELDSET FORM H1 H2 H3 H4 H5 H6 HR I IMG INPUT LI OL P PRE SELECT SMALL SPAN STRONG SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TR U UL ABBR AREA BLOCKQUOTE CAPTION CENTER CITE CODE CANVAS DFN EMBED FONT INS KBD LEGEND LABEL MAP OBJECT Q S SAMP STRIKE TT ARTICLE AUDIO ASIDE FOOTER HEADER MENU METER NAV PROGRESS SECTION TIME VIDEO NOINDEX NOBR MAIN svg circle clippath ellipse defs foreignobject g glyph glyphref image line lineargradient marker mask path pattern polygon polyline radialgradient rect set text textpath title".split(" "),
- _initComponent : function() {
- var b;
- var i;
- /** @type {null} */
- this._lastClick = null;
- /** @type {boolean} */
- this.hasQuota = !!this.quota;
- this._quota = this.quota;
- /** @type {!Array} */
- this._ignoreTags = [];
- if (this.ignoreTags) {
- /** @type {number} */
- b = 0;
- for (; b < this.ignoreTags.length; b++) {
- if (this.ignoreTags[b]) {
- _.mergeArrays(this._ignoreTags, [String(this.ignoreTags[b]).toUpperCase()]);
- }
- }
- }
- this._cacheTags = {};
- /** @type {number} */
- b = 59;
- /** @type {function(...number): string} */
- var fromCharCode = String.fromCharCode;
- /** @type {number} */
- i = 0;
- for (; i < this.tags.length; i++) {
- /** @type {string} */
- this._cacheTags[this.tags[i]] = fromCharCode(b);
- fromCharCode(b);
- b++;
- }
- this._sender = new SenderClass({
- globalConfig : this.globalConfig,
- protocol : this.protocol,
- counterId : this.counterId,
- counterType : this.counterType
- });
- /** @type {boolean} */
- this._start = false;
- this.start();
- },
- destroy : function() {
- this.stop();
- },
- start : function() {
- if (!this._start) {
- self.on(document, "click", this._handler, this);
- }
- /** @type {boolean} */
- this._start = true;
- },
- stop : function() {
- if (this._start) {
- self.un(document, "click", this._handler, this);
- }
- /** @type {boolean} */
- this._start = false;
- },
- setTrackHash : function(prop) {
- /** @type {boolean} */
- this.isTrackHash = prop;
- },
- _isIgnore : function(c) {
- return util.classNameExists(c, "(ym-disable-clickmap|ym-clickmap-ignore)");
- },
- _handler : function(e) {
- e = {
- el : _this.getTarget(e),
- pos : _this.getPos(e),
- button : _this.getMouseButton(e),
- time : +new Date
- };
- if (this._isTrackingClick(e)) {
- var ret = util.getElementSize(e.el);
- var obj = util.getElementXY(e.el);
- /** @type {!Array} */
- ret = ["rn", _.random(), "x", Math.floor(65535 * (e.pos[0] - obj[0]) / (ret[0] || 1)), "y", Math.floor(65535 * (e.pos[1] - obj[1]) / (ret[1] || 1)), "t", Math.floor((e.time - this.startTime) / 100), "p", this._getElPath(e.el)];
- obj = parse().href;
- if (this.isTrackHash) {
- _.mergeArrays(ret, ["wh", "1"]);
- } else {
- obj = obj.split("#")[0];
- }
- this._sender.sendClick(_.trim(obj, batch), ret.join(":"));
- /** @type {!Object} */
- this._lastClick = e;
- }
- },
- _isTrackingClick : function(data) {
- var i;
- if (window.ymDisabledClickmap || _.isMetrikaPlayer() || !data.el) {
- return false;
- }
- var target = data.el.tagName;
- if ((2 == data.button || 3 == data.button) && "A" != target || this.filter && !this.filter(data.el, target)) {
- return false;
- }
- /** @type {number} */
- i = 0;
- for (; i < this._ignoreTags.length; i++) {
- if (this._ignoreTags[i] == target) {
- return false;
- }
- }
- target = data.el;
- for (; target;) {
- if (this._isIgnore(target)) {
- return false;
- }
- target = target.parentNode;
- }
- if (this._lastClick) {
- if (data.time - this._lastClick.time < this.TIMEOUT_CLICK) {
- return false;
- }
- /** @type {number} */
- target = Math.abs(this._lastClick.pos[0] - data.pos[0]);
- /** @type {number} */
- i = Math.abs(this._lastClick.pos[1] - data.pos[1]);
- /** @type {number} */
- var d = data.time - this._lastClick.time;
- if (this._lastClick.el == data.el && target < this.DELTA_SAME_CLICKS && i < this.DELTA_SAME_CLICKS && d < this.TIMEOUT_SAME_CLICKS) {
- return false;
- }
- }
- if (this.hasQuota) {
- if (!this._quota) {
- return false;
- }
- this._quota--;
- }
- return true;
- },
- _getElPath : function(element) {
- /** @type {string} */
- var ret = "";
- for (; element && element.parentNode && "BODY" != element.tagName && "HTML" != element.tagName;) {
- ret = ret + (this._cacheTags[element.tagName] || "*");
- ret = ret + (util.getElementNeighborPosition(element) || "");
- element = element.parentNode;
- }
- return _.trim(ret, this.MAX_LEN_PATH);
- }
- });
- var Embassy = Class.inherit({
- injectHash : {
- Wjw75ghm7fa7JW8p : "https://yastatic.net/metrika-static-watch/assessor-init.js",
- Z4RhWJNDJanzkGJa : "https://yastatic.net/metrika-static-watch/assessor-compare.js"
- },
- ASSESSOR_COOKIE : "assessor",
- REMOTE_CONTROL : "i",
- getInjectHash : function() {
- var subscriptions = {};
- _.forEachKey(this.injectHash, function(key) {
- subscriptions[k + ("" + _.fnv32a(key))] = this.injectHash[key];
- }, this);
- return subscriptions;
- },
- checkAssessor : function() {
- /** @type {!Array} */
- var result = [];
- var handlers = this.getInjectHash();
- _.forEachKey(handlers, function(name) {
- if ((new RegExp(name)).test(window.location.hash) || Error.get(this.ASSESSOR_COOKIE + name)) {
- Error.set(this.ASSESSOR_COOKIE + name);
- result.push(handlers[name]);
- }
- }, this);
- return result;
- },
- _initComponent : function() {
- var a = this.checkAssessor();
- if (!this.globalConfig.get(this.REMOTE_CONTROL)) {
- this.globalConfig.set(this.REMOTE_CONTROL, true);
- Embassy.superclass._initComponent.apply(this, arguments);
- this._executedMsgs = {};
- self.on(window, "message", this._onMessage, this);
- if (a.length) {
- this.globalConfig.set("oo", true);
- this.globalConfig.get("stopRecoder", function() {
- })();
- _.arrayEvery(a, function(cssSrc) {
- util.loadScript({
- src : cssSrc
- }, window);
- return 1;
- });
- }
- }
- },
- _buildRemoteIframe : function(cssSrc) {
- var element = _.getNativeFunction("createElement", document)("div");
- var c = util.getBody() || document.documentElement;
- if (c) {
- /** @type {string} */
- element.innerHTML = '<iframe name="RemoteIframe" allowtransparency="true" style="position: absolute; left: -999px; top: -999px; width: 1px; height: 1px;"></iframe>';
- var d = element.firstChild;
- /**
- * @return {undefined}
- */
- d.onload = function() {
- util.loadScript({
- src : cssSrc
- }, d.contentWindow);
- };
- window._ym__remoteIframeEl = d;
- if (element.createShadowRoot || element.webkitCreateShadowRoot) {
- c.appendChild(element);
- element.removeChild(d);
- if (c = element.createShadowRoot ? element.createShadowRoot() : element.webkitCreateShadowRoot()) {
- c.appendChild(d);
- }
- window._ym__remoteIframeContainer = element;
- } else {
- c.appendChild(d);
- window._ym__remoteIframeContainer = d;
- }
- }
- },
- _isAllowedLang : function(type) {
- return -1 !== _.arrayIndexOf(["ru", "uk", "en", "tr"], type);
- },
- _isAllowedOrigin : function(subName) {
- return /^http:\/\/([\w\-.]+\.)?webvisor\.com\/?$/.test(subName);
- },
- _isAllowedStatic : function(pathToDestinationFile) {
- return /^(([\w\-.]+\.)?dev\.webvisor\.com|yastatic\.net)$/.test(pathToDestinationFile);
- },
- _onMessage : function(data) {
- try {
- var opts = data.origin;
- } catch (c) {
- }
- if (opts && this._isAllowedOrigin(opts) && (opts = service.parse(data.data)) && "appendremote" === opts.action && this._isAllowedStatic(_.parseUrl(opts.domain).host) && this._isAllowedLang(opts.lang) && !this._executedMsgs[opts.id]) {
- /** @type {boolean} */
- this._executedMsgs[opts.id] = true;
- /** @type {!Object} */
- window._ym__postMessageEvent = data;
- window._ym__inpageMode = opts.inpageMode;
- window._ym__initMessage = opts.initMessage;
- this._buildRemoteIframe(opts.domain + "/cdn/inpage-remote/" + (opts.newScriptAddr ? "_inpage-remote_" : "inpage-remote.") + opts.lang + ".js");
- }
- }
- });
- var body = {
- match : function() {
- if (this.enabled()) {
- self.ready(function() {
- var iframe = _.getNativeFunction("createElement", document)("iframe");
- /**
- * @return {undefined}
- */
- iframe.onload = function() {
- methods.save("cm", context.getMinutes());
- util.removeNode(iframe);
- };
- /** @type {string} */
- iframe.style.display = "none";
- /** @type {string} */
- iframe.src = options.protocol + "//" + options.host + "/metrika/watch_match.html";
- document.documentElement.appendChild(iframe);
- });
- }
- },
- enabled : function() {
- return 1440 < context.getMinutes() - methods.getNum("cm") && "tr" === _.getTld();
- }
- };
- require(function() {
- (function(modules) {
- /**
- * @param {string} moduleId
- * @return {?}
- */
- function __webpack_require__(moduleId) {
- if (installedModules[moduleId]) {
- return installedModules[moduleId].exports;
- }
- var module = installedModules[moduleId] = {
- i : moduleId,
- l : false,
- exports : {}
- };
- modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /** @type {boolean} */
- module.l = true;
- return module.exports;
- }
- var installedModules = {};
- __webpack_require__.m = modules;
- __webpack_require__.c = installedModules;
- /**
- * @param {!Function} exports
- * @param {string} name
- * @param {!Function} getter
- * @return {undefined}
- */
- __webpack_require__.d = function(exports, name, getter) {
- if (!__webpack_require__.o(exports, name)) {
- Object.defineProperty(exports, name, {
- configurable : false,
- enumerable : true,
- get : getter
- });
- }
- };
- /**
- * @param {!Object} module
- * @return {?}
- */
- __webpack_require__.n = function(module) {
- /** @type {function(): ?} */
- var getter = module && module.__esModule ? function() {
- return module["default"];
- } : function() {
- return module;
- };
- __webpack_require__.d(getter, "a", getter);
- return getter;
- };
- /**
- * @param {!Function} a
- * @param {string} x
- * @return {?}
- */
- __webpack_require__.o = function(a, x) {
- return Object.prototype.hasOwnProperty.call(a, x);
- };
- /** @type {string} */
- __webpack_require__.p = "";
- return __webpack_require__(__webpack_require__.s = 3);
- })({
- 0 : function(fi, obj, signatureOnly) {
- /** @type {boolean} */
- obj.__esModule = true;
- /**
- * @param {string} separator
- * @return {?}
- */
- obj.listToArray = function(separator) {
- return separator ? [].slice.call(separator) : [];
- };
- },
- 1 : function(module, exports, __weex_require__) {
- /** @type {boolean} */
- exports.__esModule = true;
- /** @type {!Array} */
- var eCfgEl = [".googlesyndication.com/", "/googleads"];
- /**
- * @param {string} BRANCHES
- * @return {?}
- */
- exports.isGoogleSrc = function(BRANCHES) {
- return !(!BRANCHES || !eCfgEl.filter(function(b) {
- return 0 < BRANCHES.indexOf(b);
- }).length);
- };
- },
- 3 : function(params, obj, kvPredicate) {
- /** @type {boolean} */
- obj.__esModule = true;
- params = {
- detectAd : kvPredicate(4).detectAd
- };
- if (window.Ya) {
- if (window.Ya.AdDetector) {
- params = window.Ya.AdDetector;
- } else {
- /** @type {number} */
- window.Ya.AdDetector = params;
- }
- } else {
- window.Ya = {
- AdDetector : params
- };
- }
- /** @type {number} */
- obj.AdDetector = params;
- },
- 34 : function(module, exports, __weex_require__) {
- /** @type {boolean} */
- exports.__esModule = true;
- /**
- * @param {!Object} immediate
- * @return {?}
- */
- exports.getParentElementsCount = function(immediate) {
- /** @type {number} */
- var b = 0;
- for (;;) {
- if (immediate = immediate.parentElement) {
- b++;
- } else {
- return b;
- }
- }
- };
- },
- 4 : function(module, exports, __weex_require__) {
- /** @type {boolean} */
- exports.__esModule = true;
- var modal = __weex_require__(5);
- var picker = __weex_require__(9);
- var navigator = __weex_require__(34);
- var animation = __weex_require__(6);
- /** @type {!HTMLBodyElement} */
- var container = document.body;
- /** @type {!Element} */
- var element = document.documentElement;
- /**
- * @return {?}
- */
- exports.detectAd = function() {
- /** @type {number} */
- var i = window.pageYOffset || element.scrollTop || container.scrollTop;
- /** @type {number} */
- var offset = window.pageXOffset || element.scrollLeft || container.scrollLeft;
- /** @type {number} */
- var d = element.clientTop || container.clientTop || 0;
- /** @type {number} */
- var delta = element.clientLeft || container.clientLeft || 0;
- var len = element.scrollWidth || element.offsetWidth || window.innerWidth;
- var b = element.scrollHeight || element.offsetHeight || window.innerHeight;
- var view = animation.getFrienlyWindowsTree(window);
- /** @type {!Array} */
- var registeredBreakpoints = [];
- animation.windowsTreeEach(view, function(options) {
- var win = options.window;
- var model = options.parent;
- /** @type {boolean} */
- var headlessmaterial = 0 < modal.getParentFriendlyIFrames(win.document.documentElement).length;
- var root = picker.getAdsInWindow(win, {
- isInIFrame : headlessmaterial
- });
- headlessmaterial = root.adElements;
- root = root.iframeProviders;
- if (model) {
- var parent = win.frameElement;
- var self = registeredBreakpoints.filter(function(options) {
- return options.windowsTree === model;
- })[0].adElements;
- root.forEach(function(provider) {
- self.push({
- provider : provider,
- element : parent
- });
- });
- }
- registeredBreakpoints.push({
- windowsTree : options,
- adElements : headlessmaterial
- });
- });
- registeredBreakpoints.forEach(function(ls1) {
- ls1.adElements = ls1.adElements.sort(function(options, scope) {
- return navigator.getParentElementsCount(options.element) - navigator.getParentElementsCount(scope.element);
- });
- });
- /** @type {!Array} */
- var dataArea = [];
- /** @type {!Array} */
- var self = [];
- registeredBreakpoints.forEach(function(a) {
- var c = a.windowsTree;
- var b = c.parent;
- a = a.adElements;
- c = modal.getParentFriendlyIFrames(c.window.document.documentElement);
- var source = c[c.length - 1];
- a.forEach(function(data) {
- var element = data.element;
- self.push({
- provider : data.provider,
- element : b ? source : element
- });
- });
- });
- self.forEach(function(data) {
- var e = data.element;
- var pos = e.getBoundingClientRect();
- /** @type {number} */
- var g = pos.top + i - d;
- /** @type {number} */
- pos = pos.left + offset - delta;
- var px = e.clientWidth;
- e = e.clientHeight;
- var val = pos + px;
- var current = g + e;
- var min = 0 > pos ? 0 : pos < len ? pos : len;
- var minSize = 0 > g ? 0 : g < b ? g : b;
- if (100 <= ((val > len ? len : val > min ? val : min) - min) * ((current > b ? b : current > minSize ? current : minSize) - minSize)) {
- dataArea.push({
- top : g,
- left : pos,
- width : px,
- height : e,
- provider : data.provider
- });
- }
- });
- return {
- page : {
- width : len,
- height : b
- },
- window : {
- top : i,
- left : offset,
- width : window.innerWidth,
- height : window.innerHeight
- },
- ads : dataArea
- };
- };
- },
- 5 : function(module, exports, __weex_require__) {
- /** @type {boolean} */
- exports.__esModule = true;
- /**
- * @param {!Object} el
- * @return {?}
- */
- exports.getParentFriendlyIFrames = function(el) {
- /** @type {!Array} */
- var foundEls = [];
- for (;;) {
- try {
- if (el = el.ownerDocument.defaultView.frameElement) {
- foundEls.push(el);
- } else {
- return foundEls;
- }
- } catch (t) {
- return foundEls;
- }
- }
- };
- },
- 6 : function(depsLoaded, module, require) {
- /**
- * @param {!Window} host
- * @return {?}
- */
- function post(host) {
- return Drawable.listToArray(host.document.getElementsByTagName("iframe")).filter(function(elem) {
- if (platform.isSafari) {
- return false;
- }
- try {
- return elem.contentWindow.document;
- } catch (m) {
- return false;
- }
- }).map(function(bridgeFrame) {
- return bridgeFrame.contentWindow;
- });
- }
- /**
- * @param {!Window} name
- * @param {?} selector
- * @return {?}
- */
- function create(name, selector) {
- var data = {
- window : name,
- children : [],
- parent : selector
- };
- data.children = post(name).map(function(RequestError) {
- return create(RequestError, data);
- });
- return data;
- }
- /**
- * @param {!Object} type
- * @param {!Function} name
- * @return {undefined}
- */
- function f(type, name) {
- name(type);
- type.children.forEach(function(onExit) {
- return f(onExit, name);
- });
- }
- /** @type {boolean} */
- module.__esModule = true;
- var platform = require(7);
- var Drawable = require(0);
- /** @type {function(!Window, ?): ?} */
- module.getFrienlyWindowsTree = create;
- /** @type {function(!Object, !Function): undefined} */
- module.windowsTreeEach = f;
- },
- 7 : function(t, d, h) {
- /** @type {boolean} */
- d.__esModule = true;
- t = h(8);
- d.isSafari = t.isSafari();
- },
- 8 : function(a, b, variableNames) {
- /** @type {boolean} */
- b.__esModule = true;
- /**
- * @return {?}
- */
- b.isSafari = function() {
- /** @type {string} */
- var ua = navigator.userAgent.toLowerCase();
- return -1 !== ua.indexOf("safari") && -1 === ua.indexOf("chrome") && -1 === ua.indexOf("android");
- };
- },
- 9 : function(module, exports, __webpack_require__) {
- /** @type {boolean} */
- exports.__esModule = true;
- var assert = __webpack_require__(0);
- var t = __webpack_require__(1);
- /**
- * @param {!Window} n
- * @param {?} game
- * @return {?}
- */
- exports.getAdsInWindow = function(n, game) {
- /**
- * @param {string} name
- * @param {!Array} selector
- * @return {undefined}
- */
- function isEnabled(name, selector) {
- selector.forEach(function(mathML) {
- self.push({
- provider : name,
- element : mathML
- });
- });
- }
- var s = game.isInIFrame;
- var parent = n.document.body;
- var variantViewer = assert.listToArray(parent.querySelectorAll("img"));
- var defectTypeCollection = assert.listToArray(parent.querySelectorAll("iframe"));
- var arrRef = assert.listToArray(parent.querySelectorAll("script"));
- var contatos = assert.listToArray(parent.querySelectorAll("div"));
- /** @type {!Array} */
- var self = [];
- /** @type {!Array} */
- var firebaseRef = [];
- var eCfgEl = assert.listToArray(parent.querySelectorAll("yatag"));
- var scenes = assert.listToArray(parent.querySelectorAll("yatag yatag"));
- isEnabled("yandex", eCfgEl.filter(function(sceneUid) {
- return -1 === scenes.indexOf(sceneUid);
- }));
- isEnabled("adriver", defectTypeCollection.filter(function(cur) {
- return (cur = cur.src) && -1 < cur.indexOf(".adriver.ru/");
- }));
- isEnabled("adfox", defectTypeCollection.filter(function(s) {
- return (s = s.id) && -1 < s.toLowerCase().indexOf("adfox");
- }));
- isEnabled("adfox", variantViewer.filter(function(cur) {
- return (cur = cur.src) && -1 < cur.indexOf("/banners.adfox.ru/");
- }));
- isEnabled("adfox", contatos.filter(function(vertexSet) {
- return -1 < vertexSet.id.indexOf("AdFox_banner_");
- }));
- if (s && variantViewer.filter(function(cur) {
- return (cur = cur.src) && -1 < cur.indexOf(".adfox.ru/");
- }).length) {
- firebaseRef.push("adfox");
- }
- defectTypeCollection.filter(function(a) {
- return t.isGoogleSrc(a.src);
- }).forEach(function(mathML) {
- self.push({
- provider : "google",
- element : mathML
- });
- });
- if (s && arrRef.filter(function(ci) {
- return t.isGoogleSrc(ci.src);
- }).length) {
- firebaseRef.push("google");
- }
- isEnabled("awaps", defectTypeCollection.filter(function(cur) {
- return (cur = cur.src) && -1 < cur.indexOf("awaps.yandex.net/");
- }));
- isEnabled("criteo", defectTypeCollection.filter(function(s) {
- var src = s.src;
- s = s.id;
- return src && (-1 < src.indexOf(".criteo.com/") || s && -1 < s.indexOf("cto_iframe_")) ? true : false;
- }));
- return {
- adElements : self,
- iframeProviders : firebaseRef
- };
- };
- }
- });
- }, "", true)();
- var atap = {
- init : function(a, be) {
- if (Math.random() < (be || .005) && !api.get("adDetect")) {
- api.set("adDetect", true);
- /**
- * @param {boolean} prev
- * @return {undefined}
- */
- var next = function(prev) {
- var options = window.Ya.AdDetector.detectAd();
- var el = options.window;
- var parent = options.page;
- a.sendParams({
- __ym : {
- ads : {
- w : {
- t : el.top,
- l : el.left,
- w : el.width,
- h : el.height
- },
- p : {
- w : parent.width,
- h : parent.height
- },
- a : _.map(function(p) {
- return {
- t : p.top,
- l : p.left,
- w : p.width,
- h : p.height,
- p : p.provider
- };
- }, options.ads),
- full : prev ? 1 : 0
- }
- }
- });
- };
- var fn = require(function() {
- self.un(window, "load", fn);
- next(true);
- }, "", true);
- self.on(window, "load", fn);
- _.setTimeout(next, 1E4, "AdDetector", true);
- }
- }
- };
- var ctor = Class.inherit({
- message : window.postMessage,
- spliter : ":",
- nameSpace : "__yminfo",
- pending : {},
- childs : {},
- isIframe : false,
- parents : {},
- dataToSend : {
- parents : [],
- childs : []
- },
- checkFrame : function(port) {
- try {
- var statsPort = port && port.postMessage;
- } catch (c) {
- return false;
- }
- return statsPort;
- },
- checkChildrenData : function(globeDepth, context) {
- _.arrayEvery(this.dataToSend.childs, function(options) {
- if (-1 == _.arrayIndexOf(options.tryTo, context.counterId)) {
- options.tryTo.push(context.counterId);
- _.mixin(options.data, {
- toCounter : context.counterId
- });
- this.sendToIframe(globeDepth, options.data, function() {
- options.sendedTo.push(context.counterId);
- if (options.callback) {
- options.callback(context, arguments);
- }
- });
- }
- return true;
- }, this);
- },
- checkParentData : function(globeDepth, context) {
- _.arrayEvery(this.dataToSend.parents, function(options) {
- if (-1 == _.arrayIndexOf(options.tryTo, context.counterId)) {
- options.tryTo.push(context.counterId);
- _.mixin(options.data, {
- toCounter : context.counterId
- });
- this.sendToIframe(globeDepth, options.data, function() {
- options.sendedTo.push(context.counterId);
- if (options.callback) {
- options.callback(context, arguments);
- }
- });
- }
- return true;
- }, this);
- },
- getHandlers : function() {
- return {
- initToChild : [{
- fn : function(x, y) {
- if (x.source === window.top) {
- this.trigger("parentConnect", x, y);
- }
- }
- }],
- initToParent : [{
- fn : function(doc, options) {
- this.childs[options.counterId] = {
- info : options,
- window : doc.source
- };
- this.checkChildrenData(doc.source, options);
- }
- }],
- parentConnect : [{
- fn : function(doc, options) {
- this.parents[options.counterId] = {
- info : options,
- window : doc.source
- };
- this.checkParentData(doc.source, options);
- }
- }]
- };
- },
- genMessage : function(event, row) {
- var data = {
- date : context.getMs(),
- key : Math.random(),
- dir : 0
- };
- if (row) {
- data = {
- date : row[0],
- key : row[1],
- dir : row[2]
- };
- }
- _.mixin(event, {
- counterId : this.counterId,
- hid : this.hid
- });
- var result = {
- data : event
- };
- /** @type {string} */
- result[this.nameSpace] = [this.nameSpace, data.date, data.key, data.dir].join(this.spliter);
- return {
- meta : data,
- string : service.stringify(result)
- };
- },
- sendToIframe : function(channel, data, size, options) {
- data = this.genMessage(data);
- var chartData = this;
- /** @type {string} */
- var i = [data.meta.date, data.meta.key].join(this.spliter);
- if (this.checkFrame(channel)) {
- channel.postMessage(data.string, "*");
- this.pending[i] = _.bind(size, options || this);
- _.setTimeout(function() {
- delete chartData.pending[i];
- }, 5E3, this, "fc.toSendToIframe");
- }
- },
- sendToChildren : function(a, callback, options) {
- var self = this;
- /** @type {number} */
- var i = this.dataToSend.childs.push({
- sendedTo : [],
- tryTo : [],
- callback : callback ? _.bind(callback, options || this) : false,
- data : a
- }) - 1;
- _.forEachKey(this.childs, function(a) {
- this.dataToSend.childs[i].tryTo.push(a);
- return 1;
- }, this);
- if (_.keys(this.childs).length) {
- _.forEachKey(this.childs, function(pid) {
- this.sendToIframe(self.childs[pid].window, _.mixin(a, {
- toCounter : pid
- }), function(inp) {
- this.dataToSend.childs[i].sendedTo.push(pid);
- if (this.dataToSend.childs[i].callback) {
- this.dataToSend.childs[i].callback(inp);
- }
- }, this);
- }, this);
- }
- },
- sendToParents : function(a, callback, options) {
- /** @type {number} */
- var id = this.dataToSend.parents.push({
- sendedTo : [],
- tryTo : [],
- callback : callback ? _.bind(callback, options || this) : false,
- data : a
- }) - 1;
- _.forEachKey(this.parents, function(a) {
- this.dataToSend.parents[id].tryTo.push(a);
- return 1;
- }, this);
- if (_.keys(this.parents).length) {
- this.sendToIframe(window.parent, a, function(inp) {
- _.forEachKey(this.parents, function(derTrigger) {
- this.dataToSend.parents[id].sendedTo.push(derTrigger);
- if (this.dataToSend.parents[id].callback) {
- this.dataToSend.parents[id].callback(inp);
- }
- }, this);
- }, this);
- }
- },
- addHandler : function(a, fn, context) {
- if (!this.handlers[a]) {
- /** @type {!Array} */
- this.handlers[a] = [];
- }
- this.handlers[a].push({
- fn : fn,
- ctx : context
- });
- },
- _initComponent : function() {
- /** @type {!NodeList<Element>} */
- var eiFrame = window.document.getElementsByTagName("iframe");
- /** @type {number} */
- var i = 0;
- ctor.superclass._initComponent.apply(this, arguments);
- this.handlers = _.mixin({}, this.getHandlers());
- this.isIframe = $scope.isIframe();
- if (this.message) {
- /** @type {number} */
- i = 0;
- for (; i < eiFrame.length; i++) {
- /** @type {!Element} */
- var subdoc = eiFrame[i];
- (function(self, doc) {
- self.sendToIframe(doc.contentWindow, {
- type : "initToChild"
- }, function(params) {
- self.childs[params.counterId] = {
- info : params,
- window : doc.contentWindow
- };
- });
- })(this, subdoc);
- }
- if (this.isIframe) {
- this.sendToIframe(window.parent, {
- type : "initToParent"
- }, function(height) {
- this.trigger("parentConnect", {
- source : window.parent
- }, height);
- });
- }
- self.on(window, "message", this.onMessage, this, {
- passive : false,
- name : "FrameConnector"
- });
- }
- },
- trigger : function(id, data, elem) {
- var _this = this;
- return _.map(function(item) {
- item = item.fn.call(item.ctx || _this, data, elem) || {};
- return _.mixin(item, {
- counterId : _this.counterId,
- hid : _this.hid
- });
- }, this.handlers[id]);
- },
- DIR_INDEX : 2,
- onMessage : function(message) {
- var b;
- /** @type {!Array} */
- var parent = [];
- try {
- var data = message.data;
- data = service.parse(message.data);
- var a = data[this.nameSpace];
- } catch (h) {
- return;
- }
- if (a && a.substring && a.substring(0, this.nameSpace.length) == this.nameSpace) {
- /** @type {number} */
- b = 0;
- for (; 3 >= b; b++) {
- var result = _.arrayIndexOf(a, this.spliter);
- if (-1 !== result) {
- parent.push(a.substring(0, result));
- } else {
- parent.push(a);
- }
- a = a.substring(result + 1);
- }
- /** @type {!Array<?>} */
- b = parent.splice(1, 3);
- if ((data = data.data) && data.type && this.handlers[data.type] && "0" === b[this.DIR_INDEX]) {
- if (!data.toCounter || data.toCounter === this.counterId) {
- try {
- message.source;
- } catch (h) {
- return;
- }
- if (data.counterId && this.checkFrame(message.source)) {
- result = this.trigger(data.type, message, data);
- message.source.postMessage(this.genMessage(result, [b[0], b[1], data.counterId]).string, "*");
- }
- }
- } else {
- if (b[this.DIR_INDEX] == this.counterId && _.isArray(data) && _.arrayEvery(data, function(options) {
- return options.counterId && options.hid;
- }) && (message = this.pending[[b[0], b[1]].join(this.spliter)])) {
- message.apply(this, data);
- }
- }
- }
- }
- });
- var result = parse();
- var offset = context.getTimezone();
- var date = context.getTimestamp();
- /** @type {!Screen} */
- var screen = window.screen;
- /** @type {number} */
- var opts = 64;
- /** @type {number} */
- var batch = $scope.isIE() ? 512 : 2048;
- /** @type {number} */
- var polymorphLimit = $scope.isIE() ? 512 : 2048;
- /** @type {number} */
- var depth = $scope.isIE() ? 100 : 400;
- /** @type {number} */
- var end = 100;
- /** @type {string} */
- var up = "noindex";
- /** @type {!RegExp} */
- var reBlockName = /\.(3gp|7z|aac|ac3|acs|ai|avi|ape|apk|asf|bmp|bz2|cab|cdr|crc32|css|csv|cue|divx|dmg|djvu?|doc(x|m|b)?|emf|eps|exe|flac?|flv|iso|swf|gif|t?gz|jpe?g?|js|m3u8?|m4a|mp(3|4|e?g?)|m4v|md5|mkv|mov|msi|ods|og(g|m|v)|psd|rar|rss|rtf|sea|sfv|sit|sha1|svg|tar|tif?f|torrent|ts|txt|vob|wave?|wma|wmv|wmf|webm|ppt(x|m|b)?|xls(x|m|b)?|pdf|phps|png|xpi|g?zip)$/i;
- /** @type {number} */
- var barStartTime = +new Date;
- var line2StartX;
- var line1StartX;
- var k = function() {
- return "1227";
- }();
- api.init().setSafe("counters", {}).setSafe("hitParam", {}).setSafe("counterNum", 0).setSafe("dataLayer", []).setSafe("hitId", _.random(1, 1073741824)).setSafe("_globalMetrikaHitId", _.random()).setSafe("v", k);
- /**
- * @param {!Object} r
- * @param {?} t
- * @param {string} c
- * @param {!Object} n
- * @return {?}
- */
- window.Ya.Metrika = function(r, t, c, n) {
- var options = this;
- return require(function() {
- /**
- * @param {!Object} opts
- * @return {?}
- */
- function check(opts) {
- /** @type {string} */
- var text = document.referrer || "";
- var i;
- var g;
- if ((new RegExp("^https?://" + result.host + "/")).test(text)) {
- return false;
- }
- var p = opts.patterns;
- /** @type {number} */
- i = 0;
- for (; i < p.length; i++) {
- /** @type {!RegExp} */
- var e = new RegExp(p[i], "i");
- if (text.match(e)) {
- if (e = opts.params || [], e.length) {
- var h = _.safeDecodeURIComponent((RegExp.$1 || "").replace(/\+/g, "%20"));
- /** @type {number} */
- g = 0;
- for (; g < e.length; g++) {
- if (h == _.safeDecodeURIComponent(e[g])) {
- return true;
- }
- }
- } else {
- return true;
- }
- }
- }
- return false;
- }
- /**
- * @param {!Object} data
- * @param {boolean} dir
- * @return {?}
- */
- function walk(data, dir) {
- /** @type {boolean} */
- var x = false;
- var i;
- if (data && "string" != typeof data && data.length) {
- /** @type {number} */
- i = 0;
- for (; i < data.length; i++) {
- var n = data[i].selector;
- var txt = data[i].text;
- var key = n.charAt(0);
- n = n.slice(1);
- if ("#" == key) {
- if (key = document.getElementById(n)) {
- /** @type {boolean} */
- x = true;
- if (dir) {
- pairs.unshift([key, key.innerHTML]);
- }
- key.innerHTML = txt;
- }
- } else {
- if ("." == key) {
- key = util.getElementsByClassName(n);
- /** @type {number} */
- n = 0;
- for (; n < key.length; n++) {
- /** @type {boolean} */
- x = true;
- var name = key[n];
- var text = txt;
- if (dir) {
- pairs.unshift([name, name.innerHTML]);
- }
- name.innerHTML = text;
- }
- }
- }
- }
- }
- return x;
- }
- /**
- * @return {undefined}
- */
- function handleTweets() {
- var i;
- /** @type {number} */
- i = 0;
- for (; i < pairs.length; i++) {
- pairs[i][0].innerHTML = pairs[i][1];
- }
- }
- /**
- * @param {string} s
- * @param {string} obj
- * @return {?}
- */
- function cb(s, obj) {
- var x;
- /** @type {string} */
- var line = "";
- s = s && s.replace(/^\?/, "");
- obj = obj && obj.replace(/^#/, "") || "";
- if (s) {
- var i = s.split("&");
- /** @type {number} */
- x = 0;
- for (; x < i.length; x++) {
- var gbBackgroundData = i[x].split("=");
- if ("_openstat" === gbBackgroundData[0]) {
- line = gbBackgroundData[1];
- }
- }
- }
- var serverListArray = obj.split("?");
- /** @type {number} */
- x = 0;
- for (; x < serverListArray.length; x++) {
- var sessionOperatorStrings = serverListArray[x].split("&");
- /** @type {number} */
- i = 0;
- for (; i < sessionOperatorStrings.length; i++) {
- gbBackgroundData = sessionOperatorStrings[i].split("=");
- if ("_openstat" === gbBackgroundData[0]) {
- line = gbBackgroundData[1];
- }
- }
- }
- if (line) {
- line = -1 < line.indexOf(";") ? _.safeDecodeURIComponent(line) : base64.decode(that.decode(line.replace(/[-*_]/g, function(operator) {
- return {
- "*" : "+",
- "-" : "/",
- _ : "="
- }[operator] || operator;
- })));
- }
- return line && (x = line.split(";"), 4 == x.length) ? {
- service : x[0],
- campaign : x[1],
- ad : x[2],
- source : x[3]
- } : null;
- }
- /**
- * @param {string} command
- * @param {string} text
- * @return {?}
- */
- function update(command, text) {
- /** @type {boolean} */
- var CMD_REQUIRES_CONFIG = command !== result.href;
- /** @type {string} */
- var eventName = document.referrer.replace(/\/$/, "");
- var request = (text || "").replace(/\/$/, "");
- /** @type {boolean} */
- eventName = eventName !== request;
- /** @type {number} */
- request = 0;
- if (eventName && CMD_REQUIRES_CONFIG) {
- /** @type {number} */
- request = 3;
- } else {
- if (eventName) {
- /** @type {number} */
- request = 1;
- } else {
- if (CMD_REQUIRES_CONFIG) {
- /** @type {number} */
- request = 2;
- }
- }
- }
- return request;
- }
- /**
- * @param {!Function} topic
- * @param {string} var_args
- * @return {?}
- */
- function merge(topic, var_args) {
- return require(function() {
- if (!options.isDestructing()) {
- return topic.apply(this, arguments);
- }
- }, var_args || "");
- }
- /**
- * @param {?} escapeNodeOffset
- * @return {?}
- */
- function create(escapeNodeOffset) {
- /** @type {boolean} */
- var that = false;
- if (!jointKeys) {
- config.initCookie();
- a.init(api);
- }
- config.retransmit(api);
- if (obj) {
- FACTORY.init(obj, i);
- }
- legacyLoader.init(val);
- if (api.get("hitParam")[name]) {
- if (1 != c || api.get("counters")[name]) {
- return false;
- }
- /** @type {boolean} */
- that = true;
- }
- api.get("counters")[name] = options;
- /** @type {number} */
- api.get("hitParam")[name] = 1;
- _.async(function() {
- config.initFingerPrint();
- });
- options._webvisor = data && data.webvisor || false;
- options._directCampaign = data && data.directCampaign;
- if (data && data.trackHash) {
- dispose(true);
- }
- if (!that) {
- s = new Schema({
- protocol : "https:",
- globalConfig : api,
- counterId : r,
- counterType : c,
- hid : i,
- tz : offset,
- ts : date,
- url : result.href,
- enabled : options._webvisor
- });
- options.replacePhones();
- that = new Uint8Array({
- globalConfig : api
- });
- /**
- * @param {?} cbAsync
- * @return {undefined}
- */
- var initialize = function(cbAsync) {
- var links = new Page({
- protocol : "https:",
- counterType : c,
- counterId : r,
- trackHash : length,
- hitId : i,
- webvisor : options._webvisor,
- counter : options,
- globalConfig : api,
- counterNum : Ja
- });
- var post = {
- ut : hover,
- he : data ? ~~data.httpError : 0,
- ad : 1 == c && window.Ya && window.Ya.Direct,
- pv : true,
- cpf : $scope.isChromePdf(),
- fu : update(url, key),
- saveRef : true
- };
- /** @type {number} */
- line2StartX = +new Date;
- links.sendHit({
- url : url,
- referrer : key,
- title : util.getDocumentTitle(),
- vParams : t,
- userParams : newUserAttributes,
- nohit : n,
- experiments : experiments,
- modes : post,
- visitColor : s.getVc(),
- hasPrerender : escapeNodeOffset,
- ts : date,
- tz : offset,
- callback : function(data, id) {
- var node;
- data = data || {};
- if (!(node = "0" !== data.pcs)) {
- open.initZZ();
- }
- if (data.eu !== undefined) {
- api.set("isEU", data.eu);
- }
- methods.init(id);
- body.match();
- store.sync(r, c, node, api);
- me.log("PageView. Counter ", r, ". URL: ", result.href, ". Referrer: " + document.referrer, ". Params: ", t);
- if (!line1StartX) {
- /** @type {number} */
- line1StartX = +new Date;
- }
- if (data.webvisor) {
- data.webvisor.isEU = api.get("isEU");
- }
- if (!options.isDestructing()) {
- s.start(data.webvisor);
- var params = data.mp2;
- node = new Error({
- counterId : r
- });
- node.erase("mp2_substs");
- if (params) {
- b: {
- var s = params.conditions;
- var i;
- if (s && s.length) {
- /** @type {number} */
- i = 0;
- for (; i < s.length; i++) {
- var c = s[i];
- if ("ref" == c.type) {
- c = check(c);
- } else {
- if ("adv" == c.type) {
- var p;
- var e = c;
- var n = window.Ya._metrika.counter._directCampaign;
- var a = e.ServiceNamePattern;
- var k = e.RefererPattern;
- c = n ? e.direct_orders : e.direct_camp;
- /** @type {string} */
- var referrer = document.referrer;
- var other = s.parse(result.search);
- var context = cb(result.search, result.hash);
- var obj = {};
- /** @type {!Array} */
- var key = ["source", "medium", "campaign", "term", "content"];
- /** @type {number} */
- p = 0;
- for (; p < key.length; p++) {
- if (other["utm_" + key[p]]) {
- obj[key[p]] = other["utm_" + key[p]];
- }
- }
- var m = n ? "direct.yandex.ru" : context && context.service || obj.source;
- /** @type {boolean} */
- p = false;
- if (!p && a && a.length) {
- /** @type {number} */
- key = 0;
- for (; key < a.length; key++) {
- if ((new RegExp(a[key], "i")).test(m)) {
- /** @type {boolean} */
- p = true;
- break;
- }
- }
- }
- if (!p && !e.yandex_direct && k && k.length) {
- /** @type {number} */
- a = 0;
- for (; a < k.length; a++) {
- if ((new RegExp(k[a], "i")).test(referrer)) {
- /** @type {boolean} */
- p = true;
- break;
- }
- }
- }
- if (!p && e.google_adwords && other.gclid) {
- /** @type {boolean} */
- p = true;
- }
- if (p && c && c.length && (p = false, n = n || context && context.campaign || obj && obj.campaign)) {
- /** @type {number} */
- e = 0;
- for (; e < c.length; e++) {
- if (c[e] == n) {
- /** @type {boolean} */
- p = true;
- break;
- }
- }
- }
- /** @type {boolean} */
- c = p;
- } else {
- /** @type {boolean} */
- c = false;
- }
- }
- if (c) {
- if (s[i].track_id) {
- node.create("mp2_track", s[i].track_id, 43200);
- }
- break b;
- }
- }
- }
- }
- s = node.read("mp2_track");
- params = params.substs && params.substs[s];
- if (s && params) {
- node.create("mp2_substs", _.toJSON(params));
- node = walk(params);
- options.params("__ym", node ? "mp_trackid" : "mp_trackid_bad", s);
- } else {
- handleTweets();
- }
- } else {
- handleTweets();
- }
- self.on(window, "load", options.replacePhones, options);
- }
- /** @type {boolean} */
- options._inited = true;
- if (cbAsync) {
- cbAsync();
- }
- }
- });
- };
- that.sync(initialize);
- }
- f(false);
- self.on(document, "click", fn);
- if (data) {
- if (data.enableAll) {
- f(true);
- init(true);
- loop();
- } else {
- if (data.clickmap) {
- init(data.clickmap);
- }
- if (data.trackLinks) {
- f(data.trackLinks);
- }
- if (data.accurateTrackBounce) {
- loop(data.accurateTrackBounce);
- }
- }
- if (data.triggerEvent) {
- _.async(function() {
- _this.dispatchCustomEvent("yacounter" + r + "inited");
- });
- }
- }
- }
- /**
- * @return {undefined}
- */
- function do_then_queue() {
- var postProcessor = new img({
- frameConnector : self,
- globalConfig : api,
- initCounter : create,
- disable : data ? data.yaDisableGDPR : false
- });
- postProcessor.handle.apply(postProcessor, arguments);
- }
- /**
- * @param {string} val
- * @return {undefined}
- */
- function f(val) {
- var snippet = {};
- switch(typeof val) {
- case "string":
- /** @type {boolean} */
- snippet.on = true;
- break;
- case "object":
- /** @type {boolean} */
- snippet.on = true;
- break;
- case "boolean":
- /** @type {string} */
- snippet.on = val;
- break;
- default:
- return;
- }
- options._trackLinks = snippet;
- }
- /**
- * @param {string} arg2
- * @return {undefined}
- */
- function fn(arg2) {
- if (options._trackLinks && options._trackLinks.on) {
- parse(arg2);
- }
- }
- /**
- * @param {string} id
- * @return {undefined}
- */
- function parse(id) {
- var data = check(id);
- var type;
- if (data) {
- /** @type {boolean} */
- id = false;
- /** @type {string} */
- var name = (type = "" + data.href) ? type.split(/\?/)[0] : "";
- /**
- * @param {string} args
- * @return {undefined}
- */
- var expand = function(args) {
- var i = getUrl(data);
- $.sendClickLink({
- url : type,
- title : type === i ? "" : i,
- modes : args
- });
- };
- if (reBlockName.test(name) || reBlockName.test(type) || filter(type, e) || filter(name, e)) {
- /** @type {boolean} */
- id = true;
- }
- var key = util.classNameExists(data, "ym-disable-tracklink");
- name = util.classNameExists(data, "ym-external-link");
- if (!key) {
- key = {
- ln : true,
- dl : id
- };
- if (name) {
- expand(key);
- } else {
- name = data.hostname || _.parseUrl(data.href).hostname || "";
- if (get(parse().hostname, name)) {
- if (id) {
- /** @type {boolean} */
- key.ln = false;
- expand(key);
- } else {
- if ((id = getUrl(data)) && id != type) {
- res.set("il", _.trim(id, end));
- }
- }
- } else {
- if (!(type && -1 != type.search(/^ *(data|javascript):/i))) {
- /** @type {string} */
- key.ut = up;
- expand(key);
- }
- }
- }
- }
- }
- }
- /**
- * @param {?} opts
- * @return {undefined}
- */
- function init(opts) {
- if ("undefined" === typeof opts) {
- /** @type {boolean} */
- opts = true;
- }
- if (true === opts) {
- opts = {};
- }
- if (options._clickmap) {
- options._clickmap.destroy();
- }
- if (opts) {
- options._clickmap = new KeepAlive({
- globalConfig : api,
- filter : opts.filter,
- ignoreTags : opts.ignoreTags,
- quota : opts.quota,
- isTrackHash : opts.isTrackHash,
- protocol : "https:",
- counterId : r,
- counterType : c,
- startTime : barStartTime
- });
- }
- }
- /**
- * @param {!Function} value
- * @param {number} e
- * @return {undefined}
- */
- function initialize(value, e) {
- /**
- * @return {undefined}
- */
- function sync() {
- if (!r) {
- if (key) {
- _.clearTimeout(key);
- }
- var c = s ? sinceLastPos : sinceLastPos + +new Date - begin;
- /** @type {number} */
- c = e - c;
- if (0 > c) {
- /** @type {number} */
- c = 0;
- }
- key = _.setTimeout(function() {
- /** @type {boolean} */
- r = true;
- cb(false);
- value();
- }, c, "trackUserTime");
- }
- }
- /**
- * @return {undefined}
- */
- function load() {
- if (!w) {
- /** @type {boolean} */
- h = true;
- /** @type {boolean} */
- s = false;
- /** @type {boolean} */
- w = true;
- sync();
- }
- }
- /**
- * @param {boolean} argCount
- * @return {undefined}
- */
- function cb(argCount) {
- var i;
- /** @type {number} */
- i = 0;
- for (; i < events.length; i = i + 3) {
- if (argCount) {
- self.on(events[i], events[i + 1], events[i + 2], {
- name : "tabTrack"
- });
- } else {
- self.un(events[i], events[i + 1], events[i + 2]);
- }
- }
- }
- /** @type {boolean} */
- var h = false;
- /** @type {boolean} */
- var w = false;
- /** @type {boolean} */
- var s = true;
- /** @type {number} */
- var sinceLastPos = 0;
- /** @type {number} */
- var begin = +new Date;
- /** @type {null} */
- var key = null;
- /** @type {boolean} */
- var r = false;
- if ($scope.isIE()) {
- _.setTimeout(value, e, "trackUserTime");
- } else {
- /** @type {!Array} */
- var events = [window, "blur", function() {
- /** @type {boolean} */
- s = h = w = true;
- sinceLastPos = sinceLastPos + (+new Date - begin);
- /** @type {number} */
- begin = +new Date;
- sync();
- }, window, "focus", function() {
- if (!(h || w)) {
- /** @type {number} */
- sinceLastPos = 0;
- }
- /** @type {number} */
- begin = +new Date;
- /** @type {boolean} */
- h = w = true;
- /** @type {boolean} */
- s = false;
- sync();
- }, document, "click", load, document, "mousemove", load, document, "keydown", load, document, "scroll", load];
- cb(true);
- sync();
- }
- }
- /**
- * @param {number} error
- * @return {undefined}
- */
- function loop(error) {
- if ("number" !== typeof error) {
- /** @type {number} */
- error = 15E3;
- }
- if (!options._isAccurateTrackBounce) {
- /** @type {boolean} */
- options._isAccurateTrackBounce = true;
- var order = new Array({
- counterId : r
- });
- var length = order.get("lastHit");
- order.set("lastHit", context.getMs());
- if ((order = order.get("lastHit")) && (!length || length < order - 18E5) || !cb(document.referrer, parse().href) || .1 > Math.random()) {
- initialize(function() {
- options.notBounce();
- }, error);
- }
- }
- }
- /**
- * @param {!Function} callback
- * @return {undefined}
- */
- function defer(callback) {
- /**
- * @return {?}
- */
- var resolve = function() {
- var type = parse().hash.split("#")[1];
- if ("undefined" == typeof type) {
- return false;
- }
- var questionChar = type.indexOf("?");
- if (0 < questionChar) {
- type = type.substring(0, questionChar);
- }
- return type;
- };
- var initialLetter = resolve();
- (function fn() {
- var letterCandidate = resolve();
- if (letterCandidate !== initialLetter) {
- callback();
- initialLetter = letterCandidate;
- }
- T = _.setTimeout(fn, 200, "trackHash");
- })();
- }
- /**
- * @param {!Function} callback
- * @return {undefined}
- */
- function dispose(callback) {
- if (false === callback) {
- if (length) {
- if ("onhashchange" in window) {
- self.un(window, "hashchange", handle);
- } else {
- _.clearTimeout(T);
- }
- /** @type {boolean} */
- length = false;
- }
- } else {
- if (callback = handle, !length) {
- if ("onhashchange" in window) {
- self.on(window, "hashchange", callback);
- } else {
- defer(callback);
- }
- /** @type {boolean} */
- length = true;
- }
- }
- $.setTrackHash(length);
- /** @type {boolean} */
- options._trackHash = length;
- }
- /**
- * @return {undefined}
- */
- function handle() {
- var ns = {
- ut : hover,
- ad : 1 == c && window.Ya && window.Ya.Direct,
- wh : true,
- saveRef : true,
- pv : true
- };
- rProp = message.lastReferrer = undefined;
- $.sendAjaxHit({
- url : parse().href,
- title : util.getDocumentTitle(),
- referrer : rProp,
- modes : ns
- });
- undefined = parse().href;
- }
- /**
- * @param {string} value
- * @param {!Array} def
- * @param {!Object} args
- * @return {undefined}
- */
- function callback(value, def, args) {
- value = that.parseValidate(value, def);
- /** @type {!Array} */
- def = [];
- if (value) {
- def.push(value);
- args = args || {};
- if (_.isFunction(args.callback)) {
- def.push(args.callback);
- if (args.ctx) {
- def.push(args.ctx);
- }
- }
- }
- if (def.length) {
- options.params.apply(options, def);
- }
- }
- /** @type {string} */
- var hover = "";
- /** @type {string} */
- var rProp = "";
- var undefined = message.lastReferrer = result.href;
- /** @type {number} */
- var val = 0;
- var s;
- api.setSafe("counter", options);
- if (data) {
- require(function() {
- throw data.error;
- }, "include." + data.scope)();
- }
- if ("object" === typeof r) {
- /** @type {!Object} */
- var data = r;
- n = r.defer;
- hover = r.ut;
- c = r.type;
- t = r.params;
- var newUserAttributes = r.userParams;
- var obj = r.tns;
- var experiments = data.experiments;
- var jointKeys = data.nck;
- var url = r.url;
- var key = r.referrer;
- r = r.id;
- }
- if (!window["disableYaCounter" + r]) {
- /**
- * @param {string} code
- * @param {boolean} parameters
- * @return {?}
- */
- s.parse = function(code, parameters) {
- var params = {};
- var i;
- code = code && code.replace(/^\?/, "") || "";
- if (code.length) {
- var paramsSplit = code.split("&");
- /** @type {number} */
- i = 0;
- for (; i < paramsSplit.length; i++) {
- if (paramsSplit[i]) {
- var v = paramsSplit[i].split("=");
- if (v[0]) {
- var i = _.safeDecodeURIComponent(v[0]);
- v = _.safeDecodeURIComponent((v[1] || "").replace(/\+/g, "%20"));
- if (parameters && i in params) {
- if (_.isArray(params[i])) {
- params[i].push(v);
- } else {
- /** @type {!Array} */
- params[i] = [params[i], v];
- }
- } else {
- params[i] = v;
- }
- }
- }
- }
- }
- return params;
- };
- /** @type {!Array} */
- var pairs = [];
- url = url ? url : result.href;
- key = key ? key : document.referrer;
- r = r || 0;
- if (!/^\d+$/.test(r)) {
- /** @type {number} */
- r = 0;
- }
- c = c || 0;
- /** @type {string} */
- var name = r + ":" + c;
- if (api.get("counters")[name]) {
- return api.get("counters")[name];
- }
- var i = api.get("hitId");
- var self = new ctor({
- counterId : r,
- hid : i
- });
- api.set("counterNum", api.get("counterNum") + 1);
- var Ja = api.get("counterNum");
- var $ = new Container({
- protocol : "https:",
- counterType : c,
- counterId : r,
- hitId : i,
- counter : options,
- globalConfig : api,
- counterNum : Ja
- });
- var legacyLoader = {
- init : function(k) {
- if (window.performance && "function" === typeof performance.getEntries && (k === undefined && (k = 1), !(Math.random() >= k))) {
- k = {
- 1882689622 : 1,
- 2318205080 : 1,
- 3115871109 : 1,
- 3604875100 : 1,
- 339366994 : 1,
- 2890452365 : 1,
- 849340123 : 1,
- 173872646 : 1,
- 2343947156 : 1,
- 655012937 : 1,
- 1996539654 : 1,
- 2065498185 : 1,
- 823651274 : 1,
- 12282461 : 1,
- 1555719328 : 1,
- 1417229093 : 1,
- 138396985 : 1
- };
- /** @type {!Array<PerformanceEntry>} */
- var typeSets = performance.getEntries();
- var json = {};
- var j;
- /** @type {number} */
- j = 0;
- for (; j < typeSets.length; j++) {
- /** @type {!PerformanceEntry} */
- var t = typeSets[j];
- /** @type {string} */
- var name = t.name.replace(/^https?:\/\//, "").split("?")[0];
- var id = _.fnv32a(name);
- if (k[id] && !json[name]) {
- json[name] = {
- dns : Math.round(t.domainLookupEnd - t.domainLookupStart),
- tcp : Math.round(t.connectEnd - t.connectStart),
- duration : Math.round(t.duration),
- response : Math.round(t.responseEnd - t.requestStart),
- pages : result.href
- };
- }
- }
- if (_.keys(json).length) {
- (new Event).logParams({
- timings8 : json
- });
- }
- }
- }
- };
- /** @type {number} */
- val = 24226447 == r ? 1 : .002;
- options.replacePhones = merge(function() {
- var op;
- var val;
- try {
- if ((op = (new Error({
- counterId : r
- })).read("mp2_substs")) && (val = service.parse(op))) {
- walk(val, true);
- }
- } catch (I) {
- }
- return options;
- }, "counter.replacePhones");
- options.reachGoal = merge(function(b, timeout, throttle, tx) {
- if (2 <= arguments.length && "function" === typeof timeout) {
- /** @type {!Object} */
- tx = throttle;
- /** @type {string} */
- throttle = timeout;
- timeout = undefined;
- }
- me.log("Reach goal. Counter: " + r + ". Goal id: " + b + ". Params: ", timeout);
- $.sendGoal(b, {
- vParams : timeout,
- callback : throttle,
- ctx : tx
- });
- return options;
- }, "counter.reachGoal");
- options.trackLinks = merge(function(a) {
- f(a);
- return options;
- }, "counter.trackLinks");
- var res = new Array({
- counterId : r
- });
- options.hit = merge(function(data, item, id, event, callback, context) {
- if (data) {
- if (_.isObject(item)) {
- id = item.referer;
- event = item.params;
- callback = item.callback;
- context = item.ctx;
- item = item.title;
- }
- me.log("PageView. Counter " + r, ". URL: " + data, ". Referrer: " + id, ". Params: ", event);
- $.sendHit({
- url : data,
- title : item,
- referrer : id,
- modes : {
- fu : update(data, id)
- },
- vParams : event,
- callback : callback,
- ctx : context
- });
- } else {
- _.warning("Empty hit url");
- }
- return options;
- }, "counter.hit");
- options.params = merge(function(b) {
- /** @type {number} */
- var l = arguments.length;
- /** @type {number} */
- var i = l;
- /** @type {!Array<?>} */
- var result = [].slice.call(arguments, 0);
- if (b) {
- if (1 < arguments.length) {
- if (_.isFunction(arguments[l - 1])) {
- var h = arguments[l - 1];
- /** @type {number} */
- i = l - 1;
- } else {
- if (_.isFunction(arguments[l - 2])) {
- h = arguments[l - 2];
- var k = arguments[l - 1];
- /** @type {number} */
- i = l - 2;
- }
- }
- /** @type {!Array<?>} */
- result = [].slice.call(result, 0, i);
- if (1 < result.length) {
- /** @type {!Array} */
- result = [_.array2Props(result)];
- }
- }
- /** @type {boolean} */
- l = -1 !== _.arrayIndexOf(_.keys(result[0]), "__ymu");
- if (i = -1 !== _.arrayIndexOf(_.keys(result[0]), "__ym") && result[0].__ym.user_id) {
- me.log('Set user id "' + result[0].__ym.user_id + '"');
- } else {
- me.log((l ? "User p" : "P") + "arams. Counter " + r + ". Params: ", result[0]);
- }
- $.sendParams(result[0], h, k);
- } else {
- _.warning("Wrong params");
- }
- return options;
- }, "counter.params");
- self.addHandler("pluginInfo", function() {
- return data;
- }, this);
- self.addHandler("parentConnect", function(a, options) {
- $.paramsQueue.push({
- __ym : {
- parentIframe : {
- counterId : options.counterId,
- hid : options.hid
- }
- }
- });
- }, this);
- options.file = merge(function(logErrorUrl, options) {
- if (logErrorUrl) {
- options = options || {};
- $.sendFileUpload({
- url : logErrorUrl,
- title : options.title,
- vParams : options.params,
- callback : options.callback,
- ctx : options.ctx
- });
- } else {
- _.warning("Empty file url");
- }
- return options;
- }, "counter.file");
- options.extLink = merge(function(logErrorUrl, options) {
- if (logErrorUrl) {
- options = options || {};
- $.sendExtLink({
- url : logErrorUrl,
- title : options.title,
- vParams : options.params,
- callback : options.callback,
- ctx : options.ctx
- });
- } else {
- _.warning("Empty link");
- }
- return options;
- }, "counter.extLink");
- options.notBounce = merge(function(context) {
- /** @type {number} */
- var b = 0;
- context = context || {};
- if (line2StartX && line1StartX) {
- /** @type {number} */
- b = line1StartX - line2StartX;
- }
- $.sendNotBounce(b, {
- callback : context.callback,
- ctx : context.ctx
- });
- return options;
- }, "counter.notBounce");
- /** @type {!Array} */
- var e = [];
- options.addFileExtension = merge(function(s) {
- if (!s) {
- return _.warning("Empty extension"), options;
- }
- if ("string" === typeof s) {
- e.push(s);
- } else {
- e = e.concat(s);
- }
- return options;
- });
- /**
- * @param {?} mockOptions
- * @return {?}
- */
- options.clickmap = function(mockOptions) {
- init(mockOptions);
- return options;
- };
- options.accurateTrackBounce = merge(function(e) {
- loop(e);
- return options;
- });
- /** @type {null} */
- var T = null;
- /** @type {boolean} */
- var length = false;
- options.trackHash = merge(function(service) {
- dispose(service);
- return options;
- });
- var that = {
- requiredEcommerceFields : ["currency", "goods"],
- parseValidate : function(text, data) {
- var result = this.validate(text, data);
- var type;
- if (!result.isValid) {
- return console && console.log(result.message), false;
- }
- result = {};
- result[text] = {};
- if (data.currency) {
- result.currencyCode = data.currency;
- }
- if (data.goods) {
- result[text].products = data.goods;
- }
- for (type in data) {
- if (data.hasOwnProperty(type) && -1 === _.arrayIndexOf(this.requiredEcommerceFields, type)) {
- if (!result[text].actionField) {
- result[text].actionField = {};
- }
- result[text].actionField[type] = data[type];
- }
- }
- return {
- __ym : {
- ecommerce : [result]
- }
- };
- },
- validate : function(type, data) {
- /** @type {boolean} */
- var isValid = false;
- /** @type {string} */
- var messagestring = "";
- if (_.isObject(data)) {
- switch(type) {
- case "detail":
- case "add":
- case "remove":
- if (_.isArray(data.goods) && data.goods.length) {
- if (!(isValid = _.arrayEvery(data.goods, function(a) {
- return _.isObject(a) && (_.isString(a.id) || _.isNumber(a.id) || _.isString(a.name) || _.isString(a.name));
- }))) {
- /** @type {string} */
- messagestring = "All items in 'goods' should be objects and contain 'id' or 'name' field";
- }
- } else {
- /** @type {string} */
- messagestring = "Ecommerce data should contain 'goods' non-empty array";
- }
- break;
- case "purchase":
- if (_.isNumber(data.id) || _.isString(data.id)) {
- /** @type {boolean} */
- isValid = true;
- } else {
- /** @type {string} */
- messagestring = "Purchase object should contain string or number 'id' field";
- }
- }
- } else {
- /** @type {string} */
- messagestring = "Ecommerce data should be an object";
- }
- return {
- isValid : isValid,
- message : messagestring
- };
- }
- };
- options.ecommerceDetail = merge(function(x1, b) {
- callback("detail", x1, b);
- return options;
- }, "ecommerce.detail");
- options.ecommerceAdd = merge(function(x1, b) {
- callback("add", x1, b);
- return options;
- }, "ecommerce.add");
- options.ecommerceRemove = merge(function(x1, b) {
- callback("remove", x1, b);
- return options;
- }, "ecommerce.remove");
- options.ecommercePurchase = merge(function(x1, b) {
- callback("purchase", x1, b);
- return options;
- }, "ecommerce.purchase");
- options.userParams = merge(function(a, errorType, close) {
- if (_.isObject(a)) {
- options.params({
- __ymu : a
- }, errorType || function() {
- }, close);
- } else {
- _.warning("Wrong user params");
- }
- return options;
- }, "uparams");
- options.experiments = merge(function(a, extCallBack, tx) {
- $.sendExperiments({
- callback : extCallBack,
- ctx : tx,
- experiments : a
- });
- return options;
- }, "exps");
- options.id = options.setUserID = merge(function(id, errorType, close) {
- if (_.isString(id) || _.isNumber(id)) {
- options.params({
- __ym : {
- user_id : id
- }
- }, errorType || function() {
- }, close);
- } else {
- _.warning("Incorrect user ID");
- }
- return options;
- }, "id");
- var validator = new Error;
- options.getClientID = merge(function() {
- return validator.read("uid");
- }, "guid");
- /**
- * @return {?}
- */
- options.enableAll = function() {
- f(true);
- init(true);
- loop();
- return options;
- };
- /**
- * @return {undefined}
- */
- options.uploadPage = function() {
- };
- options.destruct = merge(function() {
- /** @type {boolean} */
- options._isDestructing = true;
- self.un(document, "click", fn);
- self.un(window, "load", options.replacePhones, options);
- dispose(false);
- if (s) {
- s.stop();
- }
- api.set("stopRecoder", undefined);
- api.set("counter", undefined);
- init(false);
- try {
- delete window["yaCounter" + r];
- delete api.get("counters")[name];
- delete api.get("hitParam")[name];
- } catch (w) {
- }
- });
- /**
- * @return {?}
- */
- options.isDestructing = function() {
- return !!options._isDestructing;
- };
- atap.init($);
- /** @type {function(): ?} */
- options._performanceTiming = getPerformaceInfo;
- if (r) {
- if (new w({
- counter : options,
- counterId : r,
- globalConfig : api,
- frameConnector : self,
- prefsEcommerce : data && data.ecommerce,
- prefsUseDataLayer : data && data.useDataLayer
- }), "prerender" === document.webkitVisibilityState) {
- $.sendPrerenderHit({
- url : result.href,
- title : util.getDocumentTitle(),
- referrer : document.referrer
- });
- /**
- * @return {undefined}
- */
- var fn = function() {
- if ("prerender" !== document.webkitVisibilityState) {
- self.un(document, "webkitvisibilitychange", fn);
- do_then_queue(true);
- }
- };
- self.on(document, "webkitvisibilitychange", fn);
- } else {
- do_then_queue(false);
- }
- }
- }
- }, "init")();
- };
- new Embassy({
- globalConfig : api
- });
- /**
- * @return {?}
- */
- window.Ya.Metrika.counters = function() {
- /** @type {!Array} */
- var linkages = [];
- _.forEachKey(api.get("counters"), function(clusterShardData, actionParams) {
- var d = clusterShardData.split(":");
- linkages.push({
- id : +d[0],
- type : +d[1],
- accurateTrackBounce : actionParams._isAccurateTrackBounce,
- clickmap : actionParams._clickmap && actionParams._clickmap._start,
- oldCode : !!window.ya_cid,
- trackHash : !!actionParams._trackHash,
- trackLinks : actionParams._trackLinks && actionParams._trackLinks.on,
- webvisor : !!actionParams._webvisor
- });
- });
- return linkages;
- };
- api.setSafe("getCounters", function() {
- /** @type {!Array} */
- var linkages = [];
- _.forEachKey(api.get("counters"), function(clusterShardData, actionParams) {
- var d = clusterShardData.split(":");
- linkages.push({
- id : +d[0],
- type : +d[1],
- accurateTrackBounce : actionParams._isAccurateTrackBounce,
- clickmap : actionParams._clickmap && actionParams._clickmap._start,
- oldCode : !!window.ya_cid,
- trackHash : !!actionParams._trackHash,
- trackLinks : actionParams._trackLinks && actionParams._trackLinks.on,
- webvisor : !!actionParams._webvisor
- });
- });
- return linkages;
- });
- if (window.ya_cid && window.Ya.Metrika) {
- new window.Ya.Metrika(window.ya_cid, window.ya_params, window.ya_class);
- }
- if (window.ya_cid && !window.ya_hit) {
- /**
- * @param {?} a
- * @param {?} b
- * @return {undefined}
- */
- window.ya_hit = function(a, b) {
- if (window.Ya._metrika.counter) {
- window.Ya._metrika.counter.reachGoal(a, b);
- }
- };
- }
- (function() {
- /**
- * @param {string} module
- * @return {undefined}
- */
- function testAccessUnreadableDirectory(module) {
- try {
- delete window[module];
- } catch (t) {
- window[module] = undefined;
- }
- }
- var i = window.yandex_metrika_callback;
- var options = window.yandex_metrika_callbacks;
- var xhr;
- if ("function" == typeof i) {
- i();
- }
- if ("object" == typeof options) {
- /** @type {number} */
- i = 0;
- for (; i < options.length; i++) {
- if (xhr = options[i]) {
- /** @type {null} */
- options[i] = null;
- xhr();
- }
- }
- }
- testAccessUnreadableDirectory("yandex_metrika_callback");
- testAccessUnreadableDirectory("yandex_metrika_callbacks");
- })();
- /**
- * @param {!Object} partKeys
- * @return {undefined}
- */
- window.Ya.Metrika.informer = function(partKeys) {
- /** @type {boolean} */
- var b = !!window.Ya.Metrika._informer;
- /** @type {!Object} */
- Ya.Metrika._informer = partKeys;
- /** @type {string} */
- Ya.Metrika._informer.domain = "informer.yandex.ru";
- if (!b) {
- util.loadScript({
- src : "https://informer.yandex.ru/metrika/informer.js"
- });
- }
- };
- self.on(document, "click", require(function(e) {
- var target = _this.getTarget(e);
- if (target && "ym-advanced-informer" === target.className) {
- var lang = target.getAttribute("data-lang");
- var id = target.getAttribute("data-cid");
- window.Ya.Metrika.informer({
- i : target,
- id : +id,
- lang : lang
- });
- _this.prevent(e);
- }
- }, "adv-inf"), null, {
- passive : false
- });
- })(this, this.document);
Add Comment
Please, Sign In to add comment