"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["7833"],{49597:function(e,t,i){(0,i(6400).createContext)(null)},74949:function(e,t,i){i.d(t,{IC:()=>eA,P_:()=>eZ,Xn:()=>ek,gG:()=>eP});var n=i(7409),o=i(99282),r=i(16584),l=i(6400),a=i(98661),s=i(30396),m=i(94184),c=i.n(m),d=i(18446),_=i.n(d),u=i(99869),p=i(48493),v=i(68494),y=i(85200),h=i(88510),g=i(2156),b=i(50049),f=i(85557),k=i(36569),Z=i(67416),w=i(71960),S=i(6967),B=i(81169),x=i(10247),I=i(84924);i(32351);var H=i(85685),Y=i(16354),X=i(19548),q=i(64719),C=i(35543),M=i(95441);i(36518);var N=i(60807),P=i(92291),T=i(5952);i(42375);var z=i(13748),A=i(93963);i(85527);var V=i(53678),E=i(16451),O=i(68833),R=i(48980),U=i(59897);i(7882);var W=i(98750),D=i(98914),L=i(60590),F=i(94874),j=i(13229),K=i(15771),G=i(80026),$=i(19081),J=i(44424);i(98248);var Q=i(10510);i(15186);var ee=i(58175),et=i(70379),ei=i(71460),en=i(76817);i(35449);var eo=i(83010),er=i(46585),el=i(15503);i(27744);var ea=i(2009),es=i(79567);i(88817);var em=i(65575);i(49597);var ec=i(31541);i(70293),i(91400);var ed=i(98012),e_=i(48884),eu=i(31377),ep=i(22838),ev=i(60308),ey=i(62515),eh=i(63651),eg=i(84864),eb=i(47929),ef=i(43883);function ek(e){var t,i;let{activityResult:r,activityResultMaps:l,feedState:a,item:s,idx:m}=e,{publications:c,posts:d,users:_,comments:u,mentions:p,communityComments:v,communityPosts:y,liveStreams:h,liveStreamInvites:g,drafts:b,viralGifts:f,feedItemComments:k}=l,Z=a.comments.size?a.comments:u,w=s.comment_id||s.target_comment_id;return(0,o._)((0,n._)({},s),{idx:m,pub:s.publication_id&&c.get(s.publication_id),post:s.target_post_id&&null!==(i=null!==(t=d.get(s.target_post_id))&&void 0!==t?t:b.get(s.target_post_id))&&void 0!==i?i:null,recent_senders:s.recent_sender_ids&&(0,U.Z)(s.recent_sender_ids,e=>_.get(e)),comment:s.comment_id&&Z.get(s.comment_id)||null,target_comment:s.target_comment_id&&Z.get(s.target_comment_id)||null,target_user:s.target_user_id&&_.get(s.target_user_id)||null,mention:s.mention_id&&p.get(s.mention_id)||null,community_post:s.community_post_id&&y.get(s.community_post_id)||null,community_comment:s.community_comment_id&&v.get(s.community_comment_id)||null,target_community_post:s.target_community_post_id&&y.get(s.target_community_post_id)||null,target_community_comment:s.target_community_comment_id&&v.get(s.target_community_comment_id)||null,subscription_context:r.itemIdToSubscriptionContext[s.id],target_subscription_note:r.subscriptionNotes.find(e=>{let{publication_id:t,user_id:i}=e;return t===s.publication_id&&i===s.target_user_id}),target_pledge_note:r.pledgeNotes.find(e=>{let{publication_id:t,user_id:i}=e;return t===s.publication_id&&i===s.target_user_id}),feed_item_comment:w&&k.get(w)||null,target_live_stream:("live_stream"===s.type||"live_stream_invite"===s.type||"live_stream_scheduled"===s.type||"live_stream_scheduled_invite"===s.type)&&s.target_live_stream_id&&h.get(s.target_live_stream_id)?h.get(s.target_live_stream_id):null,target_live_stream_invite:("live_stream"===s.type||"live_stream_invite"===s.type||"live_stream_scheduled_invite"===s.type)&&s.target_live_stream_invite_id&&g.get(s.target_live_stream_invite_id)?g.get(s.target_live_stream_invite_id):null,target_live_stream_published_media_upload:function(e){var t;let{item:i,liveStreamPublishedMediaUploads:n,users:o,liveStreamInvites:r}=e;return"live_stream"===i.type&&i.target_live_stream_id?null!==(t=n.find(e=>{if(e.live_stream_id!==i.target_live_stream_id)return!1;if(i.target_live_stream_invite_id){var t,n,l;let a=o.get(null!==(l=null===(t=r.get(i.target_live_stream_invite_id))||void 0===t?void 0:t.invited_user_id)&&void 0!==l?l:0);return(null==a?void 0:null===(n=a.primary_publication)||void 0===n?void 0:n.id)===e.publication_id}return!0}))&&void 0!==t?t:n.find(e=>e.live_stream_id===i.target_live_stream_id):void 0}({item:s,liveStreamPublishedMediaUploads:r.liveStreamPublishedMediaUploads,users:_,liveStreamInvites:g}),viral_gifts:"viral_gift_granted"===s.type&&s.publication_id&&f.get(s.publication_id)?f.get(s.publication_id):null})}let eZ=(0,a.memo)(e=>{let{item:t,isUnread:i,readOnly:n}=e,o=eE((0,N.aF)(),t)?ew:eS;return(0,r.tZ)(ex,{item:t,isUnread:i,readOnly:n,children:(0,r.BX)($.tu,{gap:4,flex:"grow",minWidth:0,children:[(0,r.tZ)(eY,{namedSenders:t.recent_senders.slice(0,2),item:t}),(0,r.tZ)(o,{item:t})]})})},_()),ew=e=>{let{item:t}=e,i=t.comment||t.target_comment,n=t.feed_item_comment;if(!i||!n)return null;let o=!!t.post&&"everyone"!==t.post.write_comment_permissions,l="restack"===t.type||"restack_quote"===t.type||"note_like"===t.type;return(0,r.BX)($.tu,{gap:12,flex:"grow",minWidth:0,children:[(0,r.tZ)(T.bN,{comment:i,item:n,paddingRight:16*!!l}),i.attachments&&i.attachments.length>0&&(0,r.tZ)("div",{className:ef.Z.attachmentContainer,children:(0,r.tZ)(P.yd,{attachments:i.attachments,onAttachmentClick:function(){let{commentId:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,el.rw)(n,"activity-page","attachment",{tabId:ep.QP.Activity,extraEventProps:{commentId:e}})},utm_content:n.entity_key})}),(0,r.BX)($.gq,{justifyContent:l?"end":"start",style:{marginTop:l?"-24px":"0"},children:[!l&&(0,r.tZ)(A.$w,{item:n,comment:i,disableRestack:o}),(0,r.tZ)(z.U,{publication:t.pub,post:t.post,comment:i,item:n})]})]})},eS=e=>{let{item:t}=e,i=function(e){var t,i,n,o,r,l,a,s,m,c,d,_,u,p,v,y,h,g,b,f,k,Z,w,S,B,x,I,H,Y,X,q,C;let M="",N=null===(i=e.target_comment)||void 0===i?void 0:null===(t=i.attachments)||void 0===t?void 0:t.find(e=>"post"===e.type),P=null===(o=e.target_comment)||void 0===o?void 0:null===(n=o.attachments)||void 0===n?void 0:n.find(e=>"comment"===e.type);switch(e.type){case"post_reply":case"note_reply":case"comment_reply":case"comment_mention":case"comment_pub_mention":case"user_first_note":case"new_note":M=(null===(l=e.comment)||void 0===l?void 0:l.body)||"";break;case"comment_arr":M="".concat(e.comment_new_paid_subs_count&&e.comment_new_paid_subs_count>1?"This note generated ".concat(e.comment_new_paid_subs_count," paid subscribers"):"This note generated 1 paid subscriber").concat((null===(a=e.comment)||void 0===a?void 0:a.body)?": “".concat(e.comment.body,"”"):"");break;case"post_like":M=(null===(s=e.post)||void 0===s?void 0:s.title)||(null===(m=e.post)||void 0===m?void 0:m.description)||"";break;case"note_like":case"comment_like":case"mentioning_comment_like":case"mentioning_comment_reply":case"mentioning_comment_restack":M=(null===(c=e.target_comment)||void 0===c?void 0:c.body)||"";break;case"naked_restack_reaction":M=(null===(d=e.post)||void 0===d?void 0:d.title)||(null===(_=e.feed_item_comment)||void 0===_?void 0:_.comment.body)||"";break;case"post_mention":M=(null===(u=e.mention)||void 0===u?void 0:u.context)||(null===(p=e.post)||void 0===p?void 0:p.description)||"";break;case"restack":case"restack_quote":M="restack_quote"===e.type&&(null==N?void 0:null===(v=N.postSelection)||void 0===v?void 0:v.text)?null==N?void 0:null===(y=N.postSelection)||void 0===y?void 0:y.text:(null===(h=e.target_comment)||void 0===h?void 0:h.body)||(null==N?void 0:null===(g=N.postSelection)||void 0===g?void 0:g.text)||(null==N?void 0:null===(b=N.post)||void 0===b?void 0:b.title)||(null==P?void 0:null===(f=P.comment)||void 0===f?void 0:f.body)||(null===(k=e.post)||void 0===k?void 0:k.title)||(null===(Z=e.post)||void 0===Z?void 0:Z.description)||"";break;case"follow":{let{recent_senders:t}=e;if(t[0]){let{primary_publication:e,handle:i,bio:n}=t[0];M=e?"Writes ".concat(e.name):n||(i?"@".concat(i):"")}else M="";break}case"free_subscription":case"referred_free_subscription":case"presubscribe":case"new_profile":M=(null===(w=e.recent_senders[0])||void 0===w?void 0:w.bio)||"";break;case"community_comment_like":case"community_comment_mention":case"community_comment_quote_reply":case"community_comment_reply":case"community_post_reply":M=(null===(S=e.community_comment)||void 0===S?void 0:S.body)||"";break;case"community_post_like":M=(null===(B=e.target_community_post)||void 0===B?void 0:B.body)||"";break;case"arr_10k_milestone":case"arr_1k_milestone":case"list_100_milestone":case"list_1k_milestone":M="Congrats! To celebrate this milestone, we’ve created some custom images for you to share on other social networks. ";break;case"viral_post":M="Your post has received a lot of traffic over the last 24 hours";break;case"share_handle":M="Sharing your handle on Twitter will let your friends find you on Substack";break;case"paid_subscription":M=(null===(x=e.target_subscription_note)||void 0===x?void 0:x.note)||"";break;case"pledged_subscription":M=(null===(I=e.target_pledge_note)||void 0===I?void 0:I.note)||"";break;case"live_stream":M=(null===(H=e.target_live_stream)||void 0===H?void 0:H.title)||"";break;case"live_stream_scheduled":M=(null===(Y=e.target_live_stream)||void 0===Y?void 0:Y.title)?"".concat(null===(X=e.target_live_stream)||void 0===X?void 0:X.title," is happening ").concat((0,ed.Z)(e.target_live_stream.scheduled_at).format("MMM D [at] hh:mm a")):"";break;case"live_stream_scheduled_invite":M=e.target_live_stream?(0,ed.Z)(e.target_live_stream.scheduled_at).isSame((0,ed.Z)(),"day")?"Happening at ".concat((0,ed.Z)(e.target_live_stream.scheduled_at).format("hh:mm a")):(0,ed.Z)(e.target_live_stream.scheduled_at).isSame((0,ed.Z)().add(1,"day"),"day")?"Happening tomorrow at ".concat((0,ed.Z)(e.target_live_stream.scheduled_at).format("hh:mm a")):"Happening ".concat((0,ed.Z)(e.target_live_stream.scheduled_at).format("MMM D [at] hh:mm a")):"";break;case"post_shareable_assets_ready":M="We've generated several clips for your latest video";break;case"viral_gift_granted":M=(null===(C=e.viral_gifts)||void 0===C?void 0:null===(q=C.unsent)||void 0===q?void 0:q.length)?"You have new paid subscriptions to send friends":"You have sent all your paid subscriptions to friends"}return(0,eg.truncateWords)(M,300,{quotationMarks:"restack_quote"===e.type&&!!(null==N?void 0:null===(r=N.postSelection)||void 0===r?void 0:r.text)})}(t);if(!i)return null;let n=t.target_post_id&&t.post&&t.pub&&["post_like","restack","restack_quote"].includes(t.type);return(0,r.BX)(r.HY,{children:[(0,r.tZ)(ee.xv.B3,{as:"p",className:ef.Z.contentPreview,color:"secondary",style:{paddingRight:20*!!n},children:i}),n&&(0,r.tZ)($.gq,{justifyContent:"end",style:{marginTop:"-24px"},children:(0,r.tZ)(eB,{item:t})})]})};function eB(e){let{item:t}=e,i=(0,et.pm)(),l=(0,N.aF)(),{iString:s}=(0,M.M1)(),{pub:m,post:c}=t,[d,_]=(0,a.useState)(!1),h=c?(0,eu.getPostAuthor)(m,c):null,g=c&&l&&l.id===(null==h?void 0:h.id),b="/api/v1/notification_settings/post/".concat(null==c?void 0:c.id,"/mute");(0,a.useEffect)(()=>{let e=async()=>{_(!!await (0,R.rd)(b,{method:"GET"}))};g&&e()},[g]);let f=async e=>{let t;switch(e){case"1hour":t=1;break;case"8hours":t=8;break;case"24hours":t=24}let l=t?{expires_at:(0,ed.Z)().add(t,"hour").toISOString()}:{};await (0,R.rd)(b,{method:"POST",json:l}),_(!0),i.popToast(e=>(0,r.tZ)(et.FN,(0,o._)((0,n._)({},e),{text:s("Paused notifications"),Icon:p.Z})))},k=async()=>{await (0,R.rd)(b,{method:"DELETE"}),_(!1),i.popToast(e=>(0,r.tZ)(et.FN,(0,o._)((0,n._)({},e),{text:s("Unpaused notifications"),Icon:v.Z})))},Z=[(0,r.tZ)(J.sN,{leading:(0,r.tZ)(u.Z,{}),onClick:()=>{if(!c)return;let e=(0,eh.mx9)(m,c);(0,D.vQ)(e),i.popToast(e=>(0,r.tZ)(et.FN,(0,o._)((0,n._)({},e),{text:s("Copied link to clipboard"),Icon:u.Z})))},children:s("Copy link")})].filter(Boolean),w=[g&&(d?(0,r.tZ)(er.WS,{onClick:k,customLabel:s("Unpause notifications")}):(0,r.tZ)(er.KV,{onMute:f,customLabel:s("Pause notifications")}))].filter(Boolean),S=[0!==Z.length&&Z,0!==w.length&&(0,r.tZ)(J.xw,{children:w})];return 0===S.length?null:(0,r.tZ)("div",{style:{position:"relative"},children:(0,r.tZ)(J.v2,{trigger:(0,r.tZ)($.hs,{className:ef.Z.moreButtonContainer,maxHeight:360,children:(0,r.tZ)(K.hU,{priority:"quaternary",size:"sm",className:ef.Z.moreButton,"aria-label":s("More options"),children:(0,r.tZ)(y.Z,{size:16})})}),children:S})})}function ex(e){var t;let{item:i,isUnread:l,children:a,readOnly:m}=e,d=(0,eo.n)(),[,_]=(0,ec.r8)(!!l,(0,r.tZ)(ec.Eb,{className:ef.Z.unreadBadge})),u=null!==(t=i.target_comment)&&void 0!==t?t:i.comment,p=(0,s.sO)(null);return(0,W.UM)(p,()=>{var e,t,o;return d(O.FP.ACTIVITY_ITEM_VIEWED,(0,n._)({type:i.type,publication_id:i.publication_id,activity_item_id:i.id,position:i.idx,comment_type:null==u?void 0:u.post_id?"post":"note",is_unread:l,comment_id:(null===(e=i.target_comment)||void 0===e?void 0:e.id)||(null===(t=i.comment)||void 0===t?void 0:t.id),community_comment_id:i.community_comment_id,community_post_id:i.community_post_id,post_id:null===(o=i.post)||void 0===o?void 0:o.id,user_id:i.target_user_id},i.trackingParams))},{threshold:.2}),(0,r.tZ)(eI,{item:i,children:(0,r.tZ)(em.Uj,{ref:p,linkClassName:c()(ef.Z.notificationLink,l&&ef.Z.unread),isPadded:!1,onClick:e=>{d(O.FP.ACTIVITY_ITEM_TAPPED,(0,n._)({type:i.type,position:i.idx,publication_id:i.publication_id,activity_item_id:i.id,comment_type:null==u?void 0:u.post_id?"post":"note",is_unread:l},i.trackingParams));let t=e.composedPath().some(e=>e instanceof HTMLAnchorElement);if(!e.defaultPrevented&&!t){m||_();let t=(0,eh.n1t)(function(e){var t,i,r,l,a,s,m,c,d,_,u,p;switch(e.type){case"post_reply":return(0,eh.uRy)(e.pub,e.post,{commentId:e.comment_id});case"post_like":case"post_mention":return(0,eh.uRy)(e.pub,e.post);case"note_reply":case"comment_reply":if((null!==(t=e.sender_count)&&void 0!==t?t:0)>1&&e.target_comment_id&&e.target_comment&&null==e.target_comment.post_id){return p=e.target_comment_id,"/activity/replies/".concat(p)}if(e.comment&&null==e.comment.post_id)return(0,eh.Sgq)(e.comment);return(0,ev.Wnz)(e.pub,e.post,e.comment,{});case"note_like":case"comment_like":if(e.target_comment&&!e.target_comment.post_id)return(0,eh.Sgq)(e.target_comment);return(0,eh.uRy)(e.pub,e.post,{commentId:e.target_comment_id});case"naked_restack_reaction":if(e.feed_item_comment)return(0,eh.Sgq)(e.feed_item_comment.comment);if(e.target_comment)return(0,eh.Sgq)(e.target_comment);return(0,eh.uRy)(void 0,e.post);case"restack":if(e.target_comment&&!e.target_comment.post_id)return(0,eh.Sgq)(e.target_comment);return(0,eh.uRy)(e.pub,e.post,{commentId:e.target_comment_id,comments:!!e.target_comment_id});case"mentioning_comment_like":case"mentioning_comment_reply":case"mentioning_comment_restack":if(e.target_comment)return(0,eh.Sgq)(e.target_comment);break;case"restack_quote":if(e.target_comment)return(0,eh.Sgq)((0,o._)((0,n._)({},e.target_comment),{name:null===(i=e.target_user)||void 0===i?void 0:i.name}));break;case"free_subscription":case"follow":case"new_profile":return(0,eh.NNq)((null===(r=e.target_user)||void 0===r?void 0:r.name)&&e.target_user||eN(e)||e.pub);case"presubscribe":{let t=eN(e);return t&&(0,eh.NNq)(t)||""}case"referred_free_subscription":{let t=eN(e);return(null==t?void 0:t.name)?(0,eh.NNq)(t):(0,eh.SVA)(e.pub)}case"comment_mention":case"comment_pub_mention":case"user_first_note":case"new_note":case"comment_arr":if(e.comment)return(0,eh.Sgq)(e.comment);break;case"community_comment_quote_reply":case"community_comment_reply":case"community_comment_mention":case"community_comment_like":case"community_post_reply":return(0,eh.xC8)({pubId:e.publication_id,postId:e.target_community_post_id,commentId:e.target_community_comment_id,params:{targetReplyId:e.community_comment_id,showTarget:!0}});case"community_post_like":return(0,eh.xC8)({pubId:e.publication_id,postId:e.target_community_post_id});case"viral_post":if(e.post)return(0,eh.cwg)(e.pub,e.post.id,{addBase:!0});break;case"share_handle":{if(!e.target_user)return"";let t=(0,eh.NNq)(e.target_user,{utm_source:"share_handle"}),i=Math.ceil(6*Math.random()),n="".concat("Substack".slice(0,i),"*").concat("Substack".slice(i+1)),o=null===(l=e.target_user)||void 0===l?void 0:l.handle;return(0,ev.LaP)({text:"You can find me on ".concat(n).concat(o?" at @".concat(o):""),url:t})}case"live_stream":if(e.target_live_stream_published_media_upload)return(0,ev.K8_)(e.target_live_stream_published_media_upload.publication_subdomain,e.target_live_stream_published_media_upload.post_slug,{params:{utm_source:eb.b3.activityItem}});if(!(null===(a=e.target_live_stream)||void 0===a?void 0:a.id))break;return(0,eh.UDR)({liveStreamId:null===(s=e.target_live_stream)||void 0===s?void 0:s.id,utm_source:eb.b3.activityItem,noBase:!0});case"live_stream_scheduled":case"live_stream_scheduled_invite":if(!(null===(m=e.target_live_stream)||void 0===m?void 0:m.id))break;return(0,eh.bHR)({liveStreamId:null===(c=e.target_live_stream)||void 0===c?void 0:c.id,utm_source:eb.b3.activityItem});case"post_shareable_assets_ready":return(0,eh.FKc)({post_id:e.target_post_id,publication_subdomain:null===(d=e.pub)||void 0===d?void 0:d.subdomain});case"viral_gift_granted":if(null===(u=e.viral_gifts)||void 0===u?void 0:null===(_=u.unsent)||void 0===_?void 0:_.length)return(0,eh.b1P)({pub:e.pub,params:{utm_source:eb.b3.activityItem}})}return""}(i),{utm_source:eb.b3.activityItem});(0,D.uX)(t,{event:e,local_navigation:window.location.hostname===eh.pvz.hostname||t.startsWith("/live-stream"),state:{showBack:!0}})}},children:(0,r.BX)($.hs,{gap:8,className:ef.Z.container,flex:"grow",minWidth:0,children:[(0,r.tZ)(eT,{item:i}),a]})})})}function eI(e){let{item:t,children:i}=e,n=1===t.recent_senders.length?t.recent_senders[0]:null,o=(0,X.gc)(null==n?void 0:n.id),[l,s]=(0,a.useState)(!1);return!l&&o?(0,r.tZ)($.tu,{paddingY:16,children:(0,r.BX)(G.M5,{radius:"md",border:"detail",padding:20,color:"secondary",cursor:"pointer",onClick:()=>s(!0),children:[(0,r.BX)(ee.xv.B4,{minWidth:0,flex:"grow",children:["This activity item concerns someone"," ","muting"===o?"you’ve muted":"blocking"===o?"you’ve blocked":"who has blocked you","."]}),(0,r.tZ)(ee.xv.B4,{weight:"semibold",decoration:"hover-underline",children:"Show activity"})]})}):(0,r.tZ)(r.HY,{children:i})}function eH(e){var t,i,n,o;let{item:l}=e,{iString:a}=(0,M.M1)();if(["arr_10k_milestone","arr_1k_milestone","list_100_milestone","list_1k_milestone","viral_gift_granted"].includes(l.type))return(0,r.tZ)(r.HY,{children:(0,r.tZ)(V.hh,{href:(0,eh.SVA)(l.pub),weight:"medium",ellipsis:!1,children:l.pub.name})});if("viral_post"===l.type&&l.post)return(0,r.tZ)(r.HY,{children:(0,r.tZ)(V.hh,{href:(0,eh.cwg)(l.pub,l.post.id,{addBase:!0}),weight:"medium",ellipsis:!1,children:l.post.title})});if(["share_handle"].includes(l.type)||"naked_restack_reaction"===l.type&&!l.sender_count)return null;if("post_shareable_assets_ready"===l.type){let e=(null===(t=l.post)||void 0===t?void 0:t.draft_title)||(null===(i=l.post)||void 0===i?void 0:i.title)||"Untitled";return(0,r.tZ)("span",{style:{fontWeight:"bold"},children:e})}if("post_mention"===l.type&&l.pub&&0===l.recent_senders.length)return(0,r.tZ)("span",{style:{fontWeight:"bold"},children:l.pub.name});let s=l.recent_senders,m=(0,en.Q)(s,l);if("comment_arr"===l.type){let e=m.filter(e=>(0,en.T)(e))[0];if(l.user_id===e.id)return(0,r.tZ)(r.HY,{children:"Your"})}let c=(e,t)=>"comment_arr"===t.type?"".concat(e.name,"'s"):e.name;return"live_stream_scheduled"===l.type&&l.target_user_id===l.user_id?(0,r.tZ)(r.HY,{children:(0,r.tZ)(V.hh,{href:(null===(n=l.target_live_stream)||void 0===n?void 0:n.id)?(0,eh.bHR)({liveStreamId:null===(o=l.target_live_stream)||void 0===o?void 0:o.id,utm_source:eb.b3.activityItem}):"",weight:"medium",ellipsis:!1,children:a("Your live video is scheduled")})}):(0,r.tZ)(r.HY,{children:m.length>0?m.map(e=>(0,en.T)(e)?(0,r.BX)(r.HY,{children:[(0,r.tZ)(H.ProfileHoverCard,{subject:e,utmSource:"notification",children:(0,r.tZ)(V.hh,{weight:"medium",href:(0,eh.NNq)(e),showBack:!0,children:c(e,l)})}),!!e.bestseller_tier&&(0,r.BX)(r.HY,{children:[" ",(0,r.tZ)(ei.UserBadge,{className:ef.Z.userBadge,inline:!0,size:"sm",tier:e.bestseller_tier,userId:e.id})]})]}):e.bold?(0,r.tZ)(ee.xv.B3,{weight:"medium",as:"span",children:e.value}):e.value):"Someone "})}function eY(e){var t,i,l,a,s,m,c,d,_;let{namedSenders:u,item:p}=e;return(0,r.BX)($.tu,{className:ef.Z.notificationBody,alignItems:"start",gap:8,flex:"grow",children:[(0,r.BX)($.hs,{alignItems:"center",justifyContent:"space-between",flex:"grow",alignSelf:"stretch",gap:8,children:["viral_gift_granted"!==p.type&&(null===(t=p.recent_senders.filter(e=>null==e?void 0:e.name))||void 0===t?void 0:t.length)?(0,r.tZ)(j.H,{users:p.recent_senders,max:6,total:null!==(_=p.sender_count)&&void 0!==_?_:void 0,size:32,renderAvatar:e=>(0,r.tZ)(F.xV,(0,o._)((0,n._)({},e),{noBase:ea.L,utmSource:"notification"}))}):(null===(i=p.pub)||void 0===i?void 0:i.logo_url)?(0,r.tZ)(Q.wk,{pub:p.pub,size:32}):(null===(l=p.feed_item_comment)||void 0===l?void 0:l.comment)?(0,r.tZ)(j.H,{users:[{id:null===(a=p.feed_item_comment)||void 0===a?void 0:a.comment.id,name:(null===(s=p.feed_item_comment)||void 0===s?void 0:s.comment.name)||"",photo_url:null===(m=p.feed_item_comment)||void 0===m?void 0:m.comment.photo_url}],max:6,size:32,renderAvatar:e=>(0,r.tZ)(F.xV,(0,o._)((0,n._)({},e),{noBase:ea.L,utmSource:"notification"}))}):p.target_comment?(0,r.tZ)(j.H,{users:[{id:p.target_comment.id,name:p.target_comment.name||"",photo_url:p.target_comment.photo_url}],max:6,size:32,renderAvatar:e=>(0,r.tZ)(F.xV,(0,o._)((0,n._)({},e),{noBase:ea.L,utmSource:"notification"}))}):(null===(c=p.post)||void 0===c?void 0:c.publishedBylines)?(0,r.tZ)(j.H,{users:null===(d=p.post)||void 0===d?void 0:d.publishedBylines,max:6,size:32,renderAvatar:e=>(0,r.tZ)(F.xV,(0,o._)((0,n._)({},e),{noBase:ea.L,utmSource:"notification"}))}):null,(0,r.tZ)(eX,{item:p,namedSenders:u})]}),(0,r.tZ)($.tu,{flex:"grow",children:(0,r.BX)(ee.xv.B3,{as:"span",color:"primary",children:[(0,r.tZ)(eH,{item:p})," ",(0,r.tZ)(ee.xv,{as:"span",paddingRight:8,children:function(e,t){var i,n,o,l,a,s,m,c,d,_,u,p,v,y,h,g,b,f,k,Z,w,S,B;let x=(null===(i=e.post)||void 0===i?void 0:i.title)?(0,r.BX)(r.HY,{children:[" ",(0,r.tZ)(V.hh,{href:(0,eh.uRy)(e.pub,e.post),weight:"medium",ellipsis:!1,children:e.post.title})]}):null,I=x?"comment":(null===(n=e.comment)||void 0===n?void 0:n.ancestor_path)?"reply":"note";if("comment_reply"===e.type)switch(e.comment_audience){case"post_author":case"publication_author":return(0,r.BX)(r.HY,{children:["replied to a comment",x&&[" on ",x]]});case"comment_sibling":return(0,r.BX)(r.HY,{children:["also commented",x&&[" on ",x]]});default:return(0,r.BX)(r.HY,{children:["replied to your ",(null===(o=e.comment)||void 0===o?void 0:o.post_id)?"comment":"note",x&&[" on ",x]]})}else if("post_reply"===e.type)return(0,r.BX)(r.HY,{children:["commented on your ",x?["post ",x]:"note"]});else if("post_like"===e.type)return(0,r.BX)(r.HY,{children:["liked your ",x?["post ",x]:"note"]});else if("comment_like"===e.type)return(0,r.BX)(r.HY,{children:["liked your ",x?["comment on ",x]:I]});else if("comment_mention"===e.type)return(0,r.BX)(r.HY,{children:["mentioned you in a"," ",x?["comment on ",x]:I]});else if("comment_pub_mention"===e.type)return(0,r.BX)(r.HY,{children:["mentioned your publication in a ",I]});else if("post_mention"===e.type){if((t||e.pub)&&(null===(l=e.mention)||void 0===l?void 0:l.mentioned_type)==="user")return(0,r.BX)(r.HY,{children:["mentioned you",x&&[" in ",x]]});if((t||e.pub)&&(null===(a=e.mention)||void 0===a?void 0:a.mentioned_type)==="pub")return(0,r.BX)(r.HY,{children:["mentioned your publication",x&&[" in ",x]]});if(!t&&(null===(s=e.mention)||void 0===s?void 0:s.mentioned_type)==="user")return(0,r.BX)(r.HY,{children:["You were mentioned",x&&[" in ",x]]});else if(!t&&(null===(m=e.mention)||void 0===m?void 0:m.mentioned_type)==="pub")return(0,r.BX)(r.HY,{children:["Your publication was mentioned",x&&[" in ",x]]})}else if("restack"===e.type||"restack_quote"===e.type){let t="restack_quote"===e.type&&(null===(d=e.target_comment)||void 0===d?void 0:null===(c=d.attachments)||void 0===c?void 0:c.find(e=>"post"===e.type));return t&&(null==t?void 0:null===(_=t.postSelection)||void 0===_?void 0:_.text)?(0,r.BX)(r.HY,{children:["quoted your post ",x]}):"restack"===e.type&&e.target_comment?(0,r.BX)(r.HY,{children:["restacked your"," ",e.target_comment.post_id?"comment":e.target_comment.ancestor_path?"reply":"note",x&&[" on ",x]]}):(0,r.BX)(r.HY,{children:["restacked your ",x?["post ",x]:"note"]})}else if("free_subscription"===e.type)return(0,r.BX)(r.HY,{children:["subscribed to"," ",(0,r.tZ)(V.hh,{href:(0,eh.SVA)(e.pub),weight:"medium",ellipsis:!1,children:e.pub.name})]});else if("follow"===e.type)return(0,r.BX)(r.HY,{children:["followed you",e.pub?(0,r.tZ)(r.HY,{children:(0,r.tZ)(V.hh,{href:(null===(u=e.pub.author)||void 0===u?void 0:u.name)||e.pub.author_name?(0,eh.GR3)((null===(p=e.pub.author)||void 0===p?void 0:p.id)||e.pub.author_id,(null===(v=e.pub.author)||void 0===v?void 0:v.name)||e.pub.author_name):(0,eh.SVA)(e.pub),weight:"medium",ellipsis:!1,children:(null===(y=e.pub.author)||void 0===y?void 0:y.name)||e.pub.author_name||e.pub.name})}):""]});else if("presubscribe"===e.type)return(0,r.tZ)(r.HY,{children:"subscribed to you"});else if("user_first_note"===e.type)return"posted their first note";else if("new_note"===e.type)return"posted a note";else if("new_profile"===e.type)return"is on Substack";else if("community_comment_like"===e.type)return"reacted to your reply";else if("community_post_like"===e.type)return"reacted to your thread";else if("community_comment_quote_reply"===e.type||"community_comment_reply"===e.type)return"replied to your message";else if("community_post_reply"===e.type)return"replied to your thread";else if("community_comment_mention"===e.type)return"mentioned you in a reply";else if("note_like"===e.type)return"liked your note";else if("note_reply"===e.type)return"parent_comment_reacter"===e.comment_audience?"replied back to a note you liked":"replied to your note";else if("referred_free_subscription"===e.type)return(0,r.BX)(r.HY,{children:["subscribed to"," ",(0,r.tZ)(V.hh,{href:(0,eh.SVA)(e.pub),weight:"medium",ellipsis:!1,children:e.pub.name})," ","because of your share"]});else if("list_100_milestone"===e.type)return"has reached 100 subscribers";else if("list_1k_milestone"===e.type)return"has reached 1,000 subscribers";else if("arr_1k_milestone"===e.type)return"has reached $1,000 in annual revenue";else if("arr_10k_milestone"===e.type)return"has reached $10,000 in annual revenue";else if("mentioning_comment_like"===e.type)return"liked a note you were mentioned in";else if("mentioning_comment_reply"===e.type)return"replied to a note you were mentioned in";else if("mentioning_comment_restack"===e.type)return"restacked a note you were mentioned in";else if("viral_post"===e.type)return"is getting a lot of traffic";else if("share_handle"===e.type)return"Share your handle on Twitter";else if("naked_restack_reaction"===e.type)return e.sender_count?"liked your ".concat(e.feed_item_comment||e.target_comment?"note":"post"," restack"):"".concat(e.feed_item_comment?e.feed_item_comment.comment.reaction_count:e.target_comment?e.target_comment.reaction_count:null===(h=e.post)||void 0===h?void 0:h.reaction_count," people liked the ").concat(e.feed_item_comment||e.target_comment?"note":"post"," that you restacked");else if("paid_subscription"===e.type)return(0,r.BX)(r.HY,{children:["became a paying subscriber to"," ",(0,r.tZ)(V.hh,{href:(0,eh.SVA)(e.pub),weight:"medium",ellipsis:!1,children:e.pub.name})]});else if("pledged_subscription"===e.type)return(0,r.BX)(r.HY,{children:["pledged a subscription to"," ",(0,r.tZ)(V.hh,{href:(0,eh.SVA)(e.pub),weight:"medium",ellipsis:!1,children:e.pub.name})]});else if("publication_recommendation"===e.type)return(0,r.BX)(r.HY,{children:["recommended"," ",(0,r.tZ)(V.hh,{href:(0,eh.SVA)(e.pub),weight:"medium",ellipsis:!1,children:e.pub.name})]});else if("live_stream"===e.type){let t=(null===(g=e.target_live_stream)||void 0===g?void 0:g.status)==="active";return(null===(b=e.target_live_stream)||void 0===b?void 0:b.user_is_paywalled)?(null!==(f=e.sender_count)&&void 0!==f?f:0)>1?t?"are live on Substack with paid subscribers":"were live on Substack with paid subscribers":t?"is live on Substack with paid subscribers":"was live on Substack with paid subscribers":(null!==(k=e.sender_count)&&void 0!==k?k:0)>1?t?"are live on Substack":"were live on Substack":t?"is live on Substack":"was live on Substack"}else if("live_stream_scheduled"===e.type){let t=(null===(Z=e.target_live_stream)||void 0===Z?void 0:Z.status)==="active",i=(null===(w=e.target_live_stream)||void 0===w?void 0:w.status)==="scheduled";return e.target_user_id===e.user_id?null:(null!==(S=e.sender_count)&&void 0!==S?S:0)>1?i?"scheduled a live video":t?"are live on Substack":"were live on Substack":i?"scheduled a live video":t?"is live on Substack":"was live on Substack"}else if("live_stream_scheduled_invite"===e.type)return"invited you to go live";else if("live_stream_invite"===e.type){let t=(null===(B=e.target_live_stream)||void 0===B?void 0:B.status)==="active";return"".concat(t?"is inviting":"invited"," you to a live video on Substack")}else if("comment_arr"===e.type)return"note made you $".concat(e.comment_arr_usd||100);return""}(p,!!u[0])}),(0,r.tZ)(eq,{item:p})]})})]})}function eX(e){var t,i,n,o;let{item:l,namedSenders:a}=e,{iString:s}=(0,M.M1)(),m=(0,es.k)(l.target_live_stream),c=(0,C.Xe)(),d=a[0],_=null!==(t=l.cta)&&void 0!==t?t:null,u=null!==(i=null==_?void 0:_.priority)&&void 0!==i?i:"secondary";return(null==_?void 0:_.type)==="message"&&(null==d?void 0:d.name)?(0,r.tZ)(K.zx,{priority:u,size:"sm",href:(0,ey.gp)({urlParams:{user:(0,eh.JlE)({userId:d.id,userName:d.name})}}),children:s("Message")}):(null==_?void 0:_.type)==="follow"?c.data?(0,r.tZ)(eC,{user:d,text:s("follow"===l.type?"Follow back":"Follow")}):null:(null==_?void 0:_.type)==="share"?(0,r.tZ)(eM,{item:l,pub:l.pub,priority:u}):(null==_?void 0:_.type)==="subscribe"?(0,r.tZ)(K.zx,{priority:"secondary-outline",size:"sm",onClick:()=>{(0,D.uX)((0,eh.W1P)(l.pub,{addBase:!0,params:{utm_source:"recommendation_notification"}}))},children:s("Subscribe")}):(null==_?void 0:_.type)==="live-stream"&&l.target_live_stream?(0,r.tZ)(K.zx,{priority:u,size:"sm",href:l.target_live_stream_published_media_upload?(0,ev.K8_)(l.target_live_stream_published_media_upload.publication_subdomain,l.target_live_stream_published_media_upload.post_slug,{params:{utm_source:eb.b3.activityItem}}):(0,eh.UDR)({liveStreamId:null===(n=l.target_live_stream)||void 0===n?void 0:n.id,utm_source:eb.b3.activityItem,noBase:!0}),localNavigation:!l.target_live_stream_published_media_upload,children:s("Watch now")}):(null==_?void 0:_.type)==="add-livestream-to-calendar"?(0,r.tZ)(L.m,{priority:u,size:"sm",handleClick:e=>{var t;(0,O.j)(O.FP.ADD_TO_CALENDAR_CLICKED,{liveStreamId:null===(t=l.target_live_stream)||void 0===t?void 0:t.id,surface:"live-stream-activity-item",type:e})},event:m,menuProps:{onOpen:()=>{(0,R.rd)("/api/v1/live_stream/".concat(l.target_live_stream_id,"/rsvp"),{method:"PUT"})}}}):(null==_?void 0:_.type)==="live-stream-invite"?(0,r.tZ)(K.zx,{priority:u,size:"sm",onClick:()=>{(0,R.rd)("/api/v1/live_stream/".concat(l.target_live_stream_id,"/invite/").concat(l.target_live_stream_invite_id,"/accept"),{method:"PUT",json:{sendEmails:!0}}).then(e=>{alert(JSON.stringify(e))}).catch(e=>{alert(JSON.stringify(e))})},children:s("Accept invite")}):(null==_?void 0:_.type)==="post-shareable-assets"?(0,r.tZ)(K.zx,{priority:u,size:"sm",href:(0,eh.FKc)({post_id:l.target_post_id,publication_subdomain:null===(o=l.pub)||void 0===o?void 0:o.subdomain}),children:s("Open Draft")}):(null==_?void 0:_.type)==="viral-gift-granted"?(0,r.tZ)(K.zx,{priority:u,size:"sm",href:(0,eh.b1P)({pub:l.pub,params:{utm_source:eb.b3.activityItem}}),children:s("Send gifts")}):null}function eq(e){let{item:t}=e;return(0,r.tZ)(E.Ku,{timestamp:t.updated_at})}function eC(e){let{user:t,text:i}=e,{iString:n}=(0,M.M1)(),{isFollowing:o,toggle:l}=(0,C.Sv)(t,"notifications");return(0,a.useMemo)(()=>o,[])?null:(0,r.tZ)(K.zx,{priority:o?"secondary-outline":"primary",size:"sm",onClick:e=>{e.preventDefault(),l()},children:o?n("Following"):i})}function eM(e){let{item:t,pub:i,priority:n}=e,{iString:o}=(0,M.M1)(),[s,m]=(0,a.useState)(!1),c=(0,q.Cq)();return(0,a.useEffect)(()=>{if(s){let e=document.createElement("div");(0,l.render)((0,r.tZ)(()=>{let[n,o]=(0,a.useState)(s);return(0,r.tZ)(M._7,{language:(0,e_.G3)({pub:i}),children:(0,r.tZ)(q.UN,{value:c,children:(0,r.tZ)(Y.iL,{isOpen:n,setOpen:t=>{t||e.remove(),o(t),m(t)},pub:i,item:t})})})},{}),e)}},[s]),(0,r.tZ)(K.zx,{priority:n,size:"sm",onClick:e=>{e.preventDefault(),m(!0)},children:o("Share")})}function eN(e){var t;return null!==(t=e.recent_senders.find(e=>e.name))&&void 0!==t?t:null}let eP=new Set(["comment_like","comment_mention","comment_pub_mention","comment_reply","community_comment_like","community_comment_mention","community_comment_quote_reply","community_comment_reply","community_post_like","community_post_reply","free_subscription","new_note","new_profile","note_like","note_reply","comment_arr","post_like","post_mention","post_reply","naked_restack_reaction","presubscribe","restack_quote","restack","user_first_note","referred_free_subscription","follow","arr_10k_milestone","arr_1k_milestone","list_100_milestone","list_1k_milestone","viral_post","paid_subscription","pledged_subscription","share_handle","publication_recommendation","live_stream","live_stream_scheduled","live_stream_scheduled_invite","mentioning_comment_like","mentioning_comment_reply","mentioning_comment_restack","post_shareable_assets_ready","viral_gift_granted"]);function eT(e){let{item:t}=e;return(0,r.tZ)(ez,{type:function(e){let t;if(["post_like","comment_like","community_post_like","community_comment_like","note_like","naked_restack_reaction","mentioning_comment_like"].includes(e.type))t="like";else if(["restack","restack_quote","mentioning_comment_restack"].includes(e.type)){var i,n,o;let r="restack_quote"===e.type&&(null===(n=e.target_comment)||void 0===n?void 0:null===(i=n.attachments)||void 0===i?void 0:i.find(e=>"post"===e.type));t=r&&(null==r?void 0:null===(o=r.postSelection)||void 0===o?void 0:o.text)?"quote":"restack"}else t=["comment_reply","community_post_reply","community_comment_quote_reply","community_comment_reply","note_reply","mentioning_comment_reply"].includes(e.type)?"comment_sibling"===e.comment_audience?"comment":"reply":["free_subscription","presubscribe","referred_free_subscription"].includes(e.type)?"subscription":["paid_subscription","pledged_subscription"].includes(e.type)?"paid_subscription":["comment_mention","comment_pub_mention","post_mention","community_comment_mention"].includes(e.type)?"mention":["new_note","new_profile","user_first_note","live_stream","comment_arr","post_shareable_assets_ready","viral_gift_granted"].includes(e.type)?"promotion":["arr_10k_milestone","arr_1k_milestone","list_100_milestone","list_1k_milestone"].includes(e.type)?"milestone":"follow"===e.type?"follow":["live_stream","live_stream_scheduled","live_stream_invite","live_stream_scheduled_invite","live_stream_host_reminder"].includes(e.type)?"live_stream":"comment";return t}(t)})}function ez(e){let{type:t}=e;return(0,r.tZ)($.hs,{alignItems:"center",justifyContent:"center",className:c()(ef.Z.reactionBadge,ef.Z.unelevated,ef.Z["notification-".concat(t)]),children:"like"===t?(0,r.tZ)(b.Z,{color:"var(--color-accent-fg-red)"}):"comment"===t?(0,r.tZ)(h.Z,{color:"var(--color-accent-fg-cyan)"}):"restack"===t?(0,r.tZ)(x.Z,{color:"var(--color-accent-fg-green)"}):"subscription"===t?(0,r.tZ)(w.Z,{color:"var(--color-accent-fg-orange)"}):"paid_subscription"===t?(0,r.tZ)(Z.Z,{color:"var(--color-accent-fg-orange)"}):"follow"===t?(0,r.tZ)(w.Z,{color:"var(--color-accent-fg-orange)"}):"mention"===t?(0,r.tZ)(k.Z,{color:"var(--color-accent-fg-purple)"}):"quote"===t?(0,r.tZ)(S.Z,{color:"var(--color-accent-fg-yellow)"}):"promotion"===t?(0,r.tZ)(I.Z,{color:"var(--color-accent-fg-purple)"}):"milestone"===t?(0,r.tZ)(g.Z,{color:"var(--color-accent-fg-yellow)"}):"live_stream"===t?(0,r.tZ)(f.Z,{color:"var(--color-accent-fg-red)"}):(0,r.tZ)(B.Z,{color:"var(--color-accent-fg-cyan)"})})}function eA(e){let t=new Map(e.pubs.map(e=>[e.id,e])),i=new Map(e.posts.map(e=>[e.id,e])),n=new Map(e.drafts.map(e=>[e.id,e])),o=new Map(e.users.map(e=>[e.id,e])),r=new Map(e.comments.map(e=>[e.id,e])),l=new Map(e.mentions.map(e=>[e.id,e])),a=new Map(e.communityPosts.map(e=>[e.id,e])),s=new Map(e.communityComments.map(e=>[e.id,e])),m=new Map(e.feedItemComments.map(e=>[e.comment.id,e])),c=new Map((e.liveStreams||[]).map(e=>[e.id,e]));return{publications:t,posts:i,users:o,comments:r,mentions:l,communityPosts:a,communityComments:s,feedItemComments:m,liveStreams:c,liveStreamInvites:new Map((e.liveStreamInvites||[]).map(e=>[e.id,e])),drafts:n,viralGifts:new Map((e.viralGifts||[]).map(e=>{var t;return[null===(t=e.unsent[0])||void 0===t?void 0:t.publication_id,e]}).filter(e=>!!e[0]))}}let eV=new Set([ep.Os.comment_reply,ep.Os.comment_mention,ep.Os.comment_pub_mention,ep.Os.note_reply,ep.Os.note_like,ep.Os.post_reply,ep.Os.restack_quote,ep.Os.restack,ep.Os.user_first_note]),eE=(e,t)=>{var i,n;return eV.has(t.type)&&null!==t.feed_item_comment&&((null===(n=t.feed_item_comment)||void 0===n?void 0:null===(i=n.comment)||void 0===i?void 0:i.user_id)!==(null==e?void 0:e.id)||!t.target_post_id&&("restack"===t.type||"restack_quote"===t.type||"note_like"===t.type))}},35449:function(e,t,i){i.d(t,{f:()=>a});var n=i(16584),o=i(80026),r=i(65575),l=i(43883);function a(e){let{count:t=8}=e;return(0,n.tZ)(r.mE,{children:Array(t).fill(0).map(()=>(0,n.tZ)(s,{}))})}function s(e){let{elevated:t=!1}=e;return(0,n.tZ)(r.Uj,{linkClassName:l.Z.notificationLink,isPadded:!1,children:(0,n.BX)(o.hs,{gap:12,className:l.Z.container,flex:"grow",children:[(0,n.tZ)(r.Vm,{width:32,height:32,type:"circle",elevated:t}),(0,n.BX)(o.tu,{gap:12,flex:"grow",children:[(0,n.tZ)(r.Vm,{width:32,height:32,type:"circle",elevated:t}),(0,n.BX)(o.tu,{flex:"grow",gap:8,children:[(0,n.tZ)(r.Vm,{type:"bar",width:"50%",elevated:t}),(0,n.tZ)(r.Vm,{type:"bar",width:"60%",elevated:t}),(0,n.tZ)(r.Vm,{type:"bar",width:"35%",elevated:t})]})]})]})})}}}]);