"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[2261],{32329:(e,t,i)=>{i.d(t,{VH:()=>s,yX:()=>c});var o=i(71111),n=i(31209);const s=(0,o.atom)({redDotCount:0,hasVisitedFollowing:!1});s.debugLabel="followingRedDotAtom";const{useAtomService:a,useServiceDispatchers:l,useServiceState:r,getStaticApi:c}=(0,n.i)(s,((e,t)=>({setRedDotCount(e){t(s,(t=>Object.assign(Object.assign({},t),{redDotCount:e})))},setHasVisitedFollowing(e){t(s,(t=>Object.assign(Object.assign({},t),{hasVisitedFollowing:e})))}})))},84798:(e,t,i)=>{i.d(t,{BP:()=>r,E4:()=>o,Nr:()=>a,Sb:()=>s,ri:()=>n,zv:()=>l});const o=[500,3,2,6,7],n=[500,505,2,6,7],s={661:{value:661,label:"inbox_all_activity"},47:{value:47,label:"system_notifications_inbox_channel_name_accountupdates"},12:{value:12,label:"system_notifications_inbox_channel_name_tiktok"},61:{value:61,label:"system_notifications_inbox_channel_name_creatormonetization"},21:{value:21,label:"system_notifications_inbox_channel_name_adssupport"},82:{value:82,label:"system_notifications_inbox_channel_name_businessaccount"},81:{value:81,label:"promote_title"},212:{value:212,label:"TTweb_inbox_systemNotificationchannel_brandActivity_name"},215:{value:215,label:"TTweb_inbox_systemNotificationchannel_tiktokPlatform_name"},218:{value:218,label:"TTweb_inbox_systemNotificationchannel_adsFeedback_name"},223:{value:223,label:"TTweb_inbox_systemNotificationchannel_missions_name"},224:{value:224,label:"system_notifications_inbox_channel_name_transactionassistant"},249:{value:249,label:"TTweb_inbox_systemNotificationchannel_creatorProgram_name"},254:{value:254,label:"system_notifications_inbox_channel_name_live"},255:{value:255,label:"TTweb_inbox_systemNotificationchannel_screenTime_name"},256:{value:256,label:"TTweb_inbox_systemNotificationchannel_mlbb_name"},262:{value:262,label:"TTweb_inbox_systemNotificationchannel_series_name"},272:{value:272,label:"TTweb_inbox_systemNotificationchannel_creatorMarketplace_name"},274:{value:274,label:"TTweb_inbox_systemNotificationchannel_effects_name"}},a={661:"all",47:"account_updates",12:"tiktok",61:"creator_monetization",21:"ads_support",82:"business_account",81:"promotions",212:"brand_activity",215:"tiktok_platform",218:"ads_feedback",223:"missions",224:"transaction_assistant",249:"creator_program",254:"live",255:"screen_time",256:"mlbb",262:"series",272:"creator_marketplace",274:"effects"},l={500:"all",2:"comments",7:"followers",3:"likes",505:"likes",6:"mentions"},r=3},29039:(e,t,i)=>{i.d(t,{wU:()=>f,pz:()=>p,tP:()=>v});var o=i(18499),n=i(71281),s=i(22248),a=i(54888),l=i(71111),r=i(31209),c=i(32329),u=i(84798),d=i(39228),m=function(e,t,i,o){return new(i||(i=Promise))((function(n,s){function a(e){try{r(o.next(e))}catch(e){s(e)}}function l(e){try{r(o.throw(e))}catch(e){s(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,l)}r((o=o.apply(e,t||[])).next())}))},_=function(e,t,i,o){return new(i||(i=Promise))((function(n,s){function a(e){try{r(o.next(e))}catch(e){s(e)}}function l(e){try{r(o.throw(e))}catch(e){s(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,l)}r((o=o.apply(e,t||[])).next())}))};const p=(0,l.atom)({noticeCount:[],reportInbox:{noticeList:[],count:0},isFooterRequest:!1});p.debugLabel="inboxCountAtom";const{useAtomService:g,useServiceDispatchers:v,useServiceState:h,getStaticApi:f}=(0,r.i)(p,((e,t)=>({setNoticeCount(e){t(p,(t=>Object.assign(Object.assign({},t),{noticeCount:"function"==typeof e?e(t.noticeCount):e})))},setIsFooterRequest(e){t(p,(t=>Object.assign(Object.assign({},t),{isFooterRequest:e})))},setReportInboxNoticeList(e){t(p,(t=>Object.assign(Object.assign({},t),{reportInbox:Object.assign(Object.assign({},t.reportInbox),{noticeList:e})})))},setReportInboxNoticeCount(e){t(p,(t=>Object.assign(Object.assign({},t),{reportInbox:Object.assign(Object.assign({},t.reportInbox),{count:e})})))},updateNoticeList(e){var t,i;if(0===e.status_code){const s="v0"!==(null!==(t=(0,n.d)("webapp_repost_notice"))&&void 0!==t?t:"v0");let a=0;const l=(null!==(i=e.notice_count)&&void 0!==i?i:[]).filter((e=>(5===e.group&&e.count>0&&(a=e.count),!!(661===e.group||s&&509===e.group)||(s?u.ri:u.E4).indexOf(e.group)>=0&&500!==e.group)));(0,o.unstable_batchedUpdates)((()=>{this.setNoticeCount(l),this.setIsFooterRequest(!0),(0,c.yX)().setRedDotCount(a)}))}},fetchNoticeCount(){return _(this,void 0,void 0,(function*(){try{const e=yield function(){return m(this,void 0,void 0,(function*(){return d.hd.get("/api/inbox/notice_count/",{baseUrlType:2})}))}();(0,s.G)(e.status_code,[0]),this.updateNoticeList(e)}catch(e){}}))},fetchReportInbox(t){var i;return _(this,void 0,void 0,(function*(){const{region:n="",language:s=""}=t,{bizContext:l}=e(a.A);try{const{notice_lists:e}=yield function(e){return m(this,void 0,void 0,(function*(){return d.hd.get("/aweme/v1/report/inbox/notice",{query:e,baseUrlType:2})}))}({request_tag_from:(null==l?void 0:l.isMobile)?"h5":"pc",carrier_region:n,sys_region:n,current_region:n,locale:s});if(!e)return;const{notice_list:t}=e[0];if(!t)return;const a=!1===(null===(i=t[0])||void 0===i?void 0:i.has_read)?1:0;(0,o.unstable_batchedUpdates)((()=>{this.setReportInboxNoticeList(t),this.setReportInboxNoticeCount(a)}))}catch(e){}}))},updateUnreadCount(e,t){const i=new Set([500]);switch(e){case 33:case 23:i.add(7);break;case 31:i.add(2);break;case 261:case 41:i.add(505);break;case 45:i.add(6);break;case 228:case 302:i.add(509)}const o="unread"===t?1:-1;this.setNoticeCount((e=>e.map((e=>i.has(e.group)?Object.assign(Object.assign({},e),{count:Math.max(e.count+o,0)}):e))))}})))},22224:(e,t,i)=>{i.d(t,{Hp:()=>u,eh:()=>a,i7:()=>c,jx:()=>r,nG:()=>l});var o,n=i(71111),s=i(31209);!function(e){e.Main="main",e.ReportInbox="report-inbox",e.SystemNotif="system-notif"}(o||(o={}));const a=(0,n.atom)({activePage:"main",activeGroup:500,isShowing:!1,isFollowRequestShowing:!1,expandedLikeItem:null});a.debugLabel="inboxAtom";const{useAtomService:l,useServiceState:r,useServiceDispatchers:c,getStaticApi:u}=(0,s.i)(a,((e,t)=>({setActivePage(e){t(a,(t=>Object.assign(Object.assign({},t),{activePage:e})))},setActiveGroup(e){t(a,(t=>Object.assign(Object.assign({},t),{activeGroup:e})))},setIsShowing(e){t(a,(t=>Object.assign(Object.assign({},t),{isShowing:e})))},setIsFollowRequestShowing(e){t(a,(t=>Object.assign(Object.assign({},t),{isFollowRequestShowing:e})))},setExpandedLikeItem(e){t(a,(t=>Object.assign(Object.assign({},t),{expandedLikeItem:e})))}})))},73611:(e,t,i)=>{i.d(t,{Ap:()=>r,K5:()=>l,PS:()=>c});var o=i(71111),n=i(31209);const s={isDrawerOpen:!1,isNavFullOpen:!0,drawerType:void 0,moreDrawerNestedMenu:3},a=(0,o.atom)(s);a.debugLabel="leftNavDrawerAtom";const{useAtomService:l,useServiceState:r,useServiceDispatchers:c}=(0,n.i)(a,((e,t)=>({closeDrawer(){t(a,(e=>Object.assign(Object.assign({},e),{isDrawerOpen:!1,moreDrawerNestedMenu:3,isNavFullOpen:!0})))},completeCloseDrawer(){t(a,s)},openDrawer(i){const o=e(a);o.isDrawerOpen&&this.closeDrawer(),t(a,(()=>Object.assign(Object.assign({},o),{isDrawerOpen:!0,drawerType:i})))},completeOpenDrawer(){t(a,(e=>Object.assign(Object.assign({},e),{isNavFullOpen:!1})))},changeMoreNestedMenu(i){const o=e(a);t(a,(()=>Object.assign(Object.assign({},o),{moreDrawerNestedMenu:i})))}})))},18271:(e,t,i)=>{i.d(t,{A:()=>k});var o=i(24643),n=i(40099),s=i(93608),a=i(58542),l=i(47172),r=i(2584),c=i(25754),u=i(30023),d=i(84908),m=i(60072),_=i(7089),p=i(25616),g=i(60484),v=i(49057),h=i(5441),f=i(32125);const b="Inbox_Message",y={[-1]:"Follow",0:"Follow",1:"Following",3:"requested",2:"friends",4:"webapp_unblocked_button1",5:"Follow",6:"Inbox_Follow_back"};var w=i(88114),N=i(93240);const x={Follow:"follow_back_button",Following:"unfollow_button",friends:"friends_button",webapp_unblocked_button1:"unblock_button",requested:void 0,Inbox_Follow_back:"follow_back_button",Inbox_Message:"message_button"},k=(0,n.memo)((({isPopup:e,user:t})=>{var i,k;const j=(0,n.useContext)(N.V),I=(0,n.useCallback)((t=>{const i=x[t];s.f.sendEvent("click_notification",{enter_method:e?"notification_popup":"notification_panel",click_section:i})}),[e]),{handleFollow:S,isFollowing:q,text:C,relation:L}=function({uniqueId:e,followerStatus:t,prevent:i,onNeedLogin:o,teaParams:s={},isInLiveCard:a=!1,liveCardTeaParams:w={},liveFollowStatus:N,uidForMessage:x,onClickFollow:k}){const j=(0,p.s)(),I=(0,l.useHistory)(),{user:S,language:q="en"}=(0,g.L$)((0,v.W)((()=>["user","language"]),[])),C=Boolean(S),L=Boolean(x),A=function({lang:e,uid:t}){const i=(0,_.VR)((e=>e.businessPermission),f.bN),{isElectronApp:o}=(0,h.B)();return{path:i.message?`/business-suite/messages?from=homepage&lang=${e}&u=${t}`:`/messages?lang=${e}&u=${t}`,target:o&&i.message?"_blank":void 0}}({lang:q,uid:x}),[{relation:O,secUid:F},R]=(0,d.JY)((t=>{var i,o,n,s;return{relation:null!==(o=null===(i=t.users[e])||void 0===i?void 0:i.relation)&&void 0!==o?o:-1,secUid:null!==(s=null===(n=t.users[e])||void 0===n?void 0:n.secUid)&&void 0!==s?s:""}}),f.bN),T=((e,t,i=!1)=>{if(i&&(1===e||2===e))return b;if(1===t){if(e<1)return"Inbox_Follow_back";if(1===e)return y[2]}return y[e]})(O,t,L),D=j(T);(0,n.useEffect)((()=>{a&&R.setUserRelation({uniqueId:e,relation:Number(null!=N?N:0)})}),[]);const P=(0,m.mG)(),{play_mode:M,group_id:B}=s,U=(0,n.useCallback)((t=>{var n;return i&&(t.preventDefault(),t.stopPropagation()),null==k||k(T),r.O.handleGeneralClick("follow",{scene:null!==(n=s.scene)&&void 0!==n?n:"video_feed",group_id:B,play_mode:M}),C?4===O?R.blockOrUnblockUser({uniqueId:e,secUid:F,isBlock:!0}):T===b?(c.w.handleEnterChatList(void 0,"click_noti"),void(A.target?window.open(A.path,A.target):I.push(A.path))):(R.postCommitFollowUser(Object.assign(Object.assign({},s),{uniqueId:e,useFollowV2:!1})),1!==O&&P.addMlModelTrainData({id:s.group_id,action:"follow"}),void(a&&(1===O?u.YH.handleUnFollow(w):u.YH.handleFollow(w)))):null==o?void 0:o()}),[i,k,T,s,B,M,C,O,R,e,a,o,F,A.target,A.path,I,P,w]);return{isFollowing:1===O||2===O,text:D,handleFollow:U,relation:O}}({uniqueId:null!==(i=null==t?void 0:t.uniqueId)&&void 0!==i?i:"",followerStatus:null===(k=null==t?void 0:t.extraInfo)||void 0===k?void 0:k.followerStatus,prevent:!0,teaParams:{enter_from:s.f.commonParams.page_name},uidForMessage:e?null==t?void 0:t.id:void 0,onClickFollow:I}),A=(0,n.useCallback)((e=>{var t;null===(t=null==j?void 0:j.onInteract)||void 0===t||t.call(j),S(e)}),[S,j]),O=(0,n.useCallback)((e=>{var t;"Enter"!==e.key&&" "!==e.key||(null===(t=null==j?void 0:j.onInteract)||void 0===t||t.call(j),S(e))}),[j,S]);return e?(0,o.jsx)(a.I05,{"data-e2e":2===L?"":"follow-back",label:C,shape:"borderless",size:"xsmall",onClick:A,onKeyDown:O,disabled:3===L}):(0,o.jsxs)(w.MI,{"data-e2e":2===L?"":"follow-back",onClick:A,onKeyDown:O,size:"tiny",buttonTheme:q?"default":"primary",children:[2===L?(0,o.jsx)(a.nDe,{}):null,C]})}))},84951:(e,t,i)=>{i.d(t,{A4:()=>d,DW:()=>c,VQ:()=>r,i8:()=>m,xB:()=>u});var o=i(40099),n=i(57431),s=i(93608),a=i(82535),l=i(93240);function r({uniqueId:e,onClick:t,enterMethod:i,enterFrom:r,previousPage:c,shouldHandleDom:u,notifClickParams:d}){const m=(0,o.useContext)(l.V),_=(0,o.useMemo)((()=>(0,n.x)().user),[]),p=(null==_?void 0:_.uniqueId)===e;return(0,o.useCallback)((e=>{var o,n;let l=i;u&&(l=null!==(o=function(e){let t=e.target;for(;t&&!t.dataset.method&&t!==e.currentTarget;)t=t.parentElement;return null==t?void 0:t.dataset.method}(e))&&void 0!==o?o:i),null==t||t(e),null===(n=null==m?void 0:m.onInteract)||void 0===n||n.call(m),d&&s.f.sendEvent("click_notification",{enter_method:d.enterMethod,click_section:d.clickSection});const _=s.f.commonParams.page_name,g={enter_method:l,page_name:null!=r?r:_,enter_from:null!=r?r:_,previous_page:null!=c?c:_};p?a.q.handleEnterProfile(g):a.q.handleEnterUser(g)}),[i,u,t,m,d,r,c,p])}function c({onClick:e,isPopup:t}){const i=(0,o.useContext)(l.V);return(0,o.useCallback)((o=>{var n;o.preventDefault(),o.stopPropagation(),s.f.sendEvent("click_notification",{enter_method:t?"notification_popup":"notification_panel",click_section:"other_places"}),e&&(e(o),null===(n=null==i?void 0:i.onInteract)||void 0===n||n.call(i))}),[i,t,e])}function u({itemId:e,authorId:t}){return(0,o.useCallback)((()=>{a.q.handleEnterVideo({enter_method:"click_noti",group_id:e,to_group_id:e,to_author_id:t})}),[e,t])}function d({isPopup:e,itemId:t,authorId:i}){const n=(0,o.useContext)(l.V),a=u({itemId:t,authorId:i});return(0,o.useCallback)((t=>{var i;t.stopPropagation(),s.f.sendEvent("click_notification",{enter_method:e?"notification_popup":"notification_panel",click_section:"video_cover"}),null===(i=null==n?void 0:n.onInteract)||void 0===i||i.call(n),a()}),[n,e,a])}function m(){return(0,o.useMemo)((()=>{const{language:e}=(0,n.x)();return"ja-JP"===e||"zh-Hant-TW"===e||"zh-Hans"===e?"。":"."}),[])}},88114:(e,t,i)=>{i.d(t,{AZ:()=>u,Cw:()=>g,MI:()=>N,Oo:()=>v,PF:()=>_,VO:()=>f,aV:()=>d,e8:()=>h,h$:()=>m,ki:()=>b,ou:()=>p,qe:()=>w,xG:()=>y});var o=i(75431),n=i(62186),s=i(97397),a=i(31355),l=i(26290);const r=o.AH` --mask: radial-gradient(12px at calc(100% - 9px) calc(100% - 9px), #0000 98%, #000); mask: var(--mask); `,c=o.AH` display: flex; overflow: hidden; `,u=n.default.div` position: relative; height: 3rem; width: 3rem; `,d=n.default.div` ${e=>e.hasNoticeTypeIcon&&r}; `,m=n.default.div` position: absolute; bottom: 0; right: 0; height: ${e=>e.size}; width: ${e=>e.size}; `,_=n.default.div` display: flex; justify-content: space-between; align-items: center; padding-block-start: 14px; padding-inline: 16px; `,p=n.default.div` ${c} flex-direction: column; width: var(--width); `,g=n.default.div` ${c} padding-inline-end: 52px; justify-content: space-between; width: var(--width); `,v=n.default.div` ${c} justify-content: space-between; padding-inline: 16px; padding-block: 12px; min-height: 5rem; gap: 1rem; width: 100%; cursor: ${e=>e.$contentClickable?"pointer":"auto"}; `,h=n.default.div` ${c} align-items: center; gap: 1rem; flex: 1; `,f=n.default.div` ${c} align-items: center; justify-content: center; `,b=n.default.div` ${c} flex: 1; gap: 2px; flex-direction: column; `,y=(0,n.default)(l.F.P1)` overflow: hidden; text-overflow: ellipsis; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; `,w=(0,n.default)(a.N_)` flex: 0 0 56px; width: 56px; height: 80px; background: center no-repeat; background-size: cover; border-radius: 6px; `,N=(0,n.default)(s.y,{target:"efggbpu0"})({alignSelf:"center",flex:"0 0 auto","& > svg":{marginRight:"6px"}},"label:StyledFollowButtonInPanel;")},59909:(e,t,i)=>{i.d(t,{g:()=>v});var o=i(40099),n=i(47172),s=i(57431),a=i(84908),l=i(7089),r=i(60484),c=i(25616),u=i(5441),d=i(10646),m=i(97164),_=i(32125),p=i(69795),g=i(84951);function v({item:e,isPopup:t}){var i,v,h;const f=(0,r.L$)(e.comment.aweme),b=(0,o.useMemo)((()=>(0,s.x)().user),[]),y=(0,a.nW)((t=>{var i;return t.users[null!==(i=e.comment.comment.user.unique_id)&&void 0!==i?i:""]}),_.bN),w=(0,l.VR)((e=>e.businessPermission),_.bN),N=(0,n.useHistory)(),x=(0,c.s)(),{isElectronApp:k}=(0,u.B)(),j=(0,g.xB)({itemId:f.aweme_id,authorId:f.author.uid}),I=null===(h=null===(v=null===(i=f.video)||void 0===i?void 0:i.cover)||void 0===v?void 0:v.url_list)||void 0===h?void 0:h[0],S=(0,o.useMemo)((()=>w.comment&&f.author.uid===(null==b?void 0:b.uid)?`/business-suite/comments?video_id=${f.aweme_id}&comment_id=${e.comment.comment.cid}&from=homepage`:(0,p.TG)({uid:f.author.uid,awemeId:f.aweme_id,awemeType:f.aweme_type})),[w.comment,f.author.uid,f.aweme_id,f.aweme_type,e.comment.comment.cid,null==b?void 0:b.uid]),q=(0,o.useMemo)((()=>{var t,i;const{comment:o}=e,{comment_type:n,reply_comment:s}=o,a=null===(t=null==s?void 0:s.user)||void 0===t?void 0:t.uid;if(2===n||11===n){const e=a===(null==b?void 0:b.uid);return`${x(e?"Inbox_replied_to_your_comment":"Inbox_commented").replace(/%(s|@)/g,"")}${e?": ":""}${null!==(i=o.comment.text)&&void 0!==i?i:""}`}return 17===n||18===n?x("inbox_videoreply"):`${x("Inbox_commented").replace(/%(s|@)/g,"")}${o.comment.text}`}),[e,null==b?void 0:b.uid,x]),C=(0,o.useCallback)((e=>{d.Qq.setItem("highlight_comment",{id:e.comment.comment.cid,groupId:e.comment.aweme.aweme_id,uid:null==y?void 0:y.id,uniqueId:null==y?void 0:y.uniqueId,show:!0}),j();const t=`${S}?cid=${(0,m.X)(e.comment.comment.cid)}`;k?window.open(t,"_blank"):N.push(t,{browserMode:!0,cid:e.comment.comment.cid,vid:e.comment.aweme.aweme_id})}),[null==y?void 0:y.id,null==y?void 0:y.uniqueId,j,S,k,N]),L=(0,g.DW)({isPopup:t,onClick:(0,o.useCallback)((()=>{C(e)}),[e,C])}),A=(0,g.A4)({isPopup:t,itemId:f.aweme_id,authorId:f.author.uid});return{user:y,content:q,itemHref:S,coverUrl:I,handleClickNotice:L,handleClickVideoCover:A}}},39383:(e,t,i)=>{i.d(t,{U:()=>m});var o=i(24643),n=i(40099),s=i(47172),a=i(84908),l=i(25616),r=i(78662),c=i(32125),u=i(18271),d=i(84951);function m({item:e,isPopup:t}){var i;const m=(0,a.nW)((t=>{var i;return t.users[null!==(i=e.follow.from_user.unique_id)&&void 0!==i?i:""]}),c.bN),_=(0,s.useHistory)(),p=(0,l.s)(),g=(0,d.i8)(),v=(0,r.fJ)({uniqueId:null!==(i=null==m?void 0:m.uniqueId)&&void 0!==i?i:"",secUid:null==m?void 0:m.secUid}),h=(0,n.useMemo)((()=>0===e.follow.follow_button_type?p("Inbox_is_following_you").replace(/%s/g,"")+g:p("web_inappNotifs_startedFollowing",{s_nickname:""}).trim()),[e.follow.follow_button_type,g,p]),f=(0,n.useMemo)((()=>(0,o.jsx)(u.A,{user:m,isPopup:t})),[]),b=(0,d.VQ)({uniqueId:null==m?void 0:m.uniqueId,enterMethod:t?"notification_popup":"click_noti"}),y=(0,d.DW)({isPopup:t,onClick:(0,n.useCallback)((e=>{b(e),_.push(v)}),[_,b,v])});return{user:m,userHref:v,content:h,followButton:f,handleClickNotice:y}}},52757:(e,t,i)=>{i.d(t,{w:()=>f});var o=i(40099),n=i(47172),s=i(93608),a=i(81125),l=i(22224),r=i(73611),c=i(84908),u=i(60484),d=i(25616),m=i(10646),_=i(97164),p=i(32125),g=i(69795),v=i(84951),h=i(93240);function f({item:e,isPopup:t}){var i,f,b;const y=(0,u.L$)(e.digg.aweme),w=(0,o.useContext)(h.V),[N,x]=(0,l.nG)((e=>e.activeGroup)),k=(0,r.PS)(),j=(0,c.nW)((t=>{var i,o;return null!==(o=null===(i=e.digg.from_user)||void 0===i?void 0:i.flatMap((({unique_id:e})=>t.users[null!=e?e:""]||[])))&&void 0!==o?o:[]}),p.bN),I=(0,n.useHistory)(),S=(0,d.s)(),q=(0,v.i8)(),C=(0,v.xB)({itemId:y.aweme_id,authorId:y.author.uid}),L=null===(f=null===(i=y.video)||void 0===i?void 0:i.cover.url_list)||void 0===f?void 0:f[0],A=a.b.getInstance(),O=(0,o.useMemo)((()=>(0,g.TG)({uid:y.author.uid,awemeId:y.aweme_id,awemeType:y.aweme_type})),[y.author.uid,y.aweme_id,y.aweme_type]),F=(0,o.useMemo)((()=>{var t,i,o,n;if(1===e.digg.digg_type){if(void 0!==y.image_post_info){const e=null!==(o=null===(i=null===(t=y.image_post_info)||void 0===t?void 0:t.images)||void 0===i?void 0:i.length)&&void 0!==o?o:0;return S("photomode_inbox_liked",{num:e})}return`${S("Inbox_liked_your_video").replace(/%s/g,"")}${q}`}return 3===e.digg.digg_type?`${S("Inbox_liked_your_comment").replace(/%s/g,"")}: ${null===(n=e.digg.comment)||void 0===n?void 0:n.text}`:""}),[e.digg.digg_type,null===(b=e.digg.comment)||void 0===b?void 0:b.text,y.image_post_info,S,q]),R=(0,o.useCallback)((()=>{var i;t&&s.f.sendEvent("notification_panel_show",{enter_method:"notification_popup"}),A.handleEnterFold({tab_name:500===N?"all":"likes",group_id:null!==(i=e.digg.aweme.aweme_id)&&void 0!==i?i:""})}),[N,t,e.digg.aweme.aweme_id,A]),T=(0,o.useCallback)((e=>{var i,o,n;if(!e)return;const s=null!==(o=null===(i=e.digg.from_user)||void 0===i?void 0:i.length)&&void 0!==o?o:0;if(3===e.digg.digg_type||1===s){let t,i=O;3===e.digg.digg_type&&(null===(n=e.digg.comment)||void 0===n?void 0:n.cid)&&(m.Qq.setItem("highlight_comment",{id:e.digg.comment.cid,groupId:y.aweme_id,show:!0}),t={browserMode:!0,cid:e.digg.comment.cid,vid:y.aweme_id},i=`${O}?cid=${(0,_.X)(e.digg.comment.cid)}`),C(),I.push(i,t)}else s>1&&(t&&(null==w||w.dismissAll(),x.setIsFollowRequestShowing(!1),k.openDrawer(0),x.setIsShowing(!0)),x.setExpandedLikeItem(e),R())}),[O,C,I,y.aweme_id,t,x,R,w,k]),D=(0,v.DW)({isPopup:t,onClick:(0,o.useCallback)((()=>{T(e)}),[e,T])}),P=(0,v.A4)({isPopup:t,itemId:y.aweme_id,authorId:y.author.uid});return{users:j,content:F,itemHref:O,coverUrl:L,handleClickNotice:D,handleClickVideoCover:P}}},70836:(e,t,i)=>{i.d(t,{h:()=>_});var o=i(40099),n=i(47172),s=i(84908),a=i(60484),l=i(25616),r=i(10646),c=i(97164),u=i(32125),d=i(69795),m=i(84951);function _({item:e,isPopup:t}){var i,_,p,g,v,h,f;const b=(0,a.L$)(e.at.aweme),y=(0,s.nW)((t=>{var i,o;return t.users[null!==(o=null===(i=e.at.user_info)||void 0===i?void 0:i.unique_id)&&void 0!==o?o:""]}),u.bN),w=(0,n.useHistory)(),N=(0,l.s)(),x=(0,m.xB)({itemId:b.aweme_id,authorId:null!==(_=null===(i=b.author)||void 0===i?void 0:i.uid)&&void 0!==_?_:""}),k=null===(v=null===(g=null===(p=b.video)||void 0===p?void 0:p.cover)||void 0===g?void 0:g.url_list)||void 0===v?void 0:v[0],j=(0,o.useMemo)((()=>{var e,t;return(0,d.TG)({uid:null===(e=b.author)||void 0===e?void 0:e.uid,awemeId:null!==(t=b.aweme_id)&&void 0!==t?t:"",awemeType:b.aweme_type})}),[b.author.uid,b.aweme_id,b.aweme_type]),I=(0,o.useMemo)((()=>{var t,i,o;const{at:n}=e,{sub_type:s,content:a,aweme:l}=n,r=void 0!==(null==l?void 0:l.image_post_info);if(1===s){if(r){const e=null!==(o=null===(i=null===(t=l.image_post_info)||void 0===t?void 0:t.images)||void 0===i?void 0:i.length)&&void 0!==o?o:0;return N("in_app_push_mention_in_photo",{num:e})}return N("Inbox_mentioned_you_in_a_video").replace(/%(s|#)/g,"")}return 2===s?`${N("Inbox_mentioned_you_in_a_comment").replace("%@"," ").replace("%#","")}${a}`:5===s?`${N("Inbox_replied_to_your_comment").replace("%s","")}${a}`:""}),[e,N]),S=(0,o.useCallback)((e=>{var t,i,o;const{schema_url:n}=e.at,s=(null!==(t=null==n?void 0:n.match(/cid=(\d+)/))&&void 0!==t?t:[])[1],a=(null!==(i=null==n?void 0:n.match(/detail\/(\d+)/))&&void 0!==i?i:[])[1];let l;s&&(r.Qq.setItem("highlight_comment",{id:s,groupId:a,show:!0}),l={browserMode:!0,cid:s,vid:a}),x();let u=j;(null===(o=e.at.comment)||void 0===o?void 0:o.cid)&&(u=`${j}?cid=${(0,c.X)(e.at.comment.cid)}`),w.push(u,l)}),[x,j,w]),q=(0,m.DW)({isPopup:t,onClick:(0,o.useCallback)((()=>{S(e)}),[S,e])}),C=(0,m.A4)({isPopup:t,itemId:b.aweme_id,authorId:null!==(f=null===(h=b.author)||void 0===h?void 0:h.uid)&&void 0!==f?f:""});return{user:y,content:I,itemHref:j,coverUrl:k,handleClickNotice:q,handleClickVideoCover:C}}},91505:(e,t,i)=>{i.d(t,{A:()=>d});var o=i(40099),n=i(47172),s=i(84908),a=i(25616),l=i(32125),r=i(69795),c=i(84951);const u={228:"pcWeb_inbox_repostedSame",261:"pcWeb_inbox_likedRepost",302:"pcWeb_inbox_repostedYour"};function d({item:e,isPopup:t}){const i=(0,s.nW)((t=>{var i,o,n,s;return null!==(s=null===(n=null===(o=null===(i=e.template_notice.notice)||void 0===i?void 0:i.title)||void 0===o?void 0:o.from_users)||void 0===n?void 0:n.flatMap((({unique_id:e})=>t.users[null!=e?e:""]||[])))&&void 0!==s?s:[]}),l.bN),d=(0,n.useHistory)(),m=(0,a.s)(),{awemeId:_,authorId:p,coverUrl:g,isPhotoMode:v}=(0,r.c)(e),h=(0,c.xB)({itemId:null!=_?_:"",authorId:null!=p?p:""}),f=(0,o.useMemo)((()=>(0,r.TG)({uid:null!=p?p:"",awemeId:null!=_?_:"",awemeType:v?150:void 0})),[p,_,v]),b=(0,o.useMemo)((()=>228===e.type||261===e.type||302===e.type?m(u[e.type]):""),[e,m]),y=(0,c.DW)({isPopup:t,onClick:(0,o.useCallback)((()=>{h(),d.push(f)}),[h,d,f])}),w=(0,c.A4)({isPopup:t,itemId:null!=_?_:"",authorId:null!=p?p:""});return{users:i,content:b,itemHref:f,coverUrl:g,handleClickVideoCover:w,handleClickNotice:y}}},93240:(e,t,i)=>{i.d(t,{V:()=>s,p:()=>a});var o=i(24643),n=i(40099);const s=(0,n.createContext)(void 0),a=e=>{var{toastId:t,notification:i,dismiss:a,dismissAll:l,onInteract:r}=e,c=function(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n{null==r||r(i)}),[r,i]),d=(0,n.useMemo)((()=>({toastId:t,notification:i,dismiss:a,dismissAll:l,onInteract:u})),[t,i,a,l,u]);return(0,o.jsx)(s.Provider,Object.assign({value:d},c))}},69795:(e,t,i)=>{i.d(t,{BS:()=>l,TG:()=>r,c:()=>c,uV:()=>u});var o=i(57431),n=i(78662),s=i(60484);const a=[228,261,302],l={isFollowRequest:e=>!("type"in e)&&"users"in e,isFollowNotice:e=>"type"in e&&33===e.type&&Boolean(e.follow),isFollowApprovalNotice:e=>"type"in e&&23===e.type&&Boolean(e.follow_request_approve),isLikeNotice:e=>"type"in e&&41===e.type&&Boolean(e.digg),isCommentNotice:e=>"type"in e&&31===e.type&&Boolean(e.comment),isDuetNotice:e=>"type"in e&&21===e.type&&Boolean(e.duet),isMentionNotice:e=>"type"in e&&45===e.type&&Boolean(e.at),isReportInboxNotice:e=>"type"in e&&213===e.type&&Boolean(e.template_notice),isRepostInboxNotice:e=>"type"in e&&a.includes(e.type)&&Boolean(e.template_notice)};function r({uid:e,awemeId:t,awemeType:i}){return(0,n.yw)({uniqueId:e,secUid:e,itemId:t,isPhoto:150===i})}function c(e){var t,i,n,s,a,l;const r=null===(t=e.template_notice.extra_data)||void 0===t?void 0:t.nudge_info,c=e.template_notice.notice;let{aweme_id:u,author_id:d,cover_url:m,aweme_type:_}=null!=r?r:{};if(m||(m=null===(n=null===(i=null==c?void 0:c.image_url)||void 0===i?void 0:i.url_list)||void 0===n?void 0:n[0]),u||(u=null===(a=null===(s=null==c?void 0:c.right_schema_url)||void 0===s?void 0:s.match(/\/detail\/(\d+)/))||void 0===a?void 0:a[1]),!d&&302===e.type){const{user:e}=(0,o.x)();d=null==e?void 0:e.uid}return{isPhotoMode:150===_||null!==(l=null==m?void 0:m.includes("photomode"))&&void 0!==l&&l,awemeId:u,authorId:d,coverUrl:m}}function u(e){var t;if(l.isLikeNotice(e))return void 0!==(0,s.L$)(e.digg.aweme).image_post_info?"photo_like":3===e.digg.digg_type?"comment_like":"video_like";if(l.isCommentNotice(e)){const{comment:i}=e,{comment_type:n,reply_comment:s}=i,a=null===(t=null==s?void 0:s.user)||void 0===t?void 0:t.uid;if(2===n||11===n){const e=(0,o.x)().user;return a===(null==e?void 0:e.uid)?"reply_to_comment":"video_comment"}return"video_comment"}if(l.isMentionNotice(e)){const{at:t}=e,{sub_type:i}=t;if(1===i)return"tagged_in_video";if(2===i)return"tagged_in_comment";if(5===i)return"reply_to_comment"}return l.isRepostInboxNotice(e)?"repost_video":l.isFollowRequest(e)?"follow_request":l.isFollowNotice(e)?"follow":l.isFollowApprovalNotice(e)?"accept_follow_request":"unknown"}},52261:(e,t,i)=>{i.d(t,{Cp:()=>Je,P4:()=>We,Kd:()=>Ke});var o=i(58632),n=i(40099),s=i(24643),a=i(48514),l=i(47172),r=i(93608),c=i(58542),u=i(25616),d=i(26290),m=i(69795),_=i(88114),p=i(46803),g=i(58305),v=i(78662),h=i(31355),f=i(84951);const b="1.125rem",y={41:(0,s.jsx)(c.Twf,{size:b}),45:(0,s.jsx)(c.HEM,{size:b}),302:(0,s.jsx)(c.lqC,{size:b}),31:(0,s.jsx)(c.rs3,{size:b})},w=(0,n.memo)((({noticeType:e})=>e in y?(0,s.jsx)(_.h$,{size:b,children:y[e]}):null)),N=(0,n.memo)((({noticeType:e,users:t})=>{var i,o;const n=(0,u.s)(),a=(0,f.VQ)({uniqueId:null===(i=t[0])||void 0===i?void 0:i.uniqueId,enterMethod:"click_head",notifClickParams:{enterMethod:"notification_popup",clickSection:"profile_picture"}});if(0===t.length)return null;const l=e in y,r=l?(0,s.jsx)(w,{noticeType:e}):null;if(1===t.length){const{uniqueId:e="",secUid:i,nickname:u}=null!==(o=t[0])&&void 0!==o?o:{},d=(0,v.fJ)({uniqueId:e,secUid:i});return(0,s.jsx)(_.AZ,{onClick:g.dG,children:(0,s.jsxs)(h.N_,{to:d,onClick:a,"aria-label":n("accessibilityLabels_link_userProfile",{username:u}),children:[(0,s.jsx)(_.aV,{"data-e2e":"notice-avatar",hasNoticeTypeIcon:l,children:(0,s.jsx)(c.pfZ,{src:t[0].avatarThumb,alt:n("editprofile_editpage_photo"),size:48})}),r]})})}return(0,s.jsxs)(_.AZ,{onClick:g.dG,children:[(0,s.jsx)(_.aV,{"data-e2e":"notice-avatar-multiple",hasNoticeTypeIcon:l,children:(0,s.jsx)(c.pmp,{frontImageSrc:t[0].avatarThumb,backImageSrc:t[1].avatarThumb,alt:n("editprofile_editpage_photo"),size:48})}),r]})})),x=(0,n.memo)((function({user:e}){const t=(0,u.s)(),i=(0,f.VQ)({uniqueId:null==e?void 0:e.uniqueId,enterMethod:"click_name",notifClickParams:{enterMethod:"notification_popup",clickSection:"user_name"}});if(!e)return null;const{uniqueId:o,secUid:n,nickname:a}=e,l=(0,v.fJ)({uniqueId:o,secUid:n});return(0,s.jsx)(h.N_,{to:l,onClick:i,"aria-label":t("accessibilityLabels_link_userProfile",{username:a}),children:e.nickname})})),k=(0,n.memo)((({users:e,mergeCount:t})=>{const i=(0,u.s)(),o=e[1]?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x,{user:e[0]}),", ",(0,s.jsx)(x,{user:e[1]}),t>2&&(0,s.jsxs)(s.Fragment,{children:[" ",i("Inbox_and")," ",i("Inbox_others").replace(/%d/,String(t-2))]})]}):(0,s.jsx)(x,{user:e[0]});return(0,s.jsx)("div",{"data-e2e":"notice-title",onClick:g.dG,children:(0,s.jsx)(d.F.H4,{weight:"medium",children:o})})})),j=(0,n.memo)((({users:e,content:t,createTime:i,mergeCount:o,onClick:n,action:a,noticeType:l})=>{const{timeTranslator:r}=(0,p.T)();return(0,s.jsxs)(_.Oo,{"data-e2e":"notice-list-item",onClick:n,$contentClickable:void 0!==n,children:[(0,s.jsxs)(_.e8,{children:[(0,s.jsx)(N,{noticeType:l,users:e}),(0,s.jsxs)(_.ki,{"data-e2e":"notice-main",children:[(0,s.jsx)(k,{users:e,mergeCount:null!=o?o:e.length}),(0,s.jsx)(_.xG,{children:t}),(0,s.jsx)(d.F.P1,{color:"UIText3",children:r(1e3*Number(i))})]})]}),a&&(0,s.jsx)(_.VO,{onClick:g.dG,children:a})]})}));var I=i(59909);const S=(0,n.memo)((({item:e})=>{const{user:t,content:i,itemHref:o,coverUrl:n,handleClickNotice:a,handleClickVideoCover:l}=(0,I.g)({item:e,isPopup:!0});return t?(0,s.jsx)(j,{noticeType:e.type,users:[t],content:i,createTime:e.create_time,action:n?(0,s.jsx)(_.qe,{onClick:l,to:o,style:{backgroundImage:`url(${n})`}}):null,onClick:a}):null}));var q=i(39383);const C=(0,n.memo)((({item:e})=>{const{user:t,content:i,followButton:o}=(0,q.U)({item:e,isPopup:!0});return t?(0,s.jsx)(j,{noticeType:e.type,users:[t],content:i,createTime:e.create_time,action:o}):null}));var L=i(84908),A=i(32125);const O=(0,n.memo)((({item:e})=>{const{user:t,content:i}=function({item:e}){const t=(0,L.nW)((t=>{var i;return t.users[null!==(i=e.follow_request_approve.from_user.unique_id)&&void 0!==i?i:""]}),A.bN),i=(0,u.s)(),o=(0,f.i8)();return{user:t,content:(0,n.useMemo)((()=>i("Inbox_approved_your_follow_request").replace(/%s/g,"")+o),[o,i])}}({item:e});return t?(0,s.jsx)(j,{noticeType:e.type,users:[t],content:i,createTime:e.create_time}):null}));var F=i(81125),R=i(22224),T=i(73611),D=i(93240),P=i(39228),M=i(26325),B=function(e,t,i,o){return new(i||(i=Promise))((function(n,s){function a(e){try{r(o.next(e))}catch(e){s(e)}}function l(e){try{r(o.throw(e))}catch(e){s(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,l)}r((o=o.apply(e,t||[])).next())}))};const U=(0,n.memo)((({user:e,onAccept:t})=>{const i=(0,n.useContext)(D.V),o=(0,L.eI)(),a=(0,u.s)(),[l,d]=(0,n.useState)(!1),m=F.b.getInstance(),_=(0,n.useCallback)((e=>B(void 0,void 0,void 0,(function*(){m.handleFollowRequestAction({action:"accept",to_user_id:e}),yield function(e){return B(this,void 0,void 0,(function*(){return P.hd.post("/api/commit/follow/request/approve/",{query:{from_user_id:e,from:33},headers:{[M.nk]:P.hd.csrfToken}})}))}(e)}))),[m]),p=(0,n.useCallback)(((n,s)=>B(void 0,void 0,void 0,(function*(){var a;r.f.sendEvent("click_notification",{enter_method:"notification_popup",click_section:"accept_button"}),n.stopPropagation(),n.preventDefault(),e&&(null===(a=null==i?void 0:i.onInteract)||void 0===a||a.call(i),d(!0),o.setUserRelation({uniqueId:e.uniqueId,relation:1===e.relation?2:6,shouldUpdateFollowed:!0}),t(),yield _(s))}))),[e,i,o,t,_]),g=(0,n.useCallback)(((e,t)=>B(void 0,void 0,void 0,(function*(){"Enter"!==e.key&&" "!==e.key||(yield p(e,t))}))),[p]);return e?(0,s.jsx)(c.I05,{"data-e2e":"inbox-request-accept",label:a("inbox_request_accept"),"aria-label":a("inbox_request_accept"),shape:"borderless",size:"xsmall",onClick:t=>p(t,e.id),onKeyDown:t=>g(t,e.id),disabled:l}):null}));var G=i(18271);const E=(0,n.memo)((({item:e})=>{const{users:t,content:i,followButton:o,handleClickNotice:a}=function({item:e}){const t=(0,n.useContext)(D.V),i=(0,R.i7)(),o=(0,T.PS)(),a=(0,L.nW)((t=>e.users.flatMap((e=>t.users[e]||[]))),A.bN),l=(0,u.s)(),[c,d]=(0,n.useState)(!1),m=F.b.getInstance(),_=(0,n.useCallback)((()=>{r.f.sendEvent("notification_panel_show",{enter_method:"notification_popup"}),m.handleEnterFollow({request_cnt:Number(e.total)})}),[e.total,m]),p=(0,n.useMemo)((()=>l("web_inappNotifs_followRequest",{s_nickname:""}).trim()),[l]),g=(0,n.useMemo)((()=>1!==a.length?null:c?(0,s.jsx)(G.A,{user:a[0],isPopup:!0}):(0,s.jsx)(U,{user:a[0],onAccept:()=>d(!0)})),[c,a]),v=(0,n.useCallback)((()=>{var e;null==t||t.dismissAll(),null===(e=null==t?void 0:t.onInteract)||void 0===e||e.call(t),o.openDrawer(0),i.setIsShowing(!0),i.setIsFollowRequestShowing(!0),_()}),[t,o,i,_]),h=(0,f.DW)({isPopup:!0,onClick:v});return{users:a,content:p,followButton:g,handleClickNotice:a.length>1?h:void 0}}({item:e});return 0===t.length?null:(0,s.jsx)(j,{noticeType:33,users:t,mergeCount:Number(e.total),content:i,createTime:Date.now()/1e3,action:o,onClick:a})}));var $=i(52757);const H=(0,n.memo)((({item:e})=>{const{users:t,content:i,itemHref:o,coverUrl:n,handleClickNotice:a,handleClickVideoCover:l}=(0,$.w)({item:e,isPopup:!0});return 0===t.length?null:(0,s.jsx)(j,{noticeType:e.type,users:t,mergeCount:e.digg.merge_count,content:i,createTime:e.create_time,action:n?(0,s.jsx)(_.qe,{onClick:l,to:o,style:{backgroundImage:`url(${n})`}}):null,onClick:a})}));var V=i(70836);const z=(0,n.memo)((({item:e})=>{const{user:t,content:i,itemHref:o,coverUrl:n,handleClickNotice:a,handleClickVideoCover:l}=(0,V.h)({item:e,isPopup:!0});return t?(0,s.jsx)(j,{noticeType:e.type,users:[t],content:i,createTime:e.create_time,action:n?(0,s.jsx)(_.qe,{onClick:l,to:o,style:{backgroundImage:`url(${n})`}}):null,onClick:a}):null}));var W=i(91505);const Z=(0,n.memo)((({item:e})=>{var t,i,o;const{users:n,content:a,itemHref:l,coverUrl:r,handleClickNotice:c,handleClickVideoCover:u}=(0,W.A)({item:e,isPopup:!0});return 0===n.length?null:(0,s.jsx)(j,{noticeType:e.type,users:n,mergeCount:null!==(o=null===(i=null===(t=e.template_notice.notice)||void 0===t?void 0:t.title)||void 0===i?void 0:i.merge_count)&&void 0!==o?o:0,content:a,createTime:e.create_time,action:r?(0,s.jsx)(_.qe,{onClick:u,to:l,style:{backgroundImage:`url(${r})`}}):null,onClick:c})})),J=({notification:e})=>m.BS.isFollowRequest(e)?(0,s.jsx)(E,{item:e}):m.BS.isFollowNotice(e)?(0,s.jsx)(C,{item:e}):m.BS.isFollowApprovalNotice(e)?(0,s.jsx)(O,{item:e}):m.BS.isLikeNotice(e)?(0,s.jsx)(H,{item:e}):m.BS.isCommentNotice(e)?(0,s.jsx)(S,{item:e}):m.BS.isMentionNotice(e)?(0,s.jsx)(z,{item:e}):m.BS.isRepostInboxNotice(e)?(0,s.jsx)(Z,{item:e}):null,K=e=>{const t=(0,u.s)();return(0,s.jsxs)(_.ou,{children:[(0,s.jsx)(_.PF,{children:(0,s.jsx)(d.F.H3,{weight:"medium",children:t("web_inappNotifs_Notification_header")})}),(0,s.jsx)(J,Object.assign({},e))]})},X=e=>(0,s.jsxs)(_.Cw,{children:[(0,s.jsx)(J,Object.assign({},e)),(0,s.jsx)("div",{children:(0,s.jsx)(c.hIm,{direction:"vertical"})})]}),Q=(0,n.memo)((({id:e,dismiss:t,dismissAll:i,onInteract:o,layoutType:n,notification:a})=>{const l="withHeader"===n?K:X;return(0,s.jsx)(D.p,{toastId:e,notification:a,dismiss:t,dismissAll:i,onInteract:o,children:(0,s.jsx)(l,{notification:a})})}));let Y=1;var ee=i(26263),te=i(6585),ie=i(57431),oe=i(16085),ne=i(29039),se=i(88920),ae=i(52266),le=i(19442),re=i(84798),ce=i(18499),ue=i(300),de=i.n(ue),me=i(22248),_e=i(8800),pe=i(71111),ge=i(31209);function ve(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){return P.hd.get("/api/notice/multi/",{query:e,baseUrlType:2})}))}function he(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){return P.hd.get("/api/inbox/notice_list/",{query:e,baseUrlType:2})}))}var fe=i(40858);const be={has_more:1,max_time:0,min_time:0,notice_list:[],loading:!1},ye={diggList:{users:[],loading:!1,has_more:1,max_cursor:0,min_cursor:0},activeSystemNoticeGroup:null,noticeList:be,followRequest:{has_more:!1,min_time:0,total:0,users:[],loading:!1},latestSystemNotice:null},we=(0,pe.atom)(ye),Ne=(0,pe.atom)((e=>Object.assign(Object.assign({},e(we)),{inboxTabShowing:e(R.eh).isShowing,activeGroup:e(R.eh).activeGroup})),((e,t)=>{t(we,ye)}));let xe;Ne.debugLabel="noticeAtom";const{useAtomService:ke,useServiceState:je,useServiceDispatchers:Ie,getStaticApi:Se}=(0,ge.i)(Ne,((e,t)=>({setInboxTabShowing(e){(0,R.Hp)().setIsShowing(e)},setActiveGroup(e){(0,R.Hp)().setActiveGroup(e)},setActiveSystemNoticeGroup(e){t(we,(t=>Object.assign(Object.assign({},t),{activeSystemNoticeGroup:e})))},setNoticeList(e){t(we,(t=>Object.assign(Object.assign({},t),{noticeList:e})))},setNoticeListLoading(e){t(we,(t=>Object.assign(Object.assign({},t),{noticeList:Object.assign(Object.assign({},t.noticeList),{loading:e})})))},setLatestSystemNotice(e){t(we,(t=>Object.assign(Object.assign({},t),{latestSystemNotice:e})))},changeActiveGroup({group:e}){return(0,o.__awaiter)(this,void 0,void 0,(function*(){xe||(xe=F.b.getInstance()),xe.handleChangeTab({to_tab_name:re.zv[e]}),(0,ce.unstable_batchedUpdates)((()=>{this.setActiveGroup(e),this.setNoticeList(be)}));const t=[this.fetchNoticeData()];500===e&&t.push(this.fetchLatestSystemNotice()),yield Promise.all(t)}))},changeActiveSystemNoticeGroup(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){xe||(xe=F.b.getInstance()),xe.handleChangeSystemNotificationTab({to_tab_name:re.Nr[e]}),(0,ce.unstable_batchedUpdates)((()=>{this.setActiveSystemNoticeGroup(e),this.setNoticeList(be)})),yield this.fetchSystemNoticeData()}))},fetchNoticeData(t){var i;return(0,o.__awaiter)(this,void 0,void 0,(function*(){const{activeGroup:o,noticeList:n}=e(Ne),{fetchLatest:s,markAsRead:a}=null!=t?t:{};if(n.loading||!s&&!n.has_more)return;const l={count:20,is_mark_read:null==a||a?1:0,group:o,max_time:s?0:n.max_time,min_time:s?n.max_time:n.min_time};this.setNoticeListLoading(!0);try{const e=yield ve({aid:1988,group_list:JSON.stringify([l])});if((0,me.G)(e.status_code,[0]),0===e.status_code){const{notice_lists:t}=e;if(null==t?void 0:t.length){const{has_more:e,max_time:o,min_time:a,notice_list:l=[]}=t[0];l.forEach((e=>{(0,fe.mX)(e)}));const r=de()([...null!==(i=n.notice_list)&&void 0!==i?i:[],...l].sort(((e,t)=>Number(BigInt(t.create_time)-BigInt(e.create_time)))),(e=>{var t;return null!==(t=e.nid_str)&&void 0!==t?t:e.nid}));(0,ce.unstable_batchedUpdates)((()=>{(0,L.Gp)().multiSetUser(this.getNoticeUsers(l)),s?this.setNoticeList({has_more:n.has_more,max_time:r[0].create_time,min_time:n.min_time,notice_list:r,loading:!1}):this.setNoticeList({has_more:e,max_time:o,min_time:a,notice_list:r,loading:!1})}))}else this.setNoticeList({has_more:0,min_time:n.min_time,max_time:n.max_time,notice_list:n.notice_list,loading:!1})}}catch(e){this.setNoticeListLoading(!1)}}))},markAsRead(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){const t={count:1,is_mark_read:1,group:500,max_time:Number(e.create_time)+.001,min_time:e.create_time},i=(0,ne.wU)();try{i.updateUnreadCount(e.type,"read");const{status_code:o}=yield ve({aid:1988,group_list:JSON.stringify([t])});(0,me.G)(o,[0]),0!==o&&i.updateUnreadCount(e.type,"unread")}catch(e){}}))},fetchSystemNoticeData(){var t;return(0,o.__awaiter)(this,void 0,void 0,(function*(){const{activeSystemNoticeGroup:i,noticeList:o}=e(Ne);if(!o.loading&&o.has_more&&null!=i){this.setNoticeListLoading(!0);try{const e=yield he({aid:1988,group_list:JSON.stringify([{count:20,is_mark_read:1,group:i,max_time:o.max_time,min_time:o.min_time}])});if(0!==e.status_code)return void this.setNoticeListLoading(!1);const{notice_lists:n}=e;if(null==n?void 0:n.length){const{has_more:e,max_time:i,min_time:s,notice_list:a=[]}=n[0];this.setNoticeList({has_more:e?1:0,max_time:i,min_time:s,notice_list:[...null!==(t=o.notice_list)&&void 0!==t?t:[],...a],loading:!1})}else this.setNoticeList({has_more:0,min_time:o.min_time,max_time:o.max_time,notice_list:o.notice_list,loading:!1})}catch(e){}this.setNoticeListLoading(!1)}}))},fetchLatestSystemNotice(){var e,t;return(0,o.__awaiter)(this,void 0,void 0,(function*(){const i=yield he({aid:1988,group_list:JSON.stringify([{count:1,is_mark_read:0,group:661,max_time:0,min_time:0}])});if(0!==i.status_code)return;const{notice_lists:o}=i;(null==o?void 0:o.length)?this.setLatestSystemNotice(null!==(t=null===(e=o[0].notice_list)||void 0===e?void 0:e[0])&&void 0!==t?t:null):this.setLatestSystemNotice(null)}))},setDiggList(e){t(we,(t=>Object.assign(Object.assign({},t),{diggList:Object.assign(Object.assign({},t.diggList),{users:e})})))},setDiggListLoading(e){t(we,(t=>Object.assign(Object.assign({},t),{diggList:Object.assign(Object.assign({},t.diggList),{loading:e})})))},fetchDiggListData({ref_id:t}){var i;return(0,o.__awaiter)(this,void 0,void 0,(function*(){const{diggList:n}=e(Ne);if(n.loading||!n.has_more)return;const s={count:20,max_cursor:n.max_cursor,min_cursor:n.min_cursor,digg_type:1,ref_id:t,aid:1988};this.setDiggListLoading(!0);const a=yield function(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){return P.hd.get("/api/notice/digg/list/",{query:e,baseUrlType:2})}))}(s),l=(null!==(i=a.digg_infos)&&void 0!==i?i:[]).map((({simple_user:e})=>(0,_e.bg)(e)));(0,ce.unstable_batchedUpdates)((()=>{(0,L.Gp)().multiSetUser(l),this.setDiggList(l.map((({uniqueId:e})=>e))),this.setDiggListLoading(!1)}))}))},setNoticeFollowRequest(e){t(we,(t=>Object.assign(Object.assign({},t),{followRequest:e})))},setNoticeFollowRequestLoading(e){t(we,(t=>Object.assign(Object.assign({},t),{followRequest:Object.assign(Object.assign({},t.followRequest),{loading:e})})))},fetchNoticeFollowRequest({uid:t,refresh:i}){var n;return(0,o.__awaiter)(this,void 0,void 0,(function*(){const{followRequest:s}=e(Ne),a={user_id:t,count:20,max_time:i?0:s.min_time,aid:1988};this.setNoticeFollowRequestLoading(!0);try{const e=yield function(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){return P.hd.get("/api/user/following/request/list/",{query:e,baseUrlType:2})}))}(a);if((0,me.G)(e.status_code,[0]),0===e.status_code){const t=(null!==(n=e.request_users)&&void 0!==n?n:[]).map((e=>(0,_e.bg)(e))),o=t.map((({uniqueId:e})=>e));(0,ce.unstable_batchedUpdates)((()=>{(0,L.Gp)().multiSetUser(t),this.setNoticeFollowRequest({has_more:e.has_more,loading:!1,min_time:e.min_time,total:e.total,users:i?o:s.users.concat(o),from:"fetchNoticeFollowRequest"})}))}}catch(e){this.setNoticeFollowRequestLoading(!1)}}))},setNoticeFollowRequestReply(i){const{followRequest:o}=e(Ne),n=o.users.indexOf(i);n>=0&&t(we,(e=>{let t=e.followRequest.total;return"string"==typeof t?t=t.replace(/(.+?)(\d0*$)/,((e,t,i)=>t+String(Number(i)-1))):t-=1,Object.assign(Object.assign({},e),{followRequest:Object.assign(Object.assign({},e.followRequest),{users:e.followRequest.users.filter(((e,t)=>t!==n)),total:t})})}))},postFollowReply(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){const{approveOrReject:t,uniqueId:i,uid:n=""}=e;xe||(xe=F.b.getInstance()),xe.handleFollowRequestAction({action:0===t?"accept":"delete",to_user_id:n});const s=0===t?function(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){return P.hd.post("/api/commit/follow/request/approve/",{query:{from_user_id:e,from:33},headers:{[M.nk]:P.hd.csrfToken}})}))}(n):function(e){return(0,o.__awaiter)(this,void 0,void 0,(function*(){return P.hd.post("/api/commit/follow/request/reject/",{query:{from_user_id:e,from:33},headers:{[M.nk]:P.hd.csrfToken}})}))}(n);yield s,this.setNoticeFollowRequestReply(i)}))},getNoticeUsers:e=>e.reduce(((e,t)=>{var i,o,n,s;return fe.BS.isFollowNotice(t)&&e.push((0,_e.bg)(t.follow.from_user)),fe.BS.isFollowApprovalNotice(t)&&e.push((0,_e.bg)(t.follow_request_approve.from_user)),fe.BS.isLikeNotice(t)&&(null===(i=t.digg.from_user)||void 0===i||i.forEach((t=>e.push((0,_e.bg)(t))))),fe.BS.isCommentNotice(t)&&e.push((0,_e.bg)(t.comment.comment.user)),fe.BS.isDuetNotice(t)&&e.push((0,_e.bg)(t.duet.aweme.author)),fe.BS.isMentionNotice(t)&&t.at.user_info&&e.push((0,_e.bg)(t.at.user_info)),fe.BS.isRepostInboxNotice(t)&&(null===(s=null===(n=null===(o=t.template_notice.notice)||void 0===o?void 0:o.title)||void 0===n?void 0:n.from_users)||void 0===s||s.forEach((t=>e.push((0,_e.bg)(Object.assign({short_id:"",gender:0,birthday:""},t)))))),e}),[])})));var qe=i(64162),Ce=i(4126),Le=i(93995),Ae=i(23999),Oe=i(46657),Fe=i(26324),Re=i(95719),Te=i(8536),De=i(24451),Pe=i(72916),Me=i(74690),Be=i(80339),Ue=i(35572),Ge=i(8453),Ee=i(55322),$e=i(55306),He=i(38203);let Ve=class{constructor(e){this.fetch=e}getNoticeGroupData(e){return this.fetch.get("/api/notice/multi/",{query:e,baseUrlType:2})}getSystemNoticeGroupData(e){return this.fetch.get("/api/inbox/notice_list/",{query:e,baseUrlType:2})}getNoticeDiggList(e){return this.fetch.get("/api/notice/digg/list/",{query:e,baseUrlType:2})}getNoticeFollowRequestList(e){return this.fetch.get("/api/user/following/request/list/",{query:e,baseUrlType:2})}postFollowReplyApprove(e){return this.fetch.post("/api/commit/follow/request/approve/",{query:{from_user_id:e,from:33},headers:{[M.nk]:this.fetch.csrfToken}})}postFollowReplyReject(e){return this.fetch.post("/api/commit/follow/request/reject/",{query:{from_user_id:e,from:33},headers:{[M.nk]:this.fetch.csrfToken}})}};Ve=(0,o.__decorate)([(0,He._)(),(0,o.__metadata)("design:paramtypes",[P.pM])],Ve);let ze=class extends qe.E{constructor(e,t,i){super(),this.report=e,this.service=t,this.user=i,this.defaultNoticeList={has_more:1,max_time:0,min_time:0,notice_list:[],loading:!1},this.defaultFollowRequest={has_more:!1,min_time:0,total:0,users:[],loading:!1},this.defaultState={diggList:{users:[],loading:!1,has_more:1,max_cursor:0,min_cursor:0},inboxTabShowing:!1,activeGroup:500,activeSystemNoticeGroup:null,noticeList:this.defaultNoticeList,followRequest:this.defaultFollowRequest,latestSystemNotice:null}}setInboxTabShowing(e,t){e.inboxTabShowing=t}setActiveGroup(e,t){e.activeGroup=t}setActiveSystemNoticeGroup(e,t){e.activeSystemNoticeGroup=t}setNoticeList(e,t){e.noticeList=t}setNoticeListLoading(e,t){e.noticeList.loading=t}setLatestSystemNotice(e,t){e.latestSystemNotice=t}changeActiveGroup(e){return e.pipe((0,Re.M)((({group:e})=>{this.report.handleChangeTab({to_tab_name:re.zv[e]})})),(0,Te.Z)((({group:e})=>(0,Ae.of)(this.getActions().setActiveGroup(e),this.getActions().setNoticeList(this.defaultNoticeList),this.getActions().fetchNoticeData(),500===e?this.getActions().fetchLatestSystemNotice():this.noop()))))}changeActiveSystemNoticeGroup(e){return e.pipe((0,Re.M)((e=>{this.report.handleChangeSystemNotificationTab({to_tab_name:re.Nr[e]})})),(0,Te.Z)((e=>(0,Ae.of)(this.getActions().setActiveSystemNoticeGroup(e),this.getActions().setNoticeList(this.defaultNoticeList),this.getActions().fetchSystemNoticeData()))))}fetchNoticeData(e){return e.pipe((0,De.E)(this.state$),(0,Pe.n)((([e,{activeGroup:t,noticeList:i}])=>{if(i.loading||!i.has_more)return Oe.w;const o={count:20,is_mark_read:1,group:t,max_time:i.max_time,min_time:i.min_time};return this.service.getNoticeGroupData({aid:1988,group_list:JSON.stringify([o])}).pipe((0,Re.M)((e=>{(0,me.G)(e.status_code,[0])})),(0,Te.Z)((e=>{var t;if(0===e.status_code){const{notice_lists:o}=e;if(!(null==o?void 0:o.length))return(0,Ae.of)(this.getActions().setNoticeList({has_more:0,min_time:i.min_time,max_time:i.max_time,notice_list:i.notice_list,loading:!1}));const{has_more:n,max_time:s,min_time:a,notice_list:l=[]}=o[0];return l.forEach((e=>{(0,fe.mX)(e)})),(0,Ae.of)(this.user.getActions().multiSetUser(this.getNoticeUsers(l)),this.getActions().setNoticeList({has_more:n,max_time:s,min_time:a,notice_list:[...null!==(t=i.notice_list)&&void 0!==t?t:[],...l],loading:!1}))}return(0,Ae.of)(this.noop())})),(0,Me.Z)(this.getActions().setNoticeListLoading(!0)),(0,Be.q)(this.getActions().setNoticeListLoading(!1)),(0,Ee.n)({}))})))}fetchSystemNoticeData(e){return e.pipe((0,De.E)(this.state$),(0,Pe.n)((([e,{activeSystemNoticeGroup:t,noticeList:i}])=>i.loading||!i.has_more||null==t?Oe.w:this.service.getSystemNoticeGroupData({aid:1988,group_list:JSON.stringify([{count:20,is_mark_read:1,group:t,max_time:i.max_time,min_time:i.min_time}])}).pipe((0,Te.Z)((e=>{var t;if(0!==e.status_code)return(0,Ae.of)(this.noop());const{notice_lists:o}=e;if(!(null==o?void 0:o.length))return(0,Ae.of)(this.getActions().setNoticeList({has_more:0,min_time:i.min_time,max_time:i.max_time,notice_list:i.notice_list,loading:!1}));const{has_more:n,max_time:s,min_time:a,notice_list:l=[]}=o[0];return(0,Ae.of)(this.getActions().setNoticeList({has_more:n?1:0,max_time:s,min_time:a,notice_list:[...null!==(t=i.notice_list)&&void 0!==t?t:[],...l],loading:!1}))})),(0,Me.Z)(this.getActions().setNoticeListLoading(!0)),(0,Be.q)(this.getActions().setNoticeListLoading(!1)),(0,Ee.n)({})))))}fetchLatestSystemNotice(e){return e.pipe((0,Pe.n)((e=>this.service.getSystemNoticeGroupData({aid:1988,group_list:JSON.stringify([{count:1,is_mark_read:0,group:661,max_time:0,min_time:0}])}).pipe((0,Te.Z)((e=>{var t,i;if(0!==e.status_code)return(0,Ae.of)(this.noop());const{notice_lists:o}=e;return(null==o?void 0:o.length)?(0,Ae.of)(this.getActions().setLatestSystemNotice(null!==(i=null===(t=o[0].notice_list)||void 0===t?void 0:t[0])&&void 0!==i?i:null)):(0,Ae.of)(this.getActions().setLatestSystemNotice(null))}))))))}setDiggList(e,t){e.diggList.users=t}setDiggListLoading(e,t){e.diggList.loading=t}fetchDiggListData(e){return e.pipe((0,De.E)(this.state$),(0,Ue.p)((([{ref_id:e},{diggList:t}])=>{if(t.loading||!t.has_more)return Oe.w;const i={count:20,max_cursor:t.max_cursor,min_cursor:t.min_cursor,digg_type:1,ref_id:e,aid:1988};return this.service.getNoticeDiggList(i).pipe((0,Te.Z)((e=>{var t;const i=(null!==(t=e.digg_infos)&&void 0!==t?t:[]).map((({simple_user:e})=>(0,_e.bg)(e)));return(0,Ae.of)(this.user.getActions().multiSetUser(i),this.getActions().setDiggList(i.map((({uniqueId:e})=>e))))})),(0,Me.Z)(this.getActions().setDiggListLoading(!0)),(0,Be.q)(this.getActions().setDiggListLoading(!1)))})))}setNoticeFollowRequest(e,t){e.followRequest=t}setNoticeFollowRequestLoading(e,t){e.followRequest.loading=t}fetchNoticeFollowRequest(e){return e.pipe((0,De.E)(this.state$),(0,Te.Z)((([{uid:e,refresh:t},{followRequest:i}])=>{const o={user_id:e,count:20,max_time:t?0:i.min_time,aid:1988};return this.service.getNoticeFollowRequestList(o).pipe((0,Re.M)((e=>{(0,me.G)(e.status_code,[0])})),(0,Te.Z)((e=>{var o;if(0===e.status_code){const n=(null!==(o=e.request_users)&&void 0!==o?o:[]).map((e=>(0,_e.bg)(e))),s=n.map((({uniqueId:e})=>e));return(0,Ae.of)(this.user.getActions().multiSetUser(n),this.getActions().setNoticeFollowRequest({has_more:e.has_more,loading:!1,min_time:e.min_time,total:e.total,users:t?s:i.users.concat(s),from:"fetchNoticeFollowRequest"}))}return(0,Ae.of)(this.noop())})),(0,Me.Z)(this.getActions().setNoticeFollowRequestLoading(!0)),(0,Be.q)(this.getActions().setNoticeFollowRequestLoading(!1)),(0,Ee.n)({}))})))}setNoticeFollowRequestReply(e,t){const i=e.followRequest.users.indexOf(t);if(i>=0){e.followRequest.users.splice(i,1);const{total:t}=e.followRequest;e.followRequest.total="string"==typeof t?t.replace(/(.+?)(\d0*$)/,((e,t,i)=>t+String(Number(i)-1))):t-1}}postFollowReply(e){return e.pipe((0,Re.M)((({approveOrReject:e,uid:t=""})=>{this.report.handleFollowRequestAction({action:0===e?"accept":"delete",to_user_id:t})})),(0,Te.Z)((({approveOrReject:e,uniqueId:t,uid:i=""})=>(0===e?this.service.postFollowReplyApprove(i):this.service.postFollowReplyReject(i)).pipe((0,Ge.u)(this.getActions().setNoticeFollowRequestReply(t))))))}getNoticeUsers(e){return e.reduce(((e,t)=>{var i,o,n,s;return fe.BS.isFollowNotice(t)&&e.push((0,_e.bg)(t.follow.from_user)),fe.BS.isLikeNotice(t)&&(null===(i=t.digg.from_user)||void 0===i||i.forEach((t=>e.push((0,_e.bg)(t))))),fe.BS.isCommentNotice(t)&&e.push((0,_e.bg)(t.comment.comment.user)),fe.BS.isDuetNotice(t)&&e.push((0,_e.bg)(t.duet.aweme.author)),fe.BS.isMentionNotice(t)&&t.at.user_info&&e.push((0,_e.bg)(t.at.user_info)),fe.BS.isRepostInboxNotice(t)&&(null===(s=null===(n=null===(o=t.template_notice.notice)||void 0===o?void 0:o.title)||void 0===n?void 0:n.from_users)||void 0===s||s.forEach((t=>e.push((0,_e.bg)(Object.assign({short_id:"",gender:0,birthday:""},t)))))),e}),[])}};(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Boolean]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setInboxTabShowing",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Number]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setActiveGroup",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Number]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setActiveSystemNoticeGroup",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Object]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setNoticeList",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Boolean]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setNoticeListLoading",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Object]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setLatestSystemNotice",null),(0,o.__decorate)([(0,Ce.Mj)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Fe.c]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"changeActiveGroup",null),(0,o.__decorate)([(0,Ce.Mj)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Fe.c]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"changeActiveSystemNoticeGroup",null),(0,o.__decorate)([(0,Ce.Mj)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Fe.c]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"fetchNoticeData",null),(0,o.__decorate)([(0,Ce.Mj)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Fe.c]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"fetchSystemNoticeData",null),(0,o.__decorate)([(0,Ce.Mj)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Fe.c]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"fetchLatestSystemNotice",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Array]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setDiggList",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Boolean]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setDiggListLoading",null),(0,o.__decorate)([(0,Ce.Mj)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Fe.c]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"fetchDiggListData",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Object]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setNoticeFollowRequest",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,Boolean]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setNoticeFollowRequestLoading",null),(0,o.__decorate)([(0,Ce.Mj)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Fe.c]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"fetchNoticeFollowRequest",null),(0,o.__decorate)([(0,Ce.h5)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Object,String]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"setNoticeFollowRequestReply",null),(0,o.__decorate)([(0,Ce.Mj)(),(0,o.__metadata)("design:type",Function),(0,o.__metadata)("design:paramtypes",[Fe.c]),(0,o.__metadata)("design:returntype",void 0)],ze.prototype,"postFollowReply",null),ze=(0,o.__decorate)([(0,Le.n)("Notice"),(0,o.__metadata)("design:paramtypes",[F.b,Ve,$e.U])],ze);const{useSigiOrJotaiService:We,useSigiOrJotaiState:Ze,useSigiOrJotaiDispatchers:Je}=(0,ae.K)((()=>(0,se.$4)().isInAppNotificationEnabled),ze,{useServiceState:je,useServiceDispatchers:Ie});function Ke(e=1e4){const{layoutType:t}=(0,se.mf)(),i=(0,n.useRef)(null),c=(0,n.useRef)(!1),u=(0,n.useRef)(!0),d=(0,n.useRef)(!0),_=(0,le.JD)((e=>e.showingBrowserMode),A.bN),p=(0,oe.Z9)((e=>e.isOpen),A.bN),[{noticeList:v,followRequest:h},f]=ke((e=>({noticeList:e.noticeList,followRequest:e.followRequest})),A.bN),b=(0,ne.tP)(),{user:y,wid:w=""}=(0,n.useMemo)(ie.x,[]),N=(0,n.useMemo)((()=>{var e;return{uid:null!==(e=null==y?void 0:y.uid)&&void 0!==e?e:"",wid:w,refresh:!0}}),[null==y?void 0:y.uid,w]),x=function(e){const t=(0,l.useHistory)(),i=(0,n.useRef)({}),o=(0,n.useCallback)((({item:e})=>{const t=(0,m.uV)(e);r.f.sendEvent("notification_popup_show",{popup_type:t})}),[]),c=(0,n.useCallback)((({enterMethod:e,toastId:t})=>{const o=i.current[t];if(o){const n=(0,m.uV)(o);r.f.sendEvent("close_notification_popup",{enter_method:e,popup_type:n}),delete i.current[t]}}),[]),u=(0,n.useCallback)((e=>{c({enterMethod:"user_close",toastId:Number(e.id)})}),[c]),d=(0,n.useCallback)((e=>{c({enterMethod:"auto_close",toastId:Number(e.id)})}),[c]),_=(0,n.useCallback)((e=>{c({enterMethod:"user_close",toastId:Number(e)}),a.oR.dismiss(e)}),[c]),p=(0,n.useCallback)((()=>{Object.keys(i.current).forEach((e=>{c({enterMethod:"user_leaves_page",toastId:Number(e)})})),a.oR.dismiss()}),[c]),g=(0,n.useCallback)((t=>{const n=Y++;i.current[n]=t.notification,o({item:t.notification}),(0,a.oR)((0,s.jsx)(Q,Object.assign(Object.assign(Object.assign({},e),t),{id:n,dismiss:()=>_(n),dismissAll:p})),{id:n,onDismiss:u,onAutoClose:d})}),[e,p,_,o,d,u]);return(0,n.useEffect)((()=>t.listen(p)),[p,c,t]),(0,n.useMemo)((()=>({show:g,dismissAll:p})),[g,p])}({layoutType:t,onInteract:(0,n.useCallback)((e=>{"type"in e&&f.markAsRead(e)}),[f])}),k=(0,n.useCallback)((()=>(0,o.__awaiter)(this,void 0,void 0,(function*(){if(!_&&!p&&u.current)try{yield Promise.all([f.fetchNoticeData({fetchLatest:!0,markAsRead:!1}),f.fetchNoticeFollowRequest(N)]),c.current=!0}catch(e){}i.current=setTimeout(k,e)}))),[e,f,N,p,_]);(0,n.useEffect)((()=>{var e,t,i,o,n,s,a,l,r,u;if(!c.current||!(null==y?void 0:y.uid)||v.loading||h.loading)return;const _=(0,ee.Y)(te.H.InAppNotificationShown),p=(0,ee.Y)(te.H.InAppNotificationSettings),g=null!==(e=_.getLocalStorage())&&void 0!==e?e:{},f=null!==(t=g[y.uid])&&void 0!==t?t:{followRequests:[],lastActivityCreatedAt:0},w=new Set(f.followRequests),N=f.lastActivityCreatedAt,k=null!==(o=(null!==(i=p.getLocalStorage())&&void 0!==i?i:{})[y.uid])&&void 0!==o?o:{},j=new Set(Object.keys(k).filter((e=>!1===k[e]))),I=h.users.filter((e=>!w.has(e))),S=[];let q=re.BP;!j.has("followPush")&&I.length>0&&(S.push(Object.assign(Object.assign({},h),{users:I})),q-=1);const C=null!==(s=null===(n=v.notice_list)||void 0===n?void 0:n.filter((e=>Number(e.create_time)>N&&!1===e.has_read)))&&void 0!==s?s:[],L=null!==(a=C.filter((e=>!(m.BS.isCommentNotice(e)&&j.has("commentPush")||(m.BS.isFollowNotice(e)||m.BS.isFollowRequest(e)||m.BS.isFollowApprovalNotice(e))&&j.has("followPush")||m.BS.isLikeNotice(e)&&j.has("diggPush")||m.BS.isMentionNotice(e)&&j.has("mentionPush")||m.BS.isRepostInboxNotice(e)&&j.has("repostPush")))).slice(0,q).reverse())&&void 0!==a?a:[];[...S,...L].forEach((e=>x.show({notification:e}))),d.current?d.current=!1:C.forEach((e=>b.updateUnreadCount(e.type,"unread"))),_.setLocalStorage(Object.assign(Object.assign({},g),{[y.uid]:{followRequests:h.users,lastActivityCreatedAt:Math.max(Number(null!==(u=null===(r=null===(l=v.notice_list)||void 0===l?void 0:l[0])||void 0===r?void 0:r.create_time)&&void 0!==u?u:0),N)}}))}),[h,h.loading,h.users,b,v.loading,v.notice_list,x,null==y?void 0:y.uid]),(0,n.useEffect)((()=>{(_||p)&&x.dismissAll()}),[p,x,_]),(0,n.useEffect)((()=>(u.current=!document.hidden,(0,g.Gz)((()=>{u.current=!1}),(()=>{u.current=!0})))),[]),(0,n.useEffect)((()=>(k(),()=>{i.current&&(clearTimeout(i.current),i.current=null)})),[k])}},40858:(e,t,i)=>{i.d(t,{BS:()=>S,mX:()=>q,G6:()=>A,fG:()=>C,Bl:()=>F,Eo:()=>O});var o=i(94204),n=i(15328),s=i(90161),a=i(18490),l=i(91446),r=i(78954),c=i(80469),u=i(93823),d=i(77360),m=i(45068),_=i(62015),p=i(45209),g=i(33165),v=i(95649),h=i(6156),f=i(93418),b=i(86107),y=i(50389),w=i(61124),N=i(4474);const x=({src:e})=>{const t=/^https?:\/\/[a-zA-Z0-9-]+-sg/.test(e)?"t.tiktok.com":"m.tiktok.com";return(0,N.stringifyUrl)({url:`https://${t}/node-a/video/playsv`,query:{play_url:e}})};var k=i(88920),j=i(84798);const I=[228,261,302],S={isFollowNotice:e=>33===e.type&&Boolean(e.follow),isFollowApprovalNotice:e=>"type"in e&&23===e.type&&Boolean(e.follow_request_approve),isLikeNotice:e=>41===e.type&&Boolean(e.digg),isCommentNotice:e=>31===e.type&&Boolean(e.comment),isDuetNotice:e=>21===e.type&&Boolean(e.duet),isMentionNotice:e=>45===e.type&&Boolean(e.at),isReportInboxNotice:e=>213===e.type&&Boolean(e.template_notice),isRepostInboxNotice:e=>I.includes(e.type)&&Boolean(e.template_notice)},q=e=>{var t,i,o,n,s,a,l,r,c,u,d,m,_,p,g,v,h,f,b,y;if(S.isLikeNotice(e)){const a=null===(o=null===(i=null===(t=e.digg.aweme)||void 0===t?void 0:t.video)||void 0===i?void 0:i.cover)||void 0===o?void 0:o.url_list;if(0!==(null===(s=null===(n=e.digg.aweme)||void 0===n?void 0:n.status)||void 0===s?void 0:s.private_status)&&a){const e=x({src:a[0]});a[0]=e}}if(S.isCommentNotice(e)){const t=null===(r=null===(l=null===(a=e.comment.aweme)||void 0===a?void 0:a.video)||void 0===l?void 0:l.cover)||void 0===r?void 0:r.url_list;if(0!==(null===(u=null===(c=e.comment.aweme)||void 0===c?void 0:c.status)||void 0===u?void 0:u.private_status)&&t){const e=x({src:t[0]});t[0]=e}}if(S.isDuetNotice(e)){const t=null===(_=null===(m=null===(d=e.duet.aweme)||void 0===d?void 0:d.video)||void 0===m?void 0:m.cover)||void 0===_?void 0:_.url_list;if(0!==(null===(g=null===(p=e.duet.aweme)||void 0===p?void 0:p.status)||void 0===g?void 0:g.private_status)&&t){const e=x({src:t[0]});t[0]=e}}if(S.isMentionNotice(e)){const t=null===(f=null===(h=null===(v=e.at.aweme)||void 0===v?void 0:v.video)||void 0===h?void 0:h.cover)||void 0===f?void 0:f.url_list;if(0!==(null===(y=null===(b=e.at.aweme)||void 0===b?void 0:b.status)||void 0===y?void 0:y.private_status)&&t){const e=x({src:t[0]});t[0]=e}}};function C(e){switch(e){case 661:return o.A;case 47:return n.A;case 12:return s.A;case 61:return a.A;case 21:return l.A;case 82:return r.A;case 81:return c.A;case 212:return u.A;case 215:return d.A;case 218:return m.A;case 223:return _.A;case 224:return p.A;case 249:return g.A;case 254:return v.A;case 255:return h.A;case 256:return f.A;case 262:return b.A;case 272:return y.A;case 274:return w.A;default:return}}const L={2:47,6:21};function A(e){var t;return null!==(t=L[e])&&void 0!==t?t:e}function O(e){try{return"object"==typeof JSON.parse(e)}catch(e){return!1}}function F(){const{isRepostNoticeEnabled:e}=(0,k.Fl)();return e?j.ri:j.E4}},81125:(e,t,i)=>{i.d(t,{b:()=>d});var o,n=i(58632),s=i(67192),a=i(38203),l=i(71510),r=i.n(l),c=i(93608);const u="homepage_message";let d=o=class{handlePopShow(e){c.f.sendEvent("message_pop_notice_show",e)}handleChangeTab(e){c.f.sendEvent("change_notification_tab",this.getNoticeParams(e))}handleEnterFollow(e){c.f.sendEvent("enter_follow_request",this.getNoticeParams(e))}handleFollowRequestAction(e){c.f.sendEvent("follow_request_action",r()(e,{enter_from:"follow_request_page",previous_page:"homepage_message"}))}handleEnterFold(e){c.f.sendEvent("enter_folded_message",r()(e,{enter_from:u,account_type:"like"}))}handleSystemNotificationShow(){c.f.sendEvent("system_notification_show",this.getNoticeParams({}))}handleSystemNotificationClick(e){c.f.sendEvent("system_notification_click",this.getNoticeParams({enter_from:"system_notification_page",enter_method:e.enter_method}))}handleChangeSystemNotificationTab(e){c.f.sendEvent("change_system_notification_tab",this.getNoticeParams(e))}getNoticeParams(e){return r()(e,{enter_from:u,page_name:u,previous_page:c.f.commonParams.page_name})}};d.getInstance=()=>s.l.getInstance(o),d=o=(0,n.__decorate)([(0,a._)()],d)}}]);