var __defProp = Object.defineProperty,
  __defProps = Object.defineProperties,
  __getOwnPropDescs = Object.getOwnPropertyDescriptors,
  __getOwnPropSymbols = Object.getOwnPropertySymbols,
  __hasOwnProp = Object.prototype.hasOwnProperty,
  __propIsEnum = Object.prototype.propertyIsEnumerable,
  __defNormalProp = (e, t, n) =>
    t in e
      ? __defProp(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n })
      : (e[t] = n),
  __spreadValues = (e, t) => {
    for (var n in t || (t = {})) __hasOwnProp.call(t, n) && __defNormalProp(e, n, t[n])
    if (__getOwnPropSymbols)
      for (var n of __getOwnPropSymbols(t)) __propIsEnum.call(t, n) && __defNormalProp(e, n, t[n])
    return e
  },
  __spreadProps = (e, t) => __defProps(e, __getOwnPropDescs(t)),
  __objRest = (e, t) => {
    var n = {}
    for (var r in e) __hasOwnProp.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r])
    if (null != e && __getOwnPropSymbols)
      for (var r of __getOwnPropSymbols(e))
        t.indexOf(r) < 0 && __propIsEnum.call(e, r) && (n[r] = e[r])
    return n
  },
  __publicField = (e, t, n) => (__defNormalProp(e, 'symbol' != typeof t ? t + '' : t, n), n),
  __async = (e, t, n) =>
    new Promise((r, i) => {
      var o = (e) => {
          try {
            a(n.next(e))
          } catch (t) {
            i(t)
          }
        },
        s = (e) => {
          try {
            a(n.throw(e))
          } catch (t) {
            i(t)
          }
        },
        a = (e) => (e.done ? r(e.value) : Promise.resolve(e.value).then(o, s))
      a((n = n.apply(e, t)).next())
    })
