"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["2340"],{20392:function(t,e,i){i.d(e,{Z:()=>a});let a={container:"container-AejwGn",tab:"tab-FhVbMD",highlight:"highlight-rZ7aQJ"}},90311:function(t,e,i){i.d(e,{SP:()=>J,fB:()=>V,hp:()=>q});var a=i(27412),n=i(7409),o=i(99282),s=i(16584),c=i(6400),l=i(30396),r=i(94184),d=i.n(r),h=i(39693),p=i.n(h),m=i(26224),u=i(60826),_=i(33112),Z=i(39432),g=i(64579),v=i(21286),b=i(25265),k=i(21206),f=i(39929),N=i(54688),w=i(48917),S=i(94922),y=i(94442),C=i(85685),x=i(30329),B=i(95441),P=i(40647),M=i(90099),A=i(68833),L=i(7882),U=i(94874),X=i(24547),F=i(19081),I=i(58175),z=i(2009),R=i(98012),O=i(24791),W=i(31377),E=i(60308),T=i(33884),D=i(63651),K=i(84864),H=i(47929);class j extends c.Component{componentWillUnmount(){this.unmounted=!0}render(t){let{pub:e,post:i,showAuthor:a,showPhoto:c,fromPostPage:l}=t;return(0,y.F6)({pub:e,post:i,showAuthor:a,showPhoto:c})||(0,y.Cz)({pub:e,post:i,showAuthor:a})||(0,y.z5)({pub:e,post:i,showAuthor:a})?this.withAuthorLine(this.props,this.state):(0,s.tZ)($,(0,o._)((0,n._)({},this.props),{editOnRightSide:this.props.showUpdatedIcons,className:this.props.showUpdatedIcons?"alternative-meta":this.props.className,isMobileWidth:this.state.isMobileWidth,actionBarStyle:l?"post-header-compact":"post-preview"}))}constructor(t,e){var i;if(super(t,e),(0,a._)(this,"unmounted",void 0),(0,a._)(this,"withAuthorLine",(t,e)=>{let{pub:i,post:a,showAuthor:n,showPhoto:o,getConfigFor:c,isAppMode:l}=t,r="adhoc_email"===a.type,h=(0,K.getBylineUsers)(a).length,p=1===h&&(0,K.getBylineUsers)(a)[0],u=p&&p.is_guest&&!c("dont_show_guest_byline")&&!r,_=t.showDate||t.showDatetime,Z=!a.is_published&&!t.inThreadHead&&_&&!r,g=t.isFreePreview&&t.showAudience&&_&&!r,v=(0,W.isFoundingAudience)(a.audience)&&t.showAudience&&!g&&_&&!r&&!(0,O.sv)({post:a}),b=(0,W.isPaidAudience)(a.audience)&&t.showAudience&&!v&&!g&&_&&!r&&!(0,O.sv)({post:a}),k=(0,y.F6)({pub:i,post:a,showAuthor:n,showPhoto:o});return(0,s.tZ)(M.YF,{width:"100%",className:d()("post-meta"),children:(0,s.BX)("tr",{children:[(0,s.tZ)("td",{children:(0,s.BX)(M.i$,{children:[(0,s.tZ)(M.zK,{gap:4,children:(0,s.tZ)(I.xv.Meta,{color:"primary",className:m.A.postAuthor,children:h>0?(0,K.oxfordComma)((0,K.getBylineUsers)(a).map(t=>(0,s.tZ)(I.xv.Meta,{as:"a",href:l?(0,D.FA)({user_id:t.id,user_name:t.name,redirect:"app-store-no-desktop"}):(0,E.LwU)(t,i),color:"primary",style:"text-decoration: none",children:t.name}))):(0,K.getPrintedByline)(i,a)})}),(0,s.BX)(M.zK,{gap:4,children:[(0,s.tZ)(I.xv.Meta,{children:(t.showDate||t.showDatetime)&&a.post_date&&(0,s.tZ)("time",{dateTime:(0,R.Z)(a.post_date).toISOString(),children:(0,R.Z)(a.post_date).locale(this.context.language).standardDate()})}),b&&(0,s.BX)(M.zK,{gap:4,children:[(0,s.tZ)(I.xv.Meta,{children:"∙"}),(0,s.tZ)(I.xv.Meta,{color:"paid",translated:!0,children:"Paid"})]}),v&&(0,s.BX)(M.zK,{gap:4,children:[(0,s.tZ)(I.xv.Meta,{children:"∙"}),(0,s.tZ)(I.xv.Meta,{color:"paid",children:this.context.iString((0,O.a_)(i,a))})]}),g&&(0,s.BX)(M.zK,{gap:4,children:[(0,s.tZ)(I.xv.Meta,{children:"∙"}),(0,s.tZ)(I.xv.Meta,{color:"paid",translated:!0,children:"Preview"})]}),u&&(0,s.BX)(M.zK,{gap:4,children:[(0,s.tZ)(I.xv.Meta,{children:"∙"}),(0,s.tZ)(I.xv.Meta,{translated:!0,children:"Guest post"})]}),Z&&(0,s.BX)(M.zK,{gap:4,children:[(0,s.tZ)(I.xv.Meta,{children:"∙"}),(0,s.tZ)(I.xv.Meta,{translated:!0,children:"Draft"})]})]})]})}),k&&(0,s.tZ)("td",{align:"right",children:(0,s.tZ)(M.zK,{gap:4,children:h>0&&(0,K.getBylineUsers)(a).map((t,e)=>{var a;return e<4&&(0,s.tZ)("a",{href:l?(0,D.FA)({user_id:t.id,user_name:t.name,redirect:"app-store-no-desktop"}):(0,E.LwU)(t,i),children:(0,s.tZ)(M.NS,{src:null!==(a=t.photo_url)&&void 0!==a?a:"",size:h>1?32:40})})})})})]})})}),"undefined"!=typeof window&&(null===(i=window)||void 0===i?void 0:i.matchMedia)){let t=window.matchMedia("screen and (max-width: 650px)");this.state={isMobileWidth:t.matches};let e=t=>{this.unmounted||this.setState({isMobileWidth:t.matches})};t.addEventListener?t.addEventListener("change",e):t.addListener&&t.addListener(e)}}}(0,a._)(j,"contextType",B.wj);let J=(0,P.xY)(j);function V(t){var e,i;let{pub:a,post:o,user:r,reactors:d,secondaryFaces:h,mediaClipId:p}=t,[m,u]=(0,l.eJ)(null),[Z,g]=(0,l.eJ)(!1),v=(0,L.ib)({pathname:"primary"===m?"/api/v1/post/".concat(o.id,"/reactors"):"/api/v1/".concat(p?"media_clip":"post","/").concat(null!=p?p:o.id,"/restackers"),auto:!!m,deps:[o.id,m]}),b=Q(d,r,!!o.reaction,a),k=Q(h,r,!!o.restacked,a),f=b.concat(k.filter(t=>!!t.photo_url&&!b.find(e=>e.id===t.id))),N=Math.max(null!==(e=o.reactions["❤"])&&void 0!==e?e:0,(null!=b?b:[]).length),w=a.hide_post_restacks?0:null!==(i=o.restacks)&&void 0!==i?i:0,S=N>0?(0,K.pluralize)(N,"Like"):"",y="";return w>0&&(y="".concat((0,K.pluralize)(w,"Restack"))),(0,s.BX)(s.HY,{children:[(0,s.BX)(F.X2,{gap:16,alignItems:"center",color:"secondary",children:[(0,s.tZ)(X.H,{users:f,renderAvatar:t=>(0,s.tZ)(U.xV,(0,n._)({},t)),direction:"rtl",renderCount:()=>(0,s.tZ)(c.Fragment,{})}),(0,s.tZ)(I.xv.B4,{color:"secondary",children:(0,s.BX)(F.X2,{gap:4,alignItems:"center",children:[(0,s.tZ)(G,{label:S,onClick:()=>{N&&((0,A.j)(A.FP.POST_REACTIONS_MODAL_VIEWED,{post_id:o.id}),u("primary"),g(!0))}}),S&&y&&"∙",(0,s.tZ)(Y,{post:o,label:y})]})})]}),v.result&&(0,s.tZ)(_.F,{isOpen:Z,modalLabel:S,faces:v.result,totalCount:N,onClose:()=>{g(!1),u(null)},utmSource:"post-reactions-modal"})]})}let G=t=>{let{label:e,onClick:i}=t;return(0,s.tZ)(I.hh,{onClick:i,color:"secondary",cursor:"pointer",children:e})},Y=t=>{let{label:e,post:i}=t;return(0,s.tZ)(I.xv.B4,{color:"secondary",children:(0,s.tZ)(I.hh,{href:(0,T.Oi)(i.id,{noBase:z.L,urlParams:{utm_source:H.b3.substack,utm_content:H.fZ.facepileRestacks}}),color:"secondary",children:e})})};function q(t){var e,i;let{post:a,user:o,pub:c,mediaClipId:l}=t,r=(0,L.ib)({pathname:"/api/v1/post/".concat(a.id,"/facepile"),auto:!0,deps:[a.id,l],query:{media_clip_id:l}});return(0,s.tZ)(V,(0,n._)({reactors:Q(null===(e=r.result)||void 0===e?void 0:e.reactors,o,!!a.reaction,c),secondaryFaces:Q(null===(i=r.result)||void 0===i?void 0:i.restackers,o,!!a.restacked,c)},t))}function Q(t,e,i,a){if(!t)return[];if(e){let n=t.findIndex(t=>t.id===e.id);i&&("private"!==e.subscription_visibility||46438===a.id)&&e.activity_likes_enabled&&n<0?t.splice(0,0,{id:e.id,name:e.name,photo_url:e.photo_url}):!i&&n>=0&&t.splice(n,1)}return t}function $(t){var e;let i,{additionalCommentCount:a=0,className:n,user:o,pub:c,post:l,showAudience:r=!1,showDate:h=!1,showEmailSent:m=!1,showDatetime:_=!1,showReactions:v=!0,showComments:B=!0,showShare:P=!1,showRestack:M=!1,showPublicationName:A=!1,hidePinning:L=!1,reaction_token:U,onClick:X,onChange:F,isStatic:z=!1,isFreePreview:O=!1,allowSendEmail:T=!1,allowEdit:D=!1,shareTooltipText:j,showPins:J,sharedShareDialog:V,showUpdatedIcons:G,editOnRightSide:Y=!1,onClickCommentButton:q,showAuthor:Q,showPhoto:$,fromPostPage:te,isMobileWidth:ti,actionBarStyle:ta="post-header-compact"}=t,tn=c.id===l.publication_id?c:void 0,to="post-footer"===ta,ts=to?20:"post-preview"===ta?14:18,tc="post-header-large"===ta?20:"post-preview"===ta?16:"thread-head"===ta||to?14:18;i=l.comment_url_override?l.comment_url_override:z?"".concat(u.W.HALF_MAGIC_COMMENTS_URL,"&utm_source=").concat(H.b3.substack,"&utm_medium=").concat(H.lP.email):(0,E.uRy)(c,l,{comments:!0});let tl=a+(null!==(e=l.comment_count)&&void 0!==e?e:0),tr=B&&!O&&(0,K.showCommentsOnPost)({publication:c,post:l})&&"restack"!==l.type,td=v&&!O&&!["adhoc_email","restack"].includes(l.type),th=(h||_)&&l.post_date&&!l.is_draft,tp=m?!!l.email_sent_at:null,tm=p()([m&&tp&&{className:"email-sent",title:"This post was sent as an email",content:(0,s.tZ)(Z.Z,{className:"post-meta-icon",height:ts,isStatic:z})},J&&l.is_section_pinned&&{className:"icon pinned",content:(0,s.tZ)(f.Z,{className:"post-meta-icon",isStatic:z})},"adhoc_email"===l.type?{className:"audience-adhoc",content:(0,s.tZ)(N.Z,{className:"post-meta-icon",isStatic:z})}:r&&(0,W.isPaidAudience)(l.audience)&&{className:"audience-lock",content:(0,s.tZ)(g.Z,{color:"#666666",height:ts,isStatic:z})},(0,y.Er)({pub:c,post:l,showAuthor:Q,showPhoto:$,isMobileWidth:ti})&&{className:"author",content:(0,K.getBylineUsers)(l).length>0?(0,K.oxfordComma)((0,K.getBylineUsers)(l).map(t=>(0,s.tZ)(C.ProfileHoverCard,{disabled:z,subject:t,utmSource:"byline",children:(0,s.tZ)("a",{href:(0,E.LwU)(t,c),onClick:t=>t.stopPropagation(),children:t.name})}))):(0,K.getPrintedByline)(c,l)},A&&{className:"post-publication-name",content:c.name},G&&!Y&&D&&!z&&o&&o.is_contributor&&{className:"post-meta-item icon edit-icon",onClick:t=>t.stopPropagation(),content:(0,s.tZ)(w.l,{pub:c,post:l,iconHeight:ts,hidePinning:L,user:o,emailSent:tp,allowSendEmail:T,showUpdatedIcons:G})},th&&{className:"post-date",title:(0,R.Z)(l.post_date).toISOString(),content:(0,s.tZ)(I.xv.Meta,{children:(0,s.tZ)("time",{dateTime:(0,R.Z)(l.post_date).toISOString(),children:(0,y.fh)({post:l,showDatetime:_,isStatic:z,fromPostPage:te,showReactions:td})})})},(null==tn?void 0:tn.community_enabled)&&l.slug&&td&&!l.is_draft&&{className:"icon",onClick:t=>t.stopPropagation(),content:(0,s.tZ)(x.dJ,{user:o,pub:c,post:l,token:U,onChange:t=>{null==F||F(t)},height:tc,isStatic:z,buttonStyle:to,className:"post-meta-icon like-reaction-button",hideReactionCount:to&&!z})},o&&{className:"icon",onClick:t=>t.stopPropagation(),content:(0,s.tZ)(tt,{post:l,isPostFooter:to,isStatic:z,lucideIconHeight:tc,onChange:F})},(null==tn?void 0:tn.community_enabled)&&l.slug&&tr&&!l.is_draft&&{className:"icon",onClick:t=>t.stopPropagation(),content:(0,s.BX)("a",{className:to?"post-meta-button button":"",href:i,native:tn&&(0,E.Fdd)(document.location.pathname),onClick:q,children:[(0,s.tZ)(b.Z,{className:"comment-icon post-meta-icon",isStatic:z,height:tc,alt:"Comment",stroke:"#757575",fill:"transparent",strokeWidth:z?1:1.5,ampProps:{layout:"fixed"}}),!tl&&to&&(0,s.tZ)("span",{className:"meta-button-label",children:"Comment"}),tl>0&&(0,s.tZ)("span",{className:"comment-count",children:(0,K.numberToString)(tl)})]})},M&&!to&&{className:"icon",onClick:t=>t.stopPropagation(),content:(0,s.BX)("a",{href:u.W.RESTACK_URL,className:to?"button post-meta-button":void 0,children:[(0,s.tZ)(k.Z,{className:"recommend-icon post-meta-icon",isStatic:z,height:tc,alt:"Recommend",stroke:"#757575",fill:"transparent",strokeWidth:z?1:1.5,ampProps:{layout:"fixed"}}),to&&(0,s.tZ)("span",{className:"meta-button-label",children:"Recommend"})]})},P&&"only_free"!==l.audience&&!l.is_draft&&!O&&{className:"icon",onClick:t=>t.stopPropagation(),content:(0,s.BX)(S.v,{user:o,pub:tn,post:l,reaction_token:U,height:tc,onChange:F,isStatic:z,sharedShareDialog:V,position:"post-footer"===ta?"post-footer":"post-header",linkClassName:to?"button post-meta-button":void 0,children:[to&&(0,s.tZ)("span",{className:"meta-button-label",children:"Share"}),j&&(0,s.tZ)("div",{className:"share-tooltip-wrap",children:(0,s.tZ)("div",{className:"share-tooltip",children:j})})]})},(!G||Y)&&D&&!z&&o&&o.is_contributor&&{className:"icon edit-icon",onClick:t=>t.stopPropagation(),content:(0,s.tZ)(w.l,{pub:c,post:l,iconHeight:ts,hidePinning:L,user:o,emailSent:tp,allowSendEmail:T,showUpdatedIcons:G})}]);return z?(0,s.tZ)("table",{className:d()("post-meta custom",{big:to},n),cellpadding:"0",cellspacing:"0",onClick:X,children:(0,s.tZ)("tr",{children:tm.map(t=>{let{className:e,title:i,onClick:a,content:n}=t;return(0,s.tZ)("td",{className:d()("post-meta-item",e),title:i,onClick:a,children:n})})})}):(0,s.tZ)("div",{className:d()("post-meta post-meta-actions-web custom",{big:to},n),onClick:X,children:tm.map(t=>{let{className:e,title:i,onClick:a,content:n}=t;return(0,s.tZ)("div",{className:d()("post-meta-item",e),title:i,onClick:a,children:n})})})}function tt(t){let{post:e,isPostFooter:i,isStatic:a,lucideIconHeight:c,onChange:l}=t,{onSave:r,isSaved:h}=(0,y.vk)({post:e,isSaved:e.is_saved});return(0,s.BX)("a",{className:d()("post-meta-save-button",i?"post-meta-button button":"",{isSaved:h}),href:a&&u.W.SAVE_POST_URL||void 0,onClick:()=>{let t=r();null==l||l({post:(0,o._)((0,n._)({},e),{is_saved:t})})},children:[(0,s.tZ)(v.Z,{isStatic:a,height:c,stroke:"#757575",strokeWidth:a?1:1.5}),i&&(0,s.tZ)("span",{className:"meta-button-label",children:"Save"})]})}}}]);