"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[2110],{48868:(e,t,n)=>{n.d(t,{I9:()=>a,Tq:()=>d,tR:()=>l});var i=n(14374),o=n(31209),s=n(43723);const a=(0,i._)((0,s.p)("commentItemAtom@tiktok/webapp-atoms",{}),{rehydrationKey:"webapp.comment.items"}),{useAtomService:r,useServiceState:d,useServiceDispatchers:c,getStaticApi:l}=(0,o.i)(a,((e,t)=>({setItem(e){t(a,(t=>Object.assign(Object.assign({},t),{[e.cid]:e})))},setItemDiggState(n){e(a)[n.cid]&&t(a,(e=>{var t,i;return Object.assign(Object.assign({},e),{[n.cid]:Object.assign(Object.assign({},e[n.cid]),{user_digged:n.digged,is_author_digged:null!==(t=n.is_author_digged)&&void 0!==t?t:null===(i=e[n.cid])||void 0===i?void 0:i.is_author_digged})})}))},setItemDiggCount(n){e(a)[n.cid]&&t(a,(e=>Object.assign(Object.assign({},e),{[n.cid]:Object.assign(Object.assign({},e[n.cid]),{digg_count:n.count})})))},removeItem(e){t(a,(t=>{const n=t,i=e;return n[i],function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o{const n=Object.assign({},t);return e.forEach((e=>{n[e.cid]=Object.assign(Object.assign({},n[e.cid]),e)})),n}))},multiRemoveCommentItem(e){t(a,(t=>{const n=Object.assign({},t);return e.forEach((e=>{delete n[e]})),n}))},reduceOrIncreaseCommentCount({cid:n,isReduce:i}){var o,s;const r=e(a);if(!r[n])return;const d=Number(null!==(s=null===(o=r[n])||void 0===o?void 0:o.reply_comment_total)&&void 0!==s?s:0);t(a,(e=>Object.assign(Object.assign({},e),{[n]:Object.assign(Object.assign({},e[n]),{reply_comment_total:i?d-1:d+1})})))}})))},64747:(e,t,n)=>{n.d(t,{lN:()=>R,OL:()=>L,BY:()=>k,kH:()=>F,_B:()=>M});var i=n(84573),o=n.n(i),s=n(300),a=n.n(s),r=n(18499),d=n(93608),c=n(11983),l=n(22248),m=n(53764),u=n(14374),_=n(31209),p=n(43723),h=n(2408),v=n(84908),g=n(41548),f=n(60072),y=n(48868),b=n(8800),C=(n(4474),n(39785)),w=n(56070),O=n(26325),S=function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{d(i.next(e))}catch(e){s(e)}}function r(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}d((i=i.apply(e,t||[])).next())}))};const I=(0,C.M)({csr:function(e){return S(this,void 0,void 0,(function*(){return w.h.get("/api/comment/list/",{query:Object.assign(Object.assign({},e),{count:20,aid:1988,app_language:"ja-JP",device_platform:"web_pc",current_region:"JP",fromWeb:1,enter_from:"tiktok_web"}),baseUrlType:2})}))}});var P,j=n(57431),E=function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{d(i.next(e))}catch(e){s(e)}}function r(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}d((i=i.apply(e,t||[])).next())}))};!function(e){e[e.Like=1]="Like",e[e.Unlike=2]="Unlike"}(P||(P={}));const R={awemeId:void 0,cursor:"0",comments:[],hasMore:!0,loading:!1,isFirstLoad:!1,fetchType:"load_by_current"},T=(0,u._)((0,p.p)("commentAtom@tiktok/webapp-atoms",{}),{rehydrationKey:"webapp.comment"}),{useAtomService:F,useServiceState:M,useServiceDispatchers:k,getStaticApi:L}=(0,_.i)(T,((e,t)=>({setCommentItem({itemId:e="",item:n}){n&&t(T,(t=>{var i;return Object.assign(Object.assign({},t),{[e]:Object.assign(Object.assign({},null!==(i=t[e])&&void 0!==i?i:R),n)})}))},setReplyLoading(n){var i,o,s,a;const[r,d]=A(e,n);r&&(r.replyCache=Object.assign(Object.assign({},null!==(i=r.replyCache)&&void 0!==i?i:{comments:null!==(o=r.reply_comment)&&void 0!==o?o:[],cursor:null!==(a=null===(s=r.reply_comment)||void 0===s?void 0:s.length)&&void 0!==a?a:"0",hasMore:!0}),{loading:n.loading}),V(t,n.itemId,d,Object.assign({},r)))},setReplyComment(n){const[i,o]=A(e,n);i&&V(t,n.itemId,o,Object.assign(Object.assign({},i),{reply_comment:n.comments}))},setReplyCommentCache(n){var i,o;const[s,a]=A(e,n);s&&(s.replyCache={comments:n.comments,cursor:n.cursor,hasMore:n.hasMore,loading:null!==(o=null===(i=s.replyCache)||void 0===i?void 0:i.loading)&&void 0!==o&&o},V(t,n.itemId,a,Object.assign({},s)))},deleteCommentFromList(n){var i,o;const{index:s,subIndex:a,itemId:r}=n;if(void 0===a)V(t,r,s);else{const n=e(T)[r];if(!n)return;const d=Object.assign({},n.comments[s]);null===(i=d.reply_comment)||void 0===i||i.splice(a,1),null===(o=d.replyCache)||void 0===o||o.comments.splice(a,1),V(t,r,s,d)}},addCommentToFirst(e){t(T,(t=>{var n,i;return Object.assign(Object.assign({},t),{[e.aweme_id]:Object.assign(Object.assign(Object.assign({},R),t[e.aweme_id]),{comments:[{cid:e.cid,reply_comment:[],replyCache:null},...null!==(i=null===(n=t[e.aweme_id])||void 0===n?void 0:n.comments)&&void 0!==i?i:[]]})})}))},addReplyToFirst({comment:n,position:i}){var o,s,a,r;const d=e(T),{aweme_id:c}=n,l=d[c];if(!l)return;const m=l.comments[i];if(!m)return;const u=Object.assign({},m);u.reply_comment=[{cid:n.cid,reply_comment:null,replyCache:null},...null!==(o=m.reply_comment)&&void 0!==o?o:[]],u.replyCache=Object.assign(Object.assign({},null!==(s=u.replyCache)&&void 0!==s?s:{cursor:"0",hasMore:!0,loading:!1}),{comments:[{cid:n.cid,reply_comment:null,replyCache:null},...null!==(r=null===(a=u.replyCache)||void 0===a?void 0:a.comments)&&void 0!==r?r:[]]}),V(t,c,i,u)},handlePostSuccess(e){const{users:t,commentItems:n}=D([e]);(0,r.unstable_batchedUpdates)((()=>{this.addCommentToFirst(e),(0,v.Gp)().multiSetUser(t),(0,y.tR)().multiSetCommentItem(n),(0,f.ud)().reduceOrIncreaseCommentCount({id:e.aweme_id,isReduce:!1})}))},handleReplySuccess(e){const{comment:t,position:n}=e,{users:i,commentItems:o}=D([t],{ignoreReply:!0}),s=(0,y.tR)();(0,r.unstable_batchedUpdates)((()=>{this.addReplyToFirst({comment:t,position:n}),(0,v.Gp)().multiSetUser(i),s.multiSetCommentItem(o),s.reduceOrIncreaseCommentCount({cid:t.reply_id}),(0,f.ud)().reduceOrIncreaseCommentCount({id:t.aweme_id,isReduce:!1})}))},fetchComment(t){var n,i,o,s;return E(this,void 0,void 0,(function*(){const d=e(T),{aweme_id:c,insert_ids:m,fetch_type:u="load_by_current"}=t,_=null!==(n=d[t.aweme_id])&&void 0!==n?n:{awemeId:void 0,cursor:"0",comments:[],hasMore:!0,loading:!0},p=(0,h.PJ)(e(h.WH));if(!_.hasMore)return;const g=_.cursor;this.setCommentItem({item:{awemeId:c,loading:!0},itemId:c});try{const e=yield I({insert_ids:"0"===g?m:void 0,aweme_id:c,cursor:g,is_non_personalized:p});if((0,l.G)(e.status_code,[0]),0===e.status_code&&(null===(i=e.comments)||void 0===i?void 0:i.length)){const{users:t,comments:n,commentItems:i}=D(e.comments,{logId:null===(o=e.log_pb)||void 0===o?void 0:o.impr_id}),s=_.comments,d=a()(s.concat(n),"cid");(0,r.unstable_batchedUpdates)((()=>{(0,v.Gp)().multiSetUser(t),(0,y.tR)().multiSetCommentItem(i),this.setCommentItem({item:{comments:d,hasMore:Boolean(e.has_more),cursor:e.cursor,loading:!1,isFirstLoad:0===Number(g),fetchType:u},itemId:c}),e.total&&(0,f.ud)().setCommentCount({id:c,commentCount:Number(e.total)})}))}else 0!==e.status_code||(null===(s=e.comments)||void 0===s?void 0:s.length)||e.has_more||this.setCommentItem({item:{hasMore:Boolean(e.has_more),loading:!1},itemId:c})}catch(e){this.setCommentItem({item:{loading:!1},itemId:c})}}))},fetchCommentReply(t){var n,i,o,s;return E(this,void 0,void 0,(function*(){const[d,c]=x(e,t);if(c){this.setReplyLoading(Object.assign(Object.assign({},d),{loading:!0}));try{const e=yield function(e){return S(this,void 0,void 0,(function*(){return w.h.get("/api/comment/list/reply/",{query:Object.assign(Object.assign({},e),{count:3,aid:1988,app_language:"ja-JP",device_platform:"web_pc",current_region:"JP",fromWeb:1,enter_from:"tiktok_web"}),baseUrlType:2})}))}({comment_id:d.cid,item_id:d.itemId,cursor:null!==(i=null===(n=c.replyCache)||void 0===n?void 0:n.cursor)&&void 0!==i?i:"0"});if((0,l.G)(e.status_code,[0]),0===e.status_code){const{users:t,comments:n,commentItems:i}=D(e.comments,{logId:null===(o=e.log_pb)||void 0===o?void 0:o.impr_id}),l=null!==(s=c.reply_comment)&&void 0!==s?s:[],m=a()(l.concat(n),"cid");(0,r.unstable_batchedUpdates)((()=>{(0,v.Gp)().multiSetUser(t),(0,y.tR)().multiSetCommentItem(i),this.setReplyComment(Object.assign({comments:[...m]},d)),this.setReplyCommentCache(Object.assign({comments:[...m],hasMore:Boolean(e.has_more),cursor:e.cursor},d)),this.setReplyLoading(Object.assign(Object.assign({},d),{loading:!1}))}))}}catch(e){this.setReplyLoading(Object.assign(Object.assign({},d),{loading:!1}))}}else console.warn("No item here in fetch commoent reply")}))},handleCollapseReply(t){const[n]=A(e,t);n?this.setReplyComment(Object.assign(Object.assign({},t),{comments:[]})):console.warn("item is null")},handleShowMoreReply(t){return E(this,void 0,void 0,(function*(){const[{cid:n,itemId:i},o]=x(e,t);if(d.f.sendEvent("show_more_reply",{parent_comment_id:n,group_id:i}),!o)return void console.warn("item is null");if(!o.reply_comment||!o.replyCache)return this.fetchCommentReply(t);const s=o.reply_comment.length,a=o.replyCache.comments.length;if(sa?a:s+3;return this.setReplyComment(Object.assign(Object.assign({},t),{comments:o.replyCache.comments.slice(0,e)}))}return this.fetchCommentReply(t)}))},handleCommentLike(t){var n,i,o;return E(this,void 0,void 0,(function*(){const s=e(y.I9),a=e(v.p9),l=s[t.cid],{user:u}=(0,j.x)(),_=null==u?void 0:u.uid,p=e(f.Pu),h=null===(n=p[t.itemId])||void 0===n?void 0:n.authorId,b=a.users[null!==(i=null==l?void 0:l.user)&&void 0!==i?i:""];if(!l)return void console.warn("No comment item here in hendle comment like");const C=l.user_digged?2:1;try{const e=yield function(e){return S(this,void 0,void 0,(function*(){return w.h.post("/api/comment/digg/",{query:Object.assign(Object.assign({},e),{aid:1988,channel_id:0}),headers:{[O.nk]:w.h.csrfToken},baseUrlType:2})}))}({aweme_id:t.itemId,cid:t.cid,digg_type:C}),n=(0,g.T)();if(0===(null==e?void 0:e.status_code)?d.f.sendEvent(1===C?"like_comment":"cancel_like_comment",{comment_id:t.cid,group_id:t.itemId,comment_user_id:null!==(o=null==b?void 0:b.id)&&void 0!==o?o:"",author_id:t.teaAuthorId}):3002043===(null==e?void 0:e.status_code)?(c.F.destroy(),c.F.open({content:n(2===C?"comment_turnoff_unlike":"comment_turnoff_like"),duration:3,getContainer:m.M,getContainerPosition:"fixed"})):(null==e?void 0:e.status_code)?(c.F.destroy(),c.F.open({content:n("Sorry, something wrong with the server, please try again."),duration:3,widthType:"half",getContainer:m.M,getContainerPosition:"fixed"})):(c.F.destroy(),c.F.open({content:n("comment_nointernet_toast"),duration:3,widthType:"half",getContainer:m.M,getContainerPosition:"fixed"})),0===e.status_code){let e,n,i;1===C?(e=1,n=l.digg_count+1,_===h&&(i=!0)):(e=0,n=Math.max(l.digg_count-1,0),_===h&&(i=!1));const o=(0,y.tR)();(0,r.unstable_batchedUpdates)((()=>{o.setItemDiggState({cid:t.cid,digged:e,is_author_digged:i}),o.setItemDiggCount({cid:t.cid,count:n})}))}else 3002043===e.status_code&&(0,f.ud)().updateItem({id:t.itemId,itemCommentStatus:3})}catch(e){}}))},handleCommentDelete(e){return E(this,void 0,void 0,(function*(){const t=(0,g.T)(),{itemId:n,cid:i,parentCid:o,subIndex:s}=e;try{const a=yield function(e){return S(this,void 0,void 0,(function*(){return w.h.post("/api/comment/delete/",{query:e,baseUrlType:2,headers:{[O.nk]:w.h.csrfToken}})}))}({cid:i});if(0===a.status_code?c.F.open({content:t("comment_delete_success"),duration:3,widthType:"half",getContainer:m.M,getContainerPosition:"fixed"}):c.F.open({content:t("comment_delete_failed"),duration:3,widthType:"half",getContainer:m.M,getContainerPosition:"fixed"}),0===a.status_code){const t=(0,y.tR)();(0,r.unstable_batchedUpdates)((()=>{this.deleteCommentFromList(e),t.removeItem(i),(0,f.ud)().reduceOrIncreaseCommentCount({id:n,isReduce:!0}),void 0!==s&&o&&t.reduceOrIncreaseCommentCount({cid:o,isReduce:!0})}))}}catch(e){}}))},switchVideo(e){return E(this,void 0,void 0,(function*(){const{currId:t,insertCid:n}=e;yield this.fetchComment({insert_ids:n,aweme_id:t})}))},handleCommentsPreload(e){const{aweme_id:t,fetch_type:n,has_more:i,cursor:o,total:s}=e,{users:a,comments:d,commentItems:c}=D(e.comments);(0,r.unstable_batchedUpdates)((()=>{(0,v.Gp)().multiSetUser(a),(0,y.tR)().multiSetCommentItem(c),this.setCommentItem({item:{comments:d,hasMore:Boolean(i),cursor:o,loading:!1,isFirstLoad:!0,fetchType:n},itemId:t}),s&&(0,f.ud)().setCommentCount({id:t,commentCount:Number(s)})}))}})));function x(e,t){const[n,i]=A(e,t);return[t,n,i]}function A(e,{itemId:t,cid:n}){const i=e(T)[t];if(!i)return[void 0,-1];const o=i.comments,s=o.findIndex((({cid:e})=>e===n));return-1!==s?[o[s],s]:[void 0,-1]}function V(e,t,n,i){-1!==n&&e(T,(e=>{var s,a;const r=null!==(a=null===(s=e[t])||void 0===s?void 0:s.comments)&&void 0!==a?a:[];let d=[];return d=i?[...r.slice(0,n),o()(Object.assign(Object.assign({},r[n]),i)),...r.slice(n+1)]:[...r.slice(0,n),...r.slice(n+1)],Object.assign(Object.assign({},e),{[t]:Object.assign(Object.assign(Object.assign({},R),e[t]),{comments:d})})}))}function D(e=[],t={}){return e.reduce(((e,n)=>{const{user:i,reply_comment:o}=n;return e.users.push((0,b.bg)(i)),(null!=o?o:[]).forEach((({user:t})=>{e.users.push((0,b.bg)(t))})),e.comments.push(U(n,t)),(0,b.PT)(n,t).forEach((t=>{e.commentItems.push(t)})),e}),{users:[],comments:[],commentItems:[]})}function U(e,t={}){var n;return{cid:e.cid,logId:t.logId,reply_comment:null===(n=e.reply_comment)||void 0===n?void 0:n.map((e=>U(e,t))),replyCache:null}}},26740:(e,t,n)=>{n.d(t,{U:()=>a,w:()=>r});var i=n(40099),o=n(91257),s=n(99147);const a=e=>{s.e.init(),s.e.setPage({pageName:e}),(0,i.useEffect)((()=>()=>{s.e.pageSwitch()}),[e])},r=({isCurrentVideo:e,index:t,mode:n})=>{(0,i.useEffect)((()=>{const i=o.Jr[n];e&&s.e.setPlayStatusAndTriggerVideoSwitch({index:t,playMode:i})}),[e,t,n])}},99147:(e,t,n)=>{n.d(t,{e:()=>s});var i=n(93608);class o{constructor(e){this._startTime=null,this._count=0,this._reportFunc=e}deInit(){this._startTime=null}resetStartTime(){this._startTime=performance.now(),this._count+=1}report(){if(null===this._startTime)return;const e=performance.now()-this._startTime;this._startTime=null,this._reportFunc(e)}}const s=new class{constructor(){this._initialized=!1,this._etParams={}}init(){this._initialized||(this._initialized=!0,this._pageSwitchActualFMPReporter=new o((e=>{var t;t={page_name:this._etParams.page_name,prev_page:this._etParams.prev_page,duration:e},i.f.sendEvent("page_switch_actual_fmp",t)})),this._pageSwitchFirstFrameVideoReporter=new o((e=>{var t;t={page_name:this._etParams.page_name,prev_page:this._etParams.prev_page,duration:e},i.f.sendEvent("page_switch_first_frame_video",t)})),this._videoSwitchActualFMPReporter=new o((e=>{var t;t=Object.assign(Object.assign({},this._etParams),{duration:e}),i.f.sendEvent("video_switch_actual_fmp",t)})),this._videoSwitchFirstFrameVideoReporter=new o((e=>{var t;t=Object.assign(Object.assign({},this._etParams),{duration:e}),i.f.sendEvent("video_switch_first_frame_video",t)})),this._pageReadyReporter=new o((e=>{var t;t={page_name:this._etParams.page_name},i.f.sendEvent("page_ready",t)})),this._pageReadyReporter.resetStartTime())}setPage({pageName:e}){this._initialized&&this._etParams.page_name!==e&&(this._etParams.prev_page=this._etParams.page_name,this._etParams.page_name=e)}setPlayStatusAndTriggerVideoSwitch({index:e,playMode:t}){this._initialized&&((void 0!==this._etParams.index&&this._etParams.index!==e||void 0!==this._etParams.play_mode&&this._etParams.play_mode!==t)&&this.videoSwitch(),this._etParams.prev_index=this._etParams.index,this._etParams.index=e,this._etParams.prev_play_mode=this._etParams.play_mode,this._etParams.play_mode=t)}pageSwitch(){var e,t,n,i,o;this._initialized&&(null===(e=this._pageSwitchActualFMPReporter)||void 0===e||e.resetStartTime(),null===(t=this._pageSwitchFirstFrameVideoReporter)||void 0===t||t.resetStartTime(),null===(n=this._videoSwitchActualFMPReporter)||void 0===n||n.deInit(),null===(i=this._videoSwitchFirstFrameVideoReporter)||void 0===i||i.deInit(),null===(o=this._pageReadyReporter)||void 0===o||o.resetStartTime())}videoSwitch(){var e,t;this._initialized&&(null===(e=this._videoSwitchActualFMPReporter)||void 0===e||e.resetStartTime(),null===(t=this._videoSwitchFirstFrameVideoReporter)||void 0===t||t.resetStartTime())}handleActualFMP(){var e,t,n;this._initialized&&(null===(e=this._pageSwitchActualFMPReporter)||void 0===e||e.report(),null===(t=this._videoSwitchActualFMPReporter)||void 0===t||t.report(),null===(n=this._pageReadyReporter)||void 0===n||n.report())}handleFirstFrameVideo(){var e,t;this._initialized&&(null===(e=this._pageSwitchFirstFrameVideoReporter)||void 0===e||e.report(),null===(t=this._videoSwitchFirstFrameVideoReporter)||void 0===t||t.report())}}},99129:(e,t,n)=>{n.d(t,{K1:()=>S,M$:()=>R,Oz:()=>E,Zr:()=>P,bE:()=>T,mV:()=>I,oS:()=>j});var i=n(58632),o=n(5441),s=n(32862),a=n(54888),r=n(49057),d=n(71281),c=n(56070),l=n(93608),m=n(4135),u=n(90599),_=n(40099),p=n(34099),h=n(71828),v=n(5412),g=n(32125),f=n(93341),y=n(60484),b=n(64747),C=n(60072),w=n(41271),O=n(88920);const S=()=>{var e,t;const{isElectronApp:n}=(0,o.B)(),i="undefined"==typeof window?"v1":null!==(t=null===(e=(0,s.OW)("web_on_device_ml",{vid:"v1"}))||void 0===e?void 0:e.vid)&&void 0!==t?t:"v1";return{enableOnDeviceML:"v1"!==i&&!n,isMLWithModel:("v2"===i||"v3"===i)&&"undefined"!=typeof WebAssembly,isMLWithStrategy:"v4"===i,isMLWithModelLowThreshold:"v2"===i}},I=()=>{var e;const{enablePlayerPreloadDowngradePredict:t,disablePreloadPredict:n,playerPreloadPredictStrategy:o}=(0,O.Mz)(),s=(0,f.nr)(),{playerPreloadStrategy:c}=(0,w.P)(a.$,{selector:e=>{var t,n,i,o;return{playerPreloadStrategy:null===(o=null===(i=null===(n=null===(t=e.bizContext)||void 0===t?void 0:t.config)||void 0===n?void 0:n.onDeviceMLConfig)||void 0===i?void 0:i.playerPreload)||void 0===o?void 0:o.playerPreloadStrategy}},dependencies:[]}),{abTestVersion:l}=(0,y.L$)((0,r.W)((()=>["abTestVersion"]),[])),_=null!==(e=(0,d.qt)(l,"tt_player_preload"))&&void 0!==e?e:{maxQueueCount:3,preloadTime:10},p=e=>{var t,n,i;if(e===u.EVideoSlideSpeed.Normal)return void s.updatePredictedPreloadConfig({maxQueueCount:null==_?void 0:_.maxQueueCount,preloadTime:null==_?void 0:_.preloadTime});const a=e===u.EVideoSlideSpeed.Slow?"gt_12s":"lt_12s",r=null===(n=null===(t=null==o?void 0:o.label_index_mapping)||void 0===t?void 0:t.findIndex)||void 0===n?void 0:n.call(t,(e=>e===a)),d=null===(i=null==o?void 0:o.plans)||void 0===i?void 0:i[r];console.debug("[Video Preload] Predict preload config: ",d),s.updatePredictedPreloadConfig(d)};return e=>{if(n||!c)return;const o=c,s=u.EScene.VIDEO_PRELOAD,a=new u.Sibyl({biz:m.vh.TIKTOK_WEB_FYP}),r=a.createStrategyEngine({abConfig:o,scene:s});r&&(r.setThresholdCallback((()=>(0,i.__awaiter)(void 0,void 0,void 0,(function*(){var n,i,d;if(t){const t=a.strategyInference({abConfig:o,scene:s});return h.F.handleModelPredict({hit:Number(t===u.EVideoSlideSpeed.Slow),scene:u.EScene.VIDEO_PRELOAD,predict_value:-1,group_id:e,threshold:-1}),p(t)}try{const{package:t="",engine_config:s={inputs:[],outputs:[]}}=null!==(n=null==o?void 0:o.preload_ml)&&void 0!==n?n:{},c=(yield a.createEngine({scene:u.EScene.VIDEO_PRELOAD,modelUrl:t,inputs:null!==(i=null==s?void 0:s.inputs)&&void 0!==i?i:[],outputs:null!==(d=null==s?void 0:s.outputs)&&void 0!==d?d:[]})).inference({features:{}}),l=r.hitThresholdValue(c),{thresholdValue:m}=r.getInferenceStrategy();console.debug("[Video Preload] Inference result: ",c,"hit: ",l),p(l?u.EVideoSlideSpeed.Slow:u.EVideoSlideSpeed.Fast),h.F.handleModelPredict({hit:Number(l),scene:u.EScene.VIDEO_PRELOAD,predict_value:c,group_id:e,model_url:t,threshold:m})}catch(e){throw p(u.EVideoSlideSpeed.Normal),e}})))),r.reportInferenceResult())}},P=new Map,j=new Map,E=(e,t)=>{const[n,o]=(0,b.kH)((t=>{var n,i;return null!==(i=null===(n=t[e])||void 0===n?void 0:n.comments)&&void 0!==i?i:[]}),g.bN);return{comments:n,preloadCommentList:(e,n)=>(0,i.__awaiter)(void 0,void 0,void 0,(function*(){var i;if(!j.get(null==e?void 0:e.aweme_id))try{o.setCommentItem({item:{awemeId:null==e?void 0:e.aweme_id,loading:!0},itemId:null==e?void 0:e.aweme_id});const{comments:s,cursor:a,has_more:r,total:d}=yield c.h.get("/api/comment/list/",{query:Object.assign(Object.assign({},e),{count:20,aid:1988,app_language:"ja-JP",device_platform:"web_pc",current_region:"JP",fromWeb:1,enter_from:"tiktok_web"}),baseUrlType:2});j.set(e.aweme_id,{aweme_id:e.aweme_id,comments:null!==(i=s)&&void 0!==i?i:[],cursor:Number(a),has_more:Boolean(r),total:Number(d),fetch_type:"preload_by_ml"}),v.ao.handleCommentPreload({play_mode:t,group_id:e.aweme_id,preload_type:n})}catch(e){}finally{o.setCommentItem({item:{awemeId:null==e?void 0:e.aweme_id,loading:!1},itemId:null==e?void 0:e.aweme_id})}}))}},R=e=>{const t=(0,f.nr)();(0,_.useEffect)((()=>{var n,i;if(!l.f.dataCollectionEnabled)return;if("homepage_hot"!==e)return;const o=(0,p.V)(),s=new m.nu({biz:m.vh.TIKTOK_WEB_FYP,teaConfig:{teaInstance:l.f.getInstance(),channel_domain:null==o?void 0:o.tea,channel_type:null!==(n=null==o?void 0:o.teaChannelType)&&void 0!==n?n:"tcpy",channel:null!==(i=null==o?void 0:o.teaChannel)&&void 0!==i?i:"va"}});return null==s||s.observe(),()=>{null==s||s.destroy(),t.updatePredictedPreloadConfig({})}}),[])},T=(e,t)=>{var n,i;return t<0||t>=(null==e?void 0:e.length)?[]:(null!==(i=null===(n=null==e?void 0:e.slice)||void 0===n?void 0:n.call(e,t+1,t+5))&&void 0!==i?i:[]).map((e=>(0,C.ud)().getStaticItem(e))).map((e=>{var t;const{video:n,statsV2:i,id:o}=(0,y.L$)(e),{diggCount:s,commentCount:a,shareCount:r,playCount:d,collectCount:c}=(0,y.L$)(i);return{group_id:o,duration:null!==(t=null==n?void 0:n.duration)&&void 0!==t?t:0,like_cnt:Number(null!=s?s:0),comment_cnt:Number(null!=a?a:0),share_cnt:Number(null!=r?r:0),play_cnt:Number(null!=d?d:0),collect_cnt:Number(null!=c?c:0)}}))}},5412:(e,t,n)=>{n.d(t,{ao:()=>c,uO:()=>i});var i,o,s=n(58632),a=n(93608),r=n(92603),d=n(40040);!function(e){e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded"}(i||(i={})),function(e){e.Original="original",e.Reply="reply",e.ReplyToReply="reply_to_reply"}(o||(o={}));const c={handleCommentClick:e=>{a.f.sendEvent("click_comment_button",e)},handleCommentLike:e=>{var{isLike:t}=e,n=(0,s.__rest)(e,["isLike"]);const i=t?"like_comment":"cancel_like_comment";a.f.sendEvent(i,n)},handlePostComment:e=>{const t=(0,r.Hd)(d.DK);a.f.sendEvent("post_comment",Object.assign(Object.assign({},e),{from_group_id:t}))},handleShowMoreReply:e=>{a.f.sendEvent("show_more_reply",e)},handleCommentShow:e=>{a.f.sendEvent("video_comment_show",e)},handleSearchAt:e=>{a.f.sendEvent("search_comment_at",e)},handleSelectAt:e=>{a.f.sendEvent("add_comment_at",e)},handleEmojiSelect:e=>{a.f.sendEvent("search_comment_emoji",e)},handleClose:e=>{a.f.sendEvent("close_comment",e)},handleLeaveComment:e=>{a.f.sendEvent("leave_commet_page",e)},handleKeepComment:e=>{a.f.sendEvent("keep_editing_comment",e)},handleCopyCommentUrl:e=>{a.f.sendEvent("web_comment_url",e)},handleTapComment:e=>{a.f.sendEvent("tap_comment",e)},handleCloseCommentTab:()=>{a.f.sendEvent("close_comment_tab",{enter_method:"click_cancel"})},handleCloseCommentPanel:e=>{a.f.sendEvent("close_comment",e)},handleMentionItemShow:e=>{a.f.sendEvent("tag_mention_head_show",Object.assign(Object.assign({},e),{function:"mention"}))},handleClickBackToTop:e=>{a.f.sendEvent("click_back_to_top",e)},handleCommentModuleExpose:e=>{a.f.sendEvent("reply_module_show",{type:e.type})},handleCommentExpose:e=>{a.f.sendEvent("reply_show",Object.assign({},e))},handleCommentIconClick:e=>{a.f.sendEvent("comment_icon_click",e)},handleCommentPanelClose:e=>{a.f.sendEvent("comment_panel_close",e)},handleCommentSeeMoreClick:()=>{a.f.sendEvent("comment_see_more_click")},handleCommentLoadComplete:e=>{a.f.sendEvent("comments_load_complete",e)},handleCommentLoadMore:e=>{a.f.sendEvent("comment_load_more",e)},handleCommentPreload:e=>{a.f.sendEvent("comments_preload",e)}}}}]);