!(function () {
  'use strict'
  function e(e) {
    return 'string' != typeof e || 0 == e.trim().length
  }
  function t(e) {
    return 'string' == typeof e && e.trim().length > 0
  }
  function n({ onRequest: e, onResponse: t }) {
    ;(window.__NATIVE_FETCH__ = window.fetch),
      (window.fetch = (n, r) =>
        __async(this, null, function* () {
          null == e || e(n, r)
          const i = yield window.__NATIVE_FETCH__.call(window, n, r)
          return yield null == t ? void 0 : t(i.clone()), i
        }))
  }
  const r = [],
    i = ['pushState', 'replaceState'],
    o = {}
  function s({ type: e }) {
    setTimeout(() => {
      r.forEach((t) => t({ type: e }))
    })
  }
  function a(e) {
    r.push(e)
  }
  i.forEach((e) => {
    o[e] = window.history[e]
  }),
    i.forEach((e) => {
      window.history[e] = function () {
        return s({ type: e }), o[e].apply(window.history, arguments)
      }
    }),
    window.addEventListener('popstate', (e) => {
      s({ type: e.type })
    }),
    window.addEventListener('pageshow', (e) => {
      !0 === e.persisted && s({ type: 'bfcache' })
    })
  const c = /AISO \(([^)]+)\)/i
  function l() {
    var e, t, n
    return !(
      !(null == (t = null == (e = window.webkit) ? void 0 : e.messageHandlers)
        ? void 0
        : t.ai_summary) && !(null == (n = window.AndroidWebview) ? void 0 : n.ai_summary)
    )
  }
  function u() {
    let e = {}
    const t = {}
    return {
      send: function (t, n) {
        const r = __spreadValues({ type: t, code: 0, message: 'ok' }, n)
        if (w(e, r)) return
        e = r
        const i = JSON.stringify(r)
        if (l())
          try {
            ;/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)
              ? window.webkit.messageHandlers.ai_summary.postMessage(i)
              : window.AndroidWebview.ai_summary(i)
          } catch (o) {}
        else window.postMessage(i)
      },
      on: function (e, n) {
        t[e] || (t[e] = []), t[e].push(n)
      },
      onMessage: function (e, ...n) {
        if (e && t[e]) {
          t[e].forEach((e) => {
            e.apply(null, n)
          })
        }
      },
    }
  }
  const d = (e) => Object.keys(e).length > 0
  function h(e, t) {
    return (
      'object' ===
        (function (e) {
          if (null === e) return 'null'
          if ('object' != typeof e) return typeof e
          return Object.prototype.toString.call(e).slice(8, -1).toLocaleLowerCase()
        })(e) &&
      (!t || d(e))
    )
  }
  function p(e, t, n = window) {
    if (Object.prototype.hasOwnProperty.call(n, e))
      h(n[e])
        ? null == t || t(n[e])
        : window.addEventListener('load', () => {
            null == t || t(n[e])
          })
    else {
      let r = n[e]
      Object.defineProperty(n, e, {
        get: () => r,
        set: (e) => {
          ;(r = e),
            setTimeout(() => {
              null == t || t(e)
            })
        },
      })
    }
  }
  const f = /(<|&lt;)\/?.+?(>|&gt;)/g,
    m = /((\n)+(\s+)?)+/g
  function E(e) {
    var t, n
    return null != (n = null == (t = document.querySelector(e)) ? void 0 : t.offsetHeight) ? n : 0
  }
  function y(e) {
    const t = document.querySelector(e)
    return t ? { width: t.offsetWidth, height: t.offsetHeight } : { width: 0, height: 0 }
  }
  const v = 300
  function g(e) {
    return __async(this, null, function* () {
      const { timeout: t = 15e3 } = e || {}
      let n = 0
      return new Promise((e) => {
        const r = () => {
          n += v
          null !== document.querySelector('video')
            ? e({ ok: !0 })
            : n < t
            ? window.setTimeout(() => r(), v)
            : e({ ok: !1 })
        }
        r()
      })
    })
  }
  const _ = (() => {
    let e = 0
    return (t, n) =>
      __async(this, null, function* () {
        const { timeout: r = 15e3 } = n || {}
        let i = 0
        return (
          e > 0 && (window.clearTimeout(e), (e = 0)),
          new Promise((n) => {
            const o = () => {
              i += v
              const s = null != t ? t : document.querySelector('video')
              s instanceof HTMLVideoElement && s.readyState >= 1
                ? n({ ok: !0 })
                : i < r
                ? (e = window.setTimeout(() => o(), v))
                : n({ ok: !1 })
            }
            o()
          })
        )
      })
  })()
  function w(e, t) {
    if (Object.is(e, t)) return !0
    if ('object' != typeof e || null === e || 'object' != typeof t || null === t) return !1
    if (e.constructor !== t.constructor) return !1
    const n = Object.keys(e)
    if (n.length !== Object.keys(t).length) return !1
    for (const r of n) if (!Object.prototype.hasOwnProperty.call(t, r)) return !1
    for (const r of n) if (!w(e[r], t[r])) return !1
    return !0
  }
  function I(e) {
    e = Math.floor(e)
    return [Math.floor(e / 3600), Math.floor((e % 3600) / 60), e % 60]
      .map((e) => (e < 10 ? '0' + e : e))
      .join(':')
  }
  const T = new Map(),
    R = {
      onErrorBoundary() {
        window.addEventListener('error', ({ error: e }) => {
          e instanceof Error && this.reportError($(e.stack))
        }),
          window.addEventListener('unhandledrejection', ({ reason: e }) =>
            this.reportError(e instanceof Error ? $(e.stack) : e)
          )
      },
      reportError(t) {
        var n
        if (T.get(t) >= 3) return
        T.set(t, (T.get(t) || 0) + 1)
        ;(null != (n = window.__NATIVE_FETCH__) ? n : window.fetch)(
          [
            'https://www.sou.com',
            '/qdas/sou.htm',
            '?category=info-extractor',
            e(t) ? void 0 : `&msg=${encodeURIComponent(t)}`,
            `&href=${encodeURIComponent(window.location.href)}`,
          ].join('')
        )
      },
    }
  function $(e = '') {
    const t = e.split(/\s+|\n/),
      n = [],
      r = new Set()
    for (const i of t) {
      const e = i.replace(/:\d+:\d+(\))?$/, '')
      r.has(e) || (r.add(e), n.push(i))
    }
    return n.join(' ')
  }
  function O(e, t = !1) {
    window.A3AIMessage.send('ContentTypeChange', {
      data: { type: e, url: location.href, ignore: t },
    })
  }
  function L(e) {
    window.A3AIMessage.send('ContentChange', { data: e })
  }
  const A = new Map()
  function S(e) {
    const t = e || {},
      { ignore: n = !1 } = t,
      r = __objRest(t, ['ignore']),
      i = __spreadValues({ type: 2, ignore: n }, r)
    A.set(i.url, i), L(i)
  }
  const b = {
    BILIBILI: /.bilibili.com$/i,
    DOUYIN: /.douyin.com$/i,
    IESDOUYIN: /.iesdouyin.com$/i,
    SOHU: /m.tv.sohu.com$/i,
    HAOKAN: /haokan.baidu.com/i,
    YOUTUBE: /.youtube.com$/i,
    X: /^x.com$/i,
    TWITTER: /^twitter.com$/i,
    TIKTOK: /.tiktok.com$/i,
  }
  function N(e) {
    const t = null != e ? e : document.querySelector('video')
    return {
      url: location.href,
      historyUrl: location.href,
      title: document.title,
      duration: (null == t ? void 0 : t.duration) || 0,
      currentSrc: (null == t ? void 0 : t.currentSrc) || '',
      coverUrl: (null == t ? void 0 : t.poster) || '',
      width: (null == t ? void 0 : t.offsetWidth) || 0,
      height: (null == t ? void 0 : t.offsetHeight) || 0,
      top: 0,
      fullscreen: !1,
      coverType: 1,
    }
  }
  const P = {
    timeupdate: 'VideoTimeupdate',
    play: 'VideoPlay',
    pause: 'VideoPaused',
    ended: 'VideoEnded',
    seeking: 'VideoSeeking',
    seeked: 'VideoSeeked',
  }
  let C = 0
  const M = (e) => (t) => {
      const n = t.target,
        { currentTime: r = 0, duration: i = 0 } = n
      if (
        'timeupdate' === t.type &&
        ((t) => {
          if (h(e) && 'shouldRestart' in e) {
            const { shouldRestart: n } = e
            return 'boolean' == typeof n ? n : n(t)
          }
          return !0
        })(n)
      ) {
        i - r <= Math.ceil(100 * (r - C)) / 100 && (n.currentTime = 0)
      }
      ;(C = r), window.A3AIMessage.send(P[t.type], { data: { currentTime: r, duration: i } })
    },
    x = {}
  function V(e) {
    const t = null != e ? e : document.querySelector('video')
    t &&
      Object.keys(P).forEach((e) => {
        Array.isArray(x[e]) &&
          (x[e]
            .filter(({ node: e }) => e === t)
            .forEach(({ node: t, listener: n }) => {
              t.removeEventListener(e, n)
            }),
          (x[e] = x[e].filter(({ node: e }) => e !== t)))
      })
  }
  function D(e, t) {
    const n = null != e ? e : document.querySelector('video')
    n &&
      (n.setAttribute('playsinline', ''),
      Object.keys(P).forEach((e) => {
        const r = M(t)
        Array.isArray(x[e])
          ? x[e].push({ node: n, listener: r })
          : (x[e] = [{ node: n, listener: r }]),
          n.addEventListener(e, r)
      }))
  }
  const U = 2,
    k = 3,
    j = Object.freeze({
      ZHIHU: { patterns: [/\.zhihu\.com$/i] },
      SOU: { patterns: [/.sou.com$/i, /so.360.com$/i, /so.chat.360.cn$/i] },
      TechnologyReview: { patterns: [/\.technologyreview\.com$/i] },
    })
  function G() {
    return { url: location.href, historyUrl: location.href, title: document.title }
  }
  function F() {
    return __spreadProps(__spreadValues({}, G()), {
      textContent: document.body.innerText.replace(m, '\n'),
    })
  }
  function H(e) {
    L(__spreadProps(__spreadValues({}, e), { type: 3 }))
  }
  function X() {
    ;['audio', 'video'].forEach((e) =>
      (function (e) {
        const t = document.querySelectorAll(e)
        t.length > 0 && t.forEach((e) => e.pause())
      })(e)
    )
  }
  class q {
    static initialize() {
      this.postContentTypeMessage(),
        window.addEventListener('load', () => {
          this.tryPostContentMessage()
        })
    }
    static postContentTypeMessage() {
      O(this.checkVideoType() ? U : k, this.shouldIgnore())
    }
    static tryPostContentMessage(e) {
      this.shouldIgnore() ||
        (this.checkVideoType()
          ? (function () {
              const e = location.href
              A.has(e) && L(A.get(e))
            })()
          : setTimeout(() => {
              H(this.getTextContent())
            }, 1e3))
    }
    static checkVideoType() {
      return !1
    }
    static shouldIgnore() {
      return !this.checkVideoType()
    }
    static getStyleText() {
      return ''
    }
    static hasLogin() {
      return !0
    }
    static goLogin() {}
    static getVideoInfo() {
      return N()
    }
    static checkSubtitle() {
      return {}
    }
    static fetchSubtitle(e) {
      return __async(this, null, function* () {
        return null
      })
    }
    static setSeekTime(e) {
      const t = document.querySelector('video')
      t && e >= 0 && (t.currentTime = e)
    }
    static pause() {
      X()
    }
    static getTextContent() {
      return F()
    }
  }
  var z = ['load', 'loadend', 'timeout', 'error', 'readystatechange', 'abort'],
    B = '__origin_xhr'
  function W(e, t) {
    var n = {}
    for (var r in e) n[r] = e[r]
    return (n.target = n.currentTarget = t), n
  }
  var J = z[0],
    Y = z[1],
    K = z[2],
    Z = z[3],
    Q = z[4],
    ee = z[5],
    te = 'prototype'
  function ne(e, t) {
    return (function (e, t) {
      var n = e.onRequest,
        r = e.onResponse,
        i = e.onError
      function o(e) {
        var t = e.responseType
        if (!t || 'text' === t) return e.responseText
        var n = e.response
        if ('json' === t && !n)
          try {
            return JSON.parse(e.responseText)
          } catch (r) {
            console.warn(r)
          }
        return n
      }
      function s(e, t) {
        var n = new ce(e),
          i = {
            response: o(t),
            status: t.status,
            statusText: t.statusText,
            config: e.config,
            headers:
              e.resHeader ||
              e
                .getAllResponseHeaders()
                .split('\r\n')
                .reduce(function (e, t) {
                  if ('' === t) return e
                  var n = t.split(':')
                  return (
                    (e[n.shift()] = (function (e) {
                      return e.replace(/^\s+|\s+$/g, '')
                    })(n.join(':'))),
                    e
                  )
                }, {}),
          }
        if (!r) return n.resolve(i)
        r(i, n)
      }
      function a(e, t, n, r) {
        var o = new le(e)
        ;(n = { config: e.config, error: n, type: r }), i ? i(n, o) : o.next(n)
      }
      function c() {
        return !0
      }
      function l(e) {
        return function (t, n) {
          return a(t, this, n, e), !0
        }
      }
      function u(e, t) {
        return 4 === e.readyState && 0 !== e.status ? s(e, t) : 4 !== e.readyState && ie(e, Q), !0
      }
      var { originXhr: d, unHook: h } = (function (e, t) {
        var n = (t = t || window).XMLHttpRequest,
          r = !0,
          i = function () {
            for (var e = new n(), t = 0; t < z.length; ++t) {
              var r = 'on' + z[t]
              void 0 === e[r] && (e[r] = null)
            }
            for (var i in e) {
              var c = ''
              try {
                c = typeof e[i]
              } catch (u) {}
              'function' === c
                ? (this[i] = a(i))
                : i !== B &&
                  Object.defineProperty(this, i, { get: o(i), set: s(i), enumerable: !0 })
            }
            var l = this
            ;(e.getProxy = function () {
              return l
            }),
              (this[B] = e)
          }
        function o(t) {
          return function () {
            var n = this[B][t]
            if (r) {
              var i = this.hasOwnProperty(t + '_') ? this[t + '_'] : n,
                o = (e[t] || {}).getter
              return (o && o(i, this)) || i
            }
            return n
          }
        }
        function s(t) {
          return function (n) {
            var i = this[B]
            if (r) {
              var o = this,
                s = e[t]
              if ('on' === t.substring(0, 2))
                (o[t + '_'] = n),
                  (i[t] = function (r) {
                    ;(r = W(r, o)), (e[t] && e[t].call(o, i, r)) || n.call(o, r)
                  })
              else {
                var a = (s || {}).setter
                ;(n = (a && a(n, o)) || n), (this[t + '_'] = n)
                try {
                  i[t] = n
                } catch (c) {}
              }
            } else i[t] = n
          }
        }
        function a(t) {
          return function () {
            var n = [].slice.call(arguments)
            if (e[t] && r) {
              var i = e[t].call(this, n, this[B])
              if (i) return i
            }
            return this[B][t].apply(this[B], n)
          }
        }
        return (
          ((i.prototype = n.prototype).constructor = i),
          (t.XMLHttpRequest = i),
          Object.assign(t.XMLHttpRequest, {
            UNSENT: 0,
            OPENED: 1,
            HEADERS_RECEIVED: 2,
            LOADING: 3,
            DONE: 4,
          }),
          {
            originXhr: n,
            unHook: function () {
              ;(r = !1),
                t.XMLHttpRequest === i &&
                  ((t.XMLHttpRequest = n), (i.prototype.constructor = n), (n = void 0))
            },
          }
        )
      })(
        {
          onload: c,
          onloadend: c,
          onerror: l(Z),
          ontimeout: l(K),
          onabort: l(ee),
          onreadystatechange: function (e) {
            return u(e, this)
          },
          open: function (e, t) {
            var r = this,
              i = (t.config = { headers: {} })
            ;(i.method = e[0]),
              (i.url = e[1]),
              (i.async = e[2]),
              (i.user = e[3]),
              (i.password = e[4]),
              (i.xhr = t)
            var o = 'on' + Q
            if (
              (t[o] ||
                (t[o] = function () {
                  return u(t, r)
                }),
              n)
            )
              return !0
          },
          send: function (e, t) {
            var r = t.config
            if (((r.withCredentials = t.withCredentials), (r.body = e[0]), n)) {
              var i = function () {
                n(r, new ae(t))
              }
              return !1 === r.async ? i() : setTimeout(i), !0
            }
          },
          setRequestHeader: function (e, t) {
            if (((t.config.headers[e[0].toLowerCase()] = e[1]), n)) return !0
          },
          addEventListener: function (e, t) {
            var n = this
            if (-1 !== z.indexOf(e[0])) {
              var r = e[1]
              return (
                re(t).addEventListener(e[0], function (t) {
                  var i = W(t, n)
                  ;(i.type = e[0]), (i.isTrusted = !0), r.call(n, i)
                }),
                !0
              )
            }
          },
          getAllResponseHeaders: function (e, t) {
            var n = t.resHeader
            if (n) {
              var r = ''
              for (var i in n) r += i + ': ' + n[i] + '\r\n'
              return r
            }
          },
          getResponseHeader: function (e, t) {
            var n = t.resHeader
            if (n) return n[(e[0] || '').toLowerCase()]
          },
        },
        t
      )
      return { originXhr: d, unProxy: h }
    })(e, (t = t || window))
  }
  function re(e) {
    return e.watcher || (e.watcher = document.createElement('a'))
  }
  function ie(e, t) {
    var n,
      r = e.getProxy(),
      i = 'on' + t + '_',
      o = W({ type: t }, r)
    r[i] && r[i](o),
      'function' == typeof Event
        ? (n = new Event(t, { bubbles: !1 }))
        : (n = document.createEvent('Event')).initEvent(t, !1, !0),
      re(e).dispatchEvent(n)
  }
  function oe(e) {
    ;(this.xhr = e), (this.xhrProxy = e.getProxy())
  }
  function se(e) {
    function t(e) {
      oe.call(this, e)
    }
    return (t[te] = Object.create(oe[te])), (t[te].next = e), t
  }
  oe[te] = Object.create({
    resolve: function (e) {
      var t = this.xhrProxy,
        n = this.xhr
      ;(t.readyState = 4),
        (n.resHeader = e.headers),
        (t.response = t.responseText = e.response),
        (t.statusText = e.statusText),
        (t.status = e.status),
        ie(n, Q),
        ie(n, J),
        ie(n, Y)
    },
    reject: function (e) {
      ;(this.xhrProxy.status = 0), ie(this.xhr, e.type), ie(this.xhr, Y)
    },
  })
  var ae = se(function (e) {
      var t = this.xhr
      for (var n in ((e = e || t.config),
      (t.withCredentials = e.withCredentials),
      t.open(e.method, e.url, !1 !== e.async, e.user, e.password),
      e.headers))
        t.setRequestHeader(n, e.headers[n])
      t.send(e.body)
    }),
    ce = se(function (e) {
      this.resolve(e)
    }),
    le = se(function (e) {
      this.reject(e)
    })
  const ue = /bilibili.com\/([^\/]*)/,
    de = /bilibili.com\/read\/mobile\?id=([^&]+)/,
    he = { VIDEO: 'video', BANGUMI: 'bangumi', CHEESE: 'cheese' }
  let pe,
    fe = ''
  class me extends q {
    static initialize() {
      super.initialize(), ne(this.handleXhrProxy())
    }
    static checkVideoType() {
      return Object.values(he).includes(Ee())
    }
    static shouldIgnore() {
      return !this.checkVideoType() && !de.test(location.href)
    }
    static getStyleText() {
      return '.mplayer-control-bar .mplayer-btn-widescreen,.control-btn.btn-widescreen,.openapp-dialog,.caution-dialog{display:none!important}.m-video-new>div:nth-child(2){display:block!important}'
    }
    static handleXhrProxy() {
      return {
        onResponse: (e, t) => {
          const n = e.config.url,
            r = n.includes('api.bilibili.com/x/player/wbi/v2'),
            i = n.includes('api.bilibili.com/pgc/player/web/playurl/html5')
          if (r || i) {
            fe = Ee()
            try {
              const t = JSON.parse(e.response)
              if (0 == t.code) {
                if (i) {
                  const e = new URL(n).searchParams.get('ep_id') || ''
                  pe = __spreadProps(__spreadValues({}, t.result), { ep_id: e })
                } else r && (pe = t.data)
                !(function () {
                  __async(this, null, function* () {
                    yield g()
                    const e = document.querySelector('video')
                    if ((V(), fe === he.BANGUMI)) S(me.getVideoInfo())
                    else {
                      const t = () => {
                        var n
                        if (e.readyState >= 1) {
                          if (fe === he.CHEESE)
                            null == (n = document.querySelector('.play-handler')) || n.click()
                          else {
                            const t = document.querySelector('.player-icon.icon-preview')
                            null == t ||
                              t.addEventListener('touchstart', () => {
                                e.play()
                              }),
                              e.play()
                          }
                          S(me.getVideoInfo())
                        } else setTimeout(() => t(), 300)
                      }
                      t()
                    }
                    D()
                  })
                })()
              }
            } catch (o) {}
          }
          t.next(e)
        },
      }
    }
    static hasLogin() {
      return document.cookie.includes('DedeUserID')
    }
    static goLogin() {
      location.replace(
        [
          'https://passport.bilibili.com/h5-app/passport/login',
          '?gourl=',
          encodeURIComponent(location.href),
        ].join('')
      )
    }
    static getVideoInfo() {
      var e
      const t = N(),
        { durl: n = [], aid: r = 0, cid: i = 0, bvid: o = '', ep_id: s = 0 } = pe || {}
      let a = y('.mplayer')
      0 == a.width && (a = y('#bofqi'))
      return __spreadProps(__spreadValues(__spreadValues({}, t), a), {
        top: ye(),
        payload: {
          id: JSON.stringify({ aid: r, cid: i, bvid: o, ep_id: s }),
          target_src: 'Bilibili',
          mdl_url: JSON.stringify({
            video_urls:
              n.length > 0
                ? n.map((e) => e.url)
                : [null == (e = window.player) ? void 0 : e.getPlayurl()],
          }),
        },
      })
    }
    static checkSubtitle() {
      var e
      if (pe) {
        const t = (null == (e = pe.subtitle) ? void 0 : e.subtitles) || []
        if (t.length > 0) return { subtitlesUrl: t[0].subtitle_url }
      }
      return {}
    }
    static fetchSubtitle(e) {
      return __async(this, null, function* () {
        try {
          const t = yield fetch(e),
            n = yield t.json()
          if (Array.isArray(null == n ? void 0 : n.body) && n.body.length > 0)
            return n.body.map(({ from: e, to: t, content: n }) => ({
              from: I(e),
              to: I(t),
              content: n,
            }))
        } catch (t) {}
        return null
      })
    }
    static pause() {
      var e
      null == (e = window.player) || e.pause()
    }
  }
  function Ee() {
    var e
    const t = location.href.match(ue)
    return null != (e = null == t ? void 0 : t[1].toLocaleLowerCase()) ? e : ''
  }
  function ye() {
    return y(
      {
        '': '.m-navbar',
        [he.VIDEO]: '.m-navbar',
        [he.BANGUMI]: '.b-top-nav',
        [he.CHEESE]: '.navbar-h5',
      }[Ee()]
    ).height
  }
  const ve = 'https://www.sou.com',
    ge = {
      error(e) {
        var t
        ;(null != (t = window.__NATIVE_FETCH__) ? t : window.fetch)(
          [
            ve,
            '/qdas/sou.htm',
            '?',
            `href=${encodeURIComponent(window.location.href)}`,
            '&',
            `err=${encodeURIComponent(e)}`,
          ].join('')
        )
      },
    },
    _e = /\/shorts\/([^?\/#]*)/,
    we = /youtube\.com\/.*?\/player([/?].*)?$/i,
    Ie = ['zh', 'zh-Hans', 'en', 'en-US', 'zh-Hant', 'zh-TW', 'zh-HK'],
    Te = {},
    Re = {}
  class $e extends q {
    static initialize() {
      super.initialize(),
        p('ytInitialPlayerResponse', (e) => {
          var n
          null !== e &&
            h(e, !0) &&
            t(null == (n = e.videoDetails) ? void 0 : n.videoId) &&
            e.videoDetails.videoId === Oe() &&
            Ae(e)
        }),
        n({
          onResponse(e) {
            return __async(this, null, function* () {
              const t = e.url
              we.test(t) && $e.checkVideoType() && Ae(yield e.json())
            })
          },
        })
    }
    static checkVideoType() {
      const { pathname: e } = location
      return e.startsWith('/watch') || _e.test(e)
    }
    static getVideoInfo() {
      return __async(this, null, function* () {
        var t
        const n = N(),
          { width: r, height: i } = n,
          { videoDetails: o, streamingData: s } = Le(),
          a = n.duration || (s.formats[0].approxDurationMs || 0) / 1e3
        let c = ''
        const l = o.thumbnail.thumbnails || []
        if (l.length > 0) {
          c = (null != (t = l[1]) ? t : l[0]).url
        }
        const u = location.pathname.startsWith('/shorts') || r / i < 1,
          d = __spreadProps(__spreadValues({}, n), {
            title: o.title,
            top: u ? 0 : E('.mobile-topbar-header') || 48,
            fullscreen: u,
            duration: a,
            coverUrl: c,
            payload: {
              target_src: 'Youtube',
              mdl_url: JSON.stringify({ video_urls: [location.href] }),
            },
          }),
          { subtitlesUrl: h } = this.checkSubtitle()
        if (e(h)) {
          const { video_urls: e, audio_urls: t } = yield (function (e) {
            return __async(this, null, function* () {
              if (Re[e]) return Re[e]
              const t = JSON.stringify({
                context: {
                  client: {
                    clientName: 'IOS',
                    clientVersion: '19.29.1',
                    deviceMake: 'Apple',
                    deviceModel: 'iPhone16,2',
                    userAgent:
                      'com.google.ios.youtube/19.29.1 (iPhone16,2; U; CPU iOS 17_5_1 like Mac OS X;)',
                    osName: 'iPhone',
                    osVersion: '17.5.1.21F90',
                    hl: 'en',
                    timeZone: 'UTC',
                    utcOffsetMinutes: 0,
                  },
                },
                videoId: e,
                playbackContext: {
                  contentPlaybackContext: {
                    html5Preference: 'HTML5_PREF_WANTS',
                    signatureTimestamp: 20012,
                  },
                },
                contentCheckOk: !0,
                racyCheckOk: !0,
              })
              try {
                const n = yield window.__NATIVE_FETCH__(
                    'https://www.youtube.com/youtubei/v1/player?prettyPrint=false',
                    { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: t }
                  ),
                  {
                    streamingData: { adaptiveFormats: r },
                  } = yield n.json()
                if (r.length > 0) {
                  const t = [],
                    n = []
                  r.forEach((e) => {
                    e.qualityLabel ? t.push(e) : n.push(e)
                  }),
                    t.sort((e, t) => e.bitrate - t.bitrate),
                    n.sort((e, t) => e.bitrate - t.bitrate)
                  const i = {
                    video_urls: t.length > 0 ? [t[0].url] : [],
                    audio_urls: n.length > 0 ? [n[0].url] : [],
                  }
                  return (Re[e] = i), i
                }
              } catch (n) {
                ge.error(n.message)
              }
              return { video_urls: [], audio_urls: [] }
            })
          })(o.videoId)
          ;(e.length > 0 || t.length > 0) &&
            (d.payload = {
              target_src: 'Youtube',
              mdl_url: JSON.stringify({ video_urls: e, audio_urls: t }),
            })
        }
        return d
      })
    }
    static checkSubtitle() {
      var e, t, n
      const r =
        null == (t = null == (e = Le().captions) ? void 0 : e.playerCaptionsTracklistRenderer)
          ? void 0
          : t.captionTracks
      if (Array.isArray(r) && r.length > 0) {
        let e = null == (n = r[0]) ? void 0 : n.baseUrl
        if (r.length > 1)
          for (const t of Ie) {
            const n = r.find((e) => e.languageCode === t)
            if (n) {
              e = n.baseUrl
              break
            }
          }
        return { subtitlesUrl: e }
      }
      return {}
    }
    static fetchSubtitle(e) {
      return __async(this, null, function* () {
        try {
          const t = yield fetch(e + '&fmt=json3'),
            n = (yield t.json()).events
              .filter((e) => {
                var t
                return null == (t = e.segs) ? void 0 : t.length
              })
              .map((e) => {
                var t
                return {
                  from: Math.floor(e.tStartMs / 1e3),
                  to: Math.floor((e.tStartMs + (null != (t = e.dDurationMs) ? t : 0)) / 1e3),
                  content: e.segs.map((e) => e.utf8.replace('\n', ' ')).join(''),
                }
              })
          return n
            .reduce((e, t) => {
              if (!e.length) return e.push(t), e
              const n = e[e.length - 1]
              return t.from < n.to ? (n.content += t.content) : e.push(t), e
            }, [])
            .map((e) =>
              __spreadProps(__spreadValues({}, e), { from: I(Number(e.from)), to: I(Number(e.to)) })
            )
        } catch (t) {
          return null
        }
      })
    }
  }
  function Oe() {
    var e, t
    let n = ''
    const { pathname: r } = location
    return (
      r.startsWith('/watch') &&
        (n = null != (e = new URLSearchParams(location.search).get('v')) ? e : ''),
      _e.test(r) && (n = null != (t = r.match(_e)[1]) ? t : ''),
      n
    )
  }
  function Le() {
    let e = Oe()
    return 'string' != typeof e || 0 == e.trim().length ? {} : Te[e] ? Te[e] : {}
  }
  function Ae(e) {
    return __async(this, null, function* () {
      var n
      if (h(e, !0) && t(null == (n = e.videoDetails) ? void 0 : n.videoId)) {
        const t = e.videoDetails.videoId
        if (((Te[t] = e), Te[t])) {
          V(), yield _()
          const e = (function () {
            const { videoDetails: e } = Le()
            return !!e.isLive
          })()
          !(function (e) {
            __async(this, null, function* () {
              if (e) S({ ignore: e })
              else {
                const t = yield $e.getVideoInfo()
                S(__spreadProps(__spreadValues({}, t), { ignore: e }))
              }
            })
          })(e),
            e || D()
        }
      }
    })
  }
  function Se(e, t, n) {
    var r,
      i,
      o,
      s,
      a = 0
    n || (n = {})
    var c = function () {
        ;(a = !1 === n.leading ? 0 : Date.now()),
          (r = null),
          (s = e.apply(i, o)),
          r || (i = o = null)
      },
      l = function () {
        var l = Date.now()
        a || !1 !== n.leading || (a = l)
        var u = t - (l - a)
        return (
          (i = this),
          (o = arguments),
          u <= 0 || u > t
            ? (r && (clearTimeout(r), (r = null)),
              (a = l),
              (s = e.apply(i, o)),
              r || (i = o = null))
            : r || !1 === n.trailing || (r = setTimeout(c, u)),
          s
        )
      }
    return (
      (l.cancel = function () {
        clearTimeout(r), (a = 0), (r = i = o = null)
      }),
      l
    )
  }
  const be = /\.com\/i\/api\/graphql\/[^\/]+\/([^?]+)(\?)?.*$/i,
    Ne = /\.com\/[^\/]+\/status\/([^\/]+)\/(mediaViewer|video)[/?]*/i,
    Pe = /\.com\/[^\/]+\/status\/[^\/]+$/i,
    Ce = {},
    Me = 50
  class xe extends q {
    static initialize() {
      this.onHistoryChange(),
        ne({
          onResponse: (e, t) => {
            const n = e.config.url,
              r = Ne.test(location.href),
              i = n.match(be)
            if (null !== i) {
              const t = i[1].toLocaleLowerCase()
              try {
                const { data: r } = JSON.parse(e.response)
                'immersivemedia' === t
                  ? je(r.immersiveMedia.timeline.instructions)
                  : 'searchtimeline' === t &&
                    (function (e) {
                      try {
                        const { searchParams: t } = new URL(e)
                        return (
                          'media' === JSON.parse(t.get('variables')).product.toLocaleLowerCase()
                        )
                      } catch (t) {}
                      return !1
                    })(n)
                  ? je(r.search_by_raw_query.search_timeline.timeline.instructions)
                  : 'tweetresultbyrestid' === t
                  ? (Ge(r.tweetResult), Ve())
                  : 'tweetdetail' === t && this.postTextContentMessage(),
                  Ue && Ce[Ue.waitingId] && Ue && (Ue.waitingFn(), (Ue = null))
              } catch (o) {}
            }
            r && Xe(), t.next(e)
          },
        })
    }
    static hasLogin() {
      return document.cookie.includes('twid=')
    }
    static goLogin() {
      location.href = 'https://x.com/i/flow/login'
    }
    static onHistoryChange() {
      a(({ type: e }) => {
        if ('pushState' === e) {
          const e = location.href.match(Ne)
          null !== e && 'video' === e[2] && Ve()
        }
      })
    }
    static tryPostContentMessage({ historyType: e }) {
      'pushState' !== e && Pe.test(location.href) && this.postTextContentMessage()
    }
    static checkVideoType() {
      return Ne.test(location.href)
    }
    static shouldIgnore() {
      return !this.checkVideoType() && !Pe.test(location.href)
    }
    static postTextContentMessage() {
      setTimeout(() => {
        const e = this.getTextContent()
        H(
          __spreadProps(__spreadValues({}, e), {
            textContent: e.textContent
              .replace('To view keyboard shortcuts, press question mark', '')
              .replace('View keyboard shortcuts', '')
              .replace('See new posts', ''),
          })
        )
      }, 1500)
    }
    static getVideoInfo() {
      const e = N(Fe()),
        t = He(),
        {
          title: n = '',
          cover: r = '',
          duration: i = 0,
          width: o = 0,
          height: s = 0,
          user: { screen_name: a },
        } = Ce[t] || {},
        c = ['https://x.com/', a, '/status/', t, '/mediaViewer'].join('')
      return __spreadProps(__spreadValues({}, e), {
        historyUrl: c,
        title: n,
        coverUrl: r,
        duration: i,
        width: o,
        height: s,
        top: 0,
        currentSrc: c,
        fullscreen: !0,
        payload: ke(),
      })
    }
    static setSeekTime(e) {
      const t = Fe()
      t && e >= 0 && (t.currentTime = e)
    }
    static pause() {
      const e = Fe()
      null == e || e.pause()
    }
  }
  function Ve() {
    const e = He()
    Ce[e] && S(xe.getVideoInfo())
  }
  let De,
    Ue = null
  function ke() {
    const e = He(),
      t = Ce[e],
      n = (null == t ? void 0 : t.url) || '',
      r = { mdl_url: '' }
    return (
      n && (r.mdl_url = JSON.stringify({ video_urls: [n] })),
      __spreadValues({ target_src: 'Twitter' }, r)
    )
  }
  function je(e) {
    var t
    const n = null == (t = e.find((e) => 'TimelineAddEntries' === e.type)) ? void 0 : t.entries
    n &&
      (function (e) {
        e.forEach((e) => {
          const t = e.content.itemContent,
            n = e.content.items
          t
            ? Ge(t.tweet_results)
            : n &&
              n.forEach((e) => {
                let { tweet_results: t } = e.item.itemContent
                Ge(t)
              })
        })
      })(n)
  }
  function Ge(e) {
    const { result: n } = e,
      { rest_id: r, legacy: i } = n,
      o = (function (e) {
        const { id: t, legacy: n } = e.result
        return { id: t, screen_name: n.screen_name }
      })(n.core.user_results),
      s = (function (e) {
        const t = e.entities.media
        if ((null == t ? void 0 : t.length) > 0 && t[0].video_info) {
          const {
            media_url_https: e,
            video_info: { variants: n, duration_millis: r },
            original_info: { width: i, height: o },
          } = t[0]
          return {
            cover: e,
            url: n
              .filter((e) => 'video/mp4' === e.content_type)
              .sort((e, t) => e.bitrate - t.bitrate)[0].url,
            duration: r / 1e3,
            width: i,
            height: o,
          }
        }
        return {}
      })(i),
      { url: a = '' } = s,
      c = __objRest(s, ['url'])
    r && t(a) && (Ce[r] = __spreadValues({ user: o, title: i.full_text, url: a }, c))
  }
  function Fe() {
    let e
    const t = document.querySelectorAll('video')
    return (
      t.forEach((t) => {
        const n = t.getBoundingClientRect().top
        n >= -Me && n <= Me && (e = t)
      }),
      null != e ? e : t[0]
    )
  }
  function He() {
    var e
    const t = location.href.match(Ne)
    return t
      ? 'mediaviewer' === t[2].toLocaleLowerCase()
        ? null != (e = new URLSearchParams(location.search).get('currentTweet'))
          ? e
          : ''
        : t[1]
      : ''
  }
  const Xe = Se(
    () => {
      const e = Fe(),
        t = He()
      e && De !== e && (Ce[t] ? qe() : (Ue = { waitingFn: qe, waitingId: t }))
    },
    500,
    { leading: !1, trailing: !0 }
  )
  function qe() {
    Ve(),
      (function () {
        const e = () => {
          const t = Fe()
          if (t) return V(De), (De = t), void setTimeout(() => D(t), 300)
          setTimeout(() => e(), 300)
        }
        e()
      })()
  }
  const ze = /^\/v[\d]+\.shtml/i,
    Be = /^\/u\/vw\/[\d]+\.shtml/i,
    We = /^\/v\/[^/]+.html/i,
    Je = /^\/(svs|sugs)\/sv[\d]+\.shtml/i,
    Ye = /^\/hots/i
  class Ke extends q {
    static initialize() {
      super.initialize(),
        p('_player', () => {
          p(
            'dataModel',
            () => {
              V(window._player.video),
                window._player.play(),
                D(window._player.video, {
                  shouldRestart: () => ![ze, Je].some((e) => e.test(location.pathname)),
                }),
                S(this.getVideoInfo())
            },
            window._player
          )
        })
    }
    static checkVideoType() {
      return [ze, Be, We, Je, Ye].some((e) => e.test(location.pathname))
    }
    static getVideoInfo() {
      const { dataModel: e, videoData: t, video: n } = window._player,
        r = N(n),
        { title: i, poster: o, duration: s, vw: a, vh: c } = e,
        { url_html5: l, urls: u } = t,
        d = E('#nav_header') + E('.actv-banner'),
        h = window.screen.width,
        p = c / a
      let f = []
      try {
        const { nor: e, hig: t, sup: n } = u.mp4
        for (let r of [e, t, n])
          if (r.length > 0) {
            f = r
            break
          }
      } catch (y) {}
      const m = Ye.test(location.pathname)
      return __spreadProps(__spreadValues({}, r), {
        historyUrl: m ? l : location.href,
        duration: s,
        coverUrl: o,
        title: i,
        top: d,
        width: h,
        height: h * p,
        fullscreen: m || p > 0.57,
        payload: {
          target_src: m ? 'SohuV' : 'Sohu',
          mdl_url: JSON.stringify({ video_urls: m ? f : [location.href] }),
        },
      })
    }
    static pause() {
      const e = window._player.video
      null == e || e.pause()
    }
  }
  const Ze = /^\/share\/video\/.*/i
  let Qe = null,
    et = 100
  class tt extends q {
    static initialize() {
      super.initialize(),
        Ze.test(location.pathname)
          ? this.onShareVideoChange()
          : (window.addEventListener('DOMContentLoaded', () => {
              !(function () {
                const e = document.querySelector('.TnpQ5UcN.isBHOTdr')
                e && e.addEventListener('transitionend', it)
              })(),
                g().then(() => {
                  ot(document.querySelector('video'))
                })
            }),
            p('player', (e) => {
              ;(null == e ? void 0 : e.video) instanceof HTMLVideoElement &&
                (0 == e.bizType && rt(), nt(0 != e.bizType))
            }))
    }
    static onShareVideoChange() {
      p('_ROUTER_DATA', (e) =>
        __async(this, null, function* () {
          var t, n
          try {
            const {
              desc: r,
              music: i,
              video: o,
            } = e.loaderData['video_(id)/page'].videoInfoRes.item_list[0]
            window.player = {
              historyUrl: location.href,
              desc: r,
              currentSrc: o.play_addr.url_list[0],
              duration: null != (t = null == i ? void 0 : i.duration) ? t : 0,
              sizeInfo: { width: o.width, height: o.height },
            }
            const { ok: s } = yield g()
            if (s) {
              const e = document.querySelector('video')
              ;(window.player = __spreadProps(__spreadValues({}, window.player), {
                video: e,
                play: () => e.play(),
                poster: null == (n = document.querySelector('.poster')) ? void 0 : n.src,
              })),
                rt(),
                nt()
            }
          } catch (r) {}
        })
      )
    }
    static checkVideoType() {
      const { href: e, pathname: t } = location
      return '/' === t || e.includes('modal_id=') || Ze.test(t)
    }
    static getVideoInfo() {
      var n, r
      const i = N(),
        { protocol: o } = window.location,
        {
          historyUrl: s,
          desc: a,
          duration: c = 0,
          poster: l = '',
          sizeInfo: u,
          config: d,
        } = window.player || {},
        h = (function () {
          const { loadURL: e, currentSrc: n } = window.player
          let r = ''
          r = t(e) ? (e.startsWith('http') ? e : location.protocol + e) : n
          return r
        })(),
        p =
          null != (r = null != (n = null == d ? void 0 : d.awemeInfo) ? n : window.awemeInfo)
            ? r
            : { desc: '' },
        f = __spreadProps(__spreadValues({}, i), {
          title: null != a ? a : p.desc,
          historyUrl: s,
          duration: c > 0 ? c : i.duration,
          currentSrc: h,
          coverUrl: l.startsWith('http') ? l : o + l,
          width: u.width,
          height: u.height,
          fullscreen: !0,
          payload: { target_src: 'Douyin', mdl_url: JSON.stringify({ video_urls: [h] }) },
        })
      return (
        e(s) &&
          (f.historyUrl = f.url.includes('/lvdetail/')
            ? f.url
            : `https://m.douyin.com/share/video/${p.awemeId}`),
        f
      )
    }
    static setSeekTime(e) {
      const t = window.player.video
      t && e >= 0 && (t.currentTime = e)
    }
    static pause() {
      const e = window.player.video
      null == e || e.pause()
    }
  }
  function nt(e = !1) {
    return __async(this, null, function* () {
      e || (yield _(window.player.video)),
        S(__spreadProps(__spreadValues({}, e ? {} : tt.getVideoInfo()), { ignore: e }))
    })
  }
  function rt() {
    const e = window.player.video
    e && (V(e), D(e))
    const t = document.querySelector('#slideMode')
    if (null !== t) {
      const e = { attributes: !0, childList: !0, subtree: !0 },
        n = new MutationObserver((e) => {
          for (const t of e) {
            if ('attributes' === t.type && 'data-e2e-vid' === t.attributeName) {
              nt()
              break
            }
            'childList' === t.type &&
              t.removedNodes.length > 0 &&
              t.removedNodes.forEach((e) => {
                e instanceof HTMLVideoElement && n.disconnect()
              })
          }
        })
      n.observe(t, e)
    }
  }
  const it = Se(
    () => {
      const e = (function () {
        let e = null
        const t = document.querySelectorAll('video')
        for (const n of t) {
          const t = n.getBoundingClientRect().top
          if (t >= -100 && t <= et) {
            e = n
            break
          }
        }
        return e
      })()
      ;(null == e ? void 0 : e.currentSrc) !== (null == Qe ? void 0 : Qe.currentSrc) &&
        ((Qe = e), ot(e))
    },
    300,
    { leading: !0, trailing: !1 }
  )
  function ot(e) {
    var t
    const n = null == (t = null == e ? void 0 : e.parentElement) ? void 0 : t.parentElement
    'feed-live' === (null == n ? void 0 : n.getAttribute('data-e2e')) && nt(!0)
  }
  const st = /tiktok.com\/api\/.*?\/item_list([/?].*)?$/i,
    at = /\/\/v16m-webapp.tiktokcdn-us.com\/.+/i,
    ct = /tiktok.com\/@[^/?]+/i,
    lt = /tiktok.com\/@[^/]+\/video\/[^?]+/i
  class ut extends q {
    static setVideoList(e) {
      Array.isArray(e) && e.forEach((e) => (this.videoData[e.id] = e))
    }
    static tryGetFyqFeedCache() {
      const e = localStorage.getItem('fyp-feed-cache')
      if (t(e))
        try {
          const t = JSON.parse(e)
          h(t) && ((this.webId = t.cacheWid), this.setVideoList(t.itemList))
        } catch (n) {}
    }
    static initialize() {
      super.initialize(),
        this.tryGetFyqFeedCache(),
        this.onSharingVideoModule(),
        ne(this.handleXhrProxy()),
        n(this.handleFetchProxy())
    }
    static handleXhrProxy() {
      return {
        onRequest: (e, t) => {
          'https://mcs.tiktokw.us/v1/list' === e.url && this.checkVideoReady(e.body), t.next(e)
        },
        onResponse: (e, t) => {
          const n = e.config.url
          at.test(n) && (this.currentWebVTT = { url: n, content: e.response }), t.next(e)
        },
      }
    }
    static handleFetchProxy() {
      return {
        onResponse: (e) =>
          __async(this, null, function* () {
            const t = e.url
            if (st.test(t))
              try {
                const { itemList: t } = yield e.json()
                Array.isArray(t) && t.forEach((e) => (this.videoData[e.id] = e))
              } catch (n) {}
            else if (at.test(t)) {
              const n = yield e.text()
              this.currentWebVTT = { url: t, content: n }
            }
          }),
      }
    }
    static checkVideoReady(e) {
      return __async(this, null, function* () {
        let t = null
        try {
          t = JSON.parse(e)
        } catch (n) {}
        if (Array.isArray(t) && t.length > 0)
          for (const e of t) {
            if (!Array.isArray(null == e ? void 0 : e.events)) continue
            const t = e.events.find(({ event: e }) => 'video_request' === e)
            if (h(t)) {
              const e = JSON.parse(t.params)
              ;(this.currentVideoId = e.group_id),
                this.videoData[this.currentVideoId] && (S(this.getVideoInfo()), dt())
              break
            }
          }
      })
    }
    static onSharingVideoModule() {
      p('SIGI_STATE', (e) =>
        __async(this, null, function* () {
          setTimeout(() => {
            const t = e.SharingVideoModule.videoData.itemInfo.itemStruct
            ;(this.currentVideoId = t.id),
              (this.videoData[this.currentVideoId] = t),
              S(this.getVideoInfo()),
              dt()
          }, 300)
        })
      )
    }
    static checkVideoType() {
      const { href: e, pathname: t } = location
      return ['/', '/foryou'].includes(t) || [ct, lt].some((t) => t.test(e))
    }
    static shouldIgnore() {
      return ct.test(location.href) || !this.checkVideoType()
    }
    static getVideoInfo() {
      const t = N(),
        { id: n, desc: r, author: i, video: o } = this.videoData[this.currentVideoId]
      e(this.webId) && this.tryGetFyqFeedCache()
      const s = [
        'https://www.tiktok.com/',
        `@${i.uniqueId}`,
        '/video/',
        n,
        '?is_from_webapp=1&sender_device=mobile&sender_web_id=',
        this.webId,
      ].join('')
      return __spreadProps(__spreadValues({}, t), {
        title: r || document.title,
        historyUrl: s,
        fullscreen: !0,
        duration: o.duration,
        coverUrl: o.cover,
        payload: { target_src: 'TikTok', mdl_url: JSON.stringify({ video_urls: [s] }) },
      })
    }
    static checkSubtitle() {
      var e
      const { video: t } = this.videoData[this.currentVideoId],
        n = null == (e = t.subtitleInfos) ? void 0 : e.sort((e, t) => e.LanguageID - t.LanguageID),
        r =
          null == n
            ? void 0
            : n.find((e) => '1' === e.LanguageID || e.Url === this.currentWebVTT.url)
      return r ? { subtitlesUrl: r.Url } : {}
    }
    static fetchSubtitle(e) {
      return __async(this, null, function* () {
        if (this.currentWebVTT.url === e) return ht(this.currentWebVTT.content)
        try {
          const t = yield window.__NATIVE_FETCH__(e)
          return ht(yield t.text())
        } catch (t) {
          return null
        }
      })
    }
  }
  function dt() {
    const e = () => {
      if (document.querySelector('video'))
        return (
          V(),
          void setTimeout(() => {
            D()
          })
        )
      setTimeout(() => e(), 300)
    }
    e()
  }
  function ht(e) {
    const t = [],
      n = e.split(/\n\n/)
    for (const r of n) {
      if ('WEBVTT' === r.toLocaleUpperCase()) continue
      const [e, n] = r.split(/\n/).filter((e) => e.trim()),
        [i, o] = e.split(/ --> /)
      t.push({ from: i, to: o, content: n })
    }
    return t
  }
  __publicField(ut, 'webId', ''),
    __publicField(ut, 'currentVideoId', ''),
    __publicField(ut, 'currentWebVTT', {}),
    __publicField(ut, 'videoData', {})
  class pt extends q {
    static initialize() {
      super.initialize(),
        p('__PRELOADED_STATE__', (e) =>
          __async(this, [e], function* ({ curVideoMeta: e }) {
            ;(this.videoData = e), yield _(), D(), S(this.getVideoInfo())
          })
        )
    }
    static checkVideoType() {
      return '/' !== location.pathname
    }
    static getVideoInfo() {
      const e = N(),
        { title: t, poster: n, playurl: r } = this.videoData
      return __spreadProps(__spreadValues({}, e), {
        coverUrl: n,
        title: t,
        top: E('.navigation'),
        payload: { target_src: 'Haokan', mdl_url: JSON.stringify({ video_urls: [r] }) },
      })
    }
  }
  __publicField(pt, 'videoData')
  const {
    BILIBILI: ft,
    DOUYIN: mt,
    IESDOUYIN: Et,
    SOHU: yt,
    XIGUA: vt,
    CCTV: gt,
    HAOKAN: _t,
    YOUTUBE: wt,
    X: It,
    TWITTER: Tt,
    TIKTOK: Rt,
  } = b
  const $t = (function () {
    const { hostname: e } = location
    switch (!0) {
      case ft.test(e):
        return me
      case mt.test(e):
      case Et.test(e):
        return tt
      case yt.test(e):
        return Ke
      case _t.test(e):
        return pt
      case wt.test(e):
        return $e
      case It.test(e):
      case Tt.test(e):
        return xe
      case Rt.test(e):
        return ut
    }
    return q
  })()
  class Ot {
    static SetUp() {
      a(({ type: e }) => {
        $t.postContentTypeMessage(), $t.tryPostContentMessage({ historyType: e })
      }),
        this.registerEvents(),
        $t.initialize(),
        document.addEventListener('readystatechange', () => {
          if ('interactive' === document.readyState) {
            !(function (t) {
              if (!e(t)) {
                var n = document.createElement('style')
                n.setAttribute('type', 'text/css'),
                  n.appendChild(document.createTextNode(t)),
                  document.head.appendChild(n)
              }
            })($t.getStyleText())
          }
        })
    }
    static registerEvents() {
      this.onHasLogin(),
        this.onGoLogin(),
        this.onGetVideoInfo(),
        this.onGetSubtitle(),
        this.onSetSeekTime(),
        this.onPause(),
        this.onGetTextContent()
    }
    static onHasLogin() {
      window.A3AIMessage.on('HasLogin', () => {
        window.A3AIMessage.send('HasLogin', { data: $t.hasLogin() })
      })
    }
    static onGoLogin() {
      window.A3AIMessage.on('GoLogin', () => {
        var e
        null == (e = $t.goLogin) || e.call($t)
      })
    }
    static onGetVideoInfo() {
      window.A3AIMessage.on('GetVideoInfo', () =>
        __async(this, null, function* () {
          const e = yield $t.getVideoInfo()
          window.A3AIMessage.send('GetVideoInfo', { data: e })
        })
      )
    }
    static onGetSubtitle() {
      window.A3AIMessage.on('GetSubtitle', () =>
        __async(this, null, function* () {
          let t = { code: 10001, message: 'not supported' }
          if (Object.values(b).some((e) => e.test(location.hostname)))
            if ($t.hasLogin()) {
              const { subtitlesUrl: n } = $t.checkSubtitle()
              if (e(n)) t = { code: 10003, message: 'no subtitles' }
              else {
                const e = yield $t.fetchSubtitle(n)
                t =
                  null != e
                    ? { code: 0, message: 'ok', data: e }
                    : { code: 10004, message: 'Failed to get subtitles' }
              }
            } else t = { code: 10002, message: 'not login' }
          window.A3AIMessage.send('GetSubtitle', t)
        })
      )
    }
    static onSetSeekTime() {
      window.A3AIMessage.on('SetSeekTime', (e) => {
        var t
        const n = e.time
        null == (t = $t.setSeekTime) || t.call($t, n)
      })
    }
    static onPause() {
      window.A3AIMessage.on('Pause', () => {
        $t.pause()
      })
    }
    static onGetTextContent() {
      window.A3AIMessage.on('GetTextContent', () => {
        window.A3AIMessage.send('GetTextContent', { data: $t.getTextContent() })
      })
    }
  }
  class Lt {
    static initialize() {
      this.postTextTypeMessage()
      const e = window.setTimeout(() => {
        R.reportError('page_loading_timeout')
      }, 5e3)
      window.addEventListener('load', () => {
        window.clearTimeout(e), this.postTextContentMessage()
      })
    }
    static postTextTypeMessage() {
      O(k, this.shouldIgnore())
    }
    static postTextContentMessage(e = 3e3) {
      window.setTimeout(() => {
        this.shouldIgnore() || H(this.getTextContent())
      }, e)
    }
    static hasLogin() {
      return !0
    }
    static shouldIgnore() {
      return !1
    }
    static getTextContent() {
      return F()
    }
  }
  const At = /zhihu.com\/question\//
  class St extends Lt {
    static initialize() {
      super.initialize()
    }
    static getTextContent() {
      var e, t
      let n = ''
      const r = [...document.querySelectorAll('.css-376mun')].map((e) => {
          var t, n
          return `å›žç­”ï¼š${
            null != (n = null == (t = e.textContent) ? void 0 : t.replace(f, '')) ? n : ''
          }`
        }),
        i = 'zhuanlan.zhihu.com' === location.hostname,
        o = At.test(location.href)
      if (i || o) {
        n = [
          `é—®é¢˜ï¼š${
            null !=
            (t =
              null == (e = document.querySelector(i ? '.Post-Title' : '.QuestionHeader-title'))
                ? void 0
                : e.textContent)
              ? t
              : ''
          }`,
          r.join('\n'),
        ].join('\n')
      } else {
        n = [...document.querySelectorAll('.ContentItem-title')]
          .map((e, t) => `é—®é¢˜ï¼š${e.textContent}\n${r[t]}`)
          .join('\n')
      }
      return __spreadProps(__spreadValues({}, G()), { textContent: n })
    }
  }
  const bt = /^\/search\/([^/?]+)/i,
    Nt = /\/api\/common\/conversation\/.+/i
  class Pt extends Lt {
    static initialize() {
      O(k, !0),
        a(() => {
          this.OnRedirectNative()
        }),
        ne({
          onRequest: (e, t) => {
            const { url: n, body: r } = e
            if (Nt.test(n)) {
              const e = new URLSearchParams(r).get('title')
              this.handleRedirectMessage({ query: e }, !1)
            } else t.next(e)
          },
        }),
        this.OnRedirectNative()
    }
    static postTextTypeMessage() {}
    static postTextContentMessage() {}
    static OnRedirectNative() {
      const t = {},
        { pathname: n, search: r } = location
      if ('/' === n) {
        const n = new URLSearchParams(r).get('q')
        if (e(n)) return
        t.query = n
      } else if (bt.test(n)) {
        const e = n.match(bt)
        t.id = e[1]
      }
      this.handleRedirectMessage(t)
    }
    static handleRedirectMessage(e, t = !0) {
      h(e, !0) &&
        (t && history.back(),
        setTimeout(() => {
          var t
          ;(t = e),
            window.A3AIMessage.send('RedirectNative', {
              data: __spreadProps(__spreadValues({}, t), { url: location.href, t: Date.now() }),
            })
        }, 300))
    }
  }
  const Ct = { versions: { '>=3.5.0': { patterns: [...j.SOU.patterns] } } }
  function Mt(e) {
    return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, 'default') ? e.default : e
  }
  var xt = class {
    constructor() {
      ;(this.max = 1e3), (this.map = new Map())
    }
    get(e) {
      const t = this.map.get(e)
      return void 0 === t ? void 0 : (this.map.delete(e), this.map.set(e, t), t)
    }
    delete(e) {
      return this.map.delete(e)
    }
    set(e, t) {
      if (!this.delete(e) && void 0 !== t) {
        if (this.map.size >= this.max) {
          const e = this.map.keys().next().value
          this.delete(e)
        }
        this.map.set(e, t)
      }
      return this
    }
  }
  const Vt = Object.freeze({ loose: !0 }),
    Dt = Object.freeze({})
  var Ut = (e) => (e ? ('object' != typeof e ? Vt : e) : Dt),
    kt = { exports: {} }
  var jt = {
      MAX_LENGTH: 256,
      MAX_SAFE_COMPONENT_LENGTH: 16,
      MAX_SAFE_BUILD_LENGTH: 250,
      MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER || 9007199254740991,
      RELEASE_TYPES: ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'],
      SEMVER_SPEC_VERSION: '2.0.0',
      FLAG_INCLUDE_PRERELEASE: 1,
      FLAG_LOOSE: 2,
    },
    Gt = {}
  var Ft =
    'object' == typeof process && Gt && Gt.NODE_DEBUG && /\bsemver\b/i.test(Gt.NODE_DEBUG)
      ? (...e) => console.error('SEMVER', ...e)
      : () => {}
  !(function (e, t) {
    const { MAX_SAFE_COMPONENT_LENGTH: n, MAX_SAFE_BUILD_LENGTH: r, MAX_LENGTH: i } = jt,
      o = Ft,
      s = ((t = e.exports = {}).re = []),
      a = (t.safeRe = []),
      c = (t.src = []),
      l = (t.t = {})
    let u = 0
    const d = '[a-zA-Z0-9-]',
      h = [
        ['\\s', 1],
        ['\\d', i],
        [d, r],
      ],
      p = (e, t, n) => {
        const r = ((e) => {
            for (const [t, n] of h)
              e = e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`)
            return e
          })(t),
          i = u++
        o(e, i, t),
          (l[e] = i),
          (c[i] = t),
          (s[i] = new RegExp(t, n ? 'g' : void 0)),
          (a[i] = new RegExp(r, n ? 'g' : void 0))
      }
    p('NUMERICIDENTIFIER', '0|[1-9]\\d*'),
      p('NUMERICIDENTIFIERLOOSE', '\\d+'),
      p('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${d}*`),
      p(
        'MAINVERSION',
        `(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`
      ),
      p(
        'MAINVERSIONLOOSE',
        `(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${
          c[l.NUMERICIDENTIFIERLOOSE]
        })`
      ),
      p('PRERELEASEIDENTIFIER', `(?:${c[l.NUMERICIDENTIFIER]}|${c[l.NONNUMERICIDENTIFIER]})`),
      p(
        'PRERELEASEIDENTIFIERLOOSE',
        `(?:${c[l.NUMERICIDENTIFIERLOOSE]}|${c[l.NONNUMERICIDENTIFIER]})`
      ),
      p('PRERELEASE', `(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),
      p(
        'PRERELEASELOOSE',
        `(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`
      ),
      p('BUILDIDENTIFIER', `${d}+`),
      p('BUILD', `(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),
      p('FULLPLAIN', `v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),
      p('FULL', `^${c[l.FULLPLAIN]}$`),
      p('LOOSEPLAIN', `[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),
      p('LOOSE', `^${c[l.LOOSEPLAIN]}$`),
      p('GTLT', '((?:<|>)?=?)'),
      p('XRANGEIDENTIFIERLOOSE', `${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),
      p('XRANGEIDENTIFIER', `${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),
      p(
        'XRANGEPLAIN',
        `[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${
          c[l.XRANGEIDENTIFIER]
        })(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`
      ),
      p(
        'XRANGEPLAINLOOSE',
        `[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${
          c[l.XRANGEIDENTIFIERLOOSE]
        })(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`
      ),
      p('XRANGE', `^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),
      p('XRANGELOOSE', `^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),
      p('COERCEPLAIN', `(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),
      p('COERCE', `${c[l.COERCEPLAIN]}(?:$|[^\\d])`),
      p('COERCEFULL', c[l.COERCEPLAIN] + `(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),
      p('COERCERTL', c[l.COERCE], !0),
      p('COERCERTLFULL', c[l.COERCEFULL], !0),
      p('LONETILDE', '(?:~>?)'),
      p('TILDETRIM', `(\\s*)${c[l.LONETILDE]}\\s+`, !0),
      (t.tildeTrimReplace = '$1~'),
      p('TILDE', `^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),
      p('TILDELOOSE', `^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),
      p('LONECARET', '(?:\\^)'),
      p('CARETTRIM', `(\\s*)${c[l.LONECARET]}\\s+`, !0),
      (t.caretTrimReplace = '$1^'),
      p('CARET', `^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),
      p('CARETLOOSE', `^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),
      p('COMPARATORLOOSE', `^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),
      p('COMPARATOR', `^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),
      p('COMPARATORTRIM', `(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`, !0),
      (t.comparatorTrimReplace = '$1$2$3'),
      p('HYPHENRANGE', `^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),
      p(
        'HYPHENRANGELOOSE',
        `^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`
      ),
      p('STAR', '(<|>)?=?\\s*\\*'),
      p('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$'),
      p('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
  })(kt, kt.exports)
  var Ht = kt.exports
  const Xt = /^[0-9]+$/,
    qt = (e, t) => {
      const n = Xt.test(e),
        r = Xt.test(t)
      return (
        n && r && ((e = +e), (t = +t)), e === t ? 0 : n && !r ? -1 : r && !n ? 1 : e < t ? -1 : 1
      )
    }
  var zt = { compareIdentifiers: qt, rcompareIdentifiers: (e, t) => qt(t, e) }
  const Bt = Ft,
    { MAX_LENGTH: Wt, MAX_SAFE_INTEGER: Jt } = jt,
    { safeRe: Yt, t: Kt } = Ht,
    Zt = Ut,
    { compareIdentifiers: Qt } = zt
  var en = class e {
    constructor(t, n) {
      if (((n = Zt(n)), t instanceof e)) {
        if (t.loose === !!n.loose && t.includePrerelease === !!n.includePrerelease) return t
        t = t.version
      } else if ('string' != typeof t)
        throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`)
      if (t.length > Wt) throw new TypeError(`version is longer than ${Wt} characters`)
      Bt('SemVer', t, n),
        (this.options = n),
        (this.loose = !!n.loose),
        (this.includePrerelease = !!n.includePrerelease)
      const r = t.trim().match(n.loose ? Yt[Kt.LOOSE] : Yt[Kt.FULL])
      if (!r) throw new TypeError(`Invalid Version: ${t}`)
      if (
        ((this.raw = t),
        (this.major = +r[1]),
        (this.minor = +r[2]),
        (this.patch = +r[3]),
        this.major > Jt || this.major < 0)
      )
        throw new TypeError('Invalid major version')
      if (this.minor > Jt || this.minor < 0) throw new TypeError('Invalid minor version')
      if (this.patch > Jt || this.patch < 0) throw new TypeError('Invalid patch version')
      r[4]
        ? (this.prerelease = r[4].split('.').map((e) => {
            if (/^[0-9]+$/.test(e)) {
              const t = +e
              if (t >= 0 && t < Jt) return t
            }
            return e
          }))
        : (this.prerelease = []),
        (this.build = r[5] ? r[5].split('.') : []),
        this.format()
    }
    format() {
      return (
        (this.version = `${this.major}.${this.minor}.${this.patch}`),
        this.prerelease.length && (this.version += `-${this.prerelease.join('.')}`),
        this.version
      )
    }
    toString() {
      return this.version
    }
    compare(t) {
      if ((Bt('SemVer.compare', this.version, this.options, t), !(t instanceof e))) {
        if ('string' == typeof t && t === this.version) return 0
        t = new e(t, this.options)
      }
      return t.version === this.version ? 0 : this.compareMain(t) || this.comparePre(t)
    }
    compareMain(t) {
      return (
        t instanceof e || (t = new e(t, this.options)),
        Qt(this.major, t.major) || Qt(this.minor, t.minor) || Qt(this.patch, t.patch)
      )
    }
    comparePre(t) {
      if (
        (t instanceof e || (t = new e(t, this.options)),
        this.prerelease.length && !t.prerelease.length)
      )
        return -1
      if (!this.prerelease.length && t.prerelease.length) return 1
      if (!this.prerelease.length && !t.prerelease.length) return 0
      let n = 0
      do {
        const e = this.prerelease[n],
          r = t.prerelease[n]
        if ((Bt('prerelease compare', n, e, r), void 0 === e && void 0 === r)) return 0
        if (void 0 === r) return 1
        if (void 0 === e) return -1
        if (e !== r) return Qt(e, r)
      } while (++n)
    }
    compareBuild(t) {
      t instanceof e || (t = new e(t, this.options))
      let n = 0
      do {
        const e = this.build[n],
          r = t.build[n]
        if ((Bt('build compare', n, e, r), void 0 === e && void 0 === r)) return 0
        if (void 0 === r) return 1
        if (void 0 === e) return -1
        if (e !== r) return Qt(e, r)
      } while (++n)
    }
    inc(e, t, n) {
      switch (e) {
        case 'premajor':
          ;(this.prerelease.length = 0),
            (this.patch = 0),
            (this.minor = 0),
            this.major++,
            this.inc('pre', t, n)
          break
        case 'preminor':
          ;(this.prerelease.length = 0), (this.patch = 0), this.minor++, this.inc('pre', t, n)
          break
        case 'prepatch':
          ;(this.prerelease.length = 0), this.inc('patch', t, n), this.inc('pre', t, n)
          break
        case 'prerelease':
          0 === this.prerelease.length && this.inc('patch', t, n), this.inc('pre', t, n)
          break
        case 'major':
          ;(0 === this.minor && 0 === this.patch && 0 !== this.prerelease.length) || this.major++,
            (this.minor = 0),
            (this.patch = 0),
            (this.prerelease = [])
          break
        case 'minor':
          ;(0 === this.patch && 0 !== this.prerelease.length) || this.minor++,
            (this.patch = 0),
            (this.prerelease = [])
          break
        case 'patch':
          0 === this.prerelease.length && this.patch++, (this.prerelease = [])
          break
        case 'pre': {
          const e = Number(n) ? 1 : 0
          if (!t && !1 === n) throw new Error('invalid increment argument: identifier is empty')
          if (0 === this.prerelease.length) this.prerelease = [e]
          else {
            let r = this.prerelease.length
            for (; --r >= 0; )
              'number' == typeof this.prerelease[r] && (this.prerelease[r]++, (r = -2))
            if (-1 === r) {
              if (t === this.prerelease.join('.') && !1 === n)
                throw new Error('invalid increment argument: identifier already exists')
              this.prerelease.push(e)
            }
          }
          if (t) {
            let r = [t, e]
            !1 === n && (r = [t]),
              0 === Qt(this.prerelease[0], t)
                ? isNaN(this.prerelease[1]) && (this.prerelease = r)
                : (this.prerelease = r)
          }
          break
        }
        default:
          throw new Error(`invalid increment argument: ${e}`)
      }
      return (
        (this.raw = this.format()),
        this.build.length && (this.raw += `+${this.build.join('.')}`),
        this
      )
    }
  }
  const tn = en
  var nn = (e, t, n) => new tn(e, n).compare(new tn(t, n))
  const rn = nn
  const on = nn
  const sn = nn
  const an = nn
  const cn = nn
  const ln = nn
  const un = (e, t, n) => 0 === rn(e, t, n),
    dn = (e, t, n) => 0 !== on(e, t, n),
    hn = (e, t, n) => sn(e, t, n) > 0,
    pn = (e, t, n) => an(e, t, n) >= 0,
    fn = (e, t, n) => cn(e, t, n) < 0,
    mn = (e, t, n) => ln(e, t, n) <= 0
  var En,
    yn,
    vn,
    gn,
    _n = (e, t, n, r) => {
      switch (t) {
        case '===':
          return (
            'object' == typeof e && (e = e.version),
            'object' == typeof n && (n = n.version),
            e === n
          )
        case '!==':
          return (
            'object' == typeof e && (e = e.version),
            'object' == typeof n && (n = n.version),
            e !== n
          )
        case '':
        case '=':
        case '==':
          return un(e, n, r)
        case '!=':
          return dn(e, n, r)
        case '>':
          return hn(e, n, r)
        case '>=':
          return pn(e, n, r)
        case '<':
          return fn(e, n, r)
        case '<=':
          return mn(e, n, r)
        default:
          throw new TypeError(`Invalid operator: ${t}`)
      }
    }
  function wn() {
    if (gn) return vn
    gn = 1
    class e {
      constructor(t, i) {
        if (((i = n(i)), t instanceof e))
          return t.loose === !!i.loose && t.includePrerelease === !!i.includePrerelease
            ? t
            : new e(t.raw, i)
        if (t instanceof r) return (this.raw = t.value), (this.set = [[t]]), this.format(), this
        if (
          ((this.options = i),
          (this.loose = !!i.loose),
          (this.includePrerelease = !!i.includePrerelease),
          (this.raw = t.trim().split(/\s+/).join(' ')),
          (this.set = this.raw
            .split('||')
            .map((e) => this.parseRange(e.trim()))
            .filter((e) => e.length)),
          !this.set.length)
        )
          throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
        if (this.set.length > 1) {
          const e = this.set[0]
          if (((this.set = this.set.filter((e) => !p(e[0]))), 0 === this.set.length)) this.set = [e]
          else if (this.set.length > 1)
            for (const t of this.set)
              if (1 === t.length && f(t[0])) {
                this.set = [t]
                break
              }
        }
        this.format()
      }
      format() {
        return (
          (this.range = this.set
            .map((e) => e.join(' ').trim())
            .join('||')
            .trim()),
          this.range
        )
      }
      toString() {
        return this.range
      }
      parseRange(e) {
        const n = ((this.options.includePrerelease && d) | (this.options.loose && h)) + ':' + e,
          o = t.get(n)
        if (o) return o
        const f = this.options.loose,
          m = f ? s[a.HYPHENRANGELOOSE] : s[a.HYPHENRANGE]
        ;(e = e.replace(m, O(this.options.includePrerelease))),
          i('hyphen replace', e),
          (e = e.replace(s[a.COMPARATORTRIM], c)),
          i('comparator trim', e),
          (e = e.replace(s[a.TILDETRIM], l)),
          i('tilde trim', e),
          (e = e.replace(s[a.CARETTRIM], u)),
          i('caret trim', e)
        let y = e
          .split(' ')
          .map((e) => E(e, this.options))
          .join(' ')
          .split(/\s+/)
          .map((e) => $(e, this.options))
        f &&
          (y = y.filter(
            (e) => (i('loose invalid filter', e, this.options), !!e.match(s[a.COMPARATORLOOSE]))
          )),
          i('range list', y)
        const v = new Map(),
          g = y.map((e) => new r(e, this.options))
        for (const t of g) {
          if (p(t)) return [t]
          v.set(t.value, t)
        }
        v.size > 1 && v.has('') && v.delete('')
        const _ = [...v.values()]
        return t.set(n, _), _
      }
      intersects(t, n) {
        if (!(t instanceof e)) throw new TypeError('a Range is required')
        return this.set.some(
          (e) =>
            m(e, n) &&
            t.set.some((t) => m(t, n) && e.every((e) => t.every((t) => e.intersects(t, n))))
        )
      }
      test(e) {
        if (!e) return !1
        if ('string' == typeof e)
          try {
            e = new o(e, this.options)
          } catch (t) {
            return !1
          }
        for (let n = 0; n < this.set.length; n++) if (L(this.set[n], e, this.options)) return !0
        return !1
      }
    }
    vn = e
    const t = new xt(),
      n = Ut,
      r = (function () {
        if (yn) return En
        yn = 1
        const e = Symbol('SemVer ANY')
        class t {
          static get ANY() {
            return e
          }
          constructor(r, i) {
            if (((i = n(i)), r instanceof t)) {
              if (r.loose === !!i.loose) return r
              r = r.value
            }
            ;(r = r.trim().split(/\s+/).join(' ')),
              s('comparator', r, i),
              (this.options = i),
              (this.loose = !!i.loose),
              this.parse(r),
              this.semver === e
                ? (this.value = '')
                : (this.value = this.operator + this.semver.version),
              s('comp', this)
          }
          parse(t) {
            const n = this.options.loose ? r[i.COMPARATORLOOSE] : r[i.COMPARATOR],
              o = t.match(n)
            if (!o) throw new TypeError(`Invalid comparator: ${t}`)
            ;(this.operator = void 0 !== o[1] ? o[1] : ''),
              '=' === this.operator && (this.operator = ''),
              o[2] ? (this.semver = new a(o[2], this.options.loose)) : (this.semver = e)
          }
          toString() {
            return this.value
          }
          test(t) {
            if ((s('Comparator.test', t, this.options.loose), this.semver === e || t === e))
              return !0
            if ('string' == typeof t)
              try {
                t = new a(t, this.options)
              } catch (n) {
                return !1
              }
            return o(t, this.operator, this.semver, this.options)
          }
          intersects(e, r) {
            if (!(e instanceof t)) throw new TypeError('a Comparator is required')
            return '' === this.operator
              ? '' === this.value || new c(e.value, r).test(this.value)
              : '' === e.operator
              ? '' === e.value || new c(this.value, r).test(e.semver)
              : !(
                  ((r = n(r)).includePrerelease &&
                    ('<0.0.0-0' === this.value || '<0.0.0-0' === e.value)) ||
                  (!r.includePrerelease &&
                    (this.value.startsWith('<0.0.0') || e.value.startsWith('<0.0.0'))) ||
                  ((!this.operator.startsWith('>') || !e.operator.startsWith('>')) &&
                    (!this.operator.startsWith('<') || !e.operator.startsWith('<')) &&
                    (this.semver.version !== e.semver.version ||
                      !this.operator.includes('=') ||
                      !e.operator.includes('=')) &&
                    !(
                      o(this.semver, '<', e.semver, r) &&
                      this.operator.startsWith('>') &&
                      e.operator.startsWith('<')
                    ) &&
                    !(
                      o(this.semver, '>', e.semver, r) &&
                      this.operator.startsWith('<') &&
                      e.operator.startsWith('>')
                    ))
                )
          }
        }
        En = t
        const n = Ut,
          { safeRe: r, t: i } = Ht,
          o = _n,
          s = Ft,
          a = en,
          c = wn()
        return En
      })(),
      i = Ft,
      o = en,
      { safeRe: s, t: a, comparatorTrimReplace: c, tildeTrimReplace: l, caretTrimReplace: u } = Ht,
      { FLAG_INCLUDE_PRERELEASE: d, FLAG_LOOSE: h } = jt,
      p = (e) => '<0.0.0-0' === e.value,
      f = (e) => '' === e.value,
      m = (e, t) => {
        let n = !0
        const r = e.slice()
        let i = r.pop()
        for (; n && r.length; ) (n = r.every((e) => i.intersects(e, t))), (i = r.pop())
        return n
      },
      E = (e, t) => (
        i('comp', e, t),
        (e = _(e, t)),
        i('caret', e),
        (e = v(e, t)),
        i('tildes', e),
        (e = I(e, t)),
        i('xrange', e),
        (e = R(e, t)),
        i('stars', e),
        e
      ),
      y = (e) => !e || 'x' === e.toLowerCase() || '*' === e,
      v = (e, t) =>
        e
          .trim()
          .split(/\s+/)
          .map((e) => g(e, t))
          .join(' '),
      g = (e, t) => {
        const n = t.loose ? s[a.TILDELOOSE] : s[a.TILDE]
        return e.replace(n, (t, n, r, o, s) => {
          let a
          return (
            i('tilde', e, t, n, r, o, s),
            y(n)
              ? (a = '')
              : y(r)
              ? (a = `>=${n}.0.0 <${+n + 1}.0.0-0`)
              : y(o)
              ? (a = `>=${n}.${r}.0 <${n}.${+r + 1}.0-0`)
              : s
              ? (i('replaceTilde pr', s), (a = `>=${n}.${r}.${o}-${s} <${n}.${+r + 1}.0-0`))
              : (a = `>=${n}.${r}.${o} <${n}.${+r + 1}.0-0`),
            i('tilde return', a),
            a
          )
        })
      },
      _ = (e, t) =>
        e
          .trim()
          .split(/\s+/)
          .map((e) => w(e, t))
          .join(' '),
      w = (e, t) => {
        i('caret', e, t)
        const n = t.loose ? s[a.CARETLOOSE] : s[a.CARET],
          r = t.includePrerelease ? '-0' : ''
        return e.replace(n, (t, n, o, s, a) => {
          let c
          return (
            i('caret', e, t, n, o, s, a),
            y(n)
              ? (c = '')
              : y(o)
              ? (c = `>=${n}.0.0${r} <${+n + 1}.0.0-0`)
              : y(s)
              ? (c =
                  '0' === n
                    ? `>=${n}.${o}.0${r} <${n}.${+o + 1}.0-0`
                    : `>=${n}.${o}.0${r} <${+n + 1}.0.0-0`)
              : a
              ? (i('replaceCaret pr', a),
                (c =
                  '0' === n
                    ? '0' === o
                      ? `>=${n}.${o}.${s}-${a} <${n}.${o}.${+s + 1}-0`
                      : `>=${n}.${o}.${s}-${a} <${n}.${+o + 1}.0-0`
                    : `>=${n}.${o}.${s}-${a} <${+n + 1}.0.0-0`))
              : (i('no pr'),
                (c =
                  '0' === n
                    ? '0' === o
                      ? `>=${n}.${o}.${s}${r} <${n}.${o}.${+s + 1}-0`
                      : `>=${n}.${o}.${s}${r} <${n}.${+o + 1}.0-0`
                    : `>=${n}.${o}.${s} <${+n + 1}.0.0-0`)),
            i('caret return', c),
            c
          )
        })
      },
      I = (e, t) => (
        i('replaceXRanges', e, t),
        e
          .split(/\s+/)
          .map((e) => T(e, t))
          .join(' ')
      ),
      T = (e, t) => {
        e = e.trim()
        const n = t.loose ? s[a.XRANGELOOSE] : s[a.XRANGE]
        return e.replace(n, (n, r, o, s, a, c) => {
          i('xRange', e, n, r, o, s, a, c)
          const l = y(o),
            u = l || y(s),
            d = u || y(a),
            h = d
          return (
            '=' === r && h && (r = ''),
            (c = t.includePrerelease ? '-0' : ''),
            l
              ? (n = '>' === r || '<' === r ? '<0.0.0-0' : '*')
              : r && h
              ? (u && (s = 0),
                (a = 0),
                '>' === r
                  ? ((r = '>='), u ? ((o = +o + 1), (s = 0), (a = 0)) : ((s = +s + 1), (a = 0)))
                  : '<=' === r && ((r = '<'), u ? (o = +o + 1) : (s = +s + 1)),
                '<' === r && (c = '-0'),
                (n = `${r + o}.${s}.${a}${c}`))
              : u
              ? (n = `>=${o}.0.0${c} <${+o + 1}.0.0-0`)
              : d && (n = `>=${o}.${s}.0${c} <${o}.${+s + 1}.0-0`),
            i('xRange return', n),
            n
          )
        })
      },
      R = (e, t) => (i('replaceStars', e, t), e.trim().replace(s[a.STAR], '')),
      $ = (e, t) => (
        i('replaceGTE0', e, t), e.trim().replace(s[t.includePrerelease ? a.GTE0PRE : a.GTE0], '')
      ),
      O = (e) => (t, n, r, i, o, s, a, c, l, u, d, h) =>
        `${(n = y(r)
          ? ''
          : y(i)
          ? `>=${r}.0.0${e ? '-0' : ''}`
          : y(o)
          ? `>=${r}.${i}.0${e ? '-0' : ''}`
          : s
          ? `>=${n}`
          : `>=${n}${e ? '-0' : ''}`)} ${(c = y(l)
          ? ''
          : y(u)
          ? `<${+l + 1}.0.0-0`
          : y(d)
          ? `<${l}.${+u + 1}.0-0`
          : h
          ? `<=${l}.${u}.${d}-${h}`
          : e
          ? `<${l}.${u}.${+d + 1}-0`
          : `<=${c}`)}`.trim(),
      L = (e, t, n) => {
        for (let r = 0; r < e.length; r++) if (!e[r].test(t)) return !1
        if (t.prerelease.length && !n.includePrerelease) {
          for (let n = 0; n < e.length; n++)
            if ((i(e[n].semver), e[n].semver !== r.ANY && e[n].semver.prerelease.length > 0)) {
              const r = e[n].semver
              if (r.major === t.major && r.minor === t.minor && r.patch === t.patch) return !0
            }
          return !1
        }
        return !0
      }
    return vn
  }
  const In = wn()
  const Tn = Mt((e, t, n) => {
    try {
      t = new In(t, n)
    } catch (r) {
      return !1
    }
    return t.test(e)
  })
  class Rn extends Lt {
    static initialize() {
      this.postTextTypeMessage(),
        document.addEventListener('DOMContentLoaded', () => {
          this.postTextContentMessage(0)
        })
    }
  }
  const { ZHIHU: $n, SOU: On, TechnologyReview: Ln } = j
  function An(e) {
    return e.some((e) => e.test(location.hostname))
  }
  function Sn() {
    const e = (function () {
        if (l()) {
          const e = window.navigator.userAgent.match(c)
          if (null !== e) return e[1]
        }
        return '3.5.0'
      })(),
      t = Object.keys(Ct.versions).filter((t) => !Tn(e, t))
    if (0 == t.length) return !0
    for (const n of t) {
      const { patterns: e } = Ct.versions[n]
      if (An(e)) return !1
    }
    return !0
  }
  const bn = Sn() ? (An($n.patterns) ? St : An(On.patterns) ? Pt : An(Ln.patterns) ? Rn : Lt) : Lt
  class Nn {
    static SetUp() {
      bn.initialize(),
        this.registerEvents(),
        a(() => {
          bn.postTextTypeMessage(), bn.postTextContentMessage()
        })
    }
    static registerEvents() {
      this.onHasLogin(), this.onGetTextContent(), this.onPause()
    }
    static onHasLogin() {
      window.A3AIMessage.on('HasLogin', () => {
        window.A3AIMessage.send('HasLogin', { data: bn.hasLogin() })
      })
    }
    static onGetTextContent() {
      window.A3AIMessage.on('GetTextContent', () => {
        window.A3AIMessage.send('GetTextContent', { data: bn.getTextContent() })
      })
    }
    static onPause() {
      window.A3AIMessage.on('Pause', () => {
        X()
      })
    }
  }
  !(function () {
    if (window.__AI_SUMMARY_SCRIPT_INIT__) return
    if (((window.__AI_SUMMARY_SCRIPT_INIT__ = !0), R.onErrorBoundary(), !window.A3AIMessage)) {
      const e = u()
      ;(window.A3AIMessage = e), (window.A3OnAIMessage = e.onMessage)
    }
    window.A3AIMessage.send('JSBridgeReady')
    const { hostname: e } = location
    Object.values(b).some((t) => t.test(e)) ? Ot.SetUp() : Nn.SetUp()
  })()
})()
