mono/reference/tiktok/files/4004.ab578596.js
2026-01-29 18:35:51 +01:00

1 line
34 KiB
JavaScript

"use strict"; (self.__LOADABLE_LOADED_CHUNKS__ = self.__LOADABLE_LOADED_CHUNKS__ || []).push([["4004"], { 93036: function (e, t, n) { n.d(t, { t: function () { return a } }); var r, a = ((r = {}).H265 = "web_h265", r.H264 = "web_h264", r) }, 83814: function (e, t, n) { n.d(t, { $l: function () { return u }, AF: function () { return c }, GH: function () { return f }, gc: function () { return s } }); var r, a = n(32049), o = n(95794), i = 'video/mp4;codecs="hev1.1.6.L93.B0"'; function u(e) { return [3, 4, 31].includes(e) } function c() { return !(0, a.fU)() && "undefined" != typeof MediaSource && (!!MediaSource.isTypeSupported(i) && "probably" === document.createElement("video").canPlayType(i) || !1) } var d = "hevc_support_key_v4", l = "hevc_support_key_time"; function s() { if ((0, a.fU)()) return !1; if (void 0 !== r) return r; var e = (0, o._S)(d, ""), t = Number((0, o._S)(l, "0")); return Date.now() - t > 12096e5 || "" === e ? (r = c(), (0, o.AP)(d, r ? "1" : "0"), (0, o.AP)(l, String(Date.now())), r && navigator.mediaCapabilities.decodingInfo({ type: "file", video: { contentType: i, width: 1920, height: 1080, bitrate: 1e4, framerate: 30 } }).then(function (e) { var t = e.supported; r = t, (0, o.AP)(d, t ? "1" : "0") }).catch(function (e) { return console.error(e) }), r) : "1" === e } function f() { (0, o.AP)(d, "0"), (0, o.AP)(l, String(Date.now())), r = !1 } }, 83153: function (e, t, n) { n.d(t, { A: function () { return u } }); var r = n(40099), a = n(32049), o = n(93036), i = n(83814); function u() { var e = (0, r.useMemo)(function () { return (0, i.gc)() }, []), t = (0, r.useMemo)(function () { return (0, a.fU)() ? o.t.H264 : e ? o.t.H265 : o.t.H264 }, [e]); return { openH265: t === o.t.H265, streamDeviceType: t, hevcSupport: e } } }, 76232: function (e, t, n) { n.d(t, { AF: function () { return h }, AP: function () { return _ }, CA: function () { return f }, Sf: function () { return m }, a8: function () { return v }, hA: function () { return s }, uJ: function () { return p } }); var r = n(10874), a = n(23680), o = n(72961), i = n(43264), u = n(54520), c = n(88947), d = n(10829), l = "abTestVersion", s = function () { var e, t = (0, o.L$)((0, i.W)(function () { return [l] }, [])).abTestVersion, n = null != (e = (0, u.qt)(t, "search_bar_style_opt")) ? e : "v1", r = "v2" === n, a = "v3" === n; return { isSearchBarStyleV1: "v1" === n, isSearchBarStyleV2: r, isSearchBarStyleV3: a, withNewStyle: r || a } }, f = function () { var e, t = (0, r.useLocation)().pathname, n = (0, o.L$)((0, i.W)(function () { return [l] }, [])).abTestVersion, a = null != (e = (0, u.qt)(n, "search_remove_related_search")) ? e : "v0"; return { hasRelatedSearch: "v0" === a || (0, c.ie)(t), hasSugReport: !0, isNewSearchLayout: "v0" !== a } }, h = function () { var e, t = (0, o.L$)((0, i.W)(function () { return [l] }, [])).abTestVersion; return "v2" === (null != (e = (0, u.qt)(t, "search_keep_sug_show")) ? e : "v1") }; function p() { var e, t = (0, o.L$)((0, i.W)(function () { return [l] }, [])).abTestVersion, n = null != (e = (0, u.qt)(t, "search_add_non_personalized_switch")) ? e : "v1", r = (0, a.P)(d.L, { selector: function (e) { var t; return { user: null == (t = e.appContext) ? void 0 : t.user } }, dependencies: [] }).user; return { hasPersonalizedSwitch: "v2" === n && !!r } } function v() { var e, t = (0, o.L$)((0, i.W)(function () { return [l] }, [])).abTestVersion; return { shouldRecomReduceIconRisk: "v1" === (null != (e = (0, u.qt)(t, "should_recom_reduce_icon_risk")) ? e : "v0") } } function _() { var e, t = (0, o.L$)((0, i.W)(function () { return [l] }, [])).abTestVersion; return { notificationShouldBeClickable: "v1" === (null != (e = (0, u.qt)(t, "webapp_moderation")) ? e : "v0") } } function m() { var e, t = (0, o.L$)((0, i.W)(function () { return [l] }, [])).abTestVersion; return { showLiveHead: "v1" === (null != (e = (0, u.qt)(t, "show_search_live_head")) ? e : "v0") } } }, 12064: function (e, t, n) { n.d(t, { ip: function () { return R }, _k: function () { return C }, Ob: function () { return L }, aL: function () { return P }, Ee: function () { return w }, g1: function () { return E } }); var r = n(40099), a = n(94553), o = n(95794), i = n(43264), u = n(17505), c = n(5377), d = n(45996), l = n(71111), s = n(4676), f = { pageName: null, itemID: "", sentBatchCount: 0 }, h = (0, l.atom)(f); h.debugLabel = "fypFeederAtom"; var p = (0, s.i)(h, function (e, t) { return { setCache: function (n) { e(h).itemID || t(h, function (e) { return (0, c._)({}, e, n) }) }, clearCache: function () { "ALWAYS_ALLOWED" !== e(h).pageName && t(h, function (e) { return (0, d._)((0, c._)({}, f), { sentBatchCount: e.sentBatchCount }) }) }, incrementSentBatchCount: function () { t(h, function (e) { return (0, d._)((0, c._)({}, e), { sentBatchCount: e.sentBatchCount + 1 }) }) } } }), v = (p.useAtomService, p.useServiceDispatchers), _ = p.useServiceState; p.getStaticApi; var m = "webapp_fyp_feeder_landing", S = !0, g = function () { (0, o.Hd)(m) && (S = !1), (0, o.J2)(m, "1") }, y = function (e) { var t, n = (0, u.CQv)().sendCreatorItemId, r = (null != (t = (0, i.W)(function () { return ["user"] }, [])) ? t : {}).user; return n && e === a.L.User && S && !r }, b = function (e) { return (0, u.FTg)().isFYP && (e === a.L.Video || e === a.L.PhotoVideo) && S }, P = function () { return S }, w = function (e) { var t = v(), n = y(e), a = b(e); (0, r.useEffect)(function () { return function () { n || a || t.clearCache() } }, [t, n, a]), (0, r.useEffect)(function () { g() }, [e]) }, L = function (e, t) { var n = v(), a = y(e), o = b(e); (0, r.useEffect)(function () { t && (a || o) && n.setCache({ pageName: e, itemID: t }) }, [t, e, a, o, n]) }, E = function () { var e = v(); return (0, r.useCallback)(function (t) { e.setCache({ pageName: "ALWAYS_ALLOWED", itemID: t, sentBatchCount: 0 }) }, [e]) }, R = function () { var e = (0, u.FTg)().isFYP, t = (0, u.CQv)(), n = t.sendCreatorItemId, r = t.batchCount, o = _(), i = o.itemID, c = o.pageName, d = o.sentBatchCount, l = e && (c === a.L.Video || c === a.L.PhotoVideo || "ALWAYS_ALLOWED" === c), s = 0; l ? s = 1 : n && c === a.L.User && (s = r); var f = i && d < s ? i : ""; return { fypFeederItemId: f, setFirstItemId: l ? f : "" } }, C = function (e) { var t = v(); (0, r.useEffect)(function () { e && e > 0 && t.incrementSentBatchCount() }, [e, t]) } }, 16859: function (e, t, n) { n.d(t, { K1: function () { return O }, M$: function () { return D }, Oz: function () { return A }, Zr: function () { return T }, bE: function () { return I }, mV: function () { return F }, oS: function () { return k } }); var r, a, o = n(79066), i = n(5377), u = n(45996), c = n(6586), d = n(72516), l = n(40099), s = n(11854), f = n(24683), h = n(23680), p = n(77226), v = n(90362), _ = n(39950), m = n(59952), S = n(31847), g = n(72702), y = n(42146), b = n(72961), P = n(43264), w = n(54520), L = n(66772), E = n(42646), R = n(56904), C = n(17505), V = {}; V.m = {}, V.F = {}, V.E = function (e) { Object.keys(V.F).map(function (t) { V.F[t](e) }) }, V.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, r = [], V.O = function (e, t, n, a) { if (t) { a = a || 0; for (var o = r.length; o > 0 && r[o - 1][2] > a; o--)r[o] = r[o - 1]; r[o] = [t, n, a]; return } for (var i = 1 / 0, o = 0; o < r.length; o++) { for (var u = (0, c._)(r[o], 3), t = u[0], n = u[1], a = u[2], d = !0, l = 0; l < t.length; l++)(!1 & a || i >= a) && Object.keys(V.O).every(function (e) { return V.O[e](t[l]) }) ? t.splice(l--, 1) : (d = !1, a < i && (i = a)); if (d) { r.splice(o--, 1); var s = n(); void 0 !== s && (e = s) } } return e }, a = { 7645: 0 }, V.F.j = function (e) { if ("undefined" != typeof document && (!V.o(a, e) || void 0 === a[e])) { a[e] = null; var t = document.createElement("link"); t.charset = "utf-8", V.nc && t.setAttribute("nonce", V.nc), t.rel = "prefetch", t.as = "script", t.href = V.p + V.u(e), document.head.appendChild(t) } }, V.O.j = function (e) { return 0 === a[e] }, V.O(0, ["7645"], function () { }, 5); var O = function () { var e, t = (0, y.B)().isElectronApp, n = (0, b.L$)((0, P.W)(function () { return ["abTestVersion"] }, [])).abTestVersion, r = null != (e = (0, w.qt)(n, "comments_predict_model_opt")) ? e : "v0", a = !t && "undefined" != typeof WebAssembly; return { enableOnDeviceML: "v0" !== r && !t, isMLWithModel: "v1" === r || "v2" === r && a, isMLWithStrategy: "v3" === r, isMLWithWebRuntimeModel: "v1" === r } }, F = function () { var e, t = (0, C.tcM)(), r = t.enablePlayerPreloadDowngradePredict, a = t.disablePreloadPredict, i = t.playerPreloadPredictStrategy, u = (0, m.nr)(), c = (0, h.P)(L.$, { selector: function (e) { var t, n, r, a; return { playerPreloadStrategy: null == (a = e.bizContext) || null == (r = a.config) || null == (n = r.onDeviceMLConfig) || null == (t = n.playerPreload) ? void 0 : t.playerPreloadStrategy } }, dependencies: [] }).playerPreloadStrategy, l = (0, b.L$)((0, P.W)(function () { return ["abTestVersion"] }, [])).abTestVersion, s = null != (e = (0, w.qt)(l, "tt_player_preload")) ? e : { maxQueueCount: 3, preloadTime: 10 }, f = function (e) { if (0 === e) return void u.updatePredictedPreloadConfig({ maxQueueCount: null == s ? void 0 : s.maxQueueCount, preloadTime: null == s ? void 0 : s.preloadTime }); var t, n, r, a = 2 === e ? "gt_12s" : "lt_12s", o = null == i || null == (n = i.label_index_mapping) || null == (t = n.findIndex) ? void 0 : t.call(n, function (e) { return e === a }), c = null == i || null == (r = i.plans) ? void 0 : r[o]; console.debug("[Video Preload] Predict preload config: ", c), u.updatePredictedPreloadConfig(c) }; return function (e) { return (0, o._)(function () { var t, i, u, l, s, h, p, _; return (0, d.__generator)(this, function (m) { switch (m.label) { case 0: if (a || !c) return [2]; return [4, Promise.all([n.e("35111"), n.e("44582"), n.e("8668")]).then(n.bind(n, 21672))]; case 1: if (i = (t = m.sent()).Sibyl, u = t.EScene, l = t.EBiz, s = c, h = u.VIDEO_PRELOAD, !(_ = (p = new i({ biz: l.TIKTOK_WEB_FYP })).createStrategyEngine({ abConfig: s, scene: h }))) return [2]; return _.setThresholdCallback(function () { return (0, o._)(function () { var t, n, a, o, i, c, l, m, S, g, y, b, P; return (0, d.__generator)(this, function (d) { switch (d.label) { case 0: if (r) return t = p.strategyInference({ abConfig: s, scene: h }), v.F.handleModelPredict({ hit: Number(2 === t), scene: u.VIDEO_PRELOAD, predict_value: -1, group_id: e, threshold: -1 }), [2, f(t)]; d.label = 1; case 1: return d.trys.push([1, 3, , 4]), i = void 0 === (o = (a = null != (n = null == s ? void 0 : s.preload_ml) ? n : {}).package) ? "" : o, l = void 0 === (c = a.engine_config) ? { inputs: [], outputs: [] } : c, [4, p.createEngine({ scene: u.VIDEO_PRELOAD, modelUrl: i, inputs: null != (m = null == l ? void 0 : l.inputs) ? m : [], outputs: null != (S = null == l ? void 0 : l.outputs) ? S : [] })]; case 2: return g = d.sent().inference({ features: {} }), y = _.hitThresholdValue(g), b = _.getInferenceStrategy().thresholdValue, console.debug("[Video Preload] Inference result: ", g, "hit: ", y), f(y ? 2 : 1), v.F.handleModelPredict({ hit: Number(y), scene: u.VIDEO_PRELOAD, predict_value: g, group_id: e, model_url: i, threshold: b }), [3, 4]; case 3: throw P = d.sent(), f(0), P; case 4: return [2] } }) })() }), _.reportInferenceResult(), [2] } }) })() } }, T = new Map, k = new Map, A = function (e, t) { var n = (0, c._)((0, S.kH)(function (t) { var n, r; return null != (r = null == (n = t[e]) ? void 0 : n.comments) ? r : [] }, s.bN), 2), r = n[0], a = n[1]; return { comments: r, preloadCommentList: function (e, n) { return (0, o._)(function () { var r, o, c, l, s; return (0, d.__generator)(this, function (d) { switch (d.label) { case 0: if (k.get(null == e ? void 0 : e.aweme_id)) return [2]; d.label = 1; case 1: return d.trys.push([1, 3, 4, 5]), a.setCommentItem({ item: { awemeId: null == e ? void 0 : e.aweme_id, loading: !0 }, itemId: null == e ? void 0 : e.aweme_id }), [4, E.h.get("/api/comment/list/", { query: (0, u._)((0, i._)({}, e), { count: 20, aid: 1988, app_language: "ja-JP", device_platform: "web_pc", current_region: "JP", fromWeb: 1, enter_from: "tiktok_web" }), baseUrlType: R.Z4.FixedWww })]; case 2: return o = (r = d.sent()).comments, c = r.cursor, l = r.has_more, s = r.total, k.set(e.aweme_id, { aweme_id: e.aweme_id, comments: null != o ? o : [], cursor: Number(c), has_more: !!l, total: Number(s), fetch_type: "preload_by_ml" }), _.ao.handleCommentPreload({ play_mode: t, group_id: e.aweme_id, preload_type: n }), [3, 5]; case 3: return d.sent(), [3, 5]; case 4: return a.setCommentItem({ item: { awemeId: null == e ? void 0 : e.aweme_id, loading: !1 }, itemId: null == e ? void 0 : e.aweme_id }), [7]; case 5: return [2] } }) })() } } }, D = function () { var e = (0, m.nr)(), t = null; (0, l.useEffect)(function () { return (0, o._)(function () { var e, r, a, o, i, u; return (0, d.__generator)(this, function (c) { switch (c.label) { case 0: if (!p.f.dataCollectionEnabled) return [2]; return [4, Promise.all([n.e("35111"), n.e("86287")]).then(n.bind(n, 7386))]; case 1: return r = (e = c.sent()).Observer, a = e.EBiz, o = (0, f.V)(), (t = new r({ biz: a.TIKTOK_WEB_FYP, teaConfig: { teaInstance: p.f.getInstance(), channel_domain: null == o ? void 0 : o.tea, channel_type: null != (i = null == o ? void 0 : o.teaChannelType) ? i : "tcpy", channel: null != (u = null == o ? void 0 : o.teaChannel) ? u : "va" } })).observe(), [2] } }) })(), function () { null == t || t.destroy(), e.updatePredictedPreloadConfig({}) } }, []) }, I = function (e, t) { var n, r; return t < 0 || t >= (null == e ? void 0 : e.length) ? [] : (null != (r = null == e || null == (n = e.slice) ? void 0 : n.call(e, t + 1, t + 5)) ? r : []).map(function (e) { return (0, g.ud)().getStaticItem(e) }).map(function (e) { var t, n = (0, b.L$)(e), r = n.video, a = n.statsV2, o = n.id, i = (0, b.L$)(a), u = i.diggCount, c = i.commentCount, d = i.shareCount, l = i.playCount, s = i.collectCount; return { group_id: o, duration: null != (t = null == r ? void 0 : r.duration) ? t : 0, like_cnt: Number(null != u ? u : 0), comment_cnt: Number(null != c ? c : 0), share_cnt: Number(null != d ? d : 0), play_cnt: Number(null != l ? l : 0), collect_cnt: Number(null != s ? s : 0) } }) }; V.O({}) }, 27053: function (e, t, n) { n.d(t, { Eo: function () { return f }, TU: function () { return h }, V7: function () { return v }, _U: function () { return _ } }); var r = n(6586), a = n(40099), o = n(19642), i = n(38306), u = n(95794), c = n(17505), d = n(78790), l = n(86026), s = "video-countdown-show", f = function () { (0, u.AP)(s, "1") }, h = function () { var e = (0, r._)((0, a.useState)(!document.hidden), 2), t = e[0], n = e[1], o = function () { n(!document.hidden) }; return (0, a.useEffect)(function () { return document.addEventListener("visibilitychange", o), function () { document.removeEventListener("visibilitychange", o) } }, []), t }, p = function (e) { var t = e.itemListKey, n = e.nextItem, r = (0, c.vYI)(), f = r.isInGridToFypExperiment, h = r.gridToFypVVCount, p = (0, o.eu)(), v = (0, d.mE)(function (e) { return e.isMiniPlayerShowing }), _ = (0, l.GE)(function (e) { return e }), m = _.disableEndCard, S = _.vvCount; return (0, a.useMemo)(function () { return !!(f && !m && h <= S && !p && !v && !((0, u._S)(s) && "1" === (0, u._S)(s)) && n && t && [i.Lz.Explore, i.Lz.SearchTop, i.Lz.SearchVideo].includes(t)) }, [m, h, p, f, v, t, n, S]) }, v = function (e) { var t = e.currentIndex, n = e.itemListKey, r = e.nextItem, o = (0, l.GE)(function (e) { return e }).showEndCard, i = p({ itemListKey: n, nextItem: r }), u = (0, l.$c)(); (0, a.useEffect)(function () { u.increaseVVCount() }, [t, u]), (0, a.useEffect)(function () { return function () { o && u.disableEndCard() } }, [u, o]); var c = (0, a.useRef)(-1); return (0, a.useEffect)(function () { c.current !== t && (o && u.disableEndCard(), c.current = t) }, [t, u, o]), { showEndCard: o, handleVideoEndShowEndCard: (0, a.useCallback)(function () { i && u.setShowEndCard() }, [i, u]) } }, _ = function (e) { var t = (0, l.$c)(); (0, a.useEffect)(function () { t.resetVVCount() }, [t, e]) } }, 86026: function (e, t, n) { n.d(t, { $c: function () { return d }, GE: function () { return l } }); var r = n(5377), a = n(45996), o = n(71111), i = n(4676), u = (0, o.atom)({ vvCount: 0, showEndCard: !1, disableEndCard: !1 }), c = (0, i.i)(u, function (e, t) { return { increaseVVCount: function () { t(u, function (t) { return (0, a._)((0, r._)({}, t), { vvCount: e(u).vvCount + 1 }) }) }, resetVVCount: function () { t(u, function (e) { return (0, a._)((0, r._)({}, e), { vvCount: 0 }) }) }, setShowEndCard: function () { t(u, function (e) { return (0, a._)((0, r._)({}, e), { showEndCard: !0 }) }) }, disableEndCard: function () { t(u, function (e) { return (0, a._)((0, r._)({}, e), { showEndCard: !1, disableEndCard: !0 }) }) } } }), d = (c.useAtomService, c.useServiceDispatchers), l = c.useServiceState; c.getStaticApi }, 3091: function (e, t, n) { n.d(t, { O: function () { return j } }); var r = n(48748), a = n(95170), o = n(35383), i = n(7120), u = n(5377), c = n(45996), d = n(6586), l = n(79262), s = n(23999), f = n(76435), h = n(19293), p = n(24451), v = n(62564), _ = n(72916), m = n(95719), S = n(68710), g = n(74690), y = n(78990), b = n(82379), P = n(1455), w = n(94553), L = n(77226), E = n(90059), R = n(57007), C = n(48106), V = n(38653), O = n(84772), F = n(56904), T = n(96062); function k(e, t) { if (("undefined" == typeof Reflect ? "undefined" : (0, l._)(Reflect)) === "object" && "function" == typeof Reflect.metadata) return Reflect.metadata(e, t) } var A = function () { function e(t) { (0, a._)(this, e), this.fetch = t } return e.prototype.getRelatedSearch = function (e) { return this.fetch.get("/api/search/suggest/guide/", { query: e, baseUrlType: F.Z4.FixedWww }) }, e }(); function D(e, t, n, r) { var a, o = arguments.length, i = o < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, n) : r; if (("undefined" == typeof Reflect ? "undefined" : (0, l._)(Reflect)) === "object" && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, r); else for (var u = e.length - 1; u >= 0; u--)(a = e[u]) && (i = (o < 3 ? a(i) : o > 3 ? a(t, n, i) : a(t, n)) || i); return o > 3 && i && Object.defineProperty(t, n, i), i } function I(e, t) { if (("undefined" == typeof Reflect ? "undefined" : (0, l._)(Reflect)) === "object" && "function" == typeof Reflect.metadata) return Reflect.metadata(e, t) } A = function (e, t, n, r) { var a, o = arguments.length, i = o < 3 ? t : null === r ? r = Object.getOwnPropertyDescriptor(t, n) : r; if (("undefined" == typeof Reflect ? "undefined" : (0, l._)(Reflect)) === "object" && "function" == typeof Reflect.decorate) i = Reflect.decorate(e, t, n, r); else for (var u = e.length - 1; u >= 0; u--)(a = e[u]) && (i = (o < 3 ? a(i) : o > 3 ? a(t, n, i) : a(t, n)) || i); return o > 3 && i && Object.defineProperty(t, n, i), i }([(0, O._q)(), k("design:type", Function), k("design:paramtypes", [void 0 === T.p ? Object : T.p])], A); var j = function (e) { function t(e, n, i) { var u, c; return (0, a._)(this, t), (u = (0, r._)(this, t)).service = e, u.search = n, u.personalization = i, c = {}, (0, o._)(c, E.nX.General, {}), (0, o._)(c, E.nX.Video, {}), (0, o._)(c, E.nX.User, {}), (0, o._)(c, E.nX.Live, {}), u.defaultState = c, u } (0, i._)(t, e); var n = t.prototype; return n.setGeneralState = function (e, t) { e[E.nX.General] = t }, n.setUserState = function (e, t) { e[E.nX.User] = t }, n.setVideoState = function (e, t) { e[E.nX.Video] = t }, n.setLiveState = function (e, t) { e[E.nX.Live] = t }, n.setGeneralStateShowRelatedSearchPanel = function (e, t) { e[E.nX.General] = (0, c._)((0, u._)({}, e[E.nX.General]), { shouldShowRelatedSearchPanel: t }) }, n.setUserStateShowRelatedSearchPanel = function (e, t) { e[E.nX.User] = (0, c._)((0, u._)({}, e[E.nX.User]), { shouldShowRelatedSearchPanel: t }) }, n.setVideoStateShowRelatedSearchPanel = function (e, t) { e[E.nX.Video] = (0, c._)((0, u._)({}, e[E.nX.Video]), { shouldShowRelatedSearchPanel: t }) }, n.setLiveStateShowRelatedSearchPanel = function (e, t) { e[E.nX.Live] = (0, c._)((0, u._)({}, e[E.nX.Live]), { shouldShowRelatedSearchPanel: t }) }, n.getTopRelatedSearchData = function (e) { var t = this; return e.pipe((0, p.E)(this.search.state$, this.personalization.state$), (0, v.T)(function (e) { var t = (0, d._)(e, 3), n = t[0], r = t[1].searchGlobalParams, a = t[2].isSearchPersonalized; return { payload: n, rootEnterFrom: null == r ? void 0 : r.rootEnterFrom, nonPersonalized: a ? void 0 : 1 } }), (0, _.n)(function (e) { var n = e.payload, r = e.rootEnterFrom, a = e.nonPersonalized; return t.service.getRelatedSearch((0, c._)((0, u._)({}, n), { is_non_personalized_search: a })).pipe((0, v.T)(function (e) { return t.handleRequestData(e) }), (0, m.M)(function (e) { var n = e.data, a = e.log_id; t.reportTrendingShow(n, a, r, w.L.GeneralSearch) }), (0, S.Z)(function (e) { var n = (0, c._)((0, u._)({}, e), { shouldShowRelatedSearchPanel: !1 }); return (0, s.of)(t.getActions().setGeneralState(n)) }), (0, g.Z)(t.getActions().setGeneralState({})), (0, f.Q)(t.getAction$().dispose)) })) }, n.getVideoRelatedSearchData = function (e) { var t = this; return e.pipe((0, p.E)(this.search.state$, this.personalization.state$), (0, v.T)(function (e) { var t = (0, d._)(e, 3), n = t[0], r = t[1].searchGlobalParams, a = t[2].isSearchPersonalized; return { payload: n, rootEnterFrom: null == r ? void 0 : r.rootEnterFrom, nonPersonalized: a ? void 0 : 1 } }), (0, _.n)(function (e) { var n = e.payload, r = e.rootEnterFrom, a = e.nonPersonalized; return t.service.getRelatedSearch((0, c._)((0, u._)({}, n), { is_non_personalized_search: a })).pipe((0, v.T)(function (e) { return t.handleRequestData(e) }), (0, m.M)(function (e) { var n = e.data, a = e.log_id; t.reportTrendingShow(n, a, r, w.L.SearchVideo) }), (0, S.Z)(function (e) { var n = (0, c._)((0, u._)({}, e), { shouldShowRelatedSearchPanel: !1 }); return (0, s.of)(t.getActions().setVideoState(n)) }), (0, g.Z)(t.getActions().setVideoState({})), (0, f.Q)(t.getAction$().dispose)) })) }, n.getUserRelatedSearchData = function (e) { var t = this; return e.pipe((0, p.E)(this.search.state$, this.personalization.state$), (0, v.T)(function (e) { var t = (0, d._)(e, 3), n = t[0], r = t[1].searchGlobalParams, a = t[2].isSearchPersonalized; return { payload: n, rootEnterFrom: null == r ? void 0 : r.rootEnterFrom, nonPersonalized: a ? void 0 : 1 } }), (0, _.n)(function (e) { var n = e.payload, r = e.rootEnterFrom, a = e.nonPersonalized; return t.service.getRelatedSearch((0, c._)((0, u._)({}, n), { is_non_personalized_search: a })).pipe((0, v.T)(function (e) { return t.handleRequestData(e) }), (0, m.M)(function (e) { var n = e.data, a = e.log_id; t.reportTrendingShow(n, a, r, w.L.SearchUser) }), (0, S.Z)(function (e) { var n = (0, c._)((0, u._)({}, e), { shouldShowRelatedSearchPanel: !1 }); return (0, s.of)(t.getActions().setUserState(n)) }), (0, g.Z)(t.getActions().setUserState({})), (0, f.Q)(t.getAction$().dispose)) })) }, n.getLiveRelatedSearchData = function (e) { var t = this; return e.pipe((0, p.E)(this.search.state$, this.personalization.state$), (0, v.T)(function (e) { var t = (0, d._)(e, 3), n = t[0], r = t[1].searchGlobalParams, a = t[2].isSearchPersonalized; return { payload: n, rootEnterFrom: null == r ? void 0 : r.rootEnterFrom, nonPersonalized: a ? void 0 : 1 } }), (0, _.n)(function (e) { var n = e.payload, r = e.rootEnterFrom, a = e.nonPersonalized; return t.service.getRelatedSearch((0, c._)((0, u._)({}, n), { is_non_personalized_search: a })).pipe((0, v.T)(function (e) { return t.handleRequestData(e) }), (0, m.M)(function (e) { var n = e.data, a = e.log_id; t.reportTrendingShow(n, a, r, w.L.SearchLive) }), (0, S.Z)(function (e) { var n = (0, c._)((0, u._)({}, e), { shouldShowRelatedSearchPanel: !1 }); return (0, s.of)(t.getActions().setLiveState(n)) }), (0, g.Z)(t.getActions().setLiveState({})), (0, f.Q)(t.getAction$().dispose)) })) }, n.handleRequestData = function (e) { var t = e.status_code, n = e.data, r = void 0 === n ? [] : n, a = e.log_id, o = []; return t === R.s.Ok && (null == r ? void 0 : r.length) && (o = r.map(function (e) { return (0, c._)((0, u._)({}, e), { impr_id: a }) })), (0, c._)((0, u._)({}, e), { data: null != o ? o : [] }) }, n.reportTrendingShow = function (e, t, n, r) { if (e && e.length >= 10) { var a = { enter_from: n, words_source: E.rU.RelatedSearch, search_position: L.f.commonParams.page_name, page_name: r }; E.$G.handleTrendingShow((0, u._)({ words_num: e.length, impr_id: null != t ? t : "", raw_query: "" }, a)), e.forEach(function (e, n) { var r, o; return E.$G.handleTrendingWordsShow((0, u._)({ words_position: n, words_content: null != (r = null == e ? void 0 : e.word) ? r : "", group_id: null != (o = null == e ? void 0 : e.group_id) ? o : "", impr_id: null != t ? t : "" }, a)) }) } }, t }(y.E); D([(0, b.uk)(), I("design:type", void 0 === h.c ? Object : h.c)], j.prototype, "dispose", void 0), D([(0, b.h5)(), I("design:type", Function), I("design:paramtypes", ["undefined" == typeof RelatedSearchState ? Object : RelatedSearchState, "undefined" == typeof RelatedSearchPayload ? Object : RelatedSearchPayload]), I("design:returntype", void 0)], j.prototype, "setGeneralState", null), D([(0, b.h5)(), I("design:type", Function), I("design:paramtypes", ["undefined" == typeof RelatedSearchState ? Object : RelatedSearchState, "undefined" == typeof RelatedSearchPayload ? Object : RelatedSearchPayload]), I("design:returntype", void 0)], j.prototype, "setUserState", null), D([(0, b.h5)(), I("design:type", Function), I("design:paramtypes", ["undefined" == typeof RelatedSearchState ? Object : RelatedSearchState, "undefined" == typeof RelatedSearchPayload ? Object : RelatedSearchPayload]), I("design:returntype", void 0)], j.prototype, "setVideoState", null), D([(0, b.h5)(), I("design:type", Function), I("design:paramtypes", ["undefined" == typeof RelatedSearchState ? Object : RelatedSearchState, "undefined" == typeof RelatedSearchPayload ? Object : RelatedSearchPayload]), I("design:returntype", void 0)], j.prototype, "setLiveState", null), D([(0, b.h5)(), I("design:type", Function), I("design:paramtypes", ["undefined" == typeof RelatedSearchState ? Object : RelatedSearchState, Boolean]), I("design:returntype", void 0)], j.prototype, "setGeneralStateShowRelatedSearchPanel", null), D([(0, b.h5)(), I("design:type", Function), I("design:paramtypes", ["undefined" == typeof RelatedSearchState ? Object : RelatedSearchState, Boolean]), I("design:returntype", void 0)], j.prototype, "setUserStateShowRelatedSearchPanel", null), D([(0, b.h5)(), I("design:type", Function), I("design:paramtypes", ["undefined" == typeof RelatedSearchState ? Object : RelatedSearchState, Boolean]), I("design:returntype", void 0)], j.prototype, "setVideoStateShowRelatedSearchPanel", null), D([(0, b.h5)(), I("design:type", Function), I("design:paramtypes", ["undefined" == typeof RelatedSearchState ? Object : RelatedSearchState, Boolean]), I("design:returntype", void 0)], j.prototype, "setLiveStateShowRelatedSearchPanel", null), D([(0, b.Mj)(), I("design:type", Function), I("design:paramtypes", [void 0 === h.c ? Object : h.c]), I("design:returntype", void 0)], j.prototype, "getTopRelatedSearchData", null), D([(0, b.Mj)(), I("design:type", Function), I("design:paramtypes", [void 0 === h.c ? Object : h.c]), I("design:returntype", void 0)], j.prototype, "getVideoRelatedSearchData", null), D([(0, b.Mj)(), I("design:type", Function), I("design:paramtypes", [void 0 === h.c ? Object : h.c]), I("design:returntype", void 0)], j.prototype, "getUserRelatedSearchData", null), D([(0, b.Mj)(), I("design:type", Function), I("design:paramtypes", [void 0 === h.c ? Object : h.c]), I("design:returntype", void 0)], j.prototype, "getLiveRelatedSearchData", null), j = D([(0, P.nV)("RelatedSearch"), I("design:type", Function), I("design:paramtypes", [void 0 === A ? Object : A, void 0 === V.tq ? Object : V.tq, void 0 === C.f ? Object : C.f])], j) }, 93538: function (e, t, n) { n.d(t, { Ae: function () { return k }, DQ: function () { return D }, Y6: function () { return A }, gc: function () { return O }, nY: function () { return F }, u5: function () { return V } }); var r, a = n(35383), o = n(5377), i = n(45996), u = n(6586), c = n(90421), d = n(26869), l = n(40099), s = n(10874), f = n(89786), h = n(77443), p = n(23680), v = n(90059), _ = n(59952), m = n(38306), S = n(43264), g = n(13610), y = n(54520), b = n(83153), P = n(76232), w = n(26668), L = n(48106), E = n(3091), R = n(49244), C = n(38653); function V() { var e, t = (0, s.useLocation)(), n = t.search, r = t.state, a = null != r ? r : {}, o = a.enterMethod, i = a.searchSource, u = a.enterFrom, c = a.fromSearchSubTab, l = a.imprId, f = a.blankpageEnterFrom, h = a.blankpageEnterMethod, p = a.videoPageType, v = a.preClickId, _ = (0, d.parse)(n).q; return { enterMethod: o, searchSource: i, enterFrom: u, keyword: null != (e = Array.isArray(_) ? _.toString() : _) ? e : "", fromSearchSubTab: c, imprId: l, blankpageEnterFrom: f, blankpageEnterMethod: h, videoPageType: p, preClickId: v } } function O(e) { var t, n, r = V(), a = r.keyword, o = r.enterMethod, i = r.searchSource, c = r.enterFrom, d = r.fromSearchSubTab, p = r.imprId, _ = r.blankpageEnterFrom, y = r.blankpageEnterMethod, P = r.videoPageType, L = r.preClickId, E = null != (t = (0, S.W)(function () { return ["user", "language", "abTestVersion"] }, [])) ? t : {}, O = E.user, F = E.language, T = void 0 === F ? "en" : F, k = E.abTestVersion, D = null != (n = (0, g.U)(function () { return ["searchVideoForLoggedin", "searchLiveForLoggedin"] }, [])) ? n : {}, I = D.searchVideoForLoggedin, j = D.searchLiveForLoggedin, z = (0, s.useLocation)(), M = (0, b.A)().streamDeviceType, U = z.pathname, G = !!O, X = (0, u._)((0, h.S)(C.tq, { dependencies: [], selector: function (t) { var n; return { state: null != (n = t[e]) ? n : {}, rootEnterFrom: t.searchGlobalParams.rootEnterFrom } } }), 2), $ = X[0], W = $.state, q = $.rootEnterFrom, B = X[1], N = (0, h.w)(R.O), Z = (0, h.w)(w.F), H = U === f.OZ.searchUser, x = A(); return (0, l.useCallback)(function () { var t = !(arguments.length > 0) || void 0 === arguments[0] || arguments[0], n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = a !== (null == W ? void 0 : W.keyword) || t, u = a !== (null == W ? void 0 : W.keyword) || n, l = !I || G, s = !j || G, h = { search_source: null != i ? i : v.Cy.SearchOuter, search_type: e, enter_method: o, from_search_subtab: d, enter_from: null != c ? c : q, pre_click_id: null != p ? p : L, pre_recom_show_id: p, blankpage_enter_from: _, blankpage_enter_method: y, video_page_type: P }; switch (e) { case v.nX.General: U === f.OZ.searchHome && r && l && (u && (B.setSearchResult({ key: v.nX.General, result: C.I4 }), N.resetItemList({ key: m.Lz.SearchTop, loading: !0 })), B.getTopSearch({ keyword: a, teaParams: h, user: O, language: T, abTestVersion: k, hasSearchLive: x, search_source: i, device_type: M })); break; case v.nX.User: H && r && (u && B.setSearchResult({ key: v.nX.User, result: C.Fy }), B.getUserSearch({ keyword: a, teaParams: h, user: O, language: T, abTestVersion: k })); break; case v.nX.Video: U === f.OZ.searchVideo && r && l && (u && (B.setSearchResult({ key: v.nX.Video, result: C.Fy }), N.resetItemList({ key: m.Lz.SearchVideo, loading: !0 })), B.getVideoSearch({ keyword: a, teaParams: h, user: O, language: T, abTestVersion: k })); break; case v.nX.Live: U === f.OZ.searchLive && r && s && (u && (B.setSearchResult({ key: v.nX.Live, result: C.Fy }), Z.resetLiveList({ key: m.Lz.SearchLive, loading: !0 })), B.getLiveSearch({ keyword: a, teaParams: h, user: O, language: T, abTestVersion: k, device_type: M })) } }, [M, a, null == W ? void 0 : W.keyword, I, G, o, i, e, U, H, B, O, T, k, N, x, Z, j, d, q, p, _, y, L, P]) } function F(e) { var t = !(arguments.length > 1) || void 0 === arguments[1] || arguments[1], n = V().keyword, r = (0, s.useLocation)(), a = (0, s.useHistory)(), c = r.state, d = r.pathname, p = !!(0, s.matchPath)(d, { path: f.OZ.searchHome }), _ = (0, P.CA)().hasRelatedSearch, m = (0, u._)((0, h.S)(C.tq, { dependencies: [], selector: function (t) { var n; return null != (n = t[e]) ? n : {} } }), 2), S = m[0], g = m[1], y = (0, u._)((0, h.S)(E.O, { dependencies: [], selector: function (e) { return e } }), 2)[1], b = (0, u._)((0, h.S)(L.f, { dependencies: [], selector: function (e) { return { personalized: e.isSearchPersonalized } } }), 1)[0], w = O(e); return (0, l.useEffect)(function () { if (p) { var u, d, l, s, f, h = S.data ? !S.error && (null == (d = S.data) || null == (u = d.videoList) ? void 0 : u.length) === 0 && (null == (s = S.data) || null == (l = s.otherDataList) ? void 0 : l.length) === 0 : (null == S || null == (f = S.items) ? void 0 : f.length) === 0, m = n !== S.keyword || h; if (t && a.replace((0, i._)((0, o._)({}, r), { state: (0, o._)({}, c) })), w(m), m && _) { var b = { req_source: "related_search", search_source: e, keyword: n }; switch (e) { case v.nX.General: y.getTopRelatedSearchData(b); break; case v.nX.User: y.getUserRelatedSearchData(b); break; case v.nX.Video: y.getVideoRelatedSearchData(b); break; case v.nX.Live: y.getLiveRelatedSearchData(b) } } return function () { g.dispose(), y.dispose() } } }, [n, _, e, y, b]), (0, i._)((0, o._)({}, S), { keyword: n, handleSearch: w }) } var T = (r = {}, (0, a._)(r, v.nX.General, f.OZ.searchHome), (0, a._)(r, v.nX.User, f.OZ.searchUser), (0, a._)(r, v.nX.Video, f.OZ.searchVideo), (0, a._)(r, v.nX.Live, f.OZ.searchLive), r); function k(e, t) { var n = (0, l.useRef)(0), r = (0, s.useHistory)(), a = (0, s.useLocation)(), o = V(), i = o.keyword, u = o.enterMethod, d = (0, p.P)(C.tq, { dependencies: [], selector: function (e) { return { searchGlobalParams: e.searchGlobalParams } } }).searchGlobalParams, f = (0, _.GF)(), h = a.pathname; (0, l.useEffect)(function () { if ((0, s.matchPath)(h, { path: T[t] })) return n.current || (n.current = Date.now()), r.listen(function (r) { var a, o = r.pathname, l = Date.now() - n.current, s = null == (a = (0, c.A)(T)) ? void 0 : a[o]; v.$G.handleSearchSessionFinish({ duration: l, impr_id: e, search_id: e, search_type: t, search_keyword: i, enter_method: u, enter_from: d.rootEnterFrom, group_id: f, next_tab: s }) }) }, [e, t, d, f, u]) } function A() { var e, t, n = null != (e = (0, S.W)(function () { return ["abTestVersion", "user"] }, [])) ? e : {}, r = n.abTestVersion, a = n.user; return "v2" === (0, y.qt)(r, "search_add_live") && (null == (t = null == a ? void 0 : a.hasSearchLivePermission) || t) } function D(e) { var t = (0, u._)((0, h.S)(C.tq, { selector: function (e) { return { rootEnterFrom: e.searchGlobalParams.rootEnterFrom } }, dependencies: [] }), 2)[1]; (0, l.useEffect)(function () { t.setSearchGlobalParams({ rootEnterFrom: e }) }, [t, e]) } }, 90362: function (e, t, n) { n.d(t, { F: function () { return a } }); var r = n(77226), a = { handleModelPredict: function (e) { r.f.sendEvent("on_device_ml_predict", e) } } } }]);