function()

in static/js/tracker.js [2391:2978]


    function (e, n, t) {
      'use strict';
      t.r(n),
        t.d(n, 'mark', function () {
          return S;
        }),
        t.d(n, 'measure', function () {
          return k;
        }),
        t.d(n, 'markWithEntry', function () {
          return T;
        }),
        t.d(n, 'measureWithEntry', function () {
          return E;
        }),
        t.d(n, 'markOnMCP', function () {
          return C;
        });
      var r = t(0),
        o = t.n(r),
        i = t(6),
        u = t.n(i),
        a = t(7),
        c = t.n(a),
        s = {},
        f = null,
        l = 0,
        p = function () {
          f && h(f), (l || f) && o.a.log('paint', s);
        },
        d = function (e) {
          var n = e.entryType,
            t = e.name,
            r = {
              p1: e.startTime,
              p2: e.duration,
              p3: n,
              p4: t,
              c1: e.c1,
              c2: e.c2,
              c3: e.c3,
              c4: e.c4,
              c5: e.c5,
              c6: e.c6,
            };
          o.a.log('usertiming', r);
        },
        v = function (e) {
          var n,
            t = {
              startTime: 'p1',
              identifier: 'p2',
              name: 'p3',
              url: 'p4',
              element: 'p5',
              naturalHeight: 'p6',
              naturalWidth: 'p7',
            },
            r = {};
          for (var i in t)
            void 0 !== e[i] &&
              (r[t[i]] =
                'string' == typeof (n = e[i]) || 'number' == typeof n
                  ? n
                  : 'object' == typeof n && n instanceof HTMLElement
                  ? n.tagName
                  : void 0);
          o.a.log('elementtiming', r);
        },
        m = function () {
          var e,
            n,
            t,
            r,
            i = o.a.getConfig('plugin_perf_resourceTimingSampling') || 0.01;
          if (
            !(Math.random() >= i) &&
            'function' == typeof window.fetch &&
            null !== (e = window) &&
            void 0 !== e &&
            null !== (n = e.performance) &&
            void 0 !== n &&
            n.getEntries &&
            null !== (t = window) &&
            void 0 !== t &&
            null !== (r = t.performance) &&
            void 0 !== r &&
            r.getEntriesByType
          ) {
            var u =
                o.a.getConfig('plugin_perf_resourceTimingThreshhold') || 8e3,
              a =
                performance.getEntriesByType('navigation')[0] ||
                window.performance.timing;
            if (a) if (a.loadEventStart - a.fetchStart < u) return;
            var s = performance.getEntries();
            if (s && 0 !== s.length)
              try {
                var f = o.a.getConfig('pv_id'),
                  l = o.a.getConfig('pid'),
                  p = {
                    __topic__: 'resourcetiming',
                    __logs__: [
                      {
                        pid: l,
                        name: f,
                        resource: encodeURIComponent(c()(s.slice(0, 200))),
                      },
                    ],
                  };
                if (!l || !f) return;
                fetch(
                  'https://aes.cn-wulanchabu.log.aliyuncs.com/logstores/aes-resourcetiming/track',
                  {
                    method: 'POST',
                    body: c()(p),
                    headers: {
                      'Content-Type': 'application/json',
                      'x-log-apiversion': '0.6.0',
                      'x-log-bodyrawsize': '1234',
                    },
                  }
                );
              } catch (e) {}
          }
        },
        y = function (e) {
          f = e;
        },
        h = function (e) {
          var n,
            t = { startTime: 'p3', element: 'p4', url: 'p5' };
          for (var r in t)
            void 0 !== e[r] &&
              (s[t[r]] =
                'string' == typeof (n = e[r]) || 'number' == typeof n
                  ? n
                  : 'object' == typeof n && n instanceof HTMLElement
                  ? n.tagName
                  : void 0);
        },
        g = new Date().getTime(),
        w = [],
        b = function (e) {
          return w
            .concat([])
            .reverse()
            .find(function (n) {
              return n.name === ''.concat(e);
            });
        },
        x = function () {
          var e, n, t, r;
          return null !== (e = window) &&
            void 0 !== e &&
            null !== (n = e.performance) &&
            void 0 !== n &&
            n.now
            ? performance.now()
            : null !== (t = window) &&
              void 0 !== t &&
              null !== (r = t.performance) &&
              void 0 !== r &&
              r.timing
            ? new Date().getTime() - performance.timing.navigationStart
            : new Date().getTime() - g;
        },
        S = function (e) {
          if (void 0 === e)
            return console.error(
              "Failed to execute 'mark' on 'Performance': 1 argument required, but only 0 present."
            );
          var n = {
            name: e + '',
            entryType: 'mark',
            startTime: x(),
            duration: 0,
          };
          return w.push(n), d(n), n;
        },
        T = function (e) {
          return d(u()({ entryType: 'mark', duration: 0 }, e)), e;
        },
        k = function (e, n, t) {
          if (void 0 === e)
            return console.error(
              "Failed to execute 'measure' on 'Performance': at least 1 argument required, but only 0 present."
            );
          var r = void 0 === n ? null : b(n),
            o = void 0 === t ? null : b(t);
          if (void 0 !== n && !r)
            return console.error(
              "Failed to execute 'measure' on 'Performance': The mark '".concat(
                n,
                "' does not exist."
              )
            );
          if (void 0 !== t && !o)
            return console.error(
              "Failed to execute 'measure' on 'Performance': The mark '".concat(
                t,
                "' does not exist."
              )
            );
          o = o || { startTime: 0 };
          var i = {
            name: e + '',
            entryType: 'measure',
            startTime: (r = r || { startTime: 0 }).startTime,
            duration: (o.startTime || x()) - r.startTime,
          };
          return d(i), i;
        },
        E = function (e) {
          return d(u()({ entryType: 'measure' }, e)), e;
        },
        _ = t(8),
        O = t.n(_),
        P = t(9),
        j = t.n(P),
        L = {
          hasHookRequest: !1,
          requestStackSize: 0,
          listeners: [],
          runListeners: function () {
            var e = this;
            this.listeners.forEach(function (n) {
              return n(e.requestStackSize);
            });
          },
          hook: function () {
            var e,
              n,
              t,
              r = this,
              o = XMLHttpRequest.prototype.send;
            if (
              window.fetch &&
              null !== (e = window) &&
              void 0 !== e &&
              null !== (n = e.Response) &&
              void 0 !== n &&
              null !== (t = n.prototype) &&
              void 0 !== t &&
              t.blob
            ) {
              var i = window.fetch;
              window.fetch = function () {
                return (
                  r.requestStackSize++,
                  r.runListeners(),
                  i.apply(window, arguments).then(
                    function (e) {
                      try {
                        e.clone()
                          .blob()
                          .then(function (e) {
                            r.requestStackSize--, r.runListeners();
                          });
                      } catch (e) {}
                      return e;
                    },
                    function (e) {
                      try {
                        r.requestStackSize--, r.runListeners();
                      } catch (e) {}
                      throw e;
                    }
                  )
                );
              };
            }
            XMLHttpRequest.prototype.send = function () {
              o.apply(this, arguments), r.requestStackSize++, r.runListeners();
              var e = this;
              e.addEventListener('readystatechange', function () {
                4 === e.readyState && (r.requestStackSize--, r.runListeners());
              });
            };
          },
          addEventListener: function (e) {
            this.hasHookRequest || (this.hook(), (this.hasHookRequest = !0)),
              this.listeners.push(e);
          },
          removeEventListener: function (e) {
            this.listeners = this.listeners.filter(function (n) {
              return n !== e;
            });
          },
        },
        M = (function () {
          function e(n) {
            var t = this;
            O()(this, e),
              (this.assetsStack = 0),
              (this.observer = function () {
                (t.requestStackSize = L.requestStackSize + t.assetsStack),
                  1 !== t.end && n(t.requestStackSize);
              });
          }
          return (
            j()(e, [
              {
                key: 'observe',
                value: function (e) {
                  var n = this;
                  return e
                    ? (n.assetsStack++,
                      e.addEventListener('load', function () {
                        n.assetsStack--, n.observer();
                      }),
                      void e.addEventListener('error', function () {
                        n.assetsStack--, n.observer();
                      }))
                    : (L.addEventListener(this.observer), this);
                },
              },
              {
                key: 'disconnect',
                value: function () {
                  (this.end = 1), L.removeEventListener(this.observer);
                },
              },
            ]),
            e
          );
        })(),
        q = (function () {
          function e(n) {
            O()(this, e),
              (this.inputTypes = ['click', 'keypress', 'wheel']),
              (this.eventHandler = n);
          }
          return (
            j()(e, [
              {
                key: 'observer',
                value: function () {
                  var e = this;
                  this.inputTypes.forEach(function (n) {
                    window.addEventListener(n, e.eventHandler, !0);
                  });
                },
              },
              {
                key: 'disconnect',
                value: function () {
                  var e = this;
                  this.inputTypes.forEach(function (n) {
                    window.removeEventListener(n, e.eventHandler, !0);
                  });
                },
              },
            ]),
            e
          );
        })();
      function C(e) {
        var n, t;
        if (
          window.PerformanceLongTaskTiming &&
          window.MutationObserver &&
          null !== (n = window) &&
          void 0 !== n &&
          null !== (t = n.performance) &&
          void 0 !== t &&
          t.now
        ) {
          var r,
            o,
            i,
            u,
            a,
            c,
            s,
            f,
            l = function () {
              document.hidden && d();
            },
            p = function () {
              i && clearTimeout(i),
                (i = setTimeout(function () {
                  s &&
                    s.requestStackSize < 1 &&
                    (d(),
                    T({
                      name: 'aes-mcp',
                      startTime: r - o,
                      c1: o > 0 ? '0' : '1',
                    }),
                    e && e({ startTime: r - o }));
                }, 100));
            },
            d = function () {
              i && clearTimeout(i),
                (i = null),
                [u, c, a, s, f].forEach(function (e) {
                  e && e.disconnect(), (e = null);
                }),
                l && window.removeEventListener('visibilitychange', l),
                (l = null),
                0 === o && window.removeEventListener('load', v);
            },
            v = function () {
              (s = new M(p)).observe(),
                (u = new MutationObserver(function (e, n) {
                  (r = performance.now()),
                    null == e ||
                      e.forEach(function (e) {
                        var n;
                        'childList' === e.type &&
                          (null == e ||
                            null === (n = e.addedNodes) ||
                            void 0 === n ||
                            n.forEach(function (e) {
                              ((('SCRIPT' === e.tagName ||
                                'IMG' === e.tagName) &&
                                e.src) ||
                                ('LINK' === e.tagName &&
                                  'stylesheet' === e.rel &&
                                  e.href)) &&
                                s &&
                                s.observe(e);
                            }));
                      });
                })).observe(document.documentElement, {
                  attributes: !0,
                  childList: !0,
                  subtree: !0,
                }),
                window.LayoutShiftAttribution &&
                  (c = new PerformanceObserver(function () {
                    (r = performance.now()), p();
                  })).observe({ entryTypes: ['layout-shift'] }),
                (a = new PerformanceObserver(function (e) {
                  e.getEntries().some(function (e) {
                    e.duration > 50 && p();
                  });
                })).observe({ entryTypes: ['longtask'] }),
                (f = new q(function () {
                  d();
                })).observer(),
                window.addEventListener('visibilitychange', l),
                p();
            };
          return (
            'complete' !== document.readyState
              ? ((o = 0), window.addEventListener('load', v))
              : ((o = performance.now()), v()),
            { abort: d }
          );
        }
      }
      var z,
        N = function () {
          return (
            (function () {
              var e, n;
              if (
                window.PerformanceNavigationTiming &&
                null !== (e = window) &&
                void 0 !== e &&
                null !== (n = e.performance) &&
                void 0 !== n &&
                n.getEntriesByType
              ) {
                var t = performance.getEntriesByType('navigation')[0],
                  r = {};
                for (var o in t)
                  'entryType' !== o &&
                    'initiatorType' !== o &&
                    'name' !== o &&
                    0 !== t[o] &&
                    'number' == typeof t[o] &&
                    (r[o] = t[o].toFixed(2));
                return r;
              }
            })() ||
            (function () {
              var e, n, t;
              if (
                (null === (e = window) ||
                void 0 === e ||
                null === (n = e.performance) ||
                void 0 === n ||
                null === (t = n.timing) ||
                void 0 === t
                  ? void 0
                  : t.navigationStart) > 0
              ) {
                var r = {};
                for (var o in performance.timing)
                  'number' == typeof performance.timing[o] &&
                    performance.timing[o] > 0 &&
                    (r[o] = Math.max(
                      performance.timing[o] -
                        performance.timing.navigationStart,
                      0
                    ));
                return r;
              }
            })()
          );
        };
      (z = function () {
        var e = N();
        e &&
          e.responseStart &&
          e.responseEnd &&
          e.responseEnd >= e.responseStart &&
          o.a.log('perf', e),
          o.a.getConfig('plugin_perf_enableResourceTiming') &&
            setTimeout(m, 5e3);
      }),
        'complete' === document.readyState
          ? setTimeout(z)
          : window.addEventListener('load', function () {
              return setTimeout(z);
            });
      !(function () {
        if (window.PerformanceObserver) {
          var e = [];
          o.a.getConfig('plugin_perf_enableUserTimingObserve') &&
            (window.PerformanceMark && e.push('mark'),
            window.PerformanceMeasure && e.push('measure')),
            window.PerformancePaintTiming && e.push('paint'),
            window.PerformanceElementTiming && e.push('element'),
            window.LargestContentfulPaint &&
              (e.push('largest-contentful-paint'),
              document.addEventListener(
                'visibilitychange',
                function e() {
                  document.hidden &&
                    (document.removeEventListener('visibilitychange', e, !0),
                    p());
                },
                !0
              ));
          try {
            !(function () {
              for (var n = {}, t = 0; t < e.length; t++) {
                var r = e[t],
                  o = new PerformanceObserver(function (e) {
                    e.getEntries().forEach(function (e) {
                      switch (e.entryType) {
                        case 'paint':
                          (r = (t = e).name),
                            (o = t.startTime),
                            (i = {
                              'first-paint': 'p1',
                              'first-contentful-paint': 'p2',
                            })[r] &&
                              ((s[i[r]] = o),
                              l++,
                              window.LargestContentfulPaint || 2 !== l || p());
                          break;
                        case 'mark':
                        case 'measure':
                          d(e);
                          break;
                        case 'element':
                          n[e.identifier] || ((n[e.identifier] = 1), v(e));
                          break;
                        case 'largest-contentful-paint':
                          y(e);
                      }
                      var t, r, o, i;
                    });
                  });
                try {
                  o.observe({ type: r, buffered: !0 });
                } catch (n) {
                  o.observe({ entryTypes: e });
                  break;
                }
              }
            })();
          } catch (e) {}
        }
      })();
      n.default = {
        mark: S,
        measure: k,
        markWithEntry: T,
        measureWithEntry: E,
        markOnMCP: C,
      };
    },