PageSourceSearch

https://cdn.plixi.com/landing/js/legacy.js

js plixi.com collected 2026-09-24 09:16:56 UTC 75,307 bytes, 1,743 lines download raw bytes

1"use strict";
2
3function _toConsumableArray(arr) {
4    return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread()
5}
6
7function _nonIterableSpread() {
8    throw new TypeError("Invalid attempt to spread non-iterable instance")
9}
10
11function _iterableToArray(iter) {
12    if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter)
13}
14
15function _arrayWithoutHoles(arr) {
16    if (Array.isArray(arr)) {
17        for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
18            arr2[i] = arr[i]
19        }
20        return arr2
21    }
22}
23
24function _typeof(obj) {
25    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
26        _typeof = function _typeof(obj) {
27            return typeof obj
28        }
29    } else {
30        _typeof = function _typeof(obj) {
31            return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
32        }
33    }
34    return _typeof(obj)
35}(function(define) {
36    return define(function() {
37        var pluralRe = /^Plural-Forms:\s*nplurals\s*=\s*(\d+);\s*plural\s*=\s*([^a-zA-Z0-9\$]*([a-zA-Z0-9\$]+).+)$/im;
38
39        function format(s, ctx) {
40            return s.replace(/(^|.)?\{([^\}]+)\}/g, function(match, prev, k) {
41                if (prev === "\\") {
42                    return "{" + k + "}"
43                }
44                prev = prev || "";
45                return prev + ctx[k.split("#")[0].trim()]
46            })
47        }
48
49        function parsePlural(header) {
50            var rv = {
51                pluralNum: 2,
52                isPlural: function isPlural(n) {
53                    return n !== 1
54                }
55            };
56            if (!header) {
57                return rv
58            }
59            var match = header.match(pluralRe);
60            if (!match) {
61                return rv
62            }
63            rv.pluralNum = parseInt(match[1], 10);
64            if (rv.pluralNum == 1) {
65                rv.isPlural = function() {
66                    return 0
67                };
68                return rv
69            }
70            var expr = match[2];
71            var varName = match[3];
72            var code = "(function (" + varName + ") { return " + expr + " })";
73            try {
74                rv.isPlural = eval(code)
75            } catch (e) {
76                console.log("Could not evaluate: " + code)
77            }
78            return rv
79        }
80
81        function gettrans(messages, isPlural, msg1, msg2, num) {
82            if (!messages || !messages[msg1]) {
83                return num !== undefined && isPlural(num) ? msg2 : msg1
84            }
85            var trans = messages[msg1];
86            if (msg2 === undefined && num === undefined) {
87                return typeof trans === "string" ? trans : trans[0]
88            }
89            if (num !== undefined && typeof trans === "string") {
90                throw format('Plural number ({num}) provided for "{msg1}", ' + "but only singular translation exists: {trans}", {
91                    num: num,
92                    msg1: msg1,
93                    trans: trans
94                })
95            }
96            return trans[+isPlural(num)]
97        }
98        return function(messages) {
99            function puttext(msg1, msg2, num, ctx) {
100                if (_typeof(msg2) === "object" && num === undefined && ctx === undefined) {
101                    ctx = msg2;
102                    msg2 = undefined
103                }
104                var text = gettrans(puttext.messages, puttext.plural, msg1, msg2, num);
105                if (ctx) {
106                    return format(text, ctx)
107                }
108                return text
109            }
110            puttext.format = format;
111            puttext.setMessages = function(messages) {
112                puttext.messages = messages;
113                var parsed = parsePlural(messages && messages[""]);
114                puttext.pluralNum = parsed.pluralNum;
115                puttext.plural = parsed.isPlural
116            };
117            puttext.setMessages(messages);
118            return puttext
119        }
120    })
121})(typeof define !== "undefined" ? define : function(factory) {
122    if (typeof module !== "undefined" && typeof exports !== "undefined") {
123        return module.exports = factory()
124    } else {
125        return window.puttext = factory()
126    }
127});
128window.__ = puttext();
129window.__n = puttext();
130if (typeof puttextPhrases != "undefined") {
131    __.setMessages(puttextPhrases)
132}
133var KYB = {
134    channelsSuggest: {
135        settings: {
136            action: "request",
137            btnText: __("Check"),
138            placeholder: false,
139            type: false,
140            recentSearch: true,
141            keywords: false,
142            hideSearch: false,
143            onSelect: function onSelect() {},
144            onInput: function onInput() {}
145        },
146        activeItem: {},
147        init: function init(wrap, options) {
148            if (wrap.suggestInited) {
149                return wrap.suggestInited
150            }
151            var s = KYB.clone(this, false, true);
152            _.extend(s.settings, options);
153            s.wrap = wrap;
154            if (wrap.tagName == "FORM") {
155                s.form = wrap;
156                s.input = wrap.querySelector('input[name="username"]');
157                s.button = wrap.querySelector("button")
158            } else if (wrap.tagName == "INPUT") {
159                s.input = wrap;
160                s.wrap = wrap.parentNode;
161                s.form = s.wrap
162            } else {
163                s.render()
164            }
165            s.results = document.createElement("div");
166            s.results.className = "kyb-search-bar--results";
167            s.form.appendChild(s.results);
168            s.input.addEventListener("input", s.onInput.bind(s));
169            s.input.addEventListener("focus", s.onFocus.bind(s));
170            s.input.addEventListener("blur", s.onBlur.bind(s));
171            s.input.addEventListener("keydown", s.onKeydown.bind(s));
172            s.results.addEventListener("click", s.onClick.bind(s));
173            s.form.addEventListener("submit", s.onSubmit.bind(s));
174            wrap.suggestInited = s;
175            return s
176        },
177        render: function render() {
178            var s = this.settings;
179            this.form = document.createElement("form");
180            this.form.className = "hype-channels-suggest--form";
181            this.form.method = "post";
182            this.form.action = KYB.baseUrl + (s.action ? s.action + "/" : "");
183            var fields = document.createElement("div");
184            fields.innerHTML = '<label for="username-field" style="display:none;">Username</label><input class="js-email-hidden" type="text" id="username" name="email" value="">';
185            fields.className = "hype-channels-suggest--form-fields";
186            this.input = document.createElement("input");
187            this.input.type = "text";
188            this.input.className = s.inputClass || "field-input";
189            this.input.required = true;
190            this.input.autocomplete = "off";
191            this.input.name = "username";
192            this.input.placeholder = s.placeholder ? s.placeholder : s.type ? s.type == 1 ? __("Enter Instagram username") : __("Enter YouTube account") : __("Enter Instagram username or YouTube account");
193            this.button = document.createElement("button");
194            this.button.type = "submit";
195            this.button.setAttribute("disabled", "disabled");
196            this.button.className = "button button-disabled";
197            this.button.innerHTML = s.btnText;
198            fields.appendChild(this.input);
199            this.form.appendChild(fields);
200            this.form.appendChild(this.button);
201            this.wrap.appendChild(this.form)
202        },
203        onFocus: function onFocus() {
204            if (this.hideT) {
205                clearTimeout(this.hideT)
206            }
207            if (!this.suggestions && localStorage && !this.settings.hideRecent) {
208                var vuex = JSON.parse(localStorage.getItem("vuex"));
209                if (vuex && vuex.storage) {
210                    this.suggestions = vuex.storage.recentSuggests
211                }
212                if (this.suggestions && this.suggestions.length) {
213                    var r = document.createElement("div");
214                    r.className = "kyb-search-bar--results-title";
215                    r.innerText = __("Recent reports:");
216                    this.results.appendChild(r);
217                    this.renderSuggest()
218                }
219            }
220            if (!this.settings.hideSearch) {
221                this.wrap.classList.add("kyb-search-bar--form-focus");
222                if (this.wrap.dataset.overlay) {
223                    var overlay = document.querySelector(this.wrap.dataset.overlay);
224                    overlay.classList.remove("--hidden")
225                }
226            }
227        },
228        onBlur: function onBlur() {
229            var T = this;
230            this.hideT = setTimeout(function() {
231                T.wrap.classList.remove("kyb-search-bar--form-focus");
232                T.hideT = false;
233                if (T.wrap.dataset.overlay) {
234                    var overlay = document.querySelector(T.wrap.dataset.overlay);
235                    overlay.classList.add("--hidden")
236                }
237            }, 250)
238        },
239        onSubmit: function onSubmit(e) {
240            // e.preventDefault();
241            var T = this;
242            var username = this.input.value;
243            console.log(username);
244            if (!username) {
245                return false
246            }
247            if (this.xhr) {
248                this.xhr.abort()
249            }
250            if (this.reqT) {
251                clearTimeout(this.reqT);
252                this.reqT = false
253            }
254            this.results.innerHTML = "";
255            this.input.blur();
256            if (this.button) {
257                // this.button.setAttribute("disabled", "disabled")
258            }
259            if (this.currSelectedI >= 0) {
260                var s = this.suggestions[this.currSelectedI];
261                this.activeItem = s;
262                if (s && s.type && this.settings.action == "request") {
263                    T.input.value = "";
264                    this.settings.onSubmit(s, T);
265                    T.form.classList.remove("preload");
266                    return true
267                }
268            }
269            var params = {};
270            if (this.settings.usernameParamName) {
271                params[this.settings.usernameParamName] = this.settings.usernameParamField && e.detail ? e.detail[this.settings.usernameParamField] : username
272            } else {
273                params.username = username
274            }
275            if (this.settings.params) {
276                _.extend(params, this.settings.params)
277            }
278            if (this.settings.action) {
279                T.form.classList.add("preload");
280                KYB.get(this.form.action, params).then(function(resp) {
281                    if (T.settings.onSubmit) {
282                        resp.info = {
283                            type: params.type,
284                            channelId: username
285                        };
286                        T.settings.onSubmit(resp, T)
287                    }
288                    T.input.value = "";
289                    T.suggestions = false;
290                    T.form.classList.remove("preload");
291                    try {
292                        if (!resp.success && resp.errors && resp.errors.length) {
293                            var $errPlace = T.form;
294                            if (_.isArray(resp.errors[0])) {
295                                var errorText = resp.errors[0][1]
296                            } else {
297                                var errorText = resp.errors[0]
298                            }
299                            var inp = $errPlace.querySelectorAll("input");
300                            $errPlace.insertAdjacentHTML("afterbegin", '<label for="' + inp[inp.length - 1].name + '" class="kyb-error">' + errorText + "</label>");
301                            T.input.addEventListener("focus", function() {
302                                $errPlace.querySelector(".kyb-error").remove()
303                            }, {
304                                once: true
305                            });
306                            KYB.tracker.trackEvent("Report Error", {
307                                "error text": errorText,
308                                username: username,
309                                url: window.location.href
310                            })
311                        }
312                    } catch (err) {
313                        console.log(err)
314                    }
315                })
316            } else if (this.settings.onSubmit) {
317                T.form.classList.remove("preload");
318                if (!s) {
319                    s = {
320                        username: username
321                    }
322                }
323                this.settings.onSubmit(s, this);
324                this.suggestions = false
325            }
326        },
327        onInput: function onInput(e) {
328            e.preventDefault();
329            this.settings.onInput(e, this);
330            var T = this;
331            if (this.button) {
332                if (this.input.value.length > 1) {
333                    this.button.removeAttribute("disabled", "disabled")
334                } else {
335                    this.button.setAttribute("disabled", "disabled")
336                }
337            }
338            if (this.xhr) {
339                this.xhr.abort()
340            }
341            if (this.reqT) {
342                clearTimeout(this.reqT);
343                this.reqT = false
344            }
345            var str = this.input.value.trim();
346            if (str.length < 2) {
347                T.form.classList.remove("preload");
348                return false
349            }
350            if (!this.settings.hideSearch) {
351                T.form.classList.add("preload");
352                this.reqT = setTimeout(function() {
353                    T.get(str).then(function() {
354                        T.renderSuggest();
355                        T.form.classList.remove("preload")
356                    });
357                    T.reqT = false
358                }, 2e3)
359            }
360            T.suggestions = [{
361                isTip: true,
362                text: str
363            }];
364            this.results.innerHTML = "";
365            this.renderSuggest()
366        },
367        onKeydown: function onKeydown(e) {
368            if (typeof this.currSelectedI === "undefined") {
369                this.currSelectedI = -1
370            }
371            if (this.suggestions && this.suggestions.length) {
372                if (e.which === 40 && this.currSelectedI < this.suggestions.length - 1) {
373                    e.preventDefault();
374                    this.currSelectedI++;
375                    this.selected(this.currSelectedI)
376                } else if (e.which === 38 && this.currSelectedI > 0) {
377                    e.preventDefault();
378                    this.currSelectedI--;
379                    this.selected(this.currSelectedI)
380                } else if (e.which === 13) {
381                    var s = this.suggestions[this.currSelectedI];
382                    if (s) {
383                        this.input.value = s.type === "yt" ? s.channel_id : s.username
384                    }
385                }
386            }
387        },
388        onClick: function onClick(e) {
389            var link = e.target.closest(".kyb-suggest--user-link");
390            if (link) {
391                var i = _.indexOf(_.pluck(this.suggestions, "el"), link);
392                if (i >= 0 && this.suggestions[i].username) {
393                    this.currSelectedI = i;
394                    this.selected(i);
395                    this.input.value = this.suggestions[i].username
396                }
397                KYB.trigger(this.form, "submit", this.suggestions[i])
398            }
399        },
400        selected: function selected(i) {
401            if (typeof i === "undefined") {
402                i = 0;
403                this.currSelectedI = 0
404            }
405            if (this.suggestions) {
406                var className = "kyb-suggest--user-link-selected";
407                var curr = _.find(this.suggestions, function(s) {
408                    return s.el.classList.contains(className)
409                });
410                if (curr) {
411                    curr.el.classList.remove(className)
412                }
413                if (this.suggestions[i]) {
414                    this.suggestions[i].el.classList.add(className)
415                }
416            }
417        },
418        get: function get(string) {
419            var T = this;
420            var p = {
421                search: string
422            };
423            T.form.classList.add("preload");
424             var suggestHost = (KYB.domain != null && String(KYB.domain)) || (typeof window !== 'undefined' && window.location && window.location.host) || 'plixi.com';
425                var suggestBase = typeof KYB.baseUrl === 'string' ? KYB.baseUrl : '/';
426                if (!suggestBase) suggestBase = '/';
427                return this.xhr = KYB.get('https://' + suggestHost + suggestBase + 'suggest', p).then(function (resp) {
428                T.currSelectedI = -1;
429                T.suggestions = resp.list;
430                T.xhr = false;
431                T.results.innerHTML = "";
432                T.form.classList.remove("preload");
433                T.renderSuggest()
434            })
435        },
436        renderSuggest: function renderSuggest(resp) {
437            var T = this;
438            var frag = document.createDocumentFragment();
439            _.each(T.suggestions, function(suggest) {
440                suggest.el = document.createElement("div");
441                suggest.el.className = "kyb-suggest--user-link";
442                // suggest.el.addEventListener("click", function(e) {
443                //     e.preventDefault();
444                //     if (suggest.isTip) {
445                //         window.open("/instagram/" + suggest.text, "_self")
446                //     } else {
447                //         window.open("/instagram/" + suggest.username, "_self")
448                //     }
449                // }, false);
450                if (suggest.isTip) {
451                    suggest.el.dataset.username = suggest.text;
452                    var tpl = '<div class="kyb-suggest-avatar"><i class="enter-icon"></i></div>' + '<div class="kyb-suggest--user-name">' + suggest.text + "</div>" + __('Press "Enter" to request') + '<i class="far fa-angle-right"></i>'
453                } else {
454                    suggest.el.dataset.username = suggest.type == "yt" ? suggest.channel_id : suggest.username;
455                    var tpl = '<img class="kyb-suggest-avatar" src="' + suggest.avatar_url + '">' + '<div class="kyb-suggest--user-name">' + (suggest.username ? suggest.username : suggest.full_name) + (suggest.is_verified ? ' <i class="fas fa-badge-check ig-verified-bage"></i>' : "") + "</div>" + "" + (suggest.username ? suggest.full_name : "") + (suggest.followers_count ? '<span class="kyb-suggest--user-followers">' + KYB.numberFormat(suggest.followers_count, 1) + " " + (suggest.type == "yt" ? __("subscribers") : __("followers")) + "</span>" : "") + '<i class="far fa-angle-right"></i>' + (suggest.type == "yt" ? '<i class="youtube-icon"></i>' : suggest.type == "tt" ? '<i class="tiktok-icon"></i>' : '<i class="instagram-icon"></i>')
456                }
457                suggest.el.innerHTML = tpl;
458                frag.appendChild(suggest.el)
459            });
460            if (this.reqAnimF) {
461                window.cancelAnimationFrame(this.reqAnimF)
462            }
463            this.reqAnimF = window.requestAnimationFrame(function() {
464                T.results.appendChild(frag)
465            })
466        },
467        addToStorage: function addToStorage(user) {
468            try {
469                var vuex = JSON.parse(localStorage.getItem("vuex"));
470                if (!vuex) {
471                    vuex = {
472                        storage: {
473                            recentSuggests: []
474                        }
475                    }
476                }
477                if (!vuex.storage.recentSuggests.find(function(x) {
478                        return x.username === user.username
479                    })) {
480                    vuex.storage.recentSuggests.unshift({
481                        avatar_url: user.avatar_url,
482                        followers_count: user.followers_count,
483                        full_name: user.full_name,
484                        username: user.username,
485                        is_verified: user.is_verified,
486                        type: user.type,
487                        link: user.link
488                    });
489                    console.log(vuex.storage.recentSuggests);
490                    if (vuex.storage.recentSuggests.length > 3) {
491                        vuex.storage.recentSuggests.pop()
492                    }
493                    localStorage.setItem("vuex", JSON.stringify(vuex))
494                }
495            } catch (e) {
496                console.error(e)
497            }
498        }
499    },
500    trigger: function trigger(el, e, data) {
501        if (window.CustomEvent) {
502            var event = new CustomEvent(e, {
503                cancelable: true,
504                detail: data
505            })
506        } else {
507            var event = document.createEvent("CustomEvent");
508            event.initCustomEvent(e, true, true, data)
509        }
510        el.dispatchEvent(event)
511    },
512    post: function post(url, params) {
513        return this.ajax(url, "post", params)
514    },
515    get: function get(url, params) {
516        return this.ajax(url, "get", params)
517    },
518    sendForm: function sendForm(url, params) {
519        return this.ajax(url, "form", params)
520    },
521    ajax: function ajax(url, method, params) {
522        var xhr = new XMLHttpRequest;
523        var promise = new Promise(function(resolve, reject) {
524            xhr.onreadystatechange = function() {
525                if (xhr.readyState === 4) {
526                    var status = xhr.status;
527                    if (status == 200) {
528                        resolve(xhr.response)
529                    } else {
530                        reject(xhr)
531                    }
532                }
533            }
534        });
535        if (params && method == "get") {
536            url += (url.indexOf("?") < 0 ? "?" : "&") + KYB.param(params)
537        }
538        xhr.responseType = "json";
539        xhr.open(method == "form" ? "post" : method, url, true);
540        if (method == "get") {
541            xhr.setRequestHeader("Content-type", "application/json; charset=utf-8")
542        } else if (method == "post") {
543            xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8")
544        }
545        xhr.setRequestHeader("Accept", "*/*");
546        xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
547        if (method == "post") {
548            xhr.send(KYB.param(params))
549        } else if (method == "form") {
550            if (params instanceof FormData) {
551                xhr.send(params)
552            } else {
553                var buildFormData = function buildFormData(formData, data, parentKey) {
554                    if (data && _typeof(data) === "object" && !(data instanceof Date) && !(data instanceof File)) {
555                        Object.keys(data).forEach(function(key) {
556                            buildFormData(formData, data[key], parentKey ? parentKey + "[" + key + "]" : key)
557                        })
558                    } else {
559                        var value = data == null ? "" : data;
560                        formData.append(parentKey, value)
561                    }
562                };
563                var data = new FormData;
564                buildFormData(data, params);
565                xhr.send(data)
566            }
567        } else {
568            xhr.send()
569        }
570        return {
571            abort: function abort() {
572                xhr.abort()
573            },
574            then: function then(resolve, reject) {
575                this.reject = reject;
576                promise.then(resolve, reject)["catch"](function(e) {
577                    throw e
578                });
579                return this
580            },
581            xhr: xhr
582        }
583    },
584    param: function param(a) {
585        var prefix, s = [],
586            add = function add(key, valueOrFunction) {
587                var value = typeof valueOrFunction === "function" ? valueOrFunction() : valueOrFunction;
588                s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value)
589            };
590        if (a == null) {
591            return ""
592        }
593        var rbracket = /\[\]$/;
594
595        function buildParams(prefix, obj, add) {
596            var name;
597            if (_.isArray(obj)) {
598                _.each(obj, function(v, i) {
599                    if (rbracket.test(prefix)) {
600                        add(prefix, v)
601                    } else {
602                        buildParams(prefix + "[" + (_typeof(v) === "object" && v != null ? i : "") + "]", v, add)
603                    }
604                })
605            } else if (toType(obj) === "object" && !(obj instanceof Date) && !(obj instanceof File)) {
606                for (name in obj) {
607                    buildParams(prefix + "[" + name + "]", obj[name], add)
608                }
609            } else {
610                add(prefix, obj)
611            }
612        }
613
614        function toType(obj) {
615            if (obj == null) {
616                return obj + ""
617            }
618            var class2type = {};
619            return _typeof(obj) === "object" ? class2type[class2type.toString.call(obj)] || "object" : _typeof(obj)
620        }
621        for (prefix in a) {
622            buildParams(prefix, a[prefix], add)
623        }
624        return s.join("&")
625    },
626    tracker: {
627        pageLoad: function pageLoad(params, eventName) {
628            var onLoad = function onLoad() {
629                if (!params) {
630                    params = {}
631                }
632                params.url = window.location.href;
633                if (!params["Page Id"]) {
634                    params["Page Id"] = KYB.pageId
635                }
636                if (typeof params["Load Time"] == "undefined") {
637                    if (KYB.performance) {
638                        params["Response Time"] = parseFloat((KYB.performance.responseTime / 1e3).toFixed(2));
639                        params["Render Time"] = parseFloat((KYB.performance.renderTime / 1e3).toFixed(2));
640                        params["Load Time"] = parseFloat((KYB.performance.loadTime / 1e3).toFixed(2));
641                        if (params["Ajax Time"]) {
642                            params["Load Time"] = parseFloat((params["Load Time"] + params["Ajax Time"]).toFixed(2))
643                        }
644                        params["Full Time"] = parseFloat((KYB.performance.fullTime / 1e3).toFixed(2));
645                        KYB.performance = false
646                    } else {
647                        if (params["Ajax Time"]) {
648                            params["Load Time"] = params["Ajax Time"]
649                        } else {
650                            params["Load Time"] = "Empty performance data"
651                        }
652                    }
653                }
654                KYB.tracker.trackEvent(eventName ? eventName : "Page Load", params)
655            };
656            if (KYB.performance || typeof KYB.performance != "undefined") {
657                onLoad()
658            } else {
659                window.addEventListener("load", onLoad)
660            }
661        },
662        setUserId: function setUserId(userId) {
663            if (self.amplitudeInstance) {
664                self.amplitudeInstance.setUserId(userId)
665            }
666        },
667        trackEvent: function trackEvent(evName, eventProperties, skipAmplitude, amplitudeEventCallback) {
668            if (!KYB.amplitudeInstance) {
669                if (amplitudeEventCallback) {
670                    amplitudeEventCallback(false)
671                }
672                return false
673            }
674            KYB.amplitudeInstance.logEvent(evName, eventProperties || {}, amplitudeEventCallback || false);
675            if (evName == "View Report Preview") {
676                evName += " (" + (!KYB.user ? "non-" : "") + "reg)"
677            } else if (evName == "Page Action" && eventProperties.target) {
678                var rdText = "Request Demo btn";
679                if (eventProperties.target.indexOf(rdText) !== -1) {
680                    evName = rdText
681                }
682            }
683            dataLayer.push({
684                event: "logEventNoAmplitude",
685                eventType: evName,
686                eventProperties: eventProperties
687            })
688        },
689        setProperties: function setProperties(properties) {
690            if (!KYB.amplitudeInstance) {
691                return false
692            }
693            KYB.amplitudeInstance.setUserProperties(properties)
694        },
695        setOnceProperties: function setOnceProperties(properties) {
696            if (!KYB.amplitudeInstance) {
697                return false
698            }
699            var identify = new amplitude.Identify;
700            _.each(properties, function(value, key) {
701                identify.setOnce(key, value)
702            });
703            KYB.amplitudeInstance.identify(identify)
704        },
705        setUserProperty: function setUserProperty(properties) {
706            if (!KYB.amplitudeInstance) {
707                return false
708            }
709            var identify = new amplitude.Identify;
710            _.each(properties, function(value, key) {
711                identify.append(key, [value])
712            });
713            KYB.amplitudeInstance.identify(identify)
714        }
715    },
716    fsIndentify: function fsIndentify() {
717        var user = KYB.user;
718        if (user) {
719            if (KYB.isOurIp) {
720                console.log(FS, user)
721            }
722            FS.identify(user.user_id, {
723                displayName: user.name,
724                email: user.email
725            });
726            FS.setUserVars({
727                userName_str: user.name,
728                page_srt: KYB.pageId,
729                tokens_int: user.tokens,
730                payable_int: user.payable,
731                lang_srt: user.lang,
732                spentTokens_int: user.spentTokens,
733                boughtTokens_int: user.boughtTokens
734            })
735        }
736    },
737    trackScroll: {
738        init: function init() {
739            document.addEventListener("scroll", function() {
740                setTimeout(function() {
741                    KYB.tracker.trackEvent("Page Action", {
742                        "Page Id": KYB.pageId ? KYB.pageId : "unset",
743                        Action: "scroll",
744                        target: "body"
745                    })
746                }, 250)
747            }, {
748                once: true
749            })
750        }
751    },
752    trackUserAction: function() {
753        var _sendEvent = function _sendEvent(e) {
754            if (!e.currentTarget) return;
755            var targetName = e.currentTarget.getAttribute("data-track-target");
756            var actName = e.currentTarget.getAttribute("data-track-action");
757            if (!targetName) return;
758            var actionName = actName ? actName : "tap";
759            var params = {
760                "Page Id": KYB.pageId ? KYB.pageId : "unset",
761                Action: actionName,
762                target: targetName
763            };
764            var sendEvBefore = e.currentTarget.hasAttribute("data-pd");
765            if (!sendEvBefore) {
766                KYB.tracker.trackEvent("Page Action", params);
767                return
768            }
769            e.preventDefault();
770            var href = e.currentTarget.getAttribute("href");
771            KYB.tracker.trackEvent("Page Action", params, false, function() {
772                window.location = href
773            })
774        };
775        return {
776            init: function init($trackEls) {
777                _.each($trackEls.split(","), function(selector) {
778                    _.each(document.querySelectorAll(selector), function(s) {
779                        s.addEventListener("click", _sendEvent)
780                    })
781                })
782            }
783        }
784    }(),
785    numberFormat: function numberFormat(n, toFixed, minimumFractionDigits) {
786        if (typeof toFixed == "undefined") {
787            var toFixed = 2
788        }
789        if (minimumFractionDigits > toFixed) {
790            toFixed = minimumFractionDigits
791        }
792        var ranges = [{
793            divider: 1e18,
794            suffix: "P"
795        }, {
796            divider: 1e15,
797            suffix: "E"
798        }, {
799            divider: 1e12,
800            suffix: "T"
801        }, {
802            divider: 1e9,
803            suffix: "B"
804        }, {
805            divider: 1e6,
806            suffix: "M"
807        }, {
808            divider: 1e3,
809            suffix: "K"
810        }];
811        for (var i = 0; i < ranges.length; i++) {
812            if (n >= ranges[i].divider) {
813                var newN = n / ranges[i].divider;
814                var p = {
815                    maximumFractionDigits: toFixed
816                };
817                if (minimumFractionDigits) {
818                    p.minimumFractionDigits = minimumFractionDigits
819                }
820                return newN.toLocaleString("en", p) + ranges[i].suffix
821            }
822        }
823        return this.numberToLocale(n, toFixed, minimumFractionDigits)
824    },
825    numberToLocale: function numberToLocale(number, toFixed, minimumFractionDigits) {
826        if (!number) {
827            return 0
828        }
829        if (!KYB.numberToLocaleDefaultFormater || toFixed || minimumFractionDigits) {
830            var p = {};
831            if (toFixed) {
832                p.maximumFractionDigits = toFixed
833            }
834            if (minimumFractionDigits) {
835                p.minimumFractionDigits = minimumFractionDigits
836            }
837            return number.toLocaleString("en", p)
838        } else {
839            return KYB.numberToLocaleDefaultFormater.format(number)
840        }
841    },
842    exitIntentPopup: {
843        init: function init() {
844            var T = this;
845            var show = function show(e) {
846                if (e.clientY < 10) {
847                    T.show();
848                    document.removeEventListener("mouseout", show, false)
849                }
850            };
851            document.addEventListener("mouseout", show, false)
852        },
853        show: function show() {
854            this.popup = KYB.popup.show({
855                html: '<div class="kyb-exit-intent-popup--img"></div><div class="kyb-exit-intent-popup--logo"></div>' + "<h2>" + __("The State of&nbsp;Influencer Marketing 2020") + "</h2>" + "<h3>" + __("Exploring influencer fraud of&nbsp;Instagram") + "</h3>" + "<h4>" + __("In this annual report you will discover:") + "</h4><ol>" + "<li>" + __("Instagram Audience Analytics") + "</li>" + "<li>" + __("Performance Benchmarks including the average engagement rates") + "</li>" + "<li>" + __("The percentage of influencers who inflate their&nbsp;followers and engagement by country and size.") + "</li></ol>" + "<p>" + __("<b>Get Free</b> PDF with the research and start optimizing your marketing campaigns") + "</p>" + '<div class="kyb-exit-intent-popup--btn"><a href="https://plixi.com/s/auditor/resources/The-State-of-Influencer-Marketing-2019.pdf" class="btn btn--orange">' + __("Download it Free") + "</a>" + __("I want free research") + "</div>" + '<div class="kyb-exit-intent-popup--btn"><div class="btn btn--orange-ghost kyb-exit-intent-popup--btn-close">' + __("No, thanks") + "</div>" + __("I don’t want to optimize my marketing campaigns") + "</div>",
856                cssClass: "kyb-exit-intent-popup",
857                onOpen: function onOpen(t) {
858                    Cookies.set("exitIntentPopup", 1, {
859                        expires: 30,
860                        path: "/"
861                    });
862                    t.$content.querySelector(".kyb-exit-intent-popup--btn-close").addEventListener("click", function() {
863                        t.hide()
864                    }, {
865                        once: true
866                    });
867                    KYB.tracker.trackEvent("View Promo", {
868                        type: "White Paper popup"
869                    })
870                }
871            })
872        }
873    },
874    clone: function clone(o, copyProto, copyNested) {
875        function Create(i) {
876            for (i in o) {
877                if (o.hasOwnProperty(i)) this[i] = copyNested && _typeof(o[i]) == "object" ? clone(o[i], true, true) : o[i]
878            }
879        }
880        if (copyProto && "__proto__" in o) Create.prototype = o.__proto__;
881        return new Create
882    },
883    currPopup: false,
884    allPopups: [],
885    popup: {
886        settings: {
887            html: "",
888            cssClass: ""
889        },
890        all: [],
891        create: function create(options) {
892            var popup = KYB.clone(KYB.popup, false, true);
893            _.extend(popup.settings, options);
894            KYB.allPopups.push(popup);
895            return popup
896        },
897        show: function show(options) {
898            if (navigator.userAgent.match("HypeauditorPdfGen/1.0")) {
899                return false
900            }
901            var popup = this.create(options);
902            popup.open();
903            return popup
904        },
905        render: function render() {
906            var T = this;
907            this.$el = document.createElement("div");
908            this.$el.setAttribute("class", "kyb-popup kyb-popup--curr" + (this.settings.cssClass ? " " + this.settings.cssClass : "") + (this.settings.without_close_btn ? " kyb-popup--without-close-btn" : ""));
909            this.$wrap = document.createElement("div");
910            this.$wrap.classList.add("kyb-popup-wrap");
911            this.wrapS = this.$wrap.style;
912            this.$content = document.createElement("div");
913            this.$content.classList.add("kyb-popup-content");
914            if (this.settings.html.jquery) {
915                this.$content.appendChild(this.settings.html[0])
916            } else if (_.isObject(this.settings.html)) {
917                this.$content.appendChild(this.settings.html)
918            } else {
919                var frag = document.createRange().createContextualFragment(this.settings.html);
920                this.$content.appendChild(frag)
921            }
922            this.contentS = this.$content.style;
923            if (!this.settings.without_close_btn) {
924                this.$close = document.createElement("div");
925                this.$close.classList.add("kyb-popup-close");
926                this.$close.innerHTML = '<i class="fas fa-times"></i>';
927                this.$close.addEventListener("click", function() {
928                    T.hide()
929                });
930                this.$wrap.appendChild(this.$close)
931            }
932            this.$wrap.appendChild(this.$content);
933            this.$el.appendChild(this.$wrap);
934            this.$el.addEventListener("click", function(e) {
935                if (e.target === T.$el && !T.settings.keepOpened) {
936                    T.hide()
937                }
938            });
939            return this
940        },
941        update: function update(html) {
942            if (!this.$el) {
943                this.settings.html = html
944            } else {
945                this.$content.innerHTML = "";
946                if (html.jquery) {
947                    this.$content.appendChild(html[0])
948                } else if (_.isObject(html)) {
949                    this.$content.appendChild(html)
950                } else {
951                    var frag = document.createRange().createContextualFragment(html);
952                    this.$content.appendChild(frag)
953                }
954            }
955        },
956        updWidth: function updWidth() {
957            var T = this;
958            this.wrapS.width = "auto";
959            this.contentS.width = "auto";
960            var newWidth = Math.round(T.$wrap.width());
961            this.wrapS.width = KYB.popup.oldWidth + "px";
962            window.requestAnimationFrame(function() {
963                T.wrapS.width = newWidth + "px";
964                KYB.popup.oldWidth = newWidth
965            })
966        },
967        open: function open() {
968            var T = this;
969            var popup = this.render();
970            document.body.appendChild(popup.$el);
971            document.body.classList.add("kyb-popup-showing");
972            if (KYB.allPopups[KYB.allPopups.length - 2]) {
973                KYB.allPopups[KYB.allPopups.length - 2].$el.classList.remove("kyb-popup--curr")
974            }
975            if (T.settings.onOpen) {
976                T.settings.onOpen(T)
977            }
978            KYB.currPopup = popup
979        },
980        hide: function hide() {
981            if (this.$el) {
982                KYB.allPopups.splice(_.indexOf(KYB.allPopups, this), 1);
983                if (!KYB.allPopups.length) {
984                    document.body.classList.remove("kyb-popup-showing");
985                    KYB.currPopup = false
986                } else {
987                    if (KYB.allPopups[KYB.allPopups.length - 1]) {
988                        KYB.currPopup = KYB.allPopups[KYB.allPopups.length - 1];
989                        KYB.currPopup.$el.classList.add("kyb-popup--curr")
990                    }
991                }
992                if (typeof CustomEvent != "undefined") {
993                    var event = new CustomEvent("popup_close");
994                    this.$el.dispatchEvent(event)
995                } else {
996                    this.$el.fireEvent("popup_close")
997                }
998                this.$el.remove();
999                if (this.settings.onClose) {
1000                    this.settings.onClose()
1001                }
1002            }
1003        },
1004        currPopupHide: function currPopupHide() {
1005            if (KYB.currPopup) {
1006                KYB.currPopup.hide()
1007            }
1008        },
1009        allHide: function allHide() {
1010            var s = KYB.allPopups.length;
1011            for (var i = 0; i < s; i++) {
1012                this.currPopupHide()
1013            }
1014        }
1015    },
1016    newTotalPrice: function newTotalPrice(coupons) {
1017        var totalPrice = 0;
1018        var coupons = parseInt(coupons);
1019        switch (coupons) {
1020            case 1:
1021                totalPrice = KYB.couponsPriceConfig[1];
1022                break;
1023            case 10:
1024                totalPrice = KYB.couponsPriceConfig[10];
1025                break;
1026            case 50:
1027                totalPrice = KYB.couponsPriceConfig[50];
1028                break;
1029            default:
1030                totalPrice = (coupons * (coupons > 50 ? 6.98 : 14.9)).toFixed(2)
1031        }
1032        if (!KYB.user.discount20Tokens50Done && coupons == 10) {
1033            return Math.floor(totalPrice * (99 / totalPrice))
1034        } else if (KYB.user.discountAffiliate && coupons != 10) {
1035            return totalPrice * .6
1036        } else {
1037            return totalPrice
1038        }
1039    },
1040    buyTokenPopupShow: function buyTokenPopupShow(token, header, desc, source) {
1041        KYB.buyBtnClickDate = (new Date).getTime();
1042        var T = this;
1043        var $html = document.createElement("div");
1044        $html.id = "buy-token-popup";
1045        $html.innerHTML = '<h2 class="popup-header">' + (header ? header : token + (token > 1 ? " credits" : " credit") + " " + __("for") + " $" + KYB.newTotalPrice(token)) + '<p style="color: #7f7f7f; margin-top: 8px; line-height: 24px">' + (desc ? desc : __("1 credit = 1 Instagram/Youtube report for 1 year.")) + '</p></h2><div class="preloader"></div>';
1046        var popup = KYB.popup.show({
1047            html: $html,
1048            cssClass: "buy-token-popup",
1049            onClose: function onClose() {
1050                if (T.xhr) {
1051                    T.xhr.abort()
1052                }
1053            }
1054        });
1055        var p = {
1056            source: source ? source : "paywall",
1057            credits: token
1058        };
1059        this.xhr = KYB.get(KYB.baseUrl + "ajax/getTokensBuyForm/", p).then(function(resp) {
1060            if (resp.html) {
1061                var frag = document.createRange().createContextualFragment(resp.html);
1062                $html.appendChild(frag);
1063                $html.querySelector(".preloader").remove();
1064                if (KYB.user) {
1065                    KYB.buy.popup.init()
1066                }
1067            } else {
1068                $html.innerHTML = "Error. Try again."
1069            }
1070        })
1071    },
1072    subscribe: {
1073        popup: function popup(plan) {
1074            var popup = KYB.popup.show({
1075                html: "<h2>" + __("Subscribe to") + " " + plan.title + '</h2><div id="card-element" class="kyb-preload"></div><div id="errors--wrap"><i class="far fa-times-octagon"></i> <span id="errors"></span></div><div id="card-element--btn" class="button">' + __("Subscribe") + '</div><div id="pricing-popup-secure-msg"><i class="fas fa-lock-alt"></i> ' + __("Secure credit card payment") + '</div><div id="credits--total">USD<span class="total-price-val">
1075' + plan.price + "/" + plan.period + '</span></div><div id="pricing-popup-secure-logos"></div>',
1076                cssClass: "hype-subscribe-popup"
1077            });
1078            this.init(plan)
1079        },
1080        init: function init(plan) {
1081            var card = KYB.buy.stripe.init();
1082            card.on("ready", function() {
1083                document.getElementById("card-element").classList.remove("kyb-preload");
1084                var btn = document.getElementById("card-element--btn");
1085                btn.addEventListener("click", function() {
1086                    btn.classList.add("button-preload");
1087                    KYB.buy.stripe.instance.createPaymentMethod("card", card, {
1088                        billing_details: {
1089                            email: KYB.user.email
1090                        }
1091                    }).then(function(result) {
1092                        if (result.paymentMethod) {
1093                            var params = {
1094                                stripeToken: result.paymentMethod.id,
1095                                stripeEmail: KYB.user.email,
1096                                source: plan.source ? plan.source : false
1097                            };
1098                            if (plan.planId) {
1099                                params.planId = plan.planId
1100                            }
1101                            if (plan.quote) {
1102                                params.quote = plan.quote
1103                            }
1104                            if (plan.seller) {
1105                                params.seller = plan.seller
1106                            }
1107                            KYB.post(KYB.baseUrl + "billing/stripeSubscription/", params).then(function(resp) {
1108                                if (resp.success) {
1109                                    if (plan.onSuccess) {
1110                                        plan.onSuccess()
1111                                    } else {
1112                                        KYB.popup.allHide();
1113                                        window.scrollTo(0, 0);
1114                                        KYB.notify(plan.title + " bought", "success")
1115                                    }
1116                                } else {
1117                                    KYB.notify(resp.message, "danger");
1118                                    KYB.buy.stripe.trackError(resp.message, resp.decline_code)
1119                                }
1120                                btn.classList.remove("button-preload")
1121                            }, function(resp) {
1122                                KYB.buy.stripe.trackError("Server error");
1123                                KYB.notify(__("Error. Try again."), "danger");
1124                                btn.classList.remove("button-preload")
1125                            })
1126                        } else {
1127                            btn.classList.remove("button-preload");
1128                            var errorElement = document.getElementById("errors");
1129                            errorElement.textContent = result.error.message;
1130                            errorElement.parentNode.style.display = "block";
1131                            KYB.buy.stripe.trackError(result.error.message, result.error.decline_code)
1132                        }
1133                    })
1134                })
1135            })
1136        }
1137    },
1138    buy: {
1139        paymentDone: function paymentDone(credits, bought) {
1140            Intercom("trackEvent", "paypal-buy", {
1141                tokens: credits
1142            });
1143            var html = '<h2 class="popup-header">' + __("Purchase successful!") + "<span>" + __("Use them to check bloggers") + '</span></h2><div class="popup-content"><div class="popup-token"><i class="ico ico-token ico-token-big mh-s"></i><div class="kyb-market-points">+</div><div class="kyb-market-points kyb-market-points--count">' + bought + '</div></div><div class="button" onclick="KYB.buy.paymentPopupSuccess()">' + __("Done") + "</div></div>";
1144            document.querySelector(".buy-token-popup").classList.add("buy-token-popup_success");
1145            document.getElementById("buy-token-popup").innerHTML = html;
1146            window.scrollTo(0, 0)
1147        },
1148        paymentPopupSuccess: function paymentPopupSuccess() {
1149            KYB.popup.allHide();
1150            if (location.pathname.indexOf("preview") !== -1) {
1151                location.search = "?update=1"
1152            }
1153        },
1154        popup: {
1155            init: function init() {
1156                var T = this;
1157                KYB.buy.paypal.inited = false;
1158                this.amountInput = document.getElementById("credits-amount");
1159                var credits = T.amountInput.value;
1160                this.total = document.getElementById("credits--total");
1161                this.popupTabs = document.querySelectorAll("#credits-form .kyb-report-tab");
1162                var btn = document.getElementById("card-element--btn");
1163                var card = KYB.buy.stripe.init();
1164                card.on("ready", function() {
1165                    document.getElementById("card-element").classList.remove("kyb-preload");
1166                    document.getElementById("credits-form").addEventListener("submit", function(e) {
1167                        e.preventDefault();
1168                        btn.classList.add("button-preload");
1169                        if (T.loading) {
1170                            return false
1171                        }
1172                        T.loading = true;
1173                        KYB.buy.stripe.instance.createToken(card).then(function(result) {
1174                            if (!result.error) {
1175                                KYB.buy.stripe.bill(result, credits).then(function(resp) {
1176                                    if (resp.success) {
1177                                        card.clear();
1178                                        KYB.buy.paymentDone(KYB.user.tokens + parseInt(credits), credits)
1179                                    } else {
1180                                        var errorElement = document.getElementById("errors");
1181                                        errorElement.textContent = resp.message;
1182                                        errorElement.parentNode.style.display = "block";
1183                                        KYB.buy.stripe.trackError(resp.message, resp.decline_code)
1184                                    }
1185                                    btn.classList.remove("button-preload");
1186                                    T.loading = false
1187                                }, function(resp) {
1188                                    var errorElement = document.getElementById("errors");
1189                                    errorElement.textContent = __("Server error");
1190                                    errorElement.parentNode.style.display = "block";
1191                                    KYB.buy.stripe.trackError("Server error")
1192                                })
1193                            } else {
1194                                btn.classList.remove("button-preload");
1195                                T.loading = false;
1196                                var errorElement = document.getElementById("errors");
1197                                errorElement.textContent = result.error.message;
1198                                errorElement.parentNode.style.display = "block";
1199                                KYB.buy.stripe.trackError(result.error.message, result.error.decline_code)
1200                            }
1201                        })
1202                    })
1203                });
1204                KYB.buy.stripe.applePay.init(credits);
1205                var methodTabs = document.getElementsByClassName("kyb-report-tabs--item");
1206                _.each(methodTabs, function(tab) {
1207                    tab.addEventListener("click", function() {
1208                        KYB.buyBtnClickDate = (new Date).getTime();
1209                        var cn = "kyb-report-tabs--item-active";
1210                        _.each(methodTabs, function(t) {
1211                            t.classList.remove(cn)
1212                        });
1213                        tab.classList.add(cn);
1214                        var method = tab.dataset.type;
1215                        T.choosePaymentMethod(method, credits);
1216                        T.methodStat(method);
1217                        T.showTotalPrice(credits, method)
1218                    })
1219                });
1220                T.methodStat("stripe");
1221                T.showTotalPrice(credits, "stripe")
1222            },
1223            choosePaymentMethod: function choosePaymentMethod(type, credits) {
1224                var cn = "kyb-report-tab--active";
1225                _.each(this.popupTabs, function(tab) {
1226                    tab.classList.remove(cn)
1227                });
1228                if (type == "paypal") {
1229                    if (!KYB.buy.paypal.inited) {
1230                        KYB.buy.paypal.init(credits)
1231                    }
1232                    document.getElementById("paypal--wrap").classList.add(cn)
1233                } else if (type == "apple") {
1234                    document.getElementById("payment-request-button").classList.add(cn)
1235                } else {
1236                    document.getElementById("card-element--wrap").classList.add(cn)
1237                }
1238            },
1239            methodStat: function methodStat(method) {
1240                KYB.tracker.trackEvent("Payment Form Opened", {
1241                    "Page Id": KYB.pageId,
1242                    method: method,
1243                    "time elapsed": parseFloat((((new Date).getTime() - KYB.buyBtnClickDate) / 1e3).toFixed(2))
1244                })
1245            },
1246            showTotalPrice: function showTotalPrice(val, method) {
1247                var T = this;
1248                if (val < 1) {
1249                    var errorElement = document.getElementById("errors");
1250                    errorElement.textContent = __("Min credits amount is 1");
1251                    errorElement.parentNode.style.display = "block";
1252                    T.total.innerHTML = ""
1253                } else {
1254                    var totalPrice = parseFloat(KYB.newTotalPrice(val));
1255                    if (!KYB.user.discount20Tokens50Done && val == 10) {
1256                        var price = "<s>" + KYB.couponsPriceConfig[10] + "</s> USD" + totalPrice
1257                    } else {
1258                        var price = '<span class="total-price-val">' + totalPrice + "</span>"
1259                    }
1260                    if (method == "paypal") {
1261                        var taxVal = KYB.buy.paypal.getTax(val)
1262                    } else {
1263                        var taxVal = KYB.buy.stripe.getTax(val).toFixed(2)
1264                    }
1265                    var fee = " $" + taxVal + " ";
1266                    T.total.innerHTML = __("Total: $") + price + " <small>+" + fee + __("fee") + "</small>"
1267                }
1268            }
1269        },
1270        paypal: {
1271            init: function init(credits) {
1272                this.inited = true;
1273                var T = this;
1274                paypal.Buttons({
1275                    createOrder: function createOrder(data, actions) {
1276                        KYB.tracker.trackEvent("Page Action", {
1277                            "Page Id": KYB.pageId,
1278                            Action: "tap",
1279                            method: "paypal",
1280                            target: "Pay button"
1281                        });
1282                        var totalCreditsPrice = parseFloat(KYB.newTotalPrice(credits));
1283                        var tax = parseFloat(T.getTax(credits));
1284                        var breakdown = {
1285                            item_total: {
1286                                currency_code: "USD",
1287                                value: KYB.couponsPriceConfig[credits].toFixed(2)
1288                            },
1289                            handling: {
1290                                currency_code: "USD",
1291                                value: tax
1292                            }
1293                        };
1294                        if (!KYB.user.discount20Tokens50Done && credits == 10) {
1295                            breakdown.discount = {
1296                                currency_code: "USD",
1297                                value: (KYB.couponsPriceConfig[credits] - 99).toFixed(2)
1298                            }
1299                        } else if (KYB.user.discountAffiliate && credits != 10) {
1300                            breakdown.discount = {
1301                                currency_code: "USD",
1302                                value: (KYB.couponsPriceConfig[credits] * .4).toFixed(2)
1303                            }
1304                        }
1305                        return actions.order.create({
1306                            intent: "CAPTURE",
1307                            payer: {
1308                                email_address: KYB.user.email
1309                            },
1310                            application_context: {
1311                                shipping_preference: "NO_SHIPPING",
1312                                user_action: "PAY_NOW",
1313                                payment_method: {
1314                                    payee_preferred: "IMMEDIATE_PAYMENT_REQUIRED"
1315                                }
1316                            },
1317                            purchase_units: [{
1318                                custom_id: KYB.user.user_id,
1319                                amount: {
1320                                    currency_code: "USD",
1321                                    value: (totalCreditsPrice + tax).toFixed(2),
1322                                    breakdown: breakdown
1323                                },
1324                                items: [{
1325                                    name: "Reports",
1326                                    unit_amount: {
1327                                        currency_code: "USD",
1328                                        value: (KYB.couponsPriceConfig[credits] / credits).toFixed(2)
1329                                    },
1330                                    quantity: credits,
1331                                    category: "DIGITAL_GOODS"
1332                                }]
1333                            }]
1334                        })
1335                    },
1336                    onError: function onError(err) {
1337                        KYB.tracker.trackEvent("Paypal Error", {
1338                            "error text": err,
1339                            url: window.location.href
1340                        })
1341                    },
1342                    onApprove: function onApprove(data, actions) {
1343                        return actions.order.capture().then(function(details) {
1344                            KYB.buy.paymentDone(KYB.user.tokens + parseInt(credits), credits)
1345                        })
1346                    }
1347                }).render("#paypal-button-container")
1348            },
1349            getTax: function getTax(credits) {
1350                var totalCreditsPrice = parseFloat(KYB.newTotalPrice(credits));
1351                if (KYB.user.countryCode == "US") {
1352                    var tax = totalCreditsPrice * .029 + .3
1353                } else {
1354                    var tax = totalCreditsPrice * .044 + .3
1355                }
1356                return tax.toFixed(2)
1357            }
1358        },
1359        stripe: {
1360            init: function init() {
1361                this.instance = Stripe(KYB.stripe.key);
1362                this.elements = this.instance.elements();
1363                var card = this.elements.create("card", {
1364                    style: {
1365                        base: {
1366                            iconColor: "#666ee8",
1367                            color: "#31325f",
1368                            fontWeight: 400,
1369                            fontFamily: '"Proxima Nova", -apple-system, sans-serif',
1370                            fontSmoothing: "antialiased",
1371                            fontSize: "16px",
1372                            "::placeholder": {
1373                                color: "#747e87"
1374                            },
1375                            ":-webkit-autofill": {
1376                                color: "#666ee8"
1377                            }
1378                        }
1379                    },
1380                    hidePostalCode: true
1381                });
1382                card.mount("#card-element");
1383                var errorElement = document.getElementById("errors");
1384                card.addEventListener("change", function(event) {
1385                    if (event.error) {
1386                        errorElement.textContent = event.error.message;
1387                        errorElement.parentNode.style.display = "block";
1388                        KYB.buy.stripe.trackError(event.error.message)
1389                    } else {
1390                        errorElement.textContent = "";
1391                        errorElement.parentNode.style.display = "none"
1392                    }
1393                });
1394                return card
1395            },
1396            bill: function bill(result, credits) {
1397                return KYB.post(KYB.baseUrl + "billing/stripe/", {
1398                    stripeToken: result.token.id,
1399                    stripeEmail: result.token.email ? result.token.email : KYB.user.email,
1400                    credits: credits,
1401                    method: result.methodName,
1402                    source: KYB.buy.source
1403                })
1404            },
1405            getTax: function getTax(credits) {
1406                var totalCreditsPrice = parseFloat(KYB.newTotalPrice(credits));
1407                return totalCreditsPrice * .029 + .2
1408            },
1409            getAmount: function getAmount(credits) {
1410                var totalCreditsPrice = parseFloat(KYB.newTotalPrice(credits));
1411                return Math.round((totalCreditsPrice + this.getTax(credits)) * 100)
1412            },
1413            applePay: {
1414                init: function init(credits) {
1415                    var T = this;
1416                    this.paymentRequest = KYB.buy.stripe.instance.paymentRequest({
1417                        country: "US",
1418                        currency: "usd",
1419                        total: {
1420                            label: "Payment for " + credits + " credits",
1421                            amount: KYB.buy.stripe.getAmount(credits)
1422                        }
1423                    });
1424                    var prButton = KYB.buy.stripe.elements.create("paymentRequestButton", {
1425                        paymentRequest: this.paymentRequest
1426                    });
1427                    this.paymentRequest.canMakePayment().then(function(result) {
1428                        var tab = document.getElementById("payment-request-tab");
1429                        if (result) {
1430                            if (result.applePay) {
1431                                tab.textContent = "Apple Pay"
1432                            } else {
1433                                tab.textContent = "Other"
1434                            }
1435                            tab.style.display = "";
1436                            prButton.mount("#payment-request-button");
1437                            T.paymentRequest.on("token", function(ev) {
1438                                KYB.buy.stripe.bill(ev, credits).then(function(resp) {
1439                                    if (resp.success) {
1440                                        ev.complete("success");
1441                                        KYB.buy.paymentDone(resp.credits, credits)
1442                                    } else {
1443                                        KYB.notify(resp.message, "danger");
1444                                        ev.complete("fail");
1445                                        KYB.buy.stripe.trackError(resp.message, resp.decline_code)
1446                                    }
1447                                }, function(e, type) {
1448                                    KYB.notify("Error", "danger");
1449                                    ev.complete("fail");
1450                                    KYB.buy.stripe.trackError("Apple pay " + type)
1451                                })
1452                            });
1453                            T.paymentRequest.on("cancel", function() {
1454                                KYB.buy.stripe.trackError("CANCEL (Apple Pay or Other)")
1455                            })
1456                        } else {
1457                            document.getElementById("payment-request-button").style.display = "none";
1458                            tab.style.display = "none"
1459                        }
1460                    })
1461                }
1462            },
1463            trackError: function trackError(errText, errCode) {
1464                if (typeof errText != "string") {
1465                    errText = JSON.stringify(errText)
1466                }
1467                var p = {
1468                    "error text": errText,
1469                    url: window.location.href
1470                };
1471                if (errCode) {
1472                    p["error code"] = errCode
1473                }
1474                KYB.tracker.trackEvent("Stripe Error", p)
1475            }
1476        }
1477    },
1478    requestDemoPopup: function requestDemoPopup(source, options) {
1479        var $html = document.querySelector(".request-demo-wrap").cloneNode(true);
1480        if (source == "PDF") {
1481            $html.querySelector("#request-demo-field-7").required = true
1482        }
1483        if (options) {
1484            if (options.title) {
1485                $html.querySelector(".request-demo-wrap--header").innerHTML = options.title
1486            }
1487            if (options.subtitle) {
1488                $html.querySelector(".request-demo-wrap--subtitle").innerHTML = options.subtitle
1489            } else {
1490                $html.querySelector(".request-demo-wrap--subtitle").remove()
1491            }
1492            if (options.btn) {
1493                $html.querySelector(".button").innerHTML = options.btn
1494            }
1495            if (options.textarea) {
1496                $html.querySelector("textarea").value = options.textarea
1497            }
1498        }
1499        var popup = KYB.popup.show({
1500            html: $html,
1501            cssClass: "request-demo--popup",
1502            onOpen: function onOpen(t) {
1503                var form = t.$content.querySelector(".request-demo--form");
1504                form.addEventListener("submit", function(e) {
1505                    e.preventDefault();
1506                    var params = serialize(form);
1507                    if (options && options.source) {
1508                        params += "&source=" + options.source
1509                    }
1510                    params += "&page=" + KYB.pageId;
1511                    KYB.post(KYB.baseUrl + "ajax/requestDemo/?" + params).then(function(resp) {
1512                        if (resp.success) {
1513                            popup.hide();
1514                            KYB.notify(__("Thank you! We will reach you shortly."), "success");
1515                            if (options.calback) {
1516                                options.calback()
1517                            }
1518                        } else {
1519                            form.querySelector(".button").classList.remove("button-preload");
1520                            KYB.notify("Error", "danger")
1521                        }
1522                    });
1523                    form.querySelector(".button").classList.add("button-preload")
1524                })
1525            }
1526        });
1527        KYB.tracker.trackEvent("Page Action", {
1528            "Page Id": KYB.pageId,
1529            Action: "tap",
1530            target: "Request Demo btn " + source
1531        });
1532        return popup
1533    },
1534    notify: function notify(message, type, params) {
1535        var wrap = document.createElement("DIV");
1536        var close = document.createElement("DIV");
1537        wrap.setAttribute("class", "notify" + (type ? " " + type : ""));
1538        close.setAttribute("class", "fas fa-times");
1539        wrap.innerHTML = message;
1540        close.innerHTML = "&#xf00d";
1541        wrap.appendChild(close);
1542        document.body.appendChild(wrap);
1543        setTimeout(function() {
1544            wrap.remove()
1545        }, 5e3);
1546        close.addEventListener("click", function() {
1547            wrap.remove()
1548        })
1549    },
1550    getParams: function getParams() {
1551        var params = {};
1552        if (window.location.search.substring(1)) {
1553            params = JSON.parse('{"' + window.location.search.substring(1).replace(/&/g, '","').replace(/=/g, '":"') + '"}', function(key, value) {
1554                return key === "" ? value : decodeURIComponent(value)
1555            })
1556        }
1557        return params
1558    },
1559    rand: function rand(min, max) {
1560        return max ? Math.floor(Math.random() * (max - min + 1)) + min : Math.floor(Math.random() * (min + 1))
1561    },
1562    imageLoader: {
1563        uuid: 0,
1564        arr: {},
1565        cache: {},
1566        add: function add(selector) {
1567            var T = this;
1568            _.each(selector, function(el) {
1569                var src = el.dataset.image;
1570                if (src) {
1571                    T.uuid += 1;
1572                    T.arr[T.uuid] = {
1573                        t: el,
1574                        src: src
1575                    };
1576                    el.dataset.image = ""
1577                }
1578            });
1579            this.update()
1580        },
1581        update: function update() {
1582            var T = this;
1583            window.requestAnimationFrame(function() {
1584                var s = window.scrollY;
1585                if (!KYB.windowHeight) {
1586                    KYB.windowHeight = window.innerHeight
1587                }
1588                for (var i in T.arr) {
1589                    var a = T.arr[i],
1590                        top = getOffset(a.t).top;
1591                    if (top && s + KYB.windowHeight > top - 110 && s < top + 110) {
1592                        T.load(a.t, a.src);
1593                        delete T.arr[i]
1594                    }
1595                }
1596            })
1597        },
1598        load: function load(t, src) {
1599            var T = this;
1600            var cache = this.cache[src];
1601            if (cache) {
1602                if (cache.img) {
1603                    var img = cache.img
1604                } else {
1605                    if (cache.status == "ok") {
1606                        this.onLoad(t, src)
1607                    } else {
1608                        this.onError(t, src)
1609                    }
1610                    return false
1611                }
1612            } else {
1613                var img = new Image;
1614                cache = {
1615                    img: img
1616                };
1617                img.src = src
1618            }
1619            img.onload = function() {
1620                cache.status = "ok";
1621                cache.img = false;
1622                T.onLoad(t, src);
1623                img = false
1624            };
1625            img.onerror = function() {
1626                cache.status = "error";
1627                cache.img = false;
1628                T.onError(t, src);
1629                img = false
1630            }
1631        },
1632        onLoad: function onLoad(t, src) {
1633            if (t.tagName.toLowerCase() == "img") {
1634                t.src = src
1635            } else {
1636                t.style.backgroundImage = "url(" + src + ")"
1637            }
1638        },
1639        onError: function onError(t, src) {
1640            if (t.tagName.toLowerCase() == "img") {
1641                t.src = KYB.staticUrl + "/ic_broken_image.svg"
1642            } else {
1643                var ico = document.createElement("i");
1644                ico.setAttribute("class", "far fa-file-times");
1645                ico.innerHTML = "";
1646                t.appendChild(ico)
1647            }
1648            t.classList.add("kyb-img--deleted")
1649        }
1650    },
1651    pricingPlans: {
1652        starter: {
1653            title: __("Reports Starter"),
1654            price: "299",
1655            period: __("month"),
1656            quote: 1290
1657        },
1658        starter10: {
1659            title: __("Reports Starter 10 reports/mo"),
1660            price: "149",
1661            period: __("month"),
1662            quote: 1509
1663        },
1664        starter20: {
1665            title: __("Reports Starter 20 reports/mo"),
1666            price: "199",
1667            period: __("month"),
1668            quote: 1510
1669        },
1670        discovery: {
1671            ig: {
1672                title: __("Instagram Discovery Starter"),
1673                price: "299",
1674                period: __("month"),
1675                quote: 1294
1676            },
1677            yt: {
1678                title: __("YouTube Discovery Starter"),
1679                price: "299",
1680                period: __("month"),
1681                quote: 1295
1682            },
1683            tt: {
1684                title: __("TikTok Discovery Starter"),
1685                price: "299",
1686                period: __("month"),
1687                quote: 1296
1688            }
1689        },
1690        tracking: {
1691            title: __("Tracking Starter"),
1692            price: "299",
1693            period: __("month"),
1694            quote: 1297
1695        }
1696    },
1697    pricingSubscribe: function pricingSubscribe(plan, source) {
1698        if (!KYB.user) {
1699            document.location.href = "/signup/";
1700            return false
1701        }
1702        var config = {};
1703        if (plan == "discovery") {
1704            config = KYB.pricingPlans.discovery[KYB.pricingPlansDiscovery]
1705        } else {
1706            config = KYB.pricingPlans[plan]
1707        }
1708        config.source = source;
1709        KYB.subscribe.popup(config);
1710        KYB.tracker.trackEvent("Page Action", {
1711            "Page Id": KYB.pageId,
1712            Action: "tap",
1713            target: "pricing subscribe btn"
1714        })
1715    }
1716};
1717if (typeof Intl != "undefined") {
1718    KYB.numberToLocaleDefaultFormater = new Intl.NumberFormat("en")
1719}
1720var serialize = function serialize(form) {
1721    var serialized = [];
1722    for (var i = 0; i < form.elements.length; i++) {
1723        var field = form.elements[i];
1724        if (!field.name || field.disabled || field.type === "file" || field.type === "reset" || field.type === "submit" || field.type === "button") continue;
1725        if (field.type === "select-multiple") {
1726            for (var n = 0; n < field.options.length; n++) {
1727                if (!field.options[n].selected) continue;
1728                serialized.push(encodeURIComponent(field.name) + "=" + encodeURIComponent(field.options[n].value))
1729            }
1730        } else if (field.type !== "checkbox" && field.type !== "radio" || field.checked) {
1731            serialized.push(field.name + "=" + field.value)
1732        }
1733    }
1734    return serialized.join("&")
1735};
1736
1737function getOffset(el, wrap) {
1738    var box = el.getBoundingClientRect();
1739    return {
1740        top: box.top + (wrap ? wrap.scrollTop : window.pageYOffset) - (wrap ? wrap.getBoundingClientRect().top : document.documentElement.clientTop),
1741        left: box.left + window.pageXOffset - document.documentElement.clientLeft
1742    }
1743}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.