"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["1760"],{89451:function(e,t,i){i.d(t,{Z:()=>n});let n={placeholder:"placeholder-lQYQJg",placeholderMessage:"placeholderMessage-GZJPyX"}},77686:function(e,t,i){i.d(t,{Z:()=>n});let n={button:"button-NT7dt3",avatarWithPubLogo:"avatarWithPubLogo-FS3Qv7",avatar:"avatar-mn4drz",pubLogo:"pubLogo-cMWGpU",displayedBadge:"displayedBadge-gAo5ie",pubAvatar:"pubAvatar-QXvrAG",offer:"offer-BpTfs_",unavailable:"unavailable-hONyuw",description:"description-Ca932u",check:"check-lUurJO",disabledCheck:"disabledCheck-I9na7Z",originalPrice:"originalPrice-GLByyh",closeButton:"closeButton-l2SNve"}},5749:function(e,t,i){i.d(t,{Z:()=>n});let n={variables:"variables-fH4ag7",containsAppPrompt:"containsAppPrompt-UMsmqt",isHidden:"isHidden-vzcyV0",page:"page-aOaH_e",miniInboxItem:"miniInboxItem-qLFrMG",newItems:"newItems-twwRBA",facepile:"facepile-BvssMQ",face:"face-P6q4PH",tabIcon:"tabIcon-KkbGZ1",feedItem:"feedItem-ONDKv3",feedUnit:"feedUnit-NTpfyQ",showThreadGutter:"showThreadGutter-X3iYha",hasAvatar:"hasAvatar-XDSVUi",hasAction:"hasAction-pgoBA3",seeMoreFade:"seeMoreFade-xP5n8v",feedPermalinkUnit:"feedPermalinkUnit-JBJrHa",permalinkHeader:"permalinkHeader-bQJTnJ",seeMoreReplies:"seeMoreReplies-K4uhty",seeMoreThread:"seeMoreThread-KEnEyq",seeMoreThreadSegment:"seeMoreThreadSegment-_Apecq",top:"top-zb_BJC",hasContext:"hasContext-_DCyNJ",replyUnit:"replyUnit-tO0ejm",youtube:"youtube-AgNZc0",tiktok:"tiktok-x4gDkP",spotify:"spotify-cCmxPs",youtubeIframe:"youtubeIframe-kP47yC",tiktokIframe:"tiktokIframe-izo_uk",feedCommentBody:"feedCommentBody-UWho7S",feedCommentBodyInner:"feedCommentBodyInner-AOzMIC",smallPreview:"smallPreview-dZMrxO",underlineLink:"underlineLink-RuIQrC",disabled:"disabled-W2Bv0n",peopleYouMayKnowContainer:"peopleYouMayKnowContainer-A79AYm",peopleYouMayKnow:"peopleYouMayKnow-GCnR1N",seeMore:"seeMore-D88zkH",seeMoreText:"seeMoreText-Y5A1El",postAttachment:"postAttachment-eYV3fM",saveButton:"saveButton-BUhk5Q",commentContainer:"commentContainer-kpPRBB",vibrantHeader:"vibrantHeader-We3FVb",postImage:"postImage-L4FlO9",vibrantPostImage:"vibrantPostImage-TTXyOq",linkImage:"linkImage-i4xmRa",linkImagePlaceholder:"linkImagePlaceholder-zpM5qk",actionRow:"actionRow-T4wXed",moreButtonContainer:"moreButtonContainer-zdayXV",moreButton:"moreButton-EXZOW4",shortPostText:"shortPostText-HTEthL",large:"large-xah3K0",stat:"stat-Q5QJPb",reportModal:"reportModal-LypavT",likeButton:"likeButton-R3Kfso",heartWrapper:"heartWrapper-PXEHho",heart:"heart-oifoWn",active:"active-c0Nov_",clickedOnce:"clickedOnce-CLj8DV",isLiked:"isLiked-iBpLIp","heart-bounce":"heart-bounce-_VxmXZ",heartBounce:"heart-bounce-_VxmXZ",spark:"spark-Jja6Nt","spark-burst":"spark-burst-qrrWP7",sparkBurst:"spark-burst-qrrWP7",sparks:"sparks-KOlXwI",ripple:"ripple-DknUjK",mutedItem:"mutedItem-ZGcK37",vibrant:"vibrant-Ys_KyG",saved:"saved-BzlEct",videoThumbnailImage:"videoThumbnailImage-GeQb7o",feedStatsGrid:"feedStatsGrid-lsizQ6",inlineLinkRow:"inlineLinkRow-b2tbOE",transparentLoginPrompt:"transparentLoginPrompt-sD3O95",appPrompt:"appPrompt-gZ1qj_",asParent:"asParent-gmw3iy"}},54416:function(e,t,i){i.d(t,{Z:()=>n});let n={visitedSurfacesIFrame:"visitedSurfacesIFrame-yy8AJL"}},93974:function(e,t,i){i.d(t,{Jg:()=>ep,Q4:()=>eE,V8:()=>eT,mZ:()=>e9,qp:()=>eh,rk:()=>eR,xn:()=>to});var n=i(7409),o=i(99282),r=i(98848),l=i(58865),a=i(16584),s=i(6400),d=i(30396),c=i(94184),u=i.n(c),p=i(28175),h=i.n(p),m=i(10293),g=i(28058),v=i(88812),f=i(85200),b=i(45609),_=i(99869),y=i(26141),Z=i(7617),w=i(47976),k=i(7073),C=i(49770),S=i(17048),x=i(27194),B=i(887),P=i(2564),I=i(13639),N=i(41293),T=i(36412),E=i(51534),L=i(45530),X=i(3880);i(20888);var M=i(28905),R=i(19548),F=i(95441),U=i(60807),O=i(37663),A=i(67348),D=i(68833),z=i(48980),j=i(12799),H=i(98914),W=i(94874),q=i(17540),Y=i(15771),V=i(80026),K=i(44424),J=i(63474),G=i(43570),Q=i(70379),$=i(33451),ee=i(16913),et=i(32223),ei=i(97842),en=i(11308);i(70125);var eo=i(64172),er=i(76820),el=i(23398),ea=i(63651),es=i(32440),ed=i(23710),ec=i(77859);function eu(){let e=(0,l._)(["You are not allowed to post or react to this chat. ",""]);return eu=function(){return e},e}function ep(e){var t,i,n;let{communityPost:o,author:r,pubRole:l,extras:s,withAttribution:c,flex:u,hideReply:p,isReadOnly:h,onReply:g,onDelete:v,pub:f,truncate:b=!0,surface:_,useClientSideRouting:y,utmSource:Z,isPaid:w,isFounding:k}=e,{iString:C}=(0,F.M1)(),S=(0,d.sO)(null),x=y?(0,ea.xC8)({pubId:o.publication_id,postId:o.id,noBase:!0}):(0,ea._5K)({postId:o.id,utm_source:Z}),B=(0,en.o)({entityType:"communityPost",publication:f}),P=(0,R.KG)(o.user_id);return(0,a.BX)(eO,{pubThemeAccentColor:null!==(n=null==f?void 0:null===(t=f.theme)||void 0===t?void 0:t.background_pop_color)&&void 0!==n?n:null==f?void 0:f.theme_var_background_pop,pubThemePrintOnPopColor:null==f?void 0:null===(i=f.theme)||void 0===i?void 0:i.print_on_pop,user:r,pubRole:l,flex:u,containerRef:S,extras:s,children:[c&&(0,a.tZ)(to,{text:"From ".concat(r.name,"’s subscriber chat")}),!P&&(0,a.tZ)($.KV,{user:r}),(0,a.tZ)(eg,{actionMenuProps:{communityEntity:o,publicationId:o.publication_id,replyAction:g&&!p&&(0,a.tZ)(K.sN,{leading:(0,a.tZ)(m.Z,{}),disabled:o.is_locked,onClick:g,children:C("Reply")}),onReply:h||p||o.is_locked?void 0:g,onDelete:v,onReport:B,isReadOnly:h,isFlagged:o.reported_by_user},flex:u,children:(0,a.tZ)(eh,{communityPost:o,hideReply:p,userBlockStatus:P,isFounding:k,isPaid:w,isReadOnly:h,useClientSideRouting:y,utmSource:Z,pub:f,truncate:b,surface:_,author:r})}),!p&&(0,a.tZ)(J.A0,{href:x,children:(0,a.tZ)(e9,{onClick:g,direction:"incoming",commenters:o.recent_commenters,count:o.comment_count,hasUnread:!!(o.most_recent_comment_created_at&&o.user_last_viewed_timestamp&&o.user_last_viewed_timestamp0||S),B=null!=b?b:{type:"posts",id:t.id},{audience:P}=t,{canReply:I,shouldShowToken:N}=tt({audience:P,isFounding:s,isPaid:d,chatPaywallStatus:null==c?void 0:c.paywall_chat}),T=(0,ei.I0)(),E=m?(0,ea.xC8)({pubId:t.publication_id,postId:t.id,noBase:!0,params:{backAction:w}}):(0,ea._5K)({postId:t.id,utm_source:g}),L=function(e,t){if(!e||!(null==t?void 0:t.url))return e;let i=t.url,n=e.trim();return n.startsWith(i)?n.slice(i.length).trim():n.endsWith(i)?n.slice(0,-i.length).trim():e}(t.body,t.link_metadata),M=e=>{"feed-recommended"!==B.type&&(_?_({id:t.id,reaction:e}):ev(t.id,"posts",T,t.reaction)(e))},R=null!=y?y:t.reaction,F=null!=Z?Z:t.reactions,U=p&&(p.startsWith("chat_inbox")?"chat_inbox":(0,O.T)(p));return(0,a.BX)(e0,{hasFooter:!i,children:[!r&&"media"===t.type&&(C.length>0||S)&&(0,a.BX)(et.c,{context:B,reactions:F,currentReaction:R,onReactionClick:M,isReadOnly:l,children:[S&&(0,a.tZ)(er.Jl,{mediaUpload:S.mediaUpload,composing:!1,maxWidth:400,videoPlayerProps:{surface:U,entityType:"community_post",entityKey:t.id,contentType:"communityPost",primaryEntityKey:h,primaryEntityType:h?"post":void 0}},S.mediaUpload.id),C&&(0,a.BX)(V.xu,{children:[(0,a.tZ)(X.E,{assets:C.filter(e=>e.url).map(e=>({src:e.url,explicit:e.explicit,width:e.width,height:e.height})),className:u()(es.Z.imageGroup,i&&!t.body&&es.Z.isLast),maxWidth:400,maxHeight:420,readOnly:l,isContained:!0,outline:k}),N&&!t.body&&(0,a.tZ)(e2,{className:es.Z.right,canReply:!!I,audience:t.audience,style:"media"})]})]}),!r&&t.link_metadata&&(0,a.tZ)(et.c,{context:B,reactions:F,currentReaction:null!=y?y:t.reaction,onReactionClick:M,setReactions:!!(x&&t.link_metadata),isReadOnly:l,alignSelf:"stretch",children:(0,a.tZ)($.xk,{metadata:t.link_metadata,isFirst:x,direction:"incoming"})}),(t.body||x&&!t.link_metadata)&&(0,a.tZ)(et.c,{context:B,reactions:F,currentReaction:null!=y?y:t.reaction,onReactionClick:M,setReactions:x&&!t.link_metadata,isReadOnly:l,alignSelf:"stretch",children:L&&(0,a.tZ)(J.A0,{href:E,style:{display:"flex"},children:(0,a.tZ)(e4,{publication:c,communityEntity:(0,o._)((0,n._)({},t),{body:L}),onClick:e=>{!e.defaultPrevented&&f&&f(e)},truncate:v,isPaid:d,isFounding:s,outline:k})})})]})}let em=e=>{let t=[],i=null;for(let n of e)"image"===n.type?t.push(n):i||(i=n);return{images:t,video:i}};function eg(e){let{children:t,actionMenuProps:i,flex:o="grow"}=e;return(0,a.BX)(V.gq,{alignItems:"start",gap:12,flex:o,children:[(0,a.tZ)($.pc,{children:t}),(0,a.tZ)(ez,(0,n._)({},i))]})}let ev=(e,t,i,n)=>async o=>{n===o?i(eb(o,e,t)):i(ef(o,e,t,n))},ef=(e,t,i,n)=>async(o,r)=>{let{iString:l,iTemplate:a}=I18N.i("en");o({type:"".concat(i,"-new_reaction"),payload:{id:t,reaction:e}});let s=await (0,N.oQ)(e,t,i);if(s instanceof z.kp){var d,c;(null===(d=s.body)||void 0===d?void 0:d.status)==="PUBLICATION_BAN"?alert(a(eu(),null===(c=s.body)||void 0===c?void 0:c.error)):alert(l("We failed to post your comment. Please try again later."))}s instanceof Error&&o(n?{type:"".concat(i,"-new_reaction"),payload:{id:t,reaction:n}}:{type:"".concat(i,"-remove_reaction"),payload:{id:t,reaction:e}})},eb=(e,t,i)=>async(n,o)=>{n({type:"".concat(i,"-remove_reaction"),payload:{id:t,reaction:e}}),await (0,N.aQ)(e,t,i) instanceof Error&&n({type:"".concat(i,"-new_reaction"),payload:{id:t,reaction:e}})},e_=(e,t)=>async(i,n)=>{i({type:"posts-delete_post",payload:{id:e,publication_id:t}});let o=await eN(e);o instanceof Error&&console.warn("error deleting thread",o)},ey=(e,t,i)=>async(n,o)=>{n({type:"comments-delete_comment",payload:{id:e,postId:t}});let r=await eB(e);if(r instanceof Error&&console.warn("error deleting comment",r),i){let e=await eP(i);e instanceof Error||n({type:"comments-update_comment",payload:{id:i,comment:e.comment}})}let l=await eI(t);l instanceof Error||n({type:"posts-update_post",payload:{id:t,post:l.communityPost}})},eZ=(e,t)=>async(i,n)=>{i({type:"posts-lock_replies",payload:{id:e,isLocked:t}});let o=await eC(e,t);o instanceof Error&&(console.warn("error locking post",o),alert("There was an error ".concat(t?"locking":"unlocking"," replies to this post. Please try again later.")),i({type:"posts-lock_replies",payload:{id:e,isLocked:!t}}))},ew=(e,t)=>async(i,n)=>{i({type:"comments-lock_replies",payload:{id:e,isLocked:t}});let o=await eS(e,t);o instanceof Error&&(console.warn("error locking comment",o),alert("There was an error ".concat(t?"locking":"unlocking"," replies to this comment. Please try again later.")),i({type:"comments-lock_replies",payload:{id:e,isLocked:!t}}))},ek=(e,t)=>async(i,n)=>{i({type:"comments-ban_author",payload:{id:e,ban:t}});let o=await ex(e,t);o instanceof Error&&(console.warn("error toggling ban for comment author",o),alert("There was an error ".concat(t?"banning":"unbanning"," this user. Please try again later.")),i({type:"comments-ban_author",payload:{id:e,ban:!t}}))};async function eC(e,t){try{return await fetch("/api/v1/community/posts/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({is_locked:t})})}catch(e){return e}}async function eS(e,t){try{return await fetch("/api/v1/community/comments/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({is_locked:t})})}catch(e){return e}}async function ex(e,t){try{return await fetch("/api/v1/community/comments/".concat(e,"/publication_bans?ban=").concat(t.toString()),{method:"POST"})}catch(e){return e}}async function eB(e){try{return await (0,z.rd)("/api/v1/community/comments/".concat(e),{method:"DELETE",json:{commentId:e}})}catch(e){return e}}async function eP(e){try{return await (0,z.rd)("/api/v1/community/comments/".concat(e),{method:"GET"})}catch(e){return console.warn(e),e}}async function eI(e){try{return await (0,z.rd)("/api/v1/community/posts/".concat(e),{method:"GET"})}catch(e){return console.warn(e),e}}async function eN(e){try{return await (0,z.rd)("/api/v1/community/posts/".concat(e),{method:"DELETE",json:{postId:e}})}catch(e){return e}}function eT(e){let{author:t,extras:i,showReply:r=!0,analyticsParams:l,commenters:s,count:c,audience:u,paywallInfo:p,onClick:h}=e;return(0,d.d4)(()=>{var e;l&&(0,D.j)(D.FP.THREAD_PAYWALL_SCREEN_VIEWED,(0,o._)((0,n._)({},l),{audience:u&&("only_founding"===(e=u)?"founding":"only_paid"===e?"paid":"free")}))},[]),(0,a.BX)(eO,{user:t,extras:i,children:[t&&(0,a.tZ)($.KV,{user:t}),(0,a.BX)(e0,{children:[p?(0,a.tZ)(ti,{audience:u,paywallInfo:p,onClick:h}):(0,a.tZ)(e7,{audience:u,onClick:h}),r&&(0,a.tZ)(e9,{isLocked:!0,direction:"incoming",commenters:s,count:c,onClick:h})]})]})}function eE(e){let{author:t,extras:i,showReply:n=!0,commenters:o,count:r}=e;return(0,a.tZ)(eO,{user:t,extras:i,children:(0,a.BX)(e0,{children:[(0,a.tZ)(te,{}),n&&(0,a.tZ)(e9,{isLocked:!0,direction:"incoming",commenters:o,count:r})]})})}function eL(e){return"string"==typeof e.message}function eX(e){let{text:t,rawText:i,specialText:n,mentionMap:o,direction:r="incoming",limit:l=600,linkify:s=!0}=e,{iString:c}=(0,F.M1)(),[p,h]=(0,d.eJ)(!1);if(n)return(0,a.tZ)("em",{children:n});if(!t)return(0,a.tZ)(a.HY,{});let m=[{characters:t.length,message:t}];i&&o&&(m=function(e,t,i){let n=/\$\{(\d+)\}/g,o=n.exec(e),r=[],l=0;for(;o;){var s,d,c,u;let p=t[Number(o[1])],h=p.text.slice(1);p?(o.index>l&&r.push({characters:o.index-l,message:e.slice(l,o.index)}),r.push({characters:p.text.length,message:(s=p.user_id,d=0,c=h,u=i,(0,a.tZ)(A.p,{id:s,label:c,type:"user",unstyled:"outgoing"===u}))})):r.push({characters:n.lastIndex-l,message:e.slice(l,n.lastIndex)}),l=n.lastIndex,o=n.exec(e)}return lt&&eL(e)){let n=t-i,r={characters:n,message:e.message.slice(0,n)},l={characters:e.characters-n,message:e.message.slice(n)};e=r,o.push(l)}i+=e.characters,n.push(e)}else o.push(e)}return{alwaysShow:n,afterExpansion:o}}(m,l),f=v.length>0;return(0,a.BX)(a.HY,{children:[g.map(e=>s&&eL(e)?(0,a.tZ)(eM,{children:e.message}):e.message),f&&!p&&(0,a.BX)(a.HY,{children:[(0,a.tZ)("span",{children:" "}),(0,a.tZ)(Y.kG,{resetCss:!0,className:u()(es.Z.readMore,es.Z[r]),onClick:e=>{e.preventDefault(),h(!0)},children:c("See more")})]}),f&&p&&(0,a.tZ)(a.HY,{children:v.map(e=>s&&eL(e)?(0,a.tZ)(eM,{children:e.message}):e.message)})]})}function eM(e){let{children:t}=e;return(0,a.tZ)(h(),{options:{attributes:{rel:"nofollow ugc",onClick:e=>e.stopPropagation()},className:es.Z.textLink,format:(e,t)=>"url"===t?(0,el.u)(e,64):e},children:t})}function eR(e){var{communityComment:t,quoteReply:i,isTargeted:o,isBanned:l,pubRole:s,isNew:d,error:c}=e,u=(0,r._)(e,["communityComment","quoteReply","isTargeted","isBanned","pubRole","isNew","error"]);return(0,a.tZ)(eF,(0,n._)({isTargeted:o,isNew:d,comments:[{communityComment:t,quoteReply:i,isBanned:l,pubRole:s,isNew:d,error:c}]},u))}function eF(e){let{comments:t,author:i,isNew:n,chatPublicationId:o,hideReply:r,onReply:l,onNewQuote:d,onQuoteReplyClick:c,onDelete:u,commentRef:p,isTargeted:h,isReadOnly:m,chatAuthorNameAttribution:v,extras:f,flex:b,pub:_}=e,y=(0,ei.I0)(),Z=t[t.length-1].communityComment,{reply_count:w=0,recent_commenters:k=[]}=null!=Z?Z:{},C=(0,en.o)({entityType:"communityComment",publication:_}),S=!r&&w>0,x=t[0],{communityComment:B}=x;return(0,a.BX)(eO,{user:i,pubRole:t[0].pubRole,containerRef:p,id:"comment-".concat(null==Z?void 0:Z.id),flex:b,extras:f,children:[v&&(0,a.tZ)(to,{text:"Comment from ".concat(v,"’s subscriber chat")}),(0,a.tZ)(eg,{actionMenuProps:{communityEntity:B,isBanned:x.isBanned,isFlagged:B.reported_by_user,replyAction:l&&(0,a.tZ)(K.sN,{disabled:!!B.is_locked,onClick:l,leading:(0,a.tZ)(g.Z,{}),children:"Reply in ".concat(0===w?"a new":"","thread")}),onDelete:u,onNewQuote:d,onReport:C,isReadOnly:m,publicationId:o,isNew:n},flex:b,children:(0,a.tZ)(e0,{hasFooter:S,children:t.map((e,i)=>{var n,o;let{communityComment:{id:r,body:d,quote_id:u,media_uploads:p,reactions:g,reaction:v,reported_by_user:f},quoteReply:b,isNew:_,error:Z}=e;return(0,a.BX)(s.Fragment,{children:[!_&&!f&&p&&p.length>0&&null===u&&(0,a.BX)(et.c,{context:{type:"comments",id:r},reactions:g,currentReaction:v,onReactionClick:ev(r,"comments",y,v),isReadOnly:m||_,children:[(0,a.tZ)(M.z,{mediaAssets:(null!=p?p:[]).filter(e=>e.media_upload_id).map(e=>({media_upload_id:e.media_upload_id})),surface:"chat_inbox",entityType:"community_comment",entityKey:r,contentType:"communityComment"}),(0,a.tZ)(X.E,{assets:p.filter(e=>e.url).map(e=>({src:e.url,explicit:!!e.is_explicit,width:e.image_width,height:e.image_height})),className:es.Z.ImageGrid,maxWidth:400,maxHeight:420,readOnly:m,isContained:!0})]}),d&&(0,a.tZ)(et.c,{context:{type:"comments",id:r},reactions:g,currentReaction:v,onReactionClick:ev(r,"comments",y,v),setReactions:!p||0===p.length,isReadOnly:m||_,children:(0,a.BX)(e1,{isTargeted:h,onClick:l,children:[b&&(0,a.tZ)(e6,{body:b.comment.body,author:null!==(o=null===(n=b.user)||void 0===n?void 0:n.name)&&void 0!==o?o:"",onClick:c,direction:"outgoing"}),(0,a.tZ)(e5,{communityEntity:t[i].communityComment})]})}),Z&&(0,a.tZ)(V.xv.B5,{color:"error",children:"\uDBC0\uDC5F Not delivered."})]},r)})})}),S&&(0,a.tZ)(e9,{direction:"incoming",commenters:k,count:w,onClick:l})]})}function eU(e){return void 0===e.post_id}function eO(e){var t;let{user:i,children:n,extras:o,flex:r="grow",containerRef:l,id:s,pubRole:d,pubThemeAccentColor:c,pubThemePrintOnPopColor:p}=e,h=(0,R.KG)(null!==(t=null==i?void 0:i.id)&&void 0!==t?t:0);return(0,a.BX)(V.tu,{id:s,flex:r,gap:2,ref:l,className:u()(ed.Z.reactionsHoverZone,es.Z.avatarContainer),children:[(0,a.BX)(V.hs,{alignItems:"end",gap:12,children:[(0,a.tZ)(V.hs,{paddingTop:4,children:h?(0,a.tZ)(eA,{user:i}):i?(0,a.tZ)(tr,{pubThemeAccentColor:c,pubThemePrintOnPopColor:p,user:i,pubRole:d,size:32}):(0,a.tZ)(eD,{})}),(0,a.tZ)(V.tu,{flex:"grow",gap:2,position:"relative",alignItems:"start",children:n})]}),o&&(0,a.BX)(V.hs,{gap:12,children:[(0,a.tZ)(V.xu,{width:32}),(0,a.tZ)(V.tu,{flex:"grow",gap:4,children:o})]})]})}function eA(e){let{user:t}=e;return(0,a.tZ)(J.A0,{href:t?(0,ea.NNq)(t,{noBase:!0}):void 0,children:(0,a.tZ)(eD,{children:(0,a.tZ)(v.Z,{size:20,color:"var(--color-fg-tertiary)"})})})}let eD=(0,J.zo)({radius:"full",width:32,height:32,bg:"secondary"},J.M5);function ez(e){var{isNew:t}=e,i=(0,r._)(e,["isNew"]);if(t)return null;let{onNewQuote:o,onReply:l,communityEntity:s}=i;return(0,a.BX)(V.hs,{alignItems:"center",gap:4,className:es.Z.actions,children:[o&&s&&(0,a.tZ)(eH,{onNewQuote:o,communityComment:s}),l&&s&&(0,a.tZ)(eW,{onReply:l}),(0,a.tZ)(K.v2,{trigger:(0,a.tZ)(Y.hU,{"aria-label":"Options",size:"sm",priority:"tertiary",children:(0,a.tZ)(f.Z,{size:20})}),hideOnScroll:!0,children:(0,a.tZ)(ej,(0,n._)({},i))})]})}function ej(e){let{communityEntity:t,replyAction:i,onDelete:n,onReport:o,isReadOnly:r,publicationId:l,isBanned:s,isFlagged:d,onNewQuote:c}=e,u=(0,U.aF)(),{isAuthor:p}=(0,eo.Y0)(null!=l?l:0),h=l&&p,m=t&&u&&t.user_id===u.id,g=t&&!eU(t),v=g&&"parent_id"in t&&null!==t.parent_id,f=m||h,b=m||h,_=!m&&!d,y=h&&g&&!m,Z=!g&&u&&(null==t?void 0:t.user_id)===u.id;return t?(0,a.BX)(a.HY,{children:[(0,a.tZ)(eV,{communityEntity:t}),t.body&&(0,a.tZ)(eY,{communityEntity:t}),!r&&c&&g&&(0,a.tZ)(eq,{onNewQuote:c,communityComment:t}),!r&&i,Z&&(0,a.tZ)(eJ,{communityEntity:t}),(0,a.BX)(K.xw,{children:[!r&&!v&&b&&(0,a.tZ)(eK,{communityEntity:t}),!r&&f&&(0,a.tZ)(e$,{communityEntity:t,onDelete:n}),!r&&void 0!==s&&y&&(0,a.tZ)(eQ,{communityEntity:t,isBanned:s}),!r&&_&&(0,a.tZ)(eG,{onReport:o,communityEntity:t})]}),(0,a.tZ)(K.dW,{children:(0,a.tZ)(V.hs,{paddingY:4,children:(0,a.tZ)(ee.E,{conjunction:!0,timestamp:t.created_at})})})]}):null}function eH(e){let{onNewQuote:t,communityComment:i}=e;return(0,a.tZ)(Y.hU,{size:"sm",priority:"tertiary","aria-label":"Reply",onClick:()=>{t(i)},children:(0,a.tZ)(m.Z,{size:20})})}function eW(e){let{onReply:t}=e;return(0,a.tZ)(Y.hU,{size:"sm",priority:"tertiary","aria-label":"Reply",onClick:t,children:(0,a.tZ)(m.Z,{size:20})})}function eq(e){let{onNewQuote:t,communityComment:i}=e,{iString:n}=(0,F.M1)();return(0,a.tZ)(K.sN,{leading:(0,a.tZ)(m.Z,{}),onClick:()=>{t(i)},children:n("Reply")})}function eY(e){let{communityEntity:t}=e,{iString:i}=(0,F.M1)(),r=(0,Q.pm)();return(0,a.tZ)(K.sN,{leading:(0,a.tZ)(b.Z,{}),onClick:()=>{if(t){let{body:e}=t;(0,H.vQ)(e),r.popToast(e=>(0,a.tZ)(Q.FN,(0,o._)((0,n._)({},e),{text:i("Text copied to clipboard"),Icon:b.Z})))}},children:i("Copy text")})}function eV(e){let{communityEntity:t}=e,{iString:i}=(0,F.M1)(),n=(0,j.g)(),{id:o}=t,r=eU(t);return(0,a.tZ)(K.sN,{leading:(0,a.tZ)(_.Z,{}),onClick:()=>{let e;if(r)e=(0,ea._5K)({postId:o});else if(t.parent_id){var i;e=(0,ea.lsD)({commentId:null!==(i=t.parent_id)&&void 0!==i?i:o,targetReplyId:t.parent_id?o:void 0,showTarget:!0})}else e=(0,ea._5K)({postId:t.post_id,targetReplyId:t.id,showTarget:!0});n(e)},children:i("Copy link")})}function eK(e){let{communityEntity:t}=e,{iString:i}=(0,F.M1)(),r=(0,ei.I0)(),l=(0,Q.pm)(),{id:s,is_locked:d}=t,c=eU(t),u=async()=>{c?r(eZ(s,!d)):r(ew(s,!d)),d?l.popToast(e=>(0,a.tZ)(Q.FN,(0,o._)((0,n._)({},e),{text:i("Enabled replies"),Icon:Z.Z}))):l.popToast(e=>(0,a.tZ)(Q.FN,(0,o._)((0,n._)({},e),{text:i("Disabled replies"),Icon:y.Z})))};return(0,a.tZ)(K.sN,{leading:(0,a.tZ)(y.Z,{}),onClick:u,priority:"destructive",children:d?i("Re-enable replies"):i("Disable replies")})}function eJ(e){let{communityEntity:t}=e,i=(0,ei.I0)(),n=eU(t),o=async()=>{n&&i({type:"posts-edit_post",payload:{post:t}})};return(0,a.tZ)(K.sN,{leading:(0,a.tZ)(w.Z,{}),onClick:o,priority:"primary",children:"Edit"})}function eG(e){let{onReport:t,communityEntity:i}=e,{iString:n}=(0,F.M1)();return(0,a.tZ)(a.HY,{children:(0,a.tZ)(K.sN,{leading:(0,a.tZ)(k.Z,{}),onClick:()=>{t(i.id,"admin"!==i.user_pub_role)},priority:"destructive",children:n("Report")})})}function eQ(e){let{communityEntity:t,isBanned:i}=e,{iString:n}=(0,F.M1)(),o=(0,ei.I0)(),r=async()=>{if(confirm("Are you sure you want to ban this user?")){let{id:e}=t;o(ek(e,!i))}};return(0,a.tZ)(K.sN,{leading:i?(0,a.tZ)(C.Z,{}):(0,a.tZ)(S.Z,{}),onClick:r,priority:"destructive",children:n(i?"Unban":"Ban")})}function e$(e){let{communityEntity:t,onDelete:i}=e,{iString:n}=(0,F.M1)(),o=(0,ei.I0)(),r=eU(t),l=async()=>{if(confirm("Are you sure you want to delete this ".concat(r?"thread":"comment","?"))){let{id:e}=t;if(r){let{publication_id:i}=t;o(e_(e,i))}else{let{post_id:i,parent_id:n}=t;o(ey(e,i,n))}i&&setTimeout(i,500)}};return(0,a.tZ)(K.sN,{leading:(0,a.tZ)(x.Z,{}),onClick:l,priority:"destructive",children:n("Delete")})}function e0(e){var{hasFooter:t}=e,i=(0,r._)(e,["hasFooter"]);return(0,a.tZ)(V.tu,(0,n._)({className:u()(es.Z.bubbleStack,t&&es.Z.hasFooter),gap:2,alignItems:"start"},i))}function e1(e){var{isTargeted:t,className:i}=e,o=(0,r._)(e,["isTargeted","className"]);return(0,a.tZ)(V.tu,(0,n._)({className:u()(es.Z.bubble,t&&es.Z.highlight,i),sizing:"border-box",paddingY:8,paddingX:12,bg:"secondary",minWidth:0,gap:8},o))}function e4(e){let{communityEntity:t,publication:i,isTargeted:n,onClick:o,truncate:r=!0,isPaid:l,isFounding:s,outline:d}=e,{audience:c}=t,{canReply:u,shouldShowToken:p}=tt({audience:c,isFounding:s,isPaid:l,chatPaywallStatus:null==i?void 0:i.paywall_chat}),h=p||t.is_edited,m=t.reactions?Object.keys(t.reactions).length:0;return(0,a.BX)(e1,{isTargeted:n,onClick:o,className:ec.Z[m>0?"reactions-".concat(m):""],outline:d,children:[(0,a.tZ)(e5,{communityEntity:t,truncate:r}),h&&(0,a.BX)(V.gq,{justifyContent:"end",gap:2,children:[p&&(0,a.tZ)(e2,{canReply:!!u,audience:c}),t.is_edited&&(0,a.tZ)(e3,{})]})]})}function e2(e){let{canReply:t,audience:i,style:n="default",showLabel:o=!0,className:r}=e,l=o?"media"===n?"var(--vibrance-primary)":"var(--color-chat-incoming-fg-primary)":"var(--color-fg-primary)";return(0,a.BX)(G.Vp,{className:u()(es.Z.paywallReplyTag,"media"===n&&es.Z.media,!o&&es.Z.iconOnly,r),priority:"secondary",children:[t?(0,a.tZ)(L.Z,{size:12,color:l}):(0,a.tZ)(E.Z,{size:12,color:l}),o&&(0,a.tZ)(V.xv.B5,{weight:"medium",children:e8.get(i)})]})}let e8=new Map([["only_paid","Paid subscribers only"],["only_paid_replies","Paid subscriber replies"],["only_founding","Founding members only"],["only_founding_replies","Founding member replies"]]);function e3(){return(0,a.BX)(G.Vp,{className:es.Z.paywallReplyTag,priority:"secondary",children:[(0,a.tZ)(B.Z,{size:12}),(0,a.tZ)(V.xv.B5,{weight:"medium",children:"Edited"})]})}function e6(e){let{author:t,body:i,direction:n,onClick:o,children:r,isFirst:l=!0,pubThemeBackgroundColor:s,isAuthorContributor:d}=e,c="incoming"===n&&d,p=c&&s;return(0,a.tZ)(V.hs,{pullX:4,children:(0,a.BX)(V.hs,{gap:12,className:u()(es.Z.quote,es.Z[n],!l&&es.Z.notFirst,c&&es.Z.author),onClick:o,radius:"md",overflow:"hidden",padding:8,flex:"grow",style:{"--color-chat-author-bg-overlay":p?"".concat(s,"33"):"rgba(var(--color-bg-accent-themed-rgb), 0.2)"},children:[(0,a.BX)(V.tu,{children:[(0,a.tZ)(V.xv.B4,{weight:"bold",children:null!=t?t:""}),(0,a.tZ)(V.xv.B3,{clamp:2,isParagraph:!0,children:i})]}),r]})})}function e5(e){var t,i,n,o,r;let{communityEntity:l,truncate:s=!0}=e,d=null,c=eU(l)?"thread":"reply";l.reported_by_user&&(d="You reported this ".concat(c)),"deleted"!==l.status&&l.body||(d="This ".concat(c," is not available"));let u=(0,R.KG)(l.user_id);d||"blocking"!==u?d||"blocked"!==u||(d="This person is blocked"):d="This person blocked you";let p=null!==(t=l.raw_body)&&void 0!==t?t:l.body;return p?eU(l)&&l.link_url&&!l.link_metadata&&(p="".concat(p,"\n\n").concat(l.link_url).trim()):eU(l)?(null===(n=l.media_assets)||void 0===n?void 0:n.length)?d="".concat(l.media_assets.length," ").concat(l.media_assets.length>1?"photos":"photo","."):l.link_url&&(l.link_metadata?d='Link: "'.concat(l.link_metadata.title,'"'):(p=l.link_url,d=null)):(null===(i=l.media_uploads)||void 0===i?void 0:i.length)&&(d="".concat(l.media_uploads.length," ").concat(l.media_uploads.length>1?"photos":"photo",".")),(0,a.tZ)(V.xv.B3,{className:es.Z.body,isParagraph:!0,children:(p||d)&&(0,a.tZ)(eX,{text:p,rawText:null!==(o=l.raw_body)&&void 0!==o?o:"",mentionMap:Array.isArray(l.mentions)?void 0:null!==(r=l.mentions)&&void 0!==r?r:void 0,specialText:d,limit:s?void 0:9999999})})}function e9(e){let{isLocked:t,count:i=0,commenters:n,hasUnread:o,onClick:r,direction:l,outline:s}=e,{iString:d,iPlural:c}=(0,F.M1)();return(0,a.tZ)($.xj,{isLast:!0,messageDirection:l,onClick:r,cursor:r?"pointer":void 0,height:36,paddingY:4,paddingRight:12,paddingLeft:12,outline:s,children:(0,a.BX)(V.hs,{justifyContent:"space-between",alignItems:"center",gap:32,children:[(0,a.BX)(V.hs,{alignItems:"center",gap:8,children:[n&&i>0&&(0,a.tZ)(V.hs,{className:es.Z.facepile,alignItems:"center",children:n.map(e=>(0,a.tZ)(W.qE,{className:u()(es.Z.facepileAvatar,"outgoing"===l&&es.Z.outgoing),user:e,size:22}))}),(0,a.tZ)(V.hs,{gap:8,alignItems:"center",children:(0,a.tZ)(V.xv.B3,{as:"span",className:o?es.Z.hasUnread:es.Z.noUnread,children:0===i?d("Leave a reply"):c("%1 reply","%1 replies",i)})})]}),t?(0,a.tZ)(E.Z,{size:14,color:"var(--color-chat-fg-secondary)"}):(0,a.tZ)(P.Z,{size:20,stroke:o?"var(--color-chat-reply-active)":"var(--color-chat-fg-secondary)"})]})})}function e7(e){let{audience:t,href:i,onClick:n}=e;return(0,a.tZ)(V.tu,{className:es.Z.paywallBubble,as:i?"a":"div",onClick:n,cursor:n?"pointer":void 0,alignSelf:"stretch",alignItems:"center",justifyContent:"center",bg:"secondary",href:i,target:i?"_blank":void 0,children:(0,a.BX)(V.hs,{alignItems:"center",gap:4,children:[(0,a.tZ)(I.Z,{size:12,stroke:"var(--color-fg-secondary)"}),(0,a.tZ)(V.xv.Meta,{weight:"semibold",children:"only_founding"===t?"FOUNDING MEMBERS ONLY":"only_paid"===t?"PAID SUBSCRIBERS ONLY":"SUBSCRIBERS ONLY"})]})})}function te(){return(0,a.tZ)(V.tu,{className:es.Z.paywallBubble,alignSelf:"stretch",alignItems:"center",justifyContent:"center",bg:"secondary",children:(0,a.BX)(V.hs,{alignItems:"center",gap:4,children:[(0,a.tZ)(I.Z,{size:12,stroke:"var(--color-fg-secondary)"}),(0,a.tZ)(V.xv.Meta,{weight:"semibold",children:"SUBSCRIBERS ONLY"})]})})}function tt(e){let{audience:t,isFounding:i,isPaid:n,chatPaywallStatus:o}=e,r=["only_founding","only_founding_replies"].includes(t);return{canReply:i||"all_subscribers"===t||n&&["only_paid","only_paid_replies"].includes(t),shouldShowToken:o&&("free"===o&&"all_subscribers"!==t||"paid"===o&&r)}}function ti(e){let{paywallInfo:t,audience:i,onClick:n}=e,{mediaAttachments:o}=t,{body:r}=t,l=o[0];return r||l||(r=[,,,,].fill("Blah blah blah blahhhhh blah.").join(" ")),(0,a.BX)(a.HY,{children:[l&&(0,a.tZ)(V.tu,{position:"relative",children:(0,a.tZ)(X.E,{className:es.Z.ImageGrid,assets:[{src:l.thumb_url,width:l.width,height:l.height,explicit:!1}],maxWidth:400,maxHeight:420,readOnly:!0,isContained:!0,children:(0,a.tZ)(tn,{className:es.Z.paywallFade,children:(0,a.tZ)(e2,{canReply:!1,audience:null!=i?i:"only_paid",style:"media",showLabel:!r,className:r?es.Z.right:es.Z.center})})})}),r&&(0,a.BX)(e1,{className:es.Z.bubble,onClick:n,children:[(0,a.tZ)(V.xv.B3,{className:es.Z.paywallText,isParagraph:!0,children:r}),(0,a.tZ)(tn,{className:u()(es.Z.paywallFade,es.Z.paywallBlur),children:(0,a.tZ)(V.xu,{className:es.Z.paywallReplyTagAbsolute,children:(0,a.tZ)(e2,{canReply:!1,audience:null!=i?i:"only_paid",style:"media"})})})]})]})}let tn=(0,J.zo)({position:"absolute",inset:0,alignItems:"center",justifyContent:"center"},J.sg);function to(e){let{text:t,isStatic:i}=e;return(0,a.tZ)(V.hs,{paddingX:8,paddingY:4,children:(0,a.BX)(V.xv.B5,{color:"secondary",weight:"semibold",children:[(0,a.tZ)(T.Z,{strokeWidth:2,height:12,stroke:"#808080",fill:"transparent",isStatic:i})," ",t]})})}function tr(e){let t,{user:i,size:n,pubRole:o,className:r,disabled:l,pubThemeAccentColor:s,pubThemePrintOnPopColor:d}=e;return(null==o?void 0:o.role)==="admin"||(null==o?void 0:o.role)==="contributor"?t="author":(null==o?void 0:o.is_founding)?t="founding":(null==o?void 0:o.membership_state)==="subscribed"&&(t="paid"),(0,a.tZ)(q.zY,{tier:t,fgOverride:d,bgOverride:s,children:(0,a.tZ)(W.xV,{user:i,size:n,className:r,disabled:l,linkProps:{target:"_blank"},noBase:!0})})}},7703:function(e,t,i){i.d(t,{Z:()=>a});var n=i(16584),o=i(13639),r=i(15702),l=i(25682);let a=e=>{let{audience:t,className:i,size:a=16,isStatic:s,thin:d}=e;return"only_paid"===t?d?(0,n.tZ)(l.Z,{className:i,height:a,isStatic:s}):(0,n.tZ)(o.Z,{className:i,size:a}):"founding"===t?(0,n.tZ)(r.Z,{className:i,height:a,isStatic:s,strokeWidth:1}):null}},42694:function(e,t,i){i.d(t,{qT:()=>p});var n=i(16584);i(30396);var o=i(94184),r=i.n(o),l=i(80569),a=i.n(l);i(20253);var s=i(13304),d=i(95441);i(40647),i(68833);var c=i(62981);i(15771),i(63651),i(84864);let u=function(){let{children:e,dismissKey:t,dismissDurationInSeconds:i,beforeDismiss:o,className:l,level:a="info"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[d,u]=(0,c.Z)(t,i,o);return d?null:(0,n.BX)("div",{className:r()("banner",a,l),children:[e,(0,n.tZ)(s.Z,{width:12,height:12,className:"banner-close",onClick:e=>{e.preventDefault(),e.stopPropagation(),u()}})]})},p=e=>{let{}=e,{iString:t}=(0,d.M1)();return(0,n.BX)(u,{level:"coming-soon",dismissKey:"coming-soon-banner.dismissed",beforeDismiss:()=>{a().put("/api/v1/publication_settings").send({seen_coming_soon_explainer:!0})},children:[(0,n.tZ)("div",{className:"coming-soon-banner-header",children:t("Welcome to Substack!")}),(0,n.tZ)("br",{}),(0,n.tZ)("p",{children:t('We\'ve created this "Coming Soon" post for you. To edit it, click the three-dot icon.')}),(0,n.tZ)("br",{}),(0,n.tZ)("p",{children:t("It's just a placeholder and won't be sent out to your subscribers. To email them, click the \"New Post\" button.")})]})}},23254:function(e,t,i){i.d(t,{OZ:()=>U,ZP:()=>F,f8:()=>M});var n=i(7409),o=i(99282),r=i(16584),l=i(6400),a=i(30396),s=i(17876),d=i(3039),c=i(40423),u=i(80569),p=i.n(u),h=i(42725),m=i(61649),g=i(45405),v=i(94442),f=i(75697),b=i(12281),_=i(68833),y=i(62981),Z=i(93687),w=i(98914),k=i(71068),C=i(15771),S=i(61254),x=i(19081),B=i(6490),P=i(98248),I=i(58175),N=i(60308),T=i(93370),E=i(9799),L=i(47929),X=i(89451);let M=e=>{let[t,i]=(0,a.eJ)(null),[n,o]=(0,a.eJ)(null),[r]=(0,a.eJ)(!0),[l,s]=(0,a.eJ)(null),[d,c]=(0,a.eJ)(null),u=async()=>{let t=await p().get("/api/v1/video/upload/".concat(e));i(t.body);let{id:r,state:l}=t.body;if(["uploaded","transcoded"].includes(l)&&!n){let{body:{src:e}}=await p().get("/api/v1/video/upload/".concat(r,"/src.json?type=original"));o(e)}},h=async()=>{let{mux_asset:t,mux_preview_asset:i}=(await p().get("/api/v1/video/upload/".concat(e,"/assets"))).body;s(t),c(i)};return(0,a.d4)(()=>{u(),h()},[e]),(0,a.d4)(()=>{let r=setInterval(()=>{let l=async()=>{let t=await p().get("/api/v1/video/upload/".concat(e)),{id:l,mux_rendition_quality:a,state:s}=t.body;if(i(t.body),a&&clearInterval(r),["uploaded","transcoded"].includes(s)&&!n){let{body:{src:e}}=await p().get("/api/v1/video/upload/".concat(l,"/src.json?type=original"));o(e)}else h()};(null==t?void 0:t.state)==="error"?(console.warn("error creating clip"),clearInterval(r)):(null==t?void 0:t.mux_rendition_quality)?clearInterval(r):l()},5e3);return()=>{clearInterval(r)}},[t]),{mediaUpload:t,loading:r,downloadUrl:n,muxAsset:l,muxPreviewAsset:d}};function R(e){var t;let{pub:i,post:o,mediaUploadId:c,isOpen:u,onClose:p}=e,h=(0,l.createRef)(),{mediaUpload:m,downloadUrl:v,muxPreviewAsset:y}=M(c);(0,a.d4)(()=>{c&&(0,_.j)(_.FP.VIDEO_CLIP_SEEN,{post_id:o.id,clip_id:c})},[c]);let Z=async()=>{m&&await (0,E.I)(m)},R=()=>{(0,_.j)(_.FP.VIDEO_CLIP_WATCH_FULL_EPISODE_BUTTON_CLICKED,{name:"watch full episosde",post_id:o?o.id:null,utm_campaign:L.VX.substackClips,utm_medium:L.lP.web}),window.history.pushState({},"",(0,N.rhs)(window.location.href,{clipId:void 0,share:void 0})),p()};if(!m)return null;let F=null!==new URL(window.location.href).searchParams.get("share"),U=["uploaded","transcoded"].includes(m.state),O=(0,w.K1)(),A="creating";"error"===m.state?A="error":"transcoded"===m.state?A="transcoded":"uploaded"===m.state?A="uploaded":null!==m.mux_preview_playback_id&&(null==y?void 0:y.status)==="ready"&&(A="preview");let D={entityType:"post",entityKey:String(o.id),surface:"editor",contentType:"clip"};return(0,r.BX)(B.u_,{width:640,fullscreenMobile:!0,isOpen:u,onClose:p,children:[(0,r.tZ)(B.xB,{showClose:!0,title:F?"Share Clip":"Clip",onClose:p,description:"✂️ ".concat((0,T.UB)(null!==(t=m.duration)&&void 0!==t?t:0)," | ").concat(o.title)}),(0,r.BX)(B.fe,{children:["transcoded"===A&&(0,r.tZ)(b.Z,(0,n._)({ref:h,mediaUpload:m,pub:null!=i?i:null,autoPlay:!1,isClip:!0,videoType:"clip"},D)),"preview"===A&&(0,r.tZ)(b.Z,(0,n._)({ref:h,mediaUpload:m,pub:null!=i?i:null,autoPlay:!1,isClip:!0,usePreview:!0,videoType:"clip"},D)),"uploaded"===A&&v&&(0,r.tZ)("div",{class:"video-player-wrapper",children:(0,r.tZ)("div",{class:"video-player",children:(0,r.tZ)("video",{src:v,type:"video/mp4",controls:!0})})}),"creating"===A&&(0,r.tZ)(x.gq,{children:(0,r.tZ)(x.tu,{className:X.Z.placeholder,justifyContent:"center",alignItems:"center",children:(0,r.BX)(x.tu,{justifyContent:"center",alignItems:"center",className:X.Z.placeholderMessage,gap:8,children:[(0,r.tZ)(P.$j,{}),(0,r.tZ)(I.xv.B3,{weight:"bold",children:"Your clip is being processed"}),(0,r.BX)(I.xv.B4,{weight:"medium",color:"secondary",align:"center",children:["Clips may take up to a minute to process. Meanwhile, ",(0,r.tZ)("b",{children:"share your clip link below"})]})]})})}),"error"===A&&(0,r.tZ)(x.gq,{children:(0,r.BX)(x.tu,{className:X.Z.placeholder,children:[(0,r.tZ)(s.Z,{color:"gray"}),(0,r.tZ)(I.xv.B4,{weight:"medium",color:"secondary",children:"Oops! There was an error creating the clip"})]})}),"error"!==A&&(0,r.BX)(x.tu,{paddingTop:16,children:[(0,r.tZ)(S.iz,{}),(0,r.tZ)(k.xu,{children:(0,r.BX)(x.gq,{justifyContent:"space-between",flex:"grow",paddingTop:16,children:[!F&&(0,r.tZ)(x.gq,{children:O?(0,r.tZ)(C.hU,{priority:"primary",onClick:R,children:(0,r.tZ)(d.Z,{})}):(0,r.tZ)(C.zx,{priority:"primary",onClick:R,children:"Watch full episode"})}),(0,r.tZ)(g.S,{shareUrl:(e,t,n)=>(0,f.O1)(e,{clip:m,post:o,pub:i,medium:n,utm_campaign:t}),pub:i,clip:m,post:o,selectionId:void 0,disabled:!1,disabledInstagram:!U,disabledDownload:!U,onDownloadClick:Z,isSharing:F})]})})]})]})]})}function F(e){let{post:t,mediaUploadId:i}=e,[l,s]=(0,a.eJ)(!0),[d,c]=(0,a.eJ)(i);(0,a.d4)(()=>{let e=()=>{c(new URLSearchParams(window.location.search).get("clipId")),s(!0)};return window.addEventListener("urlchange",e),window.addEventListener("popstate",e),e(),()=>{window.removeEventListener("urlchange",e),window.removeEventListener("popstate",e)}},[]);let{mediaUpload:u,loading:p}=(0,Z.z)({mediaUploadId:d});return!p&&u&&d?(0,r.tZ)(R,(0,o._)((0,n._)({},e),{mediaUploadId:d,isOpen:l,onClose:()=>{s(!1),(0,_.j)(_.FP.VIDEO_CLIP_MODAL_CLOSED,{post_id:null==t?void 0:t.id,clip_id:d})}})):null}let U=e=>{var t;let{post:i,mediaUpload:n,disabled:o,style:l}=e,[,a]=(0,y.Z)(h.pc),{onStartClipping:s}=(0,m.Sr)(),d=(null!==(t=null==n?void 0:n.duration)&&void 0!==t?t:0)>5;return(0,r.tZ)(v.Ng,{title:d?o?"upgrade in order to watch this video and be able to clip it":"":"can't clip videos shorter than 5 seconds",isDisabled:!d||o,style:l,onClick:()=>{a(),d&&(s({source:"post-ufi",title:null}),(0,_.j)(_.FP.MEDIA_CLIP_BUTTON_CLICKED,{button:"create",source:"player ufi"}),(0,_.j)(_.FP.VIDEO_CLIP_BUTTON_CLICKED,{post_id:i.id}))},icon:(0,r.tZ)(c.Z,{className:"icon",height:(0,v.Su)(l),strokeWidth:v.PA})})}},45405:function(e,t,i){i.d(t,{S:()=>T});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(94184),s=i.n(a),d=i(99869),c=i(71212),u=i(46990),p=i(27543),h=i(64515);let m=e=>(0,r.tZ)(h.l,(0,o._)((0,n._)({},e),{name:"ShareInstagramIcon",svgParams:{height:1e3,width:1e3},children:(0,r.BX)("svg",{width:"1000.0001",height:"1000.0001",viewBox:"0 0 264.58332 264.58332",version:"1.1",id:"svg15",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.BX)("defs",{id:"defs11",children:[(0,r.tZ)("radialGradient",{id:"f",cx:"158.429",cy:"578.08801",r:"52.351501",href:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0,-4.03418,4.28018,0,-2332.2273,942.2356)",fx:"158.429",fy:"578.08801"}),(0,r.tZ)("radialGradient",{href:"#b",id:"g",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0.67441,-1.16203,1.51283,0.87801,-814.3657,-47.8354)",cx:"172.6149",cy:"600.69238",fx:"172.6149",fy:"600.69238",r:"65"}),(0,r.tZ)("radialGradient",{href:"#c",id:"h",cx:"144.01199",cy:"51.3367",fx:"144.01199",fy:"51.3367",r:"67.081001",gradientTransform:"matrix(-2.3989,0.67549,-0.23008,-0.81732,464.9957,-26.4035)",gradientUnits:"userSpaceOnUse"}),(0,r.tZ)("radialGradient",{href:"#d",id:"e",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(-3.10797,0.87652,-0.6315,-2.23914,1345.6503,1374.1983)",cx:"199.78841",cy:"628.43793",fx:"199.78841",fy:"628.43793",r:"52.351501"}),(0,r.BX)("linearGradient",{id:"d",children:[(0,r.tZ)("stop",{offset:"0","stop-color":"#ff005f",id:"stop1"}),(0,r.tZ)("stop",{offset:"1","stop-color":"#fc01d8",id:"stop2"})]}),(0,r.BX)("linearGradient",{id:"c",children:[(0,r.tZ)("stop",{offset:"0","stop-color":"#780cff",id:"stop3"}),(0,r.tZ)("stop",{"stop-color":"#820bff",offset:"1","stop-opacity":"0",id:"stop4"})]}),(0,r.BX)("linearGradient",{id:"b",children:[(0,r.tZ)("stop",{offset:"0","stop-color":"#fc0",id:"stop5"}),(0,r.tZ)("stop",{offset:"1","stop-color":"#fc0","stop-opacity":"0",id:"stop6"})]}),(0,r.BX)("linearGradient",{id:"a",children:[(0,r.tZ)("stop",{offset:"0","stop-color":"#fc0",id:"stop7"}),(0,r.tZ)("stop",{offset:".1242","stop-color":"#fc0",id:"stop8"}),(0,r.tZ)("stop",{offset:".5672","stop-color":"#fe4a05",id:"stop9"}),(0,r.tZ)("stop",{offset:".6942","stop-color":"#ff0f3f",id:"stop10"}),(0,r.tZ)("stop",{offset:"1","stop-color":"#fe0657","stop-opacity":"0",id:"stop11"})]}),(0,r.tZ)("clipPath",{id:"clipCircle",children:(0,r.tZ)("circle",{cx:"132",cy:"132",r:"132",fill:"#ffffff",stroke:"#000000",id:"circle11"})})]}),(0,r.BX)("g",{"clip-path":"url(#clipCircle)",id:"g15",children:[(0,r.tZ)("path",{d:"m 204.1503,18.1429 c -55.2305,0 -71.3834,0.057 -74.5232,0.3175 -11.3342,0.9424 -18.387,2.7275 -26.0708,6.554 -5.9214,2.9413 -10.5915,6.3506 -15.2005,11.1298 -8.3938,8.7157 -13.481,19.4383 -15.3226,32.1842 -0.8953,6.1877 -1.1558,7.4496 -1.2087,39.0558 -0.0203,10.5354 0,24.4007 0,42.9984 0,55.2008 0.061,71.3418 0.3256,74.4764 0.9157,11.032 2.6453,17.9728 6.3081,25.565 7,14.5329 20.369,25.4428 36.119,29.5137 5.4535,1.4044 11.4767,2.1779 19.2092,2.5442 3.2762,0.1425 36.6684,0.2443 70.081,0.2443 33.4127,0 66.8253,-0.0407 70.02,-0.2035 8.9535,-0.4214 14.1526,-1.1195 19.9011,-2.6054 15.8517,-4.0912 28.9767,-14.8383 36.119,-29.5748 3.5916,-7.409 5.4128,-14.6144 6.237,-25.0704 0.179,-2.2796 0.2543,-38.6263 0.2543,-74.924 0,-36.304 -0.0814,-72.5835 -0.2605,-74.8632 -0.8343,-10.6249 -2.6555,-17.7692 -6.363,-25.3207 -3.0421,-6.1816 -6.42,-10.798 -11.324,-15.518 -8.752,-8.3616 -19.4555,-13.4502 -32.2101,-15.2902 -6.18,-0.8936 -7.411,-1.1582 -39.033,-1.2131 z",fill:"url(#e)",transform:"translate(-71.8155,-18.1429)",id:"path11",style:"fill:url(#e)"}),(0,r.tZ)("path",{d:"m 204.1503,18.1429 c -55.2305,0 -71.3834,0.057 -74.5232,0.3175 -11.3342,0.9424 -18.387,2.7275 -26.0708,6.554 -5.9214,2.9413 -10.5915,6.3506 -15.2005,11.1298 -8.3938,8.7157 -13.481,19.4383 -15.3226,32.1842 -0.8953,6.1877 -1.1558,7.4496 -1.2087,39.0558 -0.0203,10.5354 0,24.4007 0,42.9984 0,55.2008 0.061,71.3418 0.3256,74.4764 0.9157,11.032 2.6453,17.9728 6.3081,25.565 7,14.5329 20.369,25.4428 36.119,29.5137 5.4535,1.4044 11.4767,2.1779 19.2092,2.5442 3.2762,0.1425 36.6684,0.2443 70.081,0.2443 33.4127,0 66.8253,-0.0407 70.02,-0.2035 8.9535,-0.4214 14.1526,-1.1195 19.9011,-2.6054 15.8517,-4.0912 28.9767,-14.8383 36.119,-29.5748 3.5916,-7.409 5.4128,-14.6144 6.237,-25.0704 0.179,-2.2796 0.2543,-38.6263 0.2543,-74.924 0,-36.304 -0.0814,-72.5835 -0.2605,-74.8632 -0.8343,-10.6249 -2.6555,-17.7692 -6.363,-25.3207 -3.0421,-6.1816 -6.42,-10.798 -11.324,-15.518 -8.752,-8.3616 -19.4555,-13.4502 -32.2101,-15.2902 -6.18,-0.8936 -7.411,-1.1582 -39.033,-1.2131 z",fill:"url(#f)",transform:"translate(-71.8155,-18.1429)",id:"path12",style:"fill:url(#f)"}),(0,r.tZ)("path",{d:"m 204.1503,18.1429 c -55.2305,0 -71.3834,0.057 -74.5232,0.3175 -11.3342,0.9424 -18.387,2.7275 -26.0708,6.554 -5.9214,2.9413 -10.5915,6.3506 -15.2005,11.1298 -8.3938,8.7157 -13.481,19.4383 -15.3226,32.1842 -0.8953,6.1877 -1.1558,7.4496 -1.2087,39.0558 -0.0203,10.5354 0,24.4007 0,42.9984 0,55.2008 0.061,71.3418 0.3256,74.4764 0.9157,11.032 2.6453,17.9728 6.3081,25.565 7,14.5329 20.369,25.4428 36.119,29.5137 5.4535,1.4044 11.4767,2.1779 19.2092,2.5442 3.2762,0.1425 36.6684,0.2443 70.081,0.2443 33.4127,0 66.8253,-0.0407 70.02,-0.2035 8.9535,-0.4214 14.1526,-1.1195 19.9011,-2.6054 15.8517,-4.0912 28.9767,-14.8383 36.119,-29.5748 3.5916,-7.409 5.4128,-14.6144 6.237,-25.0704 0.179,-2.2796 0.2543,-38.6263 0.2543,-74.924 0,-36.304 -0.0814,-72.5835 -0.2605,-74.8632 -0.8343,-10.6249 -2.6555,-17.7692 -6.363,-25.3207 -3.0421,-6.1816 -6.42,-10.798 -11.324,-15.518 -8.752,-8.3616 -19.4555,-13.4502 -32.2101,-15.2902 -6.18,-0.8936 -7.411,-1.1582 -39.033,-1.2131 z",fill:"url(#g)",transform:"translate(-71.8155,-18.1429)",id:"path13",style:"fill:url(#g)"}),(0,r.tZ)("path",{d:"m 204.1503,18.1429 c -55.2305,0 -71.3834,0.057 -74.5232,0.3175 -11.3342,0.9424 -18.387,2.7275 -26.0708,6.554 -5.9214,2.9413 -10.5915,6.3506 -15.2005,11.1298 -8.3938,8.7157 -13.481,19.4383 -15.3226,32.1842 -0.8953,6.1877 -1.1558,7.4496 -1.2087,39.0558 -0.0203,10.5354 0,24.4007 0,42.9984 0,55.2008 0.061,71.3418 0.3256,74.4764 0.9157,11.032 2.6453,17.9728 6.3081,25.565 7,14.5329 20.369,25.4428 36.119,29.5137 5.4535,1.4044 11.4767,2.1779 19.2092,2.5442 3.2762,0.1425 36.6684,0.2443 70.081,0.2443 33.4127,0 66.8253,-0.0407 70.02,-0.2035 8.9535,-0.4214 14.1526,-1.1195 19.9011,-2.6054 15.8517,-4.0912 28.9767,-14.8383 36.119,-29.5748 3.5916,-7.409 5.4128,-14.6144 6.237,-25.0704 0.179,-2.2796 0.2543,-38.6263 0.2543,-74.924 0,-36.304 -0.0814,-72.5835 -0.2605,-74.8632 -0.8343,-10.6249 -2.6555,-17.7692 -6.363,-25.3207 -3.0421,-6.1816 -6.42,-10.798 -11.324,-15.518 -8.752,-8.3616 -19.4555,-13.4502 -32.2101,-15.2902 -6.18,-0.8936 -7.411,-1.1582 -39.033,-1.2131 z",fill:"url(#h)",transform:"translate(-71.8155,-18.1429)",id:"path14",style:"fill:url(#h)"}),(0,r.tZ)("path",{d:"m 132.3452,33.973 c -26.7167,0 -30.0696,0.1167 -40.5629,0.5939 -10.4727,0.4792 -17.6212,2.136 -23.8762,4.567 -6.4701,2.5107 -11.9586,5.8693 -17.4265,11.3352 -5.472,5.464 -8.8332,10.9483 -11.354,17.4116 -2.4389,6.2524 -4.099,13.3976 -4.5703,23.8585 -0.4693,10.4854 -0.5923,13.8379 -0.5923,40.5348 0,26.697 0.1189,30.0371 0.5943,40.5225 0.4817,10.465 2.1397,17.6082 4.5703,23.8585 2.5147,6.4654 5.8758,11.9497 11.3458,17.4136 5.466,5.468 10.9544,8.8349 17.4204,11.3456 6.259,2.4309 13.4097,4.0877 23.8803,4.567 10.4933,0.477 13.8441,0.5938 40.5588,0.5938 26.7188,0 30.0615,-0.1167 40.5547,-0.5939 10.4728,-0.4792 17.6295,-2.136 23.8885,-4.567 6.4681,-2.5106 11.9484,-5.8775 17.4143,-11.3455 5.472,-5.4639 8.8332,-10.9482 11.354,-17.4115 2.4183,-6.2524 4.0784,-13.3976 4.5703,-23.8585 0.4713,-10.4854 0.5943,-13.8277 0.5943,-40.5246 0,-26.697 -0.123,-30.0473 -0.5943,-40.5328 -0.4919,-10.465 -2.152,-17.6081 -4.5703,-23.8584 -2.5208,-6.4654 -5.882,-11.9498 -11.354,-17.4137 C 208.7183,45.0011 203.2462,41.6425 196.77,39.1338 190.4986,36.7029 183.346,35.0461 172.8733,34.5669 162.38,34.0897 159.0394,33.973 132.3145,33.973 Z m -8.825,17.7147 c 2.6193,-0.0041 5.5418,0 8.825,0 26.2659,0 29.379,0.0942 39.7513,0.5652 9.5915,0.4383 14.7971,2.0397 18.2648,3.3852 4.5908,1.7817 7.8638,3.9116 11.3048,7.3521 3.4431,3.4406 5.5745,6.7173 7.3617,11.3046 1.3465,3.461 2.9512,8.6628 3.3877,18.2472 0.4714,10.3625 0.5739,13.4754 0.5739,39.7095 0,26.234 -0.1025,29.347 -0.5739,39.7095 -0.4386,9.5843 -2.0412,14.7861 -3.3877,18.2471 -1.783,4.5874 -3.9186,7.8539 -7.3617,11.2923 -3.443,3.4406 -6.712,5.5704 -11.3048,7.3521 -3.4636,1.3517 -8.6733,2.949 -18.2648,3.3873 -10.3702,0.471 -13.4854,0.5734 -39.7513,0.5734 -26.2679,0 -29.381,-0.1024 -39.7513,-0.5734 -9.5914,-0.4423 -14.797,-2.0438 -18.2668,-3.3893 -4.5908,-1.7817 -7.87,-3.9116 -11.313,-7.3521 -3.4431,-3.4405 -5.5745,-6.709 -7.3617,-11.2985 -1.3465,-3.461 -2.9512,-8.6628 -3.3877,-18.2471 -0.4714,-10.3626 -0.5657,-13.4754 -0.5657,-39.7259 0,-26.2504 0.0943,-29.347 0.5657,-39.7095 0.4386,-9.5844 2.0412,-14.7861 3.3877,-18.2512 1.783,-4.5874 3.9186,-7.8641 7.3617,-11.3046 3.443,-3.4406 6.7222,-5.5704 11.313,-7.3562 3.4677,-1.3517 8.6754,-2.949 18.2668,-3.3894 9.075,-0.4096 12.5919,-0.5324 30.9264,-0.553 z m 61.3363,16.322 c -6.5173,0 -11.805,5.2776 -11.805,11.792 0,6.5125 5.2877,11.7962 11.805,11.7962 6.5172,0 11.8049,-5.2837 11.8049,-11.7962 0,-6.5124 -5.2877,-11.796 -11.805,-11.796 z m -52.5113,13.7826 c -27.8993,0 -50.5191,22.6031 -50.5191,50.4817 0,27.8786 22.6198,50.4714 50.5191,50.4714 27.8993,0 50.511,-22.5928 50.511,-50.4714 0,-27.8786 -22.6137,-50.4817 -50.513,-50.4817 z m 0,17.7147 c 18.109,0 32.7914,14.6694 32.7914,32.767 0,18.0956 -14.6824,32.767 -32.7914,32.767 -18.111,0 -32.7913,-14.6714 -32.7913,-32.767 0,-18.0976 14.6803,-32.767 32.7913,-32.767 z",fill:"#ffffff",id:"path15"})]})]})}));var g=i(42042),v=i(20068),f=i(68833),b=i(15771),_=i(19081),y=i(6490),Z=i(58175);let w="step-Rk40vT",k=e=>{let{isOpen:t,onClose:i,onCopyLinkClick:n,mediaCarousel:o}=e;return(0,l.d4)(()=>{t&&(0,f.j)(f.FP.VIDEO_CLIP_INSTAGRAM_SHARE_MODAL_SEEN,{source:"clip-share-modal"})},[t]),(0,r.BX)(y.u_,{isOpen:t,onClose:i,fullscreenMobile:!0,children:[(0,r.tZ)(y.xB,{showClose:!0,onClose:i,title:"Share to Instagram"}),(0,r.tZ)(y.fe,{children:(0,r.BX)(_.tu,{gap:32,children:[(0,r.BX)(_.gq,{children:[(0,r.tZ)(_.gq,{justifyContent:"center",className:w,children:(0,r.tZ)(Z.xv.H4,{children:"1"})}),(0,r.tZ)(_.gq,{children:(0,r.BX)(_.tu,{gap:16,children:[(0,r.tZ)(Z.xv.H4,{children:"Download clip"}),(0,r.tZ)(_.tu,{bg:"secondary",radius:"md",border:"detail",children:o})]})})]}),(0,r.BX)(_.gq,{children:[(0,r.tZ)(_.gq,{justifyContent:"center",className:w,children:(0,r.tZ)(Z.xv.H4,{children:"2"})}),(0,r.tZ)(_.gq,{children:(0,r.BX)(_.tu,{gap:16,children:[(0,r.BX)(_.tu,{gap:4,children:[(0,r.tZ)(Z.xv.H4,{children:"Copy a link to the post"}),(0,r.tZ)(Z.xv.B4,{children:"Add a link to your Instagram story or bio."})]}),(0,r.tZ)(_.gq,{children:(0,r.tZ)(b.zx,{priority:"secondary",onClick:()=>n("instagram","substack-clips","social"),trailing:(0,r.tZ)(d.Z,{}),children:"Copy link"})})]})})]}),(0,r.BX)(_.gq,{children:[(0,r.tZ)(_.gq,{justifyContent:"center",className:w,children:(0,r.tZ)(Z.xv.H4,{children:"3"})}),(0,r.tZ)(_.gq,{children:(0,r.tZ)(_.tu,{gap:16,children:(0,r.BX)(_.tu,{gap:4,children:[(0,r.tZ)(Z.xv.H4,{children:"Post from Instagram"}),(0,r.tZ)(Z.xv.B4,{children:"Visit the Instagram app and share the image with a link to the post. Or share from Instagram on desktop"})]})})})]}),(0,r.tZ)(_.gq,{justifyContent:"end",paddingTop:32,paddingX:16,children:(0,r.tZ)(b.zx,{priority:"primary",onClick:i,children:"Done"})})]})})]})};var C=i(75697),S=i(98914),x=i(98248),B=i(70379),P=i(87077),I=i(60308),N=i(63651);function T(e){let{shareUrl:t,pub:i,post:a,clip:h,selectionId:y,disabled:Z,disabledInstagram:w,disabledDownload:T,onDownloadClick:E,isSharing:L}=e,X=(0,B.pm)(),[M,R]=(0,l.eJ)(!1),F=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"substack-clip",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"web";U(e,t,i,e=>((0,S.vQ)(e),X.popToast(e=>(0,r.tZ)(B.FN,(0,o._)((0,n._)({},e),{text:"Copied link to clipboard"}))),!1))},U=(e,n,o,r)=>{(0,C.I)(e,r,{shareUrl:t(e,n,o),post:a,pub:i,selectionId:y,utm_campaign:n,utm_medium:o,event:f.FP.VIDEO_CLIP_SHARE_BUTTON_CLICKED})},O=async()=>{U("facebook","substack-clips","social",e=>(0,N.n1t)("https://www.facebook.com/sharer/sharer.php",{u:e}))},A=async()=>{a&&U("twitter","substack-clips","social",e=>(0,I.LaP)({url:e,text:a.title}))},D=async()=>{U("linkedin","substack-clips","social",e=>(0,N.n1t)("https://www.linkedin.com/sharing/share-offsite/",{url:e}))};return(0,r.BX)(_.gq,{justifyContent:"space-between",flex:"fill",children:[L?(0,r.tZ)(_.gq,{children:(0,r.tZ)(b.zx,{priority:"primary",rounded:!1,onClick:()=>F(),leading:(0,r.tZ)(d.Z,{size:20}),children:"Copy link"})}):(0,r.tZ)("div",{}),(0,r.BX)(_.gq,{gap:8,children:[(0,r.tZ)(P.u,{text:T?"Your clip will be ready to download shortly":"Download",children:(0,r.tZ)(b.hU,{className:s()({"disabledButton-hUWISL":T}),priority:"secondary-outline",onClick:E,disabled:T,children:T?(0,r.tZ)(x.$j,{}):(0,r.tZ)(c.Z,{size:20})})}),!L&&(0,r.tZ)(b.hU,{priority:"secondary-outline",onClick:()=>F(),disabled:Z,children:(0,r.tZ)(d.Z,{size:20})}),(0,r.tZ)(b.hU,{priority:"secondary-outline",onClick:()=>{(0,C.BZ)({shareUrl:t("notes","substack-clips","web"),pub:i,post:a,utm_campaign:"substack-clips"})},disabled:Z,children:(0,r.tZ)(g.Z,{height:24})}),(0,r.tZ)(b.hU,{priority:"secondary-outline",onClick:()=>{(0,f.j)(f.FP.VIDEO_CLIP_SHARE_BUTTON_CLICKED,{name:"instagram",post_id:a?a.id:null,utm_campaign:"substack-clips",utm_medium:"social"}),R(!0)},disabled:Z||w,children:(0,r.tZ)(m,{height:20,width:20})}),(0,r.tZ)(b.hU,{priority:"secondary-outline",onClick:A,disabled:Z,children:(0,r.tZ)(v.Z,{height:20,width:20})}),(0,r.tZ)(b.hU,{priority:"secondary-outline",onClick:O,disabled:Z,children:(0,r.tZ)(u.Z,{height:20,width:20})}),(0,r.tZ)(b.hU,{priority:"secondary-outline",onClick:D,disabled:Z,children:(0,r.tZ)(p.Z,{height:20,width:20})}),(0,r.tZ)(k,{isOpen:M,onClose:()=>{R(!1)},onCopyLinkClick:F,mediaCarousel:(0,r.BX)(_.gq,{gap:16,alignItems:"center",justifyContent:"center",padding:16,position:"relative",children:[(0,r.tZ)("img",{src:(0,I.kOB)(h),width:"300px"}),(0,r.tZ)("div",{className:"download-QWI_A5",children:(0,r.tZ)(_.gq,{padding:32,children:(0,r.tZ)(b.GI,{onClick:()=>E&&E(),children:(0,r.tZ)(c.Z,{size:"16"})})})})]})})]})]})}},29032:function(e,t,i){i.d(t,{C:()=>r});var n=i(16584),o=i(4615);let r=e=>{let{children:t,disable:i}=e;return i?(0,n.tZ)(n.HY,{children:t}):(0,n.tZ)(o.f6,{theme:"dark-theme",children:t})}},28121:function(e,t,i){i.d(t,{Y:()=>l});var n=i(16584),o=i(347),r=i(19081);let l=()=>(0,n.tZ)(o.h,{children:(0,n.tZ)(r.gq,{height:56,borderBottom:"detail-themed"})})},67203:function(e,t,i){i.d(t,{O0:()=>W,YY:()=>j,sp:()=>H});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(94184),s=i.n(a),d=i(31131),c=i(99869),u=i(77600),p=i(40423),h=i(28596),m=i(98661),g=i(60826),v=i(61649),f=i(51455),b=i(59154),_=i(79138),y=i(37632),Z=i(4473),w=i(39535),k=i(94442),C=i(75697),S=i(57391),x=i(95441),B=i(93155),P=i(68833),I=i(59176),N=i(98914),T=i(15771),E=i(82402),L=i(19081),X=i(44424),M=i(58175),R=i(51776),F=i(70379),U=i(97434),O=i(37759),A=i(93370),D=i(47929),z=i(8108);let j=e=>{let{initialTime:t,onChange:i,maxTime:n}=e,{iString:o}=(0,x.M1)(),[a,s]=(0,l.eJ)(!0),[d,c]=(0,l.eJ)(!0),[u,p]=(0,l.eJ)((0,A.DL)(null!=t?t:0)),h=e=>{let t=(0,A.Jk)(e),o=(0,A.ZD)(e);t&&(!n||o<=n)?(i((0,A.ZD)(e)),c(!0)):(i(null),c(!1)),p(e)};return(0,r.BX)(L.gq,{gap:12,alignItems:"center",paddingX:8,paddingY:4,children:[(0,r.tZ)(X.Mz,{children:(0,r.tZ)(E.X,{size:"sm",checked:a,onChange:()=>s(!a)})}),(0,r.tZ)(M.xv.B4,{weight:"medium",color:"primary",children:o("Start at")}),(0,r.tZ)(R.oi,{className:z.Z.textInput,value:u,error:!d,onChange:e=>h(e.currentTarget.value),placeholder:"0:00"})]})};function H(e){var t,i,a,h,E;let M,{post:R,user:U,pub:O,trigger:A,onChange:H,position:q,showClipping:Y,disableClipping:V,initialShareTimestamp:K}=e,{iString:J}=(0,x.M1)(),{onStartClipping:G}=(0,v.Sr)(),[Q,$]=(0,l.eJ)(null!=K?K:null);(0,m.useEffect)(()=>{K&&$(K)},[K]);let ee=Q?{timestamp:Q.toFixed(1)}:{},{getExperimentVariant:et,exposeExperiment:ei}=(0,S.jc)(),en=(0,C.O1)(null,{post:R,pub:O,user:U,useCustomDomainOverOpen:!0,params:(0,n._)({},ee,U&&{showWelcomeOnShare:"treatment"===et("show_welcome_screen_on_post_share")})}),eo=(0,C.B8)({post:R,pub:O}),er={title:eo,url:en},el=(0,F.pm)(),{openModal:ea,closeModal:es}=(0,B.dd)(),ed=(0,N.K1)()&&navigator.share&&navigator.canShare&&navigator.canShare(er),[ec,eu]=(0,l.eJ)(ed),ep=async()=>{if((0,P.j)(P.FP.POST_SHARE_BUTTON_CLICKED,{position:q,post_id:R.id}),ed&&ec)try{var e;await navigator.share(er),ei("show_welcome_screen_on_post_share"),(0,P.j)(P.FP.NATIVE_SHARE_SUCCESS,{medium:"web",post_id:null!==(e=R.id)&&void 0!==e?e:null,utm_campaign:D.VX.default}),(0,I.ex)("".concat(O.subdomain," shared"),!0);return}catch(e){if(!(e instanceof Error)||"AbortError"===e.name)return;eu(!1),(0,P.j)(P.FP.NATIVE_SHARE_FAILED,{errorName:e.name,errorMessage:e.message})}};if(void 0!==A.type)M=A;else{if(void 0!==(E=A).style&&void 0!==E.labelStyle){let e;e=R.share_url_override?R.share_url_override:A.isStatic?R?g.W.SHARE_URL:g.W.SHARE_PUB_URL:"javascript:void(0)";let t="none"===A.labelStyle;M=(0,r.tZ)(k.Ng,{style:A.style,icon:t?(0,r.tZ)(d.Z,{className:"icon",height:(0,k.Su)(A.style),strokeWidth:k.PA,width:(0,k.Su)(A.style)}):null,href:e,noLabel:"none"===A.labelStyle,className:s()(!t&&"no-icon"),children:"cta"===A.labelStyle&&J("Share")})}}return(0,r.tZ)(r.HY,{children:(0,r.BX)(X.v2,{trigger:M,onOpen:ep,disableMenu:ec,layerOptions:{placement:"pub-preview"===q?"bottom-start":"bottom-end",preferX:"pub-preview"===q?"right":"left"},className:z.Z.dropdownMenu,maxHeight:"fit-content",ariaLabel:J("View share options"),children:[(0,r.tZ)(X.sN,{leading:(0,r.tZ)(c.Z,{}),onClick:()=>{ei("show_welcome_screen_on_post_share"),(0,C.Ui)({shareUrl:en,pub:O,post:R,utm_campaign:q,skipToast:!0,trackParams:ee}),el.popToast(e=>(0,r.tZ)(F.FN,(0,o._)((0,n._)({},e),{text:J("Copied link to clipboard")}))),null==H||H()},children:J("Copy link")}),U&&(0,r.tZ)(W,{url:en,onShare:()=>{(0,P.j)(P.FP.SHARE_LINK_CLICKED,{name:"direct_message",post_id:R.id,source:q}),null==H||H()}}),(0,r.tZ)(X.sN,{leading:(0,r.tZ)(u.Z,{}),onClick:()=>{ea({children:(0,r.tZ)(f.I,{post:R,pub:O,onClose:es}),width:540})},children:J("Embed")}),(0,r.BX)(X.xw,{children:[(0,r.tZ)(X.sN,{leading:(0,r.tZ)(Z.Z,{}),onClick:()=>{ei("show_welcome_screen_on_post_share"),(0,C.BZ)({shareUrl:en,pub:O,post:R,utm_campaign:q,trackParams:ee}),null==H||H()},children:J("Share to Notes")}),(0,r.tZ)(X.sN,{leading:(0,r.tZ)(_.Z,{}),onClick:()=>{ei("show_welcome_screen_on_post_share"),(0,C.Po)({shareUrl:en,pub:O,post:R,utm_campaign:q,trackParams:ee}),null==H||H()},children:J("Share to Facebook")}),(0,r.tZ)(X.sN,{leading:(0,r.tZ)(y.Z,{}),onClick:()=>{ei("show_welcome_screen_on_post_share"),(0,C.lc)({shareUrl:en,pub:O,post:R,utm_campaign:q,trackParams:ee}),null==H||H()},children:J("Share to Linkedin")}),(0,r.tZ)(X.sN,{leading:(0,r.tZ)(b.Z,{}),onClick:()=>{ei("show_welcome_screen_on_post_share"),(0,C.bI)({shareUrl:en,shareName:eo,pub:O,post:R,utm_campaign:q,trackParams:ee}),null==H||H()},children:J("Share to Bluesky")}),(0,r.tZ)(X.sN,{leading:(0,r.tZ)(w.Z,{}),onClick:()=>{ei("show_welcome_screen_on_post_share"),(0,C.Wn)({shareUrl:en,shareName:eo,pub:O,post:R,utm_campaign:q,trackParams:ee}),null==H||H()},children:J("Share to X")})]}),R.videoUpload&&(0,r.tZ)(X.xw,{children:(0,r.tZ)(j,{initialTime:null!=K?K:0,onChange:$,maxTime:null!==(h=null!==(a=null===(t=R.videoUpload)||void 0===t?void 0:t.duration)&&void 0!==a?a:null===(i=R.podcastUpload)||void 0===i?void 0:i.duration)&&void 0!==h?h:null})}),Y&&(0,r.tZ)(X.xw,{children:(0,r.tZ)(L.tu,{paddingX:8,paddingTop:4,paddingBottom:8,children:(0,r.tZ)(T.zx,{leading:(0,r.tZ)(p.Z,{size:16}),disabled:V,priority:"primary",onClick:()=>{(0,P.j)(P.FP.MEDIA_CLIP_BUTTON_CLICKED,{button:"create",source:"post share dropdown"}),(0,P.j)(P.FP.VIDEO_CLIP_BUTTON_CLICKED,{post_id:R.id,source:q,type:R.type}),G({source:"post-share-dropdown",title:null}),null==H||H()},children:J("Create clip")})})})]})})}function W(e){let{url:t,onShare:i}=e,{iString:n}=(0,x.M1)(),o=(0,U.B)();return(0,r.tZ)(X.sN,{leading:(0,r.tZ)(h.Z,{}),onClick:()=>{o.open({linkAttachmentUrl:t,source:"share_post"}),null==i||i()},onMouseEnter:O.R,children:n("Send as message")})}},28905:function(e,t,i){i.d(t,{z:()=>u});var n=i(7409),o=i(98848),r=i(16584),l=i(30396),a=i(48980),s=i(19081),d=i(76820);let c=e=>{var{mediaAsset:t}=e,i=(0,o._)(e,["mediaAsset"]);let[n,s]=(0,l.eJ)(null);return((0,l.d4)(()=>{let e=async e=>{s(await (0,a.rd)("/api/v1/video/upload/".concat(e)))};t.media_upload_id&&e(t.media_upload_id)},[t.media_upload_id]),n)?(0,r.tZ)(d.Jl,{mediaUpload:n,composing:!1,videoPlayerProps:i}):null},u=e=>{var{mediaAssets:t=[]}=e,i=(0,o._)(e,["mediaAssets"]);return(0,r.tZ)(s.sg,{children:t.map(e=>(0,r.tZ)(c,(0,n._)({mediaAsset:e},i),e.media_upload_id))})}},50486:function(e,t,i){i.d(t,{p:()=>a});var n=i(16584),o=i(94184),r=i.n(o),l=i(24189);let a=e=>{let{name:t,label:i,info:o,checked:a,disabled:s,onChange:d,isRow:c=!0,className:u}=e,p=(0,n.tZ)(n.HY,{children:(0,n.tZ)("span",{className:r()("big-checkbox",{checked:a,disabled:s}),onClick:()=>!s&&(null==d?void 0:d(!a)),onKeyDown:e=>{" "===e.key&&(null==d||d(!a))},role:"checkbox","aria-checked":a,"aria-label":i||t,tabIndex:0,children:a&&(0,n.tZ)(l.Z,{fill:"#ffffff"})})});return(0,n.BX)("label",{className:r()("big-checkbox-input",u,{"big-checkbox-input-row":c}),children:[!c&&p,(0,n.BX)("div",{onClick:()=>{(i||o)&&(s||null==d||d(!a))},children:[i,o&&(0,n.tZ)("div",{className:"info",children:o})]}),c&&p,(0,n.tZ)("input",{type:"hidden",name:t,"data-testid":t,value:String(a)})]})}},76205:function(e,t,i){i.d(t,{Z:()=>d});var n=i(7409),o=i(16584),r=i(6400),l=i(94184),a=i.n(l),s=i(32351);class d extends r.Component{render(e){let{html:t,children:i,metadata:r}=e;return(0,o.BX)("div",{className:a()("pageContainer-PCEs9w","container-border"),children:[(0,o.tZ)(s.Metadata,(0,n._)({},r)),(0,o.tZ)("div",{className:"container",children:(0,o.BX)("div",{className:"page typography",children:[i,(0,o.tZ)("div",{className:"body markup",dangerouslySetInnerHTML:{__html:t}})]})})]})}}},46990:function(e,t,i){i.d(t,{Z:()=>a});var n=i(7409),o=i(99282),r=i(16584),l=i(64515);let a=e=>(0,r.BX)(l.l,(0,o._)((0,n._)({},e),{name:"FacebookIconCircle",svgParams:{height:24,width:24},children:[(0,r.tZ)("circle",{cx:"12",cy:"12",r:"11.75",fill:"white",stroke:"none"}),(0,r.tZ)("path",{d:"M12 0C5.37098 0 0 5.37089 0 11.9975C0 17.9844 4.38331 22.9414 10.1117 23.8491L10.1164 15.473H7.04998V12.0021H10.1164C10.1164 12.0021 10.1023 10.0269 10.1164 9.14743C10.1305 8.26797 10.3045 7.42142 10.7607 6.65008C11.4615 5.4555 12.5526 4.87237 13.893 4.70775C14.9935 4.57135 16.08 4.72183 17.1664 4.87237C17.2416 4.88176 17.2792 4.89115 17.3545 4.90529C17.3545 4.90529 17.3592 5.03225 17.3545 5.11222C17.3498 5.94933 17.3545 7.86819 17.3545 7.86819C16.8324 7.8588 15.9671 7.80706 15.3933 7.89641C14.4433 8.04221 13.8977 8.64891 13.8789 9.6036C13.8601 10.3467 13.8695 12.0021 13.8695 12.0021H17.2134L16.6726 15.473H13.8742V23.8491C19.612 22.9508 24 17.9844 24 11.9975C23.9953 5.37089 18.6243 0 11.9977 0Z",fill:"#1877f2",stroke:"none"})]}))},27543:function(e,t,i){i.d(t,{Z:()=>a});var n=i(7409),o=i(99282),r=i(16584),l=i(64515);let a=e=>(0,r.tZ)(l.l,(0,o._)((0,n._)({},e),{name:"LinkedInShareIcon",svgParams:{height:24,width:24,stroke:"none",viewBox:"0 0 72 72"},children:(0,r.BX)("g",{fill:"none","fill-rule":"evenodd",stroke:"none",children:[(0,r.tZ)("path",{d:"M36,72 L36,72 C55.882251,72 72,55.882251 72,36 L72,36 C72,16.117749 55.882251,-3.65231026e-15 36,0 L36,0 C16.117749,3.65231026e-15 -2.4348735e-15,16.117749 0,36 L0,36 C2.4348735e-15,55.882251 16.117749,72 36,72 Z",fill:"#007EBB"}),(0,r.tZ)("path",{d:"M59,57 L49.959375,57 L49.959375,41.6017895 C49.959375,37.3800228 48.3552083,35.0207581 45.0136719,35.0207581 C41.3785156,35.0207581 39.4792969,37.4759395 39.4792969,41.6017895 L39.4792969,57 L30.7666667,57 L30.7666667,27.6666667 L39.4792969,27.6666667 L39.4792969,31.6178624 C39.4792969,31.6178624 42.0989583,26.7704897 48.3236979,26.7704897 C54.5455729,26.7704897 59,30.5699366 59,38.4279486 L59,57 Z M20.372526,23.8257036 C17.4048177,23.8257036 15,21.4020172 15,18.4128518 C15,15.4236864 17.4048177,13 20.372526,13 C23.3402344,13 25.7436198,15.4236864 25.7436198,18.4128518 C25.7436198,21.4020172 23.3402344,23.8257036 20.372526,23.8257036 Z M15.8736979,57 L24.958724,57 L24.958724,27.6666667 L15.8736979,27.6666667 L15.8736979,57 Z",fill:"#FFF",stroke:"none"})]})}))},76157:function(e,t,i){i.d(t,{Z:()=>s});var n=i(7409),o=i(99282),r=i(16584),l=i(4675),a=i(64515);let s=e=>(0,r.tZ)(a.l,(0,o._)((0,n._)({},e),{name:"LucideArrowLeftRight",svgParams:{height:24,width:24,fill:"#000000",strokeWidth:0},children:(0,r.tZ)(l.Z,{height:24,stroke:e.stroke,fill:e.fill,strokeWidth:e.strokeWidth})}))},42042:function(e,t,i){i.d(t,{Z:()=>a});var n=i(7409),o=i(99282),r=i(16584),l=i(64515);let a=e=>(0,r.tZ)(l.l,(0,o._)((0,n._)({},e),{name:"ShareSubstackIcon",svgParams:{height:24,width:24,viewBox:"0 0 24 24",stroke:"none"},children:(0,r.tZ)("path",{d:"M21.6608 8.55517H2.33838V5.9555H21.6617V8.55517H21.6608ZM2.33838 10.911V23L12 17.6008L21.6617 23V10.911H2.33838ZM21.6617 1H2.33838V3.59967H21.6617V1Z",fill:"var(--color-accent-fg-substack)",stroke:"none"})}))},20068:function(e,t,i){i.d(t,{Z:()=>a});var n=i(7409),o=i(99282),r=i(16584),l=i(64515);let a=e=>(0,r.tZ)(l.l,(0,o._)((0,n._)({},e),{name:"ShareTwitterIcon",svgParams:{height:24,width:24,stroke:"none"},children:(0,r.tZ)("path",{d:"M17.7508 2.96069H20.8175L14.1175 10.619L22 21.0382H15.8283L10.995 14.7182L5.46333 21.0382H2.395L9.56167 12.8465L2 2.96153H8.32833L12.6975 8.73819L17.7508 2.96069ZM16.675 19.2032H18.3742L7.405 4.69986H5.58167L16.675 19.2032Z",fill:"var(--color-fg-primary)",stroke:"none"})}))},16808:function(e,t,i){i.d(t,{_q:()=>B,hF:()=>I,xt:()=>P});var n=i(7409),o=i(16584),r=i(30396),l=i(94184),a=i.n(l),s=i(36808),d=i(51014),c=i(40647),u=i(68833),p=i(27036),h=i(98914),m=i(15771),g=i(19081),v=i(6490),f=i(58175),b=i(98012),_=i(31742),y=i(63651),Z=i(84864),w=i(47929),k=i(2180);let C=_.Ic.LIKE_UPSELL_LAST_SHOWN_AT,S=()=>{let e=s.get(C);if(e){let t=(0,b.Z)(e),i=(0,b.Z)().subtract(30,"days");if(t.isAfter(i))return!1}return!0},x=e=>{s.set(C,(0,b.Z)().format(),(0,n._)({expires:3650},!e.custom_domain&&{domain:".".concat(new URL((0,y.SVA)()).hostname)}))},B=e=>{var t,i;let{pub:l}=e,s=(0,c.xR)(),[d,p]=(0,r.eJ)(null==l?void 0:null===(t=l.plans)||void 0===t?void 0:t[0]),v=s.getConfigFor("disable_monthly_subscriptions"),b=s.getConfigFor("disable_annual_subscriptions");return(0,o.BX)(g.tu,{gap:20,children:[(0,o.BX)(g.tu,{gap:4,children:[(0,o.BX)(f.xv.H4,{weight:"semibold",children:["Support ",l.name]}),(0,o.BX)(f.xv.B4,{color:"secondary",children:["Since you liked this post, why not support ",l.name," with a subscription?"]})]}),(0,o.tZ)("form",{className:k.Z.form,children:(0,o.tZ)(g.tu,{gap:12,children:null==l?void 0:null===(i=l.plans)||void 0===i?void 0:i.map(e=>{if(("month"!==e.interval||!v)&&("year"!==e.interval||!b))return(0,o.tZ)("label",{className:k.Z.label,children:(0,o.BX)(g.gq,{gap:12,alignItems:"center",children:[(0,o.tZ)("input",{name:"plan",type:"radio",value:e.id,onInput:()=>p(e),checked:d&&d.id===e.id,className:a()({[k.Z.selectedInput]:d&&d.id===e.id},k.Z.input)}),(0,o.BX)(g.gq,{gap:8,children:[(0,o.tZ)(f.xv.B4,{as:"span",weight:"semibold",color:d&&d.id===e.id?"primary":"secondary",children:(0,Z.getPlanTitle)(e,l.language)}),(0,o.tZ)(f.xv.B4,{as:"span",color:"secondary",children:(0,Z.planBasePricing)(e)})]})]})},e.id)})})}),(0,o.tZ)(m.zx,{onClick:()=>{(0,u.j)(u.FP.LIKE_UPSELL_PLAN_SELECTED),(0,h.uX)((0,y.W1P)(l,{params:(0,n._)({utm_source:w.b3.likeButtonUpsell},d&&{selectedPlanId:d.id})}),{local_navigation:!1})},flex:"grow",priority:"primary",children:"Select"})]})},P=e=>{let{onClose:t,shareDialogRef:i}=e;return(0,o.BX)(g.tu,{gap:20,children:[(0,o.BX)(g.tu,{gap:4,children:[(0,o.tZ)(f.xv.H4,{weight:"semibold",children:"Share this post with a friend"}),(0,o.tZ)(f.xv.B4,{color:"secondary",children:"Since you liked this post, why not share it to help spread the word?"})]}),(0,o.tZ)(m.zx,{onClick:()=>{var e;(0,u.j)(u.FP.LIKE_UPSELL_SHARE_CLICKED),null===(e=i.current)||void 0===e||e.open(),null==t||t()},flex:"grow",priority:"primary",children:"Share"})]})},I=e=>{let{user:t,pub:i,post:n}=e,l=(0,r.sO)(),a=S(),[s,c]=(0,r.eJ)(a),[m,g]=(0,r.eJ)(a);(0,r.d4)(()=>{(!a||(null==t?void 0:t.is_contributor)||(null==t?void 0:t.is_admin))&&(0,h.iO)("show_reaction_upsell")},[a,t]),(0,r.d4)(()=>{m&&s&&t&&((0,u.j)(u.FP.LIKE_UPSELL_MODAL_SEEN,{source:"email",type:(0,p.P)(t,i)?"share":"paid"}),x(i))},[m,s,i,t]);let f=()=>{c(!s),g(!1),(0,h.iO)("show_reaction_upsell")};return t&&!t.is_contributor&&!t.is_admin&&m?(0,o.BX)(o.HY,{children:[(0,o.tZ)(v.u_,{isOpen:s,onClose:f,children:(0,o.tZ)(v.fe,{children:(0,p.P)(t,i)?(0,o.tZ)(P,{pub:i,onClose:f,shareDialogRef:l}):(0,o.tZ)(B,{pub:i})})}),(0,o.tZ)(d.ZP,{ref:l,user:t,pub:i,post:n})]}):null}},31815:function(e,t,i){i.d(t,{l:()=>G});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(94184),s=i.n(a),d=i(39693),c=i.n(d),u=i(24350),p=i.n(u),h=i(25380),m=i(5463),g=i(32224),v=i(98661),f=i(82034),b=i(34057),_=i(20888),y=i(4211),Z=i(73207),w=i(14952),k=i(49688),C=i(98422),S=i(19081),x=i(58175),B=i(6070),P=i(60308),I=i(81821);let N={containerFP:"containerFP-Ndac1V",containerFp:"containerFP-Ndac1V",name:"name-mkZ7O7",imgFP:"imgFP-nsipp_",imgFp:"imgFP-nsipp_",toggleBox:"toggleBox-FyAfgO",selected:"selected-bOtT9y",previewLink:"previewLink-nVh1jb",img:"img-tyGf_Q",container:"container-Yff188",selectableContainer:"selectableContainer-nkPfNo",selectedContainer:"selectedContainer-jizK_g",clickableContainer:"clickableContainer-BH19PC",containerMobile:"containerMobile-MaSyfh",imgMobile:"imgMobile-afxbEf",selector:"selector-x5tcGg",unselected:"unselected-B90yNk",seeLatest:"seeLatest-OQwW6G"},T=e=>{var t,i,n,o,l;let{newsletter:a,hideLink:d=!1,onToggle:c,onClick:u}=e,p=(0,w.Ij)(),{metadata:h}=(0,Z.I)({pub:p}),{metadata:m}=(0,Z.I)({pub:p,pubSetting:"fp_primary_column_section_ids"});u&&c&&console.error("you cannot pass both onToggle and onClick");let g=!!c;if((0,B.HD)({pub:p}))return(0,r.tZ)(E,{newsletter:a,onClick:u,onToggle:c});if((0,I.tq)())return(0,r.tZ)(L,{newsletter:a,hideLink:d,onClick:u,onToggle:c});let v=null!==(l=null===(t=h[null!==(n=a.sectionId)&&void 0!==n?n:-1])||void 0===t?void 0:t.frequency)&&void 0!==l?l:null===(i=m[null!==(o=a.sectionId)&&void 0!==o?o:-1])||void 0===i?void 0:i.frequency;return(0,r.BX)(S.tu,{className:s()(N.container,{[N.selectedContainer]:g&&a.selected,[N.selectableContainer]:g,[N.clickableContainer]:!!u}),justifyContent:"space-between",radius:"md",padding:16,onClick:g?e=>{e.stopPropagation(),null==c||c({sectionId:a.sectionId,isSelected:!a.selected})}:null!=u?u:void 0,children:[g&&a.selected?(0,r.tZ)(b.Z,{className:s()(N.selector)}):g?(0,r.tZ)("div",{className:s()(N.unselected,N.selector)}):null,(0,r.BX)(S.tu,{gap:24,children:[a.logoUrl&&(0,r.tZ)("div",{className:N.img,children:a.logoUrl&&(0,r.tZ)("img",{className:N.img,src:(0,P.zF4)(a.logoUrl,64)})}),(0,r.BX)(S.tu,{gap:8,children:[(0,r.BX)(x.xv.H3,{paddingRight:32*!a.logoUrl,weight:"semibold",color:"pub-primary-text",clamp:2,children:[a.name,v&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("br",{}),(0,r.tZ)(x.xv.B4,{color:"secondary",weight:"semibold",children:v})]})]}),(0,r.tZ)(x.xv.B4,{color:"pub-secondary-text",clamp:4,children:a.description})]})]}),!d&&(0,r.tZ)(x.xv,{size:14,weight:"semibold",font:"text",color:"pub-secondary-text",children:(0,r.tZ)("a",{onClick:e=>e.stopPropagation(),className:N.seeLatest,href:a.linkUrl,native:!0,children:"See the latest"})})]})},E=e=>{var t,i,l,a,d,c,u,p,m,v,f;let{newsletter:b,onToggle:x}=e,{isMobile:B}=(0,C.v9)(),P=(0,w.Ij)(),{metadata:I,ids:T}=(0,Z.I)({pub:P}),{metadata:E,ids:L}=(0,Z.I)({pub:P,pubSetting:"fp_primary_column_section_ids"}),X=T.concat(L),{markdownProps:M}=(0,k.V)(b.description);if(!x)return null;let R=X.includes(null!==(d=b.sectionId)&&void 0!==d?d:-1),F=null!==(p=null===(t=I[null!==(c=b.sectionId)&&void 0!==c?c:-1])||void 0===t?void 0:t.frequency)&&void 0!==p?p:null===(i=E[null!==(u=b.sectionId)&&void 0!==u?u:-1])||void 0===i?void 0:i.frequency,U=null!==(f=null===(l=I[null!==(m=b.sectionId)&&void 0!==m?m:-1])||void 0===l?void 0:l.tagline)&&void 0!==f?f:null===(a=E[null!==(v=b.sectionId)&&void 0!==v?v:-1])||void 0===a?void 0:a.tagline;return(0,r.BX)(S.hs,{direction:B?"row":"column",gap:8,className:s()(N.containerFP,{[N.selectedContainerFP]:b.selected}),justifyContent:"space-between",padding:16,paddingRight:B?48:void 0,children:[(0,r.tZ)(S.tu,{className:s()(N.toggleBox,{[N.selected]:b.selected}),onClick:()=>{x({sectionId:b.sectionId,isSelected:!b.selected})},children:b.selected?(0,r.tZ)(h.Z,{color:"#FFFFFF",size:20}):(0,r.tZ)(g.Z,{color:"var(--color-primary-themed)",size:20})}),b.logoUrl&&(0,r.tZ)("div",{children:(0,r.tZ)(_.e,{src:b.logoUrl,className:N.imgFP,maxWidth:80,imageIsFixedWidth:!0,useRetinaSizing:!0})}),(0,r.BX)(S.tu,{justifyContent:"space-between",style:{height:"100%"},children:[(0,r.BX)(S.tu,{gap:8,children:[(0,r.BX)(y.Z,{preset:"h7-sans",className:N.name,children:[b.name,U&&": ".concat(U)]}),(0,r.tZ)(y.Z,(0,o._)((0,n._)({},M),{preset:"d4-serif",clamp:4}))]}),R&&(0,r.BX)(S.gq,{gap:8,paddingTop:16,children:[(0,r.tZ)(y.Z,{className:N.previewLink,as:"a",preset:"caption",color:"accent",onClick:e=>e.stopPropagation(),href:b.linkUrl,native:!0,children:"Preview"}),F&&(0,r.tZ)(y.Z,{as:"a",preset:"caption",color:"tertiary",onClick:e=>e.stopPropagation(),href:b.linkUrl,native:!0,children:F})]})]})]})},L=e=>{var t,i;let{newsletter:n,hideLink:o,onClick:l,onToggle:a}=e,d=(0,w.Ij)(),{metadata:c}=(0,Z.I)({pub:d}),u=!!a,p=e=>{e.stopPropagation(),null==a||a({sectionId:n.sectionId,isSelected:!n.selected})},h=null===(t=c[null!==(i=n.sectionId)&&void 0!==i?i:-1])||void 0===t?void 0:t.frequency;return(0,r.BX)(S.tu,{className:s()(N.containerMobile,{[N.selectedContainer]:u&&n.selected,[N.selectableContainer]:u,[N.clickableContainer]:!!p}),justifyContent:"space-between",radius:"md",padding:16,onClick:u?p:null!=l?l:void 0,children:[u&&n.selected?(0,r.tZ)(b.Z,{className:s()(N.selector)}):u?(0,r.tZ)("div",{className:s()(N.unselected,N.selector)}):null,(0,r.BX)(S.tu,{gap:8,children:[(0,r.BX)(S.gq,{gap:8,children:[n.logoUrl&&(0,r.tZ)("img",{className:N.imgMobile,src:(0,P.zF4)(n.logoUrl,64)}),(0,r.tZ)(x.xv.B3,{paddingRight:32,weight:"semibold",color:"primary",font:"text",clamp:2,children:n.name})]}),(0,r.tZ)(x.xv.B4,{color:"secondary",clamp:2,font:"text",children:n.description}),h&&(0,r.BX)(x.xv.B4,{color:"secondary",weight:"semibold",children:["Frequency: ",h]})]}),!o&&(0,r.tZ)(x.xv,{translated:!0,size:14,weight:"semibold",font:"text",color:"pub-secondary-text",children:(0,r.tZ)("a",{href:n.linkUrl,native:!0,children:"See the latest"})})]})};var X=i(95441),M=i(98914);let R=e=>{let{newsletters:t,hideLinks:i,onNewsletterClick:n,justifyItems:o}=e,{iString:l}=(0,X.M1)(),{isMobile:a}=(0,C.v9)(),s=(0,w.Ij)();return(0,r.BX)(S.hs,{direction:(0,B.HD)({pub:s})&&a?"column":"row",className:"container-AE41Ma",wrap:"wrap",justifyContent:o,gap:(0,B.HD)({pub:s})&&a?16:(0,B.HD)({pub:s})?40:24,children:[0===t.length&&(0,r.tZ)("div",{children:l("No additional newsletters")}),t.map((e,t)=>(0,r.tZ)(T,{newsletter:e,hideLink:i,onToggle:n?e=>{let{sectionId:t,isSelected:i}=e;n({sectionId:t,isSelected:i})}:void 0,onClick:i||(0,B.HD)({pub:s})?void 0:()=>{(0,M.uX)(e.linkUrl,{local_navigation:!1})}},t))]})};var F=i(347),U=i(44846),O=i(21061),A=i(98130),D=i(94778),z=i(7882),j=i(15771),H=i(61254),W=i(70379),q=i(24791),Y=i(14773),V=i(47929);let K={container:"container-moTuSH",large:"large-pO5KJu",newsletterList:"newsletterList-TOG54r",accountLink:"accountLink-UwyLNq",containerFP:"containerFP-TSfFix",dividerFP:"dividerFP-n4b0az",selectAll:"selectAll-z_I3hx",selectAllWrapper:"selectAllWrapper-CuXhFC"},J=e=>{let{pub:t,user:i,newsletters:a,freeSignupEmail:d,newsletter_management_token:u}=e,{ids:b}=(0,D.c)({pub:t}),{ids:_}=(0,A.L)({pub:t}),{ids:w}=(0,Z.I)({pub:t}),{ids:k}=(0,Z.I)({pub:t,pubSetting:"fp_primary_column_section_ids"}),{ids:x}=(0,O.l)({pub:t}),{isMobile:B}=(0,C.v9)(),{popToast:I}=(0,W.pm)(),N=p()(t.authorPagesInfo,"primary_section_id"),T=a.filter(e=>{var t,i,n;return!b.includes(null!==(t=e.sectionId)&&void 0!==t?t:-1)&&!_.includes(null!==(i=e.sectionId)&&void 0!==i?i:-1)&&!x.includes(null!==(n=e.sectionId)&&void 0!==n?n:-1)}).map(e=>{var i;let r=e.sectionId?N[e.sectionId]:void 0;return(0,o._)((0,n._)({},e),{linkUrl:r&&null!==(i=(0,P.rfk)({userId:r.user_id,pub:t}))&&void 0!==i?i:e.linkUrl})}),E=!!i||!!d,[L,X]=(0,l.eJ)(new Set);(0,v.useEffect)(()=>{if("undefined"!=typeof window&&E){let e=Number(new URL(window.location.href).searchParams.get("unsubscribed_from")),t=T.find(t=>t.sectionId===e);t&&I(e=>(0,r.tZ)(W.FN,(0,o._)((0,n._)({},e),{Icon:h.Z,text:"You will no longer receive emails for ".concat(t.name,".")})))}},[]);let{result:H,isLoading:q}=(0,z.ib)({pathname:"/api/v1/subscription",auto:E,query:{token:u}});(0,v.useEffect)(()=>{!q&&(null==H?void 0:H.email_settings)&&X(new Set(Object.keys(H.email_settings).filter(e=>"individual"===H.email_settings[e]).map(e=>Number(e))))},[q]);let{refetch:Y}=(0,z.ib)({pathname:"/api/v1/subscription/sections/email",auto:!1,method:"PATCH",query:{token:u},deps:[L]});if(q&&E)return(0,r.tZ)("div",{style:{minHeight:"100vh"}});let V=e=>{E&&Y({json:T.reduce((t,i)=>(i.sectionId&&(t[i.sectionId]={setting:e.has(i.sectionId)?"individual":"disabled"}),t),{})}).then(()=>{I(e=>(0,r.tZ)(W.FN,(0,o._)((0,n._)({},e),{Icon:h.Z,text:"Subscription updated!"})))})},J=e=>{let{sectionId:t,isSelected:i}=e;if(!t)return;let n=new Set(L);i?n.add(t):n.delete(t),V(n),X(n)},G=p()(T,"sectionId"),Q=c()(w.map(e=>G[e])),$=c()(k.map(e=>G[e])),ee=Q.some(e=>L.has(e.sectionId||0)),et=$.some(e=>L.has(e.sectionId||0)),ei=T.filter(e=>!k.includes(e.sectionId||-1)&&!w.includes(e.sectionId||-1)),en=ei.some(e=>L.has(e.sectionId||0)),eo=(e,t)=>{let i;let n=("from-thefp"===e?$:"columns"===e?Q:ei).map(e=>e.sectionId||0),o=Array.from(L);V(i=new Set(t?o.concat(n):o.filter(e=>!n.includes(e)))),X(i)};return(0,r.BX)(F.h,{children:[(0,r.BX)("div",{className:s()("page","typography",K.container,K.large,K.containerFP,"the-free-press-theme"),children:[(0,r.BX)(S.tu,{gap:8,position:"relative",children:[(0,r.tZ)(y.Z,{preset:"h1-sans",children:"Newsletters"}),(0,r.BX)(y.Z,{preset:"d1-sans-regular",children:["The best of ",(0,r.tZ)("em",{children:"The Free Press"}),", directly in your inbox"]}),(null==i?void 0:i.is_admin)&&(0,r.tZ)(S.gq,{position:"absolute",style:{top:0,right:0},children:(0,r.tZ)(U.r,{pub:t,sectionType:"columns",user:i})})]}),(0,r.BX)(S.tu,{paddingY:48,gap:40,children:[!!$.length&&(0,r.BX)(S.tu,{gap:B?24:40,children:[(0,r.BX)(S.tu,{gap:8,children:[(0,r.BX)(S.gq,{justifyContent:"space-between",children:[(0,r.BX)(S.gq,{gap:16,alignItems:"baseline",children:[(0,r.tZ)(y.Z,{preset:"h4-sans-condensed",children:"From The Free Press"}),!B&&(0,r.tZ)(y.Z,{preset:"d3-serif",children:"As a subscriber, every week you’ll receive:"})]}),(0,r.tZ)(j.kG,{onClick:()=>{eo("from-thefp",!et)},className:K.selectAllWrapper,style:{backgroundColor:"transparent",border:"none",cursor:"pointer"},children:(0,r.BX)(S.gq,{gap:12,alignItems:"center",children:[(0,r.tZ)(y.Z,{className:K.selectAll,preset:"detail-large",children:et?"Deselect All":"Select All"}),et?(0,r.tZ)(m.Z,{size:24,color:"var(--color-primary-themed)"}):(0,r.tZ)(g.Z,{size:24,color:"var(--color-primary-themed)"})]})})]}),(0,r.tZ)("div",{className:K.dividerFP}),B&&(0,r.tZ)(y.Z,{preset:"d3-serif",children:"As a subscriber, every week you’ll receive:"})]}),(0,r.tZ)(R,{newsletters:$.map(e=>(0,o._)((0,n._)({},e),{selected:L.has(e.sectionId||0)})),hideLinks:!1,onNewsletterClick:J,justifyItems:"start"})]}),(0,r.BX)(S.tu,{gap:B?24:40,children:[(0,r.BX)(S.tu,{gap:8,children:[(0,r.BX)(S.gq,{justifyContent:"space-between",children:[(0,r.tZ)(S.gq,{gap:16,alignItems:"baseline",children:(0,r.tZ)(y.Z,{preset:"h4-sans-condensed",children:"Featured"})}),(0,r.tZ)(j.kG,{onClick:()=>{eo("columns",!ee)},className:K.selectAllWrapper,style:{backgroundColor:"transparent",border:"none",cursor:"pointer"},children:(0,r.BX)(S.gq,{gap:12,alignItems:"center",children:[(0,r.tZ)(y.Z,{className:K.selectAll,preset:"detail-large",children:ee?"Deselect All":"Select All"}),ee?(0,r.tZ)(m.Z,{size:24,color:"var(--color-primary-themed)"}):(0,r.tZ)(g.Z,{size:24,color:"var(--color-primary-themed)"})]})})]}),(0,r.tZ)("div",{className:K.dividerFP})]}),(0,r.tZ)(R,{newsletters:Q.map(e=>(0,o._)((0,n._)({},e),{selected:L.has(e.sectionId||0)})),hideLinks:!1,onNewsletterClick:J,justifyItems:"start"})]}),(0,r.tZ)(S.tu,{gap:40,children:(0,r.BX)(S.tu,{gap:B?24:40,children:[(0,r.BX)(S.tu,{gap:8,children:[(0,r.BX)(S.gq,{justifyContent:"space-between",alignItems:"baseline",children:[(0,r.BX)(S.gq,{gap:16,alignItems:"baseline",wrap:"wrap",children:[(0,r.tZ)(y.Z,{preset:"h4-sans-condensed",children:"Topic Alerts"}),!B&&(0,r.BX)(y.Z,{preset:"d3-serif",children:["Click to select which ",(0,r.tZ)("em",{children:"Free Press"})," stories you’d like delivered directly to your inbox, the moment we publish them:"]})]}),(0,r.tZ)(j.kG,{className:K.selectAllWrapper,onClick:()=>{eo("topics",!en)},style:{backgroundColor:"transparent",border:"none",cursor:"pointer"},children:(0,r.BX)(S.gq,{gap:12,alignItems:"center",children:[(0,r.tZ)(y.Z,{className:K.selectAll,preset:"detail-large",children:en?"Deselect All":"Select All"}),en?(0,r.tZ)(m.Z,{size:24,color:"var(--color-primary-themed)"}):(0,r.tZ)(g.Z,{size:24,color:"var(--color-primary-themed)"})]})})]}),(0,r.tZ)("div",{className:K.dividerFP}),B&&(0,r.BX)(y.Z,{preset:"d3-serif",children:["Click to select which ",(0,r.tZ)("em",{children:"Free Press"})," stories you’d like delivered directly to your inbox, the moment we publish them:"]})]}),(0,r.tZ)(R,{newsletters:ei.map(e=>(0,o._)((0,n._)({},e),{selected:L.has(e.sectionId||0)})).sort((e,t)=>e.namet.name)),hideLinks:!1,onNewsletterClick:J,justifyItems:"start"})]})})]})]}),!E&&(0,r.tZ)(f.x,{isOpen:L.size>0,selectedNewsletters:L,user:i,pub:t,onSuccess:e=>{(0,M.uX)((0,P.Zs0)(t,{just_signed_up:!0,autoSubmit:!!e.body.prompt_to_login||void 0,email:e.body.email,skip_sections:!0,next:"/newsletters"}),{replace:!0,local_navigation:!1})}})]})},G=e=>{let{pub:t,user:i,freeSignupEmail:l,newsletter_management_token:a}=e,d=(0,v.useMemo)(()=>(0,q.tk)({pub:t,includeMainPub:!(0,B.HD)({pub:t}),excludePodcasts:(0,B.VL)({pub:t})||(0,B.HD)({pub:t})}).map(e=>(0,o._)((0,n._)({},e),{linkUrl:(0,P.rhs)(e.linkUrl,{utm_source:V.b3.newsletterPage}),selected:e.defaultOn})),[t]);return 0===d.length?("undefined"!=typeof window&&(window.location.href=(0,Y.SV)(t)),(0,r.tZ)("div",{children:"loading..."})):(0,B.HD)({pub:t})?(0,r.tZ)(J,{newsletter_management_token:a,newsletters:d,pub:t,user:i,freeSignupEmail:l}):(0,r.tZ)("div",{className:s()("page","typography",K.container),children:(0,r.tZ)(F.h,{children:(0,r.BX)(S.tu,{children:[(0,r.BX)(S.gq,{justifyContent:"space-between",alignItems:"center",children:[(0,r.BX)(S.tu,{gap:8,paddingBottom:40,paddingTop:48,children:[(0,r.tZ)(x.xv.H2,{color:"pub-primary-text",children:"Newsletters"}),(0,r.BX)(x.xv.B3,{color:"pub-secondary-text",children:["Get the best of ",t.name," in your inbox.",(null==i?void 0:i.is_subscribed)?(0,r.BX)(r.HY,{children:[" ","You can manage your subscription in your"," ",(0,r.tZ)("a",{className:K.accountLink,href:(0,P.mGw)(t),native:!0,children:"account settings"}),"."]}):""]})]}),(!i||!i.is_subscribed)&&(0,r.tZ)(j.zx,{priority:"primary",href:(0,P.W1P)(t,{addBase:!0,utm_source:V.b3.newsletterPage}),localNavigation:!1,children:"Subscribe"})]}),(0,r.tZ)(H.iz,{}),(0,r.tZ)("div",{className:K.newsletterList,children:(0,r.tZ)(R,{newsletters:d,hideLinks:!1,justifyItems:"start"})})]})})})}},56219:function(e,t,i){i.d(t,{Rs:()=>eY,SO:()=>eD,_q:()=>eH,a7:()=>eK,eu:()=>eU,lO:()=>eF,mV:()=>eW,nM:()=>ej,sY:()=>eJ,xw:()=>eO});var n=i(27412),o=i(7409),r=i(99282),l=i(58865),a=i(16584),s=i(6400),d=i(30396),c=i(94184),u=i.n(c);i(39693),i(85564),i(7739),i(93220);var p=i(59543),h=i(80569),m=i.n(h),g=i(60826),v=i(7464),f=i(84844),b=i(16564),_=i(9573),y=i(89074),Z=i(59708),w=i(92828),k=i(75021),C=i(18787),S=i(90311),x=i(17350),B=i(16944),P=i(94442),I=i(3862),N=i(21316),T=i(85685),E=i(11712),L=i(94594),X=i(51014),M=i(33665),R=i(90156),F=i(72392),U=i(16506),O=i(89276),A=i(25956),D=i(79160),z=i(70522),j=i(58319),H=i(57391),W=i(37168),q=i(95441),Y=i(30372),V=i(56629),K=i(68833),J=i(48980),G=i(49762),Q=i(27036),$=i(98914),ee=i(29927),et=i(15771),ei=i(61254),en=i(19081),eo=i(1844),er=i(58175),el=i(70379),ea=i(71460),es=i(23776),ed=i(57641);i(98012);var ec=i(24791),eu=i(6070),ep=i(67914),eh=i(60308),em=i(26111),eg=i(63651),ev=i(81821),ef=i(84864),eb=i(47929),e_=i(59961);function ey(){let e=(0,l._)(["The full video is for subscribers in the "," plan"]);return ey=function(){return e},e}function eZ(){let e=(0,l._)(["The full video is for subscribers in the Founding Member plan"]);return eZ=function(){return e},e}function ew(){let e=(0,l._)(["The full video is for paid subscribers"]);return ew=function(){return e},e}function ek(){let e=(0,l._)(["This email is for subscribers in the "," plan"]);return ek=function(){return e},e}function eC(){let e=(0,l._)(["This email is for subscribers in the Founding Member plan"]);return eC=function(){return e},e}function eS(){let e=(0,l._)(["This email is for paid subscribers"]);return eS=function(){return e},e}function ex(){let e=(0,l._)(["Continue reading this post for free, courtesy of ","."]);return ex=function(){return e},e}function eB(){let e=(0,l._)(["This post is for subscribers in the "," plan"]);return eB=function(){return e},e}function eP(){let e=(0,l._)(["This post is for subscribers in the Founding Member plan"]);return eP=function(){return e},e}function eI(){let e=(0,l._)(["This post is for paid subscribers"]);return eI=function(){return e},e}function eN(){let e=(0,l._)(["Subscribe to "," to continue reading"]);return eN=function(){return e},e}function eT(){let e=(0,l._)(["Visit the author’s Substack to subscribe and read more."]);return eT=function(){return e},e}function eE(){let e=(0,l._)(["Visit ",""]);return eE=function(){return e},e}function eL(){let e=(0,l._)(["Support ",""]);return eL=function(){return e},e}function eX(){let e=(0,l._)(["Subscribe to ",""]);return eX=function(){return e},e}function eM(){let e=(0,l._)(["By ",""]);return eM=function(){return e},e}function eR(){let e=(0,l._)(["Subscribe to ",""]);return eR=function(){return e},e}let eF="focus-comment-input",eU=(e,t)=>!!e&&!e.invite_only&&!!t&&t.has_publication&&!t.is_admin&&!t.is_contributor&&!t.is_public_admin&&(0,Q.P)(t,e),eO=(e,t,i,n)=>"enabled"===e.payments_state?!(null==t?void 0:t.is_subscribed):(null==t?void 0:t.is_free_subscribed)&&"disabled"===e.payments_state&&!e.invite_only?!n&&i&&!(null==t?void 0:t.is_pledged):!(null==t?void 0:t.is_free_subscribed);class eA extends s.Component{async loadReactors(){let e=await m().get("/api/v1/post/".concat(this.props.post.id,"/facepile"));this.setState({reactors:e.body.reactors,restackers:e.body.restackers})}async componentDidMount(){var e;this.props.paywall&&!this.props.postPreview&&(0,K.j)(K.FP.POST_PAYWALL_SHOWN,{post_id:this.props.post.id,post_audience:this.props.post.audience,post_type:this.props.post.type,user:this.props.user}),this._triggerShare=()=>this.triggerShare(),null===(e=this.containerRef.current)||void 0===e||e.addEventListener("share-post",this._triggerShare),this.props.post&&this.loadReactors(),.001>Math.random()&&(0,K.K8)({post:this.props.post});let t=(0,em.x)("subscribe_prompt");t&&("paid"===t?this.props.popToast(e=>(0,a.tZ)(el.FN,(0,r._)((0,o._)({},e),{text:"Subscription purchased for ".concat(this.props.pub.name)}))):this.props.popToast(e=>(0,a.tZ)(el.FN,(0,r._)((0,o._)({},e),{text:"Subscribed to ".concat(this.props.pub.name)})))),this.setPostPromptState()}componentWillUnmount(){if(this._triggerShare){var e;null===(e=this.containerRef.current)||void 0===e||e.removeEventListener("share-post",this._triggerShare)}this.props.stopInterval&&this.props.stopInterval()}isGiftPostEligible(){var e,t;let{getSettingFor:i,post:n,pub:o,referringUser:r,user:l}=this.props;return i("paywall_unlock_tokens")&&"only_paid"===n.audience&&n.teaser_post_eligible&&(!l||!l.is_subscribed)&&(0,ev.tq)({checkFirst4:!0})&&(null==r?void 0:null===(t=r.subscriptions)||void 0===t?void 0:null===(e=t.find(e=>e.publication_id===o.id))||void 0===e?void 0:e.membership_state)==="subscribed"}async setPostPromptState(){var e;let{post:t,disableSubscribePrompt:i,readerIsSearchCrawler:n,pub:o,user:r,readerInstalledAt:l,referringUser:a,forceFollowPrompt:s}=this.props,d="newsletter"===t.type&&!0===this.props.getSettingFor("enable_post_page_conversion")&&!i&&!(0,$.AE)()&&!n,c=!1;if(null===(e=document)||void 0===e?void 0:e.referrer)try{let e=new URL(document.referrer);c=!!e.hostname.match(/(^|\.)substack\.com$/)||e.hostname===window.location.hostname}catch(e){}let u=!1,p=this.props.skipFollowPrompt;this.isGiftPostEligible()&&["treatment_more_gifty","treatment_popover_gifty"].includes(this.context.getExperimentVariant("gift_post_unlocks_recipient_2"))&&(u=!0,p=!0);let h=!1;if(s)h=!0;else if(!ef.PUB_IDS_TO_NOT_SHOW_FOLLOW_PROMPT_ON.includes(o.id)&&!p&&d&&a&&a.name&&a.id!==(null==r?void 0:r.id)&&o.author_id!==a.id&&o.contributors.every(e=>e.user_id!==a.id)){let e=[];if(r)try{e=await (0,J.rd)("/api/v1/feed/following")}catch(e){console.warn("Failed to fetch following state",e)}h=!e.includes(a.id)}let m=d&&!u&&!h&&!this.props.paywall&&!this.props.freeSignup&&!r,g=!u&&!["video","podcast"].includes(t.type)&&!n&&(0,ev.tq)({checkFirst4:!0})&&!l&&!c,v=!1;g&&!m&&(this.context.exposeExperiment("app_install_prompts"),"drawer"===this.context.getExperimentVariant("app_install_prompts")&&(v=!0,h=!1)),this.setState({shouldShowGiftPostPrompt:u,shouldShowFollowPrompt:h,shouldShowSubscribePrompt:m,appUpsellEligible:g,mountAppUpsellFooter:v})}triggerShare(){var e,t;let{fromEmail:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i?null===(e=this.shareDialogRef.current)||void 0===e||e.fromEmail():null===(t=this.shareDialogRef.current)||void 0===t||t.open()}onBottomReached(e){this.state.bottomReached||this.props.postPreview||(this.setState({bottomReached:!0}),(0,K.xG)({post:this.props.post,hasPaywall:e,surface:"publication",trackerUuid:this.props.getCurrentUuid()}))}shouldShowUFI(){let{fromPostPage:e,user:t,pub:i,getSettingFor:n}=this.props,{canShowSubscribeFooterAfterPost:o}=this.state;return!!e&&!!o&&eO(i,t,!!n("payment_pledges_enabled"),this.shouldShowRecommendCta)}shouldTrackPaywallPostSeen(){if("undefined"==typeof window)return!1;let e=document.createElement("div"),t=this.props.post.body_html;e.innerHTML=t;let i=this.props.pub.post_preview_limit||ef.DEFAULT_PREVIEW_LIMIT,n="",o=!1;for(let t=e.childNodes.length-1;t>=0;t--){let r=e.childNodes[t];if(r&&(n+=r.textContent).length>i){o=!0;break}}return o}render(e,t){var i,n,l,s,d,c,h;let m,{user:g,pub:f,post:_,freeSignup:B,freeSignupEmail:I,isServingFreePodcastUrl:N,isShowsPost:T,isTheFreePressTheme:M,reaction_token:A,invisible:z,paywall:H,onChange:W,hideTitle:q,noTitleLink:Y,showComments:V,fromPostPage:J,freeTrialCoupon:Q,showRestackModal:$,stripe_publishable_key:ee,crossPostInfo:ei,iString:eo,iTemplate:er,themeVariables:ea,referringUser:ed,renderComments:ep,renderContent:eh,getSettingFor:em,startInterval:ef,forceFollowPrompt:eb}=e,{showTranscription:e_,truncated:eN,autoPlayVoiceOver:eT,reactors:eE,restackers:eL,shouldShowFollowPrompt:eX,shouldShowSubscribePrompt:eM,shouldShowGiftPostPrompt:eR,appUpsellEligible:eF,mountAppUpsellFooter:eU}=t;if(_.is_geoblocked)return(0,a.tZ)(eG,{});let eO=!!this.context.getConfigFor("like_posts_enabled"),eA=(0,Z.N1)(null!==(s=eN||_.body_html)&&void 0!==s?s:""),eD=!H||H&&this.shouldTrackPaywallPostSeen();ef&&eD&&ef({postId:this.props.post.id,containerElementRef:this.containerRef,elementIsStatic:!0});let eH="video"===_.type&&!H&&(null===(i=_.videoUpload)||void 0===i?void 0:i.transcription),eY=this.shouldShowUFI()&&!(0,eu.HD)({pub:f}),eJ=eK(_),eQ=!!eE&&eE.length>0,e$=!!(em("paywall_unlock_tokens")&&"only_paid"===_.audience&&_.teaser_post_eligible),e0=e$&&!(null==g?void 0:g.is_subscribed)&&((null==g?void 0:g.is_free_subscribed)||B)&&!(null==g?void 0:g.has_redeemed_post_unlock_token),e1=(0,ev.tq)({checkFirst4:!0});e$&&this.isGiftPostEligible()&&(this.context.exposeExperiment("gift_post_unlocks_recipient_2"),["treatment_more_gifty","treatment_popover_gifty"].includes(this.context.getExperimentVariant("gift_post_unlocks_recipient_2"))&&(e0=!0,m=this.context.getExperimentVariant("gift_post_unlocks_recipient_2")));let e4="";e4="video"===_.type?"founding"===_.audience&&(0,ec.H$)(f)?er(ey(),null!==(d=(0,ec.H$)(f))&&void 0!==d?d:""):er("founding"===_.audience?eZ():ew()):"adhoc_email"===_.type?"founding"===_.audience&&(0,ec.H$)(f)?er(ek(),null!==(c=(0,ec.H$)(f))&&void 0!==c?c:""):er("founding"===_.audience?eC():eS()):e0?e1?eo("Continue reading this post for free in the Substack app"):er(ex(),f.author_name||f.name):"founding"===_.audience&&(0,ec.H$)(f)?er(eB(),null!==(h=(0,ec.H$)(f))&&void 0!==h?h:""):er("founding"===_.audience?eP():eI());let e2=(0,a.BX)(O.j,{disabled:!M,post:_,isShowsPost:T,children:[(0,a.tZ)("div",{className:"available-content",children:e_?(0,a.tZ)("div",{className:"container tw-py-12",children:(0,a.tZ)(es.Z,{post:_,pub:f,user:g,playerRef:this.videoPlayer})}):(0,a.tZ)(E.Z,{html:eN||_.body_html||null,pub:f,trackSelection:!0,post:_,themeVariables:ea,canRestackImage:this.context.getConfigFor("restack_with_image"),user:g,freeSignup:B,freeSignupEmail:I,paywall:H,showing_behind_paywall:!!_.post_paywall_content_for_google})}),_.post_paywall_content_for_google&&(0,a.tZ)("div",{className:"paywall-content",children:(0,a.tZ)(E.Z,{html:_.post_paywall_content_for_google,pub:f,trackSelection:!1,post:_,user:g,freeSignup:B,freeSignupEmail:I,paywall:H})}),!z&&eD&&(0,a.tZ)(j.Z,{onVisible:()=>this.onBottomReached(!!H)})]}),e8=(0,eu.HD)({pub:f}),e3=(0,eu.kb)({pub:f}),e6=e8?(0,a.tZ)(U.Z,{post:_,user:g,pub:f,freeSignupEmail:I}):(0,a.tZ)(C.f1,(0,o._)({user:g,freeSignupEmail:I,freeSignup:B,publication:f,post:_,coupon:!0===this.props.paywall&&this.props.pub.paywall_free_trial_enabled?Q:null,showPostUnlockPrompt:!!e0,magicToken:A,giftingUser:ed,treatmentVariantForGiftPostPaywall:m,onPostUnlockError:()=>this.props.popToast(e=>(0,a.tZ)(el.FN,(0,r._)((0,o._)({},e),{text:eo("Teaser posts are not currently available for this content")})))},Object.assign({title:e4,reauthenticationTitle:eo("To read this, please re-authenticate.")},H)));return(0,a.BX)("article",{className:u()("typography ".concat(_.type,"-post post"),{"tw-p-0":"podcast"===_.type,"shows-post":T,"full-width-image-header":(null===(n=_.postTheme)||void 0===n?void 0:n.header_variant)==="full-width-image"}),ref:this.containerRef,children:[(null==g?void 0:g.is_contributor)&&(null==_?void 0:_.id)&&(null==_?void 0:_.type)==="page"&&(0,a.tZ)(et.zx,{priority:"secondary",href:(0,eg.ANx)(f,_.id,{params:{back:document.location.href}}),localNavigation:!1,leading:(0,a.tZ)(p.Z,{size:20}),children:eo("Edit")}),(0,a.tZ)(eV,{post:_,user:g,onChange:W}),(0,a.tZ)(X.ZP,{ref:this.shareDialogRef,user:g,pub:f,post:_,reaction_token:A,source:"email-share"}),eR&&(0,a.tZ)(k.f,{user:g,post:_,pub:f,referringUser:ed,freeSignupEmail:I,variant:this.context.getExperimentVariant("gift_post_unlocks_recipient_2")}),eX&&(0,a.tZ)(w.yi,{pub:f,post:_,referringUser:ed,freeSignupEmail:I,forceFollowPrompt:eb,surface:"post-follow-referrer-prompt"}),eM&&(0,a.tZ)(R.H,{pub:f,post:_,stripe_publishable_key:ee,sharer:ed,appUpsellEligible:!!eF}),eU&&(0,a.tZ)(v.m,{pub:f,slug:_.slug}),eh?(0,a.BX)(a.HY,{children:[!z&&(0,a.tZ)(j.Z,{onVisible:()=>{this.onTopReached(!!H)}}),eh({comments:ep?ep():null,crossPostInfo:ei,postContent:(0,a.BX)(a.HY,{children:[e2,!!(H&&!_.post_paywall_content_for_google&&!N)&&e6]})})]}):(0,a.BX)(a.HY,{children:[(0,a.tZ)(eW,{user:null!=g?g:null,pub:f,post:_,isOnPostPage:!0,reaction_token:A,allowEdit:!0,showShare:!0,showSubtitle:!0,showPhoto:!0,showCommentRestack:!f.hide_post_restacks,hideTitle:!!q,noTitleLink:!!Y,onChange:W,hideDate:"page"===_.type,hideAudience:"page"===_.type,showReactions:eO,showComments:!!V,showLabel:!0,showUpdatedIcons:!0,fromPostPage:!!J,onClickCommentButton:this.onCommentButtonClicked,reactors:eE,showRestackModal:!!$,showTranscriptionButton:!!eH,onTranscriptionClick:this.onTranscriptionClick,autoPlayVoiceOver:eT}),!z&&eD&&(0,a.tZ)(j.Z,{onVisible:()=>this.onTopReached(!!H)}),(_.has_voiceover||!!_.voiceoverUpload)&&!M&&(0,a.tZ)(b.KH,{pub:f,post:_,mediaUploadId:_.voiceover_upload_id,duration:null===(l=_.voiceoverUpload)||void 0===l?void 0:l.duration,autoPlay:eT,href:_.canonical_url,isPaywalled:!_.voiceover_upload_id}),!_.voiceoverUpload&&eT&&eJ&&(0,a.tZ)(D.r,{postId:_.id,onClose:()=>{(0,K.j)(K.FP.LISTEN_TO_THIS_POST_MODAL_DISMISSED,{post_id:_.id}),this.setState({autoPlayVoiceOver:!1})}}),ei?(0,a.tZ)(y.F,{postType:_.type,crossPostInfo:ei}):null,(0,a.BX)("div",{children:[eA&&(0,a.tZ)(F.o,{toc:eA,position:"fixed"}),e2,H&&!_.post_paywall_content_for_google?(0,a.BX)(a.HY,{children:[e6,(0,a.tZ)(x.i,{post:_})]}):eN?(0,a.tZ)("p",{children:(0,a.BX)(et.zx,{className:"expander",onClick:()=>this.setState({truncated:null}),children:["+ ",eo("show full post")]})}):!["page"].includes(null==_?void 0:_.type)&&(0,a.BX)(a.HY,{children:[eY&&(0,a.tZ)(ej,{pub:f,post:_,user:g,freeSignup:!!B,freeSignupEmail:I}),!eY&&this.shouldShowRecommendCta&&(0,a.tZ)(L.o,{pub:f}),ei&&("only_paid"===_.audience||"founding"===_.audience)&&(0,a.tZ)(ez,{pub:f}),(0,G.default)("like_posts_enabled")&&f.community_enabled&&eQ&&!M&&(0,a.tZ)(en.X2,{borderTop:"detail-themed",paddingY:16,children:(0,a.tZ)(S.fB,{post:_,pub:f,user:g,reactors:eE,secondaryFaces:eL})}),!M&&(0,a.tZ)("div",{className:"post-footer",children:(0,a.tZ)(P.Mp,{post:_,pub:f,user:g,onChange:W,postReactionToken:A})}),(0,a.tZ)(x.i,{post:_})]}),_.show_guest_bios&&"podcast"!==_.type&&!e8&&!e3&&(0,a.tZ)(eq,{user:g,pub:f,post:_})]})]})]})}constructor(e,t){var i,o;super(e,t),(0,n._)(this,"containerRef",void 0),(0,n._)(this,"shareDialogRef",void 0),(0,n._)(this,"podcastCommentInput",void 0),(0,n._)(this,"podcastPlayer",void 0),(0,n._)(this,"videoPlayer",void 0),(0,n._)(this,"shouldShowRecommendCta",void 0),(0,n._)(this,"_triggerShare",void 0),(0,n._)(this,"onTopReached",e=>{this.state.topReached||this.props.postPreview||(this.setState({topReached:!0}),(0,K.jJ)({post:this.props.post,hasPaywall:e,surface:"publication",markRead:!!this.props.user&&!this.props.noPageView,user:this.props.user,trackerUuid:this.props.getCurrentUuid()}))}),(0,n._)(this,"onTranscriptionClick",()=>{this.setState(e=>({showTranscription:!e.showTranscription}))}),(0,n._)(this,"onCommentButtonClicked",e=>{this.props.showComments&&!this.props.post.comment_count&&(e.stopPropagation(),e.preventDefault(),document.dispatchEvent(new CustomEvent(eF)))});let r={showTranscription:!1,autoPlay:!1,autoPlayVoiceOver:!1,commentSort:null!==(o=e.post.default_comment_sort)&&void 0!==o?o:"best_first",loadedWithHeaderLink:"undefined"!=typeof window&&(null===(i=window.location.hash)||void 0===i?void 0:i.startsWith("#".concat(encodeURIComponent("\xa7")))),reactors:null,feedUrl:null,shouldShowSubscribePrompt:!1,shouldShowFollowPrompt:!1};e.paywall||e.post.hidden||!e.post.body_html||(r.canShowSubscribeFooterAfterPost=eY(e.post.body_html),r.truncated=e.truncateAt?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;if("undefined"==typeof window)return null;let n=document.createElement("div");if(n.innerHTML=e,null===n.textContent||n.textContent.length1&&n.textContent.length>i);return n.innerHTML}(e.post.body_html,e.truncateAt,e.truncateTo):null),"undefined"!=typeof window&&window.history.replaceState&&("true"===(0,em.x)("autoPlay")&&(window.history.replaceState({},document.title,(0,eh.rhs)({autoPlay:null})),r.autoPlay=!0),"true"===(0,em.x)("play_audio")&&(window.history.replaceState({},document.title,(0,eh.rhs)({play_audio:null})),r.autoPlayVoiceOver=!0)),this.state=r,this.containerRef=(0,s.createRef)(),this.shareDialogRef=(0,s.createRef)(),this.podcastCommentInput=(0,s.createRef)(),this.podcastPlayer=(0,s.createRef)(),this.videoPlayer=(0,s.createRef)(),this.shouldShowRecommendCta=eU(e.pub,e.user)}}(0,n._)(eA,"contextType",W.WH),(0,n._)(eA,"displayName","Post");let eD=(0,el.dd)((0,H.f9)((0,V.us)((0,q.fz)((0,Y.aG)(eA))))),ez=e=>{let{pub:t}=e,{iTemplate:i}=(0,q.M1)();return(0,a.BX)(a.HY,{children:[(0,a.tZ)(ei.iz,{paddingTop:16}),(0,a.BX)(en.sg,{gap:16,paddingY:32,alignItems:"center",children:[(0,a.BX)(en.sg,{gap:8,paddingBottom:8,children:[(0,a.tZ)(er.xv.H4,{flex:"grow",align:"center",children:i(eN(),t.name)}),(0,a.tZ)(er.xv.B3,{flex:"grow",align:"center",color:"secondary",children:i(eT())})]}),(0,a.tZ)(et.zx,{priority:"primary",onClick:()=>{(0,K.j)(K.FP.POST_END_CTA_CLICKED,{type:"cross-post"}),(0,$.uX)((0,eg.W1P)(t,{params:{utm_source:eb.b3.postEndCta,addBase:!0}}),{local_navigation:!1})},children:i(eE(),t.name)})]})]})},ej=e=>{let{pub:t,post:i,user:n,freeSignup:o,freeSignupEmail:r,overridePledgesEnabled:l}=e,{iString:s,iTemplate:c}=(0,q.M1)(),{getSettingFor:u}=(0,V.So)(),[p,h]=(0,d.eJ)(null),m=(0,em.x)("just_subscribed"),g="disabled"===t.payments_state&&!t.invite_only&&(u("payment_pledges_enabled")||l),v="enabled"===t.payments_state&&(null==n?void 0:n.is_free_subscribed)&&!(null==n?void 0:n.is_subscribed)?"paid_upsell":g&&(null==n?void 0:n.is_free_subscribed)&&!(null==n?void 0:n.is_pledged)?"pledge_upsell":"free_upsell",f=g&&(null==n?void 0:n.is_free_subscribed)&&!(null==n?void 0:n.is_pledged);(0,d.d4)(()=>{(0,K.j)(K.FP.POST_END_CTA_RENDERED,{pub_id:t.id,post_id:i.id,type:v})},[t.id,i.id,v,f,null==n?void 0:n.is_free_subscribed]);let b=(0,ef.getByLine)(t);return(0,a.BX)(a.HY,{children:[(0,a.tZ)(ei.iz,{paddingTop:16}),(0,a.tZ)(j.Z,{onVisible:()=>{(0,K.j)(K.FP.POST_END_CTA_SEEN,{pub_id:t.id,post_id:i.id,type:v})}}),(0,a.BX)(en.sg,{gap:16,paddingY:32,children:[(0,a.BX)(en.sg,{gap:8,paddingBottom:8,children:[(0,a.tZ)(er.xv.H4,{flex:"grow",align:"center",children:c(g&&(null==n?void 0:n.is_free_subscribed)?eL():eX(),t.name)}),(0,a.BX)(er.xv.B3,{flex:"grow",align:"center",color:"secondary",children:[b?c(eM(),b):null,b&&t.rankingDetail?" \xb7 ":null,t.rankingDetail]}),t.hero_text&&(0,a.tZ)(er.xv.B3,{color:"primary",flex:"grow",align:"center",children:t.hero_text})]}),(0,a.tZ)(en.sg,{alignItems:"center",gap:16,children:f?(0,a.tZ)(et.zx,{priority:"primary",onClick:()=>{(0,K.j)(K.FP.POST_END_CTA_CLICKED,{type:"pledge"}),(0,$.uX)((0,eg.W1P)(t,{params:{utm_source:eb.b3.postEndCta}}),{local_navigation:!1})},children:s("Pledge your support")}):(0,a.BX)(a.HY,{children:[(0,a.tZ)(M.Z,{pub:t,post:i,user:n,freeSignup:o,freeSignupEmail:r,isStatic:!1,onPrepareData:()=>{h(null)},source:"post-end-cta",className:e_.Z.subscribeWidget}),p&&(0,a.tZ)(eo.y,{align:"center",children:p}),!(null==n?void 0:n.is_free_subscribed)&&!m&&(0,a.tZ)(en.sg,{maxWidth:400,children:(0,a.tZ)(ed.O,{includeCheckbox:!1,addSubscribePreamble:!0,color:"secondary",textAlign:"center"})})]})})]})]})},eH=e=>{let{pub:t}=e;return(0,a.BX)("div",{className:"post-silhouette",children:[(0,a.tZ)("div",{className:"post-silhouette-title"}),(0,a.tZ)("div",{className:"post-silhouette-meta ".concat(t&&t.bylines_enabled&&t.byline_images_enabled?"with-byline-image":"")}),(0,a.tZ)("div",{className:"post-silhouette-body"})]})},eW=e=>{var t,i,n,o;let r,{allowEdit:l,allowSendEmail:s,allowTruncate:d,base_url:c,children:p,className:h,hideAudience:m,hideDate:v,hideTitle:b,hidePinning:y,noTitleLink:Z,isStatic:w,isFreePreview:k,is_draft:C,onChange:x,post:T,pub:E,reaction_token:L,showComments:X,showDatetime:M,showEmailSent:R,showReactions:F,showShare:U,showAppUpsell:O,showSubtitle:D,showPhoto:z,showLabel:j,showRestack:H,showCommentRestack:W,hideAuthor:Y,user:V,utm_source:K,showUpdatedIcons:J,fromPostPage:G,onClickCommentButton:Q,reactors:$,inThreadHead:ee,publishedPost:et,compEndsSoon:ei,compEndedRecently:eo,siteConfigValues:el={},eligibleForTTS:ea,showRestackModal:es,showIcon:ed,isOnPostPage:ec,showTranscriptionButton:eh,onTranscriptionClick:em,isAppMode:e_=!1,republishingPost:ey,autoPlayVoiceOver:eZ=!1}=e,{iString:ew}=(0,q.M1)(),ek=(0,ev.tq)({checkFirst4:!0}),eC=ey||T,eS="number"==typeof d?d:45,ex=T.title&&T.title.length>eS,eB=C?T.draft_title:T.title,eP=[(ed||"thread"===T.type)&&(0,a.tZ)(N.m,{postType:T.type,isStatic:w,height:15,className:T.type}),ex&&d?(0,ef.truncateWords)(eB,eS):eB],eI=C?T.draft_subtitle:T.subtitle;T.section_id&&E.sections&&E.sections.length&&(T.section=E.sections.find(e=>e.id===T.section_id));let eN=(0,ep.B9)({pub:E,subscriptionType:null==V?void 0:V.subscription_type}),eT=!["page"].includes(null==T?void 0:T.type),eE=eT&&w&&ei&&!eN&&(null==el?void 0:el.continue_support_cta_in_newsletter_emails),eL=eK(T)||ea||T.voiceoverUpload,eX=(null==T?void 0:T.type)==="adhoc_email",eM=eT&&w&&!eX&&!e_,eR=(0,eu.HD)({pub:E})&&(!!T.postTheme||["video","podcast"].includes(T.type)&&ee);r=T.post_url_override?T.post_url_override:w&&e_?g.W.POST_TITLE_APP_MODE_URL:w?g.W.POST_TITLE_URL:"".concat((0,eg.uRy)(E,T)).concat(K?"?utm_source=".concat(K):"");let eF="".concat(E.base_url+(eC.section?(0,eg.Ucy)(E,{section:eC.section}):""),"/?utm_source=").concat(eb.b3.substack,"&utm_medium=").concat(eb.lP.menu);return eR?(0,a.tZ)(A.I,{post:T,postTheme:T.postTheme,title:eB,subtitle:eI,pub:E,inThreadHead:!!ee,autoPlayVoiceOver:eZ}):(0,a.BX)("div",{className:u()("post-header",h),role:"region","aria-label":ew("Post header"),children:[(0,eu.kb)({pub:E})&&(null!==(o=null===(t=T.postTags)||void 0===t?void 0:t.length)&&void 0!==o?o:0)>0&&(0,a.tZ)(en.X2,{alignItems:"center",gap:4,paddingBottom:8,children:null===(i=T.postTags)||void 0===i?void 0:i.map((e,t)=>(0,a.BX)(a.HY,{children:[0!==t&&(0,a.tZ)(er.xv.Meta,{children:"—"}),(0,a.tZ)(er.xv.Meta,{as:"a",size:14,href:(0,eg.Mk9)(E,e),children:e.name})]}))}),j&&T.section&&(0,a.tZ)(en.X2,{className:"post-label",children:(0,a.tZ)(er.xv.Meta,{as:"a",size:14,href:eF,children:null===(n=eC.section)||void 0===n?void 0:n.name})}),eE&&(0,a.tZ)(_.v,{post:T,compAlreadyExpired:eo}),!b&&(0,a.tZ)("h1",{className:u()("post-title",T.is_published?"published":"restack"!==T.type||ey?"adhoc_email"===T.type?"adhoc":"unpublished":"email-only-cross-post",{"post-title--the-pillar":(0,eu.kb)({pub:E})}),children:Z?eP:(0,a.tZ)("a",{href:r,children:eP})}),D&&eI&&(0,a.tZ)("h3",{className:u()("subtitle",{"subtitle--the-pillar":(0,eu.kb)({pub:E})}),children:eI}),"page"===T.type?(0,a.tZ)("div",{style:{height:32}}):ec&&!w?(0,a.BX)(en.sg,{paddingBottom:16,"aria-label":ew("Post UFI"),role:"region",children:[(0,a.tZ)(en.sg,{paddingY:16,children:(0,a.tZ)(I.E,{post:T,pub:E})}),(0,a.tZ)(f.j,{user:V,isMobile:ek,post:T}),ek?G&&(0,a.tZ)(P.mt,{post:T,pub:E,user:V,isStatic:!!w,postReactionToken:L,onChange:x,allowEdit:l,hidePinning:y,showEmailSent:R,allowSendEmail:s,hideComments:!X,onCommentsClick:Q,showRestackModal:es}):(0,a.tZ)(P.Mp,{post:T,pub:E,user:V,onChange:x,showRestackModal:es,showTranscriptionButton:eh,onTranscriptionClick:em,showClipping:"video"===T.type,postReactionToken:L})]}):(0,a.BX)(a.HY,{children:[!eT||w||et||ee?eT&&!w&&et?(0,a.tZ)(P._2,{post:T,pub:E,user:V,style:"compressed",labelStyle:"counts-or-none",postReactionToken:L,showEmailSent:R,hideShare:!U||"restack"===T.type,hideComments:"restack"===T.type,hideSavePost:"restack"===T.type,hideReactions:"restack"===T.type,showPreamble:!0,onChange:void 0,allowEdit:l,allowSendEmail:s,editButtonIsLast:!0,preambleConfig:{showAudience:!m,showDate:!v,showDatetime:M,showAuthor:!Y},isStatic:w,position:"publisher-post-list"}):ee&&!w?(0,a.tZ)(P._2,{post:T,pub:E,user:V,style:"compressed",labelStyle:"counts-or-none",postReactionToken:L,hideSavePost:!0,showPreamble:!0,allowEdit:l,allowSendEmail:s,editButtonIsLast:!0,onChange:x,preambleConfig:{showAudience:!m,showDate:!v,showDatetime:M,showAuthor:!Y},hideShare:!U,position:"publisher-post-list",isStatic:w}):eT?(0,a.tZ)(S.SP,{user:V,pub:E,post:T,showDate:!v,showDatetime:M,showEmailSent:R,showAudience:!m,showReactions:!eM&&F,showComments:!eM&&X,showShare:!eM&&U,showRestack:!eM&&H,reaction_token:L,onChange:x,isStatic:w,isFreePreview:k,sharedShareDialog:!0,base_url:c,allowSendEmail:s,allowEdit:l,showAuthor:!Y,showPhoto:z,hidePinning:y,showUpdatedIcons:J,inThreadHead:ee,fromPostPage:G,onClickCommentButton:Q,reactors:$,isAppMode:e_}):(0,a.tZ)("div",{className:"spacer",style:{height:24}}):(0,a.tZ)(B.a,{className:"meta-subheader",pub:E,post:T,user:V,showDate:!v,showDatetime:!!M,isStatic:!!w,postReactionToken:L,onChange:x,allowEdit:l,hidePinning:y,showEmailSent:R,allowSendEmail:s,allowMobileFooter:G,onCommentsClick:Q,showRestackModal:es}),eT&&eM&&(0,a.tZ)(P.yT,{customization:{showShare:U,showComments:X,showReactions:F,showListen:!H&&!k&&!!eL,showSave:!H,showRestack:H,showCommentRestack:W,showAppUpsell:O}}),eX&&(0,a.tZ)("div",{className:"email-ufi-2-empty"})]}),p]})},eq=e=>{let{user:t,pub:i,post:n}=e,{iString:o,iTemplate:r}=(0,q.M1)(),l=(0,ef.getBylineUsers)(n).filter(e=>e.is_guest);return 0===l.length?null:(0,a.BX)("div",{className:"post-contributor-footer",children:[(0,a.tZ)("div",{className:"container-border"}),l.map(e=>{let n=(0,ef.guessFirstName)(e.name),l=e.primaryPublicationSubscribeUrl;l&&(null==t?void 0:t.email)&&(l=(0,eh.rhs)(l,{email:t.email,autoSubmit:!0,utm_source:eb.b3.substack,utm_campaign:eb.VX.guestPostBio,utm_medium:eb.lP.web}));let s=(0,eh.rhs)((0,eg.NNq)(e),{utm_campaign:eb.VX.guestPostBio,utm_medium:eb.lP.web}),d=z.ZP.hasCustomProfilePhoto(e);return(0,a.tZ)("div",{className:u()("post-contributor-bio",{"post-contributor-bio-no-text":!e.bio}),"data-user-id":e.id,children:(0,a.tZ)("table",{cellpadding:"0",cellspacing:"0",className:"post-contributor-bio-table",children:(0,a.BX)("tr",{className:"post-contributor-bio-table-row",children:[d&&(0,a.tZ)("td",{className:"post-contributor-bio-userhead-cell post-contributor-bio-userhead-cell-web",children:(0,a.tZ)(T.ProfileHoverCard,{subject:e,utmSource:"byline",children:(0,a.tZ)(z.ZP,{size:52,user:t,pub:i,subject:e})})}),(0,a.tZ)("td",{className:"post-contributor-bio-body-cell post-contributor-bio-body-cell-web",children:(0,a.BX)("div",{className:"post-contributor-bio-body",children:[e.bio&&(0,a.tZ)("div",{className:"post-contributor-bio-preamble",children:o("A guest post by")}),(0,a.tZ)("table",{cellpadding:"0",cellspacing:"0",className:"post-contributor-bio-body-table",children:(0,a.BX)("tr",{className:"post-contributor-bio-body-table-row",children:[(0,a.BX)("td",{className:"post-contributor-bio-copy-cell",children:[!e.bio&&(0,a.tZ)("div",{className:"post-contributor-bio-preamble",children:o("A guest post by")}),(0,a.BX)(en.X2,{gap:4,alignItems:"center",paddingBottom:4,children:[(0,a.tZ)(T.ProfileHoverCard,{subject:e,utmSource:"byline",children:(0,a.tZ)("a",{className:"post-contributor-bio-title no-margin",href:s,native:!0,children:e.name})}),(0,a.tZ)(ea.UserBadge,{size:"sm",tier:e.bestseller_tier,userId:e.id})]}),e.bio&&(0,a.tZ)("div",{className:"post-contributor-bio-text",children:e.bio})]}),(0,a.tZ)("td",{className:"post-contributor-bio-controls-cell post-contributor-bio-controls-cell-web",children:(0,a.tZ)("div",{className:"post-contributor-bio-controls",children:l&&(0,a.tZ)("a",{className:"post-contributor-bio-subscribe-button button primary",href:l,native:!0,children:(0,a.tZ)("span",{className:"post-contributor-bio-subscribe-button-label",children:r(eR(),n)})})})})]})})]})})]})})})})]})};function eY(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;if("undefined"==typeof window)return!1;let i=document.createElement("div");i.innerHTML=e;let n="",o=!1;for(let e=i.childNodes.length-1;e>=0;e--){let r=i.childNodes[e];if(r){if((0,$.pv)(r,"button-wrapper")||(0,$.pv)(r,"subscription-widget-wrap")||(0,$.pv)(r,"subscribe-widget")){o=!0;break}if((n+=r.textContent).length>t)break}}return!o}function eV(e){let{post:t,user:i,onChange:n}=e,[l,s]=(0,d.eJ)(!1),{getExperimentVariant:c}=(0,H.jc)(),u="treatment"===c("video_email_watch_later_experiment"),{onSave:p}=(0,P.vk)({post:t,isSaved:!1});return((0,d.d4)(()=>{if("save"===new URL(location).searchParams.get("action")&&(history.replaceState({},"",(0,eh.rhs)({action:null})),i)){let e=p();n({post:(0,r._)((0,o._)({},t),{is_saved:e})}),e&&u&&s(!0)}},[]),l)?(0,a.tZ)(ee.X,{onClose:()=>s(!1)}):null}function eK(e){var t;return!!(null===(t=e.audio_items)||void 0===t?void 0:t.some(e=>"tts"===e.type))}function eJ(e){var t;return!!(null===(t=e.audio_items)||void 0===t?void 0:t.some(e=>"tts"===e.type&&"paywalled"===e.status))}let eG=()=>(0,a.tZ)("article",{className:u()("typography post",{"shows-post":!1}),children:(0,a.tZ)("div",{className:"container tw-p-12",children:(0,a.tZ)("p",{align:"center",children:(0,a.tZ)(er.xv,{translated:!0,as:"span",children:"This content has been withheld in your country in response to a legal requirement."})})})})},94442:function(e,t,i){i.d(t,{Cz:()=>e2,Er:()=>e4,F6:()=>e8,Hg:()=>ez,L9:()=>e9,Mp:()=>e7,Ng:()=>e0,PA:()=>eP,RY:()=>e5,RZ:()=>eU,Su:()=>eB,TJ:()=>eW,_2:()=>eN,c1:()=>eq,fh:()=>e3,mt:()=>eE,nA:()=>eH,pD:()=>eJ,sV:()=>eL,vk:()=>ej,yT:()=>te,z5:()=>e1});var n=i(7409),o=i(99282),r=i(58865),l=i(16584),a=i(98661),s=i(30396),d=i(94184),c=i.n(d),u=i(12297),p=i.n(u),h=i(23493),m=i.n(h),g=i(85200),v=i(77951),f=i(95951),b=i(73820),_=i(56687),y=i(65207),Z=i(13808),w=i(18794),k=i(8618),C=i(31131),S=i(67358),x=i(62686),B=i(80569),P=i.n(B),I=i(60826),N=i(7703),T=i(23254),E=i(86790),L=i(39900),X=i(43389),M=i(21286),R=i(25265),F=i(666),U=i(76157),O=i(95398),A=i(91355),D=i(50137),z=i(39929),j=i(16808),H=i(48917),W=i(67203),q=i(85685),Y=i(30329),V=i(2995),K=i(51014),J=i(75778),G=i(95441),Q=i(56629),$=i(40647),ee=i(45261),et=i(60807),ei=i(90099),en=i(68833),eo=i(48980),er=i(7882),el=i(27036),ea=i(98914),es=i(97505),ed=i(15771),ec=i(19081),eu=i(44424),ep=i(6490),eh=i(98248),em=i(58175),eg=i(70379);i(27744);var ev=i(39493),ef=i(91400),eb=i(98012),e_=i(31377),ey=i(79582),eZ=i(60308),ew=i(63651),ek=i(84864),eC=i(67836),eS=i(47929);function ex(){let e=(0,r._)(["Published on ",""]);return ex=function(){return e},e}function eB(e,t){if("button"===e&&"verbose"===t)return 16;if("button"===e)return 20;if("tabs"===e)return 24;if("compressed"===e)return 14;if("large-on-dark"===e)return 20;return 0}let eP=2,eI=e=>{let{isFullWidth:t,children:i}=e;return t?(0,l.tZ)(ec.gq,{className:"post-ufi-button-wrapper",gap:8,children:i}):i};function eN(e){let{post:t,pub:i,user:n,style:o,justified:r,isStatic:a,hideReactions:s,hideComments:d,hideShare:u,hideSavePost:h,useShareLabel:m,allowEdit:v,editButtonIsLast:f,onChange:b,hidePinning:_,showEmailSent:y,allowSendEmail:Z,footerHidden:w,onCommentsClick:k,labelStyle:C,showPreamble:S,preambleConfig:x={},position:B,hideByDisabling:P,showRestackButton:I,showRestackModal:N,showClipping:E,hideFeedRestackButton:L,onToggleMenu:X,postReactionToken:M,initialShareTimestamp:R}=e,F=(0,ee.Tf)(),{showPins:U,showAudience:O,showDate:A,showDatetime:D,showAuthor:z,showPublicationName:j,showCrossPostedPublicationName:H}=x;s=s||!i.community_enabled||!t.slug||t.is_draft;let q=p()(Object.values((null==t?void 0:t.reactions)||{})),Y=y?!!t.email_sent_at:null,V=(0,J.LC)(),{iString:K}=(0,G.M1)(),Q=v&&(null==n?void 0:n.is_contributor)&&!V,et=eT({post:t,pub:i,user:n,defaultOpen:I&&N&&"post-footer"!==B&&"post-footer-full-width"!==B}),{getConfigFor:ei}=(0,$.xR)(),en=n&&(0,l.tZ)(e$,{style:o,pub:i,post:t,user:n,hidePinning:_,emailSent:null!=Y?Y:void 0,allowSendEmail:Z,footerHidden:w,canBeCrossPosted:I,onToggleMenu:X}),eo=!L&&i.community_enabled&&t.slug&&!t.is_draft,er=I&&!S&&(P||s&&d&&u&&!Q),el="counts-or-none"===C&&t.comment_count?"count":"labels"===C?"cta":"none",ea=n&&t.videoUpload&&(0,eC.a)(n,t,t.videoUpload),es="post-footer-full-width"===B;return(0,l.BX)("div",{className:c()("post-ufi","style-".concat(o),{justified:r,themed:F,"single-full-width-button":er,"vertically-stacked":"shows-episode-player"===B}),children:[(0,l.BX)(eI,{isFullWidth:es,children:[S&&x&&(0,l.tZ)(e6,{pub:i,post:t,showPins:U,showAudience:O,showDate:A,showDatetime:D,showEmailSent:y,showAuthor:z,showPublicationName:j,showCrossPostedPublicationName:H}),Q&&!f&&en,E&&t.videoUpload&&!ei("disable_clipping_for_readers")&&(0,l.tZ)(T.OZ,{post:t,mediaUpload:t.videoUpload,disabled:!ea,style:o}),(P||!s)&&(0,l.tZ)(eX,{post:t,pub:i,user:n,labelStyle:P&&s?"none":"counts-or-none"===C&&q?"count":"labels"===C?"cta":"none",style:o,onChange:b,isStatic:!!a,isDisabled:P&&s||"shows-episode-player"===B&&!n,postReactionToken:M}),(P||!d)&&(0,l.tZ)(eK,{post:t,pub:i,isStatic:a,labelStyle:P&&d?"none":el,style:o,count:t.comment_count,onClick:k,isDisabled:P&&d}),eo&&(0,l.tZ)(eR,{pub:i,post:t,onChange:b,style:o,onToggleMenu:X,isStatic:a}),!u&&(0,l.tZ)(W.sp,{post:t,pub:i,user:n,trigger:{style:o,labelStyle:m?"cta":"none",isStatic:a},position:B,initialShareTimestamp:R,showClipping:E&&!!t.videoUpload,disableClipping:!ea})]}),(0,l.BX)(eI,{isFullWidth:es,children:[!h&&!I&&n&&(0,l.tZ)(eY,{post:t,labelStyle:el,position:B,style:o,onChange:b}),Q&&f&&en,I&&!Q&&"post-header"===B&&(0,l.tZ)(l.HY,{children:(0,l.BX)(eu.v2,{trigger:(0,l.tZ)(ed.hU,{"aria-label":K("View repost options"),priority:"secondary-outline",children:(0,l.tZ)(g.Z,{size:20})}),children:[n&&(0,l.tZ)(eQ,{onClick:et.open,post:t,pub:i,user:n}),(0,l.tZ)(eV,{post:t,onChange:b})]})}),I&&!Q&&es&&(0,l.BX)(l.HY,{children:[!h&&(0,l.tZ)(eY,{post:t,labelStyle:"verbose",position:B,style:"button",onChange:b}),n&&(0,l.tZ)(eG,{onClick:et.open,post:t,pub:i,user:n,style:"button"})]})]}),et.modal]})}function eT(e){let{pub:t,user:i,post:n,defaultOpen:o=!1}=e,[r,a]=(0,s.eJ)(o);return(0,s.d4)(()=>{o&&i&&(0,en.j)(en.FP.RESTACK_POST_CLICKED,{restacked_publication_id:t.id,restacked_post_id:n.id,restacking_user_id:i.id,is_from_email:!0})},[o,t,n,i]),{open:()=>a(!0),modal:(0,l.tZ)(V.J,{pub:t,user:i,post:n,open:r,setOpen:a}),isOpen:r}}function eE(e){let{post:t,pub:i,user:n,isStatic:o,onChange:r,allowEdit:a,hidePinning:d,showEmailSent:u,allowSendEmail:p,hideComments:h,onCommentsClick:g,showRestackButton:v,showRestackModal:f,setFooterShown:b,postReactionToken:_}=e,y=function(){let e="undefined"==typeof window,[t,i]=(0,s.eJ)(e?0:window.pageYOffset),[n,o]=(0,s.eJ)(!1),r=(0,s.Ye)(()=>Date.now()+1e3,[]),l=(0,s.sO)(0);return(0,s.d4)(()=>{if(e)return;let n=m()(()=>{let e=Date.now(),n=(e-l.current)/1e3,a=(t-window.pageYOffset)/n;l.current=e,!(window.pageYOffset<0)&&(e100?o(!0):a>100&&o(!1),i(window.pageYOffset))},250);return window.addEventListener("scroll",n),()=>window.removeEventListener("scroll",n)},[e,t,i,o,r,l,!1]),n}(),Z=(0,eg.pm)();return(0,s.d4)(()=>{Z.addOffset(64*(y?1:-1)),b&&b(!y)},[y,b]),(0,l.tZ)(ec.hs,{alignItems:"center",padding:8,className:c()("mobile-footer-ufi",{hidden:y}),children:(0,l.tZ)(eN,{post:t,pub:i,user:n,isStatic:o,justified:!0,style:"tabs",onChange:r,allowEdit:a,editButtonIsLast:!0,hidePinning:d,showEmailSent:u,allowSendEmail:p,footerHidden:y,labelStyle:"counts-or-none",hideComments:h,onCommentsClick:g,position:"mobile-toolbar",hideByDisabling:!0,showRestackModal:f,showRestackButton:v,postReactionToken:_})})}function eL(){let e=function(){let e=(0,eg.pm)(),{iString:t}=(0,G.M1)();return i=>{i?e.popToast(e=>(0,l.tZ)(eg.FN,(0,o._)((0,n._)({},e),{text:t("Post liked"),Icon:k.Z}))):e.popToast(e=>(0,l.tZ)(eg.FN,(0,o._)((0,n._)({},e),{text:t("Post unliked"),Icon:k.Z})))}}();return async function(t,i){let{tabId:n,restacking_user_id:o}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};await (0,eo.rd)("/api/v1/post/".concat(t,"/reaction"),i?{method:"POST",json:{reaction:"❤",surface:"reader",tabId:n,restacking_user_id:o}}:{method:"DELETE",json:{tabId:n}}),e(i)}}function eX(e){let{post:t,pub:i,user:n,style:o,labelStyle:r,onChange:a,isStatic:s,isDisabled:d,postReactionToken:c}=e,{iString:u}=(0,G.M1)(),h=p()(Object.values((null==t?void 0:t.reactions)||{})),m="count"===r?(0,ek.numberToString)(h||0):"cta"===r?"Like":null;return(0,l.tZ)(ez,{post:t,pub:i,user:n,onChange:a,isStatic:s,style:o,postReactionToken:c,children:e=>{let{isLiked:t,handleLike:i}=e;return(0,l.tZ)(e0,{style:o,state:t?"liked":void 0,icon:(0,l.tZ)(F.Z,{className:"icon",height:eB(o),strokeWidth:eP}),onClick:d?()=>{}:i,noLabel:"none"===r,isDisabled:d,ariaLabel:u("Like")+("count"===r?" (".concat((0,ek.numberToString)(h||0),")"):""),ariaPressed:t,children:m})}})}function eM(e){let{style:t,onClick:i}=e;return(0,l.tZ)(e0,{style:t,state:void 0,icon:(0,l.tZ)(v.Z,{className:"icon",height:eB(t),strokeWidth:eP}),"aria-label":"menu",onClick:i})}function eR(e){let{pub:t,post:i,style:r,onChange:a,onToggleMenu:d,isStatic:c}=e,[u,p]=(0,s.eJ)(!1),{iString:h}=(0,G.M1)(),{canRestack:m,isRestacked:g,restacks:v,menuItems:f,nuxModal:b,loggedOutRestackAttempt:_}=(0,ev.K)({pub:t,post:i,onRestack:e=>{null==a||a({post:(0,o._)((0,n._)({},i),{restacked:e,restacks:v+(e?1:-1)})})},renderWithoutUser:!0});if((0,s.d4)(()=>{_&&p(!0)},[_]),!m)return null;let y=!t.community_enabled,Z=(0,l.tZ)(e0,{style:r,state:g?"restacked":void 0,icon:(0,l.tZ)(D.Z,{className:"icon",height:eB(r),strokeWidth:eP}),noLabel:0===v,"aria-label":"menu",isDisabled:y,children:v.toLocaleString(void 0,{maximumSignificantDigits:4})});return(0,l.BX)(l.HY,{children:[b,y?Z:(0,l.tZ)(eu.v2,(0,o._)((0,n._)({trigger:Z},d&&{onOpen:()=>{d({active:!0})},onClose:()=>{d({active:!1})}}),{ariaLabel:h("View repost options"),children:f})),(0,l.tZ)(es.Z,{displaySignInModal:u,onCloseSignInModal:()=>p(!1),isStatic:!!c,entry:"post-preview-like"})]})}function eF(e){let{postId:t,isOpen:i,onClose:n}=e,o=(0,$.xR)(),{iString:r}=(0,G.M1)(),[a,d]=(0,s.eJ)(),c=!0==o.getConfigFor("enable_post_summarization"),u=(0,s.sO)(!1),p=(0,s.I4)(()=>{u.current=!0,P().post("/api/v1/posts/".concat(t,"/summary")).then(e=>{var t;(null===(t=e.body)||void 0===t?void 0:t.summary)&&d(e.body.summary)}).finally(()=>{u.current=!1})},[t]);return((0,s.d4)(()=>{i&&c&&!a&&!u.current&&p()},[i,p,c,a]),c)?(0,l.BX)(ep.u_,{isOpen:i,onClose:n,width:750,children:[(0,l.tZ)(ep.xB,{showClose:!0,title:r("Reader guide"),onClose:n}),(0,l.tZ)(ec.tu,{padding:16,paddingBottom:32,children:a?(0,l.tZ)("div",{dangerouslySetInnerHTML:{__html:a}}):(0,l.tZ)(ec.tu,{alignItems:"center",justifyContent:"center",style:{flex:1,minHeight:300},children:(0,l.tZ)("div",{className:"embed-loader"})})})]}):null}let eU=e=>{let{isOpen:t,setIsOpen:i}=e;return(0,s.d4)(()=>{let e=setTimeout(()=>{t&&i(!1)},1e4);return()=>clearTimeout(e)},[t]),(0,l.tZ)(ep.u_,{isOpen:t,onClose:()=>i(!1),width:300,children:(0,l.BX)(ec.tu,{padding:16,gap:16,children:[(0,l.tZ)(em.xv.H4,{translated:!0,children:"Generating PDF..."}),(0,l.tZ)(ec.tu,{alignItems:"center",children:(0,l.tZ)(eh.$j,{})})]})})};function eO(e){let{post:t,pub:i,user:n,onChange:o,showRestackModal:r,canBeCrossPosted:a,onSummaryOpen:d,onToggleRestackModal:c}=e,u="button",p=(0,$.xR)(),h=!0==p.getConfigFor("enable_post_summarization"),[m,v]=(0,s.eJ)(!1),Z=eT({pub:i,user:n,post:t,defaultOpen:r&&a});return(0,s.d4)(()=>{null==c||c(Z.isOpen)},[c,Z.isOpen]),(0,l.BX)(l.HY,{children:[(0,l.tZ)(eU,{isOpen:m,setIsOpen:v}),(0,l.BX)(eu.v2,{trigger:(0,l.tZ)(e0,{style:u,icon:(0,l.tZ)(g.Z,{className:"icon edit-icon",size:eB(u),strokeWidth:2}),noLabel:!0,"aria-label":"More"}),children:[n&&(0,l.tZ)(eV,{post:t,onChange:o,showIcon:!0}),h&&(0,l.tZ)(eu.sN,{leading:(0,l.tZ)(f.Z,{}),onClick:d,children:"Reader guide"}),a&&(0,l.tZ)(eu.sN,{leading:(0,l.tZ)(b.Z,{}),onClick:()=>{Z.open(),(0,en.j)(en.FP.RESTACK_POST_CLICKED,{restacked_publication_id:i.id,restacked_post_id:t.id,restacking_user_id:n.id,is_from_email:!1})},children:"Cross post"}),p.getConfigFor("show_open_post_as_pdf_button")&&(0,l.tZ)(eu.sN,{leading:(0,l.tZ)(_.Z,{}),onClick:()=>{v(!0),(0,ea.uX)((0,ew.SUl)(i,t.id),{local_navigation:!1})},children:"Open as PDF"}),n&&(0,l.tZ)(eu.sN,{leading:(0,l.tZ)(y.Z,{}),href:(0,ew.qUD)(t.id),children:"Substack Reader"})]}),Z.modal]})}function eA(e){var t;let i=p()(Object.values((null===(t=e.post)||void 0===t?void 0:t.reactions)||{}));return(0,l.tZ)(eX,(0,o._)((0,n._)({},e),{labelStyle:i>0?"count":"none"}))}let eD=e=>{let{pub:t,user:i}=e,[n,o]=(0,s.eJ)(null==i?void 0:i.email),[r,a]=(0,s.eJ)(!1),{iString:d}=(0,G.M1)();return(0,l.BX)(ec.tu,{gap:20,children:[(0,l.BX)(ec.tu,{gap:4,children:[(0,l.BX)(em.xv.H4,{translated:!0,weight:"semibold",children:["Support ",I18N.p(t.name)]}),(0,l.tZ)(em.xv.B4,{translated:!0,color:"secondary",children:"Since you liked this post, why not subscribe?"})]}),(0,l.BX)(ec.tu,{gap:12,children:[(0,l.tZ)("input",{disabled:!!(null==i?void 0:i.email),value:n,onChange:e=>o(e.currentTarget.value)}),(0,l.tZ)(ed.zx,{onClick:async()=>{(0,en.j)(en.FP.LIKE_UPSELL_FREE_SUBSCRIBED,{email:n}),a(!0);try{let{referral_token:e}=(await P().post("/api/v1/free").send({email:n,source:"like-button-upsell"})).body;(0,en.IU)(),(0,ea.uX)((0,ew.W1P)(t,{params:{utm_source:eS.b3.likeButtonUpsell,just_signed_up:!0,referral_token:e}}),{local_navigation:!1})}catch(e){alert((0,ea.zx)(e))}},flex:"grow",disabled:r,priority:"primary",role:"button","aria-label":d("Subscribe"),children:d(r?"Please wait...":"Subscribe")})]})]})};function ez(e){let{post:t,pub:i,user:n,onChange:o,isStatic:r,children:a,style:d,postReactionToken:u}=e,p=(0,s.sO)(),h=(0,s.sO)(),{isLiked:m,toggle:g}=function(e){let{post:t,user:i,surface:n,onChange:o,postReactionToken:r}=e,l=!!(null==t?void 0:t.reaction),a=(0,J.LC)(),s=(0,er.ib)({pathname:(0,ew.n1t)(a?"/api/v1/cross-post/".concat(null==t?void 0:t.id,"/reaction"):"/api/v1/post/".concat(null==t?void 0:t.id,"/reaction"),{token:r}),method:"POST",deps:[null==t?void 0:t.id]});return{isLiked:l,toggle:async()=>{var e;if(s.isLoading)return"error";let{reaction:r,reactions:l,reactor_names:a}=(0,Y.fS)(null!=i?i:void 0,t);t.reaction=null!=r&&r,t.reactions=l,t.reactor_names=null!=a?a:[],null==o||o({post:t});let d=await s.refetch(r?{method:"POST",json:{reaction:"❤",surface:n}}:{method:"DELETE"}),c=null==d?void 0:null===(e=d.response)||void 0===e?void 0:e.status;if(c){let{reaction:e,reactions:n,reactor_names:r}=(0,Y.fS)(null!=i?i:void 0,t);t.reaction=null!=e&&e,t.reactions=n,t.reactor_names=null!=r?r:[],null==o||o({post:t})}return 401===c?"unauthorized":c?"error":r?"liked":"unliked"}}}({post:t,user:n,subscribePromptRef:p,onChange:o,postReactionToken:u}),[v,f]=(0,s.eJ)(!1),b=(0,s.I4)(async e=>{var t;null==e||null===(t=e.stopPropagation)||void 0===t||t.call(e),"unauthorized"===await g()&&f(!0)},[g]);return(0,l.BX)("div",{className:c()("like-button-container","post-ufi-button","style-".concat(d),m&&"state-liked"),children:[a({isLiked:m,handleLike:b}),(0,l.tZ)(es.Z,{isStatic:r,displaySignInModal:v,onCloseSignInModal:()=>f(!1),entry:"post-preview-restack"}),n&&!n.is_admin&&!n.is_contributor&&("button"===d||"tabs"===d)&&(0,l.tZ)(E.Fx,{ref:p,className:c()("subscribe-prompt-dropdown",!(null==n?void 0:n.is_free_subscribed)&&"free"),hideMenuTail:!0,children:(null==n?void 0:n.is_free_subscribed)?(0,el.P)(n,i)?(0,l.tZ)(j.xt,{pub:i,onClose:()=>{var e;return null===(e=p.current)||void 0===e?void 0:e.close()},shareDialogRef:h}):(0,l.tZ)(j._q,{pub:i}):(0,l.tZ)(eD,{pub:i,user:n})}),!r&&(0,l.tZ)(K.ZP,{ref:h,user:n,pub:i,post:t})]})}function ej(e){var t;let{post:i,defaultSaved:n,isSaved:o,trackSurface:r}=e;return eH({postId:i.id,defaultSaved:null!==(t=null!=n?n:i.is_saved)&&void 0!==t&&t,isSaved:o,trackSurface:r})}function eH(e){let{postId:t,defaultSaved:i,isSaved:n,trackSurface:o}=e,[r,l]=(0,s.eJ)(i),a=null!=n?n:r,{refetch:d}=(0,er.ib)({pathname:"/api/v1/posts/saved",method:"POST",json:{post_id:t,surface:o},deps:[t]}),c=eq();return{isSaved:a,onSave:()=>(d({method:a?"DELETE":"POST"}),l(!a),c(!a),!a)}}async function eW(e,t,i){let{surface:n}=i;await (0,eo.rd)("/api/v1/posts/saved",{method:t?"POST":"DELETE",json:{post_id:e}}),(0,en.j)(en.FP.POST_SAVED,{post_id:e,surface:n,is_saved:t})}function eq(){let e=(0,eg.pm)(),{iString:t}=(0,G.M1)();return i=>{i?e.popToast(e=>(0,l.tZ)(eg.FN,(0,o._)((0,n._)({},e),{text:t("Post saved"),Icon:Z.Z,cta:t("View"),href:(0,eZ.qQN)()}))):e.popToast(e=>(0,l.tZ)(eg.FN,(0,o._)((0,n._)({},e),{text:t("Post unsaved"),Icon:w.Z})))}}function eY(e){let{style:t,post:i,isSaved:r,labelStyle:a,position:s,onChange:d}=e,{isSaved:c,onSave:u}=ej({defaultSaved:r,post:i,isSaved:i.is_saved,trackSurface:s}),{iString:p}=(0,G.M1)();return(0,l.tZ)(e0,{state:c?"saved":void 0,style:t,icon:(0,l.tZ)(M.Z,{className:"icon",height:eB(t,"verbose"===a?"verbose":null),strokeWidth:eP}),noLabel:"none"===a,verboseLabel:"verbose"===a,onClick:()=>{let e=u();null==d||d({post:(0,o._)((0,n._)({},i),{is_saved:e})})},ariaPressed:c,ariaLabel:p("Save"),children:"cta"===a||"verbose"===a?p("Save"):null})}function eV(e){let{post:t,isSaved:i,onChange:r,showIcon:a}=e,{onSave:s}=ej({defaultSaved:i,post:t,isSaved:t.is_saved}),{iString:d}=(0,G.M1)(),c=t.is_saved?"var(--color-accent-fg-orange)":void 0;return(0,l.tZ)(eu.sN,{leading:a?(0,l.tZ)(Z.Z,{style:{stroke:c,fill:c}}):void 0,onClick:()=>{let e=s();null==r||r({post:(0,o._)((0,n._)({},t),{is_saved:e})})},children:d(t.is_saved?"Unsave":"Save")})}function eK(e){let t,{style:i,count:n,labelStyle:o,post:r,pub:a,isStatic:s,onClick:d,isDisabled:c}=e,{iString:u}=(0,G.M1)(),p=(0,ef.XA)(),h=(0,et.aF)();return t=(null==r?void 0:r.comment_url_override)?r.comment_url_override:s?"".concat(I.W.HALF_MAGIC_COMMENTS_URL,"&utm_source=").concat(eS.b3.substack,"&utm_medium=").concat(eS.lP.email):!p||(null==h?void 0:h.is_contributor)?(0,eZ.uRy)(a,r,{comments:!0}):(0,eZ.K8_)(a.subdomain,r.slug,{params:{comments:!0,utm_source:eS.b3.post,utm_medium:eS.lP.web}}),(0,l.BX)(e0,{style:i,icon:(0,l.tZ)(R.Z,{className:"icon",height:eB(i),strokeWidth:eP}),href:c?void 0:t,onClick:c?()=>{}:e=>{d?d(e):(null==e||e.preventDefault(),window.location.href=t)},noLabel:"none"===o,className:"post-ufi-comment-button",isDisabled:c,ariaLabel:u("cta"===o?"Comment":"View comments"+" (".concat((0,ek.numberToString)(n||0),")")),children:["cta"===o&&u("Comment"),"count"===o&&(0,ek.numberToString)(n||0)]})}function eJ(e){let t,{post:i,user:n,pub:o,style:r,labelStyle:a,isStatic:d,onChange:u,position:p}=e,h=(0,s.sO)(),m=(0,s.I4)(()=>{(0,en.j)(en.FP.POST_SHARE_BUTTON_CLICKED,{position:p,post_id:i.id}),h.current.open()},[]),{iString:g}=(0,G.M1)();t=i.share_url_override?i.share_url_override:d?i?I.W.SHARE_URL:I.W.SHARE_PUB_URL:"javascript:void(0)";let v="none"===a;return(0,l.BX)(l.HY,{children:[(0,l.tZ)(e0,{style:r,icon:v?(0,l.tZ)(C.Z,{className:"icon",height:eB(r),strokeWidth:eP}):null,onClick:m,href:t,noLabel:"none"===a,className:c()(!v&&"no-icon"),children:"cta"===a&&g("Share")}),!d&&(0,l.tZ)(K.ZP,{ref:h,user:n,pub:o,post:i,onChange:u})]})}function eG(e){let{post:t,user:i,pub:n,onClick:o,style:r}=e,{iString:a}=(0,G.M1)();return(0,l.tZ)(l.HY,{children:(0,l.tZ)(e0,{style:r,icon:(0,l.tZ)(U.Z,{className:"icon",height:eB(r,"verbose"),strokeWidth:eP}),onClick:()=>{(0,en.j)(en.FP.RESTACK_POST_CLICKED,{restacked_publication_id:n.id,restacked_post_id:t.id,restacking_user_id:i.id,is_from_email:!1}),o()},noLabel:!1,verboseLabel:!0,title:a("Cross-Post"),children:a("Cross-post")})})}function eQ(e){let{post:t,user:i,pub:n,onClick:o}=e,{iString:r}=(0,G.M1)();return(0,l.tZ)(l.HY,{children:(0,l.tZ)(eu.sN,{onClick:()=>{(0,en.j)(en.FP.RESTACK_POST_CLICKED,{restacked_publication_id:n.id,restacked_post_id:t.id,restacking_user_id:i.id,is_from_email:!1}),o()},children:r("Cross-post")})})}function e$(e){let{style:t,pub:i,post:n,user:o,hidePinning:r,emailSent:a,allowSendEmail:d,footerHidden:u,showRestackModal:p,canBeCrossPosted:h,onSummaryOpen:m,onToggleMenu:v,onToggleRestackModal:f}=e,b=(0,s.sO)();u&&b.current&&b.current.close();let _=eT({post:n,pub:i,user:o,defaultOpen:p&&h});return(0,s.d4)(()=>{null==f||f(_.isOpen)},[f,_.isOpen]),(0,l.BX)("div",{className:c()("edit-button-container","post-ufi-button","style-".concat(t)),children:[(0,l.tZ)(e0,{onClick:()=>b.current.open(),style:t,icon:(0,l.tZ)(g.Z,{className:"icon edit-icon",size:eB(t),strokeWidth:2}),noLabel:!0}),(0,l.tZ)(H.y,{ref:b,pub:i,post:n,user:o,className:"post-ufi-edit-menu",useDrawerOnMobile:!0,hidePinning:r,emailSent:a,allowSendEmail:d,handleCrossPost:h?()=>{_.open(),(0,en.j)(en.FP.RESTACK_POST_CLICKED,{restacked_publication_id:i.id,restacked_post_id:n.id,restacking_user_id:o.id,is_from_email:!1})}:void 0,onSummaryOpen:m,onToggleMenu:v}),_.modal]})}let e0=(0,a.forwardRef)((e,t)=>{let{icon:i,children:n,state:o,style:r,onClick:a,href:s,noLabel:d,verboseLabel:u,noBorder:p,className:h,isDisabled:m,iconPosition:g="left",title:v,ariaLabel:f,ariaPressed:b}=e;return(0,l.BX)("a",{role:"button",className:c()("post-ufi-button","style-".concat(r),h,o?"state-".concat(o):void 0,m?"state-disabled":void 0,n&&!d?"has-label":"no-label",p?"no-border":"with-border",u?"verbose-label":""),title:v,href:s,onClick:e=>{a&&(e.stopPropagation(),a(e))},ref:t,"aria-label":null!=f?f:v,"aria-pressed":b,children:["left"===g&&i,!d&&n&&(0,l.tZ)("div",{className:"label",children:n}),"right"===g&&i]})}),e1=e=>{let{pub:t,post:i,showAuthor:n}=e;return!!(n&&t.bylines_enabled&&(0,ek.getPrintedByline)(t,i))},e4=e=>{let{pub:t,post:i,showAuthor:n,showPhoto:o,isMobileWidth:r}=e;return e1({pub:t,post:i,showAuthor:n})&&!e2({pub:t,post:i,showAuthor:n})&&!e8({pub:t,post:i,showAuthor:n,showPhoto:o})&&!r},e2=e=>{let{pub:t,post:i,showAuthor:n}=e;return e1({pub:t,post:i,showAuthor:n})&&(0,ek.getBylineUsers)(i).length>1},e8=e=>{var t;let{pub:i,post:n,showAuthor:o,showPhoto:r}=e;return!!(e1({pub:i,post:n,showAuthor:o})&&r&&(null===(t=(0,ek.getBylineUsers)(n)[0])||void 0===t?void 0:t.photo_url)&&i.byline_images_enabled)};function e3(e){let{post:t,showDatetime:i,isStatic:n,fromPostPage:o,showReactions:r,language:l="en"}=e,a=t.reactions?Object.values(t.reactions).reduce((e,t)=>e+t,0):0,s=o&&!n&&r&&a>=70&&a<100;return i&&s?(0,eb.Z)(t.post_date).locale(l).standardDatetimeWithYear():i&&!s?(0,eb.Z)(t.post_date).locale(l).standardDatetime():n?(0,eb.Z)(t.post_date).locale(l).standardDate():s?(0,eb.Z)(t.post_date).locale(l).standardDate({full:s}):(0,eb.Z)(t.post_date).locale(l).standardDateOrTime()}function e6(e){let{pub:t,post:i,showPins:n,showAudience:o,showDate:r,showDatetime:a,showEmailSent:s,showAuthor:d,showPublicationName:u,showCrossPostedPublicationName:p}=e,h=(0,ee.Tf)(),m=!!(d&&t.bylines_enabled&&(0,ek.getPrintedByline)(t,i)),g=r&&i.post_date&&!i.is_draft,v=s?!!i.email_sent_at:null,{iString:f,iTemplate:b,language:_}=(0,G.M1)();return(0,l.BX)("div",{className:c()("ufi-preamble",{themed:h}),children:[p&&i.restacked_pub_name?(0,l.tZ)("div",{className:"ufi-preamble-label cross-posted-pub-name",children:b(ex(),i.restacked_pub_name)}):null,s&&v&&(0,l.tZ)("div",{className:"email-sent",title:f("This post was sent as an email"),children:(0,l.tZ)(S.Z,{className:"post-ufi-preamble-icon",size:16})}),n&&i.is_section_pinned&&(0,l.tZ)("div",{className:"pinned",children:(0,l.tZ)(z.Z,{className:"post-ufi-preamble-icon"})}),"adhoc_email"===i.type?(0,l.tZ)("div",{className:"audience-adhoc",children:(0,l.tZ)(L.Z,{className:"post-ufi-preamble-icon"})}):o&&(0,e_.isPaidAudience)(i.audience)&&(0,l.tZ)("div",{className:"audience-lock",children:(0,l.tZ)(N.Z,{audience:i.audience,className:"lock-icon post-ufi-preamble-icon",size:16})}),e4({pub:t,post:i,showAuthor:m,isMobileWidth:!1})&&(0,l.tZ)("div",{className:"ufi-preamble-label author",children:(0,ek.getBylineUsers)(i).length>0?(0,ek.oxfordComma)((0,ek.getBylineUsers)(i).map(e=>(0,l.tZ)(l.HY,{children:(0,l.tZ)(q.ProfileHoverCard,{subject:e,utmSource:"byline",children:(0,l.tZ)("a",{href:(0,eZ.LwU)(e,t,{base:!0}),onClick:e=>e.stopPropagation(),children:e.name})})}))):(0,ek.getPrintedByline)(t,i)}),u&&(0,l.tZ)("div",{className:"post-publication-name",children:t.name}),g&&(0,l.tZ)("div",{className:"ufi-preamble-label post-date",title:(0,eb.Z)(i.post_date).toISOString(),children:(0,l.tZ)("time",{dateTime:(0,eb.Z)(i.post_date).toISOString(),children:e3({post:i,showDatetime:a,language:_})})})]})}let e5=e=>{let{pub:t,post:i,user:n,onChange:o,postReactionToken:r}=e;return(0,$.xR)().getConfigFor("like_posts_enabled")&&t.community_enabled?(0,l.tZ)(eA,{style:"button",post:i,pub:t,user:n,onChange:o,postReactionToken:r}):null},e9=e=>{let{pub:t,post:i,onClick:n}=e,o=(0,ek.showCommentsOnPost)({publication:t,post:i}),{comment_count:r}=i;return o?(0,l.tZ)(eK,{post:i,pub:t,labelStyle:r>0?"count":"none",style:"button",count:r,onClick:n}):null};function e7(e){let{hideBottomBorder:t,post:i,pub:n,user:o,onChange:r,onCommentsClick:a,showRestackModal:d=!1,showTranscriptionButton:c,onTranscriptionClick:u,postReactionToken:p,onToggleRestackModal:h,onTranscriptClick:m}=e,{iString:g}=(0,G.M1)(),v=(0,J.LC)(),f=(null==o?void 0:o.is_contributor)&&!v,{getSettingFor:b}=(0,Q.So)(),_=!i.is_draft&&(0,ey.x)(o,{enable_restacking:!!b("enable_restacking")},i,n,!1),[y,Z]=(0,s.eJ)(!1),w=o&&i.videoUpload&&(0,eC.a)(o,i,i.videoUpload);return(0,l.BX)(ec.hs,{className:"post-ufi",alignItems:"center",borderTop:"detail-themed",borderBottom:t?void 0:"detail-themed",justifyContent:"space-between",gap:16,flex:"grow",paddingY:16,children:[(0,l.BX)(ec.hs,{gap:8,children:[(0,l.tZ)(e5,{post:i,pub:n,user:o,onChange:r,postReactionToken:p}),(0,l.tZ)(e9,{pub:n,post:i,onClick:a}),(0,l.tZ)(eR,{pub:n,post:i,onChange:r,style:"button"}),c&&(0,l.tZ)(eM,{style:"button",onClick:u})]}),(0,l.BX)(ec.hs,{gap:8,children:[(0,l.tZ)(W.sp,{post:i,pub:n,user:o,trigger:{style:"button",labelStyle:"cta"},showClipping:!!i.videoUpload,disableClipping:!w}),m&&(0,l.tZ)(e0,{onClick:m,style:"button",icon:(0,l.tZ)(x.Z,{color:"var(--color-secondary-themed)",size:16}),children:g("Transcript")}),f?(0,l.tZ)(e$,{style:"button",pub:n,post:i,user:o,showRestackModal:d,canBeCrossPosted:_,onSummaryOpen:()=>Z(!0),onToggleRestackModal:h}):(o||_)&&(0,l.tZ)(eO,{post:i,pub:n,user:o,onChange:r,showRestackModal:d,canBeCrossPosted:_,onSummaryOpen:()=>Z(!0),onToggleRestackModal:h})]}),(0,l.tZ)(eF,{postId:i.id,isOpen:y,onClose:()=>Z(!1)})]})}function te(e){let{isFooter:t,customization:{showAppUpsell:i,showShare:r,showComments:a,showReactions:s,showListen:d,showSave:u,showRestack:p,showCommentRestack:h}}=e,m=!t&&(p||d||u),{iString:g}=(0,G.M1)();return t||r||a||s||d||u||!p?(0,l.BX)(ei.YF,{className:t?"email-ufi-2-bottom":"email-ufi-2-top",width:"100%",children:[p&&t&&(0,l.BX)(l.HY,{children:[(0,l.tZ)(tt,{}),(0,l.tZ)("tr",{children:(0,l.tZ)("td",{children:(0,l.BX)(ei.YF,{width:"100%",className:"email-ufi-2-row",children:[(0,l.tZ)("tr",{children:(0,l.tZ)("td",{width:"95%",children:r&&(0,l.BX)(ei._i,{tableClassName:"email-button-outline-wrapper-full-width",aClassName:"email-button-outline full-width",href:I.W.SHARE_URL,children:[(0,l.tZ)(O.Z,(0,n._)({},ti)),(0,l.tZ)("span",{className:"email-button-text",children:g("Share")})]})})}),(0,l.tZ)(tt,{})]})})})]}),(0,l.tZ)(tt,{}),(0,l.tZ)("tr",{children:(0,l.tZ)("td",{children:(0,l.tZ)(ei.YF,{width:"100%",children:(0,l.BX)("tr",{children:[(0,l.tZ)("td",{children:(0,l.BX)(ei.zK,{gap:8,style:m?void 0:{margin:"0 auto"},children:[s?t?(0,l.BX)(ei._i,{aClassName:"email-button-outline",href:I.W.REACTION_URL,children:[(0,l.tZ)(F.Z,(0,n._)({},ti)),(0,l.tZ)("span",{className:"email-button-text",children:g("Like")})]}):(0,l.tZ)(tn,{href:I.W.REACTION_URL,children:(0,l.tZ)(F.Z,(0,n._)({},ti))}):null,a?t?(0,l.BX)(ei._i,{aClassName:"email-button-outline",href:"".concat(I.W.HALF_MAGIC_COMMENTS_URL,"&utm_source=").concat(eS.b3.substack,"&utm_medium=").concat(eS.lP.email),children:[(0,l.tZ)(R.Z,(0,n._)({},ti)),(0,l.tZ)("span",{className:"email-button-text",children:g("Comment")})]}):(0,l.tZ)(tn,{href:"".concat(I.W.HALF_MAGIC_COMMENTS_URL,"&utm_source=").concat(eS.b3.substack,"&utm_medium=").concat(eS.lP.email),children:(0,l.tZ)(R.Z,(0,n._)({},ti))}):null,r&&i&&(t?(0,l.BX)(ei._i,{aClassName:"email-button-outline",href:I.W.SHARE_URL,children:[(0,l.tZ)(A.Z,(0,n._)({},ti)),(0,l.tZ)("span",{className:"email-button-text",children:g("Share")})]}):(0,l.tZ)(tn,{href:I.W.SHARE_URL,children:(0,l.tZ)(A.Z,(0,n._)({},ti))})),h&&(t?(0,l.BX)(ei._i,{aClassName:"email-button-outline",href:"".concat(I.W.RESTACK_COMMENT_URL,"&utm_source=").concat(eS.b3.substack,"&utm_medium=").concat(eS.lP.email),children:[(0,l.tZ)(D.Z,(0,n._)({},ti)),(0,l.tZ)("span",{className:"email-button-text",children:g("Restack")})]}):(0,l.tZ)(tn,{href:"".concat(I.W.RESTACK_COMMENT_URL,"&utm_source=").concat(eS.b3.substack,"&utm_medium=").concat(eS.lP.email),children:(0,l.tZ)(D.Z,(0,n._)({},ti))}))]})}),(0,l.tZ)("td",{align:"right",children:(0,l.BX)(ei.zK,{gap:8,children:[r&&!i&&!t&&(0,l.BX)(ei._i,{aClassName:"email-button-outline",href:I.W.SHARE_URL,children:[(0,l.tZ)("div",{className:"email-button-spacer"}),(0,l.tZ)("span",{className:"email-button-text",children:g("Share")})]}),i&&!t&&(0,l.BX)(ei._i,{aClassName:"email-button-outline",href:"".concat(I.W.POST_APP_LINK_URL,"&utm_campaign=email-read-in-app"),children:[(0,l.tZ)("div",{className:"email-button-spacer"}),(0,l.tZ)("span",{className:"email-button-text",style:{marginRight:4},children:g("READ IN APP")}),(0,l.tZ)(X.Z,(0,o._)((0,n._)({},ti),{className:c()("icon","text-icon")}))]})]})})]})})})}),(0,l.tZ)(tt,{})]}):(0,l.tZ)(ei.YF,{className:"email-ufi-2-empty",width:"100%",children:(0,l.tZ)("tr",{height:1,children:(0,l.tZ)("td",{height:1,style:{fontSize:0,lineHeight:0},children:"\xa0"})})})}function tt(){return(0,l.tZ)("tr",{height:16,children:(0,l.tZ)("td",{height:16,style:{fontSize:0,lineHeight:0},children:"\xa0"})})}let ti={className:"icon",height:18,strokeWidth:1,isStatic:!0,stroke:"#808080",fill:"none"};function tn(e){let{size:t=38,href:i,children:n}=e;return(0,l.tZ)(ei.YF,{width:t,children:(0,l.tZ)("tr",{children:(0,l.tZ)("td",{align:"center",children:(0,l.tZ)("a",{className:"email-icon-button",href:i,style:{width:t},children:n})})})})}},30329:function(e,t,i){i.d(t,{E6:()=>x,dJ:()=>E,fS:()=>B,oq:()=>L,xl:()=>N});var n=i(27412),o=i(7409),r=i(16584),l=i(6400),a=i(94184),s=i.n(a),d=i(12297),c=i.n(d),u=i(80569),p=i.n(u),h=i(60826),m=i(12620),g=i(666),v=i(93666),f=i(95441),b=i(8923),_=i(35702),y=i(68833),Z=i(98914),w=i(19081),k=i(58175),C=i(60308),S=i(84864);let x=(e,t,i)=>{let{reaction:n,reactions:o,reactor_names:r}=P(e,t,i);I(t,n,o,r)},B=(e,t)=>P(e,t,!t.reaction),P=(e,t,i)=>{let n="reaction"in t?t.reaction:void 0,{reactions:r={"❤":0},reactor_names:l=[]}=t;if(r=(0,o._)({},r),l=[...l],i&&!n){let t=r[n="❤"];r[n]=t?t+1:1,e&&e.is_public_admin&&l.push(e.name||"author")}else!i&&n&&(r["❤"]=r["❤"]?r["❤"]-1:0,e&&e.is_public_admin&&(l=l.filter(t=>t!==(e.name||"author"))),n=null);return{reaction:n,reactions:r,reactor_names:l}},I=(e,t,i,n)=>{e.reaction=t,e.reactions=i,e.reactor_names=n};function N(e,t,i,n){let o=(0,C.n1t)("/api/v1/".concat(t?"comment":"post","/").concat(e.id,"/reaction"),{token:n});return i?p().post(o).send({reaction:"❤"}):p().delete(o)}class T extends l.Component{notifyParent(e){let{reaction:t,reactions:i,reactor_names:n}=e,r=(0,o._)({},this.props.post),l=this.props.comment&&(0,o._)({},this.props.comment);I(l||r,t,i,n),this.props.onChange&&this.props.onChange({post:r,comment:l})}async reactionRejected(e){(0,y.j)(y.FP.REACTION_REJECTED,{comment_id:this.props.comment&&this.props.comment.id,post_id:this.props.post&&this.props.post.id,reason:"Not logged in",unreact:!e}),await new Promise(e=>{this.state.includeModal?this.modalRef.current.open(e):this.setState({includeModal:!0},()=>this.modalRef.current.open(e))})}render(e){let t,{className:i,user:n,pub:o,comment:l,height:a,isStatic:d,post:u,buttonStyle:p,hideReactionCount:m,countInParenthesesStyle:v,iString:f}=e,b=l||u,_=null==b?void 0:b.reaction,y=(null==b?void 0:b.reactions)||{},Z=c()(Object.values(y));return t=u&&u.reaction_url_override?u.reaction_url_override:d?h.W.REACTION_URL:"javascript:void(0)",(0,r.BX)(k.xv,{as:"span",decoration:"hover-underline",color:_?"accent-red":"pub-secondary-text",className:i,children:[this.props.render?this.props.render({liked:_,numReactions:Z>0?(0,S.numberToString)(Z):null,onClick:e=>{this.react(e)}}):(0,r.tZ)("a",{href:t,className:s()("like-button",{button:p,"post-meta-button":p,liked:_}),onClick:e=>this.react(e),children:(0,r.BX)(w.hs,{gap:6,alignItems:"center",className:i,children:[d?(0,r.tZ)(g.Z,{ampProps:{layout:"fixed"},isStatic:!0,height:a,stroke:"var(--color-secondary-themed)",fill:"transparent"}):(0,r.BX)(w.hs,{className:"reaction-container",children:[(0,r.tZ)(g.Z,{className:"animation"}),!_&&(0,r.tZ)(g.Z,{strokeWidth:2,height:a,fill:"transparent",stroke:"var(--color-secondary-themed)"}),_&&(0,r.tZ)(g.Z,{height:a,strokeWidth:2})]}),v?(0,r.BX)(k.xv.Meta,{color:_?"accent-red":"pub-secondary-text",className:"like-count",children:[f(_?"Liked":"Like"),!m&&Z>0?" (".concat((0,S.numberToString)(Z),")"):""]}):!m&&Z>0?(0,r.tZ)("span",{className:"like-count",children:(0,S.numberToString)(Z)}):p?(0,r.tZ)("span",{className:"like-count",children:f("Like")}):null]})}),!d&&this.state.includeModal&&(0,r.tZ)(L,{modalRef:this.modalRef,user:n,pub:o,comment:l,react:this.react})]})}constructor(...e){super(...e),(0,n._)(this,"state",{includeModal:!1}),(0,n._)(this,"modalRef",(0,l.createRef)()),(0,n._)(this,"react",async e=>{if(this.props.isStatic)return;e&&e.stopPropagation();let t=this.props.comment||this.props.post;if(!t){console.warn("LikeButton: no subject");return}let i=!t.reaction;if(this.props.onReactedChange&&this.props.onReactedChange(i),this.props.noSelfUpdate)return;let n=await (0,Z.Se)(this,"locked",async(e,t)=>{let n;let o=t.comment||t.post;if(!o){console.warn("LikeButton: no subject");return}let r=N(o,!!t.comment,i,t.token);t.oauthAccessToken&&r.set("Authorization","Bearer ".concat(t.oauthAccessToken));let{reaction:l,reactions:a,reactor_names:s}=B(t.user,o);this.notifyParent({reactions:a,reaction:l,reactor_names:s});try{await r}catch(e){n=e,this.notifyParent(o)}return{error:n,reaction:l}});return n&&n.error&&(n.error.response&&401===n.error.response.statusCode?await this.reactionRejected(n.reaction):alert((0,Z.zx)(n.error))),!!n&&!n.error})}}let E=(0,f.fz)((0,b.$1)(T));function L(e){let{comment:t,pub:i,user:n,modalRef:o,onClose:l,react:a}=e,{iString:s}=(0,f.M1)();return(0,r.tZ)(v.Z,{ref:o,onClose:l,children:(0,r.BX)(w.tu,{alignItems:"center",paddingTop:80,gap:24,children:[(0,r.tZ)(k.xv.H2,{children:s(t?"Subscribe to like this comment":"Subscribe to like this post")}),(0,r.tZ)(m.Z,{user:n,pub:i,showLogin:!0,showTerms:!0,source:"like_button",onSuccess:async e=>{let t=e&&e.body&&e.body.email;e&&e.body&&e.body.prompt_to_login||!await a()?window.location.href=(0,C.uXE)({for_pub:i.subdomain,email:t}):(null==o?void 0:o.current)&&((0,_.a)({freeSignup:!0,freeSignupEmail:t}),await o.current.close())}})]})})}},51014:function(e,t,i){i.d(t,{ZP:()=>A});var n=i(27412),o=i(7409),r=i(99282),l=i(98848),a=i(16584),s=i(18446),d=i.n(s),c=i(25380),u=i(85200),p=i(20160);i(83330);var h=i(59154),m=i(79138),g=i(90443),v=i(37632),f=i(18573),b=i(82653),_=i(77559),y=i(82695),Z=i(4473),w=i(39535),k=i(93666),C=i(347);i(20888);var S=i(75697);i(70522);var x=i(95441),B=i(77906),P=i(72572),I=i(98170),N=i(60225),T=i(68833),E=i(59176),L=i(98914);i(15771);var X=i(19081),M=i(44424),R=i(58175),F=i(31065);i(23398),i(60308),i(84864);var U=i(47929),O=i(46518);class A extends k.p{shouldComponentUpdate(e,t){return!d()(this.props,e)||!d()(this.state,t)}async open(){let e={title:(0,S.B8)((0,o._)({},this.props)),url:this.props.shareUrl||(0,S.O1)("direct",(0,o._)({medium:this.state.medium},this.props))};if((0,L.K1)()&&navigator.share&&navigator.canShare&&navigator.canShare(e))try{var t;await navigator.share(e),(0,T.j)(T.FP.NATIVE_SHARE_SUCCESS,{medium:this.state.medium||this.props.medium||"web",post_id:this.props.post?this.props.post.id:null,utm_campaign:this.state.utm_campaign||this.props.utm_campaign||"default"}),(0,E.ex)("".concat(null===(t=this.props.pub)||void 0===t?void 0:t.subdomain," shared"),!0);return}catch(e){if("AbortError"===e.name)return;(0,T.j)(T.FP.NATIVE_SHARE_FAILED,{errorName:e.name,errorMessage:e.message})}super.open()}fromEmail(){this.setState({medium:"email"},()=>{this.open()})}getClassName(){return"share-dialog"}onBeforeOpen(){this.setState({showButtons:!0})}onOpen(){(0,T.j)(T.FP.SHARE_DIALOG_OPENED,{medium:this.state.medium||this.props.medium||"web",post_id:this.props.post?this.props.post.id:null,utm_campaign:this.state.utm_campaign||this.props.utm_campaign||U.VX.default})}onClose(){this.setState({copied:!1,utm_campaign:null})}renderChildren(e){var t;let{post:i,pub:n,comments:l,commentId:s,shareUrl:d}=e,c=l&&s&&l.find(e=>e.id===s),u=c?"comment":n&&!i?"publication":i?"post":void 0;return(0,a.tZ)(C.h,{children:(0,a.tZ)(p.W,{children:(0,a.BX)(X.tu,{className:O.Z.container,gap:24,padding:24,bg:"primary",radius:"md",border:"detail",children:[(0,a.tZ)(D,{type:u}),(0,a.tZ)(z,{type:u,pub:n,post:i,comment:c,shareUrl:d}),(0,a.tZ)(X.tu,{gap:16,children:(0,a.tZ)(W,(0,r._)((0,o._)({utm_campaign:null!==(t=this.state.utm_campaign)&&void 0!==t?t:void 0},this.props),{shareName:(0,S.B8)((0,o._)({},this.props)),shareUrl:d||(0,S.O1)(null,(0,o._)({medium:this.state.medium},this.props))}))})]})})})}constructor(e,t){super((0,o._)({},e),t),this.noFullscreen=!0}}(0,n._)(A,"contextType",x.wj);let D=e=>{let{type:t}=e,{iString:i}=(0,x.M1)();return(0,a.tZ)(R.xv.H4,{align:"center",flex:"grow",children:i(t?"Share this ".concat(t):"Share")})},z=e=>{let{type:t,pub:i,post:n,comment:o,shareUrl:r}=e;return(0,a.BX)(j,{post:n,children:["comment"==t&&o&&(0,a.tZ)(B.UK,{comment:o,readOnly:!0}),"post"==t&&n&&i&&(0,a.tZ)(I.tg,{post:n,publication:i,readOnly:!0}),"publication"==t&&i&&(0,a.tZ)(N.U,{publication:i,readOnly:!0}),void 0==t&&(0,a.tZ)(P.N,{url:r,readOnly:!0})]})},j=e=>{let{post:t,onChange:i,children:n}=e,o=(0,S.O1)(null,{medium:"web",post:t}),{handleCopyLink:r}=(0,S.Uo)();return(0,a.tZ)(X.tu,{as:"a",onClick:()=>{r({shareUrl:o}),null==i||i()},href:o,cursor:"pointer",animate:!0,gap:8,children:n})},H=e=>{let{onClick:t,icon:i,name:n}=e;return(0,a.tZ)(F.X,{onClick:t,label:n,icon:i,size:64,radius:"lg"})};function W(e){let{iString:t}=(0,x.M1)(),i=()=>{var t;null===(t=e.onChange)||void 0===t||t.call(e)},n=(0,a.BX)(a.HY,{children:[(0,a.tZ)(M.sN,{onClick:()=>{(0,S.bI)((0,o._)({},e)),i()},leading:(0,a.tZ)(h.Z,{}),children:"Bluesky"}),(0,a.tZ)(M.sN,{onClick:()=>{(0,S.Wn)((0,o._)({},e)),i()},leading:(0,a.tZ)(w.Z,{}),children:"X (Twitter)"}),!e.disableNotes&&(0,a.tZ)(M.sN,{onClick:()=>{(0,S.lc)((0,o._)({},e)),i()},leading:(0,a.tZ)(v.Z,{}),children:"LinkedIn"}),(0,a.tZ)(M.sN,{onClick:()=>{(0,S.sn)((0,o._)({},e)),i()},leading:(0,a.tZ)(y.Z,{}),children:"Reddit"}),(0,a.tZ)(M.sN,{onClick:()=>{(0,S.Vn)((0,o._)({},e)),i()},leading:(0,a.tZ)(_.Z,{}),children:"Pinterest"}),(0,a.tZ)(M.sN,{onClick:()=>{(0,S.b6)((0,o._)({},e)),i()},leading:(0,a.tZ)(g.Z,{}),children:"Hacker News"})]}),r={size:20,stroke:"var(--color-fg-primary)"},{handleCopyLink:s,justCopied:d}=(0,S.Uo)();return(0,a.BX)(X.gq,{justifyContent:"space-between",children:[(0,a.tZ)(H,{onClick:()=>{s((0,o._)({},e)),i()},icon:d?(0,a.tZ)(c.Z,(0,o._)({},r)):(0,a.tZ)(f.Z,(0,o._)({},r)),name:d?t("Copied"):t("Copy link")}),(0,a.tZ)(H,{onClick:()=>{(0,S.Po)((0,o._)({},e)),i()},icon:(0,a.tZ)(m.Z,(0,o._)({},r)),name:"Facebook"}),(0,a.tZ)(H,{onClick:()=>{(0,S.WZ)((0,o._)({},e)),i()},icon:(0,a.tZ)(b.Z,(0,o._)({},r)),name:"Email"}),e.disableNotes?(0,a.tZ)(H,{onClick:()=>{(0,S.lc)((0,o._)({},e)),i()},icon:(0,a.tZ)(v.Z,(0,o._)({},r)),name:"Linkedin"}):(0,a.tZ)(H,{onClick:()=>{(0,S.BZ)((0,o._)({},e)),i()},icon:(0,a.tZ)(Z.Z,(0,o._)({},r)),name:"Notes"}),(0,a.tZ)(M.v2,{layerOptions:{triggerOffset:-20},trigger:e=>{var{ref:i}=e,n=(0,l._)(e,["ref"]);return(0,a.tZ)(F.X,(0,o._)({forwardRef:i,label:t("More"),icon:(0,a.tZ)(u.Z,(0,o._)({},r)),size:64,radius:"lg"},n))},onOpen:()=>{(0,T.j)(T.FP.SHARE_DIALOG_MORE_OPTION_CLICKED,{medium:e.medium||"web",post_id:e.post?e.post.id:null,utm_campaign:e.utm_campaign||U.VX.default})},children:n})]})}},75697:function(e,t,i){i.d(t,{B8:()=>P,BZ:()=>x,I:()=>v,O1:()=>I,Po:()=>B,Ui:()=>w,Uo:()=>C,Vn:()=>Z,WZ:()=>S,Wn:()=>f,b6:()=>y,bI:()=>k,lc:()=>b,sn:()=>_});var n=i(7409),o=i(99282),r=i(16584),l=i(98661),a=i(95441),s=i(68833),d=i(59176),c=i(98914),u=i(70379),p=i(60308),h=i(33884),m=i(84864),g=i(47929);function v(e,t,i){let{shareUrl:r,post:l,pub:a,selectionId:c,utm_campaign:u,utm_medium:p,event:h=s.FP.SHARE_LINK_CLICKED,trackParams:m={}}=i;(0,s.j)(h,(0,n._)((0,o._)((0,n._)({name:e,post_id:l?l.id:null},c?{selection_id:c}:{}),{source:u,utm_medium:p}),m));let g=t(r);g&&"string"==typeof g&&(g.startsWith("http")?window.open(g,"_blank"):document.location.href=g),(0,d.ex)("".concat(null==a?void 0:a.subdomain," shared"),!0)}function f(e){let{pub:t,post:i,sharingSelfPub:n,shareName:o}=e,r=(null==t?void 0:t.twitter_screen_name)||t&&m.twitterScreenNames[t.subdomain],l=o;t&&n?l="I just started a Substack! You can subscribe to it here":(t&&!i&&(l="Subscribe to ".concat(l)),r&&(!i||t&&(!i.publishedBylines.length||i.publishedBylines.some(e=>e.id===t.author_id)))&&(l+=", by @".concat(r))),v("twitter",e=>(0,p.LaP)({url:e,text:l}),e)}function b(e){v("linkedin",e=>(0,p.n1t)("https://www.linkedin.com/sharing/share-offsite/",{url:e}),e)}function _(e){v("reddit",t=>(0,p.n1t)("https://www.reddit.com/submit/",{url:t,title:e.shareName}),e)}function y(e){v("hackernews",t=>(0,p.n1t)("https://news.ycombinator.com/submitlink",{url:t,title:e.shareName}),e)}function Z(e){v("pinterest",t=>(0,p.n1t)("https://www.pinterest.com/pin/create/button",{u:t,description:e.shareName}),e)}function w(e){v("copy",e=>((0,c.vQ)(e),!1),e)}function k(e){v("bluesky",t=>(0,p.xJ2)({text:"".concat(e.shareName,"\n").concat(t)}),e)}function C(){let e=(0,u.pm)(),{iString:t}=(0,a.M1)(),[i,s]=(0,l.useState)(!1);return{handleCopyLink:(0,l.useCallback)(i=>{w(i),e.popToast(e=>(0,r.tZ)(u.FN,(0,o._)((0,n._)({},e),{text:t("Copied link to clipboard")}))),s(!0),setTimeout(()=>s(!1),3e3)},[t,e]),justCopied:i}}function S(e){v("email",t=>(0,p.n1t)("mailto:",{subject:e.shareName,body:t}),e)}function x(e){v("notes",e=>(0,p.n1t)((0,h.TK)({message:e})),e)}function B(e){v("facebook",e=>(0,p.n1t)("https://www.facebook.com/sharer/sharer.php",{u:e}),e)}function P(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{post:t,pub:i,profile:n}=e;return t?t.title:i?i.name:n?"".concat(n.name," on Substack"):document.title}function I(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{pub:i,post:o,clip:r,comments:l,commentId:a,selectionId:s,profile:d,user:c,utm_campaign:u,medium:h,referral_token:v,useCustomDomainOverOpen:f,params:b}=t,_=(0,n._)({r:(null==c?void 0:c.id)?(0,m.userReferralKey)(c):v,selection:s,utm_campaign:u||(o?"post":d?"profile":i?"pub":r?"clip":"unknown"),utm_medium:h||g.lP.web,utm_source:e},{comments:null!=l&&!!l.length||void 0,commentId:a},r?{clipId:r.id}:{},b);return(null==i?void 0:i.subdomain)&&(null==o?void 0:o.slug)&&!r?(0,p.K8_)(i.subdomain,o.slug,{params:_,hostOverride:f&&i.custom_domain?(0,p.SVA)(i):null}):(0,p.n1t)("".concat(o?(0,p.uRy)(i,o,{comments:!!(null==l?void 0:l.length),commentId:a,clipId:null==r?void 0:r.id}):i?"".concat(i.base_url,"/"):"undefined"!=typeof window?window.location.href.split("?")[0]:""),_)}},50515:function(e,t,i){i.d(t,{J:()=>o}),i(27412),i(7409),i(99282),i(98848),i(16584);var n=i(6400);i(98914),i(84864);let o={"data-gramm":"false","data-gramm_editor":"false","data-enable-grammarly":"false"};n.Component},17381:function(e,t,i){i.d(t,{q:()=>Z});var n=i(16584),o=i(6400),r=i(67358),l=i(25380),a=i(68494),s=i(39535),d=i(20888),c=i(18582),u=i(3900),p=i(4211),h=i(87810),m=i(95441),g=i(33578),v=i(61264),f=i(19680),b=i(61254),_=i(19081),y=i(84864);let Z=e=>{var t,i,Z,w,k,C;let{author_id_or_slug:S,authorInfo:x,posts:B,pub:P,user:I,utm:N}=e,{authorInfo:T,posts:E}=(0,f.e)({author_id_or_slug:S,authorInfoPreload:x,postsPreload:B,pub:P}),{isSubscribedToAuthor:L,toggleSubscription:X,hasSection:M}=(0,h.l)(null!==(t=null==T?void 0:T.user_id)&&void 0!==t?t:0),{iString:R}=(0,m.M1)(),F=null!==(i=null==T?void 0:T.name)&&void 0!==i?i:"",U=null!==(Z=null==T?void 0:T.bio)&&void 0!==Z?Z:"",O=null!==(w=null==T?void 0:T.photo_url)&&void 0!==w?w:null,A=null!==(k=null==T?void 0:T.twitter_screen_name)&&void 0!==k?k:"",D=null!==(C=null==T?void 0:T.email)&&void 0!==C?C:"",z=(0,y.isDefaultMarblePhoto)(O)?void 0:O;return(0,n.tZ)(c.q,{belowDescription:(0,n.BX)(_.tu,{gap:16,children:[D&&(0,n.BX)(_.gq,{alignItems:"center",gap:8,children:[(0,n.tZ)(r.Z,{size:16}),(0,n.tZ)(p.Z,{preset:"body-link",children:(0,n.tZ)("a",{href:"mailto:".concat(D),children:D})})]}),A&&(0,n.BX)(_.gq,{alignItems:"center",gap:8,children:[(0,n.tZ)(s.Z,{size:16}),(0,n.tZ)(p.Z,{preset:"body-link",children:(0,n.tZ)("a",{href:"https://x.com/".concat(A),children:A})})]}),M&&(0,n.BX)(o.Fragment,{children:[(0,n.tZ)(b.iz,{paddingY:8}),(0,n.BX)(_.tu,{alignItems:"start",gap:16,children:[(0,n.tZ)(u._,{size:"sm",variant:"outline",onClick:X,children:L?(0,n.BX)(_.gq,{alignItems:"center",gap:8,children:[R("Notified")," ",(0,n.tZ)(l.Z,{size:16})]}):(0,n.BX)(_.gq,{alignItems:"center",gap:8,children:[R("Get Notified")," ",(0,n.tZ)(a.Z,{size:16})]})}),(0,n.tZ)(p.Z,{preset:"detail-small",children:R(L?"You'll be notified by email whenever this author publishes.":"Get notified by email whenever this author publishes.")})]})]})]}),bodyWrapperVariant:"two-middle-columns",description:null!=U?U:void 0,image:z?(0,n.tZ)(d.e,{maxWidth:400,src:z,style:{maxWidth:"100%"}}):void 0,isLoading:!T,title:F,children:T&&E&&(0,n.tZ)(g.O,{authorId:T.user_id,hideCommunity:!0,isPodcast:!1,newPosts:E,pub:P,renderLoading:()=>null,user:I,utm:N,children:e=>{let{posts:t}=e;return(0,n.tZ)(_.tu,{gap:24,children:t.map((e,t)=>(0,n.BX)(n.HY,{children:[0!==t&&(0,n.tZ)(b.iz,{}),(0,n.tZ)(v.X,{post:e,variant:"archive"})]}))})}})})}},3469:function(e,t,i){i.d(t,{_:()=>m,j:()=>g});var n=i(16584),o=i(59543),r=i(11712),l=i(20888),a=i(18582),s=i(89276),d=i(98422),c=i(15771),u=i(14773),p=i(17043),h=i(60836);let m={careers:{slug:"careers",title:(0,n.BX)("span",{children:["Join ",(0,n.tZ)("em",{children:"The Free Press"})]}),description:(0,n.BX)("span",{children:[(0,n.tZ)("em",{children:"The Free Press"})," is seeking exceptional people who share our values."]})},about:{slug:"about",title:(0,n.BX)("span",{children:["About",(0,n.tZ)("br",{}),(0,n.tZ)("em",{children:"The Free Press"})]}),description:"A new media company built on the ideals that were once the bedrock of American journalism."},"the-free-press-book-club":{slug:"the-free-press-book-club",title:"The Free Press Book Club",description:"Each month, one Free Press writer sits down with the author of a new, vital book. We’ve read and discussed novels, essay collections, political criticism, and more. Book club attendees get a copy of the book, an opportunity to ask questions, and to meet other Free Pressers.",image:(0,n.tZ)(l.e,{alt:"The Free Press Book Club",className:"image-sYkLIi",maxWidth:540,src:(0,p.zF)("".concat((0,u.ZJ)(),"/img/thefp/fp-book-club-cover.jpg"))})},"community-guidelines":{slug:"community-guidelines",title:"Community Guidelines",description:""}},g=e=>{let{pub:t,post:i,user:l,type:u,html:p}=e,g=m[u],{isMobile:v}=(0,d.v9)();if(!g)return null;let f=!!((null==l?void 0:l.is_contributor)&&(null==i?void 0:i.id)&&(null==i?void 0:i.type)==="page");return(0,n.tZ)(a.q,{aboveTitle:f&&(null==i?void 0:i.id)?(0,n.tZ)(c.zx,{href:(0,h.AN)(t,i.id,{params:{back:document.location.href}}),leading:(0,n.tZ)(o.Z,{size:20}),localNavigation:!1,priority:"secondary",children:"Edit"}):null,description:g.description,image:g.image,title:g.title,children:(0,n.tZ)("div",{className:"typography post",children:(0,n.tZ)("div",{className:v?"":"container",children:(0,n.tZ)(s.j,{isCustomPage:!0,children:(0,n.tZ)(r.Z,{html:p,isAboutPage:!1,pub:t,user:l})})})})})}},22523:function(e,t,i){i.d(t,{N:()=>c});var n=i(16584),o=i(44846),r=i(18582),l=i(3469),a=i(1455),s=i(98130),d=i(63651);let c=e=>{let{pub:t,user:i}=e,{initialSections:c}=(0,s.L)({pub:t}),{title:u,description:p}=l._["the-free-press-book-club"],h={title:u,imageUrl:"".concat((0,d.ZJn)(),"/img/thefp/fp-book-club-cover.jpg"),description:p,url:"/p/the-free-press-book-club"},m=c.map(e=>({title:e.name,imageUrl:e.logo_url,description:e.description,url:(0,d.Ucy)(t,{section:e})}));return(0,n.tZ)(r.q,{actions:(0,n.tZ)(o.r,{pub:t,sectionType:"event",user:null!=i?i:null}),description:(0,n.BX)(n.HY,{children:["Find out about our upcoming live events or watch recordings of the ones you couldn’t make it to in person. Our past events include monthly book clubs and our ",(0,n.tZ)("em",{children:"America Debates"})," series, which tackled immigration, crime and punishment, foreign policy, and the American dream. Sign up for alerts to get tickets for Free Press events at ",(0,n.tZ)("a",{href:"https://thefp.com/newsletters",children:"thefp.com/newsletters"}),"."]}),title:"Events",children:(0,n.tZ)(a.x,{hideViewAllCta:!0,items:[...m,h]})})}},78180:function(e,t,i){i.d(t,{a:()=>a});var n=i(16584),o=i(18582),r=i(40281),l=i(33578);let a=e=>{let{pub:t,user:i,newPostsForArchive:a,metadata:s,utm:d}=e;return(0,n.tZ)(o.q,{bodyWrapperVariant:"two-middle-columns",metadata:s,title:"Latest",children:(0,n.tZ)(l.O,{hideCommunity:!0,hideTop:!0,newPosts:null==a?void 0:a.pub,pub:t,renderLoading:()=>null,source:"archive",user:i,utm:d,children:e=>{let{posts:t}=e;return(0,n.tZ)(r.f,{posts:t})}})})}},87047:function(e,t,i){i.d(t,{T:()=>el});var n=i(16584),o=i(30396),r=i(80569),l=i.n(r),a=i(29032),s=i(347),d=i(10120),c=i(84967),u=i(7409),p=i(99282),h=i(98848),m=i(98661),g=i(94184),v=i.n(g),f=i(14945),b=i(4211),_=i(15771),y=i(19081),Z=i(22347),w=i(73909);let k=(0,m.forwardRef)((e,t)=>{var{className:i,value:o}=e,r=(0,h._)(e,["className","value"]);return(0,n.tZ)(b.Z,(0,p._)((0,u._)({},r),{as:"textarea",className:v()(i,w.Z.textarea),innerRef:t,preset:"list-item-menu",value:o}))}),C=(0,m.forwardRef)((e,t)=>{var{className:i,flex:o,liveStream:r,onSend:l}=e,a=(0,h._)(e,["className","flex","liveStream","onSend"]);return(0,n.BX)(y.tu,{flex:o,position:"relative",children:[(0,n.tZ)(k,(0,p._)((0,u._)({},a),{ref:t,className:v()(i,w.Z.textareaWithIcon)})),(0,n.BX)(y.gq,{className:w.Z.iconContainer,position:"absolute",children:[(0,n.tZ)(Z.d,{liveStream:r}),(0,n.tZ)(_.hU,{priority:"quaternary",onClick:()=>{l()},children:(0,n.tZ)(f.Z,{})})]})]})});var S=i(76317),x=i(98422);let B=e=>{let{isMinimized:t,liveStream:i,onMaximizeChat:r}=e,{isMobile:l,isMobileLandscape:a}=(0,x.v9)(),s=(0,o.sO)(null),{message:d,setMessage:u,loading:p,sendMessage:h}=(0,S.w)({inputRef:s,liveStream:i}),m=async()=>{await h(),t&&r()},g=async e=>{"Enter"===e.key&&await m()};return(0,n.BX)(y.tu,{flex:"grow",children:[t&&(0,n.BX)(y.gq,{alignItems:"center",borderBottom:"detail",borderTop:l?"detail":void 0,cursor:"pointer",justifyContent:"space-between",paddingX:24,paddingY:16,onClick:r,children:[(0,n.tZ)(b.Z,{preset:"d1-sans-medium",children:"Live Chat"}),(0,n.tZ)(c.Z,{})]}),(0,n.tZ)(y.tu,{flex:l||a?void 0:"grow",paddingX:24,paddingY:l||a?24:t?16:24,children:(0,n.tZ)(C,{ref:s,disabled:p,flex:"grow",liveStream:i,placeholder:"Write message...",rows:l||a||t?1:3,style:{flexGrow:1},value:d,onChange:e=>{u(e.currentTarget.value)},onKeyDown:g,onSend:m})})]})};var P=i(49336),I=i(73674);let N=e=>{let{headerHeight:t,liveStream:i,onMinimizeChat:o}=e;return(0,n.BX)(y.tu,{flex:"grow",children:[(0,n.BX)(y.gq,{alignItems:"center",borderBottom:"detail",cursor:"pointer",justifyContent:"space-between",paddingX:24,paddingY:t?void 0:16,style:t?{height:t}:void 0,onClick:o,children:[(0,n.tZ)(b.Z,{preset:"d1-sans-medium",children:"Live Chat"}),(0,n.tZ)(P.Z,{})]}),(0,n.tZ)(y.tu,{flex:"grow",position:"relative",children:(0,n.tZ)(I.hk,{liveStream:i})})]})};var T=i(67747),E=i(62372),L=i(40034),X=i(61594),M=i(63651),R=i(47929);let F=e=>{let{liveStream:t,pub:i,viewerCount:o}=e,[r,l]=(0,E.XI)(),{isMobile:a}=(0,x.v9)(),s=(0,n.BX)(y.tu,{gap:8,children:[(0,n.tZ)(b.Z,{clamp:1,preset:"h5-serif",children:t.liveStream.title}),t.liveStream.description&&(0,n.tZ)(b.Z,{clamp:2,preset:"d3-serif",children:t.liveStream.description})]}),d=(0,n.BX)(y.gq,{alignItems:"center",gap:8,children:[(0,n.tZ)("div",{className:"liveTag-MsSGA4",children:(0,n.tZ)(b.Z,{preset:"detail-large",children:"Live"})}),(0,n.BX)(y.gq,{alignItems:"center",gap:8,children:[(0,n.tZ)(T.Z,{}),(0,n.tZ)(b.Z,{preset:"detail-small",children:o})]})]}),c=(0,n.tZ)(X.u,{menuPlacement:"top-center",shareName:t.liveStream.title,shareUrl:(0,M.thY)({pub:i,utm_source:R.b3.liveStreamShareButton}),trackParams:{live_stream_id:t.liveStream.id},trigger:(0,n.tZ)(y.gq,(0,p._)((0,u._)({},l),{alignItems:"center",cursor:"pointer",children:(0,n.tZ)(L.Z,{height:24,isHovered:r,width:24})})),utmCampaign:R.VX.liveStreamPermalink});return a?(0,n.BX)(y.tu,{gap:24,paddingX:28,paddingY:16,children:[(0,n.BX)(y.gq,{alignItems:"center",gap:8,justifyContent:"space-between",children:[d,c]}),s]}):(0,n.BX)(y.gq,{alignItems:"start",gap:24,justifyContent:"space-between",paddingX:24,paddingY:24,children:[s,(0,n.BX)(y.gq,{alignItems:"center",gap:24,children:[d,c]})]})};var U=i(3900);let O=e=>{let{user:t,subscribeUrl:i}=e;return(0,n.BX)(y.tu,{gap:40,children:[(0,n.BX)(y.tu,{alignItems:"center",gap:8,children:[(0,n.tZ)(b.Z,{align:"center",preset:"h4-sans-condensed",children:"Stream Ended"}),(0,n.tZ)(b.Z,{align:"center",preset:"d1-sans-regular",children:(null==t?void 0:t.is_subscribed)?"Thanks for watching!":"".concat((null==t?void 0:t.is_free_subscribed)?"Upgrade":"Subscribe"," to watch the next live stream")})]}),(0,n.BX)(y.tu,{alignItems:"stretch",alignSelf:"stretch",gap:8,children:[(null==t?void 0:t.is_subscribed)?(0,n.tZ)(U._,{href:"/videos",variant:"outline",children:"Watch More"}):(0,n.tZ)(U._,{href:i,native:!0,variant:"primary-accent",children:(null==t?void 0:t.is_free_subscribed)?"Upgrade":"Subscribe"}),(0,n.tZ)(U._,{href:"/",variant:"tertiary",children:"Back to Homepage"})]})]})};var A=i(71375),D=i(43141);let z=e=>{let{closeHref:t,height:i,user:o,subscribeUrl:r}=e,{isMobile:l,isMobileLandscape:a}=(0,x.v9)();return(0,n.BX)(y.gq,{alignItems:"center",borderBottom:"detail",className:"container-j8poGw",justifyContent:"space-between",paddingLeft:24,paddingRight:16,paddingY:i?void 0:l?12:16,style:i?{height:i}:void 0,children:[(0,n.tZ)(D.h,{forceMobile:l||a,height:56}),(0,n.BX)(y.gq,{alignItems:"center",gap:16,children:[!(null==o?void 0:o.is_subscribed)&&(0,n.tZ)(U._,{href:r,native:!0,size:a?"sm":l?"md":"lg",trailingIcon:"plus",variant:"primary-accent",children:(null==o?void 0:o.is_free_subscribed)?"Upgrade":"Subscribe"}),(0,n.tZ)(_.hU,{href:t,priority:"quaternary",children:(0,n.tZ)(A.Z,{})})]})]})};var j=i(8746),H=i(38465),W=i(14773);let q=e=>{let{liveStream:t,pub:i,subscribeUrl:r,user:l}=e,{isMobile:a,isMobileLandscape:s}=(0,x.v9)(),[c,u]=(0,o.eJ)(a),p=(0,d.r)(),h=!!p.active,{viewerCount:m}=(0,S.d)({liveStream:t}),g={chatComposer:t?(0,n.tZ)(B,{isMinimized:c,liveStream:t,onMaximizeChat:()=>{u(!1)}}):null,chatFeed:t?(0,n.tZ)(N,{headerHeight:s?58:void 0,liveStream:t,onMinimizeChat:()=>u(!0)}):null,details:t?(0,n.tZ)(F,{liveStream:t,pub:i,viewerCount:m}):null,header:(0,n.tZ)(z,{closeHref:(0,W.SV)(i),height:s?58:void 0,subscribeUrl:r,user:l}),mainContent:t?t.liveStreamInformation.desktopPlaybackUrl?(0,n.tZ)(H.P,{disableZoom:!0,handle:p,liveStream:t}):(0,n.tZ)(H.r,{liveStream:t}):(0,n.tZ)(O,{subscribeUrl:r,user:l})};return(0,n.tZ)(y.tu,{bg:"primary",color:"primary",style:{height:"100vh"},children:(0,n.tZ)(d.I,{handle:p,children:(0,n.tZ)(s?K:a?V:Y,{isChatMinimized:c,isFullScreen:h,livestream:t,pageElements:g})})})},Y=e=>{var t;let{isChatMinimized:i,isFullScreen:r,livestream:l,pageElements:a}=e,s=(0,o.sO)(null),{width:d,height:c}=(0,j.y)({containerRef:s,defaultWidth:600}),u=16/9;if(null==l?void 0:null===(t=l.liveStreamInformation.aspectRatio)||void 0===t?void 0:t.includes(":")){let[e,t]=l.liveStreamInformation.aspectRatio.split(":").map(Number);e&&t&&(u=e/t)}let p=c*u>d?d:c*u;return(0,n.BX)(y.tu,{alignItems:"stretch",style:{height:"100vh"},children:[!r&&a.header,(0,n.BX)(y.gq,{alignItems:"stretch",flex:"grow",children:[(0,n.tZ)(y.tu,{flex:"grow",position:"relative",children:(0,n.tZ)(y.tu,{ref:s,alignItems:"center",bg:"black",inset:0,justifyContent:"center",position:"absolute",children:(0,n.tZ)(y.gq,{justifyContent:"center",position:"relative",style:{width:p},children:a.mainContent})})}),a.chatFeed&&(0,n.tZ)(y.tu,{borderLeft:"detail",style:{width:400,display:i||r?"none":void 0},children:a.chatFeed})]}),a.details&&(0,n.BX)(y.gq,{borderTop:"detail",style:{height:164,display:r?"none":void 0},children:[(0,n.tZ)(y.tu,{flex:"grow",children:a.details}),(0,n.tZ)(y.tu,{borderLeft:"detail",style:{width:400},children:a.chatComposer})]})]})},V=e=>{let{isChatMinimized:t,isFullScreen:i,pageElements:o}=e;return(0,n.BX)(y.tu,{alignItems:"stretch",style:{height:"100vh"},children:[!i&&o.header,(0,n.tZ)(y.tu,{bg:"black",flex:t?"grow":void 0,justifyContent:"center",children:(0,n.tZ)(y.gq,{justifyContent:"center",position:"relative",children:o.mainContent})}),o.chatFeed&&(0,n.tZ)(y.tu,{borderTop:"detail",flex:"grow",style:{display:t||i?"none":void 0},children:o.chatFeed}),o.details&&(0,n.BX)(y.tu,{borderTop:"detail",style:{display:i?"none":void 0},children:[t&&(0,n.tZ)(y.tu,{flex:"grow",children:o.details}),o.chatComposer]})]})},K=e=>{let{pageElements:t}=e;return(0,n.tZ)(y.gq,{alignItems:"stretch",style:{height:"100vh"},children:(0,n.tZ)(y.tu,{flex:"grow",children:(0,n.tZ)(y.tu,{bg:"black",flex:"grow",justifyContent:"center",children:(0,n.tZ)(y.gq,{position:"relative",children:t.mainContent})})})})};var J=i(13561),G=i(60308);let Q=e=>{let{isOpen:t,pub:i,subscribeUrl:o,user:r}=e;return(0,n.tZ)(J.A,{hideCloseButton:!0,isOpen:t,children:(0,n.BX)(y.tu,{gap:24,children:[(0,n.BX)(y.tu,{gap:16,children:[(0,n.tZ)(b.Z,{align:"center",preset:"h5-sans",children:"Unlock Livestream Access"}),(0,n.tZ)(b.Z,{align:"center",preset:"d2-serif",children:"We’re proud to offer livestreams as an exclusive benefit for our paid subscribers. Sign up to watch live events and never miss a moment."})]}),(0,n.BX)(y.tu,{alignItems:"center",gap:16,children:[(0,n.BX)(U._,{href:o,native:!0,children:[(null==r?void 0:r.is_free_subscribed)?"Upgrade":"Subscribe"," Today"]}),(0,n.BX)(y.gq,{alignItems:"center",gap:16,children:[(0,n.tZ)(b.Z,{preset:"caption",children:"Already a subscriber?"}),(0,n.tZ)(b.Z,{as:"a",color:"accent",href:(0,G.W1P)(i,{isSignInAttempt:!0}),preset:"caption",children:"Switch Accounts"})]})]}),(0,n.tZ)(y.tu,{alignItems:"center",children:(0,n.tZ)(U._,{href:(0,G.SVA)(i),size:"sm",variant:"tertiary",children:"Back to Homepage"})})]})})};var $=i(33636),ee=i(40281),et=i(14617),ei=i(61254);let en=e=>{var t;let{livestreamPageData:i,pub:o,subscribeUrl:r,user:l}=e,{scheduledLiveStreams:a,pastLiveStreamPosts:s,pastLiveStreamSectionId:d}=i,c=null!==(t=o.sections.find(e=>e.id===d))&&void 0!==t?t:null;return(0,n.BX)(y.tu,{bg:"primary",color:"primary",style:{height:"100vh"},children:[(0,n.tZ)(z,{closeHref:(0,M.SVA)(o),subscribeUrl:r,user:l}),(0,n.tZ)(y.tu,{flex:"grow",overflow:"auto",paddingX:28,paddingY:40,children:(0,n.BX)(y.tu,{className:"container-sckr5Y",gap:24,children:[(0,n.tZ)($.L,{children:"Upcoming livestreams"}),a.map((e,t)=>(0,n.BX)(n.HY,{children:[0!==t&&(0,n.tZ)(ei.iz,{}),(0,n.tZ)(et.I,{liveStream:e})]})),(0,n.tZ)(ei.iz,{}),(0,n.tZ)($.L,{children:"Past livestreams"}),(0,n.tZ)(ee.f,{posts:s}),c&&(0,n.tZ)(U._,{href:(0,M.Ucy)(o,{section:c}),variant:"outline",children:"Watch more"})]})})]})};var eo=i(64900),er=i(68648);let el=e=>{var t,i;let{liveStream:r,livestreamPageData:d,pub:c,user:u}=e,{activeLiveStream:p}=(0,eo.H)({preloadedLiveStream:r,pub:c}),[h,m]=(0,o.eJ)(null!=d?d:null),g=(0,G.Zs0)(c,{simple:!0,next:document.location.href,utm_source:R.b3.publicationLiveStream,utm_medium:R.lP.web,utm_content:null!==(i=null==p?void 0:null===(t=p.liveStream)||void 0===t?void 0:t.id)&&void 0!==i?i:null}),v=(null==p?void 0:p.liveStream.status)==="active"&&!(null==p?void 0:p.liveStreamInformation.desktopPlaybackUrl),f=h&&h.scheduledLiveStreams.length>0&&!p;return(0,o.d4)(()=>{let e=async()=>(await l().get("/livestream/data")).body;d||e().then(m)},[d]),(0,n.tZ)(er.hV,{pub:c,user:u,children:(0,n.tZ)("div",{className:"the-free-press-theme",children:(0,n.BX)(s.h,{children:[(0,n.tZ)(Q,{isOpen:v,pub:c,subscribeUrl:g,user:u}),(0,n.tZ)(a.C,{children:f?(0,n.tZ)(en,{livestreamPageData:h,pub:c,subscribeUrl:g,user:u}):(0,n.tZ)(q,{liveStream:p,pub:c,subscribeUrl:g,user:u})})]})})})}},1455:function(e,t,i){i.d(t,{x:()=>f});var n=i(7409),o=i(99282),r=i(16584),l=i(94184),a=i.n(l),s=i(62372),d=i(20888),c=i(3900),u=i(4211),p=i(49688),h=i(98422),m=i(61254),g=i(19081);let v={container:"container-F6lwXo",itemImage:"itemImage-xOyOyH",itemImageHoverOverlay:"itemImageHoverOverlay-Q1cWQy",itemImageMobile:"itemImageMobile-Q0peCf",itemBodyMobile:"itemBodyMobile-pajlxB"},f=e=>{let{hasMarkdownDescriptions:t,hideViewAllCta:i,items:n,showDescriptionOnMobile:o,viewAllLabel:l="View all episodes",justifyViewAllLabel:a="center",applyHoverOnTitle:s=!0}=e,{isMobile:d}=(0,h.v9)();return(0,r.tZ)("div",{children:d?(0,r.tZ)(g.tu,{gap:24,children:n.map((e,n)=>(0,r.BX)(r.HY,{children:[0!==n&&(0,r.tZ)(m.iz,{}),(0,r.tZ)(b,{applyHoverOnTitle:s,hasMarkdownDescriptions:t,hideViewAllCta:i,item:e,justifyViewAllLabel:a,showDescriptionOnMobile:o,viewAllLabel:l})]}))}):(0,r.tZ)("div",{className:v.container,children:n.map(e=>(0,r.tZ)(b,{applyHoverOnTitle:s,hasMarkdownDescriptions:t,hideViewAllCta:i,item:e,justifyViewAllLabel:a,viewAllLabel:l}))})})},b=e=>{let{hasMarkdownDescriptions:t,hideViewAllCta:i,item:l,showDescriptionOnMobile:m,viewAllLabel:f,justifyViewAllLabel:b="center",applyHoverOnTitle:_=!0}=e,{isMobile:y}=(0,h.v9)(),[Z,w]=(0,s.XI)(),{markdownProps:k}=(0,p.V)(l.description),C=t?(0,r.tZ)(u.Z,(0,o._)((0,n._)({},k),{clamp:3,preset:"d3-serif"})):(0,r.tZ)(u.Z,{clamp:3,preset:"d3-serif",children:l.description});return(0,r.tZ)("a",{href:l.url,style:{textDecoration:"none"},children:y?(0,r.BX)(g.gq,{gap:24,children:[(0,r.tZ)(g.tu,{className:v.itemImageMobile,flex:"auto",children:l.imageUrl&&(0,r.tZ)(d.e,{className:v.itemImage,maxWidth:100,src:l.imageUrl})}),(0,r.BX)(g.tu,{className:v.itemBodyMobile,gap:8*!!m,justifyContent:m?"start":"space-between",children:[(0,r.tZ)(u.Z,{preset:"h5-serif",children:l.title}),m&&l.description&&C,!i&&(0,r.tZ)(c._,{justifyContent:b,size:"md",trailingIcon:"chevron-right",variant:"tertiary",children:f})]})]}):(0,r.BX)(g.tu,{className:v.itemContainer,cursor:"pointer",gap:16,children:[l.imageUrl&&(0,r.BX)(g.tu,(0,o._)((0,n._)({},w),{position:"relative",children:[(0,r.tZ)(d.e,{className:v.itemImage,maxWidth:350,src:l.imageUrl}),(0,r.tZ)("div",{className:a()({[v.itemImageHoverOverlay]:Z})})]})),(0,r.BX)(g.tu,{gap:8,children:[(0,r.tZ)(u.Z,(0,o._)((0,n._)({},_?w:{}),{color:Z?"accent":"primary",preset:"h5-serif",children:l.title})),C,!i&&(0,r.tZ)(c._,{justifyContent:b,size:"md",trailingIcon:"chevron-right",variant:"tertiary",width:"auto",children:f})]})]})})}},79344:function(e,t,i){i.d(t,{F:()=>f});var n=i(58865),o=i(16584),r=i(94184),l=i.n(r),a=i(25380),s=i(68494),d=i(3900),c=i(87810),u=i(95441),p=i(19081),h=i(70379);let m={notifyButton:"notifyButton-lmtipU",hoverText:"hoverText-TwVQuR",notifyButtonInternal:"notifyButtonInternal-e4KibS"};function g(){let e=(0,n._)(["You'll no longer be notified when this author publishes."]);return g=function(){return e},e}function v(){let e=(0,n._)(["You'll be notified by email whenever this author publishes."]);return v=function(){return e},e}let f=e=>{let{authorId:t,className:i}=e,{popToast:n}=(0,h.pm)(),{iTemplate:r}=(0,u.M1)(),{isSubscribedToAuthor:f,toggleSubscription:b}=(0,c.l)(t);return(0,o.tZ)(d._,{className:l()(m.notifyButton,i),"data-subscribed":f,size:"sm",variant:"outline",onClick:async e=>{e.preventDefault(),e.stopPropagation(),await b(),n(()=>(0,o.tZ)(h.FN,{text:f?r(g()):r(v())}))},onMouseOver:e=>{e.stopPropagation()},children:(0,o.tZ)(p.gq,{alignItems:"center",className:m.notifyButtonInternal,gap:0,justifyContent:"space-between",position:"relative",children:f?(0,o.BX)(o.HY,{children:[(0,o.tZ)("div",{className:l()(m.hoverText),children:"Notified"}),(0,o.tZ)(a.Z,{size:16})]}):(0,o.BX)(o.HY,{children:[(0,o.tZ)("div",{className:l()(m.hoverText),children:"Get Notified"}),(0,o.tZ)(s.Z,{size:16})]})})})}},58676:function(e,t,i){i.d(t,{L:()=>p});var n=i(16584),o=i(89734),r=i.n(o),l=i(44846),a=i(18582),s=i(1455),d=i(87725),c=i(55480),u=i(60308);let p=e=>{let{pub:t,user:i}=e,{ids:o}=(0,d.F)({pub:t}),p=(0,c.EP)(t).filter(e=>!!e.sectionId),h=r()(p,e=>{var t;return o.indexOf(null!==(t=e.sectionId)&&void 0!==t?t:-1)}).map(e=>{var i;return{title:e.podcastTitle,imageUrl:e.artUrl,description:e.description,url:(0,u.UVC)({pub:t,section:e.sectionId&&null!==(i=t.sections.find(t=>t.id===e.sectionId))&&void 0!==i?i:null,addBase:!1})}});return(0,n.tZ)(a.q,{actions:(0,n.tZ)(l.r,{pub:t,sectionType:"podcast",user:null!=i?i:null}),description:(0,n.BX)(n.HY,{children:["Stories you won’t hear anywhere else, conversations with the most fascinating people in the country, and deeper looks into the most talked-about stories of the day. At ",(0,n.tZ)("em",{children:"The Free Press"}),", nothing is off-limits. Listen to our flagship podcast ",(0,n.tZ)("em",{children:"Honestly with Bari Weiss"}),", straight talk about raising kids with Professor Emily Oster, and our series with J.K. Rowling, where we cover everything from book bans to debates on gender."]}),title:"Podcasts",children:(0,n.tZ)(s.x,{items:h})})}},40281:function(e,t,i){i.d(t,{I:()=>p,f:()=>u});var n=i(16584),o=i(58319),r=i(61264),l=i(61254),a=i(19081),s=i(98248),d=i(14773),c=i(17043);let u=e=>{let{isEvents:t,posts:i}=e;return(0,n.tZ)(a.tu,{gap:24,children:i.map((e,i)=>(0,n.BX)(n.HY,{children:[0!==i&&(t?(0,n.BX)(a.gq,{alignItems:"center",gap:24,paddingY:16,children:[(0,n.tZ)(a.gq,{flex:"grow",children:(0,n.tZ)(l.iz,{})}),(0,n.tZ)("img",{src:(0,c.zF)("".concat((0,d.ZJ)(),"/img/thefp/fp-stars.svg"),154)}),(0,n.tZ)(a.gq,{flex:"grow",children:(0,n.tZ)(l.iz,{})})]}):(0,n.tZ)(l.iz,{})),(0,n.tZ)(r.X,{post:e,variant:t?"event-page":"archive"})]}))})},p=e=>{let{isLoading:t,noMorePosts:i,posts:r,onLoadMore:l}=e;return(0,n.BX)(a.tu,{gap:24,children:[(0,n.tZ)(u,{posts:r}),t&&(0,n.tZ)(a.gq,{justifyContent:"center",children:(0,n.tZ)(s.$j,{})}),!!r.length&&!t&&!i&&(0,n.tZ)(o.Z,{threshold:0,onVisible:()=>{l()}})]})}},61612:function(e,t,i){i.d(t,{N:()=>r});var n=i(16584),o=i(18582);let r=()=>(0,n.BX)(o.q,{description:(0,n.BX)("span",{children:["The Free Press reads. A lot. We're constantly running reviews, excerpts, and columns from our favorite authors.",(0,n.tZ)("br",{}),(0,n.tZ)("br",{}),"When we mention a book on our site, we make sure to link to it so that you can get the book, and go deeper. Of course, we mention tons of books: old ones, new ones, ones we agree with, ones we can't stand. You'll find them all below. When you purchase them through our site, we may earn an affiliate commission."]}),title:"What We’re Reading",children:[(0,n.BX)("div",{children:[(0,n.tZ)("script",{"data-list-slug":"pick-of-the-month","data-type":"list",src:" https://bookshop.org/widgets.js "}),(0,n.tZ)("script",{"data-list-slug":"previous-picks-of-the-month","data-type":"list",src:"https://bookshop.org/widgets.js"}),(0,n.tZ)("script",{"data-list-slug":"reader-recommendations","data-type":"list",src:"https://bookshop.org/widgets.js"}),(0,n.tZ)("script",{"data-list-slug":"politics-the-free-press","data-type":"list",src:"https://bookshop.org/widgets.js"})]}),(0,n.tZ)("div",{class:"bookshop__slider",children:(0,n.tZ)("script",{"data-list-slug":"culture-the-free-press","data-type":"list",src:"https://bookshop.org/widgets.js"})}),(0,n.tZ)("div",{class:"bookshop__slider",children:(0,n.tZ)("script",{"data-list-slug":"history-the-free-press","data-type":"list",src:"https://bookshop.org/widgets.js"})}),(0,n.tZ)("div",{class:"bookshop__slider",children:(0,n.tZ)("script",{"data-list-slug":"science-medicine","data-type":"list",src:"https://bookshop.org/widgets.js"})}),(0,n.tZ)("div",{class:"bookshop__slider",children:(0,n.tZ)("script",{"data-list-slug":"tech-the-free-press","data-type":"list",src:"https://bookshop.org/widgets.js"})}),(0,n.tZ)("div",{class:"bookshop__slider",children:(0,n.tZ)("script",{"data-list-slug":"memoir-biography-the-free-press","data-type":"list",src:"https://bookshop.org/widgets.js"})}),(0,n.tZ)("div",{class:"bookshop__slider",children:(0,n.tZ)("script",{"data-list-slug":"parenting-the-free-press","data-type":"list",src:"https://bookshop.org/widgets.js"})}),(0,n.tZ)("div",{class:"bookshop__slider",children:(0,n.tZ)("script",{"data-list-slug":"religion-the-free-press","data-type":"list",src:"https://bookshop.org/widgets.js"})})]})},99084:function(e,t,i){i.d(t,{$:()=>H});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(80569),s=i.n(a),d=i(347),c=i(44846),u=i(81451),p=i(40281),h=i(50225),m=i(29032),g=i(3900),v=i(4211),f=i(56743),b=i(2564),_=i(8746),y=i(98422),Z=i(72019),w=i(63651);let k=892/346,C=16/9,S=510/892,x=e=>{let{currentIndex:t,posts:i,pub:n,setCurrentIndex:o}=e,{isMobile:a}=(0,y.v9)(),s=(0,l.sO)(null),{width:d}=(0,_.y)({containerRef:s}),c=a?d-56:d*S,[u,p]=(0,l.eJ)({currentIndex:t,targetIndex:null,stage:null,direction:null}),h=!!u.stage,m=e=>{let{targetIndex:i,direction:n}=e;p({currentIndex:t,targetIndex:i,stage:"prepare",direction:n}),requestAnimationFrame(()=>{p({currentIndex:t,targetIndex:i,stage:"animate",direction:n}),setTimeout(()=>{o(i)},150),setTimeout(()=>{p({currentIndex:i,targetIndex:null,stage:null,direction:null})},300)})},g=()=>{!h&&m({targetIndex:(t+i.length-1)%i.length,direction:"previous"})},v=()=>{!h&&m({targetIndex:(t+1)%i.length,direction:"next"})};return(0,r.BX)("div",{ref:s,className:"outerContainer-_EB7WB",style:{height:a?(d-56)/C:d/k},children:[(0,r.tZ)("div",{className:"innerTrack-Kj4zL_",children:i.map((e,t)=>{let o=B({animationState:u,panelIndex:t,numPanels:i.length}),l=a?N({panelOffset:o,imageWidth:c}):I({panelOffset:o,containerWidth:d,imageWidth:c}),s="animate"===u.stage?"all ".concat(300,"ms ease"):"none";return(0,r.tZ)("a",{className:"panel-Y2mj7O",href:(0,w.uRy)(n,e,{noBase:!0}),style:{width:c,transform:"translateY(-50%) translateX(".concat(l.translate,"px) scale(").concat(l.scale,")"),display:l.display,transition:s,opacity:l.opacity},onClick:e=>{0!==o&&(e.preventDefault(),e.stopPropagation(),1===o?v():g())},children:(0,r.tZ)(Z.P,{className:"videoPostImage-dwXmpQ",disableVideoHover:!0,disableVideoHoverFade:!0,imageAspectRatio:16/9,imageWidth:1e3,isBelowTheFold:!1,post:e,videoPlayIconVariant:"red-circle"})},e.id)})}),(0,r.tZ)("div",{className:"previousBackground-l9aBt9",onClick:g,children:(0,r.tZ)(f.Z,{color:"white",size:a?18:32,strokeWidth:1.5})}),(0,r.tZ)("div",{className:"nextBackground-_36RTD",onClick:v,children:(0,r.tZ)(b.Z,{color:"white",size:a?18:32,strokeWidth:1.5})})]})},B=e=>{let{animationState:t,panelIndex:i,numPanels:n}=e,{currentIndex:o,targetIndex:r,stage:l,direction:a}=t,s=P({from:"animate"===l?null!=r?r:0:o,to:i,size:n});return null===l?[-1,0,1].includes(s)?s:null:[-1,0,1].includes(s)?s:"prepare"===l?"next"===a?2:-2:"next"===a?-2:2},P=e=>{let{from:t,to:i,size:n}=e,o=(i-t+n)%n;return o>n/2&&(o-=n),o},I=e=>{let{panelOffset:t,containerWidth:i,imageWidth:n}=e;return null===t?{translate:0,scale:0,display:"none",opacity:0}:{translate:.5*i-.5*n+t*(.5*n+.3*n+24),scale:0===t?1:.6,display:"block",opacity:0===t?1:.5}},N=e=>{let{panelOffset:t,imageWidth:i}=e;return null===t?{translate:0,scale:0,display:"none",opacity:0}:{translate:28+t*(i+14),scale:1,display:"block",opacity:0===t?1:.5}};var T=i(19081);let E={header:"header-MeQvZM",headerContents:"headerContents-XMY0rT"},L=e=>{var t,i;let{hasActiveLiveStream:n,posts:o,pub:a}=e,{isMobile:s,isDesktop:d}=(0,y.v9)(),[c,p]=(0,l.eJ)(0),h=69+(n&&!d?62:0),g=null==o?void 0:o[c],f=(null==g?void 0:g.section_id)&&null!==(i=null===(t=a.sections)||void 0===t?void 0:t.find(e=>e.id===g.section_id))&&void 0!==i?i:null;return(0,r.tZ)(m.C,{children:(0,r.tZ)("div",{className:E.header,style:{paddingTop:h,marginTop:-h},children:(0,r.tZ)(T.tu,{paddingY:s?40:64,children:(0,r.tZ)(u.x,{children:s?(0,r.BX)(T.tu,{children:[(0,r.tZ)(T.tu,{paddingBottom:20,children:(0,r.tZ)(v.Z,{color:"white",preset:"h1-serif",children:"Video Series"})}),(0,r.tZ)(T.tu,{paddingBottom:36,children:(0,r.tZ)(x,{currentIndex:c,posts:o?o.slice(0,4):[],pub:a,setCurrentIndex:p})}),(0,r.tZ)(T.tu,{children:g&&(0,r.tZ)(X,{post:g,pub:a,section:f})})]}):(0,r.BX)(T.tu,{gap:16,children:[(0,r.tZ)(v.Z,{color:"white",preset:"h1-serif",children:"Videos"}),(0,r.BX)("div",{className:E.headerContents,children:[(0,r.tZ)(T.tu,{children:g&&(0,r.tZ)(X,{post:g,pub:a,section:f})}),(0,r.tZ)(x,{currentIndex:c,posts:o?o.slice(0,4):[],pub:a,setCurrentIndex:p})]})]})})})})})},X=e=>{let{post:t,pub:i,section:n}=e,o=(0,w.uRy)(i,t,{noBase:!0});return(0,r.BX)(T.tu,{gap:16,children:[(0,r.BX)(T.tu,{gap:12,children:[n?(0,r.tZ)(v.Z,{as:"a",href:(0,w.Ucy)(i,{section:n}),preset:"d2-serif",children:n.name}):(0,r.tZ)(v.Z,{preset:"d2-serif",children:"\xa0"}),(0,r.BX)(T.tu,{borderBottom:"detail",borderTop:"detail",gap:12,paddingBottom:16,paddingTop:12,children:[(0,r.tZ)(v.Z,{as:"a",clamp:2,href:o,preset:"h5-serif",children:t.title}),(0,r.tZ)(v.Z,{clamp:3,preset:"d3-serif",children:t.description})]})]}),(0,r.tZ)(T.gq,{justifyContent:"start",children:(0,r.tZ)(g._,{href:o,trailingIcon:"chevron-right",variant:"tertiary",children:"Watch Now"})})]})};var M=i(20888),R=i(94778),F=i(61254),U=i(47929);let O={sectionImage:"sectionImage-OVlQ8l",sectionTitle:"sectionTitle-Aad7Bm",sectionContainer:"sectionContainer-g1nief"},A=e=>{let{pub:t,user:i}=e,{initialSections:n}=(0,R.c)({pub:t});return(0,r.tZ)(T.tu,{gap:24,children:n.map((e,n)=>(0,r.BX)(r.HY,{children:[0!==n&&(0,r.tZ)(F.iz,{}),(0,r.tZ)(D,{pub:t,section:e,user:i})]}))})},D=e=>{let{pub:t,section:i,user:n}=e,{isMobile:o}=(0,y.v9)(),l=(0,w.Ucy)(t,{section:i}),a=(0,w.W1P)(t,{addBase:!0,user:n,params:{next:document.location.href,utm_medium:U.lP.web,utm_source:U.b3.videosPage}});return(0,r.BX)(T.gq,{className:O.sectionContainer,gap:o?24:40,children:[i.logo_url&&(0,r.tZ)(T.tu,{as:"a",flex:"auto",href:l,children:(0,r.tZ)(M.e,{className:O.sectionImage,maxWidth:300,src:i.logo_url})}),(0,r.BX)(T.tu,{gap:8*!o,overflow:"hidden",children:[(0,r.tZ)(v.Z,{as:"a",clamp:1,className:O.sectionTitle,href:l,preset:"h5-serif",children:i.name}),(0,r.tZ)(T.tu,{flex:o?void 0:"grow",paddingBottom:o?16:8,children:(0,r.tZ)(v.Z,{as:"a",clamp:3,href:l,preset:"d3-serif",children:i.description})}),!(null==n?void 0:n.is_subscribed)&&(0,r.BX)(T.gq,{gap:8,children:[(0,r.tZ)(v.Z,{preset:"sm-preview-byline",children:"Free with Ads"}),(0,r.tZ)(v.Z,{as:"a",color:"accent",href:a,preset:"sm-preview-byline",children:"Listen Ad-Free"})]})]})]})};var z=i(64900),j=i(68648);let H=e=>{var t;let{activeLiveStream:i,pub:a,user:m,videoPageData:g}=e,{isMobile:v}=(0,y.v9)(),{activeLiveStream:f}=(0,z.H)({pub:a,preloadedLiveStream:i}),[b,_]=(0,l.eJ)(!1),[Z,w]=(0,l.eJ)((null!==(t=null==g?void 0:g.recentPosts.length)&&void 0!==t?t:0)<7),[k,C]=(0,l.eJ)("latest"),[S,x]=(0,l.eJ)(null!=g?g:null),B=null!=S?S:g,{recentPosts:P}=null!=B?B:{};(0,l.d4)(()=>{let e=async()=>{let e=await s().get("/videos/data");return e.body.recentPosts.length<7&&w(!0),e.body};g||e().then(x)},[g]);let I=async()=>{var e;_(!0);let{body:t}=await s().get("/videos/data").query({offset:null!==(e=null==P?void 0:P.length)&&void 0!==e?e:0,limit:7});x(e=>(0,o._)((0,n._)({},e),{recentPosts:[...e?e.recentPosts:[],...t.recentPosts]})),t.recentPosts.length<7&&w(!0),_(!1)};return(0,r.tZ)(j.hV,{pub:a,children:(0,r.tZ)(d.h,{children:(0,r.BX)(T.tu,{children:[(0,r.tZ)(L,{hasActiveLiveStream:!!f,posts:null!=P?P:null,pub:a}),(0,r.tZ)(u.x,{children:(0,r.tZ)("div",{className:"bodyContents-ivBy3X",children:(0,r.BX)(T.tu,{gap:40,paddingY:40,children:[(0,r.BX)(T.gq,{justifyContent:"center",position:"relative",children:[(0,r.tZ)(h.w,{activeTabId:k,tabs:[{title:"Latest Videos",id:"latest"},{title:"All Series",id:"series"}],onClick:C}),"series"===k&&!v&&(0,r.tZ)(T.gq,{position:"absolute",style:{right:0,top:0},children:(0,r.tZ)(c.r,{pub:a,sectionType:"video",user:null!=m?m:null})})]}),"latest"===k&&P&&(0,r.tZ)(p.I,{isLoading:b,noMorePosts:Z,posts:P,onLoadMore:I}),"series"===k&&(0,r.tZ)(A,{pub:a,user:m})]})})})]})})})}},42400:function(e,t,i){i.d(t,{S:()=>k});var n=i(16584),o=i(39693),r=i.n(o),l=i(24350),a=i.n(l),s=i(84967),d=i(98661),c=i(44846),u=i(18582),p=i(3900),h=i(1455),m=i(79344),g=i(4211),v=i(1056),f=i(12900),b=i(19081),_=i(60308),y=i(71891);let Z="letters@thefp.com",w="tips@thefp.com",k=e=>{let{pub:t,user:i}=e,{ids:o}=(0,v.d)({pub:t}),l=a()(t.authorPagesInfo,"user_id"),[k,C]=(0,d.useState)(!0),[S,x]=(0,d.useState)(!0),B=e=>{var i;let o=l[e];return o?{title:(0,n.BX)(b.gq,{alignItems:"center",justifyContent:"space-between",position:"relative",children:[(0,n.tZ)(g.Z,{preset:"h5-serif",children:o.name}),!!o.primary_section_id&&(0,n.tZ)(m.F,{authorId:o.user_id,className:y.Z.titleNotifyButton})]}),imageUrl:o.photo_url,description:o.bio,url:null!==(i=(0,_.rfk)({userId:o.user_id,pub:t}))&&void 0!==i?i:""}:null},P=r()(o.filter(e=>{var t;return!!(null===(t=l[e])||void 0===t?void 0:t.primary_section_id)}).map(B)),I=r()(o.filter(e=>{var t;return!(null===(t=l[e])||void 0===t?void 0:t.primary_section_id)}).map(B)),N=P.length>0;return(0,n.tZ)(u.q,{actions:(0,n.tZ)(c.r,{pub:t,sectionType:"who-we-are",user:null!=i?i:null}),description:(0,n.BX)(n.HY,{children:["If you have a letter to the editor, commenting on one of our stories, write to"," ",(0,n.tZ)("a",{href:"mailto:".concat(Z),rel:"noopener noreferrer",target:"_blank",children:Z}),".",(0,n.tZ)("br",{}),"To share a tip about story going on in your neighborhood or institution, write to"," ",(0,n.tZ)("a",{href:"mailto:".concat(w),rel:"noopener noreferrer",target:"_blank",children:w}),"."]}),hideDivider:N,title:"Who We Are",children:(0,n.BX)(b.tu,{gap:40,children:[N&&(0,n.BX)(n.HY,{children:[(0,n.BX)(b.tu,{gap:8,children:[(0,n.BX)(b.gq,{alignItems:"center",justifyContent:"space-between",children:[(0,n.tZ)(g.Z,{preset:"h4-sans-condensed",children:"Columnists"}),(0,n.tZ)(p._,{variant:"accordion",onClick:()=>{C(!k)},children:(0,n.tZ)(s.Z,{className:"".concat(y.Z.caret," ").concat(k?"":y.Z.collapsed),height:36,width:36})})]}),(0,n.tZ)("div",{className:y.Z.thickRule})]}),(0,n.tZ)(f.H,{expanded:k,children:(0,n.tZ)(h.x,{applyHoverOnTitle:!1,hasMarkdownDescriptions:!0,items:P,justifyViewAllLabel:"start",showDescriptionOnMobile:!0,viewAllLabel:"Read more"})}),(0,n.BX)(b.tu,{gap:8,children:[(0,n.BX)(b.gq,{alignItems:"center",justifyContent:"space-between",children:[(0,n.tZ)(g.Z,{preset:"h4-sans-condensed",children:"Staff Writers and Editors"}),(0,n.tZ)(p._,{variant:"accordion",onClick:()=>{x(!S)},children:(0,n.tZ)(s.Z,{className:"".concat(y.Z.caret," ").concat(S?"":y.Z.collapsed),height:36,width:36})})]}),(0,n.tZ)("div",{className:y.Z.thickRule})]})]}),(0,n.tZ)(f.H,{expanded:S,children:(0,n.tZ)(h.x,{applyHoverOnTitle:!1,hasMarkdownDescriptions:!0,items:I,justifyViewAllLabel:"start",showDescriptionOnMobile:!0,viewAllLabel:"Read more"})})]})})}},87810:function(e,t,i){i.d(t,{l:()=>c});var n=i(30396),o=i(14952),r=i(60807),l=i(7882),a=i(60308),s=i(47929);let d=e=>!!(null==e?void 0:e.subscription_id)||!!(null==e?void 0:e.is_free_subscribed),c=e=>{var t;let[i,c]=(0,n.eJ)(!1),[u,p]=(0,n.eJ)(!1),[h,m]=(0,n.eJ)(!0),[g,v]=(0,n.eJ)(!1),f=(0,o.Ij)(),b=(0,r.aF)(),_=null!==(t=null==f?void 0:f.authorPagesInfo)&&void 0!==t?t:[],y=null==_?void 0:_.find(t=>t.user_id===e),Z=(null==y?void 0:y.primary_section_id)===0?void 0:null==y?void 0:y.primary_section_id,w=d(b),{result:k,refetch:C}=(0,l.ib)({pathname:"/api/v1/subscription",auto:!1}),{refetch:S}=(0,l.ib)({pathname:"/api/v1/subscription/sections/email",auto:!1,method:"PATCH",cacheTtl:6e4});(0,n.d4)(()=>{(async()=>{m(!0);try{v(!!Z);let t=await C(),i=new URLSearchParams(window.location.search),n="true"===i.get("follow");if(i.has("follow")){i.delete("follow");let e=i.toString()?"".concat(window.location.pathname,"?").concat(i.toString()):window.location.pathname;window.history.replaceState({},"",e)}if(n&&Z&&w&&!(t instanceof Error)){var e;(null==t?void 0:null===(e=t.email_settings)||void 0===e?void 0:e[Z])!=="individual"&&(await S({json:{[Z]:{setting:"individual"}}}),c(!0))}}finally{m(!1)}})()},[e,f]),(0,n.d4)(()=>{p(w)},[w]),(0,n.d4)(()=>{(null==k?void 0:k.email_settings)&&Z&&(c("individual"===k.email_settings[Z]),p(w))},[k,Z,w]);let x=async()=>{if(!Z)return;if(!w&&f){var e;let t=null===(e=f.sections.find(e=>e.id===Z))||void 0===e?void 0:e.slug,i=(0,a.W1P)(f,{addBase:!0,sectionSlug:t,next:(0,a.n1t)(window.location.href,{follow:!0}),utm_source:s.b3.followAuthorCta,utm_medium:s.lP.web});window.location.href=i;return}let t=!i;await S({json:{[Z]:{setting:t?"individual":"disabled"}}}),c(t)};return{isSubscribedToAuthor:i,isSubscribedToPub:u,isLoading:h,hasSection:g,toggleSubscription:x,sectionId:Z}}},49995:function(e,t,i){i.d(t,{ZP:()=>v,g1:()=>h});var n=i(16584),o=i(6400),r=i(30396),l=i(68833),a=i(48980),s=i(62981),d=i(98012),c=i(84864);let u=function(e){let{timeout:t=5e3,className:i="",dismissable:r=!1,beforeDismiss:l=null}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;a=a||document.body;let s=document.createElement("div");s.setAttribute("id","toast"),s.setAttribute("role","alert"),i&&s.classList.add(i),a.appendChild(s);let d=()=>{l&&l(),s.classList.remove("in"),setTimeout(()=>{s.remove()},500)};(0,o.render)([(0,n.tZ)("p",{children:e}),r&&(0,n.tZ)("a",{className:"dismiss",onClick:d,children:"Dismiss"})],s),setTimeout(()=>{s.classList.add("in")}),r||setTimeout(d,t)},p=e=>{let{children:t,className:i,dismissKey:n,dismissDurationInSeconds:o,beforeDismiss:r,container:l}=e,[a,d]=(0,s.Z)(n,o,r);if(!a)return u(t,{className:i,beforeDismiss:d,dismissable:!0},l)},h=e=>{let{user:t,pub:i,container:o}=e;return t&&i&&t.is_subscribed?(0,n.tZ)(g,{pub:i,container:o}):null},m=e=>{if(e&&e.cardExpiresAt){let t=(0,d.Z)(e.expiry).subtract(c.GRACE_PERIOD_DAYS,"day"),i=(0,d.Z)(e.cardExpiresAt),n=(0,d.Z)().add(12,"day");return i.isBefore(t)&&t.isBefore(n)}return!1},g=e=>{let{pub:t,container:i}=e,[o,s]=(0,r.eJ)(null);return((0,r.d4)(()=>{(0,a.rd)("/api/v1/subscription").then(e=>s(e)).catch(e=>{console.error("Failed to fetch subscription data: ",e)})},[]),m(o))?(0,n.BX)(p,{className:"urgent",dismissKey:"card-expiring-toast.dismissed",dismissDurationInSeconds:+c.WEEK_IN_SECONDS,beforeDismiss:()=>{(0,l.j)(l.FP.CARD_EXPIRED_WARNING_DISMISSED,{type:"toast"})},container:i,children:["Your credit card is expiring soon."," ",(0,n.tZ)("a",{href:"/account/billing",native:!0,onClick:()=>{(0,l.j)(l.FP.UPDATE_EXPIRED_CARD_LINK_CLICKED,{type:"toast"})},children:"Update your card"})," before you lose access to ".concat(t.name),"."]}):null},v=u},12281:function(e,t,i){i.d(t,{L:()=>x,Z:()=>S});var n=i(27412),o=i(7409),r=i(99282),l=i(16584),a=i(6400),s=i(94184),d=i.n(s),c=i(55877),u=i(1055),p=i(30372),h=i(68833),m=i(49762),g=i(59176),v=i(98914),f=i(71068),b=i(15771),_=i(18618),y=i(60308),Z=i(69332),w=i(84864),k=i(67312);let C={hls:"application/x-mpegURL",mp4:"video/mp4"};class S extends a.Component{componentDidMount(){this._initHlsjs(),null===v.sz||void 0===v.sz||v.sz.on("play",this.onGlobalPlay),"undefined"!=typeof window&&(document.addEventListener("keydown",this.onGlobalKeyDown,!1),window.addEventListener("beforeunload",this.onBeforeUnload,!1)),this.player&&(this.player.volume=1,this.player.addEventListener("loadedmetadata",this.onLoadedMetadata),this.player.addEventListener("loadeddata",this.onLoadedData),this.player.addEventListener("canplay",this.onCanPlay),this.player.addEventListener("play",this.onPlay),this.player.addEventListener("pause",this.onPause),this.player.addEventListener("ended",this.onEnded),this.player.addEventListener("timeupdate",this.onTimeUpdate),this.player.addEventListener("waiting",this.onWaiting),this.player.addEventListener("playing",this.onPlaying),this.player.addEventListener("contextmenu",this.onContextMenu),this.player.addEventListener("click",this.onUserInteraction),this.player.addEventListener("mouseover",this.onUserInteraction),this.player.addEventListener("mousedown",this.onUserInteraction),this.player.addEventListener("touchstart",this.onUserInteraction),this.player.addEventListener("seeked",this.onSeeked)),this.onTimeUpdate(),window&&window._preloads.mux_env_key&&i.e("5590").then(i.t.bind(i,54125,23)).then(e=>{let t=e.default||e;t.monitor(this.player,{Hls:this.hlsModule,hlsjs:this.hls,debug:!1,data:{env_key:window._preloads.mux_env_key,player_name:"substack",player_init_time:t.utils.now()}})})}componentWillUnmount(){this.setPlaybackRestoreLocation(),this.lastTimeUpdate=null,null===v.sz||void 0===v.sz||v.sz.off("play",this.onGlobalPlay),"undefined"!=typeof window&&(document.removeEventListener("keydown",this.onGlobalKeyDown,!1),window.removeEventListener("beforeunload",this.onBeforeUnload,!1)),this.player&&(this.player.removeEventListener("loadedmetadata",this.onLoadedMetadata),this.player.removeEventListener("loadeddata",this.onLoadedData),this.player.removeEventListener("canplay",this.onCanPlay),this.player.removeEventListener("play",this.onPlay),this.player.removeEventListener("pause",this.onPause),this.player.removeEventListener("ended",this.onEnded),this.player.removeEventListener("timeupdate",this.onTimeUpdate),this.player.removeEventListener("waiting",this.onWaiting),this.player.removeEventListener("playing",this.onPlaying),this.player.removeEventListener("contextmenu",this.onContextMenu),this.player.removeEventListener("click",this.onUserInteraction),this.player.removeEventListener("mouseover",this.onUserInteraction),this.player.removeEventListener("mousedown",this.onUserInteraction),this.player.removeEventListener("touchstart",this.onUserInteraction)),this.onVideoReachEnd({resetTime:!1,triggerCallback:!1,track:!1}),null!=this.hls&&this.hls.destroy()}componentDidUpdate(e,t){var i,n,r;if((this.props.noPreview!==e.noPreview||this.props.noControls!==e.noControls||this.props.noKeyboardShortcuts!==e.noKeyboardShortcuts||this.props.mediaUpload.id!==e.mediaUpload.id)&&(this._initHlsjs(),this.resetDurationTracking()),!this.state.playing&&"number"==typeof this.state.waiting&&"number"!=typeof t.waiting){let{useHLSJS:e,browserCanPlayHLS:t,HLSerrored:i}=this.state;this.track(h.FP.VIDEO_BUFFERING_STARTED,{use_hlsjs:e,browser_can_play_hls:t,hls_errored:i})}if(!this.state.playing||t.playing||this.state.waiting||"number"!=typeof t.waiting||this.track(h.FP.VIDEO_BUFFERING_COMPLETED,{buffering_duration:Date.now()-t.waiting}),this.state.playing&&!(null===(i=this.player)||void 0===i?void 0:i.ended)&&Math.floor(this.state.currentTime)!==Math.floor(t.currentTime)&&Math.floor(this.state.currentTime)%5==0&&(this.trackMedia(h.FP.MEDIA_PLAYBACK_CONTINUED),this.props.mediaUpload.post_id&&this.state.duration&&(!this.props.surface||"post"===this.props.surface)&&(!this.props.videoType||"post"===this.props.videoType)&&!this.props.isClip)){let e=Math.min(Math.max(0,this.state.currentTime/this.state.duration),1);(0,p.UO)(this.props.mediaUpload.post_id,"video",e)}if(!this.state.playing&&t.playing&&(null===(n=this.player)||void 0===n?void 0:n.ended)&&this.trackMedia(h.FP.MEDIA_PLAYBACK_COMPLETED),this.props.mediaUpload.id&&(0,m.default)("use_preloaded_player_sources")&&(this.props.mediaUpload.id!==e.mediaUpload.id||!(null===(r=Object.keys(this.state.sources))||void 0===r?void 0:r.length))){let e=async e=>fetch((0,y.rhs)("/api/v1/video/upload/".concat(this.props.mediaUpload.id,"/src.json"),{type:e})).then(e=>e.json()).then(t=>({[e]:t.src}));Promise.all(["hls"].map(t=>e(t))).then(e=>{let t=e.reduce((e,t)=>(0,o._)({},e,t),{});this.setState({sources:t})})}}getPlaybackLocationKey(){return"".concat("video:playback_location:").concat(this.props.mediaUpload.id)}getPlaybackRestoreLocation(){if(this.playbackEnabled()&&this.props.restorePlaybackLocation&&this.props.mediaUpload.duration&&this.props.mediaUpload.duration>240){let e=(0,g.mM)(this.getPlaybackLocationKey());if((null==e?void 0:e.currentTime)>5&&null!==this.props.duration&&void 0!==this.props.duration&&this.props.duration-e.currentTime>60){let t=3*(Date.now()-e.watchedAt>60),i=Math.max(0,e.currentTime-t);if(i)return i}}return null}setPlaybackRestoreLocation(){var e;this.playbackEnabled()&&(null===(e=this.player)||void 0===e?void 0:e.currentTime)&&(0,g.ex)(this.getPlaybackLocationKey(),{currentTime:this.player.currentTime,watchedAt:Date.now()})}onPreviewClick(e){var t,i;this.props.stopPropagation&&(e.preventDefault(),e.stopPropagation()),!(this.state.previewHidden||this.href())&&this.playbackEnabled()&&(this.state.attemptingToPlay?(this.lastTimeUpdate=null,this.setState({attemptingToPlay:!1,autoPlay:!1}),null===(t=this.player)||void 0===t||t.pause(),this.previewHiddingTimeout&&clearTimeout(this.previewHiddingTimeout)):(this.setState({attemptingToPlay:!0}),null===(i=this.player)||void 0===i||i.play(),this.previewHiddingTimeout=window.setTimeout(()=>this.setState({previewHidden:!0}),3e3)))}track(e){var t,i,n,o;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=this.props.communityPostEmbedPostId||this.props.mediaUpload.post_id,a=this.props.mediaUpload.user_id;(0,h.j)(e,Object.assign({post_id:l,video_user_id:a,community_post_id:this.props.communityPostId,media_upload_id:this.props.mediaUpload.id,live_stream_id:this.props.liveStreamId,current_time:this.state.currentTime?Math.floor(this.state.currentTime):0,duration:this.state.duration?Math.floor(this.state.duration):0,is_clip:null!==(i=this.props.isClip)&&void 0!==i&&i,surface:this.props.surface,is_preview:null!==(n=this.props.usePreview)&&void 0!==n&&n,muted:null!==(o=null===(t=this.player)||void 0===t?void 0:t.muted)&&void 0!==o&&o,video_type:this.props.videoType,display:(0,v.rm)()?"fullscreen":document.pictureInPictureElement?"pip":"inline"},r))}trackMedia(e){var t,i,n,l,a,s,d,c;let u,p,m=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{mediaUpload:g,videoType:f,communityPostId:b,surface:_,entityKey:y,entityType:Z,primaryEntityKey:w,primaryEntityType:k,contentType:C,feedItemTrackingParameters:S}=this.props,x=null!=C?C:f?null!==(n=({communityCommentReply:"communityComment","video-embed":"embed"})[f])&&void 0!==n?n:f:"unknown";y?(u=y,p=Z):b?(u=b,p="community_post"):g.post_id?(u=String(g.post_id),p="post"):(u=y,p=Z);let B=Array.from(null!==(l=null===(t=this.player)||void 0===t?void 0:t.textTracks)&&void 0!==l?l:[]),P=B.length>0,I=this.isShowingCaptionsElsewhere||B.some(e=>["subtitles","captions"].includes(e.kind)&&"showing"===e.mode);(0,h.j)(e,(0,o._)((0,r._)((0,o._)({},S),{media_type:"video",video_upload_id:g.id,src_video_upload_id:g.src_media_upload_id,content_type:x,primary_entity_key:String(null!=w?w:u),primary_entity_type:null!=k?k:p,entity_key:String(u),entity_type:p,publication_id:g.publication_id,surface:_,display:(0,v.rm)()?"fullscreen":document.pictureInPictureElement?"pip":"inline",muted:null!==(a=null===(i=this.player)||void 0===i?void 0:i.muted)&&void 0!==a&&a,captions_enabled:P?I:null,autoplay:this.state.autoPlay&&!this.state.failedAutoplay,is_preview:null!==(s=this.props.usePreview)&&void 0!==s&&s,current_time:Math.floor(null!==(d=this.state.currentTime)&&void 0!==d?d:0),duration:Math.floor(null!==(c=this.state.duration)&&void 0!==c?c:0),duration_played:Math.floor(this.state.durationPlayed),duration_played_id:this.state.durationPlayedId}),m))}render(e,t){let{height:i,width:n}=(0,w.videoPlayerDimensions)(e.mediaUpload,{isStatic:!1}),o=d()("video-player",{"video-player-clip":e.isClipping,"video-player-with-background":!e.omitBackgroundColor},e.videoPlayerClassName);return(0,l.tZ)(B,{className:d()(e.className,{"with-preview":!t.previewHidden,"full-width":n>=960,"video-player-wrapper-clip":e.isClipping,"video-player-with-background":!e.omitBackgroundColor}),linkClassName:o,href:this.href(),width:n,height:i,onClick:this.onPreviewClick,children:this.renderPlayer(this.props,this.state)})}renderPlayer(e,t){let{hidePlayButton:i,mediaUpload:n,noControls:o,noPreview:r,renderPlayButton:s,startMuted:d,videoClassName:c,liveStreamId:p,loop:h,thumbnailUrl:g}=e,{autoPlay:f,attemptingToPlay:Z,previewHidden:w,showControls:k,useHLSJS:S,browserCanPlayHLS:x,HLSerrored:B,failedAutoplay:N}=t,T=!r&&!w,E=!this.playbackEnabled(),L=this.getBaseVideoSrc(),X=[];X=p?["hls"]:x?["hls","mp4"]:S?[]:(0,v.Dt)()?["hls","mp4"]:B?["mp4"]:["hls","mp4"];let M=(0,v.K1)(),R=!!(0,m.default)("use_preloaded_player_sources")&&M,F=f&&!N&&this.playbackEnabled(),U=g||"".concat((0,y.ow1)(n),"?refresh=").concat(n.updated_at);return[this.playbackEnabled()&&"undefined"!=typeof window&&(0,l.tZ)("video",{ref:this.assignPlayer,controls:k&&!o&&!T,controlsList:"nodownload",autoPlay:F,poster:U,muted:d,loop:h,className:c,playsInline:M,crossOrigin:"anonymous",children:R?Object.entries(this.state.sources).map((e,t)=>{let[i,n]=e;return(0,l.tZ)("source",{src:n,type:C[i],onError:t===Object.keys(this.state.sources).length-1?this.onAllSourcesFailed:void 0},"".concat(i,"_").concat(t))}):X.map((e,t)=>(0,l.tZ)("source",{src:(0,y.rhs)(L,{type:e}),type:C[e],onError:t===X.length-1?this.onAllSourcesFailed:void 0},"".concat(e,"_").concat(t)))}),T&&!i&&(0,l.BX)(a.Fragment,{children:[E&&(0,l.tZ)(P,{mediaUpload:n,thumbnailUrl:U}),!s&&(0,l.tZ)(I,{children:this.cta()?(0,l.tZ)(b._L,{href:this.href(),loading:Z&&this.playbackEnabled(),"aria-label":"play",leading:(0,l.tZ)(u.Z,{height:16,width:16,style:{stroke:"none",fill:"white"}}),children:this.cta()}):(0,l.tZ)(_.f,{isPlaying:!1,href:this.href(),size:72,loading:Z&&this.playbackEnabled()})}),s&&(0,l.tZ)(I,{children:s()})]})]}_initHlsjs(){let e=!!(this.player&&this.player.canPlayType("application/vnd.apple.mpegurl"));if(e&&!(0,v.Dt)()){this.setState({browserCanPlayHLS:e});return}i.e("4754").then(i.t.bind(i,67631,23)).then(e=>{this._initHlsjsWrapped(e.default)})}_initHlsjsWrapped(e){let t=this,i=e.isSupported();if(!e.isSupported()){this.setState({useHLSJS:i});return}null!=this.hls&&this.hls.destroy();let n=new e((0,o._)({enableWorker:!1},{}));null!=this.player&&n.attachMedia(this.player);let r=this.getBaseVideoSrc("hls");n.on(e.Events.MEDIA_ATTACHED,()=>{n.loadSource(r),n.on(e.Events.MANIFEST_PARSED,()=>{if(this.state.autoPlay&&this.player){var e;this.player.muted=null!==(e=this.props.startMuted)&&void 0!==e&&e,this.player.play().catch(e=>{console.error("Unable to autoplay prior to user interaction with the dom.",e),this.setState({failedAutoplay:!0,attemptingToPlay:!1}),this.player&&(this.player.muted=!0,this.player.play().then(()=>{var e,t;null===(e=(t=this.props).onAutoplayMuted)||void 0===e||e.call(t)}).catch(e=>{console.error("Unable to autoplay prior to user interaction with the dom when muted.",e),this.setState({failedAutoplay:!0,attemptingToPlay:!1})}))})}})}),n.on(e.Events.ERROR,function(i,o){if(o.fatal)switch(o.type){case e.ErrorTypes.NETWORK_ERROR:var r;t.setState({useHLSJS:!1}),null===(r=t.hls)||void 0===r||r.destroy(),n.startLoad();break;case e.ErrorTypes.MEDIA_ERROR:n.recoverMediaError();break;default:this._initHlsjs()}}),this.hls=n,this.hlsModule=e}constructor(e,t){var i,l;super(e,t),i=this,(0,n._)(this,"player",null),(0,n._)(this,"previewHiddingTimeout",null),(0,n._)(this,"lastTimeUpdate",null),(0,n._)(this,"_accumulatedDurationPlayed",0),(0,n._)(this,"containerRef",(0,a.createRef)()),(0,n._)(this,"isShowingCaptionsElsewhere",!1),(0,n._)(this,"assignPlayer",e=>{this.player=e}),(0,n._)(this,"resetDurationTracking",()=>{this.lastTimeUpdate=null,this.setState({durationPlayed:0,durationPlayedId:(0,c.v4)()})}),(0,n._)(this,"onLoadedMetadata",()=>{this.state.playbackRestoreLocation&&(this.player&&(this.player.currentTime=this.state.playbackRestoreLocation),this.previewHiddingTimeout=window.setTimeout(()=>this.setState({playbackRestoreLocation:null,previewHidden:!0}),3e3))}),(0,n._)(this,"onLoadedData",()=>{this.state.playbackRestoreLocation&&(this.previewHiddingTimeout&&clearTimeout(this.previewHiddingTimeout),this.setState({playbackRestoreLocation:null,previewHidden:!0}))}),(0,n._)(this,"onCanPlay",()=>{this.onTimeUpdate()}),(0,n._)(this,"onPlay",()=>{null===v.sz||void 0===v.sz||v.sz.emit("play",this),this.setState({playing:!0}),this.lastTimeUpdate=Date.now(),this.trackMedia(h.FP.MEDIA_PLAYBACK_STARTED)}),(0,n._)(this,"onPause",()=>{var e;this.setPlaybackRestoreLocation(),this.lastTimeUpdate=null,this.setState({playing:!1,waiting:!1,previewHidden:!this.props.showPreviewWhenPaused&&this.state.previewHidden}),(null===(e=this.player)||void 0===e?void 0:e.ended)||this.trackMedia(h.FP.MEDIA_PLAYBACK_PAUSED),this.player&&this.player.currentTime>this.player.duration-.1&&this.onVideoReachEnd()}),(0,n._)(this,"onEnded",()=>{this.lastTimeUpdate=null,this.setState({playing:!1,waiting:!1,previewHidden:!this.props.showPreviewWhenPaused&&this.state.previewHidden}),this.trackMedia(h.FP.MEDIA_PLAYBACK_PAUSED),this.onVideoReachEnd()}),(0,n._)(this,"onTimeUpdate",()=>{if(!this.player||!isFinite(this.player.duration))return;let e=this.player.currentTime,t=Date.now();if(this.state.playing&&null!==this.lastTimeUpdate){let e=(t-this.lastTimeUpdate)/1e3;e>0&&e<1&&(this._accumulatedDurationPlayed=(this._accumulatedDurationPlayed||0)+e,this._accumulatedDurationPlayed>=1&&(this.setState(e=>({durationPlayed:e.durationPlayed+this._accumulatedDurationPlayed})),this._accumulatedDurationPlayed=0))}this.lastTimeUpdate=t,(this.props.duration||this.state.duration===this.player.duration)&&this.state.currentTime===e?this.setState({waiting:!1}):this.setState({duration:this.props.duration||this.player.duration,currentTime:e,waiting:!1})}),(0,n._)(this,"onWaiting",()=>{this.lastTimeUpdate=null,this.setState({waiting:Date.now()})}),(0,n._)(this,"onPlaying",()=>{this.previewHiddingTimeout&&clearTimeout(this.previewHiddingTimeout),this.lastTimeUpdate=Date.now(),this.setState({playing:!0,waiting:!1,previewHidden:!0,attemptingToPlay:!1,autoPlay:!1,hasPlayed:!0})}),(0,n._)(this,"onSeeked",()=>{this.lastTimeUpdate=Date.now(),this.trackMedia(h.FP.MEDIA_SEEKED)}),(0,n._)(this,"onVideoReachEnd",function(){let{resetTime:e=!0,triggerCallback:t=!0,track:n=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.lastTimeUpdate=null,i.player&&!i.player.paused&&i.player.pause(),i.state.previewHidden&&i.setState({previewHidden:!1,attemptingToPlay:!1,hasReachedEnd:!0}),e&&i.player&&!(0,v.L)()&&!i.props.doNotResetOnEnd&&(i.player.currentTime=0),(0,v.Qg)(),(0,v.Yk)(),i.props.onFinishVideo&&t&&i.props.onFinishVideo(),n&&i.trackMedia(h.FP.MEDIA_PLAYBACK_COMPLETED)}),(0,n._)(this,"onContextMenu",e=>{e.preventDefault()}),(0,n._)(this,"onUserInteraction",()=>{this.state.showControls||this.setState({showControls:!0})}),(0,n._)(this,"onAllSourcesFailed",()=>{var e,t;console.error("Failed to load all video sources, falling back to preview image"),this.setState((0,r._)((0,o._)({},this.props.liveStreamId?{}:{previewHidden:!1,attemptingToPlay:!1,autoPlay:!1}),{allSourcesFailed:!0})),null===(e=(t=this.props).onPlaybackFailed)||void 0===e||e.call(t)}),(0,n._)(this,"onBeforeUnload",()=>{this.setPlaybackRestoreLocation(),this.state.previewHidden&&this.setState({previewHidden:!1,attemptingToPlay:!1}),this.player&&!this.player.paused&&this.player.pause()}),(0,n._)(this,"onGlobalPlay",e=>{this!==e&&this.player&&!this.player.paused&&this.player.pause()}),(0,n._)(this,"onGlobalKeyDown",e=>{var t;!this.props.noKeyboardShortcuts&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&document.activeElement===document.body&&this.player&&(!((null!==(t=null===v.sz||void 0===v.sz?void 0:v.sz.listenerCount("play"))&&void 0!==t?t:0)>1)||!this.player.paused)&&("f"===e.key?(0,v.rm)()?(0,v.Qg)()&&e.preventDefault():((0,v.bt)(this.player)&&e.preventDefault(),this.player.paused&&this.player.play()):" "!==e.key||(0,v.rm)()?"ArrowRight"===e.key?this.player.currentTime+5>this.player.duration?this.onVideoReachEnd():(this.player.currentTime+=5,this.state.previewHidden||this.setState({previewHidden:!0,attemptingToPlay:!1})):"ArrowLeft"===e.key&&(this.player.currentTime-=5):(e.preventDefault(),this.player.paused?this.player.play():this.player.pause()))}),(0,n._)(this,"getBaseVideoSrc",e=>{var t;let i={token:this.props.reaction_token,override_publication_id:null===(t=this.props.pub)||void 0===t?void 0:t.id,preview:this.props.usePreview};return e&&(i.type=e),(0,y.rhs)("/api/v1/video/upload/".concat(this.props.mediaUpload.id,"/src"),i)}),(0,n._)(this,"hls",null),(0,n._)(this,"hlsModule",void 0),(0,n._)(this,"cta",()=>""),(0,n._)(this,"href",()=>this.props.href),(0,n._)(this,"playbackEnabled",()=>!0);let s="undefined"!=typeof window?(0,Z.m)(window.location.href):{},d=null;s.timestamp?d=parseInt(s.timestamp):s.t&&(d=parseInt(s.t));let u=null!==d&&!isNaN(d);u||(0,v.iO)("timestamp");let p=u?d:this.getPlaybackRestoreLocation();this.state={playbackRestoreLocation:p,currentTime:0,waiting:!0,duration:null!==(l=e.mediaUpload.duration)&&void 0!==l?l:null,autoPlay:e.autoPlay,playing:!1,attemptingToPlay:e.autoPlay,previewHidden:null!==p&&p>0,showControls:!1,hasPlayed:!1,hasReachedEnd:!1,browserCanPlayHLS:!1,useHLSJS:!0,HLSerrored:!1,allSourcesFailed:!1,failedAutoplay:!1,sources:{},durationPlayed:0,durationPlayedId:(0,c.v4)()},this.onPreviewClick=this.onPreviewClick.bind(this)}}function x(e){let{className:t,mediaUpload:i,href:n}=e;return(0,l.tZ)(B,(0,r._)((0,o._)({},(0,w.videoPlayerDimensions)(i,{isStatic:!0})),{className:d()(t,"video-player-with-background","is-static"),linkClassName:"video-player-with-background",href:n,children:(0,l.tZ)(P,{mediaUpload:i,testId:"video-player-static-preview-image",isStatic:!0})}))}function B(e){let{className:t,linkClassName:i,width:n,height:o,href:r,onClick:a,children:s}=e,c={paddingBottom:"".concat(Math.min(60,100*o/n).toFixed(4),"%")};return(0,l.tZ)("div",{className:d()(t,"video-player-wrapper",n>=960&&"full-width"),onClick:a,role:"region","aria-label":"Video player",children:(0,l.tZ)(r?"a":"div",{className:d()("video-player",i),href:r,style:c,children:s})})}function P(e){let{mediaUpload:t,thumbnailUrl:i,testId:n,isStatic:o}=e;return(0,l.tZ)("img",{className:"video-player-preview",width:550,src:i||(0,y.kOB)(t,{isStatic:o}),"data-component-name":"VideoPlayer-PreviewImg","data-testid":n})}let I=(0,f.zo)({position:"absolute",className:d()(k.Z.buttonContainer,"video-player-button")})},15597:function(e,t,i){i.d(t,{$:()=>c,s:()=>u});var n=i(7409),o=i(16584),r=i(6400),l=i(98661),a=i(51014);let s={},d=(0,r.createContext)({open:()=>void 0});function c(e){let{children:t}=e,[i,r]=(0,l.useState)(s),c=(0,l.useRef)(null),u=(0,l.useMemo)(()=>({open:e=>{r(e),setTimeout(()=>{var e;null===(e=c.current)||void 0===e||e.open()},0)}}),[]);return(0,o.BX)(d.Provider,{value:u,children:[t,(0,o.tZ)(a.ZP,(0,n._)({ref:c},i))]})}function u(){return(0,l.useContext)(d)}},19548:function(e,t,i){i.d(t,{CH:()=>b,KG:()=>v,Yq:()=>Z,fQ:()=>y,gc:()=>f});var n=i(7409),o=i(99282),r=i(16584),l=i(6400),a=i(30396),s=i(10844),d=i(88812),c=i(60807),u=i(48980);i(7882);var p=i(98914),h=i(44424),m=i(70379);let g=(0,l.createContext)({result:{mutes:[],blocks:[],blocked:[]},refetch:async()=>null,isBlockingUser:()=>!1,isMutedByUser:()=>!1,isBlockedByUser:()=>!1});function v(e){let{isBlockingUser:t,isBlockedByUser:i}=(0,a.qp)(g);return e?i(e)?"blocking":t(e)?"blocked":null:null}function f(e){let{isBlockingUser:t,isBlockedByUser:i,isMutedByUser:n}=(0,a.qp)(g);return e?n(e)?"muting":i(e)?"blocking":t(e)?"blocked":null:null}function b(e,t){let{surface:i,noteId:l,onClick:v}=t,b=(0,c.aF)(),_=!!(b&&e&&b.id!==e.id),y=(0,a.qp)(g),Z=f(null==e?void 0:e.id),w=(0,m.pm)(),k=async()=>{if(e){try{await (0,u.rd)("/api/v1/blocks/".concat(e.id),{method:"POST",json:{type:"mute",surface:i,noteId:l}})}catch(e){w.popToast(t=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},t),{text:(0,p.zx)(e)})));return}y.refetch(),w.popToast(t=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},t),{text:"".concat(e.name||"User"," muted"),Icon:s.Z}))),null==v||v("mute")}},C=async()=>{if(e){try{await (0,u.rd)("/api/v1/blocks/".concat(e.id),{method:"DELETE",query:{surface:i,noteId:l}})}catch(e){w.popToast(t=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},t),{text:(0,p.zx)(e)})));return}y.refetch(),w.popToast(t=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},t),{text:"".concat(e.name||"User"," unmuted"),Icon:s.Z}))),null==v||v("unmute")}},S=async()=>{if(e){try{await (0,u.rd)("/api/v1/blocks/".concat(e.id),{method:"POST",json:{type:"block",surface:i,noteId:l}})}catch(e){w.popToast(t=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},t),{text:(0,p.zx)(e)})));return}y.refetch(),w.popToast(t=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},t),{text:"".concat(e.name||"User"," blocked"),Icon:d.Z}))),null==v||v("block")}},x=async()=>{if(e){try{await (0,u.rd)("/api/v1/blocks/".concat(e.id),{method:"DELETE",query:{surface:i,noteId:l}})}catch(e){w.popToast(t=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},t),{text:(0,p.zx)(e)})));return}y.refetch(),w.popToast(t=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},t),{text:"".concat(e.name||"User"," unblocked"),Icon:d.Z}))),null==v||v("unblock")}},B=[];return _&&("blocking"!==Z&&B.push((0,r.tZ)(h.sN,{leading:(0,r.tZ)(s.Z,{}),priority:"destructive",onClick:"muting"===Z?C:k,children:"muting"===Z?"Unmute":"Mute"})),B.push((0,r.tZ)(h.sN,{leading:(0,r.tZ)(d.Z,{}),priority:"destructive",onClick:"blocking"===Z?x:S,children:"blocking"===Z?"Unblock":"Block"}))),B}g.displayName="UserBlockContext";let _=(0,l.createContext)(!1);function y(e){let{muteFree:t=!0,children:i}=e;return(0,r.tZ)(_.Provider,{value:t,children:i})}function Z(){return(0,a.qp)(_)}_.displayName="MuteFreeZone"},75778:function(e,t,i){i.d(t,{LC:()=>s,uL:()=>a});var n=i(16584),o=i(6400),r=i(30396);let l=(0,o.createContext)(null);function a(e){let{crossPost:t=null,children:i}=e;return(0,n.tZ)(l.Provider,{value:t,children:i})}function s(){return(0,r.qp)(l)}l.displayName="CrossPostContext"},62718:function(e,t,i){i.d(t,{J:()=>C});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(98661),s=i(30396),d=i(94184),c=i.n(d);i(39693);var u=i(23279),p=i.n(u);i(44908),i(80569);var h=i(16564),m=i(86657);i(72508),i(95441);var g=i(24763);i(38242),i(57952),i(96904),i(53030);var v=i(68833);i(98914);var f=i(57649),b=i(1864),_=i(44989);(0,a.forwardRef)((e,t)=>{let{id:i,items:o,getItemHeight:r,renderItem:a,containerHeight:d,containerWidth:c,itemData:u,measurementProps:p,innerElementType:h,onScroll:m}=e,[g,v]=(0,s.eJ)(null),_=(0,s.sO)(null);(0,s.d4)(()=>{if(g||!c||r)return;let e=document.createElement("div");e.classList.add("hidden-sizing-element"),e.style.position="absolute",e.style.top="0",e.style.width="".concat(c,"px"),e.style.pointerEvents="none",e.style.visibility="hidden",v(e),document.body.appendChild(e)},[c,g,_]);let Z=(0,s.I4)(e=>g?(g.innerHTML=(0,f.Dq)(a({index:e,data:(0,n._)({},u,p)})),g.clientHeight||0):0,[g,u,p,a]);return g||r?(0,l.tZ)("div",{id:i,children:(0,l.tZ)(b.S_,{ref:t,itemCount:o.length,itemSize:null!=r?r:Z,height:d,width:c,innerRef:_,itemData:u,innerElementType:h,outerElementType:y,onScroll:m,children:a})}):(0,l.tZ)(l.HY,{})});let y=(0,a.forwardRef)((e,t)=>{var{style:i}=e,a=(0,r._)(e,["style"]);return(0,l.tZ)("div",(0,o._)((0,n._)({ref:t,style:i},a),{className:_.Z.listOuter}))});i(71068),i(15771),i(19081);var Z=i(58175);i(51776),i(70379),i(87077),i(17564);var w=i(60308);i(84864),i(93370);var k=i(22233);p()((e,t,i,n)=>{e.current.resetAfterIndex(t,!0),i(n)}),(0,a.forwardRef)((e,t)=>{var i;let{pub:r,audioUpload:a,onTimeUpdate:s,captions:d}=e;return a?(0,l.tZ)(m.Z,{ref:t,feature:h.MR.Podcast,pub:r,src:(0,w.rhs)("/api/v1/audio/upload/".concat(null==a?void 0:a.id,"/src")),duration:null==a?void 0:a.duration,onTimeUpdate:s,mediaUpload:a,trackingProps:{surface:"editor",contentType:"post",entityKey:null!==(i=null==a?void 0:a.post_id)&&void 0!==i?i:"unknown",entityType:"post"},render:e=>(0,l.tZ)(g.Z,(0,o._)((0,n._)({},e),{togglePlayback:()=>{var i,n,o;t&&"current"in t&&(null===(i=t.current)||void 0===i?void 0:i.player)&&(null===(n=t.current)||void 0===n?void 0:n.player.paused)?(0,v.j)(v.FP.TRANSCRIPTION_PLAY_BUTTON_CLICKED):t&&"current"in t&&(null===(o=t.current)||void 0===o?void 0:o.player)&&(0,v.j)(v.FP.TRANSCRIPTION_PAUSE_BUTTON_CLICKED),e.togglePlayback()}})),captions:d}):null});let C=e=>{let{searchTerm:t,rowIndex:i,isFocused:n,text:o}=e,r=RegExp("(".concat(t,")"),"gi"),a=o.split(r);return(0,l.tZ)(Z.xv.B3,{padding:2,color:"primary","data-chunk-index":i,className:k.Z.text,children:a.map(e=>{var t;return e.match(r)?(0,l.tZ)("span",{className:c()(k.Z.searchResult,{[null!==(t=k.Z.isFocused)&&void 0!==t?t:"undefined"]:n}),children:e}):e})})};(0,a.forwardRef)((e,t)=>{var i,a,{style:s}=e,d=(0,r._)(e,["style"]);return(0,l.tZ)("div",(0,n._)({ref:t,style:(0,o._)((0,n._)({},s),{height:"".concat(parseFloat(null!==(a=null===(i=s.height)||void 0===i?void 0:i.toString())&&void 0!==a?a:"0")+140,"px")})},d))})},57952:function(e,t,i){i.d(t,{Rq:()=>C,_F:()=>w,pH:()=>k});var n=i(16584),o=i(6400),r=i(30396),l=i(23279),a=i.n(l),s=i(24840),d=i(71375),c=i(84967),u=i(49336),p=i(5772),h=i(95441);i(4796);var m=i(68833),g=i(98422),v=i(15771);i(61254);var f=i(19081);i(44424);var b=i(58175),_=i(98905);i(98012),i(61468),i(84864);var y=i(22233);let Z=(0,o.createContext)({isSearching:!1,items:[],setIsSearching:()=>void 0,setItems:()=>void 0,focusedItemStart:null,setFocusedItemStart:()=>void 0,filteredItems:[],searchTerm:null,setSearchTerm:()=>void 0,hasFiltered:!1}),w=e=>{let{children:t}=e,[i,o]=(0,r.eJ)(!1),[l,a]=(0,r.eJ)([]),[s,d]=(0,r.eJ)(null),[c,u]=(0,r.eJ)(null),{filteredItems:h,setQuery:m,hasFiltered:g}=(0,p.R)({items:l,getKeys:e=>[e.text],sortFunc:(e,t)=>e.start-t.start});return(0,r.d4)(()=>{var e,t;d(null!==(t=null===(e=h[0])||void 0===e?void 0:e.start)&&void 0!==t?t:null)},[h]),(0,n.tZ)(Z.Provider,{value:{isSearching:i,setIsSearching:o,items:l,setItems:a,focusedItemStart:s,setFocusedItemStart:d,filteredItems:h,hasFiltered:g,searchTerm:c,setSearchTerm:e=>{u(e),m(e)}},children:t})},k=()=>(0,r.qp)(Z),C=e=>{let{postId:t,closeAlwaysVisible:i=!0}=e,{iString:o}=(0,h.M1)(),{isMobile:l}=(0,g.v9)(),p=(0,r.sO)(null),{setSearchTerm:Z,setIsSearching:w,hasFiltered:C,filteredItems:S,setFocusedItemStart:x,focusedItemStart:B,searchTerm:P}=k();(0,r.d4)(()=>{!P&&p.current&&(p.current.value="")},[P]);let I=S.findIndex(e=>e.start===B),N=()=>{let e=I+1>=S.length?0:I+1;x(S[e].start)},T=()=>{Z(""),w(!1),(0,m.j)(m.FP.TRANSCRIPTION_SEARCH_CANCELLED,{post_id:t})};return(0,n.BX)(f.gq,{gap:8,justifyContent:"space-between",alignItems:"center",className:y.Z.searchForm,children:[(0,n.tZ)(_.K,{ref:p,leftIcon:(0,n.tZ)(f.gq,{children:(0,n.tZ)(s.Z,{size:16})}),rightIcon:(0,n.tZ)(f.gq,{cursor:"pointer",onClick:T,children:P||i?(0,n.tZ)(d.Z,{size:16}):null}),placeholder:o("Search"),onChange:a()(e=>{Z(e.target.value),(0,m.j)(m.FP.TRANSCRIPTION_SEARCHED,{post_id:t})},100),onKeyDown:e=>{"Enter"===e.key&&N(),"Escape"===e.key&&T()}}),C&&(0,n.tZ)(f.gq,{gap:8,paddingRight:8*!!l,children:(0,n.BX)(f.gq,{alignItems:"center",gap:8,children:[(0,n.tZ)(b.xv.B4,{paddingLeft:l?4:16,className:y.Z.resultsValue,color:"primary",weight:"semibold",children:"".concat(I+1," / ").concat(S.length)}),(0,n.BX)(f.gq,{children:[(0,n.tZ)(v.hU,{priority:"tertiary",size:"sm",onClick:()=>{let e=I-1<0?S.length-1:I-1;x(S[e].start)},children:(0,n.tZ)(c.Z,{size:20})}),(0,n.tZ)(v.hU,{priority:"tertiary",size:"sm",onClick:N,children:(0,n.tZ)(u.Z,{size:20})})]})]})})]})}},38242:function(e,t,i){i(16584),i(19081)},5952:function(e,t,i){i.d(t,{Bk:()=>F,WS:()=>E,bN:()=>L});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(85685),s=i(95441),d=i(92291),c=i(77338),u=i(42375),p=i(93963),h=i(47395),m=i(25991),g=i(81437),v=i(85527),f=i(53678),b=i(16451),_=i(76721),y=i(68833),Z=i(80878),w=i(7882),k=i(98914),C=i(19081),S=i(58175),x=i(15503),B=i(27744),P=i(2009);i(33017);var I=i(31377),N=i(63651),T=i(5749);function E(e){var t,i,l,a,s;let{comment:c,item:f,isParent:_,showReplyingTo:S,showContext:T,utm_content:E,parentCommentUserId:X,hideable:M=!1}=e,F=(0,u.rI)(),U=(0,v.F)(),O=(0,B.de)(f),A=()=>(0,x.rw)(f,F,"profile",{tabId:U}),D=!c.ancestor_path,z=f.publication&&f.post&&(0,I.getPostAuthor)(f.publication,f.post),j=(0,w.ib)({pathname:"/api/v1/trending-topics/toggle",method:"POST"}),H=null;if(!D){let e=null===(t=c.ancestor_path)||void 0===t?void 0:t.split(".").pop(),n=e&&Number(e);H=null!==(l=null===(i=f.parentComments)||void 0===i?void 0:i.find(e=>(null==e?void 0:e.id)===n))&&void 0!==l?l:null}let W=S&&(D&&z||!D&&H),q=async()=>{var e,t,i,n,o;(0,x.rw)(f,F,"context",{tabId:U}),(0,y.j)(y.FP.SEE_MORE_NOTES_IN_CATEGORY_CLICKED,{tagId:null===(e=f.context.tag)||void 0===e?void 0:e.id,noteId:null===(t=f.comment)||void 0===t?void 0:t.id}),await j.refetch({method:"POST",json:{enable:!0,categoryID:null===(n=f.context)||void 0===n?void 0:null===(i=n.tag)||void 0===i?void 0:i.id}}),(0,k.uX)("/home/category/".concat(null===(o=f.context.tag)||void 0===o?void 0:o.id),{local_navigation:!1})},Y=(0,I.getCommentAuthor)(c),V=!_&&["comment_like","comment_restack"].includes(f.context.type);return(0,r.tZ)(b.oM,{showGutter:_,hasContext:T,onClick:e=>{if(!e.defaultPrevented&&!O){(0,x.rw)(f,F,"item",{tabId:U});let t="search"===F&&"undefined"!=typeof location?location.pathname:null,i=(0,N.Sgq)(c,{noBase:!c.hidden&&P.L,urlParams:{utmSource:t}});(0,Z.Q)(e,c.hidden&&f.publication?(0,N.W1P)(f.publication,{addBase:!0,params:{next:i}}):i,{newTab:!!c.hidden,native:c.hidden,state:{showBack:!0}})}},entityKey:f.entity_key,children:(0,r.BX)(g.n,{user:Y,item:f,comment:c,children:[T||V?(0,r.tZ)(h.L,{context:f.context,onClick:()=>(0,x.rw)(f,F,"context",{tabId:U}),utm_content:E}):null,f.context.tag?(0,r.tZ)(h.L,{context:(0,o._)((0,n._)({},f.context),{type:"topic"}),onClick:q,utm_content:E}):null,(0,r.BX)(C.gq,{gap:12,alignItems:"start",children:[(0,r.tZ)(b.Fb,{user:Y,onClick:A,utm_content:E}),(0,r.BX)(C.tu,{gap:8,flex:"grow",minWidth:0,children:[(0,r.BX)(C.tu,{gap:12,children:[(0,r.BX)(C.tu,{gap:4,children:[(0,r.tZ)(m.Ev,{author:Y,post:null!==(a=f.post)&&void 0!==a?a:void 0,comment:c,onClick:A,utm_content:E,publication:null!==(s=f.publication)&&void 0!==s?s:void 0,item:f,allowHide:M,parentCommentUserId:X}),W&&(0,r.tZ)(R,{isTopLevel:D,postAuthor:z,parentComment:H,item:f}),c.body&&(0,r.tZ)(L,{comment:c,item:f})]}),c.attachments&&(0,r.tZ)(d.yd,{parent:c,attachments:c.attachments,onAttachmentClick:function(){let{commentId:e,attachmentType:t,attachmentId:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,x.rw)(f,F,"attachment",{tabId:U,extraEventProps:{commentId:e,clicked_attachment_type:t,clicked_attachment_id:i}})},utm_content:E,item:f})]}),!c.hidden&&(0,r.tZ)(p.$w,{item:f,comment:c})]})]})]})})}function L(e){let{comment:t,item:i,large:n,paddingRight:o}=e,a=(0,u.rI)(),s=(0,v.F)(),{bodyJson:d,truncatedBodyJson:p,isTruncated:h,shouldExpandInline:m}=(0,_.Z)(t),[g,f]=(0,l.eJ)(!1),y=n||!h||g,Z=y?d:p;return(0,r.BX)(C.tu,{className:T.Z.feedCommentBody,paddingRight:o,children:[(0,r.tZ)(b.sP,{children:t.hidden&&i?(0,r.tZ)(X,{pub:null==i?void 0:i.publication}):Z&&(0,r.tZ)(c.x,{content:Z,onLinkClicked:()=>{i&&(0,x.rw)(i,a,"link",{tabId:s,extraEventProps:{commentId:t.id}})},attachedLinks:F(t)},y)}),!y&&(0,r.tZ)(M,{onClick:e=>{i&&(0,x.rw)(i,a,"see_more",{tabId:s,extraEventProps:{commentId:t.id}}),m?(e.preventDefault(),f(!0)):(0,k.uX)((0,N.Sgq)(t,{noBase:P.L,urlParams:{utmSource:"search"===a&&"undefined"!=typeof location?location.pathname:null}}),{event:e,state:{showBack:!0}})}})]})}function X(e){let{pub:t}=e;return(0,r.BX)(r.HY,{children:[(0,r.BX)("i",{children:["This comment is only visible to paid subscribers of ",null==t?void 0:t.name]}),(0,r.tZ)("br",{}),(0,r.tZ)("b",{children:"Subscribe to view →"})]})}function M(e){let{iString:t}=(0,s.M1)();return(0,r.BX)(C.hs,{className:T.Z.seeMore,children:[(0,r.tZ)(C.hs,{className:T.Z.seeMoreFade}),(0,r.tZ)(S.xv.B3,{color:"secondary",weight:"medium",className:T.Z.seeMoreText,children:(0,r.tZ)(f.hh,(0,o._)((0,n._)({},e),{children:t("See more")}))})]})}function R(e){var t;let{isTopLevel:i,postAuthor:n,parentComment:o,item:l}=e,s=i?n:o?{id:o.user_id,user_id:o.user_id,name:o.name,photo_url:o.photo_url}:n,d=i?(0,N.mx9)(l.publication,l.post,{noBase:P.L}):(0,N.Sgq)(o,{noBase:P.L}),c=(null===(t=i?n:o)||void 0===t?void 0:t.name)||"";return s?(0,r.BX)(S.xv.B5,{color:"secondary",translated:!0,children:["Replying to"," ",(0,r.tZ)(a.ProfileHoverCard,{subject:s,dontStopPropagation:!0,utmSource:"feed",children:(0,r.tZ)(f.hh,{href:d,children:I18N.p(c)})})]}):null}function F(e){return e.attachments?e.attachments.map(e=>"link"===e.type?e.linkMetadata.url:"post"===e.type?(0,N.uRy)(e.publication,e.post):"publication"===e.type?(0,N.SVA)(e.publication):"comment"===e.type?(0,N.Sgq)(e.comment):"").filter(Boolean):[]}},93963:function(e,t,i){i.d(t,{$w:()=>U,l8:()=>O});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(98661),s=i(94184),d=i.n(s),c=i(21465),u=i(66289),p=i(53804),h=i(25226),m=i(95441),g=i(60807),v=i(42375),f=i(85527),b=i(68833),_=i(7882),y=i(98914),Z=i(15771),w=i(19081),k=i(44424),C=i(58175),S=i(15503),x=i(27744),B=i(21972),P=i(88817),I=i(75419),N=i(43681),T=i(39493),E=i(61412),L=i(42886),X=i(63651),M=i(84864),R=i(47929),F=i(54888);function U(e){var t,i;let{item:o,comment:r,disableRestack:a}=e,s=(0,v.rI)(),d=(0,f.F)(),c=(0,x.I0)(),u=(0,I.i3)(),p=(0,g.aF)(),{requireLogin:h}=(0,P.SJ)(),m=(0,_.ib)({pathname:"/api/v1/comment/".concat(r.id,"/reaction"),method:"POST"}),b=(0,I.oC)(o);if(!o)return null;let{publication:Z,post:w}=o,k=!!(w&&Z&&!(0,M.commentsEnabledForPost)({publication:Z,post:w})),C=a||!!(w&&Z&&!(0,M.restacksEnabledForPost)({publication:Z,post:w})),B=r.reaction_count||0,N=!!r.reaction,T=()=>{null==h||h()},E=async e=>{if(e.preventDefault(),!p){T();return}let t=!N;c({type:"comment_like",payload:{commentId:r.id,isLiked:t}});try{var i,l;await m.refetch({method:t?"POST":"DELETE",json:(0,n._)({publication_id:(null==Z?void 0:Z.id)||null,reaction:"❤",tabId:d},t&&"comment_restack"===o.context.type&&{restacking_user_id:null===(l=o.context.users)||void 0===l?void 0:null===(i=l[0])||void 0===i?void 0:i.id})})}catch(e){c({type:"comment_like",payload:{commentId:r.id,isLiked:!t}}),alert((0,y.zx)(e));return}(0,S.rw)(o,s,"like",{tabId:d})};return(0,l.BX)(A,{children:[(0,l.tZ)(D,{count:B,active:N,disabled:!1,onClick:E}),(0,l.tZ)(z,{count:null!==(t=r.children_count)&&void 0!==t?t:0,disabled:k,onClick:e=>{var t,i;if(e.preventDefault(),!p){T();return}u.open({feedItem:o,parentPubId:null!==(t=r.publication_id)&&void 0!==t?t:void 0,parentPostId:null!==(i=r.post_id)&&void 0!==i?i:void 0,parentCommentId:r.id,tabId:d,surface:s}),(0,S.rw)(o,s,"comment",{tabId:d,extraEventProps:{reply_requirement:b,reply_locked:!!b}})},replyRequirement:b}),p?(0,l.tZ)(W,{pub:null!=Z?Z:void 0,post:null!=w?w:void 0,comment:r,feedItem:o,disabled:C,onOpen:e=>(0,S.rw)(o,s,"restack",{tabId:d,extraEventProps:{isRestacked:e}}),surface:s}):(0,l.tZ)(j,{count:null!==(i=r.restacks)&&void 0!==i?i:0,disabled:C,onClick:T}),(0,l.tZ)(q,{publication:null!=Z?Z:void 0,post:null!=w?w:void 0,comment:r,item:o})]})}function O(e){var t,i,o;let{item:r,pub:a,post:s,onLike:d}=e,c=(0,v.rI)(),u=(0,f.F)(),p=(0,I.i3)(),h=(0,g.aF)(),{requireLogin:m}=(0,P.SJ)(),b=(0,B.B)(s.id,(0,n._)({tabId:u},(null==r?void 0:r.context.type)==="post_restack"&&{restacking_user_id:null===(i=r.context.users)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:t.id})),_=(0,B.I)(s),y=!!s.reaction,Z=null!==(o=s.child_comment_count)&&void 0!==o?o:0,w=(0,I.oC)(r),k=!a.community_enabled,C=!(0,M.commentsEnabledForPost)({publication:a,post:s}),x=async e=>{if(e.preventDefault(),!h){null==m||m();return}let t=!s.reaction;await b(s.id,t)&&(null==d||d(t),r&&(0,S.rw)(r,c,"like",{tabId:u}))},N=e=>{if(null==e||e.preventDefault(),!h){null==m||m();return}p.open({feedItem:r,parentPubId:s.publication_id,parentPostId:s.id,tabId:u,surface:c}),r&&(0,S.rw)(r,c,"comment",{tabId:u})};return(0,E.B)({name:"post-comment",action:N}),(0,l.BX)(A,{children:[(0,l.tZ)(D,{count:_,active:y,disabled:k,onClick:x}),(0,l.tZ)(z,{count:Z,replyRequirement:w,onClick:N,disabled:C}),(0,l.tZ)(W,{disabled:k,pub:a,post:s,feedItem:r,surface:c}),(0,l.tZ)(q,{publication:a,post:s,item:r,twitterText:(0,M.resolveTwitterShareText)({pub:a,post:s})})]})}function A(e){let{children:t}=e;return(0,l.tZ)(w.hs,{flex:"grow",justifyContent:"start",gap:8,className:F.Z.ufiContainer,children:t})}function D(e){let{count:t,className:i,onClick:n,active:o,disabled:r}=e,[s,c]=(0,a.useState)(!1),{iString:u}=(0,m.M1)();return(0,l.tZ)(Y,{onClick:e=>{c(!0),null==n||n(e)},className:d()(i,F.Z.like,s&&F.Z.clickedOnce),count:t,active:o,disabled:r,"aria-label":u("like"),children:(0,l.tZ)(K,{isLiked:null!=o&&o})})}function z(e){let{count:t,className:i,onClick:n,active:o,disabled:r,replyRequirement:a}=e,{iString:s}=(0,m.M1)();return(0,l.tZ)(Y,{onClick:n,className:d()(i,F.Z.comment),count:t,active:o,disabled:r,tooltip:"paid_subscriber"===a?"Only paid subscribers can reply.":"free_subscriber"===a?"Only subscribers can reply.":void 0,"aria-label":s("Comment"),children:a?(0,l.tZ)(u.Z,{strokeWidth:1.5}):(0,l.tZ)(c.Z,{})})}let j=(0,a.forwardRef)((e,t)=>{let{count:i,className:n,onClick:o,active:r,disabled:s}=e,[c,u]=(0,a.useState)(!1),{iString:p}=(0,m.M1)();return(0,l.tZ)(Y,{onClick:e=>{u(!0),null==o||o(e)},className:d()(n,F.Z.restack,c&&F.Z.clickedOnce),"aria-label":p("Restack menu"),ref:t,count:i,active:r,disabled:s,children:(0,l.tZ)(J,{isRestacked:null!=r&&r})})}),H=(0,a.forwardRef)((e,t)=>{let{count:i,className:n,onClick:o,active:r,disabled:a}=e,{iString:s}=(0,m.M1)();return(0,l.tZ)(Y,{className:d()(n,F.Z.share),"aria-label":s("Share menu"),onClick:o,ref:t,count:i,active:r,disabled:a,children:(0,l.tZ)(h.Z,{})})});function W(e){let{pub:t,post:i,comment:n,feedItem:o,onOpen:r,disabled:a,surface:s}=e,d=(0,f.F)(),{canRestack:c,isRestacked:u,restacks:p,menuItems:h,nuxModal:m}=(0,T.K)({pub:t,post:i,comment:n,feedItem:o,tabId:d,surface:s});return c?(0,l.BX)(l.HY,{children:[m,(0,l.tZ)(k.v2,{trigger:(0,l.tZ)(j,{count:p,"aria-label":"menu",active:u,disabled:a}),title:"Restack",onOpen:()=>null==r?void 0:r(u),children:h})]}):null}function q(e){let{publication:t,post:i,comment:n,item:o,twitterText:r}=e,a=(0,v.rI)(),s=(0,f.F)(),d=(0,g.aF)(),c=d?d.id.toString(36):void 0,u=o&&(0,L.D2)(o)&&"post"===o.type&&o.mediaClip?o.mediaClip:void 0,p=n?(0,X.Sgq)(n,{urlParams:{utm_source:R.b3.notesShareAction,r:c}}):i?(0,X.mx9)(t,i,{urlParams:{utm_source:R.b3.notesShareAction,r:c},mediaClip:u}):null,h=(0,N.wg)({variant:"menu",url:p,twitterText:r,onLinkClicked:e=>{(0,b.j)(b.FP.FEED_ITEM_SHARE_LINK_CLICKED,{type:e,shared_post_id:null==i?void 0:i.id,shared_comment_id:null==n?void 0:n.id})},comment:n});return(0,l.tZ)(k.v2,{trigger:(0,l.tZ)(H,{}),title:"Share",maxHeight:350,onOpen:()=>{o&&(0,S.rw)(o,a,"share",{tabId:s})},children:h})}let Y=(0,a.forwardRef)((e,t)=>{var i,s,{className:c,active:u,disabled:p,count:h,children:m}=e,g=(0,r._)(e,["className","active","disabled","count","children"]);let v=!h||0===h,f=(0,a.useRef)(null),[b,_]=(0,a.useState)(0);(0,a.useLayoutEffect)(()=>{f.current&&_(f.current.offsetWidth)},[h]);let y=h?8:7,k=4*!h,C=null!==(s=null===(i=f.current)||void 0===i?void 0:i.offsetWidth)&&void 0!==s?s:0,S=v?32:18+6*!!b+b+2*y;return(0,l.tZ)(w.hs,{className:F.Z.buttonContainer,style:{"--button-min-width":"".concat(32,"px"),"--button-icon-width":"".concat(18,"px"),"--button-gap":"".concat(6,"px"),"--button-inner-padding":"".concat(y,"px"),"--button-outer-padding":"".concat(k,"px"),"--button-label-width":"".concat(C,"px"),"--button-final-width":"".concat(S,"px")},children:(0,l.BX)(Z.kG,(0,o._)((0,n._)({className:d()(c,F.Z.button,u&&F.Z.active,v&&F.Z.zero),resetCss:!0,ref:t,disabled:p,userSelect:"none"},g),{children:[m,(0,l.tZ)(V,{count:h,hidden:v,ref:f})]}))})});function V(e){let{count:t,hidden:i,ref:n}=e;return(0,l.tZ)(C.xv.B4,{className:d()(F.Z.count,i&&F.Z.hidden),ref:n,children:t?(0,M.numberToRoughShortString)(Math.max(t,1),{plusSignifier:""}):""})}function K(e){let{isLiked:t}=e;return(0,l.BX)("div",{className:d()(F.Z.heartWrapper,F.Z.icon,t&&F.Z.isLiked),children:[(0,l.tZ)("svg",{className:F.Z.heart,viewBox:"0 0 20 20",children:(0,l.tZ)("path",{d:"M5.00002 2.54822C8.00003 2.09722 9.58337 4.93428 10 5.87387C10.4167 4.93428 12 2.09722 15 2.54822C18 2.99923 18.75 5.66154 18.75 7.05826C18.75 9.28572 18.1249 10.9821 16.2499 13.244C14.3749 15.506 10 18.3333 10 18.3333C10 18.3333 5.62498 15.506 3.74999 13.244C1.875 10.9821 1.25 9.28572 1.25 7.05826C1.25 5.66154 2 2.99923 5.00002 2.54822Z"})}),(0,l.tZ)("div",{className:F.Z.sparks,style:"--total-sparks: ".concat(8),children:Array(8).fill(0).map((e,t)=>(0,l.tZ)("div",{className:F.Z.spark,style:"--i: ".concat(t+1,";")}))})]})}function J(e){let{isRestacked:t}=e;return(0,l.tZ)(w.hs,{className:d()(F.Z.restackWrapper,F.Z.icon,t&&F.Z.isRestacked),children:(0,l.tZ)(p.Z,{className:F.Z.restackIcon})})}},81914:function(e,t,i){i.d(t,{Bm:()=>ee,O3:()=>k.O3,_Q:()=>eo});var n=i(7409),o=i(99282),r=i(16584),l=i(98661),a=i(30396),s=i(94184),d=i.n(s),c=i(2647),u=i(20888),p=i(95441),h=i(40647),m=i(60807),g=i(5952),v=i(42375),f=i(98170),b=i(12337),_=i(12302),y=i(93963),Z=i(95128),w=i(31465),k=i(87447),C=i(73730),S=i(47395),x=i(25991),B=i(81437),P=i(85527),I=i(53678),N=i(16451),T=i(69181),E=i(62981),L=i(80878),X=i(98750),M=i(80026),R=i(17172),F=i(63474),U=i(45783),O=i(15503),A=i(27744),D=i(3021),z=i(2009),j=i(2017),H=i(88817),W=i(65575),q=i(91400),Y=i(76820),V=i(31377),K=i(42886),J=i(33884),G=i(63651),Q=i(47929),$=i(5749);let ee=(0,l.memo)(function(e){let{item:t,className:i,showLoginPrompt:n}=e,o=et[t.type];return o?(0,r.tZ)(o,{item:t,className:i,children:n&&(0,r.tZ)(eo,{version:"login"})}):null}),et={post:function(e){let{item:t,className:i,children:n}=e,o=(0,v.rI)(),l=(0,a.qp)(P.q),{iString:s}=(0,p.M1)();return(0,r.BX)(k.rF,{item:t,className:i,ariaLabel:s("Post"),children:[n,(0,r.tZ)(er,{item:t,context:(0,r.tZ)(S.L,{context:t.context,onClick:()=>(0,O.rw)(t,o,"context",{tabId:l}),utm_content:t.entity_key}),hideable:!0})]})},comment:function(e){var t,i;let{item:n,className:o,children:l}=e,{iString:s}=(0,p.M1)(),{publication:d,post:c,comment:u,parentComments:h}=n,m=d||c||!h||1===h.length?void 0:h[0],f=null!==(i=h&&h[h.length-1])&&void 0!==i?i:null,b=d&&c&&(0,V.getPostAuthor)(d,c),_="comment_restack"!==n.context.type&&"comment_like"!==n.context.type,y=(0,v.rI)(),Z=(0,a.qp)(P.q),w="comment_restack"===n.context.type||"comment_like"===n.context.type?"user/".concat(null===(t=n.context.users[0])||void 0===t?void 0:t.id):n.entity_key;return(0,r.tZ)(k.rF,{item:n,className:o,ariaLabel:s("Note"),children:(0,r.BX)(r.HY,{children:[l,(0,r.BX)(el,{children:[_&&(0,r.tZ)(ea,{author:b,rootFeedComment:m,parentComments:h,parentComment:f,item:n,utm_content:w,feedSurface:y,tabId:Z}),(0,r.tZ)(g.WS,{comment:u,item:n,showReplyingTo:!_,utm_content:w,hideable:!0})]})]})})},userSuggestions:function(e){let{item:t}=e,i=(0,q.XA)(),l=(0,a.sO)(null),s=(0,R.aZ)(l),{state:d,handleArrowClick:c}=(0,W.eK)(l,{scrollFullPage:!0}),u=(0,m.SE)(),p=(0,J.kM)();return(0,X.UM)(l,()=>{u.changeSetting("suggestions_feed_item_last_shown_at",new Date().toISOString())},{threshold:.2}),(0,r.tZ)(k.rF,{item:t,children:(0,r.BX)(M.tu,{paddingTop:16,children:[(0,r.BX)(M.hs,{alignItems:"center",justifyContent:"space-between",paddingLeft:{mobile:16,desktop:0},children:[(0,r.tZ)(M.xv.H4,{translated:!0,children:(0,r.tZ)(I.hh,{onClick:e=>(0,L.Q)(e,p),children:"Suggestions"})}),(0,r.tZ)(M.zx,{size:"sm",priority:"tertiary",onClick:e=>(0,L.Q)(e,p),children:"See all"})]}),(0,r.BX)(M.hs,{className:$.Z.peopleYouMayKnowContainer,alignItems:"center",flex:"grow",position:"relative",children:[(0,r.tZ)(M.hs,{flex:"grow",overflow:"hidden",children:(0,r.BX)(M.hs,(0,o._)((0,n._)({},s.props),{ref:l,className:$.Z.peopleYouMayKnow,alignItems:"center",gap:8,paddingX:{desktop:0,mobile:16},paddingBottom:16,paddingTop:12,children:[!1,t.userSuggestions.map(e=>(0,r.tZ)(D.E$,{feedUserSuggestion:e,surface:"feed"}))]}))}),!i&&(0,r.BX)(r.HY,{children:[(0,r.tZ)(U.rQ,{direction:"left",isVisible:d.showLeft,onClick:c(-1)}),(0,r.tZ)(U.rQ,{direction:"right",isVisible:d.showRight,onClick:c(1)})]})]})]})})},twitterConnect:function(e){let{item:t}=e,{getConfigFor:i}=(0,h.xR)();return i("twitter_connect_flows_enabled")?(0,r.tZ)(k.rF,{item:t,children:(0,r.tZ)(M.hs,{paddingY:20,children:(0,r.tZ)(D.rS,{})})}):null},facebookConnect:function(e){let{item:t}=e;return(0,r.tZ)(k.rF,{item:t,children:(0,r.tZ)(M.hs,{paddingY:20,children:(0,r.tZ)(D.KL,{})})})},inviteFriends:function(e){let{item:t}=e,[i]=(0,E.Z)(D.au);return i?null:(0,r.tZ)(k.rF,{item:t,children:(0,r.tZ)(M.hs,{paddingY:20,paddingX:20,children:(0,r.tZ)(D.Zx,{utmSource:"feed_item"})})})},featuredPublication:C.a,featuredCollection:w.e,chat:function(e){let{item:t}=e,{iString:i}=(0,p.M1)();return t.community_post.user&&(0,r.tZ)(k.rF,{item:t,ariaLabel:i("Chat"),children:(0,r.tZ)(b.O,{item:t,author:t.community_post.user})})},profileSearchResults:function(e){let{item:t}=e;return(0,r.tZ)(k.rF,{item:t,children:(0,r.tZ)(_.Z,{item:t})})},categoryLeaderboard:Z.w},ei=()=>{let{iString:e}=(0,p.M1)(),{requireLogin:t,onboardingModalRef:i}=(0,H.SJ)();return(0,r.BX)(r.HY,{children:[(0,r.tZ)(M.xv,{size:19,color:"primary",font:"display",fontWeight:"semibold",translated:!0,children:"Log in for more"}),(0,r.tZ)(M.xv,{color:"secondary",size:15,translated:!0,children:"Or create an account"}),(0,r.BX)(M.gq,{gap:8,paddingTop:8,children:[(0,r.tZ)(M.zx,{style:{width:"138px"},size:"sm",priority:"secondary-outline",onClick:()=>null==t?void 0:t(),children:e("Login")}),(0,r.tZ)(M.zx,{onClick:()=>{var e;return null===(e=i.current)||void 0===e?void 0:e.open()},style:{width:"138px"},size:"sm",priority:"primary",children:e("Create account")})]})]})},en=e=>{let{onDismiss:t}=e,{iString:i}=(0,p.M1)();return(0,r.BX)(M.tu,{alignItems:"center",gap:16,paddingY:16,paddingX:24,paddingTop:32,children:[(0,r.tZ)(M.hs,{width:48,paddingY:4,radius:"md",border:"detail",alignItems:"center",justifyContent:"center",bg:"primary",children:(0,r.tZ)(u.e,{src:"https://substack.com/img/substack.png",maxWidth:40,useRetinaSizing:!0,imageIsFixedWidth:!0})}),(0,r.tZ)(M.xv.B2,{size:17,textAlign:"center",font:"display",fontWeight:"semibold",translated:!0,children:"Get every post and note from creators you love with the Substack app."}),(0,r.BX)(M.tu,{style:{width:"100%"},padding:16,gap:8,children:[(0,r.tZ)(M.zx,{size:"md",priority:"primary",onClick:t,href:(0,G.h4i)({tab:"notes",redirect:"app-store",utm_source:Q.b3.menu}),newTab:!0,children:i("Switch to the app")}),(0,r.tZ)(M.zx,{onClick:t,size:"md",priority:"secondary",children:i("Maybe later")})]})]})},eo=e=>{let{onDismiss:t,version:i,asParent:n}=e,o=(0,q.XA)();return(0,r.BX)(M.tu,{borderTop:n?"detail":"transparent",gap:8,justifyContent:"center",alignItems:"center",className:d()($.Z.transparentLoginPrompt,"app"===i&&$.Z.appPrompt,n&&$.Z.asParent),minHeight:o?400:void 0,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:["login"===i&&(0,r.tZ)(ei,{}),"app"===i&&(0,r.tZ)(en,{onDismiss:t})]})};function er(e){var t,i;let{item:n,showGutter:o,context:l,hideable:s=!1}=e,{publication:d,post:c}=n,u=d&&c?(0,V.getPostAuthor)(d,c):void 0,p=(0,v.rI)(),h=(0,a.qp)(P.q),m=(0,A.de)(n),g=()=>(0,O.rw)(n,p,"profile",{tabId:h}),b="post"===n.type&&n.mediaClip?n.mediaClip.clip_info:null;return d&&c&&u?(0,r.tZ)(N.oM,{onClick:e=>{e.defaultPrevented||m||((0,O.rw)(n,p,"item",{tabId:h}),(0,L.Q)(e,(0,G.mx9)(d,c,{noBase:z.L,mediaClip:"post"===n.type&&n.mediaClip||void 0})))},showGutter:o,hasContext:!!l,entityKey:n.entity_key,children:(0,r.BX)(B.n,{user:u,item:n,children:[l,(0,r.BX)(M.hs,{gap:12,alignItems:"start",children:[(0,r.tZ)(N.Fb,{user:u,onClick:g,utm_content:n.entity_key}),(0,r.BX)(M.tu,{gap:8,flex:"grow",minWidth:0,children:[(0,r.BX)(M.tu,{gap:12,children:[(0,r.tZ)(x.Ev,{author:u,post:c,onClick:g,utm_content:n.entity_key,publication:d,item:n,allowHide:s}),c&&(null===(i=c.liveStream)||void 0===i?void 0:null===(t=i.liveStream)||void 0===t?void 0:t.status)&&["scheduled","pending","active"].includes(c.liveStream.liveStream.status)?(0,r.tZ)(j.h,{liveStream:c.liveStream,post:c}):(0,K.D2)(n)&&c.videoUpload?(0,r.tZ)(Y.Jl,{tag:(0,r.tZ)(T.u0,{item:n,pub:d,post:c}),composing:!1,mediaUpload:c.videoUpload,videoPlayerProps:(0,f.$l)({post:c,item:n,clipInfo:b})}):(0,r.tZ)(f.tg,{item:n,publication:d,post:c,onClick:()=>(0,O.rw)(n,p,"attachment",{tabId:h}),clipInfo:b})]}),(0,r.tZ)(y.l8,{item:n,pub:d,post:c})]})]})]})}):null}let el=(0,F.zo)({gap:8},F.sg);function ea(e){var t,i;let{author:n,rootFeedComment:o,parentComments:l,parentComment:a,item:s,utm_content:d,feedSurface:c,tabId:u}=e,p="note_reply"===s.context.type&&s.comment.user_id!==(null!==(i=null==n?void 0:n.id)&&void 0!==i?i:null==l?void 0:null===(t=l[0])||void 0===t?void 0:t.user_id);return(0,r.BX)(r.HY,{children:[n?(0,r.BX)(r.HY,{children:[(0,r.tZ)(er,{item:s,showGutter:!0,context:p?(0,r.tZ)(S.L,{context:s.context,onClick:()=>(0,O.rw)(s,c,"context",{tabId:u}),utm_content:d}):void 0}),(null==l?void 0:l.length)&&(null==l?void 0:l.length)>1&&a&&(0,r.tZ)(es,{url:(0,G.Sgq)(a,{noBase:z.L}),showGutter:!0})]}):o?(0,r.BX)(r.HY,{children:[(0,r.tZ)(g.WS,{isParent:!0,comment:o,item:s,showContext:p,utm_content:d}),(null==l?void 0:l.length)&&(null==l?void 0:l.length)>2&&a&&(0,r.tZ)(es,{url:(0,G.Sgq)(a,{noBase:z.L}),showGutter:!0})]}):null,a&&(null==l?void 0:l.length)&&(0,r.tZ)(g.WS,{showReplyingTo:(null==l?void 0:l.length)>2,isParent:!0,comment:a,item:s,showContext:p&&!(n||o),utm_content:d})]})}function es(e){let{url:t,showGutter:i}=e;return(0,r.tZ)(N.oM,{onClick:e=>(0,L.Q)(e,t),showGutter:i,hasAvatar:!1,children:(0,r.BX)(M.gq,{children:[(0,r.BX)(M.tu,{alignItems:"center",justifyContent:"center",className:$.Z.seeMoreThread,children:[(0,r.tZ)(M.tu,{className:d()($.Z.seeMoreThreadSegment,$.Z.top)}),(0,r.tZ)(c.Z,{size:16,stroke:"var(--color-utility-detail)"}),(0,r.tZ)(M.tu,{className:$.Z.seeMoreThreadSegment,flex:"grow"})]}),(0,r.tZ)(M.tu,{className:$.Z.seeMoreReplies,flex:"grow",minWidth:0,children:(0,r.tZ)(M.xv.B4,{color:"accent-cyan",children:(0,r.tZ)(I.hh,{href:t,children:"See more replies"})})})]})})}},25991:function(e,t,i){i.d(t,{Et:()=>N,Ev:()=>I,Gf:()=>D,KF:()=>A,Lg:()=>T,c9:()=>M,mn:()=>R,nH:()=>B});var n=i(7409),o=i(99282),r=i(16584);i(35543);var l=i(95441),a=i(40647),s=i(60807);i(5952);var d=i(42375),c=i(62110),u=i(13748),p=i(53678),h=i(16451),m=i(71068),g=i(15771),v=i(19081),f=i(58175),b=i(71460),_=i(15503),y=i(2009),Z=i(32189),w=i(43254),k=i(98012),C=i(42886),S=i(63651),x=i(47929);let B=["post_like","post_restack","comment_like"],P=["search","note-related","profile","publication","permalink"];function I(e){let{author:t,post:i,comment:n,onClick:o,utm_content:l,publication:s,item:p,allowHide:h=!1,timestamp:m,hideSubscribeCta:g}=e,f=(0,d.rI)(),b=m||(null==n?void 0:n.date)||(null==i?void 0:i.post_date),_=P.includes(f),y=!!(0,a.xR)().getConfigFor("feed_item_source_debug_mode"),Z=y&&p&&"trackingParameters"in p,w=p&&(0,C.D2)(p,n);return(0,r.BX)(A,{children:[(0,r.BX)(D,{children:[(0,r.tZ)(T,{user:t,onClick:o,utm_content:l}),b&&(0,r.tZ)(R,{timestamp:b,comment:n}),y&&p&&(0,r.tZ)(F,{item:p,showEntityKey:!0,showDebugDot:null!=Z&&Z})]}),!g&&t&&p&&!_&&(0,r.tZ)(E,{author:t,item:p,comment:null!=n?n:void 0,post:null!=i?i:void 0,publication:null!=s?s:void 0}),w&&"post"===p.type&&i&&s&&(0,r.tZ)(c._,{item:p,pub:s,post:i}),(0,r.tZ)(v.hs,{maxHeight:20,gap:12,alignItems:"center",children:(0,r.tZ)(u.U,{publication:s,post:i,comment:n,item:p,allowHide:h})})]})}function N(e){let{user:t}=e;return(0,r.tZ)(A,{children:(0,r.BX)(D,{children:[(0,r.tZ)(f.xv,{as:"span",weight:"medium",children:t.name}),(0,r.tZ)(b.UserBadge,{tier:t.bestseller_tier,userId:t.id,tooltipOnHover:!0,size:"xs"})]})})}function T(e){let{user:t,onClick:i,utm_content:n,disableHoverCard:o}=e;return(0,r.BX)(r.HY,{children:[(0,r.tZ)(f.xv,{as:"span",weight:"medium",children:(0,r.tZ)(p.xG,{user:t,onClick:i,utm_source:x.b3.substackFeedItem,utm_content:n,disableHoverCard:o,children:t.name})}),(0,r.tZ)(b.UserBadge,{tier:t.bestseller_tier,userId:t.id,tooltipOnHover:!0,size:"xs"})]})}function E(e){let{author:t,comment:i,post:n,item:o,permalink:l,publication:a}=e,{finalPublication:c,isSubscribed:u,showCta:p,handleClick:h,currentUser:m}=function(e,t,i,n,o){var r,l;let a=(0,s.aF)(),c=(0,d.rI)(),u=i?"comment":n?"post":void 0,p=null!==(l=null!==(r=null==i?void 0:i.id)&&void 0!==r?r:null==n?void 0:n.id)&&void 0!==l?l:0,h=u?(0,S.D2I)(p,u):void 0,m=null!=o?o:e.primary_publication,g=(0,Z.x)({surface:"substack-feed-item",zIndex:1001})(m),v=(0,w._F)({user:e,publicationId:null==m?void 0:m.id,publicationName:null==m?void 0:m.name,subscriptionSource:"substack-feed-item",sourceNoteId:h});return{finalPublication:m,isSubscribed:v.isSubscribed,showCta:v.showCta,handleClick:e=>{(0,_.rw)(t,c,"subscribe"),!a&&m?g(e):v.isSubscribed?v.unsubscribe(e):v.subscribe(e)},currentUser:a}}(t,o,i,n,a);return(!m||m.id!==t.id)&&c&&p?(0,r.tZ)(l?X:L,{isSubscribed:u,onClick:h}):null}function L(e){let{isSubscribed:t,onClick:i}=e,{iString:n}=(0,l.M1)();return(0,r.tZ)(g.zx,{priority:t?"quaternary":"tertiary-accent",size:"xs",onClick:i,children:n(t?"Subscribed":"Subscribe")})}function X(e){let{isSubscribed:t,onClick:i}=e,{iString:n}=(0,l.M1)();return(0,r.tZ)(g.zx,{priority:t?"quaternary":"primary",size:"sm",onClick:i,children:n(t?"Subscribed":"Subscribe")})}let M=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"});function R(e){let{timestamp:t,comment:i,post:n,publication:o}=e;return(0,r.tZ)(p.hh,{href:i?(0,S.Sgq)(i,{noBase:y.L}):n?(0,S.mx9)(o,n):void 0,color:"secondary",title:M.format((0,k.Z)(t).toDate()),style:{marginLeft:4},children:(0,r.tZ)(h.Ku,{timestamp:t})})}function F(e){let{item:t,showEntityKey:i,showDebugDot:n}=e;return(0,r.BX)(v.hs,{flex:"grow",gap:4,alignItems:"center",justifyContent:"end",children:[i&&(0,r.tZ)(U,{item:t}),n&&(0,r.tZ)(O,{item:t})]})}function U(e){let{item:t}=e;return"entity_key"in t?(0,r.tZ)(f.xv.B4,{as:"span",color:"secondary",children:t.entity_key}):null}function O(e){var t;let i,n,{item:o}=e,{iString:a}=(0,l.M1)(),s=null===(t=o.trackingParameters)||void 0===t?void 0:t.item_source;return s?"model"===s?(i="accent-green",n="Model"):s.includes("db")?(i="accent-blue",n="DB"):s.includes("new-user")?(i="accent-purple",n="New user"):s.includes("topic-injection")?(i="accent-orange",n="Topic injection"):s.includes("trending")?(i="accent-red",n="Trending"):(i="tertiary",n="Other"):(i="accent-yellow",n="No source info"),(0,r.tZ)("span",{children:(0,r.tZ)(m.xu,{height:8,width:8,radius:"full",bg:i,color:"secondary",title:a(n)})})}let A=(0,m.zo)((0,o._)((0,n._)({},f.et),{display:"flex",minWidth:0,gap:8,alignItems:"center",height:20}));(0,m.zo)((0,o._)((0,n._)({},f.et),{display:"flex",minWidth:0,gap:12,alignItems:"center"}));let D=(0,m.zo)({display:"flex",flex:"grow",minWidth:0,gap:6,alignItems:"center"})},70394:function(e,t,i){i.d(t,{V:()=>a});var n=i(16584),o=i(347),r=i(19081),l=i(74312);function a(){return(0,n.tZ)(l.cr,{module:"../feed/PublicationPage",onRequest:()=>i.e("8118").then(i.bind(i,47002)),resolve:e=>e.PublicationFeedPage,whileLoading:(0,n.tZ)(s,{})})}function s(){return(0,n.tZ)(o.h,{children:(0,n.tZ)(r.hs,{bg:"primary",style:{minHeight:800}})})}},53678:function(e,t,i){i.d(t,{G6:()=>w,Zg:()=>y,hh:()=>k,xG:()=>Z});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(94184),s=i.n(a);i(98661);var d=i(85685),c=i(95441),u=i(60807),p=i(93252),h=i(58175),m=i(2009),g=i(50312),v=i(33017),f=i(60308),b=i(36186),_=i(29439);function y(e){var{user:t,utm_source:i,utm_content:a,ellipsis:s,useYou:d,onClick:p}=e,h=(0,r._)(e,["user","utm_source","utm_content","ellipsis","useYou","onClick"]);let{iString:m}=(0,c.M1)(),g=(0,u.aF)(),v=(null==t?void 0:t.id)||(null==t?void 0:t.user_id)||0,f=d&&(null==g?void 0:g.id)===v?m("You"):"name"in t?t.name:m("User");return(0,l.tZ)(Z,(0,o._)((0,n._)({user:t,utm_source:i,utm_content:a,ellipsis:s,onClick:p},h),{children:f}))}function Z(e){var{user:t,utm_source:i,utm_content:a,children:s,onClick:c,ellipsis:u,disableHoverCard:h}=e,g=(0,r._)(e,["user","utm_source","utm_content","children","onClick","ellipsis","disableHoverCard"]);let v=(0,o._)((0,n._)({},t),{id:t.author_id||t.user_id||t.id,name:t.user_profile_name||t.author_name||t.name,handle:(null==t?void 0:t.handle)||(null==t?void 0:t.author_handle)});return(0,l.tZ)(d.ProfileHoverCard,{subject:v,dontStopPropagation:!0,utmSource:"feed",inline:!0,disabled:h,children:(0,l.tZ)(k,(0,o._)((0,n._)({href:(0,b.NN)(t,{noBase:m.L,utm_content:a,utm_source:i}),onClick:c,showBack:!0,ellipsis:u,className:g.className,target:(0,p.P)()?"_blank":void 0},g),{children:s}))})}function w(e){var{publication:t,utm_source:i,utm_content:a,children:s,onClick:d,ellipsis:c,disableHoverCard:u}=e,h=(0,r._)(e,["publication","utm_source","utm_content","children","onClick","ellipsis","disableHoverCard"]);return(0,l.tZ)(v.Sm,{publication_id:t.id,dontStopPropagation:!0,utmSource:"feed",inline:!0,disabled:u,children:(0,l.tZ)(k,(0,o._)((0,n._)({href:(0,f.n1t)("".concat(t.base_url,"/"),{utm_content:a,utm_source:i}),onClick:d,ellipsis:c,className:h.className,target:(0,p.P)()?"_blank":void 0},h),{children:s}))})}function k(e){var{weight:t,color:i,decoration:a="hover-underline",ellipsis:d,native:c,className:u}=e,p=(0,r._)(e,["weight","color","decoration","ellipsis","native","className"]);let m=p.href,v=null==m?void 0:m.match(/^([a-z]+:)?\/\//),f=null!=c?c:v&&!(null==m?void 0:m.startsWith(document.location.origin));return(0,l.tZ)(h.xv,{as:"span",ellipsis:d,weight:t,color:i,decoration:a,children:f?(0,l.tZ)("a",(0,o._)((0,n._)({},p),{className:s()(u,_.Z.link)})):(0,l.tZ)(g.r,(0,o._)((0,n._)({},p),{className:s()(u,_.Z.link)}))})}},53030:function(e,t,i){i.d(t,{FI:()=>o,On:()=>r,md:()=>l});var n=i(30396);let o=e=>{var t,i;let o=null==e?void 0:null===(t=e.current)||void 0===t?void 0:t.player,[r,l]=(0,n.eJ)("number"==typeof(null==o?void 0:o.currentTime)?o.currentTime:0),[a,s]=(0,n.eJ)(!!o&&!o.paused);return(0,n.d4)(()=>{var t;let i=null===(t=e.current)||void 0===t?void 0:t.player;if(i){let e=e=>{"number"==typeof e.target.currentTime&&l(e.target.currentTime)},t=()=>s(!0),n=()=>s(!1),o=()=>s(!1);return i.addEventListener("timeupdate",e),i.addEventListener("play",t),i.addEventListener("pause",n),i.addEventListener("ended",o),i.paused||a||s(!0),()=>{i.removeEventListener("timeupdate",e),i.removeEventListener("play",t),i.removeEventListener("pause",n),i.removeEventListener("ended",o)}}},[null==e?void 0:null===(i=e.current)||void 0===i?void 0:i.player]),{currentTime:r,isPlaying:a}},r=e=>l(e.current),l=e=>{let t=null==e?void 0:e.player,[i,o]=(0,n.eJ)(!!t&&!t.paused);return(0,n.d4)(()=>{let t=null==e?void 0:e.player;if(t){let e=()=>o(!0),n=()=>o(!1),r=()=>o(!1);return t.addEventListener("play",e),t.addEventListener("pause",n),t.addEventListener("ended",r),t.paused||i||o(!0),()=>{t.removeEventListener("play",e),t.removeEventListener("pause",n),t.removeEventListener("ended",r)}}},[null==e?void 0:e.player]),i}},30707:function(e,t,i){i.d(t,{C:()=>s});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(70379);function s(){let e=(0,a.pm)();return(0,l.d4)(()=>{let t=new URL(location.toString());t.searchParams.get("founding-member-confirmation")&&(t.searchParams.delete("founding-member-confirmation"),history.replaceState({},"",t),e.popToast(e=>(0,r.tZ)(a.FN,(0,o._)((0,n._)({},e),{text:"You upgraded to a founding tier subscription. Thank you!"}))))},[]),null}},21599:function(e,t,i){i.d(t,{S2:()=>a,pW:()=>c,sK:()=>s});var n=i(48980),o=i(7882),r=i(98914),l=i(26111);function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,l.x)("selection");let{isLoading:i,error:n,result:r}=(0,o.ib)({pathname:"/api/v1/post_selection/".concat(e),auto:!!e,deps:[e]});return{isLoading:i,error:n,postSelection:null!=r?r:null,highlightSelection:()=>{r&&d(r,t)}}}async function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,l.x)("selection");let i=null;try{i=await (0,n.rd)("/api/v1/post_selection/".concat(e))}catch(e){console.error("could not fetch post selection",e)}i&&d(i,t)}function d(e){var t,i;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.ignoreSafari&&(0,r.G6)()||!e.text)return;let o=(null!==(i=null===(t=/^[^.]+\./.exec(e.text))||void 0===t?void 0:t[0])&&void 0!==i?i:e.text).replace(/\.+$/g,"");if(!o)return;let l="#:~:text=".concat(encodeURIComponent(o));history.replaceState({},document.title,l),document.location.replace(l)}async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,l.x)("imgSelection");let i=null;try{i=(await (0,n.rd)("/api/v1/post_selection/image/".concat(e))).selection}catch(t){console.error("Couldn't find post image selection with id ".concat(e),t)}i&&function(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(i.ignoreSafari&&(0,r.G6)())&&e.img_src){for(let i of document.getElementsByTagName("img"))if(i.src===e.img_src){t=i;return}t&&t.scrollIntoView()}}(i,t)}},49740:function(e,t,i){i.d(t,{K:()=>w});var n=i(16584),o=i(94184),r=i.n(o),l=i(24350),a=i.n(l),s=i(89734),d=i.n(s),c=i(347),u=i(20888),p=i(95441),h=i(55480),m=i(98422),g=i(30733),v=i(15771),f=i(61254),b=i(19081),_=i(58175),y=i(60308);let Z={image:"image-QMta6W"},w=e=>{let{pub:t}=e,{iString:i}=(0,p.M1)(),o=a()(t.sections,"id"),l=d()((0,h.EP)(t),"podcastTitle");return(0,n.tZ)("div",{className:r()("page","typography"),children:(0,n.tZ)(g.N,{children:(0,n.BX)(b.tu,{gap:24,children:[(0,n.tZ)(_.xv.H2,{children:i("Podcasts")}),(0,n.tZ)(b.tu,{gap:24,children:l.map((e,i)=>{var r,l;let a=null!==(l=o[null!==(r=e.sectionId)&&void 0!==r?r:"undefined"])&&void 0!==l?l:null;return(0,n.BX)(n.HY,{children:[0!==i&&(0,n.tZ)(f.iz,{}),(0,n.tZ)(k,{podcastForDisplay:e,pub:t,section:a})]})})})]})})})},k=e=>{let{podcastForDisplay:t,pub:i,section:o}=e,{iString:r}=(0,p.M1)(),{isMobile:l}=(0,m.v9)(),a=(0,y.UVC)({pub:i,section:o});return(0,n.tZ)(c.h,{children:(0,n.BX)(b.gq,{gap:24,children:[(0,n.tZ)(b.tu,{width:l?140:180,flex:"auto",children:t.artUrl&&(0,n.tZ)("a",{href:a,children:(0,n.tZ)(u.e,{className:Z.image,imageIsFixedWidth:!0,maxWidth:l?140:180,src:t.artUrl,useRetinaSizing:!0})})}),(0,n.BX)(b.tu,{gap:12,children:[(0,n.BX)(b.tu,{gap:8,children:[(0,n.tZ)(_.xv.H3,{as:"a",href:a,children:t.podcastTitle}),(0,n.tZ)(_.xv.B3,{children:t.description})]}),(0,n.tZ)("div",{children:(0,n.tZ)(v.zx,{href:a,priority:"secondary",size:"sm",children:r("See episodes")})})]})]})})}},65102:function(e,t,i){i.d(t,{h:()=>P});var n=i(16584),o=i(30396),r=i(94184),l=i.n(r),a=i(887),s=i(40281),d=i(95441),c=i(7882),u=i(1152),p=i(58401),h=i(98422),m=i(80026),g=i(87185),v=i(6490),f=i(6070);let b={container:"container-Q5omP8",containerForShows:"containerForShows-FydmKs",editButtonContainer:"editButtonContainer-O6BQ51"},_=e=>{let{isShowsEpisodePage:t,posts:i,title:r,user:d,postTags:c,selectedPostTagId:g,postId:v,postTheme:f}=e,{isMobile:_}=(0,h.v9)(),[Z,w]=(0,o.eJ)(!1);return(0,n.tZ)(m.hs,{className:l()({[b.container]:!t,[b.containerForShows]:t}),children:t?(0,n.BX)(m.tu,{gap:24,children:[(0,n.tZ)(p.l,{title:r,titlePreset:"st1",variant:"align-right"}),(0,n.tZ)(s.f,{posts:i})]}):(0,n.BX)(n.HY,{children:[(null==d?void 0:d.is_admin)&&!_&&(0,n.tZ)("div",{className:b.editButtonContainer,children:(0,n.tZ)(m.hU,{priority:"primary-mono",size:"sm",onClick:()=>{w(!0)},children:(0,n.tZ)(a.Z,{size:16})})}),(0,n.tZ)(u.M,{headerVariant:"align-right",posts:i,title:r,variant:"large-in-middle"}),(0,n.tZ)(y,{currentPostTagId:g,isOpen:Z,postId:v,postTags:c,postTheme:f,user:d,onClose:()=>w(!1)})]})})},y=e=>{let{user:t,isOpen:i,onClose:r,postTags:l,currentPostTagId:a,postId:s,postTheme:u}=e,{isMobile:p}=(0,h.v9)(),{iString:f}=(0,d.M1)(),[b,_]=(0,o.eJ)(a),{refetch:y,error:Z}=(0,c.ib)({pathname:"/api/v1/post/".concat(s,"/theme"),method:"PATCH"});if(p||!(null==t?void 0:t.is_admin))return null;let w=()=>{_(a),r()},k=async()=>{await y({json:{header_variant:u.header_variant,featured_post_tag_id:b}}),Z||window.location.reload()},C=null==l?void 0:l.map(e=>({value:e.id,label:e.name}));return(0,n.BX)(v.u_,{disableCloseOnBackdropClick:!0,isOpen:i,onClose:w,children:[(0,n.tZ)(v.xB,{showClose:!0,title:f("Choose a tag to feature"),onClose:r}),(0,n.tZ)(v.fe,{children:(0,n.tZ)(g.m,{options:C,value:b,onChange:e=>_(e)})}),(0,n.tZ)(v.mz,{primaryButton:(0,n.tZ)(m.zx,{disabled:a===b,onClick:k,children:f("Save")}),secondaryButton:(0,n.tZ)(m.zx,{priority:"secondary",onClick:w,children:f("Cancel")})})]})},Z=e=>{var t,i,n,o;let{post:r,pub:l,showPodcastEpisodesOnly:a}=e;if(!r||!(0,f.HD)({pub:l}))return;if(a)return{featuredSectionId:null!==(n=r.section_id)&&void 0!==n?n:void 0,title:"More Episodes"};let{postTheme:s}=r;if(null==s?void 0:s.featured_post_tag_id){let e=null==r?void 0:null===(o=r.postTags)||void 0===o?void 0:o.find(e=>{let{id:t}=e;return t===(null==s?void 0:s.featured_post_tag_id)});return e?{featuredPostTagId:null==s?void 0:s.featured_post_tag_id,title:"More in ".concat(e.name)}:void 0}if(r.section_id&&r.section_name)return{featuredSectionId:r.section_id,title:"More in ".concat(r.section_name)};let d=new Set(null===(t=r.publishedBylines)||void 0===t?void 0:t.map(e=>e.name)),c=null===(i=r.postTags)||void 0===i?void 0:i.find(e=>{let{name:t}=e;return!d.has(t)});if(c)return{featuredPostTagId:null==c?void 0:c.id,title:"More in ".concat(null==c?void 0:c.name)}};var w=i(33578),k=i(15400),C=i(19081),S=i(58175);let x=()=>{let{isMobile:e}=(0,h.v9)();return(0,n.tZ)(C.tu,{paddingX:8*!e,paddingBottom:8,children:(0,n.tZ)(C.tu,{borderBottom:"detail-themed",paddingBottom:8,children:(0,n.tZ)(S.xv,{className:"title-lJNKDo",children:"Latest"})})})};var B=i(71068);let P=e=>{var t;let{delayFirstLoad:i,filterPostsPredicate:o,isBelowTheFold:r,isShowsEpisodePageForTheFP:l,maxPosts:a,pub:s,search:c,sort:u,sortTabs:p,source:m,user:g,post:v}=e,{isMobile:b}=(0,h.v9)(),{iString:y}=(0,d.M1)(),C=(0,f.HD)({pub:s}),S=(0,f.kb)({pub:s}),P=null===(t=s.sections)||void 0===t?void 0:t.find(e=>e.id===v.section_id),I=l&&(null==P?void 0:P.is_podcast)||P&&!!v.videoUpload&&l,N=Z({post:v,pub:s,showPodcastEpisodesOnly:I});return(0,n.tZ)(B.xu,{paddingY:24,style:b?void 0:{marginLeft:-8,marginRight:-8},"aria-label":y("Top Posts Footer"),role:"region",children:(0,n.tZ)(w.O,{delayFirstLoad:i,filterPostsPredicate:o,hideCommunity:S,hideTop:S,isBelowTheFold:r,isPodcast:I,maxPosts:a,pub:s,search:c,sort:(null==N?void 0:N.featuredPostTagId)?"new":u,sortTabs:p,source:m,user:g,postTagId:null==N?void 0:N.featuredPostTagId,sectionId:null==N?void 0:N.featuredSectionId,postId:v.id,renderTabs:S?()=>(0,n.tZ)(x,{}):void 0,children:e=>{var t,i;let{posts:o,linkToComments:r,onClickPost:a}=e;return C?(0,n.tZ)(_,{isShowsEpisodePage:l,postId:v.id,postTheme:v.postTheme,selectedPostTagId:null==N?void 0:N.featuredPostTagId,posts:o,title:null!==(i=null==N?void 0:N.title)&&void 0!==i?i:"Top posts",user:g,postTags:null==v?void 0:v.postTags}):(0,n.tZ)(k.B,{hideImages:null===(t=s.theme)||void 0===t?void 0:t.hide_images_from_list,linkToComments:r,posts:o,variant:"two-column-list",onClickPost:a})}})})}},6891:function(e,t,i){i.d(t,{Z:()=>R});var n=i(7409),o=i(16584),r=i(6400),l=i(30396),a=i(94184),s=i.n(a),d=i(59543),c=i(1852),u=i(80569),p=i.n(u),h=i(32351),m=i(85685),g=i(11712),v=i(347),f=i(33665),b=i(3469),_=i(58319),y=i(68833),Z=i(80878),w=i(27036),k=i(98914),C=i(94874),S=i(15771),x=i(19081),B=i(10510),P=i(58175),I=i(6070),N=i(60308),T=i(47929);let E={heroText:"heroText-vjETGo",container:"container-QYwuRw"},L=e=>{let{pub:t,user:i,freeSignup:n,freeSignupEmail:r}=e,a="enabled"===t.payments_state&&(null==i?void 0:i.is_free_subscribed)&&!(null==i?void 0:i.is_subscribed)?"paid_upsell":"free_upsell";return(0,l.d4)(()=>{(0,y.j)(y.FP.ABOUT_PAGE_END_CTA_RENDERED,{pub_id:t.id,type:a})},[]),(0,o.BX)(o.HY,{children:[(0,o.tZ)(_.Z,{onVisible:()=>{(0,y.j)(y.FP.ABOUT_PAGE_END_CTA_SEEN,{pub_id:t.id,type:a})}}),(0,o.BX)(x.tu,{alignItems:"center",gap:16,padding:24,className:s()(E.container,"end-cta-container"),children:[t.author_photo_url?(0,o.tZ)(C.qE,{photoUrl:t.author_photo_url,size:64}):t.logo_url?(0,o.tZ)(B.wk,{logoUrl:t.logo_url,size:64,radius:"sm"}):null,(0,o.BX)(x.tu,{alignItems:"center",children:[(0,o.BX)(P.xv.H2,{lineHeight:30,align:"center",color:"pub-primary-text",children:["Subscribe to ",t.name]}),t.hero_text&&(0,o.tZ)(P.xv.Meta,{size:12,className:E.heroText,align:"center",color:"pub-secondary-text",children:t.hero_text})]}),(0,o.tZ)(f.Z,{pub:t,user:i,freeSignup:n,freeSignupEmail:r,isStatic:!1,source:"about-page-end-cta"})]})]})};function X(e){let{pub:t,user:i,freeSignup:n,freeSignupEmail:r,subscribeContent:l}=e;return"string"!=typeof l?(0,o.BX)("div",{className:"content-about-silhouette",children:[(0,o.tZ)("div",{className:"content-about-silhouette-line"}),(0,o.tZ)("div",{className:"content-about-silhouette-line"}),(0,o.tZ)("div",{className:"content-about-silhouette-line"}),(0,o.tZ)("div",{className:"content-about-silhouette-line"}),(0,o.tZ)("div",{className:"content-about-silhouette-line"})]}):(0,o.tZ)("div",{className:"content-about",children:(0,o.tZ)(g.Z,{html:l,pub:t,user:i,freeSignup:n,freeSignupEmail:r,isAboutPage:!0})})}function M(e){let{pub:t,people:i}=e,n=(0,c.useMediaQuery)({maxWidth:540}),r=n?[[]]:[[],[]];for(let e=0;e(0,o.tZ)("div",{className:"people-column",children:e.map(e=>(0,o.tZ)("div",{className:"content-person",onClick:i=>(0,Z.Q)(i,(0,N.LwU)(e,t,{utm_source:T.b3.aboutPage}),{native:!0}),children:(0,o.tZ)(m.ProfileCard,{subject:e,profile:e,utmSource:"about-page",forceRefresh:()=>({})})}))}))})}class R extends r.Component{async componentDidMount(){this.loadPeople(),this.loadAbout()}async loadAbout(){if(""!==this.state.subscribeContent)try{let{body:e}=await p().get("/api/v1/publication/subscribe_content");this.setState({subscribeContent:e})}catch(e){console.error("Failed to load about content:",e)}}async loadPeople(){if(!this.state.people)try{let e=(await p().get("/api/v1/publication/users/ranked").query({public:!0})).body;this.setState({people:e})}catch(e){console.error("Failed to load people:",e)}}render(e,t){let{pub:i,user:r,freeSignup:l,freeSignupEmail:a,metadata:s}=e,{subscribeContent:c,people:u}=t;if((0,I.HD)({pub:i})&&c)return(0,o.tZ)(b.j,{pub:i,user:r||void 0,type:"about",html:c});let p=(0,I.kb)({pub:i}),m=(!r||!(0,w.P)(r,i))&&function(e){if("undefined"==typeof window)return!0;let t=document.createElement("div");t.innerHTML=e;for(let e=t.childNodes.length-1;e>=0;e--){let i=t.childNodes[e];if((0,k.pv)(i,"button-wrapper")||(0,k.pv)(i,"subscription-widget-wrap"))return!1}return!0}(c);return(0,o.tZ)(v.h,{children:(0,o.BX)("div",{className:"page typography about-page typography post",children:[s&&(0,o.tZ)(h.Metadata,(0,n._)({},s)),(0,o.BX)("div",{className:"container",children:[(null==r?void 0:r.is_contributor)&&(0,o.tZ)(S.zx,{priority:"secondary",href:(0,N.n1t)("/publish/settings/edit",{title:"About page",bodyField:"subscribe_content",redirect:document.location.href}),localNavigation:!1,leading:(0,o.tZ)(d.Z,{size:20}),children:"Edit"}),(0,o.tZ)("div",{className:"about-content-wrap",children:(0,o.tZ)(X,{pub:i,user:r,freeSignup:l,freeSignupEmail:a,subscribeContent:c})}),m?(0,o.tZ)(L,{pub:i,user:r,freeSignup:l,freeSignupEmail:a}):null,!p&&(null!=u?u:[]).length>0&&(0,o.BX)(x.tu,{gap:24,children:[(0,o.tZ)("h3",{className:"about-page-section-title",children:"People"}),(0,o.tZ)(M,{pub:i,people:u})]})]})]})})}constructor(e,t){super(e,t),this.state={subscribeContent:e.subscribeContent,people:e.people}}}},97901:function(e,t,i){i.d(t,{Z:()=>u});var n=i(7409),o=i(16584),r=i(94184),l=i.n(r),a=i(32351),s=i(347),d=i(33578),c=i(15400);function u(e){var t;let{children:i,title:r,pub:u,user:p,sort:h,search:m,newPostsForArchive:g,topPostsForArchive:v,communityPostsForArchive:f,searchPosts:b,slug:_,isPodcast:y,metadata:Z}=e,w=!!(null==u?void 0:u.theme),k=u.sections.find(e=>e.slug===_),C=null!==(t=null==k?void 0:k.id)&&void 0!==t?t:y?"pubPodcast":"pub",S=null==g?void 0:g[C],x=null==v?void 0:v[C],B=null==f?void 0:f[C];return(0,o.BX)(s.h,{children:[Z&&(0,o.tZ)(a.Metadata,(0,n._)({},Z)),(0,o.tZ)("div",{className:l()("archive-page typography","container-b1BW1a",{"use-theme-bg":w}),children:(0,o.BX)("div",{className:"container",children:[r&&(0,o.tZ)("h2",{children:r}),(0,o.tZ)(d.O,{communityPosts:B,isPodcast:y,newPosts:S,pub:u,search:m,searchPosts:b,sectionId:null==k?void 0:k.id,showMonthDividers:!0,sort:h,source:"archive",topPosts:x,user:p,variant:"list",children:e=>{var t;let{posts:i,linkToComments:n,onClickPost:r}=e;return(0,o.tZ)(c.B,{hideImages:null===(t=u.theme)||void 0===t?void 0:t.hide_images_from_list,linkToComments:n,posts:i,variant:"two-column-list",onClickPost:r})}}),i]})})]})}},97349:function(e,t,i){i.d(t,{IO:()=>q,o_:()=>Y,rf:()=>j});var n=i(27412),o=i(7409),r=i(99282),l=i(58865),a=i(16584),s=i(6400),d=i(80569),c=i.n(d),u=i(16808),p=i(18787),h=i(347),m=i(30329),g=i(51014),v=i(6498),f=i(57626),b=i(12980),_=i(95441),y=i(40647),Z=i(41149),w=i(68833),k=i(98914),C=i(41258),S=i(41990),x=i(1980),B=i(83225),P=i(75496),I=i(21266),N=i(46638),T=i(32129),E=i(19081),L=i(58175),X=i(70379),M=i(50364),R=i(6070),F=i(31377),U=i(60308),O=i(26111),A=i(84864);function D(){let e=(0,l._)(["Comments on this "," are for "," subscribers"]);return D=function(){return e},e}class z extends s.Component{async componentDidMount(){var e;let{iString:t}=this.props;if((0,k.ut)(this.onWindowVisibilityChange),this.props.publication.community_enabled||this.props.inline?await this.loadPost():document.location.href="./",null===(e=this.props.matches)||void 0===e?void 0:e.feedCommentUrl){let e=this.props.matches.feedCommentUrl,i=new URL(location.toString());i.searchParams.delete("feedCommentUrl"),history.replaceState({},"",i),this.props.popToast(i=>(0,a.tZ)(X.FN,(0,r._)((0,o._)({},i),{text:t("Note Shared."),cta:t("View Now"),href:e})),{ttl:1e4})}}componentWillUnmount(){(0,k.kE)(this.onWindowVisibilityChange),clearInterval(this.loadTimeout)}async componentDidUpdate(e,t){if(e.slug!==this.props.slug||t.sort!==this.state.sort){let e=this.props.post&&this.props.post.slug===this.props.slug;await (0,k.IW)(this,{post:e?this.props.post:null,comments:[]}),await this.loadPost()}else if(this.state.post&&this.state.comments&&!this.commentsViewed&&!this.state.loading){let e=0;(0,M.hO)(this.state.comments,()=>{e++}),this.state.post.comment_count!==e&&(this.state.post.comment_count=e,this.setState({post:this.state.post}),this.props.onChange&&this.props.onChange({post:this.state.post}))}}queueRefresh(){if(!this.commentsViewed&&this.state.comments&&this.state.post){this.commentsViewed=!0;let{post:e}=this.state;(0,w.j)(w.FP.COMMENTS_VIEWED,{post_id:e.id,comment_count:this.state.comments.length}),this.props.publication.community_enabled&&!("thread"===e.type||(0,A.canSeeComments)(this.props.user,e))&&(0,w.j)(w.FP.COMMENT_PAYWALL_SHOWN,{post_id:e.id,post_type:e.type}),"thread"===e.type&&this.props.user&&Promise.resolve(c().post("/api/v1/posts/".concat(e.id,"/seen")))}clearTimeout(this.loadTimeout),"undefined"!=typeof window&&(this.loadTimeout=window.setTimeout(()=>this.loadPost(),3e4))}async loadPost(){let e;if(this.state.comments&&!(0,k.dr)())return;clearTimeout(this.loadTimeout),this.setState({loading:!0});let t=this.state.comments&&this.state.comments.length>0;this.state.comments&&(e=null,(0,M.hO)(this.state.comments,t=>{!t.deleted&&t.date&&(!e||t.date>e)&&(e=t.date)}));try{let t=this.props.slug,i=this.state.sort,n={token:this.props.post_reaction_token||"",all_comments:!0,sort:i,last_comment_at:e};this.state.post&&this.props.commentId&&(n.comment_id=this.props.commentId);let o=await c().get(this.state.post?"/api/v1/post/".concat(this.state.post.id,"/comments"):"/api/v1/posts/".concat(t)).query(n);if(this.setState({loading:!1}),t!==this.props.slug||i!==this.state.sort)return;let r=this.state.sort;!this.state.post&&o.body.default_comment_sort&&(r=o.body.default_comment_sort);let l=o.body.comments,a=this.state.comments;if(!this.state.post||!a||l){let e=a&&l?(0,P.v)(a,l):null!=l?l:[];await (0,k.IW)(this,{post:this.state.post||o.body,comments:e,sort:r})}}catch(e){console.error("Failed to load post:",e),400===e.statusCode&&await (0,k.IW)(this,{notAllowedToFetchComments:!0}),this.setState({loading:!1})}!t&&this.state.comments&&this.state.comments.length>0&&(0,k.pK)(),(0,k.dr)()&&this.queueRefresh(),this.triggerShareOnLoad()}onSortSelected(e){var t,i;this.setState({sort:e}),(0,w.j)(w.FP.COMMENTS_SORTED,{post_id:null===(t=this.state.post)||void 0===t?void 0:t.id,post_type:null===(i=this.state.post)||void 0===i?void 0:i.type,sort:e})}triggerShareOnLoad(){var e;(null===(e=this.shareDialogRef)||void 0===e?void 0:e.current)&&"share"===(0,O.x)("action")&&(window.history.replaceState({},document.title,(0,U.rhs)({action:null})),this.shareDialogRef.current.fromEmail())}_isPub(e){let{publication:t}=this.props;return(null==t?void 0:t.subdomain)===e}render(e,t){let{slug:i,user:n,freeSignup:o,freeSignupEmail:r,publication:l,post_reaction_token:s,inline:d,commentId:c,selectionFromQuery:p,imgSelectionFromQuery:v,freeTrialCoupon:f,show_reaction_upsell:_,bannedFromNotes:y,iString:w}=e,{sort:k,post:B,comments:P,notAllowedToFetchComments:I,reactionSigninComment:E}=t;if(!B||!l.community_enabled)return d&&B?(0,a.tZ)("div",{className:"container",children:(0,a.tZ)(q,{post:B})}):(0,a.tZ)("div",{className:"comments-page",children:(0,a.tZ)("div",{className:"container",children:(0,a.tZ)(b.U,{})})});let L=(0,R.HD)({pub:l}),X=l.community_enabled&&B&&"none"!==B.write_comment_permissions,M=I||X&&!(0,A.canSeeComments)(n,B),F=async(e,t)=>Y({user:n,reactionToken:s,comments:P,id:e,reacted:t,setComments:e=>this.setState({comments:e}),onNeedsSignin:e=>{let{comment:t}=e;return new Promise(e=>this.setState({reactionSigninComment:t},()=>{var t;return null===(t=this.modalRef.current)||void 0===t?void 0:t.open(e)}))}});return(0,a.tZ)(h.h,{children:(0,a.BX)("div",{className:"comments-page",children:[c&&(null==P?void 0:P[0])?(0,a.tZ)(Z.N,{comment:P[0],post:B,publication:l}):(0,a.tZ)(T.PostMetaTags,{post:B,publication:l,isCommentPage:!this.props.inline,selection:p,imgSelection:v}),(0,a.tZ)(g.ZP,{ref:this.shareDialogRef,user:n,pub:l,post:B,reaction_token:s,comments:P,commentId:c}),!d&&!c&&(0,a.tZ)("div",{className:"container",children:(0,a.tZ)(b.H,{pub:l,post:Object.assign({},B,{comment_url_override:(0,U.uRy)(l,B,{comments:!0})}),user:n,freeSignup:o,freeSignupEmail:r,hidden:!(0,A.isUUID)(i)&&B.hidden,truncated:"thread"!==B.type,post_reaction_token:s,onChange:e=>this.setState(null!=e?e:{}),showUnsubscribeNotice:!0,gap:0,showShare:!1,children:(0,a.tZ)("div",{className:"full-container-border"})})}),M&&(0,a.tZ)(W,{freeSignup:o,freeSignupEmail:r,freeTrialCoupon:f,inline:d,post:B,publication:l,user:n}),"thread"===B.type||(0,A.canSeeComments)(n,B)?(0,a.BX)("div",{className:"container",children:[!d&&P&&(0,a.tZ)(H,{comments:P,post:B,sort:k,notAllowedToFetchComments:I,commentId:c,publication:l,handleSort:e=>this.onSortSelected(e),useFreePressTheme:L}),P&&P.length>0&&!X&&(0,a.tZ)(q,{post:B}),X&&(0,a.tZ)(S._,{user:n,freeSignup:o,freeSignupEmail:r,pub:l,post:B,token:s,autoFocus:(0,N.gB)(),onSuccess:e=>this.setState({comments:[e].concat(P)}),bannedFromNotes:y}),c&&P&&(0,a.tZ)("a",{className:"return-to-thread-link",href:(0,U.uRy)(l,B,{comments:!0,commentId:c,highlightComment:!0}),children:w("⭠ Return to thread")}),P||I?P.length>0?[(0,a.tZ)("div",{className:"comment-list-container",ref:this.scrollRef,children:(0,a.tZ)(C.AM,{user:n,freeSignup:o,freeSignupEmail:r,pub:l,post:B,comments:P,reaction_token:s,depth:0,collapseAtDepth:d?10:P.length>3&&"most_recent_first"===k?C.sA:C.lf,onChange:this.onChange,pageSize:d||this._isPub("astralcodexten")?C.eR:"thread"===B.type?C.LB:C.L8,scrollRef:this.scrollRef,retainUserCollapseState:!0,updateCommentReacted:this.updateCommentReacted,noRestack:!0},B.id)})]:null:[(0,a.tZ)(x.l,{}),(0,a.tZ)(x.l,{})]]}):null,E&&(0,a.tZ)(m.oq,{comment:E,pub:l,user:n,react:()=>F(E.id,!0),modalRef:this.modalRef}),_?(0,a.tZ)(u.hF,{user:n,pub:l,post:B}):null]})})}constructor(e,t){let i;super(e,t),(0,n._)(this,"modalRef",(0,s.createRef)()),(0,n._)(this,"scrollRef",void 0),(0,n._)(this,"shareDialogRef",void 0),(0,n._)(this,"onboardingModalRef",void 0),(0,n._)(this,"loadTimeout",void 0),(0,n._)(this,"commentsViewed",void 0),(0,n._)(this,"onWindowVisibilityChange",()=>{(0,k.dr)()?setTimeout(()=>{this.loadPost()},100):clearTimeout(this.loadTimeout)}),(0,n._)(this,"onChange",e=>{this.setState({comments:(0,I.H)(this.state.comments,e)})}),(0,n._)(this,"updateCommentReacted",(e,t)=>{let{user:i,post_reaction_token:n}=this.props,{comments:o}=this.state;Y({user:i,reactionToken:n,comments:o,id:e,reacted:t,setComments:e=>this.setState({comments:e}),onNeedsSignin:e=>{let{comment:t}=e;return new Promise(e=>this.setState({reactionSigninComment:t},()=>{var t;return null===(t=this.modalRef.current)||void 0===t?void 0:t.open(e)}))}})}),e.post&&e.post.slug===e.slug&&(i=e.post);let o=e.sort||i&&i.default_comment_sort||e.publication.default_comment_sort||"best_first",r=e.initialComments;this.scrollRef=(0,s.createRef)(),this.shareDialogRef=(0,s.createRef)(),this.onboardingModalRef=(0,s.createRef)(),this.state={post:i,sort:o,comments:r,loading:!1,reactionSigninComment:null}}}let j=(0,y.xY)((0,X.dd)((0,_.fz)(z))),H=e=>{let{comments:t,post:i,sort:n,notAllowedToFetchComments:o,commentId:r,publication:l,handleSort:s,sortMenuUseMobileBottomSheet:d,useFreePressTheme:c=!1}=e,{iString:u,iPlural:p}=(0,_.M1)();return c?(0,a.tZ)(v.R,{comments:t,post:i,publication:l,notAllowedToFetchComments:o,handleSort:s,sort:n,sortMenuUseMobileBottomSheet:d}):(0,a.BX)(E.gq,{alignItems:"center",justifyContent:"space-between",paddingY:8,children:[(0,a.tZ)(L.xv.B1,{weight:"bold",children:t.length>0?p("1 Comment","%1 Comments",i.comment_count):u("Comments")}),t.length>1&&!o&&!r&&(0,a.tZ)(B.$,{currentSort:n,isLoading:!t,handleSort:s,pub:l,useMobileBottomSheet:d})]})},W=e=>{let{freeSignup:t,freeSignupEmail:i,freeTrialCoupon:n,inline:o,post:r,publication:l,user:s}=e,{iTemplate:d,iString:c}=(0,_.M1)();return(0,R.HD)({pub:l})?(0,a.tZ)(f.C,{publication:l,post:r,user:s,freeSignupEmail:i,showHeader:!o}):(0,a.tZ)("div",{className:"container",children:(0,a.tZ)(p.f1,{user:s,freeSignupEmail:i,freeSignup:t,publication:l,post:r,title:d(D(),"podcast"===r.type?"episode":"post",(0,F.isFoundingAudience)(r.audience)?"founding":"paid"),reauthenticationTitle:c("To see the comments, please re-authenticate."),coupon:n})})},q=e=>{let{post:t}=e,{iString:i}=(0,_.M1)();return(0,a.tZ)("div",{className:"locked-comments",children:i("adhoc_email"===t.type?"Commenting has been turned off for this email":"Commenting has been turned off for this post")})};async function Y(e){let{user:t,reactionToken:i,comments:n,id:r,reacted:l,setComments:a,onNeedsSignin:s}=e,d=(0,N.S9)(r,n);if(!d)return;let c=(0,o._)({},d);(0,m.E6)(t,c,l),a((0,N.fc)(n.slice(0),c));try{await (0,m.xl)(c,!0,l,i)}catch(e){var u;if((0,m.E6)(t,c,!l),a((0,N.fc)(n.slice(0),(0,o._)({},c))),(null===(u=e.response)||void 0===u?void 0:u.statusCode)!==401){alert((0,k.zx)(e));return}await s({comment:c})}}},63145:function(e,t,i){i.d(t,{IO:()=>o.IO,Os:()=>r.Os,_D:()=>n._,fc:()=>r.fc,o_:()=>o.o_,rf:()=>o.rf});var n=i(41990);i(41258);var o=i(97349);i(1980);var r=i(46638)},46638:function(e,t,i){i.d(t,{Fs:()=>b,Jr:()=>m,Os:()=>v,S9:()=>function e(t,i){if(!t||!i||!i.length)return null;for(let n of i){if(n.id===t)return n;if(n.children&&n.children.length){let i=e(t,n.children);if(i)return i}}return null},VS:()=>y,aE:()=>c.aE,ei:()=>Z,fc:()=>function e(t,i){for(let[r,l]of t.entries()){if(l.id===i.id)return t.with(r,i);if(l.children){let a=e(l.children,i);if(a!==l.children)return t.with(r,(0,o._)((0,n._)({},l),{children:a}))}}return t},fg:()=>f,gB:()=>g,gz:()=>_});var n=i(7409),o=i(99282),r=i(16584),l=i(28175),a=i.n(l),s=i(59176),d=i(60308),c=i(60836),u=i(84864);let p="comment-collapse-state",h=function(){try{return(0,s.mM)(p,[])}catch(e){return console.error("Failed to load comment collapse state:",e),[]}}(),m=()=>{if("undefined"!=typeof window&&window.location.hash){let e=/^#comment-(\d+)/.exec(window.location.hash);if(e)return Number(e[1])}return null},g=()=>"undefined"!=typeof window&&"#input"===window.location.hash;function v(e,t,i){return(0,d.n1t)((0,d.uRy)(t,e,{comments:!(0,u.shouldUseInlineComments)(t,e)}),i)}function f(e,t,i){return(0,d.n1t)("".concat((0,d.SVA)(t),"/embed/comments/").concat(e.id),{access_token:i})}function b(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"p";return(e||"").split("\n").filter(e=>e.trim()).map(e=>(0,r.tZ)(t,{children:(0,r.tZ)(a(),{options:{validate:{url:e=>!!e&&!e.startsWith("/")},attributes:{rel:"nofollow ugc noopener"}},children:e})}))}let _=e=>{var t,i,n,o,r,l;return{id:e.user_id,slug:"user_slug"in e?e.user_slug:void 0,photo_url:e.photo_url,name:null!==(r=e.name)&&void 0!==r?r:null,bestseller_tier:e.user_bestseller_tier,primary_publication:e.user_primary_publication,is_free_subscribed:["free_signup, subscribed"].includes(null!==(l=null===(t=e.metadata)||void 0===t?void 0:t.membership_state)&&void 0!==l?l:""),is_subscribed:(null===(i=e.metadata)||void 0===i?void 0:i.membership_state)==="subscribed",is_founding:null===(n=e.metadata)||void 0===n?void 0:n.founding,is_author:null===(o=e.metadata)||void 0===o?void 0:o.is_author}};function y(e,t){let i=!1;if(t)!h.includes(e)&&(i=!0,h.push(e),h.length>250&&h.splice(0,h.length-250));else{let t=h.indexOf(e);t>=0&&(i=!0,h.splice(t,1))}if(i)try{(0,s.ex)(p,h)}catch(e){console.error("Failed to store comment collapse state:",e)}}function Z(e){return h.includes(e)}},92892:function(e,t,i){i.d(t,{H:()=>B});var n=i(27412),o=i(16584),r=i(6400),l=i(94184),a=i.n(l),s=i(39693),d=i.n(s),c=i(80569),u=i.n(c),p=i(56219),h=i(58319),m=i(75778),g=i(37168),v=i(56629),f=i(40647),b=i(68833),_=i(10047),y=i(98914),Z=i(32129),w=i(65102),k=i(19081),C=i(38501),S=i(60308),x=i(26111);class B extends r.Component{async componentDidMount(){(0,y.pK)(),this.cleanEmbedResizeListener=(0,_.J)(),this.state.post||await this.loadPost(),this.triggerShareOnLoad(),this.fillEmbeddedEmailInputs()}componentWillUnmount(){var e;null===(e=this.cleanEmbedResizeListener)||void 0===e||e.call(this)}async componentDidUpdate(){this.state.embeddedEmailInputsFilled||this.fillEmbeddedEmailInputs()}async loadPost(){if(this.setState({embeddedEmailInputsFilled:!1}),this.props.post)this.setState({post:this.props.post},()=>(0,y.pK)());else try{let e=await u().get("/api/v1/cross-posts/".concat(this.props.post_id));await (0,y.IW)(this,{post:e.body.post,introText:e.body.intro_text,crossPostedPub:e.body.crossPostedPub,crossPostingByLine:e.body.crossPostingByLine,userWithCrossPostedPubContext:e.body.userWithCrossPostedPubContext,crossPostedPublicationSettings:e.body.crossPostedPublicationSettings,crossPostedSiteConfig:e.body.crossPostedSiteConfig}),(0,y.pK)()}catch(e){console.error("Failed to load post:",e),alert((0,y.zx)(e))}}triggerShareOnLoad(){"share"===(0,x.x)("action")&&(window.history.replaceState({},document.title,(0,S.rhs)({action:null})),this.post&&this.post.triggerShare({fromEmail:!0}))}render(e,t){var i;let{freeSignup:n,freeSignupEmail:r,publication:l}=e,{post:s,user:c,introText:u,crossPostedPub:g,crossPostingByLine:b,userWithCrossPostedPubContext:_,crossPostedPublicationSettings:y,crossPostedSiteConfig:S}=t,x=(null==s?void 0:s.type)==="podcast",B=["video","podcast"].includes(null!==(i=null==s?void 0:s.type)&&void 0!==i?i:"");return g?(0,o.tZ)("div",{children:(0,o.BX)("div",{className:a()("single-post-container"),children:[(0,o.tZ)("div",{className:a()({container:!x}),children:(0,o.BX)("div",{className:"single-post",children:[(0,o.tZ)(Z.PostMetaTags,{post:s,publication:l}),s&&y&&S?(0,o.tZ)(v.Iz,{settings:y,children:(0,o.tZ)(f.vC,{siteConfigs:S,children:(0,o.tZ)(m.uL,{crossPost:{crossPostedPub:g},children:B?(0,o.tZ)(C.o,{ref:this.assignPost,user:_,post:s,pub:g,freeSignup:n,freeSignupEmail:r,paywall:!1,noTitleLink:!0,onChange:e=>this.setState(null!=e?e:{}),fromPostPage:!0,crossPostInfo:{introText:u,crossPostedPub:g,crossPostingByLine:b,userWithCrossPostedPubContext:_}}):(0,o.tZ)(p.SO,{ref:this.assignPost,user:_,post:s,pub:g,freeSignup:n,freeSignupEmail:r,paywall:!1,noTitleLink:!0,onChange:e=>this.setState(null!=e?e:{}),fromPostPage:!0,crossPostInfo:{introText:u,crossPostedPub:g,crossPostingByLine:b,userWithCrossPostedPubContext:_}})})})}):(0,o.tZ)(p._q,{pub:l})]})}),l.has_posts&&s?(0,o.tZ)(k.gq,{justifyContent:"center",borderTop:"detail",paddingTop:8,children:(0,o.tZ)("div",{className:"single-post-section",children:(0,o.BX)("div",{className:"container",children:[(0,o.tZ)(h.Z,{onVisible:()=>{this.onVisible("Top Posts Footer"),c&&this.context.exposeExperiment("related_posts_web")}}),(0,o.tZ)(w.h,{user:c,freeSignup:n,freeSignupEmail:r,pub:l,maxPosts:3,filterPostsPredicate:e=>e.id!==(null==s?void 0:s.id),stateInUrl:!0,sortTabs:e=>{if("treatment"===this.context.getExperimentVariant("related_posts_web")){let t=e.findIndex(e=>"related"===e.id);if(-1!==t)return d()([e[t]].concat(e.filter((e,i)=>i!==t)))}let t=e.findIndex(e=>"top"===e.id);return -1!==t?d()([e[t]].concat(e.filter((e,i)=>i!==t))):null},delayFirstLoad:1e3,source:"post",isBelowTheFold:!0,post:s})]})})}):null]})}):(0,o.tZ)("div",{})}constructor(e,t){super(e,t),(0,n._)(this,"cleanEmbedResizeListener",void 0),(0,n._)(this,"post",void 0),(0,n._)(this,"assignPost",e=>{this.post=e}),(0,n._)(this,"onVisible",e=>{let t="".concat(e," Seen");this.state.post&&(this.state[t]||(this.setState({[t]:!0}),(0,b.j)(t,{post_id:this.state.post.id,post_audience:this.state.post.audience,post_type:this.state.post.type})))}),(0,n._)(this,"fillEmbeddedEmailInputs",()=>{var e;let t=document.querySelectorAll('article.post input[type="email"]'),i=(null===(e=this.state.user)||void 0===e?void 0:e.email)||this.props.freeSignupEmail;i&&t.forEach(e=>e.value=i),this.setState({embeddedEmailInputsFilled:!0})});let{user:i}=e;e.post?this.state={post:e.post,user:i,introText:e.introText,crossPostedPub:e.crossPostedPub,crossPostingByLine:e.crossPostingByLine,userWithCrossPostedPubContext:e.userWithCrossPostedPubContext,crossPostedPublicationSettings:e.crossPostedPublicationSettings,crossPostedSiteConfig:e.crossPostedSiteConfig}:this.state={user:i}}}(0,n._)(B,"contextType",g.WH)},46611:function(e,t,i){i.d(t,{Z:()=>y});var n=i(27412),o=i(16584),r=i(6400),l=i(94184),a=i.n(l),s=i(22072),d=i(20253),c=i(35047),u=i(33665),p=i(40647),h=i(65205),m=i(98914),g=i(15771),v=i(58175),f=i(60308),b=i(63651),_=i(47929);class y extends r.Component{componentDidMount(){(0,m.pt)((0,f.zF4)("/img/substack_wordmark.png",200));let e=this.props.freeSignupEmail||this.props.user&&this.props.user.email;if(e&&this.emailInput)this.emailInput.value=e;else if(!(0,m.K1)()){var t;null===(t=this.emailInput)||void 0===t||t.focus()}}onPrepareData(e){!this.props.pub.plans&&this.context.getConfigFor("no_embed_redirect")||this.subscribeWindow||(this.subscribeWindow=window.open("about:blank","_blank"))}onSignup(e){this.setState({freeSignup:!0,freeSignupEmail:e.body.email}),this.subscribeWindow&&(this.subscribeWindow.location=(0,b.W1P)(this.props.pub,{addBase:!0,params:{just_signed_up:!0,skip_redirect_check:!0,utm_medium:_.lP.web,utm_source:_.b3.embed,freeSignupEmail:e.body.email}}))}onError(e){if(this.subscribeWindow){try{this.subscribeWindow.close()}catch(e){console.error("Failed to close subscribe window:",e)}this.subscribeWindow=null}}render(e,t){let{pub:i,user:n,no_border:r}=e,{freeSignup:l,freeSignupEmail:p,loading:b,success:y}=t,Z=p||n&&n.email;return(0,o.BX)("div",{className:"embed-page ".concat(r?"no-border":""),children:[(0,o.BX)("div",{className:"embed-page-inner",children:[i.logo_url&&(0,o.tZ)("a",{href:"".concat(i.base_url,"/"),target:"_blank",children:(0,o.tZ)("img",{className:"publication-logo",src:(0,f.zF4)(i.logo_url,170,{quality:"auto:best"}),alt:"Logo"})}),(0,o.tZ)("h1",{className:"publication-name".concat(i.logo_url?"":" no-logo"),children:(0,o.tZ)("a",{href:"".concat(i.base_url,"/"),target:"_blank",children:(0,o.tZ)(s.Z,{text:i.name})})}),!!i.hero_text&&(0,o.tZ)("p",{className:"publication-tagline",children:(0,o.tZ)(s.Z,{text:i.hero_text})}),(0,o.tZ)("div",{className:"publication-meta",children:(0,o.tZ)(s.Z,{text:(0,c.sv)(i,{includePrice:!1,includeBadge:!0,rankingDetailOverrideText:i.rankingDetailFreeSubscriberCount,includeRankingDetail:!!i.rankingDetailFreeSubscriberCount})})}),i.invite_only?(0,o.BX)(d.ZP,{className:"subscription-request-form",ref:this.assignForm,noInlineErrors:!0,action:(0,f.n1t)("/api/v1/subscription/request"),noJsAction:(0,f.n1t)("/api/v1/subscription/request",{nojs:!0}),onSuccess:()=>this.setState({success:!0}),onError:e=>{this.setState({loading:!1}),alert((0,m.zx)(e,"Failed to request a subscription"))},children:[(0,o.tZ)("input",{type:"hidden",name:"first_url",value:h.xY}),(0,o.tZ)("input",{type:"hidden",name:"first_referrer",value:h.ip}),(0,o.tZ)("input",{type:"hidden",name:"current_url",value:h.UE}),(0,o.tZ)("input",{type:"hidden",name:"current_referrer",value:h.xU}),(0,o.tZ)("input",{type:"hidden",name:"first_session_url",value:h.ac}),(0,o.tZ)("input",{type:"hidden",name:"first_session_referrer",value:h.qR}),!!Z&&(0,m.e5)(),(0,o.BX)("div",{className:"sideBySideWrap",children:[(0,o.tZ)("input",{className:a()(y?"secondary":"primary"),type:"email",name:"email",ref:this.assignEmailInput,readOnly:!!(Z||b),disabled:!!(b||y||Z),placeholder:"Type your email…"}),(0,o.tZ)(g.zx,{priority:y?"secondary":"primary",type:"submit",disabled:!!(b||y),onClick:()=>{this.setState({loading:!0})},children:y?"Requested":"Subscribe"})]}),(0,o.tZ)("div",{id:"error-container"})]}):(0,o.tZ)(u.Z,{source:"embed",pub:i,user:n,freeSignup:l,freeSignupEmail:p,forceEmailInput:!0,onPrepareData:e=>this.onPrepareData(e),onSignup:e=>this.onSignup(e),onError:e=>this.onError(e)}),(0,o.tZ)("div",{className:"embed-tos",children:(0,o.BX)(v.xv.B4,{color:"pub-secondary-text",size:12,lineHeight:16,align:"center",children:["By subscribing you agree to"," ",(0,o.tZ)("a",{className:"tos-text",target:"_blank",rel:"noopener",href:(0,f.P8A)({pub:i,utm_source:"embed_publication"}),children:"Substack's Terms of Use"}),", ",(0,o.tZ)("a",{className:"tos-text",target:"_blank",rel:"noopener",href:(0,f.RF2)({pub:i,utm_source:"embed_publication"}),children:"our Privacy Policy"})," ","and"," ",(0,o.tZ)("a",{className:"tos-text",target:"_blank",rel:"noopener",href:(0,f.WFt)({utm_source:"embed_publication"}),children:"our Information collection notice"})]})}),(n||l)&&(0,o.tZ)("p",{className:"sign-out-block",children:(0,o.tZ)("span",{className:"account-info-logout",children:(0,o.tZ)("a",{href:(0,f.ZPN)({redirect:document.location.href,for_pub:i.subdomain}),native:!0,children:"Sign out"})})})]}),(0,o.tZ)("a",{href:"".concat((0,f.ZJn)(),"/?utm_source=").concat(_.b3.embed,"&utm_content=").concat(i.subdomain),target:"_blank",children:(0,o.tZ)("img",{ref:this.assignImg,className:"substack-watermark",src:(0,f.zF4)("/img/substack_wordmark.black.png",200),onMouseEnter:()=>{this.img&&(this.img.src=(0,f.zF4)("/img/substack_wordmark.png",200))},onMouseLeave:()=>{this.img&&(this.img.src=(0,f.zF4)("/img/substack_wordmark.black.png",200))},alt:"Substack"})})]})}constructor(e,t){super(e,t),(0,n._)(this,"emailInput",void 0),(0,n._)(this,"subscribeWindow",void 0),(0,n._)(this,"form",void 0),(0,n._)(this,"img",void 0),(0,n._)(this,"assignEmailInput",e=>{this.emailInput=e}),(0,n._)(this,"assignForm",e=>{this.form=e}),(0,n._)(this,"assignImg",e=>{this.img=e}),this.state={freeSignup:e.freeSignup,freeSignupEmail:e.freeSignupEmail,success:!1}}}(0,n._)(y,"contextType",p.QA)},50806:function(e,t,i){i.d(t,{Z:()=>u});var n=i(16584),o=i(30396),r=i(80569),l=i.n(r),a=i(16564),s=i(86657),d=i(98914),c=i(69332);let u=e=>{var t,i;let{pub:r,slug:u}=e,[p,h]=(0,o.eJ)(null);(0,o.d4)(()=>{!async function(){try{let e=await l().get("/api/v1/posts/".concat(u));h(e.body)}catch(e){console.error("Failed to load post:",e),404===e.status?alert("Post not found"):alert((0,d.zx)(e))}}()},[u]);let m=!1;return"undefined"!=typeof window&&(m="1"===(null!==(t=(0,c.m)(window.location.href).autoplay)&&void 0!==t?t:"0")),p?(0,n.tZ)(s.Z,{feature:a.MR.Podcast,pub:r,post:p,src:p.podcast_url,autoPlay:m,metricsPost:p,isFancy:!0,showCTAs:!0,mediaUpload:null!==(i=p.podcastUpload)&&void 0!==i?i:void 0,trackingProps:{surface:"external",contentType:"post",entityType:"post",entityKey:p.id}}):(0,n.tZ)("div",{className:"loading-container"})}},17393:function(e,t,i){i.d(t,{Z:()=>o});var n=i(16584);function o(){return(0,n.tZ)("div",{className:"embed-test-page",children:(0,n.tZ)("iframe",{style:{border:"1px solid #EEE",background:"white"},width:"480",height:"320",src:"/embed",frameBorder:"0",scrolling:"no"})})}},30792:function(e,t,i){i.d(t,{Z:()=>p});var n=i(16584),o=i(30396),r=i(80569),l=i.n(r),a=i(12281),s=i(98914),d=i(98422),c=i(18618),u=i(69332);let p=e=>{var t,i;let{pub:r,slug:p}=e,[h,m]=(0,o.eJ)(null),{isMobile:g}=(0,d.v9)();(0,o.d4)(()=>{!async function(){try{let e=await l().get("/api/v1/posts/".concat(p));m(e.body)}catch(e){console.error("Failed to load post:",e),404===e.status?alert("Post not found"):alert((0,s.zx)(e))}}()},[p]);let v=!1;return"undefined"!=typeof window&&(v="1"===(null!==(t=(0,u.m)(window.location.href).autoplay)&&void 0!==t?t:"0")),(null==h?void 0:h.videoUpload)?(0,n.tZ)("div",{className:"video-player-embed-container",children:(0,n.tZ)(a.Z,{mediaUpload:h.videoUpload,pub:r,autoPlay:v,videoType:"video-embed",renderPlayButton:()=>(0,n.tZ)(c.f,{isPlaying:!1,size:g?40:56}),contentType:"embed",entityType:"post",entityKey:null!==(i=null==h?void 0:h.id)&&void 0!==i?i:"unknown",surface:"external"})}):(0,n.tZ)("div",{className:"loading-container"})}},80074:function(e,t,i){i.d(t,{Z:()=>h});var n=i(16584),o=i(30396),r=i(7409),l=i(99282),a=i(64515);let s=e=>(0,n.tZ)(a.l,(0,l._)((0,r._)({},e),{name:"ChevronIcon",svgParams:{height:24,width:24,stroke:"#666666",viewBox:"0 0 24 24"},children:(0,n.tZ)("path",{d:"M9.88507 18.9609L15.8851 12.9609L9.88507 6.96094",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})),d=e=>(0,n.BX)(a.l,(0,l._)((0,r._)({},e),{name:"DownloadIcon",svgParams:{height:32,width:32},children:[(0,n.tZ)("rect",{width:"32",height:"32",rx:"6",fill:e.fill||"black"}),(0,n.tZ)("path",{d:"M23.5 18.5V21.8333C23.5 22.2754 23.3244 22.6993 23.0118 23.0118C22.6993 23.3244 22.2754 23.5 21.8333 23.5H10.1667C9.72464 23.5 9.30072 23.3244 8.98816 23.0118C8.67559 22.6993 8.5 22.2754 8.5 21.8333V18.5",stroke:e.stroke||"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.tZ)("path",{d:"M11.8333 14.3335L16 18.5002L20.1667 14.3335",stroke:e.stroke||"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,n.tZ)("path",{d:"M16 18.5V8.5",stroke:e.stroke||"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})),c=e=>(0,n.BX)(a.l,(0,l._)((0,r._)({},e),{name:"PanelsIcon",svgParams:{height:32,width:32},children:[(0,n.tZ)("rect",{width:"32",height:"32",rx:"6",fill:"black"}),(0,n.tZ)("rect",{x:"7.19995",y:"7.2002",width:"8.49554",height:"11.8938",rx:"0.424777",fill:"white"}),(0,n.tZ)("rect",{opacity:"0.7",x:"7.19995",y:"19.603",width:"8.49554",height:"6.79643",rx:"0.424777",fill:"white"}),(0,n.tZ)("path",{opacity:"0.7",d:"M16.2048 7.62497C16.2048 7.39037 16.395 7.2002 16.6296 7.2002H20.4526C23.737 7.2002 26.3995 9.8627 26.3995 13.1471C26.3995 16.4314 23.737 19.094 20.4526 19.094H16.6296C16.395 19.094 16.2048 18.9038 16.2048 18.6692V7.62497Z",fill:"white"})]}));var u=i(60308),p=i(84864);function h(e){var t;let{file:i="undefined"!=typeof window&&"file"in window._preloads&&(null===(t=window._preloads)||void 0===t?void 0:t.file)||{},pub:r}=e,[l,a]=(0,o.eJ)(null);return(0,o.d4)(()=>{(async()=>{if(!i.fileKey){let e=await fetch("/api/v1/file/entry/".concat(window.location.pathname.split("/").pop()));e.redirected&&(window.location.href=e.url),a(await e.json())}})()},[i.fileKey]),(0,n.tZ)(m,{file:l||i,pub:r})}function m(e){var t,i,o,r;let{file:l,pub:a}=e;if(!l.id)return(0,n.tZ)("div",{className:"page",children:(0,n.BX)("div",{className:"container",children:[(0,n.tZ)("h3",{children:"Read Now"}),(0,n.tZ)("div",{className:"popup-container",children:(0,n.tZ)("div",{className:"overlay"})})]})});let h=null===(i=l.file_key)||void 0===i?void 0:null===(t=i.split(".").pop())||void 0===t?void 0:t.toUpperCase(),m=(0,p.numberToHumanFileSize)(l.num_bytes),g=(o=null!=h?h:"","".concat(null===(r=l.title)||void 0===r?void 0:r.toLowerCase().replace(/\s/g,"_"),".").concat(o.toLowerCase()));return(0,n.tZ)("div",{className:"page",children:(0,n.BX)("div",{className:"container",children:[(0,n.BX)("span",{className:"table-list-title",children:[(0,n.tZ)("h3",{children:"Read Now"}),(0,n.tZ)("a",{className:"file-sidebar-header-button",href:"".concat((0,u.SVA)(a),"/p/").concat(l.post_id),children:"Back"})]}),(0,n.BX)("div",{className:"table-list",children:[(0,n.BX)("div",{className:"table-list-row table-list-header",children:[(0,n.tZ)("img",{className:"table-list-thumbnail ".concat(l.thumbnail&&-1===l.thumbnail.indexOf("/img/attachment_icon.svg")?"":"default"),src:l.thumbnail||"".concat((0,u.SVA)(a),"/img/attachment_icon.svg")}),(0,n.BX)("div",{className:"table-list-col",children:[(0,n.tZ)("div",{className:"table-list-h1",children:l.title||"Unknown File"}),(0,n.BX)("div",{className:"table-list-h2",children:[m," ∙ ",h," File"]})]})]}),(0,n.BX)("a",{className:"table-list-row table-list-item",href:"".concat((0,u.SVA)(a),"/api/v1/file/panels/").concat(l.file_key),children:[(0,n.tZ)(c,{}),(0,n.BX)("span",{className:"table-list-grow",children:[(0,n.tZ)("div",{className:"table-list-h1",children:"Open in Panels"}),(0,n.tZ)("div",{className:"table-list-h2",children:"Comic reader for iOS"})]}),(0,n.tZ)(s,{stroke:"#666",strokeWidth:0,isStatic:!0})]}),(0,n.BX)("a",{className:"table-list-row table-list-item",download:g,href:"".concat((0,u.SVA)(a),"/api/v1/file/").concat(l.file_key),children:[(0,n.tZ)(d,{}),(0,n.BX)("span",{className:"table-list-grow",children:[(0,n.tZ)("div",{className:"table-list-h1",children:"Download file"}),(0,n.tZ)("div",{className:"table-list-h2",children:g})]}),(0,n.tZ)(s,{stroke:"#666",strokeWidth:0,isStatic:!0})]})]})]})})}},96494:function(e,t,i){i.d(t,{Z:()=>c});var n=i(27412),o=i(16584),r=i(6400),l=i(80569),a=i.n(l),s=i(42493),d=i(98914);class c extends r.Component{componentDidMount(){this.props.user||(0,d.rf)()}render(e,t){let{pub:i,post:n,user:r,freeSignup:l,freeSignupEmail:a,inviteToPost:d,primaryEligiblePublications:c,switchAccountRedirectUrl:u}=e,{error:p}=t;if(p)return(0,o.BX)("div",{className:"container invite-success",children:[(0,o.tZ)("h3",{children:"Error"}),(0,o.tZ)("p",{children:p})]});let h=d&&n&&"podcast"===n.type,m=h&&r?"Fill out your profile for your podcast appearance":h&&!r?"Set up your profile for your podcast appearance":d&&r?"Set up your profile":d&&!r?"Fill out your profile":"Your invite to ".concat(i.name),g=h?"Listeners will want to know more about you. Use your profile as a chance to express yourself.":d?"Readers will want to know more about you and even follow your writing. Use your profile as a chance to express yourself.":"Before you can accept your invite, finish setting up your profile:",v=d?"Update Profile & Accept Invite":"Accept Invite",f=r?"Already a writer?":"Already have an account?",b=r?"Switch accounts":"Login";return(0,o.BX)("div",{className:"container finish-invite",children:[(0,o.tZ)("h3",{children:m}),(0,o.tZ)("p",{children:g}),(0,o.tZ)(s._0,{pageTitle:"",user:r,freeSignup:l,freeSignupEmail:a,needsPhoto:!1,optionalPhoto:d,isPostInvite:d,primaryEligiblePublications:c,onSuccess:this.acceptInvite,text:v}),d&&u&&(0,o.BX)("div",{className:"invite-switch-account",children:[f," ",(0,o.tZ)("a",{href:u,children:b})]})]})}constructor(...e){super(...e),(0,n._)(this,"acceptInvite",async()=>{try{var e,t;let i=await a().post("/api/v1/publication_user_invite/".concat(this.props.matches.id,"/accept"));(null===(e=i.body)||void 0===e?void 0:e.postUrl)?location.href=null===(t=i.body)||void 0===t?void 0:t.postUrl:(0,d.uX)("/invite-success/".concat(this.props.matches.id))}catch(t){let e=(0,d.zx)(t);this.setState({error:e})}})}}(0,n._)(c,"defaultProps",{inviteToPost:!1,primaryEligiblePublications:[]})},49116:function(e,t,i){i.d(t,{E:()=>c});var n=i(16584),o=i(6400),r=i(20253),l=i(12620),a=i(32351),s=i(15771),d=i(84864);class c extends o.Component{renderNotAvailable(e){let{time:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,n.BX)("div",{className:"container reward-page gift-reward-page",children:[(0,n.tZ)("h2",{children:"All gone"}),e,(0,n.BX)("p",{children:["Sorry, ",t?"this gift has expired":"all of these gifts have already been claimed",". You can still subscribe if you like."]}),(0,n.tZ)("div",{className:"signup",children:(0,n.tZ)(l.Z,{source:"viral_gift_none_left",pub:this.props.pub,onSuccess:()=>{document.location.href="/subscribe"}})})]})}renderForSender(){var e;return[(0,n.BX)("h3",{className:"sender-hint",children:[(0,n.BX)("span",{children:[(e=this.props.user).name?e.name.trim().split(/\s+/g)[0]:e.email.split("@")[0],", share this page to give your gift"]}),(0,n.tZ)("a",{className:"button twitter-button",href:this.props.viral_gift_data.tweet_link,native:!0,children:"Share on Twitter"})]})]}render(e){var t;let{pub:i,t:o,user:l,freeSignupEmail:c,viral_gift_data:u}=e,{sender_name:p,count_remaining:h,sender_id:m}=u,g=(0,d.getGiftValueText)(null!==(t=i.plans)&&void 0!==t?t:[]),v=g?" (value: ".concat(g,")"):"",f="A three-month subscription to ".concat(i.name).concat(v),b=(0,n.tZ)(a.Metadata,{title:"Accept ".concat(p||"your friend","'s gift"),description:f,image:i.logo_url});if(!o||!h)return this.renderNotAvailable(b);let _=null;l&&l.id==m&&(_=this.renderForSender());let y="",Z=c||"";return l&&!_&&(y=l.name,Z=l.email),(0,n.BX)("div",{className:"container reward-page receive-page",children:[_,b,(0,n.tZ)("h2",{children:"Accept Gift Subscription"}),(0,n.BX)("p",{children:[p||"Your friend"," would like to give you a free, three-month subscription. ",v]}),(0,n.tZ)("p",{children:(0,n.tZ)("b",{children:"".concat(h," left")})}),(0,n.BX)(r.ZP,{action:"/api/v1/viral_gifts/accept_gift_from_link",onSuccess:()=>document.location.href="/account/gifts/accept",children:[(0,n.tZ)("input",{type:"text",name:"name",placeholder:"Your name",value:y}),(0,n.tZ)("input",{type:"email",name:"email",placeholder:"Your email",value:Z}),(0,n.tZ)("input",{type:"hidden",value:o,name:"token"}),(0,n.tZ)("div",{id:"error-container"}),(0,n.tZ)("div",{className:"button-container",children:(0,n.tZ)(s.zx,{priority:"primary",type:"submit",children:"Accept Gift"})})]})]})}}},41633:function(e,t,i){i.d(t,{B:()=>u});var n=i(16584),o=i(347),r=i(33578),l=i(63391),a=i(15400),s=i(6207),d=i(30733),c=i(19680);let u=e=>{var t,i,u;let{author_id_or_slug:p,authorInfo:h,posts:m,pub:g,user:v,utm:f}=e,{authorInfo:b,posts:_}=(0,c.e)({author_id_or_slug:p,authorInfoPreload:h,postsPreload:m,pub:g});return b&&_?(0,n.tZ)(d.N,{children:(0,n.BX)(o.h,{children:[(0,n.tZ)(s.M,{description:null!==(t=b.bio)&&void 0!==t?t:null,logoUrl:null!==(i=b.photo_url)&&void 0!==i?i:null,name:null!==(u=b.name)&&void 0!==u?u:"",pub:g}),(0,n.tZ)(l.f,{}),(0,n.tZ)(r.O,{authorId:b.user_id,newPosts:_,pub:g,sort:"new",source:"author-archive",user:v,utm:f,children:e=>{var t;let{posts:i,linkToComments:o,onClickPost:r}=e;return(0,n.tZ)(a.B,{hideImages:null===(t=g.theme)||void 0===t?void 0:t.hide_images_from_list,linkToComments:o,posts:i,variant:"two-column-list",onClickPost:r})}})]})}):null}},52597:function(e,t,i){i.d(t,{h:()=>ib});var n=i(16584),o=i(30396),r=i(49995),l=i(95050),a=i(66555),s=i(33417),d=i(7409),c=i(99282),u=i(58865),p=i(94184),h=i.n(p),m=i(3312),g=i.n(m),v=i(28175),f=i.n(v),b=i(39693),_=i.n(b),y=i(25380),Z=i(7073),w=i(87184),k=i(47976),C=i(99869),S=i(52307),x=i(66298),B=i(25469),P=i(85200),I=i(31131),N=i(28596),T=i(65207),E=i(13639),L=i(63685),X=i(3678),M=i(78796),R=i(71375),F=i(80569),U=i.n(F),O=i(92828),A=i(59154),D=i(85941),z=i(79138),j=i(23365),H=i(37632),W=i(8796),q=i(39535),Y=i(33425),V=i(57768),K=i(31122),J=i(32351),G=i(94442),Q=i(10878),$=i(51014),ee=i(19548),et=i(35543),ei=i(95441),en=i(99259),eo=i(85095),er=i(40647),el=i(60807),ea=i(42375),es=i(81914),ed=i(883),ec=i(53678),eu=i(11358),ep=i(12765),eh=i(68833),em=i(21811),eg=i(7882),ev=i(9682),ef=i(98914),eb=i(94874),e_=i(13229),ey=i(15771),eZ=i(20730),ew=i(19081),ek=i(44424),eC=i(6490),eS=i(98248),ex=i(10510),eB=i(69891),eP=i(43570),eI=i(58175),eN=i(70379),eT=i(87077),eE=i(71460),eL=i(65958),eX=i(85566),eM=i(17948),eR=i(27744),eF=i(44116),eU=i(40949),eO=i(21972),eA=i(40559),eD=i(74312),ez=i(16072),ej=i(88817),eH=i(50167),eW=i(65575),eq=i(98848),eY=i(98661),eV=i(8618),eK=i(13808),eJ=i(98643),eG=i(20817),eQ=i(1548),e$=i(41069),e0=i(48159),e1=i(31548),e4=i(13774);i(4168);var e2=i(12799),e8=i(98750),e3=i(10656),e6=i(26960),e5=i(31541),e9=i(91400),e7=i(64172),te=i(93903),tt=i(60308),ti=i(84864),tn=i(81352);function to(e){var t,{post:i,pub:o,openInPostViewer:r,canonicalUrl:l}=e,a=(0,eq._)(e,["post","pub","openInPostViewer","canonicalUrl"]);let s=!!(0,el.aF)(),{subscription:u}=(0,e7.p6)(o.id);return(0,n.tZ)(tr,(0,c._)((0,d._)({},a),{post:i,postId:i.id,title:i.title,description:(0,te.Z)(i.description),bylines:i.publishedBylines,consumptionTime:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"md",{minutes:i,action:n}=function(e){let t;let{comment_count:i,podcast_duration:n,wordcount:o,videoUpload:r}=e,l=null,a=(0,e3.z_)(e);if(r&&r.duration&&r.duration>0)t=r.duration/60,l="watch";else if("podcast"===a)t=n/60,l="listen";else{if("thread"===a)return{minutes:0,action:i>0?"".concat(i.toLocaleString()," replies"):"Thread"};if(null==o||!(o>0))return{minutes:0,action:null};t=o/ti.READ_WORDS_PER_MINUTE,l="read"}return{minutes:Math.max(Math.round(t),1),action:l}}(e);if(null===n)return"";let o=function(e,t){if(0===e||!e)return"";let i=Math.floor(e/60),n=e%60;switch(t){case"lg":return i>0?"".concat(i.toLocaleString()," hours ").concat(n>0?"".concat(n.toLocaleString()," minutes"):""):"".concat(n.toLocaleString()," minutes");case"sm":return i>0?"".concat(i.toLocaleString(),"h ").concat(n>0?"".concat(n.toLocaleString(),"m"):""):"".concat(n.toLocaleString(),"m");default:return i>0?"".concat(i.toLocaleString()," hr ").concat(n>0?"".concat(n.toLocaleString()," min"):""):"".concat(n.toLocaleString()," min")}}(i,t);return"".concat(o," ").concat(n)}(i),coverImage:i.cover_image,type:(0,e3.z_)(i),Icon:"podcast"===(t=(0,e3.z_)(i))?e0.f:"video"===t?e4.O:"thread"===t?e1.o:null,canonicalUrl:null!=l?l:(0,tt.uRy)(o,i,{signedIn:s}),noNewTab:r,timestamp:i.post_date,pub:o,audienceBadge:["only_paid","founding"].includes(i.audience)?(null==u?void 0:u.membership_state)==="free_signup"&&i.should_send_free_preview?"preview":"founding"===i.audience?"founding":"paid":void 0}))}function tr(e){var{post:t,bylines:i,consumptionTime:o,Icon:r,audienceBadge:l,showBestsellerBadge:a,highlights:s,excerpt:u,noNewTab:p,showLoginPrompt:h}=e,m=(0,eq._)(e,["post","bylines","consumptionTime","Icon","audienceBadge","showBestsellerBadge","highlights","excerpt","noNewTab","showLoginPrompt"]);return(0,n.BX)(tl,(0,c._)((0,d._)({},m),{highlights:s,noNewTab:p,children:[h&&(0,n.tZ)(es._Q,{version:"login"}),(0,n.tZ)(tp,{post:t,bylines:i,consumptionTime:o,Icon:r,audienceBadge:l,showBestsellerBadge:a,highlights:s,excerpt:u})]}))}function tl(e){let{children:t,pub:i,publisherName:r,logoUrl:l,timestamp:a,isViewed:s,isArchived:d,isSelected:c,isLiked:u,isSaved:p,onLike:m,onClick:g,canonicalUrl:v,postId:f,defaultSaved:b,onSave:_,onArchive:y,onMouseEnter:Z,onVisible:w,utmSource:k,highlights:C,noNewTab:S}=e,x=(0,el.aF)(),[B,P]=(0,e5.r8)(!s),I=(0,ef.K1)(),N=(0,o.sO)();return(0,e8.UM)(N,()=>w&&w(),{threshold:.2}),(0,n.BX)(ts,{ref:N,href:v,onClick:e=>{P(),g&&g(e)},className:"reader2-post-container",utmSource:k,isSelected:c,onMouseMove:()=>{null==Z||Z(f)},noNewTab:S,children:[(0,n.tZ)(td,{pub:i,publisherName:r,logoUrl:l,highlights:C,children:(0,n.BX)(eW.gq,{className:h()("reader2-post-info tw-items-center tw-gap-3",x&&"hasUser"),children:[(0,n.tZ)(tc,{className:"inbox-item-timestamp",value:a}),(0,n.tZ)(ta,{isMobile:I,postId:f,defaultSaved:b,isSaved:p,isArchived:d,onSave:_,user:x,onArchive:y,isLiked:u,onLike:m,canonicalUrl:v,communityEnabled:null==i?void 0:i.community_enabled}),B]})}),t]})}function ta(e){let{isMobile:t,postId:i,defaultSaved:o,isLiked:r,onLike:l,isSaved:a,onSave:s,user:d,isArchived:c,onArchive:u,canonicalUrl:p,communityEnabled:m}=e,{isSaved:g,onSave:v}=(0,G.nA)({postId:i,defaultSaved:o}),f=()=>{null==u||u()},b=(0,e2.g)();return t?null:(0,n.BX)(ew.hs,{padding:4,gap:4,position:"absolute",className:h()("inbox-item-actions-menu",tn.Z.actionMenu),onClick:e=>{e.stopPropagation(),e.preventDefault()},radius:"md",border:"detail",bg:"primary",children:[l&&m&&(0,n.tZ)(ey.zx,{size:"sm",priority:"tertiary",onClick:()=>l(i),children:(0,n.tZ)(tf,{isActive:r})}),(0,n.tZ)(ey.zx,{size:"sm",priority:"tertiary",onClick:()=>b(p),children:(0,n.tZ)(tZ,{})}),d&&(0,n.tZ)(ey.zx,{size:"sm",priority:"tertiary",onClick:()=>{s?s(i,!g):v()},children:(0,n.tZ)(tb,{isActive:null!=a?a:g})}),u&&(c?(0,n.tZ)(ey.zx,{size:"sm",priority:"tertiary",onClick:f,children:(0,n.tZ)(ty,{})}):(0,n.tZ)(ey.zx,{size:"sm",priority:"tertiary",onClick:f,children:(0,n.tZ)(t_,{})}))]})}let ts=(0,eY.forwardRef)((e,t)=>{var{noNewTab:i}=e,o=(0,eq._)(e,["noNewTab"]);return(0,n.tZ)(eW.Uj,(0,d._)({ref:t,linkClassName:h()("reader2-inbox-post",null==o.isSelected&&"hover-action-menu",tn.Z.inboxItem),native:!0,isPadded:!1,newTab:!i},o))});function td(e){let{pub:t,logoUrl:i,publisherName:o,children:r,highlights:l={}}=e;return(0,n.BX)("div",{className:"reader2-post-head reader2-text-meta",children:[(t||i)&&(0,n.tZ)(ex.wk,{pub:t,logoUrl:i,publicationName:o,size:20,radius:"xs"}),(0,n.tZ)("div",{className:"pub-name",children:o||t&&(0,n.tZ)(eW.zr,{href:t.base_url,onClick:e=>e.stopPropagation(),children:(0,e6.L)(t.name,l["publication.name"])})}),r]})}function tc(e){let{value:t,className:i}=e;return(0,n.tZ)(eI.xv.Meta,{className:i,nowrap:!0,children:(0,ef.Po)(t)})}function tu(e){let{post:t,image:i,metaText:o,highlights:r={},excerpt:l}=e;return(0,n.BX)("div",{className:"reader2-post-body",onClick:()=>{var e;let i=(null===(e=window)||void 0===e?void 0:e.location)&&new URL(window.location.href);i&&(0,eh.j)(eh.FP.POST_SEARCH_RESULT_CLICKED,{post_id:t.id,query:decodeURIComponent(i.pathname.replace(/\/search\//g,""))})},children:[(0,n.BX)(eW.tu,{minWidth:0,gap:8,children:[(0,n.tZ)("div",{className:"reader2-post-title reader2-clamp-lines",children:(0,e6.L)(t.title,r.title||r["posts.title"],"heavy")}),t.description&&(0,n.tZ)(eW.nv,{variant:"secondary",isConstrained:!l,children:l?(0,n.BX)(eI.xv,{as:"span",fontStyle:"italic",children:["“...",(0,e6.L)(l,r.body_text,"heavy"),"”"]}):(0,e6.L)((0,te.Z)(t.description),r.subtitle||r["posts.subtitle"],"heavy")}),o]}),i]})}function tp(e){let{bylines:t,consumptionTime:i,Icon:o,audienceBadge:r,showBestsellerBadge:l,post:a,highlights:s,excerpt:d}=e;return(0,n.tZ)(tu,{post:a,metaText:(0,n.tZ)(th,{bylines:t,consumptionTime:i,Icon:o,audienceBadge:r,showBestsellerBadge:l,highlights:s}),image:a.cover_image&&(0,n.tZ)(tv,{post:a}),highlights:s,excerpt:d})}function th(e){let{bylines:t,consumptionTime:i,Icon:o,audienceBadge:r,showBestsellerBadge:l,highlights:a={}}=e;return(0,n.BX)(eW.SC,{children:[r&&(0,n.BX)(n.HY,{children:[(0,n.tZ)("span",{className:"meta-audience-badge",children:r}),(0,n.tZ)(tg,{})]}),t.length>0?(0,n.BX)(n.HY,{children:[(0,n.tZ)(eQ.M,{array:t,limit:3,formatter:e=>l?(0,n.tZ)(tm,{name:e.name||"",tier:e.bestseller_tier,userId:e.id}):(0,e6.L)(e.name||"",a["publication.author_name"])}),i&&(0,n.tZ)(tg,{})]}):null,o&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(o,{className:"meta-icon tw-align-text-top"})," "]}),i]})}let tm=e=>{let{name:t,tier:i,userId:o}=e;return i?(0,n.BX)(eW.gq,{inline:!0,gap:4,alignItems:"center",children:[t," ",(0,n.tZ)(eE.UserBadge,{userId:o,tier:i,size:"sm"})]}):(0,n.tZ)(n.HY,{children:t})},tg=()=>(0,n.tZ)("span",{className:"meta-bullet",children:"∙"});function tv(e){let{post:t,size:i=132,square:r,className:l}=e,a=t.cover_image,s=(0,e3.z_)(t),d="podcast"===s||r?i:200,[c,u]=(0,o.eJ)(null);return c?null:(0,n.BX)("div",{className:h()("reader2-post-picture-container",l),children:[(0,n.tZ)(eW.t5,{className:h()("reader2-post-picture",s),src:a,width:d,height:i,loading:"lazy",noStyle:!r,onError:e=>u(e)}),("podcast"===s||"video"===s)&&(0,n.tZ)("div",{className:"reader2-picture-overlay",children:(0,n.tZ)(e$.x,{className:"picture-play"})})]})}function tf(e){let{isActive:t}=e;return(0,n.tZ)(eV.Z,{className:t?tn.Z.activeLike:"",size:20})}function tb(e){let{isActive:t}=e;return(0,n.tZ)(eK.Z,{className:t?tn.Z.activeSave:"",size:20})}function t_(){return(0,n.tZ)(eJ.Z,{size:20})}function ty(){return(0,n.tZ)(eG.Z,{size:20})}function tZ(){return(0,n.tZ)(C.Z,{size:20})}function tw(){return(0,n.tZ)(n.HY,{children:Array(6).fill(0).map((e,t)=>(0,n.tZ)(tk,{},t))})}function tk(){let e=(0,e9.XA)();return(0,n.tZ)(eW.Uj,{isPadded:!1,children:(0,n.BX)(eW.tu,{flex:"grow",gap:12,padding:e?8:12,children:[(0,n.BX)(ew.hs,{gap:12,alignItems:"center",children:[(0,n.tZ)(eW.Vm,{size:24,style:{borderRadius:6}}),(0,n.tZ)(eW.Vm,{type:"bar",maxWidth:120,className:"tw-grow"}),(0,n.tZ)(eW.Vm,{type:"bar",maxWidth:80,className:"tw-ml-auto tw-grow"})]}),(0,n.BX)("div",{className:"reader2-post-body",children:[(0,n.BX)(eW.tu,{minWidth:0,gap:4,children:[(0,n.tZ)(eW.Vm,{type:"bar",width:"70%"}),(0,n.tZ)(eW.Vm,{type:"bar",width:"80%"}),(0,n.tZ)(eW.Vm,{type:"bar",width:"50%"})]}),(0,n.tZ)(eW.Vm,{width:e?64:160,height:e?64:120,style:{borderRadius:6}})]})]})})}var tC=i(5623),tS=i(32189),tx=i(40548),tB=i(78446),tP=i(70293),tI=i(84923),tN=i(43254),tT=i(92039),tE=i(25479),tL=i(98012),tX=i(6163),tM=i(26111),tR=i(36186),tF=i(63651),tU=i(47929),tO=i(51984);function tA(){let e=(0,u._)([""," only accepts messages from subscribers"]);return tA=function(){return e},e}function tD(){let e=(0,u._)([""," only accepts messages from paid subscribers"]);return tD=function(){return e},e}function tz(){let e=(0,u._)([""," only accepts messages from founding members"]);return tz=function(){return e},e}let tj=(0,tt.Nhr)({utm_source:tU.b3.substack}),tH="profile-page-feed";function tW(e){var t,i,r;let l,a,{id:s,subpath:u,initialData:{profileSubscribeOnTransit:p=!1,referringUser:h,freeSignup:m,freeSignupEmail:g,activeLiveStream:v,subscriptionToLiveStreamPub:f,invitedLiveStreamPublications:b,subscriptionsToLiveStreamInvitedPub:_}}=e,k=(0,el.aF)(),[C,S]=(0,ev.tv)(),x=(0,o.sO)(null),B=(0,eN.pm)(),[P]=(0,o.eJ)(!!((0,tM.x)("followPrompt")&&h)),{addSurface:I}=(0,tE.ze)();(0,ej.qr)(""),s.includes("-")?(l=function(e){let t=e.split("-");return t.length?parseInt(t[0]):-1}(s),a=function(e){let t=e.split("-");return t.length?t.slice(1).join("-"):""}(s)):l=s;let{subjectProfile:N,error:T}=(0,eo.Un)({subjectId:l,subjectName:a}),E=RegExp("/p-(\\d+)"),L=null,X=u.match(E);X&&X[1]&&(L=Number(X[1]));let M=(0,ee.gc)(null==N?void 0:N.id),R="blocked"===M||"blocking"===M,F=!!(null==N?void 0:N.profile_set_up_at),U=N&&N.id===(null==k?void 0:k.id),A=(null==N?void 0:N.subscriptions)||[],D=(null==N?void 0:N.primaryPublication)&&(null===(t=N.publicationUsers.find(e=>{var t;return e.publication_id===(null==N?void 0:null===(t=N.primaryPublication)||void 0===t?void 0:t.id)}))||void 0===t?void 0:t.publication),z=!!(D&&(null==N?void 0:N.isSubscribed)),j=(0,et.Sv)(N,"profile"),H=(null==N?void 0:N.max_pub_tier)===2;(0,o.d4)(()=>{var e;(null===(e=new URL(document.location.href).searchParams)||void 0===e?void 0:e.has("invite"))?(0,ef.uX)("/app",{local_navigation:!1}):N&&((0,eh.j)(eh.FP.PROFILE_VISITED,{profile_user_id:N.id,is_set_up:F,is_self:U,has_name:!!N.name,has_photo:!!N.photo_url,has_bio:!!N.bio,has_twitter:!!N.twitterAccount,reads_count:N.visibleSubscriptionsCount,writes_count:N.publicationUsers.length,subscribe_cta_publication_id:!z&&(null==D?void 0:D.id),live_stream_id:null==v?void 0:v.liveStream.id}),p&&((0,ef.iO)("subscribed"),B.popToast(e=>(0,n.tZ)(eN.FN,(0,c._)((0,d._)({},e),{text:"Subscribed to ".concat((null==D?void 0:D.name)||N.name||"user"),Icon:y.Z})))))},[s]),(0,o.d4)(()=>{var e;(null===(e=new URL(document.location.href).searchParams)||void 0===e?void 0:e.has("follow"))&&N&&j.isLoaded&&((0,ef.iO)("follow"),U||j.isFollowing||j.toggle())},[s,N,j.isLoaded]),(0,o.d4)(()=>{k&&N&&I({type:"visited-profile",profile:N})},[I,N,k]);let[{url:W}]=(0,ev.tv)(),q=!function(e,t){var i;let n=null===(i=new URL(e,"https://monograph.dev").searchParams)||void 0===i?void 0:i.get("utm_source");return!!(n&&ih.includes(n)||(null==t?void 0:t.source)&&ih.includes(t.source))}(W,(0,em.l)())?"profile-page":tH,Y=null;return(N&&!U&&!R&&(D?Y=(0,n.tZ)(iu,{user:k,profile:N,primaryPublication:D,subscriptionSource:q}):N.isPersonalEligible&&(Y=(0,n.tZ)(ip,{profile:N,subscriptionSource:q}))),(0,o.d4)(()=>{if(!N)return;let e=[];if(U)e.push("share","edit");else{var t;Y&&e.push((null==N?void 0:N.isSubscribed)?"subscribed":"subscribe"),N.isSubscribed||e.push(N.isFollowing?"following":"follow"),(N.can_dm||(null!==(t=N.dm_upgrade_options)&&void 0!==t?t:[]).length>0)&&e.push("message")}0!==e.length&&(0,eh.j)(eh.FP.PROFILE_PRIMARY_ACTIONS_SHOWN,{actions:e})},[N]),T)?(0,n.BX)(eW.T3,{className:tO.Z.page,children:[(0,n.tZ)(J.Metadata,{title:"Profile not found"}),(0,n.tZ)(ew.hs,{paddingY:64,flex:"grow",children:(0,n.tZ)(eW.mb,{icon:(0,n.tZ)(Z.Z,{}),title:"Profile not found",text:"We couldn't load this profile.",action:(0,n.tZ)(ey.zx,{priority:"secondary",href:(0,tt.daR)(),children:"Search"})})})]}):N?(0,n.BX)(ew.tu,{style:{maxWidth:568},flex:"grow",minWidth:0,children:[(0,n.tZ)(J.Metadata,{title:v?"LIVE NOW: ".concat(N.name||v.user.name||(null===(i=v.pub)||void 0===i?void 0:i.name)," on Substack"):"".concat(N.name||""," | Substack"),description:(null==v?void 0:null===(r=v.pub)||void 0===r?void 0:r.name)||N&&N.bio,image:v?(0,tF.VCE)(v.liveStream.id,{isGif:!0}):N&&N.photo_url&&(0,tt.zF4)(N.photo_url),seoProps:{noindex:!(H&&(N.photo_url||N.bio||F))}}),(0,n.tZ)($.ZP,{ref:x,medium:"profile-page",user:k,profile:N,onClick:e=>e.preventDefault()}),P&&h?(0,n.tZ)(O.yi,{referringUser:h,freeSignupEmail:g,forceFollowPrompt:!0,surface:"profile-follow-referrer-prompt"}):null," ",(0,tM.x)(document.location.href,"liveStream")&&(null==v?void 0:v.liveStream.id)?(0,n.tZ)(ez.V,{profile:N,activeLiveStream:v,subscriptionToLiveStreamPub:f,invitedLiveStreamPublications:b,subscriptionsToLiveStreamInvitedPub:_,freeSignup:m,freeSignupEmail:g}):null,(0,n.tZ)(ic,{profile:N}),(0,n.BX)(ew.tu,{children:[(0,n.BX)(ew.tu,{gap:8,paddingX:{desktop:0,mobile:16},paddingTop:{desktop:32,mobile:16},paddingBottom:{desktop:16,mobile:8},children:[(null==v?void 0:v.liveStream.id)&&v.liveStreamInformation.desktopPlaybackUrl&&(0,tL.Z)(v.liveStream.started_streaming_at).isBefore((0,tL.Z)().subtract(1,"minute"))?(0,n.tZ)(K.Y,{activeLiveStream:v}):null,(0,n.tZ)(t1,{profile:N,yourProfile:!!U,primaryPublication:D,user:k,showCTAs:!R,onShare:()=>{var e;return null===(e=x.current)||void 0===e?void 0:e.open()},subscribeButton:Y,activeLiveStream:v,profileBlocked:R}),"blocked"===M&&(0,n.tZ)(ew.hs,{paddingY:32,flex:"grow",children:(0,n.tZ)(eW.mb,{icon:(0,n.tZ)(w.Z,{}),title:"".concat(N.name||"They"," blocked you"),text:"You are blocked from subscribing to ".concat(N.name||"them"," and their publications")})}),"blocking"===M&&(0,n.tZ)(ew.hs,{paddingY:32,flex:"grow",children:(0,n.tZ)(eW.mb,{icon:(0,n.tZ)(w.Z,{}),title:"You blocked ".concat(N.name||"them"),text:"You can manage your blocks in your account settings.",action:(0,n.tZ)(ey.zx,{priority:"secondary",href:(0,tt.v3t)(),children:"Account settings"})})})]}),!R&&!!N.name&&(0,n.tZ)(tQ,{subscriptions:A,profile:N,subpath:u})]}),!F&&U&&(0,n.tZ)(eW.ET,{children:(0,n.tZ)(ew.hs,{paddingY:64,flex:"grow",children:(0,n.tZ)(eW._Y,{icon:(0,n.tZ)(V.Z,{}),title:"You haven’t set up your profile yet.",text:"Click the button below to get started.",action:(0,n.tZ)(ey.zx,{priority:"secondary",href:(0,tt.v3t)(),children:"Set up profile"})})})}),L&&(0,n.tZ)(ig,{postId:L,onClose:()=>{S((0,tt.NNq)(N,{noBase:!0}))}})]}):(0,n.tZ)(tY,{})}function tq(e){return(0,n.tZ)(ew.tu,(0,d._)({flex:"grow"},e))}let tY=()=>(0,n.tZ)(ew.tu,{style:{maxWidth:600},flex:"grow",children:(0,n.BX)(ew.tu,{gap:{desktop:20,mobile:16},paddingTop:{desktop:32,mobile:16},paddingBottom:16,children:[(0,n.BX)(ew.gq,{justifyContent:"space-between",alignItems:"center",children:[(0,n.BX)(ew.tu,{justifyContent:"center",gap:8,children:[(0,n.tZ)(eW.Vm,{type:"bar",height:36,width:200}),(0,n.tZ)(eW.Vm,{type:"bar",height:20,width:180})]}),(0,n.tZ)(eW.Vm,{type:"circle",size:88})]}),(0,n.BX)(ew.tu,{gap:8,flex:"grow",minWidth:0,children:[(0,n.tZ)(eW.Vm,{type:"bar",height:20,width:"70%"}),(0,n.tZ)(eW.Vm,{type:"bar",height:20,width:"80%"}),(0,n.tZ)(eW.Vm,{type:"bar",height:20,width:"30%"})]}),(0,n.tZ)(eW.Vm,{type:"bar",height:40,width:120})]})});function tV(e){var t;let i,{profile:r,type:l="notes"}=e;(0,o.d4)(()=>{(0,eh.j)(eh.FP.FEED_PROFILE_SCREEN_VIEWED,{target_user_id:r.id})},[]);let a=(0,el.aF)(),s=(0,en.M$)().isOnDestination,u=!a&&s,[p,h]=(0,ep.L)(eR.K5,eR._H);"likes"===l?i=["like"]:"notes"===l?i=void 0:console.warn("Unrecognized type in NotesList: ".concat(l));let{canFetchMore:m,lastPage:g,fetchMore:v,hasLoadedOnce:f}=(0,eg.NL)({pathname:"/api/v1/reader/feed/profile/".concat(r.id),query:{types:i},getPageInit:e=>{var t;let{lastPage:i,init:n}=e,o=null==i?void 0:null===(t=i.result)||void 0===t?void 0:t.nextCursor;return o&&(n.query=(0,c._)((0,d._)({},n.query),{cursor:o})),n},auto:!0,deps:[r.id,l],pages:p.pages,dispatch:h}),b=m&&!!(null==g?void 0:null===(t=g.result)||void 0===t?void 0:t.nextCursor)&&!u,{bodyRef:_}=(0,tP.M)(v,[g],{shouldCheck:b,threshold:640}),y=p.pages.map(e=>{var t;return(null===(t=e.result)||void 0===t?void 0:t.items)||[]}).flat(),Z=u&&y.length>2;Z&&(y=y.slice(0,3));let w=r&&r.id===(null==a?void 0:a.id);return(0,o.d4)(()=>{var e;(null==g?void 0:null===(e=g.result)||void 0===e?void 0:e.items.length)==0&&b&&v()},[g]),(0,n.tZ)(ea.$U,{surface:"profile",dispatch:h,state:p,children:(0,n.BX)(ew.tu,{ref:_,children:[(0,n.tZ)(ee.fQ,{children:y.map((e,t)=>(0,n.tZ)(es.Bm,{item:(0,eR.K6)(p,e),showLoginPrompt:!!(Z&&2===t)}))}),(null==g?void 0:g.isLoading)||!f?(0,n.tZ)(ed.n,{}):0===y.length?(0,n.tZ)(ew.hs,{paddingY:64,flex:"grow",children:"notes"===l?(0,n.tZ)(tK,{yourProfile:w}):(0,n.tZ)(tJ,{profile:r,yourProfile:w})}):null]})})}function tK(e){let{yourProfile:t}=e;return(0,n.tZ)(eW._Y,{icon:(0,n.tZ)(k.Z,{}),title:t?"You haven’t published any notes yet.":"This user hasn’t published any notes yet.",text:t?"Once you do, you’ll see them here.":"Once they do, you’ll see them here.",action:(0,n.tZ)(ey.zx,{priority:"secondary",href:(0,tt.E2n)(),children:"Explore more notes"})})}function tJ(e){let{yourProfile:t,profile:i}=e,o=(0,ti.guessFirstName)(i.name);return(0,n.tZ)(eW._Y,{title:"No likes yet",text:t?"Your likes will appear here.":o?"".concat(o,"’s likes will appear here."):"Their likes will appear here."})}let tG=new Set(["notes","posts","likes","lists","reads"]);function tQ(e){let{subscriptions:t,profile:i,subpath:o}=e,[r,l]=(0,ev.tv)(),a=(0,el.aF)(),{getConfigFor:s}=(0,er.xR)(),d=s("lists_enabled"),c=(0,en.M$)().isOnDestination,u=o?o.slice(1):void 0,p=u&&tG.has(u)?u:i.hasActivity?"notes":i.hasPosts?"posts":i.hasLikes?"likes":(null==i?void 0:i.lists)&&d?"lists":"reads",h=_()([{value:"notes",label:"Activity"},{value:"posts",label:"Posts"},{value:"likes",label:"Likes"},d?{value:"lists",label:"Lists"}:null,{value:"reads",label:"Reads".concat(i.visibleSubscriptionsCount>0?" (".concat(i.visibleSubscriptionsCount,")"):"")}]);return(0,n.BX)(ew.tu,{children:[(0,n.tZ)(eB.n,{tabs:h,value:p,onChange:e=>{let t=history.state;l(c?"".concat((0,tt.NNq)(i,{noBase:!0}),"/").concat(e):"/profile/".concat(e),!0),history.replaceState(t,"")}}),(0,n.BX)(ew.tu,{flex:"fill",paddingBottom:20,children:["posts"===p&&(0,n.tZ)(t0,{profile:i,userId:i.id}),"notes"===p&&(0,n.tZ)(tV,{profile:i}),"likes"===p&&(0,n.tZ)(tV,{profile:i,type:"likes"}),d&&"lists"===p&&(0,n.tZ)(tx.E,{lists:i.lists,ownProfile:(null==a?void 0:a.id)===i.id}),"reads"===p&&(0,n.tZ)(ia,{subscriptions:t,profile:i})]})]})}function t$(e){let{profile:t}=e,i=(0,el.aF)(),o=t&&t.id===(null==i?void 0:i.id);return(0,n.tZ)(ew.hs,{paddingY:64,flex:"grow",children:(0,n.tZ)(eW._Y,{icon:(0,n.tZ)(k.Z,{}),title:"".concat(o?"You haven’t":"".concat(t.name," hasn’t")||"This user hasn’t"," published any posts yet."),text:"Once they do, you’ll see them here."})})}function t0(e){var t,i;let{profile:r,userId:l}=e,[a,s]=(0,o.eJ)(0),[d,c]=(0,o.eJ)([]),u=(0,el.aF)(),p=(0,en.M$)().isOnDestination,h=!u&&p,{result:m,isLoading:g}=(0,eg.ib)({pathname:"/api/v1/profile/posts",query:{profile_user_id:l,offset:a,limit:13},auto:!0,deps:[l,a]}),v=h&&((null===(i=d[0])||void 0===i?void 0:null===(t=i.posts)||void 0===t?void 0:t.length)||0)>2;(0,o.bt)(()=>{m&&c(0===a?[m]:[...d,m])},[m]);let f=(0,o.Ye)(()=>{let e=d.map(e=>e.posts.slice(0,12)).flat();return v&&(e=e.slice(0,3)),{posts:e,publicationMap:new Map(d.map(e=>e.publications).flat().map(e=>[e.id,e]))}},[d]),b=d[d.length-1],_=b&&b.posts.length>12&&!h,{bodyRef:y}=(0,tP.M)(()=>{s(a+12)},[f,g],{shouldCheck:!!_&&!g}),{posts:Z,publicationMap:w}=f;return(0,n.tZ)(ew.tu,{children:(0,n.BX)(eW.mE,{ref:y,children:[m?Z.length>0?Z.map((e,t)=>{let i=w.get(e.publication_id);if(i){let o="profile"===i.homepage_type&&r.handle?(0,tF.e3o)({postId:e.id,handle:r.handle,noBase:!1}):null;return(0,n.tZ)(to,{post:e,pub:i,isViewed:!0,isLiked:!!e.reaction,isSaved:e.is_saved,showLoginPrompt:!!(v&&2===t),onClick:n=>{if((0,eh.j)(eh.FP.ARCHIVE_PAGE_POST_CLICKED,{post_id:e.id,tab:"new",rank_in_feed:t,source:"profile"}),n.ctrlKey||n.metaKey)return;n.preventDefault(),n.stopPropagation();let o=p?(0,tF.e3o)(r.handle?{postId:e.id,handle:r.handle,noBase:!0}:{readerProfileUser:r,postId:e.id,noBase:!0}):(0,tF.uRy)(i,e,{noBase:!1});(0,ef.uX)(o)},utmSource:"profile",openInPostViewer:!0,canonicalUrl:o},e.id)}}):(0,n.tZ)(t$,{profile:r}):(0,n.tZ)(tw,{}),g&&(0,n.tZ)(eS.$j,{})]})})}function t1(e){let{profile:t,yourProfile:i,user:o,showCTAs:r,subscribeButton:l,onShare:a,activeLiveStream:s,primaryPublication:d,profileBlocked:c}=e,u=(null==t?void 0:t.name)||"";return(0,n.BX)(ew.tu,{gap:{desktop:16,mobile:8},children:[(0,n.BX)(ew.hs,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:16,children:[(0,n.BX)(ew.tu,{gap:4,children:[(0,n.BX)(eI.xv.H3,{fontWeight:"heavy",textAlign:"left",children:[u,(0,n.BX)("span",{style:{whiteSpace:"nowrap"},children:["\xa0",(0,n.tZ)("span",{style:{marginLeft:4},children:(0,n.tZ)(eE.UserBadge,{tier:t.bestseller_tier,userId:t.id,inline:!0,size:"md"})})]})]}),(0,n.tZ)(t2,{profile:t,yourProfile:i}),!c&&(0,n.tZ)(t4,{profile:t,primaryPublication:d})]}),(0,n.tZ)(im,{profile:t,activeLiveStream:s})]}),(0,n.BX)(ew.tu,{gap:{desktop:16,mobile:8},paddingBottom:{desktop:4,mobile:8},children:[t.bio&&(0,n.tZ)(eI.xv.B3,{textAlign:"left",clamp:3,children:(0,n.tZ)(f(),{options:{attributes:{rel:"nofollow ugc"}},children:t.bio})}),(0,n.tZ)(t6,{profile:t,yourProfile:i,profileBlocked:c})]}),(0,n.tZ)(it,{subscribeButton:l,profile:t,yourProfile:i,user:o,showCTAs:r,onShare:a})]})}function t4(e){var t,i;let{profile:o,primaryPublication:r}=e,{iString:l}=(0,ei.M1)(),a=(0,en.M$)().isOnDestination,s=o.publicationUsers.filter(e=>{var t;return(null===(t=e.publication)||void 0===t?void 0:t.id)!==(null==r?void 0:r.id)}),d=s.length>0?null===(t=s[0])||void 0===t?void 0:t.publication:void 0,c=s.length>1?_()(s.slice(1).map(e=>e.publication)):[],u=(null!==(i=o.userLinks)&&void 0!==i?i:[]).sort((e,t)=>{let i=t3(e.type),n=t3(t.type);return i!==n?i-n:(Number(e.id)||0)-(Number(t.id)||0)}),p=(0,eU.y)(),h=(e,t)=>{if("undefined"==typeof window)return;let i=(0,tt.TJI)(t);a||window.location.origin!==new URL(i).origin&&t.custom_domain!==window.location.hostname?(0,eh.x6)(t,"profile"):(e.preventDefault(),p(i),(0,eh.j)(eh.FP.PUBLICATION_URL_COPIED))};return(0,n.BX)(ew.hs,{gap:4,wrap:"wrap",children:[r&&(0,n.tZ)(eZ.A,{leading:(0,n.tZ)(ex.wk,{pub:r,size:20}),href:(0,tt.TJI)(r),onClick:e=>h(e,r),children:(0,n.tZ)(eI.xv.B4,{children:r.name})}),d&&(0,n.tZ)(eZ.A,{leading:(0,n.tZ)(ex.wk,{pub:d,size:20}),href:(0,tt.TJI)(d),onClick:e=>h(e,d),children:(0,n.tZ)(eI.xv.B4,{children:d.name})}),c.length+u.length>0&&(0,n.BX)(ek.v2,{trigger:(0,n.tZ)(eZ.A,{leading:(0,n.tZ)(C.Z,{size:16}),children:(0,n.tZ)(eI.xv.B4,{children:!r&&s.length<1?l("Links"):"+".concat(c.length+u.length," ").concat(l("more"))})}),title:l("Links"),layerOptions:{placement:"bottom-start"},children:[c.length>0&&c.map(e=>(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(ex.wk,{pub:e,size:20}),href:(0,tt.TJI)(e),onClick:t=>h(t,e),children:(0,n.BX)(ew.tu,{justifyContent:"center",minWidth:0,children:[(0,n.tZ)(eI.xv.B3,{maxWidth:200,ellipsis:!0,children:e.name}),(0,n.tZ)(eI.xv.B4,{color:"secondary",children:"Substack publication"})]})},e.id)),u.length>0&&u.map(e=>{var t,i;let o=e.type&&t8[e.type],r=null!==(t=null==o?void 0:o.icon)&&void 0!==t?t:C.Z,l=null!==(i=null==o?void 0:o.label)&&void 0!==i?i:e.value;return(0,n.tZ)(ek.sN,{leading:r?(0,n.tZ)(r,{className:tO.Z.socialLinkIcon}):(0,n.tZ)(S.Z,{stroke:"var(--color-fg-primary)"}),href:e.url,target:"_blank",children:(0,n.BX)(ew.hs,{alignItems:"center",children:[(0,n.BX)(ew.tu,{flex:"grow",children:[(0,n.tZ)(eI.xv.B3,{children:l}),(0,n.tZ)(eI.xv.B4,{color:"secondary",maxWidth:200,ellipsis:!0,children:e.value})]}),(0,n.tZ)(x.Z,{size:20,style:{marginLeft:90}})]})},e.url)})]})]})}function t2(e){let{profile:t,yourProfile:i}=e,o=(0,e9.XA)(),{iString:r}=(0,ei.M1)(),l=t.subdomainUrl,a=t.handle||i,s=(0,eU.y)();return(0,n.tZ)(ew.hs,{gap:8,alignItems:"center",justifyContent:"start",children:a&&(t.handle?(0,n.tZ)(eI.xv.B3,{as:"a",onClick:()=>{(0,eh.j)(eh.FP.PROFILE_LINK_COPIED,{surface:"profile_page",profile_link:l,shared_user_id:t.id}),s((0,tt.NNq)(t))},cursor:"pointer",decoration:"hover-underline",color:"secondary",display:"flex",lineHeight:20,tabIndex:0,radius:"xs",showFocus:!0,animate:!0,children:(0,n.tZ)(eT.u,{text:"Copy link",disabled:o,children:"@".concat(t.handle)})}):i&&(0,n.tZ)(eI.xv.B3,{color:"substack",children:(0,n.tZ)(ec.hh,{href:(0,tt.qvS)({params:{utm_source:tU.b3.handleNotification,choose_handle:!0}}),children:r("Claim your handle")})}))})}let t8={books:{icon:D.Z,label:"Book"},facebook:{icon:z.Z,label:"Facebook"},instagram:{icon:j.Z,label:"Instagram"},linkedin:{icon:H.Z,label:"LinkedIn"},youtube:{icon:Y.Z,label:"YouTube"},tiktok:{icon:W.Z,label:"TikTok"},bluesky:{icon:()=>(0,n.tZ)(A.Z,{size:20}),label:"Bluesky"},twitter:{icon:q.Z,label:"Twitter",verifiedIcon:(0,n.tZ)(B.Z,{className:h()(tO.Z.fillIcon,tO.Z.twitterVerifiedIcon),size:18})}};function t3(e){return e?Object.keys(t8).indexOf(e):-1}function t6(e){let{profile:t,yourProfile:i,profileBlocked:o}=e;if(o)return null;let r=i||!t.mutualsContext;return(0,n.BX)(ew.hs,{alignItems:r?"center":"start",direction:r?"row":"column",justifyContent:"start",gap:r?8:4,children:[(0,n.tZ)(t9,{profile:t,yourProfile:!!i}),(0,n.tZ)(t5,{oneLine:r,profile:t})]})}function t5(e){let{oneLine:t,profile:i}=e,{leaderboardRanking:o}=i;if(!o)return null;let r="paid"===o.ranking?"#".concat(o.rank," in\n ").concat(o.category_name):"bestseller"===o.category_id?"#".concat(o.rank," in New Bestsellers"):"#".concat(o.rank," Rising in\n ").concat(o.category_name);return(0,n.BX)(n.HY,{children:[t&&(0,n.tZ)(eI.xv.B3,{color:"secondary",children:" • "}),(0,n.tZ)(eI.xv.B3,{color:"substack",children:(0,n.tZ)(ec.hh,{href:(0,tF.k5c)({categoryId:o.category_id,ranking:o.ranking,utm_source:"profile",focusedPubId:o.publication_id,backAction:(0,tt.NNq)(i)}),children:r})})]})}function t9(e){let{profile:t,yourProfile:i}=e;return i||!t.mutualsContext?(0,n.tZ)(t7,{profile:t}):(0,n.tZ)(ie,{profile:t})}let t7=e=>{let{profile:t}=e,i=(0,en.M$)().isOnDestination?(0,tR.Fh)(t,null,{noBase:!0}):"/profile/subscribers";return(0,n.tZ)(eI.xv.B3,{decoration:"hover-underline",color:"secondary",children:(0,n.tZ)(ec.hh,{href:i,state:{showBack:!0},showFocus:!0,animate:!0,children:t.subscriberCountString})})},ie=e=>{var t;let{profile:i}=e,{iPlural:o}=(0,ei.M1)(),r=(0,e9.XA)();if(!(null===(t=i.mutualsContext)||void 0===t?void 0:t.users))return(0,n.tZ)(t7,{profile:i});let l=i.mutualsContext.users.filter(e=>e.name),a=l.slice(0,2).map(e=>{var t;return null!==(t=e.name)&&void 0!==t?t:""}),s=Math.max(0,(i.subscriberCountNumber||0)-a.length),c="".concat((0,ti.numberToRoughShortString)(s)),u=o("other subscriber","other subscribers",s),p="".concat(c," ").concat(u);"subscribers"===i.mutualsContext.type&&s>0&&a.push(p);let h=eF.t.formatToParts(a);return(0,n.BX)(ew.hs,{gap:8,minWidth:0,alignItems:"center",children:[(0,n.tZ)(e_.H,{users:l,max:3,size:24,renderAvatar:e=>(0,n.tZ)(eb.xV,(0,d._)({},e))}),(0,n.tZ)(ec.hh,{href:(0,tR.Fh)(i,null,{noBase:!0}),state:{showBack:!0},decoration:"hover-underline",color:"secondary",children:r?(0,n.tZ)(eI.xv.B3,{minWidth:0,children:i.subscriberCountString}):(0,n.BX)(eI.xv.B3,{minWidth:0,children:["followers"===i.mutualsContext.type&&"Followed by ",h.map((e,t)=>(0,n.tZ)(eI.xv,{as:"span",children:e.value},t)),"subscribers"===i.mutualsContext.type&&0===s&&(0,n.BX)(eI.xv,{as:"span",children:[" ",o("subscribes","subscribe",l.length)]})]})})]})},it=e=>{var t,i,r;let{profile:l,subscribeButton:a,yourProfile:s,user:d,onShare:c,showCTAs:u}=e,{iString:p}=(0,ei.M1)(),h=(0,ee.CH)(l,{surface:"profile",onClick(e){(0,eh.j)(eh.FP.PROFILE_BLOCKED_MUTED_CHANGED,{action:e,target_user_id:l.id})}}),[m,g]=(0,o.eJ)(!1),[v,f]=(0,o.eJ)(!1),b=(0,eU.y)(),_=()=>{b((0,tt.NNq)(l))},y=(0,eL.s)({source:"profile"}),w=null==l?void 0:null===(t=l.publicationUsers)||void 0===t?void 0:t.find(e=>"admin"===e.role||"contributor"===e.role),k=w||(null==l?void 0:l.isPersonalEligible);return(0,n.BX)(ew.hs,{gap:8,direction:"row",justifyContent:"end",children:[(0,n.tZ)(eA.N,{isOpen:v,utmSource:"profile-page",onClose:()=>f(!1)}),!s&&(0,n.BX)(n.HY,{children:[a&&(0,n.tZ)(tq,{children:a}),u&&!a&&(0,n.tZ)(tq,{children:(0,n.tZ)(il,{profile:l})}),l.can_dm?(0,n.tZ)(tq,{children:(0,n.tZ)(ii,{profile:l})}):(null!==(r=null===(i=l.dm_upgrade_options)||void 0===i?void 0:i.length)&&void 0!==r?r:0)>0&&l.primaryPublication&&(0,n.tZ)(tq,{children:(0,n.tZ)(io,{profile:l,publication:l.primaryPublication})}),(0,n.BX)(ek.v2,{trigger:(0,n.tZ)(ey.hU,{rounded:!1,priority:"secondary",children:(0,n.tZ)(P.Z,{size:20})}),children:[(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(C.Z,{}),priority:"primary",onClick:_,children:"Copy link"}),(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(I.Z,{}),onClick:c,children:"Share"}),(0,n.BX)(ek.xw,{children:[l.can_dm&&(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(N.Z,{}),onClick:()=>y.handleStart([l.id]),children:"Send message"}),(0,n.tZ)(ir,{profile:l}),l.subscribesToViewerSubdomain&&(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(T.Z,{}),href:"".concat((0,tF.SVA)({subdomain:l.subscribesToViewerSubdomain}),"/publish/subscribers/legacy?userId=").concat(l.id),children:"Subscriber stats"})]}),(0,n.BX)(ek.xw,{children:[h,(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(Z.Z,{}),priority:"destructive",onClick:()=>g(!0),children:"Report"})]}),(null==d?void 0:d.is_global_admin)&&(0,n.tZ)(ek.xw,{children:(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(T.Z,{}),priority:"secondary",onClick:()=>window.location.href=(0,tt.SIi)(l.id),children:"Open in Underground"})})]}),(0,n.tZ)(Q.u,{canReportToAdmins:!1,isOpen:m,onClose:()=>g(!1),onSubmit:async e=>{let{reportCategory:t,details:i}=e;await U().post("/api/v1/users/".concat(l.id,"/profile/report")).send({details:i,reportCategory:t,surface:"profile"}),g(!1)},reasons:Q.M})]}),u&&s&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(tq,{children:l&&k?(0,n.tZ)(eH.QC,{profile:l,publicationUser:w}):l.profile_set_up_at?(0,n.tZ)(ey.zx,{onClick:()=>f(!0),children:"Share profile"}):(0,n.tZ)(ey.zx,{href:tj,localNavigation:!1,children:"Set up profile"})}),(0,n.tZ)(tq,{children:(0,n.tZ)(ey.zx,{priority:"secondary",href:(0,tt.qvS)(),children:p("Edit profile")})}),(0,n.BX)(ek.v2,{trigger:(0,n.tZ)(ey.hU,{rounded:!1,priority:"secondary",children:(0,n.tZ)(P.Z,{size:20})}),children:[(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(C.Z,{}),priority:"primary",onClick:_,children:"Copy link"}),(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(I.Z,{}),onClick:c,children:"Share"}),(0,n.tZ)(ek.xw,{children:(0,n.tZ)(eM.s,{user:d,profile:l})}),(null==d?void 0:d.is_global_admin)&&(0,n.tZ)(ek.xw,{children:(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(T.Z,{}),priority:"secondary",onClick:()=>window.location.href=(0,tt.SIi)(l.id),children:"Open in Underground"})})]})]})]})};function ii(e){let{profile:t}=e,{isLoading:i,handleStart:o}=(0,eL.s)({source:"profile"}),{iString:r}=(0,ei.M1)();return(0,n.tZ)(ey.zx,{priority:"secondary",onClick:()=>o([t.id]),disabled:i,children:r("Message")})}function io(e){let{profile:t,publication:i}=e,{iString:o,iTemplate:r}=(0,ei.M1)(),l=(0,el.aF)(),a=(0,tI.d)(),{dm_upgrade_options:s}=t,u=null==s?void 0:s.includes("free_subscribers"),p=null==s?void 0:s.includes("paid_subscribers");return(0,n.BX)(n.HY,{children:[(0,n.tZ)(ey.zx,{priority:"secondary",leading:(0,n.tZ)(E.Z,{size:20}),onClick:a.onOpen,children:o("Message")}),(0,n.tZ)(eC.u_,(0,c._)((0,d._)({},a),{width:360,children:(0,n.BX)(eX.F,{title:o(u?"Subscribers only":p?"Paid subscribers only":"Founding members only"),subtitle:r(u?tA():p?tD():tz(),t.name),onClose:a.onClose,children:[(0,n.tZ)(ey.zx,{priority:"primary",href:(0,tF.W1P)(i,{user:l,addBase:!0,params:{next:document.location.href,utm_source:"profile-dm",utm_medium:tU.lP.web,utm_campaign:tU.VX.substackProfile}}),children:o("Subscribe")}),(0,n.tZ)(ey.zx,{priority:"secondary",onClick:a.onClose,children:o("Cancel")})]})}))]})}function ir(e){let{profile:t}=e,{isFollowing:i,buttonProps:o}=(0,et.yr)(t,"profile");return(0,n.tZ)(ek.sN,(0,c._)((0,d._)({leading:i?(0,n.tZ)(L.Z,{}):(0,n.tZ)(X.Z,{})},o),{children:i?"Unfollow":"Follow"}))}function il(e){let{profile:t}=e,{isFollowing:i,buttonProps:o}=(0,et.yr)(t,"profile"),{iString:r}=(0,ei.M1)();return(0,n.tZ)(ey.zx,(0,c._)((0,d._)({priority:i?"secondary":"primary"},o),{children:r(i?"Following":t.followsViewer?"Follow back":"Follow")}))}function ia(e){let{subscriptions:t,profile:i}=e,o=(0,el.aF)(),r=i.id===(null==o?void 0:o.id);return 0===t.length?(0,n.tZ)(ew.hs,{paddingY:64,flex:"grow",children:r?i.hasHiddenPublicationUsers?(0,n.tZ)(eW._Y,{title:"All of your publications are hidden.",text:"Edit your profile to show others what you read.",action:(0,n.tZ)(ey.zx,{priority:"secondary",href:(0,tt.qvS)(),children:"Edit profile"})}):(0,n.tZ)(eW._Y,{title:"You haven’t subscribed to any publications yet.",text:"Visit Explore to find something to read.",action:(0,n.tZ)(ey.zx,{priority:"secondary",href:(0,tt._P8)(),children:"Explore"})}):(0,n.tZ)(eW._Y,{title:"".concat(i.name," doesn’t have any subscriptions to show."),text:"Visit Explore to find something to read.",action:(0,n.tZ)(ey.zx,{priority:"secondary",href:(0,tt._P8)(),children:"Explore"})})}):(0,n.tZ)(ew.tu,{flex:"fill",gap:{desktop:8,mobile:0},padding:8,children:t.map(e=>(0,n.tZ)(is,{subscription:e},e.id))})}function is(e){let{subscription:t}=e,i=t.is_founding?"founder":"subscribed"===t.membership_state?"subscribed":null,{publication:o}=t,{author:r}=o,l=(0,tN._F)({publication:o,subscriptionSource:tU.b3.profileSubscriptions}),a="profile"===o.homepage_type&&r&&r.handle?(0,tR.NJ)(r.handle):(0,tt.TJI)(o);return(0,n.BX)(ew.gq,{as:"a",href:a,gap:12,alignItems:"center",paddingY:8,paddingX:8,className:tO.Z.readsRow,minWidth:0,flex:"grow",children:[(0,n.tZ)(ex.wk,{pub:o,size:40,badgeType:i}),(0,n.BX)(ew.tu,{flex:"grow",minWidth:0,children:[(0,n.tZ)(eI.xv.B4,{ellipsis:!0,weight:"semibold",color:"primary",children:o.name}),r&&(0,n.BX)(eI.xv.B4,{ellipsis:!0,color:"secondary",children:["by ",r.name]})]}),l.isSubscribed?(0,n.tZ)(id,{onUnsubscribe:l.unsubscribe,publication:o,button:(0,n.tZ)(ey.zx,{priority:"secondary",size:"sm",children:"Subscribed"})}):(0,n.tZ)(ey.zx,{priority:"primary",size:"sm",onClick:l.subscribe,children:"Subscribe"})]})}function id(e){let{onUnsubscribe:t,publication:i,button:o}=e,r=(0,tB.N4)(),l=async()=>{!r.isConfirming&&await r.confirm()&&t()};return(0,n.BX)(n.HY,{children:[(0,n.tZ)(tB.sm,{modal:r,title:"Unsubscribe from ".concat(i.name,"?"),body:"You can resubscribe at any time.",cancelLabel:"Cancel",confirmLabel:"Unsubscribe"}),(0,n.BX)(ek.v2,{trigger:o,children:[(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(M.Z,{}),target:"_blank",href:(0,tt.mGw)(i,{addBase:!0}),children:"Manage subscription"}),(0,n.tZ)(ek.sN,{leading:(0,n.tZ)(R.Z,{}),onClick:l,priority:"destructive",children:"Unsubscribe"})]})]})}let ic=e=>{let{profile:t}=e;return(0,n.tZ)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:g()((0,tX.v_)(t),{json:!0,isScriptContext:!0})}})},iu=e=>{let{user:t,profile:i,primaryPublication:r,subscriptionSource:l}=e,{iString:a}=(0,ei.M1)(),s=(0,tS.x)({surface:"profile",zIndex:1001}),[d,c]=(0,o.eJ)(i.isSubscribed),u=(0,tN._F)({publication:r,subscriptionSource:"profile"}),{isLoading:p,subscribe:h}=(0,eu.G)({publication:r,profileId:i.id,source:l,onSuccess:()=>{c(!0)}}),m=(0,tF.W1P)(r,{user:t,addBase:!0,params:{next:document.location.href,utm_source:l,utm_medium:tU.lP.web,utm_campaign:tU.VX.substackProfile,just_signed_up:!0}}),g=(0,en.M$)().isOnDestination;return d?(0,n.tZ)(id,{publication:r,onUnsubscribe:()=>{u.unsubscribe(),c(!1)},button:(0,n.tZ)(ey.zx,{priority:"secondary",children:"Subscribed"})}):l===tH?t?(0,n.tZ)(ey.zx,{priority:"primary",onClick:e=>{e.preventDefault(),h()},disabled:p,children:a("Subscribe")}):(0,n.tZ)(ey.zx,{priority:"primary",onClick:s(r,i),children:a("Subscribe")}):(0,n.tZ)(ey.zx,{href:m,localNavigation:!1,onClick:()=>{(0,eh.j)(eh.FP.ACCOUNT_CARD_SUBSCRIBE_CLICKED,{homepage_type:r.homepage_type,is_on_destination:g}),(0,eh.x6)(r,"hover_profile")},title:r.name,children:a("Subscribe")})};function ip(e){let{profile:t,subscriptionSource:i}=e,{refetch:o,isLoading:r}=(0,eg.ib)({pathname:(0,tF.n1t)("/api/v1/@".concat(t.handle,"/personal-initialize"),{source:i}),method:"post"}),l=async()=>{let e=await o({query:{action:"subscribe"}});if(e instanceof Error)throw e;location.href=e.redirectUrl};return t.handle?(0,n.tZ)(ey.zx,{priority:"primary",onClick:l,localNavigation:!1,disabled:r,children:"Subscribe"}):null}let ih=["feed","feed-mentions","notes-inline-suggestions","notes-all-suggestions","notes-like-list","notes-restack-list","substack-feed-item"];function im(e){let{profile:t,activeLiveStream:r}=e,[l,a]=(0,o.eJ)(!1),s=(0,tt.SMH)(t),d=(0,e9.XA)(),[c,u]=(0,o.eJ)(!1),p=(0,tT.rG)();(0,o.d4)(()=>{if(null==r?void 0:r.liveStream.id)return null==p?void 0:p.listen({["live-stream:".concat(null==r?void 0:r.liveStream.id)]:e=>{var t;let{data:i}=e;(null==i?void 0:null===(t=i.message)||void 0===t?void 0:t.type)==="live-stream:ended"&&u(!0)}})},[p]);let h=(null==r?void 0:r.liveStream.id)&&"active"===r.liveStream.status&&(0,tL.Z)(r.liveStream.started_streaming_at).isBefore((0,tL.Z)().subtract(1,"minute"))&&!c;return(0,n.BX)(ew.hs,{style:{cursor:"pointer"},onClick:()=>{h?(0,ef.uX)((0,tF.bHR)({liveStreamId:r.liveStream.id,utm_source:tU.b3.profileAvatar,utm_campaign:tU.VX.substackProfile,params:{utm_medium:tU.lP.web}}),{local_navigation:!1}):a(!0)},tabIndex:0,showFocus:!0,animate:!0,radius:"full",position:"relative",children:[(0,n.tZ)(eb.qE,{size:d?56:88,user:t,className:h?tO.Z.liveStreamAvatar:void 0}),h?(0,n.tZ)(ew.hs,{className:tO.Z.liveBox,alignItems:"center",justifyContent:"center",children:(0,n.tZ)(eP.Vp,{className:tO.Z.liveTag,theme:"error",priority:"primary",children:"LIVE"})}):null,(0,n.tZ)(eD.cr,{module:"@/frontend/components/ImageViewerModal",resolve:e=>e.ImageViewerModal,onRequest:()=>Promise.resolve().then(i.bind(i,2563)),showModal:l,modalContent:[{attrs:{src:s}}],onClose:()=>{a(!1)},step:0,includeDownloadButton:!1})]})}function ig(e){let{postId:t,onClose:i}=e,r=(0,eO.B)(t),l=(0,eR.I0)(),a=(0,o.sO)(null),{posts:s,publications:d,publicationSettings:c,publicationRecommendations:u}=(0,eR.kc)(),p=s.get(t),h=(0,G.nA)({postId:t,isSaved:!!(null==p?void 0:p.is_saved),trackSurface:"post-viewer"}),m=p?d.get(p.publication_id):void 0,g=p?c.get(p.publication_id):void 0,v=m?u.get(m.id):void 0,f=v?d.get(v.recommending_publication_id):void 0;return(0,n.tZ)(tC.R5,{post:p,postId:t,videoPlayerRef:a,onClose:i,onLike:r,onSave:()=>{h.onSave(),l({type:"post_save",payload:{postId:t}})},onLoad:e=>{l({type:"post_load",payload:e})},publication:m,publicationSettings:g,referringRecommendation:v,referringPub:f})}var iv=i(40121);let ib=e=>{let{blurbs:t,freeSignup:i,freeSignupEmail:d,hide_intro_popup:c,notify_user:u,pub:p,referralCode:h,showWelcome:m,user:g,launchWelcomePage:v,skipIntoPopupRender:f,initialData:b,subpath:_}=e;if((0,o.d4)(()=>{u&&"undefined"!=typeof window&&(0,r.ZP)(u)},[u]),!p.theme)return null;let y=["subscribers","followers","following"].includes(_),Z="".concat(p.author_id,"-").concat((0,iv.Of)(p.author_name));return(0,n.BX)("div",{className:"home-page home-page--modular",children:[(0,n.tZ)(l.PageMetaData,{isHomepage:!0,pub:p}),(0,n.tZ)("div",{className:"profile-theme",children:b&&(0,n.BX)(n.HY,{children:[!y&&(0,n.tZ)(tW,{id:Z,initialData:b,subpath:_?"/".concat(_):"/"}),_&&y&&(0,n.tZ)(s.S,{id:Z,subpath:"/".concat(_)})]})}),f?null:(0,n.tZ)(a.L,{blurbs:t,freeSignup:i,freeSignupEmail:d,hide_intro_popup:c,launchWelcomePage:v,pub:p,referralCode:h,showWelcome:m,user:g})]})}},6207:function(e,t,i){i.d(t,{M:()=>p});var n=i(16584),o=i(94184),r=i.n(o),l=i(98422),a=i(19081),s=i(58175),d=i(6070),c=i(60308);let u={logo:"logo-Q8LqG3",pillarHeader:"pillarHeader-Q57NYM"},p=e=>{var t;let{description:i,logoUrl:o,name:p,pub:h}=e,{isMobile:m}=(0,l.v9)();return(0,n.BX)(a.tu,{gap:12,paddingX:8*!m,children:[o&&(0,n.tZ)("img",{alt:p,className:u.logo,src:(0,c.zF4)(o,144)}),(0,n.tZ)(s.xv.H1,{className:r()({[null!==(t=u.pillarHeader)&&void 0!==t?t:""]:(0,d.kb)({pub:h})}),color:"pub-primary-text",font:"pub-headings",children:p}),i&&(0,n.tZ)(s.xv.B3,{color:"pub-secondary-text",children:i})]})}},98422:function(e,t,i){i.d(t,{qU:()=>d,v9:()=>s});var n=i(30396),o=i(1852),r=i(80569),l=i.n(r),a=i(81821);let s=()=>{let e;let t=(0,a.tq)(),i=(0,o.useMediaQuery)({query:"only screen and (max-width: 1024px)"}),r=(0,o.useMediaQuery)({query:"only screen and (max-width: 768px)"}),l=(0,o.useMediaQuery)({query:"(orientation: landscape)"});return e="undefined"==typeof window?t?"mobile":"desktop":r?"mobile":i?"tablet":"desktop",(0,n.Ye)(()=>({breakpoint:e,isMobile:"mobile"===e,isMobileLandscape:t&&l,isTablet:"tablet"===e,isDesktop:"desktop"===e}),[e,l,t])},d=e=>{let{preloadedHomepageData:t,isPreview:i}=e,[o,r]=(0,n.eJ)(null);return(0,n.d4)(()=>{let e=async()=>{r((await l().get("/api/v1/homepage_data").query({preview:i})).body)};t||e()},[t,i]),null!=t?t:o}},60885:function(e,t,i){i.d(t,{DE:()=>a,QI:()=>s});var n=i(16584),o=i(6400),r=i(30396);let l=(0,o.createContext)({getPubPinInfo:()=>({showPin:!1}),getSectionPinInfo:()=>({showPin:!1})}),a=()=>(0,r.qp)(l),s=e=>{let{children:t,pub:i,showPubPins:o,showSectionPins:a}=e,s=(0,r.I4)(e=>{var t;let{post:n}=e;return{showPin:o&&!!(null===(t=n.pins)||void 0===t?void 0:t.includes(i.id))}},[i.id,o]),d=(0,r.I4)(e=>{let{post:t}=e;return{showPin:a&&t.is_section_pinned}},[a]);return(0,n.tZ)(l.Provider,{value:{getPubPinInfo:s,getSectionPinInfo:d},children:t})}},19680:function(e,t,i){i.d(t,{e:()=>d});var n=i(7409),o=i(99282),r=i(39693),l=i.n(r),a=i(7882),s=i(40121);let d=e=>{var t,i;let{author_id_or_slug:r,authorInfoPreload:d,postsPreload:c,pub:u}=e,p=!!(0,s.FQ)({slugOrId:r,pub:(0,o._)((0,n._)({},u),{authorPagesInfo:l()([d])})}),h=(0,a.ib)({pathname:"/w/".concat(r,"/info"),auto:!p,initialResult:p&&d&&c?{authorInfo:d,posts:c}:void 0,deps:[r]});return{authorInfo:null===(t=h.result)||void 0===t?void 0:t.authorInfo,posts:null===(i=h.result)||void 0===i?void 0:i.posts}}},18304:function(e,t,i){i.d(t,{Z:()=>h});var n=i(27412),o=i(16584),r=i(6400),l=i(80569),a=i.n(l),s=i(20253),d=i(98914),c=i(15771),u=i(98012),p=i(84864);class h extends r.Component{componentDidMount(){if(!this.hasInvites()){(0,d.gN)(this.props.pub);return}this.loadInvites()}hasInvites(){let{pub:e,user:t}=this.props;return!!e.invite_only&&(!!t&&!!t.is_contributor||!!(e.subscriber_invites>0)&&!!t&&!!t.is_subscribed)}async loadInvites(){try{let e=await a().get("/api/v1/publication/invite");this.setState({invites:e.body,loading:!1})}catch(e){console.error("Failed to fetch invites:",e),alert((0,d.zx)(e))}}render(e,t){let{pub:i,user:n}=e,{loading:r,invites:l}=t;if(!this.hasInvites())return(0,o.tZ)("p",{className:"main-loader",children:"Loading…"});let a=n&&n.is_contributor,d=Math.max(n&&n.invites,l.length),h=Math.max(d,i.subscriber_invites),m=h-d;return(0,o.tZ)("div",{className:"invite-page page",children:(0,o.BX)("div",{className:"container",children:[(0,o.tZ)("h3",{children:"Your invites"}),(0,o.BX)("p",{children:[i.name," is invite-only, but you’ve been granted"," ",a?"an infinite number of invites":(0,p.pluralize)(h,"invite")," to give out."]}),(m>0||a)&&[!a&&(0,o.BX)("h5",{children:["You have ",(0,p.pluralize)(m,"invite")," left"]}),(0,o.BX)(s.ZP,{ref:this.assignForm,action:"/api/v1/publication/invite",onSuccess:this.onSuccess,noInlineErrors:!0,children:[(0,o.BX)("div",{className:"sideBySideWrap",children:[(0,o.tZ)("input",{type:"text",name:"name",placeholder:"Name…"}),(0,o.tZ)("input",{type:"text",name:"email",placeholder:"Email…"}),(0,o.tZ)(c.zx,{priority:"primary",type:"submit",children:"Invite"})]}),(0,o.tZ)("div",{id:"error-container"})]})],r&&d>0?(0,o.BX)("p",{children:[(0,o.tZ)("br",{}),"Loading…"]}):l.length>0?[(0,o.tZ)("h5",{children:"Used invites"}),(0,o.tZ)("ul",{children:l.sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>(0,o.BX)("li",{children:[e.inviteeUser&&e.inviteeUser.name||""," on"," ",(0,u.Z)(e.created_at).standardDate()]}))})]:null]})})}constructor(...e){super(...e),(0,n._)(this,"form",void 0),(0,n._)(this,"assignForm",e=>{this.form=e}),(0,n._)(this,"state",{loading:!0,invites:[]}),(0,n._)(this,"onSuccess",async()=>{alert("Invite sent!"),document.location.reload()})}}},74562:function(e,t,i){i.d(t,{Z:()=>s});var n=i(16584),o=i(15771),r=i(19081),l=i(58175),a=i(60308);function s(e){let{pub:t,post:i}=e;return(0,n.BX)(r.tu,{alignItems:"center",className:"container",gap:32,children:[(0,n.BX)(r.tu,{alignItems:"center",gap:4,children:[(0,n.tZ)(r.tu,{paddingTop:24,paddingBottom:16,children:(0,n.BX)(l.xv.H1,{children:["You rejected your invite to ",t.name]})}),(0,n.tZ)(l.xv.B3,{children:"If you change your mind, you can accept from your email invitation."}),i.is_published?(0,n.BX)(l.xv.B3,{children:["Your byline has been removed from this post: ",(0,n.tZ)("a",{href:(0,a.uRy)(t,i),children:i.title})]}):null]}),(0,n.tZ)(o.zx,{href:t.base_url,children:"Go to ".concat(t.name)})]})}},22622:function(e,t,i){i.d(t,{Z:()=>c});var n=i(16584),o=i(30396),r=i(94499),l=i(42493),a=i(15771),s=i(19081),d=i(58175);function c(e){let{pub:t,user:i,post:c,freeSignup:u,freeSignupEmail:p}=e,h=(0,o.sO)(null);if(!c)return(0,n.tZ)(s.tu,{paddingTop:32,children:(0,n.BX)("div",{className:"container invite-success",children:[(0,n.BX)("p",{children:["You accepted your invite to ",t.name,"."]}),(0,n.tZ)("p",{children:"If you need admin access, ask your inviter to change your status in the publication settings."}),(0,n.BX)("p",{children:["If you expect to be shown on this publication's author list, make sure your"," ",(0,n.tZ)(r.Z,{onClick:()=>h.current&&h.current.open(),children:"profile is up to date"})]}),(0,n.tZ)(l.EB,{ref:h,user:i,freeSignup:u,freeSignupEmail:p,needsPhoto:!0})]})});let m="podcast"===c.type?"We’ll let you know when the podcast episode goes live":"We’ll let you know when your guest post is live";return(0,n.BX)(s.tu,{alignItems:"center",className:"container",gap:32,children:[(0,n.BX)(s.tu,{alignItems:"center",gap:4,children:[(0,n.tZ)(s.tu,{paddingTop:24,paddingBottom:16,children:(0,n.tZ)(d.xv.H1,{children:m})}),(0,n.tZ)(d.xv.B3,{children:"Your profile is set up and good to go!"})]}),(0,n.tZ)(a.zx,{href:t.base_url,children:"Go to ".concat(t.name)})]})}},47651:function(e,t,i){i.d(t,{A:()=>V});var n=i(7409),o=i(99282),r=i(58865),l=i(16584),a=i(30396),s=i(94184),d=i.n(s),c=i(32224),u=i(25380),p=i(46621),h=i(80569),m=i.n(h),g=i(39432),v=i(61781),f=i(98435),b=i(85685),_=i(96220),y=i(95441),Z=i(19081),w=i(58175),k=i(22838);function C(){let e=(0,r._)(["You're here!"]);return C=function(){return e},e}let S=e=>{let{isSelected:t,tier:i}=e,{iString:n,iTemplate:o,iPlural:r}=(0,y.M1)(),a={[k.E4.CompOneMonth]:n("1 month comp"),[k.E4.CompThreeMonths]:n("3 month comp"),[k.E4.CompSixMonths]:n("6 month comp"),[k.E4.CompNineMonths]:n("9 month comp"),[k.E4.CompTwelveMonths]:n("12 month comp"),[k.E4.Custom]:n("Custom")};return(0,l.BX)(Z.tu,{className:"rewardBox-wSCnji",border:"detail-themed",radius:"md",justifyContent:"space-between",alignItems:"center",flex:"grow",paddingTop:{desktop:20,mobile:20},paddingBottom:{desktop:8,mobile:8},paddingX:{desktop:8,mobile:8},sizing:"border-box",style:{borderColor:t?"var(--color-accent-themed)":void 0},children:[(0,l.tZ)(Z.gq,{gap:4,alignItems:"center",children:Array(i.display_order).fill(0).map(()=>(0,l.tZ)(_.Z,{size:20,fill:"var(--color-accent-themed)",stroke:"var(--color-accent-themed)"}))}),(0,l.tZ)(w.xv.H4,{weight:"bold",font:"pub-headings",color:"pub-primary-text",textAlign:"center",textWrap:"balance",children:"custom"===i.reward_type?i.reward_description:a[i.reward_type]}),(0,l.tZ)(w.xv.Meta,{weight:"semibold",style:{color:t?"var(--color-accent-themed)":void 0},children:t?o(C()):r("1 Referral","%1 Referrals",i.num_referrals_required)})]})};var x=i(68833),B=i(65205),P=i(7882),I=i(52384),N=i(98914),T=i(94874),E=i(71068),L=i(15771),X=i(10510),M=i(51776),R=i(70379),F=i(60308),U=i(26111),O=i(63651),A=i(47929);let D={wrapper:"wrapper-tJi0TK",headerWrapper:"headerWrapper-EjRfuK",copyLinkInput:"copyLinkInput-AiXniG",copyLinkButton:"copyLinkButton-K98yGk",shareButton:"shareButton-JVF5KK",referrerRow:"referrerRow-N5KSEa",referrerRowInverted:"referrerRowInverted-CeLqXo",referrerLink:"referrerLink-nE7Cs1",responsiveHeader:"responsiveHeader-yuaZkv",shareButtons:"shareButtons-xB8IiL"};function z(){let e=(0,r._)(["You’ve qualified for the Tier "," reward."]);return z=function(){return e},e}function j(){let e=(0,r._)(["Refer friends to ",""]);return j=function(){return e},e}function H(){let e=(0,r._)(["Subscribe and invite friends to ",""]);return H=function(){return e},e}function W(){let e=(0,r._)(["No referrers yet. Be the first on ","'s leaderboard by helping them find new readers."]);return W=function(){return e},e}let q=(e,t)=>{(0,x.j)(x.FP.SHARE_LINK_CLICKED,{name:t,source:"leaderboard"}),e&&(e.startsWith("http")?window.open(e,"_blank"):document.location.href=e)},Y=e=>{let{user:t,rank:i,referrals:n,isSelf:o,isHighlighted:r}=e,{iString:a}=(0,y.M1)();return(0,l.tZ)(w.xv,{as:t?"a":"div",href:t?(0,O.GR3)(t.id,t.name):void 0,className:D.referrerLink,children:(0,l.BX)(Z.gq,{sizing:"border-box",style:{width:"100%"},alignItems:"center",border:o||r?"detail-themed":"transparent",radius:"md",paddingLeft:12,paddingY:o?16:8,paddingRight:20,justifyContent:"space-between",className:d()(D.referrerRow,{[D.referrerRowInverted]:!o}),children:[(0,l.BX)(Z.gq,{gap:8,alignItems:"center",children:[(0,l.BX)(w.xv.Digit,{weight:"semibold",paddingRight:4,color:"pub-primary-text",children:[i,"."]}),t?(0,l.tZ)(b.ProfileHoverCard,{subject:t,dontStopPropagation:!1,children:(0,l.tZ)(T.qE,{size:36,user:t})}):(0,l.tZ)(T.qE,{size:36,showProfileHovercard:!1}),(0,l.tZ)(w.xv.B4,{color:"pub-primary-text",weight:"semibold",children:(null==t?void 0:t.name)||a("Anonymous Reader")})]}),(0,l.tZ)(w.xv.B4,{color:"pub-primary-text",weight:"semibold",children:n})]})})},V=e=>{let t,i,{pub:r,user:s,freeSignupEmail:d}=e,{iString:h,iTemplate:b,iPlural:_}=(0,y.M1)(),k=(0,R.pm)(),{result:C,isLoading:T,refetch:V}=(0,P.ib)({pathname:"/api/v1/reader_referrals/leaderboard",auto:!0}),{refetch:K}=(0,I.Q)({auto:!1,pathname:"/api/v1/subscription/visibilities",method:"post"});if((0,a.d4)(()=>{T||C||(0,N.uX)((0,O.SVA)(r))},[C,T,r]),T||!C)return(0,l.tZ)("div",{className:"page typography signup-page",children:(0,l.tZ)("div",{className:"container"})});let{current_user_stats:J,tiers:G,top_referrers:Q,current_user_can_share:$,current_user_id:ee,current_user_profile_hidden:et}=C,ei=null==s?void 0:s.is_admin,en=null==s?void 0:s.is_contributor,eo=(0,U.x)("referrer_token"),er=s&&!s.is_magic&&s.email||d||null,el=(0,O.n1t)((0,O.SVA)(r),{r:(null==ee?void 0:ee.toString(36))||eo});G.find((e,n)=>{let o=(null==J?void 0:J.referrals)||0,r=G[n+1];o>=e.num_referrals_required&&(!r||o{let t;e.preventDefault();try{er&&(t=(await m().post("/api/v1/free").send({source:"referral-leaderboard",email:er,first_url:B.xY,first_referrer:B.ip,current_url:B.UE,current_referrer:B.xU,first_session_url:B.ac,first_session_referrer:B.qR})).body.referral_token,(0,x.IU)())}catch(e){(0,x.j)(x.FP.FREE_SIGNUP_FAILED,{reason:e.message,source:"referral-leaderboard"})}window.location.href=(0,O.W1P)(r,{addBase:!0,params:{simple:!0,next:document.location.href,utm_source:A.b3.referralLeaderboard,utm_medium:A.lP.web,skip_redirect_check:!0,just_signed_up:!0,referral_token:t}})},href:(0,O.n1t)("/subscribe",{next:(0,O.j8T)(r,void 0,{addBase:!0}),utm_source:A.b3.referralLeaderboard}),localNavigation:!1,children:(0,l.BX)(Z.gq,{alignItems:"center",gap:8,children:[(0,l.tZ)(c.Z,{size:20}),h("Subscribe")]})})})]})}),($||en||ei||eo)&&(0,l.BX)(Z.tu,{alignItems:"center",gap:16,style:{width:"100%"},children:[(0,l.BX)(Z.gq,{style:{width:"100%"},children:[(0,l.tZ)(M.oi,{className:D.copyLinkInput,flex:"grow",readOnly:!0,value:el}),(0,l.tZ)(L.zx,{className:D.copyLinkButton,priority:"primary",onClick:()=>{(0,x.j)(x.FP.SHARE_LINK_CLICKED,{name:"copy",source:"leaderboard"}),(0,N.vQ)(el),k.popToast(e=>(0,l.tZ)(R.FN,(0,o._)((0,n._)({},e),{Icon:u.Z,text:h("Copied link to clipboard")})))},children:h("Copy link")})]}),(0,l.BX)(Z.hs,{className:D.shareButtons,gap:{desktop:16,mobile:8},style:{width:"100%"},children:[(0,l.tZ)(L.zx,{className:D.shareButton,priority:"secondary",leading:(0,l.tZ)(f.Z,{width:18,height:18,style:{paddingTop:2}}),onClick:()=>q((0,F.LaP)({url:el,text:r.name}),"twitter"),children:"Twitter"}),(0,l.tZ)(L.zx,{className:D.shareButton,priority:"secondary",leading:(0,l.tZ)(v.Z,{height:20,width:20}),onClick:()=>q((0,O.n1t)("https://www.facebook.com/sharer/sharer.php",{u:el}),"facebook"),children:"Facebook"}),(0,l.tZ)(L.zx,{className:D.shareButton,priority:"secondary",leading:(0,l.tZ)(g.Z,{strokeWidth:1,height:20,width:20,style:{paddingTop:2}}),onClick:()=>q((0,O.n1t)("mailto:",{subject:r.name,body:el}),"email"),children:"Email"})]})]}),(0,l.BX)(Z.tu,{alignItems:"start",style:{width:"100%"},gap:16,children:[(0,l.tZ)(w.xv.H3,{translated:!0,font:"pub-headings",color:"pub-primary-text",children:"Rewards and Progress"}),(0,l.tZ)(Z.gq,{gap:{desktop:16,mobile:12},style:{width:"100%"},children:G.map(e=>(0,l.tZ)(S,{tier:e,isSelected:e.display_order===(null==t?void 0:t.display_order)},e.display_order))}),$&&J&&(0,l.BX)(Z.tu,{gap:8,style:{width:"100%"},alignItems:"center",children:[(0,l.tZ)(Y,{user:s,isSelf:!0,referrals:J.referrals,rank:J.rank}),!et&&(0,l.tZ)(w.xv.B4,{color:"pub-secondary-text",children:ea}),et&&(0,l.BX)(Z.gq,{sizing:"border-box",style:{width:"100%"},alignItems:"center",border:"detail-themed",radius:"md",paddingX:12,paddingY:16,justifyContent:"space-between",bg:"secondary",gap:32,children:[(0,l.BX)(Z.tu,{gap:4,children:[(0,l.tZ)(w.xv.B4,{translated:!0,weight:"semibold",color:"pub-primary-text",children:"Your subscription is private"}),(0,l.BX)(w.xv.B4,{translated:!0,color:"pub-secondary-text",children:["To appear on the leaderboard, turn on visibility for ",I18N.p(r.name)]})]}),(0,l.tZ)(L.zx,{priority:"primary",onClick:async()=>{await K({body:{ids:[C.current_user_subscription_id],visibility:"public"}}),V(),k.popToast(e=>(0,l.tZ)(R.FN,(0,o._)((0,n._)({},e),{text:"".concat(r.name," is now visible on your profile!")})))},children:h("Show on profile")})]})]})]}),(0,l.BX)(Z.tu,{alignItems:"start",style:{width:"100%"},gap:16,children:[(0,l.tZ)(w.xv.H3,{translated:!0,font:"pub-headings",color:"pub-primary-text",children:"Leaderboard"}),(null==Q?void 0:Q.length)===0&&(0,l.BX)(Z.tu,{alignItems:"center",justifyContent:"center",paddingX:48,sizing:"border-box",style:{width:"100%",minHeight:350},gap:4,border:"detail-themed",radius:"md",children:[(0,l.tZ)(p.Z,{size:22,stroke:"var(--color-secondary-themed)"}),(0,l.tZ)(w.xv.B4,{color:"pub-secondary-text",children:b(W(),r.name)})]}),(null==Q?void 0:Q.length)>0&&(0,l.BX)(Z.tu,{gap:8,style:{width:"100%"},children:[(0,l.BX)(Z.gq,{alignItems:"center",style:{width:"100%"},justifyContent:"space-between",paddingBottom:2,children:[(0,l.tZ)(w.xv.Meta,{translated:!0,weight:"semibold",children:"Referrer"}),(0,l.tZ)(w.xv.Meta,{translated:!0,weight:"semibold",children:"Referrals"})]}),null==Q?void 0:Q.map(e=>(0,l.tZ)(Y,{user:e.user,isHighlighted:e.isCurrentUser,rank:e.rank,referrals:e.referrals},e.rank))]})]})]})})})}},32590:function(e,t,i){i.d(t,{P:()=>c});var n=i(16584),o=i(71375),r=i(98914),l=i(15771),a=i(60308),s=i(26111),d=i(77686);let c=e=>{let{pub:t}=e;return(0,n.tZ)(l.hU,{onClick:()=>{let e=(0,s.x)("referrer"),i=null!=e?e:(0,a.TJI)(t);(0,r.uX)(i,{local_navigation:!1})},className:d.Z.closeButton,size:"sm",priority:"secondary-outline",children:(0,n.tZ)(o.Z,{size:20})})}},19139:function(e,t,i){i.d(t,{G:()=>d});var n=i(16584),o=i(49762),r=i(94874),l=i(19081),a=i(10510),s=i(77686);let d=e=>{let{pub:t,user_id:i,user_profile_photo_url:d,children:c}=e;return(0,o.getConfigFor)("meetings_embed_publication_name")?(0,n.BX)(l.tu,{gap:20,alignItems:"center",paddingTop:32,children:[(0,n.tZ)(a.wk,{className:s.Z.pubLogo,pub:t,size:112}),c]}):(0,n.BX)(l.tu,{gap:20,alignItems:"center",paddingTop:32,children:[(0,n.BX)("div",{className:s.Z.avatarWithPubLogo,children:[(0,n.tZ)(r.qE,{className:s.Z.avatar,user:{id:i,photo_url:d},size:112}),(t.logo_url||t.cover_photo_url)&&(0,n.tZ)(a.wk,{className:s.Z.pubAvatar,pub:t,size:40})]}),c]})}},97698:function(e,t,i){i.d(t,{N:()=>K});var n=i(7409),o=i(98848),r=i(16584),l=i(30396),a=i(49762),s=i(98914),d=i(19139),c=i(99282),u=i(99869),p=i(45609),h=i(15771),m=i(19081),g=i(58175),v=i(70379),f=i(98012),b=i(63651),_=i(84864);let y={meetingDetails:"meetingDetails-vrQSc_"},Z=(e,t,i)=>{var n,o,r,l,a,s,d,c,u,p,h,m,g,v,f,y,Z,w,k,C,S,x,B,P,I,N,T,E,L,X,M,R,F;return(null===(n=e.location)||void 0===n?void 0:n.location)||(null===(o=e.location)||void 0===o?void 0:o.join_url)?({zoom:{href:null===(r=e.location)||void 0===r?void 0:r.join_url,copyContent:null===(l=e.location)||void 0===l?void 0:l.join_url,label:"Join Zoom"},zoom_conference:{href:null===(a=e.location)||void 0===a?void 0:a.join_url,copyContent:null===(s=e.location)||void 0===s?void 0:s.join_url,label:"Join Zoom"},google:{href:null===(d=e.location)||void 0===d?void 0:d.join_url,copyContent:null===(c=e.location)||void 0===c?void 0:c.join_url,label:"Join Meet"},google_conference:{href:null===(u=e.location)||void 0===u?void 0:u.join_url,copyContent:null===(p=e.location)||void 0===p?void 0:p.join_url,label:"Join Meet"},inbound_call:{href:"tel:".concat(null===(h=e.location)||void 0===h?void 0:h.location),copyContent:null===(m=e.location)||void 0===m?void 0:m.location,label:null===(g=e.location)||void 0===g?void 0:g.location},outbound_call:{href:null,label:"".concat((0,_.guessFirstName)(e.user_name)," will call you at ").concat(null===(v=e.location)||void 0===v?void 0:v.location)},microsoft_teams:{href:null===(f=e.location)||void 0===f?void 0:f.join_url,copyContent:null===(y=e.location)||void 0===y?void 0:y.join_url,label:"Join Teams"},microsoft_teams_conference:{href:null===(Z=e.location)||void 0===Z?void 0:Z.join_url,copyContent:null===(w=e.location)||void 0===w?void 0:w.join_url,label:"Join Teams"},webex:{href:null===(k=e.location)||void 0===k?void 0:k.join_url,copyContent:null===(C=e.location)||void 0===C?void 0:C.join_url,label:"Join Webex"},webex_conference:{href:null===(S=e.location)||void 0===S?void 0:S.join_url,copyContent:null===(x=e.location)||void 0===x?void 0:x.join_url,label:"Join Webex"},gotomeeting:{href:null===(B=e.location)||void 0===B?void 0:B.join_url,copyContent:null===(P=e.location)||void 0===P?void 0:P.join_url,label:"Join GoToMeeting"},gotomeeting_conference:{href:null===(I=e.location)||void 0===I?void 0:I.join_url,copyContent:null===(N=e.location)||void 0===N?void 0:N.join_url,label:"Join GoToMeeting"},physical:{href:null,label:null!==(M=null===(T=e.location)||void 0===T?void 0:T.location)&&void 0!==M?M:"Unknown"},ask_invitee:{href:null,label:null!==(R=null===(E=e.location)||void 0===E?void 0:E.location)&&void 0!==R?R:"Unknown"},custom:{href:null,label:null!==(F=null===(L=e.location)||void 0===L?void 0:L.location)&&void 0!==F?F:"Unknown"}})[null===(X=e.location)||void 0===X?void 0:X.type]||{}:t&&i?{href:(0,b.h7c)(i,e.id,{addBase:!0}),label:"View here"}:{href:null,label:"Processing..."}},w=e=>{let{order:t,isStatic:i=!1,pub:o=null}=e,l=(0,v.pm)(),{href:a,label:d,copyContent:f}=Z(t,i,o),b=(0,r.tZ)(g.xv.B3,{align:"right",children:a?(0,r.tZ)("a",{href:a,children:d}):d});return i||!f?b:(0,r.BX)(m.gq,{gap:4,alignItems:"center",children:[b,(0,r.tZ)(h.hU,{size:"sm",onClick:()=>{(0,s.vQ)(f),l.popToast(e=>(0,r.tZ)(v.FN,(0,c._)((0,n._)({},e),{Icon:u.Z,text:"Copied link to clipboard"})))},children:(0,r.tZ)(p.Z,{height:20})})]})},k=e=>{var t,i;let{order:n,pub:o}=e,l=(0,f.Z)(null!==(t=n.start_time)&&void 0!==t?t:void 0),a=(0,f.Z)(null!==(i=n.end_time)&&void 0!==i?i:void 0),s="".concat(l.format("MMMM D, YYYY")," at ").concat(l.format("h:mm A z")),d=a.diff(l,"minute");return(0,r.BX)(m.tu,{gap:8,className:y.meetingDetails,children:[(0,r.BX)(m.gq,{justifyContent:"space-between",gap:8,children:[(0,r.tZ)(g.xv.B3,{weight:"bold",children:"Time"}),(0,r.tZ)(g.xv.B3,{children:s})]}),(0,r.BX)(m.gq,{justifyContent:"space-between",gap:8,children:[(0,r.tZ)(g.xv.B3,{weight:"bold",children:"Length"}),(0,r.BX)(g.xv.B3,{children:[d," minutes"]})]}),(0,r.BX)(m.gq,{justifyContent:"space-between",alignItems:"center",gap:8,children:[(0,r.tZ)(g.xv.B3,{weight:"bold",children:"Location"}),(0,r.tZ)(w,{order:n,pub:o})]}),(0,r.tZ)(g.xv.B3,{align:"center",className:y.description,paddingTop:16,children:(0,r.tZ)("i",{children:n.description})})]})};var C=i(60308),S=i(26111);let x=e=>{let{booking:t,settings:i,pub:n}=e,o=(0,a.getConfigFor)("meetings_embed_publication_name")?n.name:t.user_name;return t.cancelled_at?(0,r.BX)(r.HY,{children:[(0,r.tZ)(d.G,{pub:n,user_id:i.user_id,user_profile_photo_url:i.user_profile_photo_url,children:(0,r.BX)(g.xv.H2,{align:"center",children:["Your meeting with ",o," has been cancelled"]})}),t.cancellation_reason&&(0,r.BX)(r.HY,{children:[(0,r.tZ)(g.xv.B3,{align:"center",paddingBottom:16,children:"The author provided the following reason:"}),(0,r.tZ)(g.xv.B4,{align:"center",paddingBottom:32,children:t.cancellation_reason})]}),t.refunded_at&&(0,r.tZ)(g.xv.B3,{align:"center",children:"A refund has been issued to your original form of payment."}),i.enabled&&(0,r.tZ)(g.xv.B3,{align:"center",paddingBottom:16,children:(0,r.BX)(r.HY,{children:["You can book another meeting"," ",(0,r.tZ)("a",{href:(0,b.szv)(n,{params:{source:"cancellation-rebook"}}),children:"here"}),"."]})})]}):(0,r.BX)(r.HY,{children:[(0,r.tZ)(d.G,{pub:n,user_id:i.user_id,user_profile_photo_url:i.user_profile_photo_url,children:(0,r.BX)(g.xv.H2,{align:"center",children:["Your meeting with ",o," has been ",t.num_rebookings>0?"rebooked":"booked"]})}),(0,r.BX)(m.tu,{gap:16,alignItems:"center",children:[(0,r.tZ)(k,{order:t,pub:n}),(0,r.tZ)(g.xv.B4,{align:"center",children:"A confirmation of your booking has been emailed to you."}),t.refunded_at&&(0,r.tZ)(g.xv.B4,{align:"center",children:"A refund has been issued to your original form of payment."}),(0,r.tZ)(h.zx,{onClick:()=>{let e=(0,S.x)("referrer"),t=null!=e?e:(0,C.TJI)(n);(0,s.uX)(t,{local_navigation:!1})},children:"Done"})]})]})};var B=i(78718),P=i.n(B),I=i(71375),N=i(80569),T=i.n(N),E=i(20253),L=i(71978),X=i(68833),M=i(55014),R=i(38023),F=i(51776),U=i(87077),O=i(73229),A=i(37313);let D={button:"button-qJPITd",tos:"tos-KUjQ2h",input:"input-FRaHpS",originalPrice:"originalPrice-OtRI61",filePicker:"filePicker-sGpV6W",fileAttachment:"fileAttachment-fKUmWJ",fileName:"fileName-yGqqsU",fileRemoveIcon:"fileRemoveIcon-fRmA6k",savedCard:"savedCard-bAi8SY",cardOnFileIcon:"cardOnFileIcon-CDsU3Y",errorContainer:"errorContainer-TdnCG0",errorTooltip:"errorTooltip-k9_jmH",checkoutBox:"checkoutBox-B3gOs5"},z=e=>{let{stripe_publishable_key:t,onComplete:i,user:n,pub:o,booking:s,settings:c}=e,[u,p]=(0,l.eJ)(s.name),[v,f]=(0,l.eJ)(s.description),[b,y]=(0,l.eJ)(null),[Z,w]=(0,l.eJ)(null),[k,C]=(0,l.eJ)(null),[S,x]=(0,l.eJ)(null),[B,N]=(0,l.eJ)(!1),[z,j]=(0,l.eJ)(null);(0,l.d4)(()=>{let e=(0,E.lQ)(t,o),i=e&&(0,E.UD)(e);w(e),C(i)},[o,t,w,C]),(0,l.d4)(()=>{(0,X.j)(A.F.MEETING_ORDER_PAGE_VIEWED,{user_id:n.id,publication_id:o.id})},[]),(0,l.d4)(()=>{(async()=>{var e;let t=await T().get("/api/v1/subscription/last4");(null===(e=t.body)||void 0===e?void 0:e.last4)&&x(t.body.last4)})()},[o]);let{price:H,duration:W,subscriber_price:q,founding_price:Y,currency:V}=c.selected_event_type,K=H;n.is_subscribed&&q&&(K=q),n.is_founding&&Y&&(K=Y);let J=!!(null==n?void 0:n.has_saved_payment),G=(0,l.I4)(async()=>k?Z?await Z.createToken(k):{token:null,error:{message:""}}:(console.error("stripeCard is null, cannot createToken"),{token:null,error:{message:"Internal error"}}),[Z,k]),Q=(0,l.I4)(async()=>{let e;if(N(!0),j(null),!J){let{token:t,error:i}=await G();if(i){N(!1),j(i&&i.message),(0,X.j)(A.F.MEETING_MISSING_PAYMENT,{type:i&&"type"in i&&i.type,code:i&&"code"in i&&i.code,decline_code:i&&"decline_code"in i&&i.decline_code,reason:i&&i.message});return}e=t}let t=new FormData;t.append("name",u),t.append("description",v),e&&t.append("stripe_token",JSON.stringify(e)),b&&t.append("attachment",b);let r=Intl.DateTimeFormat().resolvedOptions().timeZone;r&&t.append("timezone",r),(0,X.j)(A.F.MEETING_SUBMIT_PRESSED,{publication_id:o.id,user_id:n.id});try{let e=await T().post("/api/v1/meetings/book").send(t);history.pushState({},"","/meetings/book/".concat(e.body.order_id)),i("schedule",P()(e.body,["order_id","calendly_scheduling_uri","name","email","description"]))}catch(e){var l,a,s,d;(null===(a=e.response)||void 0===a?void 0:null===(l=a.body)||void 0===l?void 0:l.error)?j(null===(d=e.response)||void 0===d?void 0:null===(s=d.body)||void 0===s?void 0:s.error):j("Something went wrong.")}N(!1)},[u,v,G,b,N,j]),$=!!u&&!!v;return(0,r.BX)(r.HY,{children:[(0,r.tZ)(d.G,{pub:o,user_id:c.user_id,user_profile_photo_url:c.user_profile_photo_url,children:(0,r.BX)("div",{children:[(0,r.tZ)(g.xv.H2,{align:"center",size:20,children:"Book a meeting with"}),(0,r.tZ)(g.xv.H2,{align:"center",paddingTop:4,children:(0,a.getConfigFor)("meetings_embed_publication_name")?o.name:c.user_name}),(0,r.BX)(g.xv.B3,{align:"center",paddingTop:8,children:[Kp(e.currentTarget.value),placeholder:"Name...",disabled:B,maxLength:500})}),(0,r.tZ)(O.B,{alignment:"vertical",label:"What do you want to talk about?",children:(0,r.tZ)(R.g,{name:"description",value:v,onChange:e=>f(e.target.value),rows:4,maxLength:1e3,placeholder:"E.g. I’m really interested in knowing...",disabled:B})}),b?(0,r.BX)("div",{children:[(0,r.tZ)(g.xv.B4,{weight:"semibold",paddingBottom:8,children:"Add an attachment (optional)"}),(0,r.BX)(m.gq,{className:D.fileAttachment,gap:8,alignItems:"center",flex:"auto",children:[(0,r.tZ)(I.Z,{onClick:()=>y(null),className:D.fileRemoveIcon,height:24}),(0,r.tZ)(g.xv.B3,{className:D.fileName,children:b.name})]})]}):(0,r.BX)("div",{children:[(0,r.tZ)(g.xv.B4,{weight:"semibold",paddingBottom:8,children:"Add an attachment (optional)"}),(0,r.tZ)(M.G,{className:D.filePicker,onFileSelected:e=>y(e),acceptableTypes:".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/pdf, image/*, audio/*, video/*, .pdf, .xls, .xlsx"})]}),(0,r.BX)("div",{className:D.checkoutBox,children:[J&&(0,r.BX)(m.gq,{className:D.savedCard,padding:12,gap:12,children:[(0,r.tZ)(L.Z,{className:D.cardOnFileIcon}),(0,r.tZ)(g.xv.B4,{children:S?"**** **** **** ".concat(S):"Use card on file"})]}),!J&&k&&(0,r.tZ)(E.GP,{className:D.input,element:k}),z&&(0,r.tZ)(g.xv.B4,{paddingTop:12,className:D.errorContainer,children:z}),(0,r.tZ)(m.hs,{paddingTop:12,children:(0,r.tZ)(U.u,{text:c.enabled?"You must provide your name and a topic for the meeting before booking.":"You must enable Meetings before one can be booked.",disabled:B||$&&c.enabled,preferPlacement:"top-center",className:D.errorTooltip,children:(0,r.tZ)(h.zx,{className:D.button,flex:"grow",type:"submit",onClick:Q,disabled:B||!$||!c.enabled,children:B?"Loading...":"Book meeting"})})})]})]}),(0,r.BX)(g.xv,{className:D.tos,paddingBottom:16,size:14,align:"center",color:"secondary",children:["By booking, you will be automatically signed up for a free subscription to ",o.name,". Additionally, you agree to Substack's"," ",(0,r.tZ)("a",{href:"https://substack.com/tos",target:"__blank",children:"Terms of Service"}),", our"," ",(0,r.tZ)("a",{href:"https://substack.com/privacy",target:"__blank",children:"Privacy Policy"}),", and our"," ",(0,r.tZ)("a",{href:"https://substack.com/ccpa#personal-data-collected",target:"__blank",children:"Information Collection Notice"}),"."]})]})};var j=i(20761),H=i(1852),W=i(98248);let q=e=>{let{booking:t,onComplete:i,settings:n,pub:o}=e,[s,c]=(0,l.eJ)(!1),[u,p]=(0,l.eJ)(!1),{duration:h}=n.selected_event_type,v=(0,a.getConfigFor)("meetings_embed_publication_name")?o.name:t.user_name,f=(0,H.useMediaQuery)({maxWidth:698});return((0,j.pv)({onEventScheduled:async e=>{var n,o,r;let l=null===(r=e.data)||void 0===r?void 0:null===(o=r.payload)||void 0===o?void 0:null===(n=o.event)||void 0===n?void 0:n.uri;c(!0);try{let e=await T().put("/api/v1/meetings/order/".concat(t.order_id)).send({calendly_event_uri:l});await new Promise(e=>setTimeout(e,2e3)),i("confirmation",e.body)}catch(e){p(!0)}}}),u)?(0,r.tZ)(d.G,{pub:o,user_id:n.user_id,user_profile_photo_url:n.user_profile_photo_url,children:(0,r.tZ)(g.xv.H2,{align:"center",children:"Something went wrong with your booking. Please contact meetings@substackinc.com."})}):s?(0,r.tZ)(m.hs,{justifyContent:"center",children:(0,r.tZ)(W.$j,{})}):(0,r.BX)(r.HY,{children:[(0,r.tZ)(d.G,{pub:o,user_id:n.user_id,user_profile_photo_url:n.user_profile_photo_url,children:(0,r.BX)("div",{children:[(0,r.BX)(g.xv.H2,{align:"center",children:[t.num_rebookings>0?"Rebook":"Book"," your meeting with ",v]}),(0,r.BX)(g.xv.B3,{align:"center",paddingTop:8,children:["Schedule your ",h,"-minute meeting"]})]})}),"undefined"!=typeof window&&t.calendly_scheduling_uri&&(0,r.tZ)(j.KS,{iframeTitle:"calendly",url:"".concat(t.calendly_scheduling_uri,"?hide_gdpr_banner=1"),prefill:{name:t.name||"",email:t.email,customAnswers:{a1:t.description}},styles:{minWidth:"320px",height:"700px",marginTop:f?"0px":"-66px"}})]})};var Y=i(32590);let V=e=>{var{step:t}=e,i=(0,o._)(e,["step"]);switch(t){case"order":return(0,r.tZ)(z,(0,n._)({},i));case"schedule":return(0,r.tZ)(q,(0,n._)({},i));case"confirmation":return(0,r.tZ)(x,(0,n._)({},i))}},K=e=>{let{stripe_publishable_key:t,pub:i,user:o,order:a,order_id:s,settings:d}=e,c=s?a.calendly_scheduling_uri?"schedule":"confirmation":"order",[u,p]=(0,l.eJ)(c),[h,g]=(0,l.eJ)((0,n._)({name:o.name,email:o.email,description:""},a)),v=V({step:u,booking:h,settings:d,order:a,onComplete:(e,t)=>{g((0,n._)({},h,t)),p(e)},pub:i,stripe_publishable_key:t,user:o,orderId:s});return(0,r.BX)(r.HY,{children:[(0,r.tZ)(Y.P,{pub:i}),(0,r.tZ)(m.hs,{style:{minHeight:"100vh"},bg:"secondary",alignItems:"center",justifyContent:"center",children:(0,r.tZ)(m.tu,{paddingX:24,gap:32,style:{width:"schedule"===u?"100%":450,maxWidth:"100%",boxSizing:"border-box"},children:v})})]})}},84632:function(e,t,i){i.d(t,{T:()=>Z});var n=i(16584),o=i(30396),r=i(94184),l=i.n(r),a=i(55065),s=i(17181),d=i(68833),c=i(49762),u=i(32590),p=i(19139),h=i(15771),m=i(19081),g=i(58175),v=i(24791),f=i(60308),b=i(26111),_=i(84864),y=i(77686);let Z=e=>{var t,i,r,Z;let{pub:w,user:k,settings:C}=e,{selected_event_type:{price:S,subscriber_price:x,founding_price:B,currency:P,description_html:I,duration:N,num_availabilities:T},user_name:E}=C,L=S,X=null;null!==(i=null===(t=w.plans)||void 0===t?void 0:t.length)&&void 0!==i&&i&&((null==k?void 0:k.is_subscribed)&&x&&(L=x,X="SUBSCRIBER DISCOUNT"),(null==k?void 0:k.is_founding)&&B&&(L=B,X="".concat(null===(r=(0,v.H$)(w)||"FOUNDING")||void 0===r?void 0:r.toUpperCase()," DISCOUNT"))),(0,o.d4)(()=>{var e,t;(0,d.j)(d.FP.MEETING_PAGE_VIEWED,{publication_id:w.id,user_id:k.id,referrer:null!==(e=(0,b.x)("referrer"))&&void 0!==e?e:null,source:null!==(t=(0,b.x)("source"))&&void 0!==t?t:null})},[]);let M=null!==(Z=(0,b.x)("referrer"))&&void 0!==Z?Z:void 0,R=(0,f.rhs)("/meetings/book",{referrer:M}),F=T>0,U=I?{__html:I.replace(/
/g,"")}:{__html:""};return(0,n.BX)(n.HY,{children:[(0,n.tZ)(u.P,{pub:w}),(0,n.tZ)(m.tu,{style:{minHeight:"100vh"},bg:"secondary",alignItems:"center",justifyContent:"center",children:(0,n.BX)(m.tu,{paddingX:24,gap:32,style:{width:400,maxWidth:"100%",boxSizing:"border-box"},children:[(0,n.tZ)(p.G,{pub:w,user_id:C.user_id,user_profile_photo_url:C.user_profile_photo_url,children:(0,n.BX)("div",{children:[(0,n.tZ)(g.xv.H2,{align:"center",size:20,children:"Book a meeting with"}),(0,n.tZ)(g.xv.H2,{align:"center",paddingTop:4,children:(0,c.getConfigFor)("meetings_embed_publication_name")?w.name:E})]})}),(0,n.BX)(m.tu,{bg:"primary",className:l()(y.Z.offer,{[y.Z.unavailable]:!F}),radius:"md",shadow:"xl",padding:20,children:[X&&(0,n.tZ)("div",{className:y.Z.displayedBadge,children:X}),(0,n.BX)(m.gq,{justifyContent:"space-between",paddingBottom:16,children:[(0,n.tZ)(m.tu,{children:L&&P&&N&&(0,n.BX)(n.HY,{children:[(0,n.BX)(g.xv.H3,{color:F?"primary":"secondary",children:[N,"-minute meeting"]}),(0,n.BX)(g.xv.B4,{color:F?"primary":"secondary",paddingTop:4,children:[L50?"Many availabilities":"".concat((0,_.pluralize)(T,"slot")," available this month"):"No slots available in the next week"]})]})}),F?(0,n.tZ)(a.Z,{className:y.Z.check,size:28}):(0,n.tZ)(s.Z,{size:28,className:y.Z.disabledCheck})]}),(0,n.tZ)(g.xv.B4,{color:"secondary",children:(0,n.tZ)("div",{className:y.Z.description,dangerouslySetInnerHTML:U})})]}),(0,n.tZ)(h.zx,{className:y.Z.button,disabled:!F,flex:"grow",localNavigation:!1,href:R,children:F?"Continue to book":"No meetings available"})]})})]})}},89082:function(e,t,i){i.d(t,{A:()=>l});var n=i(16584),o=i(32351),r=i(60308);let l=e=>{let{subdomain:t}=e;return(0,n.BX)("div",{className:"page typography signup-page",path:"/not-found",children:[(0,n.tZ)(o.Metadata,{title:"Not Found"}),(0,n.BX)("div",{className:"container",children:[(0,n.tZ)("h2",{children:"Not Found"}),(0,n.tZ)("p",{children:"The page you are attempting to access is not found."}),(0,n.tZ)("p",{children:"If you want to claim this URL you can start a Substack today"}),(0,n.tZ)("p",{children:(0,n.tZ)("a",{href:(0,r._HV)(),class:"button primary",rel:"nofollow",children:"Start a Substack"})}),(0,n.tZ)("p",{children:(0,n.BX)("a",{href:(0,r.daR)({query:t,params:{searching:"publication"}}),children:['Search Substack for "',t,'"']})})]})]})}},85558:function(e,t,i){i.d(t,{s:()=>tv});var n=i(27412),o=i(7409),r=i(99282),l=i(16584),a=i(6400),s=i(30396),d=i(94184),c=i.n(d),u=i(3312),p=i.n(u),h=i(39693),m=i.n(h),g=i(14293),v=i.n(g),f=i(2564),b=i(20042),_=i(80569),y=i.n(_),Z=i(12936),w=i(42694),k=i(23254),C=i(58865),S=i(71375),x=i(51214),B=i(347),P=i(57391),I=i(95441),N=i(60807),T=i(68833),E=i(48980),L=i(62981),X=i(98914),M=i(51450),R=i(15771),F=i(19081),U=i(6490),O=i(98248),A=i(10510),D=i(71068);let z=(0,D.E7)({flex:"grow"});var j=i(58175),H=i(51776),W=i(91400),q=i(63651);let Y={giftModal:"giftModal-cKDVP2",slideUp:"slideUp-LNtrKH",enterEmail:"enterEmail-HqKu0k"};function V(){let e=(0,C._)(["Here's "," to spend on ",""]);return V=function(){return e},e}function K(){let e=(0,C._)(["Special offer: "," free"]);return K=function(){return e},e}function J(){let e=(0,C._)(["Get a "," month subscription in the app, paid for by Substack."]);return J=function(){return e},e}let G=e=>["duration_focused","value_focused"].includes(e),Q=e=>{var t;let{pub:i,numMonths:n,valueString:o}=e,r=(0,W.XA)(),a=(0,N.aF)(),{freeSignup:d,freeSignupEmail:u}=(0,s.qp)(M.p),{getExperimentVariant:p,exposeExperiment:h}=(0,P.jc)(),[m,g]=(0,L.Z)("gift-from-substack-modal",null),[v,f]=(0,s.eJ)(!m),[b,_]=(0,s.eJ)("claim-gift"),[y,Z]=(0,s.eJ)(null!=u?u:""),[w,k]=(0,s.eJ)(!1),[C,S]=(0,s.eJ)(!1),[x,I]=(0,s.eJ)(null),[R,F]=(0,s.eJ)(!1),O=null!==(t=p("gift_from_substack_modal"))&&void 0!==t?t:"control";(0,s.d4)(()=>{v&&(h("gift_from_substack_modal"),g(),(0,T.j)(T.FP.GIFT_FROM_SUBSTACK_MODAL_VIEWED,{freeSignup:d,variant:O}))},[]);let A=(0,s.I4)(()=>{(0,T.j)(T.FP.GIFT_FROM_SUBSTACK_MODAL_DISMISSED,{step:b,freeSignup:d,variant:O}),f(!1)},[d,b,O]),D=(0,s.I4)(e=>{R||((0,T.j)(T.FP.GIFT_FROM_SUBSTACK_MODAL_INITIAL_TEXT_TYPED,{step:b,freeSignup:d,variant:O}),F(!0)),Z(e)},[d,R,b,O]),z=(0,s.I4)(async()=>{if((0,T.j)(T.FP.GIFT_FROM_SUBSTACK_MODAL_CTA_CLICKED,{step:b,freeSignup:d,variant:O}),null!==a)try{S(!0),I(null);let e=await (0,E.rd)("/api/v1/viral_gifts/create_for_email",{method:"POST",json:{email:a.email,fromSubstack:!0}});A(),window.location.href=(0,q.Hs2)({giftId:e.gift.id})}catch(t){var e;I(null!==(e=(0,X.zx)(t))&&void 0!==e?e:"Something went wrong")}finally{S(!1)}else _("enter-email")},[A,a,b,O,d]),j=(0,s.I4)(async e=>{(0,T.j)(T.FP.GIFT_FROM_SUBSTACK_MODAL_CTA_CLICKED,{step:b,variant:O});try{S(!0),I(null);let t=await (0,E.rd)("/api/v1/viral_gifts/create_for_email",{method:"POST",json:{email:e,fromSubstack:!0}});k(!0),window.setTimeout(()=>{A(),window.location.href=(0,q.Hs2)({giftId:t.gift.id})},1e3)}catch(e){var t;I(null!==(t=(0,X.zx)(e))&&void 0!==t?t:"Something went wrong")}finally{S(!1)}},[A,b,O]);return G(O)&&r&&!(n<1)?(0,l.tZ)(U.u_,{isOpen:v,onClose:A,position:"bottom",className:c()(Y.giftModal,"claim-gift"===b&&Y.claimGift,"enter-email"===b&&Y.enterEmail),fullscreenMobile:"enter-email"===b,children:(0,l.BX)(B.h,{children:["claim-gift"===b&&(0,l.tZ)($,{pub:i,numMonths:n,valueString:o,onClaim:z,onDecline:A,variant:O,loading:C,error:x}),"enter-email"===b&&(0,l.tZ)(ee,{pub:i,numMonths:n,valueString:o,onClaim:j,onClose:A,email:y,onEmailChange:D,loading:C,error:x,showSubscribed:w})]})}):null},$=e=>{let{pub:t,numMonths:i,valueString:n,onClaim:o,onDecline:r,variant:a,loading:s,error:d}=e,{iString:c,iTemplate:u}=(0,I.M1)();return(0,l.BX)(F.tu,{alignItems:"stretch",paddingX:20,paddingTop:32,paddingBottom:8,gap:20,children:[(0,l.tZ)(A.wk,{pub:t,size:80,style:{margin:"auto"}}),(0,l.BX)(F.tu,{alignItems:"stretch",gap:8,children:[(0,l.tZ)(j.xv.H3,{textAlign:"center",fontWeight:"heavy",children:"value_focused"===a?u(V(),n,t.name):1===i?c("Special offer: 1st month free"):u(K(),i)}),(0,l.tZ)(j.xv.B2,{textAlign:"center",color:"secondary",children:"value_focused"===a?u(J(),i):"Get a ".concat(i," subscription to ").concat(t.name,", paid for by Substack")})]}),(0,l.BX)(F.tu,{alignItems:"stretch",gap:8,children:[(0,l.tZ)(R.zx,{onClick:o,priority:"primary",disabled:s,style:{height:"48px"},children:s?(0,l.tZ)(O.$j,{}):c("Claim my free gift")}),d&&(0,l.tZ)(j.xv.B3,{color:"accent-red",paddingBottom:8,children:d}),(0,l.tZ)(R.zx,{onClick:r,priority:"tertiary",style:{height:"48px"},children:c("Decline my gift")})]})]})},ee=e=>{let{pub:t,numMonths:i,valueString:n,onClaim:o,onClose:r,email:a,onEmailChange:d,loading:c,error:u,showSubscribed:p}=e,{iString:h}=(0,I.M1)(),m=(0,s.I4)(()=>{o(a)},[a,o]),g=(0,s.I4)(e=>{d(e.target.value)},[d]),v=(0,s.sO)(null);return(0,s.d4)(()=>{var e;null===(e=v.current)||void 0===e||e.focus()},[]),(0,l.BX)(F.tu,{alignItems:"stretch",padding:20,paddingTop:32,gap:20,flex:"grow",children:[(0,l.BX)(F.gq,{alignItems:"center",justifyContent:"space-between",children:[(0,l.tZ)(A.wk,{pub:t,size:32}),(0,l.tZ)(R.hU,{rounded:!0,size:"sm",onClick:r,"aria-label":h("Close"),children:(0,l.tZ)(S.Z,{size:20})})]}),(0,l.BX)(F.tu,{alignItems:"stretch",gap:8,children:[(0,l.BX)(j.xv.H3,{textAlign:"left",fontWeight:"heavy",translated:!0,children:["Claim your ",I18N.p(n)," gift"]}),(0,l.BX)(j.xv.B2,{textAlign:"left",color:"secondary",translated:!0,children:["Enter your email to subscribe and claim your $",I18N.p(i)," month gift subscription in the Substack app."]})]}),(0,l.tZ)(H.oi,{ref:v,placeholder:h("Email address"),value:a,onChange:g}),(0,l.tZ)(z,{}),p?(0,l.BX)(F.gq,{gap:8,alignItems:"center",justifyContent:"center",children:[(0,l.tZ)(x.Z,{isStatic:!0,height:24,fill:"#187F22",stroke:"#187F22"}),(0,l.tZ)(j.xv.B3,{color:"secondary",align:"center",translated:!0,children:"Subscribed"})]}):(0,l.BX)(F.tu,{alignItems:"stretch",gap:8,children:[(0,l.tZ)(R.zx,{onClick:m,priority:"primary",disabled:c,style:{height:"48px"},children:c?(0,l.tZ)(O.$j,{}):h("Claim my free gift")}),u&&(0,l.tZ)(j.xv.B3,{color:"accent-red",children:u})]})]})};var et=i(64515);function ei(e){return(0,l.BX)(et.l,(0,r._)((0,o._)({},e),{name:"reader2__RestackReplyIcon",svgParams:{height:24,width:24,stroke:"none"},children:[(0,l.tZ)("path",{d:"M18.5 2.50023C18.8978 2.1024 19.4374 1.87891 20 1.87891C20.5626 1.87891 21.1022 2.1024 21.5 2.50023C21.8978 2.89805 22.1213 3.43762 22.1213 4.00023C22.1213 4.56284 21.8978 5.1024 21.5 5.50023L12 15.0002L8 16.0002L9 12.0002L18.5 2.50023Z","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),(0,l.tZ)("path",{d:"M20 13C20 17.9706 15.9706 22 11 22C6.02944 22 2 17.9706 2 13C2 8.02944 6.02944 4 11 4","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}))}var en=i(35047),eo=i(16808),er=i(56219),el=i(10045),ea=i(30329),es=i(63639),ed=i(12620),ec=i(60308),eu=i(84864),ep=i(47929);class eh extends a.Component{isSubscribed(){let{user:e}=this.props;return!!e&&e.is_subscribed}isFreeSubscribed(){let{freeSignup:e,user:t}=this.props;return!!e||!!t&&t.is_free_subscribed&&!t.is_contributor}onFreeSubscribe(e){if(this.props.publication.plans){let i=(0,ec.W1P)(this.props.publication,{just_signed_up:!0,referral_token:e.body.referral_token});if(e.body.prompt_to_login){var t;i="/account/login?redirect=".concat(encodeURIComponent(i),"&email=").concat(encodeURIComponent(null!==(t=e.body.email)&&void 0!==t?t:""))}document.location.href=i}else window.location.reload()}render(e){let{publication:t,user:i,freeSignupEmail:n,iString:o,language:r}=e;return this.isSubscribed()||this.isFreeSubscribed()&&!t.plans?null:(0,l.tZ)("div",{className:"subscribe-footer",children:(0,l.BX)("div",{className:"container",children:[(0,l.tZ)("p",{children:o("Ready for more?")}),this.isFreeSubscribed()?(0,l.tZ)("div",{children:(0,l.tZ)("a",{className:"cta",href:(0,ec.W1P)(t,{utm_source:ep.b3.readyForMore}),native:!0,children:(0,l.tZ)(R.zx,{priority:"primary",children:(0,l.tZ)("b",{children:(0,eu.getSubscribeText)(t,{language:r})})})})}):(0,l.tZ)(F.gq,{justifyContent:"center",children:(0,l.tZ)("div",{children:(0,l.tZ)(ed.Z,{freeSignupEmail:n,onAccentBackground:!0,pub:t,source:ep.b3.subscribeFooter,submitButtonText:(0,eu.getSubscribeText)(t),user:i,onSuccess:this.onFreeSubscribe.bind(this)})})})]})})}}let em=(0,I.fz)(eh);var eg=i(6498),ev=i(57626),ef=i(3469),eb=i(79344),e_=i(4211),ey=i(87810),eZ=i(40647),ew=i(49688),ek=i(98422),eC=i(63474),eS=i(61301);let ex={authorInfo:"authorInfo-uQxGwM",authorImg:"authorImg-RBQVJm",notifyButton:"notifyButton-dcpYYD"},eB=e=>{let{bio:t,byline:i,name:n,photoUrl:a,pub:s}=e,{getConfigFor:d}=(0,eZ.xR)(),{isMobile:c}=(0,ek.v9)(),{markdownProps:u}=(0,ew.V)(t),{hasSection:p}=(0,ey.l)(i.id),h=(0,ec.NNq)(i);if(d("enable_author_pages")){var m;h=null!==(m=(0,ec.rfk)({userId:i.id,pub:s}))&&void 0!==m?m:h}return(0,l.BX)(F.hs,{className:ex.authorInfo,direction:c?"column":"row",gap:16*!!c,padding:24*!!c,position:"relative",children:[(0,l.BX)(eC.A0,{href:h,native:!0,children:[a&&!(0,eS.d7)(a)&&(0,l.tZ)(D.xu,{className:ex.authorImg,style:{background:"url(".concat((0,ec.zF4)(a,(c?200:430)*2,{height:430}),") lightgray 50% / cover no-repeat")}}),(0,l.BX)(F.tu,{gap:16,padding:40*!c,children:[(0,l.tZ)(e_.Z,{color:"white",preset:"h5-serif",children:n}),(0,l.tZ)(e_.Z,(0,r._)((0,o._)({},u),{clamp:4,color:"white",preset:"d3-serif"}))]})]}),p&&(0,l.tZ)(eb.F,{authorId:i.id,className:ex.notifyButton})]})};var eP=i(3900),eI=i(84722),eN=i(11183);let eT=e=>{var t;let{pub:i,post:n}=e,{iString:o}=(0,I.M1)(),r=null===(t=n.postTags)||void 0===t?void 0:t.filter(e=>{var t,i,o;return e.name!==(null===(i=n.publishedBylines)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:t.name)&&e.name!==(null===(o=n.section)||void 0===o?void 0:o.name)});return r&&0!==r.length?(0,l.BX)(F.gq,{alignItems:"center",className:"tagList-aHQ9ej",gap:16,wrap:"wrap",children:[(0,l.tZ)(e_.Z,{preset:"detail-small",children:o("Tags:")}),r.map(e=>(0,l.tZ)("a",{className:"tagBox-lyb9LX",href:(0,q.Mk9)(i,e),children:(0,l.tZ)(e_.Z,{color:"tertiary",preset:"detail-small",children:e.name})}))]}):null},eE={postFooter:"postFooter-urmQJ_",authorInfoContainer:"authorInfoContainer-XS7yHj",upgradeCtaContainer:"upgradeCtaContainer-B3vHAT",upgradeCtaSwitchAccounts:"upgradeCtaSwitchAccounts-uPAFOo",upgradeCtaInputContainer:"upgradeCtaInputContainer-I6n3O5"},eL=e=>{var t;let{post:i,user:n,pub:o,includeUFI:r=!0,freeSignupEmail:a}=e,{iString:s}=(0,I.M1)();return(0,l.tZ)(B.h,{children:(0,l.BX)(F.tu,{alignItems:"center","aria-label":s("Post footer"),className:eE.postFooter,gap:40,children:[(null===(t=i.postTheme)||void 0===t?void 0:t.header_variant)!=="title_and_image_only"&&(0,l.tZ)(eX,{freeSignupEmail:a,post:i,pub:o,user:n}),(0,l.tZ)(eT,{post:i,pub:o}),r&&(0,l.tZ)(eN.I,{post:i,pub:o,user:n})]})})},eX=e=>{let{post:t,pub:i,user:n,freeSignupEmail:o}=e,{isMobile:r}=(0,ek.v9)(),a=t.publishedBylines.map(e=>{var t,n;let o=null===(t=i.authorPagesInfo)||void 0===t?void 0:t.find(t=>t.user_id===e.id);return{name:null!==(n=null==o?void 0:o.name)&&void 0!==n?n:e.name,bio:null==o?void 0:o.bio,photo_url:null==o?void 0:o.photo_url,byline:e}}).filter(e=>e.bio&&e.name),s=!(null==n?void 0:n.is_subscribed)&&!t.hidden;if(0===a.length&&!s)return null;let d=!n&&!o,c=(0,l.BX)(F.tu,{alignItems:"center",className:eE.upgradeCtaContainer,gap:24,padding:40,paddingTop:24,children:[(0,l.BX)(F.tu,{alignItems:"center",gap:16,children:[(0,l.tZ)(e_.Z,{align:"center",preset:"h5-sans",children:"Become a Paid Subscriber"}),(0,l.tZ)(e_.Z,{align:"center",preset:"body",wrap:"balance",children:"Get access to our comments section, special columns like TGIF and Things Worth Remembering, tickets in advance to our live events, and more."})]}),(0,l.tZ)(F.gq,{className:eE.upgradeCtaInputContainer,justifyContent:"center",children:d?(0,l.tZ)(eI.Z,{post:t,pub:i,user:n,utmSource:ep.b3.freePressPostEndCta}):(0,l.tZ)(eP._,{href:(0,ec.Zs0)(i,{utm_source:ep.b3.freePressPostEndCta,next:(0,q.uRy)(i,t)}),localNavigation:!1,children:(null==n?void 0:n.is_free_subscribed)?"Upgrade today":"Subscribe today"})}),(0,l.BX)(F.gq,{gap:16,children:[(0,l.tZ)(e_.Z,{preset:"caption",children:"Already a paid subscriber?"}),(0,l.tZ)("a",{className:eE.upgradeCtaSwitchAccounts,href:(0,ec.uXE)({for_pub:i.subdomain,change_user:!0}),native:!0,children:(0,l.tZ)(e_.Z,{color:"accent",preset:"caption",children:"Switch Accounts"})})]})]});return(0,l.BX)(F.tu,{alignItems:"center",className:eE.authorInfoContainer,gap:r?16:32,children:[s?c:null,a.map(e=>{var t,n;return(0,l.tZ)(eB,{bio:null!==(t=e.bio)&&void 0!==t?t:"",byline:e.byline,name:null!==(n=e.name)&&void 0!==n?n:"",photoUrl:null==e?void 0:e.photo_url,pub:i})})]})};var eM=i(20888),eR=i(65523);let eF=()=>{let[e,t]=(0,s.eJ)(!0),{iString:i}=(0,I.M1)(),n=()=>{t(!1)};return(0,l.BX)(U.u_,{isOpen:e,onClose:n,children:[(0,l.tZ)(eR.NO,{showClose:!1,image:(0,l.tZ)(D.xu,{radius:"md",overflow:"hidden",children:(0,l.tZ)(eM.e,{maxWidth:400,useRetinaSizing:!0,imageIsFixedWidth:!0,src:(0,q.zF4)("/img/publish/selection.gif")})})}),(0,l.tZ)(U.xB,{showClose:!1,alignItems:"center",title:i("Select a chunk of text"),description:i("We'll convert your selection into a shareable video to help promote this post")}),(0,l.tZ)(U.ex,{}),(0,l.tZ)(U.mz,{direction:"column",primaryButton:(0,l.tZ)(R.zx,{onClick:n,priority:"primary",children:i("Okay")})})]})};var eU=i(58319),eO=i(37168),eA=i(56629),eD=i(42375),ez=i(81914),ej=i(8090),eH=i(10047),eW=i(49762),eq=i(59176),eY=i(21599),eV=i(63018),eK=i(13285),eJ=i(63145),eG=i(41258),eQ=i(32129),e$=i(65102),e0=i(31131),e1=i(59543),e4=i(51014),e2=i(33665),e8=i(27036),e3=i(98012);let e6={container:"container-zWi_VI",imageContainer:"imageContainer-nn2nS0",postContainer:"postContainer-pVTsPs",imagePreview:"imagePreview-gmfk3B",shareButton:"shareButton-TCXuA9",foundingButton:"foundingButton-jUuPk2",upsellDescription:"upsellDescription-ILV1gy",countdownContainer:"countdownContainer-gvKChz",countdownInnerContainer:"countdownInnerContainer-P186WI",refreshLink:"refreshLink-qARRi5"},e5=e=>{var t,i,n,o,r,a,d,c,u,p;let{post:h,publication:m,user:g,freeSignup:v,freeSignupEmail:f}=e,b=(0,s.sO)(),_=h.cover_image,y=h.title,Z=h.description,w=(0,eu.getPrintedByline)(m,h),k=(null===(t=h.postSchedule)||void 0===t?void 0:t.email_audience)==="founding"&&(null==g?void 0:g.is_founding)||(null===(i=h.postSchedule)||void 0===i?void 0:i.email_audience)==="only_paid"&&g&&(0,e8.P)(g,m)||(null===(n=h.postSchedule)||void 0===n?void 0:n.email_audience)==="everyone"&&(null==g?void 0:g.is_free_subscribed),[C,S]=(0,s.eJ)((0,e3.Z)(null===(o=h.postSchedule)||void 0===o?void 0:o.trigger_at).diff((0,e3.Z)(),"second")),x=Math.floor(C/60/60/24),B=Math.floor(C/60/60%24),P=Math.floor(C/60%60);return(0,s.d4)(()=>{let e=setInterval(()=>{var e;S((0,e3.Z)(null===(e=h.postSchedule)||void 0===e?void 0:e.trigger_at).diff((0,e3.Z)(),"second"))},500);return()=>{clearInterval(e)}}),(0,s.d4)(()=>{(0,T.j)(T.FP.SCHEDULED_POST_SEEN,{post_id:h.id})},[]),(0,l.BX)(l.HY,{children:[(0,l.tZ)(eQ.PostMetaTags,{post:h,publication:m}),(0,l.BX)(F.tu,{className:e6.container,alignItems:"center",gap:96,paddingTop:{desktop:64,mobile:32},paddingX:12,children:[(0,l.BX)(F.tu,{className:e6.postAndImageContainer,alignItems:"center",gap:32,children:[_&&(0,l.tZ)("div",{className:e6.imageContainer,children:(0,l.tZ)("img",{src:_,className:e6.imagePreview})}),(0,l.BX)(F.tu,{className:e6.postContainer,alignItems:"center",gap:4,children:[(0,l.tZ)(j.xv.H2,{color:"pub-primary-text",align:"center",children:y}),(0,l.tZ)(j.xv.B3,{color:"pub-secondary-text",align:"center",children:(0,eu.truncateText)(Z,135)}),(0,l.BX)(j.xv.Meta,{color:"pub-secondary-text",align:"center",children:[(null===(r=h.postSchedule)||void 0===r?void 0:r.email_audience)==="founding"?(0,l.BX)(l.HY,{children:[(0,l.tZ)(j.xv.Meta,{as:"span",color:"pub-accent",children:"Founding"}),w?"\xa0\xa0•\xa0\xa0":""]}):(null===(a=h.postSchedule)||void 0===a?void 0:a.email_audience)==="only_paid"?(0,l.BX)(l.HY,{children:[(0,l.tZ)(j.xv.Meta,{as:"span",color:"pub-accent",children:"Paid"}),w?"\xa0\xa0•\xa0\xa0":""]}):"",w?"By ".concat(w):""]})]})]}),(0,l.BX)(F.tu,{className:e6.upsellContainer,alignItems:"center",children:[k?(0,l.BX)(F.gq,{gap:12,children:[(0,l.tZ)(R.zx,{onClick:()=>{if((null==g?void 0:g.is_admin)||(null==g?void 0:g.is_contributor))(0,X.uX)((0,q.fQy)(m,h.id),{local_navigation:!1});else{var e;null===(e=b.current)||void 0===e||e.open()}},className:e6.shareButton,leading:(0,l.tZ)(e0.Z,{size:20}),priority:"primary",children:"Share"}),(null==g?void 0:g.is_admin)||(null==g?void 0:g.is_contributor)?(0,l.tZ)(R.zx,{onClick:()=>{(0,X.uX)((0,q.ANx)(m,h.id),{local_navigation:!1})},className:e6.shareButton,leading:(0,l.tZ)(e1.Z,{size:20}),priority:"secondary",children:"Edit Post"}):null]}):(null===(d=h.postSchedule)||void 0===d?void 0:d.email_audience)!=="founding"||(null==g?void 0:g.is_founding)?(0,l.tZ)(e2.Z,{pub:m,post:h,user:g,freeSignup:v,freeSignupEmail:f,isStatic:!1,source:"post-scheduled-page"}):(0,l.tZ)(R.zx,{className:e6.foundingButton,onClick:()=>{var e,t;let i=null===(t=m.plans)||void 0===t?void 0:null===(e=t.find(e=>{var t;return null===(t=e.metadata)||void 0===t?void 0:t.founding}))||void 0===e?void 0:e.id;(0,X.uX)(i?(0,q.W1P)(m,{addBase:!0,params:{next:document.location.href,utm_source:ep.b3.postScheduledPage,utm_medium:ep.lP.web,utm_content:h.id,selectedPlanId:i}}):(0,ec.Zs0)(m,{simple:!0,next:document.location.href,utm_source:ep.b3.postScheduledPage,utm_medium:ep.lP.web,utm_content:h.id,plan:"founding"}),{local_navigation:!1})},children:"Upgrade to founding"}),(0,l.BX)(j.xv.B3,{className:e6.upsellDescription,color:"pub-primary-text",align:"center",children:["Publishes on ",(0,e3.Z)(null===(c=h.postSchedule)||void 0===c?void 0:c.trigger_at).format("MMMM Do, h:mma"),"."," ",(null==g?void 0:g.is_admin)||(null==g?void 0:g.is_contributor)?"":k?"You’ll receive this post in your inbox when it’s live. Meanwhile, help spread the word!":(null===(u=h.postSchedule)||void 0===u?void 0:u.email_audience)==="founding"&&(null==g?void 0:g.is_free_subscribed)?"Upgrade to founding and receive this post in your inbox when it’s live":(null===(p=h.postSchedule)||void 0===p?void 0:p.email_audience)==="only_paid"&&(null==g?void 0:g.is_free_subscribed)?"Upgrade to paid and receive this post in your inbox when it’s live":"Subscribe now and receive the post in your inbox when it’s live"]})]})]}),(0,l.tZ)("div",{className:e6.countdownContainer,children:(0,l.tZ)(F.tu,{className:e6.countdownInnerContainer,alignItems:"center",gap:4,children:C>0?(0,l.BX)(j.xv.B3,{color:"pub-secondary-text",align:"center",children:["Available in ",x>0?"".concat((0,eu.pluralize)(x,"day"),", "):"",x>0||B>0?"".concat((0,eu.pluralize)(B,"hour"),", "):"",x>0||B>0||P>0?"".concat((0,eu.pluralize)(P,"minute")).concat(x>0||B>0?",":""," and "):"",(0,eu.pluralize)(C%60,"second")]}):(0,l.BX)(j.xv.B3,{color:"pub-secondary-text",align:"center",children:["Available now!"," ",(0,l.tZ)(j.xv.B3,{as:"a",color:"pub-secondary-text",align:"center",onClick:()=>{location.reload()},className:e6.refreshLink,decoration:"underline",children:"Refresh to see the post"}),"."]})})}),(0,l.tZ)(e4.ZP,{ref:b,user:g,pub:m,post:h})]})};var e9=i(13229),e7=i(15186),te=i(78118),tt=i(27744),ti=i(88817),tn=i(75419),to=i(65575),tr=i(41233),tl=i(38501),ta=i(43905),ts=i(24791),td=i(6070),tc=i(31377),tu=i(76560),tp=i(6163),th=i(26111),tm=i(81821);let tg={singlePostContainerPillar:"singlePostContainerPillar-sdUBxf",restackEmpty:"restackEmpty-joLIAL",feedItem:"feedItem-p_SCsv",discussionContainerFP:"discussionContainerFP-YrbLts"};class tv extends a.Component{async componentDidMount(){var e;(0,X.pK)(),this.cleanEmbedResizeListener=(0,eH.J)();let t=this.props.post&&[this.props.post.slug,this.props.post.uuid].filter(e=>e).includes(this.props.slug)?this.props.post:null;if(this.shouldRedirectToComments(t)&&t?this.redirectToComments(t):(null===(e=this.props.siteConfigs)||void 0===e?void 0:e.post_metering_enabled)&&(null==t?void 0:t.meter_type)!=="none"&&!this.props.user?await this.loadPost({forceLoad:!0}):this.state.post||await this.loadPost(),this.triggerShareOnLoad(),this.fillEmbeddedEmailInputs(),this.props.justPublished){(0,X.iO)("justPublished"),this.props.post&&(0,X.pt)((0,eQ.getPostMetaImage)(this.props.publication,this.props.post)[0]);let e=(0,eQ.getPostMetaImageForTwitter)(this.props.publication,this.props.post);e&&(0,X.pt)(e)}(this.props.embeddedPostPublications||""===this.props.embeddedPostPublications)&&(0,X.iO)("embeddedPostPublications"),this.props.autoSharedOnTwitter&&(0,X.iO)("autoSharedOnTwitter"),this.props.showRestackModal&&(0,X.iO)("showRestackModal"),"restack-comment"===this.props.action&&(0,X.iO)("action"),this.props.showWelcome||this.props.launchWelcomePage||(0,X.ut)(this.updateSubscribeTakeover),this.props.showWelcome&&((0,X.iO)("showWelcome"),this.updateSubscribeTimers()),this.props.showWelcomeOnShare&&((0,X.iO)("showWelcomeOnShare"),(this.props.launchWelcomePage||this.props.skipIntoPopupRender)&&this.updateSubscribeTimers()),this.props.selectionFromQuery&&(0,eY.sK)(this.props.selectionFromQuery),this.props.imgSelectionFromQuery&&(0,eY.pW)(this.props.imgSelectionFromQuery),this.props.trackFrontendVisit&&((0,T.j)(T.FP.POST_PAGE_VISIT_TRACKED,{post_id:null==t?void 0:t.id}),this.context.exposeExperiment("check_for_tracking_disabled")),this.props.user||this.context.exposeExperiment("test_cached_post_page"),await this.loadWelcomePageData()}async loadWelcomePageData(){if(!this.shouldShowWelcomePage()||(0,tm.tq)())return;let e=await (0,E.rd)("/api/v1/welcome_page_data");this.setState(e)}shouldShowWelcomePage(){return!!(!this.props.skipIntoPopupRender&&(this.props.launchWelcomePage||this.props.showWelcome||this.state.showSubscribeTakeover))}componentWillUnmount(){var e;null===(e=this.cleanEmbedResizeListener)||void 0===e||e.call(this),(0,X.kE)(this.updateSubscribeTakeover)}async componentDidUpdate(e){e.slug!==this.props.slug&&this.loadPost(),this.state.embeddedEmailInputsFilled||this.fillEmbeddedEmailInputs()}shouldRedirectToComments(e){if(e&&"thread"===e.type)return!0}redirectToComments(e){(0,b.route)((0,ec.uRy)(this.props.publication,e,{comments:!0,noBase:!0}),!0)}async loadPost(){let{forceLoad:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.setState({embeddedEmailInputsFilled:!1}),this.props.post&&[this.props.post.slug,this.props.post.uuid].filter(e=>e).includes(this.props.slug)&&!this.shouldRedirectToComments(this.props.post)&&!e)this.setState({post:this.props.post,comments:this.props.renderedComments},()=>(0,X.pK)());else{this.setState({post:null,comments:null});try{let e=(await y().get("/api/v1/posts/".concat(this.props.slug)).query({postPreview:this.props.postPreview,updated:this.props.updated,sub:this.props.sub,device:this.props.device,audience:this.props.audience,free_preview:this.props.free_preview,freemail:this.props.freemail,utm_campaign:this.props.utm_campaign})).body;if(this.shouldRedirectToComments(e))this.redirectToComments(e);else{if(await (0,X.IW)(this,{post:e,comments:e.comments,stateThemeVariables:e.themeVariables}),(0,eW.default)("add_section_and_tag_metadata")&&!(0,ej.bI)()){let e={url:document.location.origin+document.location.pathname+document.location.search,urlref:document.referrer||"",js:1,data:{audience:(0,ej.Bt)(this.props.user)}};"undefined"!=typeof window&&window.PARSELY&&window.PARSELY.loaded&&window.PARSELY.beacon&&window.PARSELY.beacon.trackPageView&&window.PARSELY.beacon.trackPageView(e)}(0,X.pK)()}}catch(e){console.error("Failed to load post:",e),404===e.status?this.setState({notFound:!0}):alert((0,X.zx)(e))}}}triggerShareOnLoad(){var e,t;"share"===(0,th.x)("action")&&(window.history.replaceState({},document.title,(0,ec.rhs)({action:null})),this.post&&(null===(e=(t=this.post).triggerShare)||void 0===e||e.call(t,{fromEmail:!0})))}render(e,t){var i,n,a,s,d;let u,{slug:p,freeSignup:h,freeSignupEmail:g,readerInstalledAt:v,publication:f,reaction_token:b,hide_intro_popup:_,sort:y,search:w,children:C,showWelcome:S,launchWelcomePage:x,justPublished:P,autoSharedOnTwitter:I,readerIsSearchCrawler:N,postPreview:T,selectionFromQuery:E,embeddedPublications:L,siteConfigs:X={},freeTrialCoupon:M,showRestackModal:R,action:F,publicationSettings:U,show_reaction_upsell:O,stripe_publishable_key:A,bannedFromNotes:D,themeVariables:z,referringUser:j,clip:H,recentEpisodes:W,followPrompt:q,imgSelectionFromQuery:Y}=e,{comments:V,notFound:K,post:J,user:$,stateThemeVariables:ee,hideSubscribePrompt:et,blurbs:ei,topThreePosts:ea,topThreeSubscribers:ed}=t,{iString:ec}=this.I18N,ep=this._inlineComments(),eh=null==J||!J.audience||(0,tc.userHasFullAccessToPost)($,J),eg=(null==$?void 0:$.is_subscribed)&&eh,ev=J&&J.slug&&"coming-soon"!==J.slug&&"page"!==J.type,eb=(0,eu.commentsEnabledForPost)({publication:f,post:J}),e_=(0,eu.showCommentsOnPost)({publication:f,post:J}),ey=eg||(null==$?void 0:$.is_free_subscriber)||h,eZ=(0,td.HD)({pub:f}),ew=!!(J&&["video","podcast"].includes(J.type)),ek=ee||z,eC=!(null==J?void 0:J.hidden)&&((0,eu.isUUID)(p)||eg||N||J&&J.current_user_post_meter||J&&!(0,tc.isPaidAudience)(J.audience)||J&&!J.slug),eS=!!J&&(0,ts.sv)({post:J})&&!eg,ex=!eC||(null==$?void 0:$.is_contributor)&&J&&(0,tc.isPaidAudience)(J.audience)||eZ,eB=P&&(null==$?void 0:$.is_contributor)&&!this.props.publication.invite_only&&J&&!["page"].includes(J.type),eP=!1;if("undefined"!=typeof window&&(eP="true"===new URLSearchParams(window.location.search).get("selectQuote")),eZ&&J&&"page"===J.type&&Object.keys(ef._).includes(J.slug))return(0,l.tZ)(ef.j,{type:J.slug,html:J.body_html||"",post:J,pub:this.props.publication,user:this.props.user});if(J&&"is_scheduled"in J&&J.is_scheduled)return(0,l.tZ)(e5,{freeSignup:h,freeSignupEmail:g,user:$,post:J,publication:f});let eI=J?(0,l.tZ)(tb,{commentsEnabled:eb,comments:V,post:J,slug:p,user:$,freeSignup:h,freeSignupEmail:g,publication:f,reaction_token:b,onVisible:this.onVisible,onChangeComment:this.onChangeComment,inlineComments:ep,isShowsEpisodePage:ew,selectionFromQuery:E,imgSelectionFromQuery:Y,onChange:e=>{let{post:t}=e;J?this.setState({post:(0,r._)((0,o._)({},J),{comment_count:t.comment_count})}):console.error("post not set with CommentsAndRestacks onChange")},bannedFromNotes:D}):null,eN=(0,eK.S)(f,{publicationSettings:U})&&!(null==$?void 0:$.reader_installed_at)&&!(null==$?void 0:$.is_subscribed)&&!(null==$?void 0:null===(i=$.email)||void 0===i?void 0:i.includes("+"))&&!(null==g?void 0:g.includes("+"))&&!this.shouldShowWelcomePage();eN&&(u=(0,eu.getGiftValueText)(f.plans,{interval_count:1}));let eT=eN&&G(null!==(n=this.context.getExperimentVariant("gift_from_substack_modal"))&&void 0!==n?n:"control"),eE=["podcast","video"].includes(null!==(a=null==J?void 0:J.type)&&void 0!==a?a:"")&&(null==J?void 0:J.videoUpload)&&(0,eW.default)("enable_video_seo_data");return(0,l.BX)("div",{children:["restack-comment"===F&&(0,l.tZ)(tw,{post:J,pub:f,selection:E,imgSelection:null!=Y?Y:void 0}),(0,l.tZ)(ty,{pub:f,post:J}),eE&&(0,l.tZ)(tZ,{pub:f,post:J,hasPaywall:!eC}),this.shouldShowWelcomePage()?(0,l.tZ)(en.ZP,{freeSignup:h,freeSignupEmail:g,user:$,post:J,publication:f,hidden:_,launchWelcomePage:x,showOnMount:x,blurbs:ei,topThreePosts:ea,topThreeSubscribers:ed}):null,(0,l.BX)(Z._e,{children:[!ew&&(0,l.BX)(l.HY,{children:[eN&&u&&(0,l.tZ)(Q,{pub:f,numMonths:1,valueString:u}),!eT&&(0,l.tZ)(tf,{user:$,readerInstalledAt:v,post:J,publication:f,readerIsSearchCrawler:N,publicationSettings:U})]}),(0,l.BX)("div",{className:c()("single-post-container",{[null!==(s=tg.singlePostContainerPillar)&&void 0!==s?s:""]:(0,td.kb)({pub:f})}),"aria-label":ec("Post"),role:"main",children:[(0,l.tZ)("div",{className:c()({container:!(ew||(null==J?void 0:J.postTheme)&&eZ)}),children:(0,l.BX)("div",{className:"single-post",children:[(0,l.tZ)(eQ.PostMetaTags,{publication:f,post:null!=J?J:void 0,clip:H,selection:E,siteConfigs:X}),J?(0,l.tZ)(B.h,{children:ew?(0,l.tZ)(tl.o,{ref:this.assignPost,isServingFreePodcastUrl:eS,isShowsEpisodePage:ew,isTheFreePressTheme:eZ,postPreview:T,showComments:e_,user:null!=$?$:null,post:J,pub:f,freeSignup:h,freeSignupEmail:g,readerInstalledAt:v,reaction_token:b,disableSubscribePrompt:et||(x||S)&&!_,paywall:!eC,noTitleLink:!0,onChange:e=>this.setState(null!=e?e:{}),fromPostPage:!0,freeTrialCoupon:M,showRestackModal:!!R,stripe_publishable_key:A,readerIsSearchCrawler:N,renderComments:()=>eI,themeVariables:ek,referringUser:j,recentEpisodes:null!=W?W:null,forceFollowPrompt:q,skipFollowPrompt:this.shouldShowWelcomePage()}):(0,l.tZ)(er.SO,{ref:this.assignPost,isServingFreePodcastUrl:eS,isShowsEpisodePage:ew,isTheFreePressTheme:eZ,postPreview:T,showComments:e_,user:null!=$?$:null,post:J,pub:f,freeSignup:h,freeSignupEmail:g,readerInstalledAt:v,reaction_token:b,disableSubscribePrompt:et||(x||S)&&!_,paywall:!eC,noTitleLink:!0,onChange:e=>this.setState(null!=e?e:{}),fromPostPage:!0,freeTrialCoupon:M,showRestackModal:!!R,stripe_publishable_key:A,readerIsSearchCrawler:N,renderComments:()=>eI,themeVariables:ek,referringUser:j,forceFollowPrompt:q,skipFollowPrompt:this.shouldShowWelcomePage()})}):K?(0,l.tZ)("p",{className:"main-loader","aria-label":ec("Error: Post not found"),children:ec("Post not found")}):(0,l.tZ)(er._q,{pub:f}),C]})}),(0,l.tZ)(B.h,{children:ev&&(eC||eZ)&&[eZ&&(0,l.tZ)(eL,{post:J,user:$,pub:f,freeSignupEmail:g,includeUFI:!!eC&&"video"!==J.type&&"podcast"!==J.type}),e_&&!ew&&eI,f.has_posts&&(!ew||eZ)&&(0,l.tZ)("div",{className:"single-post-section",children:(0,l.BX)("div",{className:c()({container:!(J.postTheme&&eZ)}),children:[(0,l.tZ)(eU.Z,{onVisible:()=>{this.onVisible("Top Posts Footer"),$&&this.context.exposeExperiment("related_posts_web")}}),(0,l.tZ)(e$.h,{user:null!=$?$:null,freeSignup:h,freeSignupEmail:g,isShowsEpisodePageForTheFP:ew,pub:f,maxPosts:ex||eg||ey&&!f.plans?10:3,filterPostsPredicate:e=>e.id!==J.id,sort:y,search:w,stateInUrl:!0,sortTabs:e=>{if("treatment"===this.context.getExperimentVariant("related_posts_web")){let t=e.findIndex(e=>"related"===e.id);if(-1!==t)return m()([e[t]].concat(e.filter((e,i)=>i!==t)))}let t=e.findIndex(e=>"top"===e.id);return -1!==t?m()([e[t]].concat(e.filter((e,i)=>i!==t))):null},delayFirstLoad:1e3,source:"post",isBelowTheFold:!0,post:J})]})}),!ex&&[(0,l.tZ)(eU.Z,{onVisible:()=>this.onVisible("Subscribe Footer")}),(0,l.tZ)(em,{publication:f,user:$,freeSignupEmail:g,freeSignup:h})]]}),eB?(0,l.tZ)(el.Z,{post:J,autoSharedOnTwitter:"true"===I,publicationTwitterScreenName:f.twitter_screen_name,publication:f,showAfter:(null==L?void 0:L.length)?(0,l.tZ)(es.D,{pub:f,pubsToRecommend:L}):null}):null,O?(0,l.tZ)(eo.hF,{user:$,pub:f,post:null!=J?J:void 0}):null,eP&&(0,l.tZ)(eF,{}),(0,l.tZ)(k.ZP,{post:J,mediaUploadId:null!==(d=this.props.clipId)&&void 0!==d?d:null})]})]})]})}constructor(e,t){super(e,t),(0,n._)(this,"I18N",void 0),(0,n._)(this,"cleanEmbedResizeListener",void 0),(0,n._)(this,"post",void 0),(0,n._)(this,"assignPost",e=>{this.post=e}),(0,n._)(this,"updateSubscribeTakeover",()=>{let e=this.props.publication.id,t=(0,eq.mM)("pub-".concat(e,"-takeover-next-shown-at")),i=!t||Date.now()>=t;(0,X.dr)()?this.state.subscribeTakeOverTimer&&(i&&Date.now()-this.state.subscribeTakeOverTimer.getTime()>=12e4&&this.setState({showSubscribeTakeover:!0},()=>{this.loadWelcomePageData()}),this.setState({subscribeTakeOverTimer:null}),this.updateSubscribeTimers()):this.state.subscribeTakeOverTimer||this.setState({subscribeTakeOverTimer:new Date})}),(0,n._)(this,"updateSubscribeTimers",()=>{let e=this.props.publication.id,t="pub-".concat(e,"-subscribe-prompt-next-shown-at"),i="pub-".concat(e,"-takeover-next-shown-at");(0,eq.ex)(t,(0,e3.Z)().add(1,"hour").valueOf()),(0,eq.ex)(i,(0,e3.Z)().add(1,"hour").valueOf()),this.setState({hideSubscribePrompt:!0})}),(0,n._)(this,"onChangeComment",e=>{this.setState({comments:(0,eJ.fc)(this.state.comments,e)})}),(0,n._)(this,"onVisible",e=>{let t="".concat(e," Seen");this.state.post&&(this.state[t]||(this.setState({[t]:!0}),(0,T.j)(t,{post_id:this.state.post.id,post_audience:this.state.post.audience,post_type:this.state.post.type})))}),(0,n._)(this,"_inlineComments",()=>{let{inlineComments:e,publication:t}=this.props;return!!e||(0,eu.shouldUseInlineComments)(t,this.state.post||this.props.post)}),(0,n._)(this,"fillEmbeddedEmailInputs",()=>{var e;let t=document.querySelectorAll('article.post input[type="email"]'),i=(null===(e=this.state.user)||void 0===e?void 0:e.email)||this.props.freeSignupEmail;if(i)for(let e of t)e.value=i;this.setState({embeddedEmailInputsFilled:!0})});let{user:i}=e;this.I18N=I18N.i({pub:e.publication}),e.postPreview&&(i=(0,r._)((0,o._)({},i),{is_draft:!1,is_subscribed:"free"!==e.postPreview,is_founding:"founding"===e.postPreview,is_contributor:!1})),e.post&&[e.post.slug,e.post.uuid].filter(e=>e).includes(e.slug)&&!this.shouldRedirectToComments(e.post)?this.state={post:e.post,comments:e.renderedComments,user:i}:this.state={post:null,comments:null,user:i}}}function tf(e){let{user:t,readerInstalledAt:i,post:n,publication:o,readerIsSearchCrawler:r,publicationSettings:a}=e,s=n&&o&&!r&&!(0,td.HD)({pub:o}),d=t&&t.is_contributor&&(null==n?void 0:n.slug)=="coming-soon"&&!(null==a?void 0:a.seen_coming_soon_explainer);return(0,l.BX)(l.HY,{children:[s&&(0,l.tZ)(Z.S$,{subdomain:o.subdomain,post:n,readerInstalled:!!i,isContributor:!!(null==t?void 0:t.is_contributor)}),d&&(0,l.tZ)(w.qT,{})]})}(0,n._)(tv,"contextType",eO.WH);let tb=e=>{var t,i,n;let{commentsEnabled:a,comments:d,post:u,slug:p,user:h,freeSignup:m,freeSignupEmail:g,publication:b,reaction_token:_,onVisible:y,onChangeComment:Z,inlineComments:w,isShowsEpisodePage:k,selectionFromQuery:C,onChange:S,bannedFromNotes:x,imgSelectionFromQuery:B}=e,{iString:P,iPlural:E}=(0,I.M1)(),[L,X]=(0,s.eJ)(!!(0,th.x)("showRestacks")),[M,R]=(0,s.eJ)(!1),U=(0,N.SE)(),{getSettingFor:A}=(0,eA.So)(),z=(0,td.HD)({pub:b}),H=A("show_restacks_below_posts")&&b.community_enabled&&!z,[W,Y]=(0,tt.d6)(),[V,K]=(0,s.eJ)(!1),J=(0,eV._I)("/api/v1/note/p-".concat(u.id,"/restacks?filterForPub=true"),{auto:V||L,deps:[u.id]});(0,s.d4)(()=>{var e,t;!J.isLoading&&(null===(t=J.data)||void 0===t?void 0:null===(e=t.items)||void 0===e?void 0:e.length)&&Y({type:"comments_load",payload:{comments:J.data.items.map(e=>{let{comment:t}=e;return t})}})},[Y,J.isLoading,J.data]);let G=(0,eV._I)("/api/v1/post/".concat(u.id,"/restackers"),{auto:L,deps:[u.id]}),[Q,$]=(0,s.eJ)(""),[ee,et]=(0,s.eJ)(""),en=(0,s.sO)(),eo=h?void 0:function(){let{redirectOverride:e,overrideTitle:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};R(!0),e&&$(e),t&&et(t)},er="undefined"!=typeof window&&new URL(window.location.href);er&&(er.searchParams.set("showRestacks",!0),er.hash="discussion");let el=!!u.videoUpload,ea=!!(!el&&"podcast"===u.type);return(0,l.BX)(l.HY,{children:[(0,l.tZ)(eU.Z,{onVisible:()=>K(!0)}),(0,l.BX)(F.tu,{paddingY:32,gap:z?28:16,id:"discussion",children:[(0,l.BX)(F.tu,{gap:32,className:c()({container:"newsletter"===u.type&&!z,[tg.discussionContainerFP]:z&&!k}),children:[z?(0,l.tZ)(eg.R,{comments:d,post:u,notAllowedToFetchComments:!(0,eu.canSeeComments)(h,u)}):(0,l.tZ)(j.xv.H4,{children:H?P("newsletter"===u.type?"Discussion about this post":el?"Discussion about this video":ea?"Discussion about this episode":"Discussion"):u.comment_count?E("1 Comment","%1 Comments",u.comment_count):P("Comments")}),H&&(0,l.tZ)(D.xu,{alignSelf:"start",children:(0,l.tZ)(e7.Z,{value:L,onChange:e=>{X(e),(0,T.j)(T.FP.POST_DISCUSSION_TOGGLE_CLICKED,{post_id:u.id,tab:e?"restacks":"comments"})},tabs:[{value:!1,label:P("Comments")},{value:!0,label:P("Restacks")}],ariaLabel:P("Select discussion type")})})]}),L?(0,l.BX)(F.tu,{className:"container",paddingTop:16,gap:16,children:[(0,l.tZ)(ti.Ly.Provider,{value:{requireLogin:eo,onboardingModalRef:en,publicationUsers:[],subscriptions:[]},children:(0,l.tZ)(tn.sA,{restackUrl:(0,ec.uRy)(b,u),placeholder:P((0,tm.tq)()?"Write a restack...":"Write a restack about this post to your followers..."),surface:"post-page-restacks-list"})}),(0,l.tZ)(tr.fA,{isOpen:M,onCancel:()=>{R(!1),$(""),et("")},onSuccess:()=>{R(!1),window.history.replaceState(null,"",null==er?void 0:er.toString()),location.reload()},onSignup:()=>{var e;R(!1),null===(e=en.current)||void 0===e||e.open()},redirectOverride:Q,overrideTitle:ee}),(0,l.tZ)(te.ReaderOnboardingModal,{ref:en,user:U.user,step:tu.c.SIGNUP,redirectAfterProfile:!0,skipCategories:!0,redirect:null==er?void 0:er.toString()}),J.isLoading?(0,l.tZ)(O.$j,{}):(null===(t=J.data)||void 0===t?void 0:t.items.length)?(0,l.BX)(F.tu,{gap:16,children:[(0,l.tZ)(F.tu,{children:(0,l.tZ)(eD.$U,{surface:"post-page-restacks-list",dispatch:Y,state:W,children:null===(i=J.data.items)||void 0===i?void 0:i.slice(0,3).map(e=>{var t,i,n,l,a,s;return(0,r._)((0,o._)({},e),{publication:e.publication?null!==(i=W.publications.get(e.publication.id))&&void 0!==i?i:e.publication:null,post:e.post?null!==(n=W.posts.get(e.post.id))&&void 0!==n?n:e.post:null,comment:e.comment?(0,r._)((0,o._)({},null!==(l=W.comments.get(e.comment.id))&&void 0!==l?l:e.comment),{attachments:(null!==(s=null===(t=null!==(a=W.comments.get(e.comment.id))&&void 0!==a?a:e.comment)||void 0===t?void 0:t.attachments)&&void 0!==s?s:[]).filter(e=>{let{type:t,postSelection:i}=e;return"post"!==t||!!i})}):null})}).map(e=>(0,l.tZ)(ez.Bm,{className:tg.feedItem,item:e},e.entity_key))})}),!v()(u.restacks)&&u.restacks-3>0&&(0,l.BX)(F.gq,{gap:8,alignItems:"center",children:[(0,l.tZ)(F.gq,{as:"a",alignItems:"center",cursor:"pointer",href:(0,q.Oiq)(u.id,{urlParams:{utm_source:ep.b3.substack,utm_content:ep.fZ.facepileRestacks}}),children:(0,l.tZ)(e9.H,{users:(null!==(n=G.data)&&void 0!==n?n:[]).filter(e=>{var t,i,n;let{id:o}=e;return!(null===(n=J.data)||void 0===n?void 0:null===(i=n.items)||void 0===i?void 0:null===(t=i.slice(0,3))||void 0===t?void 0:t.some(e=>{let{comment:t}=e;return t.user_id==o}))}).map(e=>(0,r._)((0,o._)({},e),{noLink:!0}))})}),(0,l.BX)(F.gq,{as:"a",gap:4,alignItems:"center",cursor:"pointer",href:(0,q.Oiq)(u.id,{urlParams:{utm_source:ep.b3.substack,utm_content:ep.fZ.facepileRestacks}}),children:[(0,l.tZ)(j.xv.B3,{color:"pub-secondary-text",children:E("See 1 more restack","See %1 more restacks",u.restacks-3)}),(0,l.tZ)(f.Z,{color:"var(--print_secondary_on_web_bg_color, var(--color-fg-secondary))",strokeWidth:1,size:18})]})]})]}):(0,l.tZ)(F.hs,{paddingY:48,justifyContent:"center",alignItems:"center",flex:"grow",children:(0,l.tZ)(to._Y,{className:tg.restackEmpty,icon:(0,l.tZ)(ei,{}),title:P("There are no restacks yet, be the first one to restack the post!")})})]}):(0,l.tZ)(t_,{commentsEnabled:a,comments:d,post:u,isShowsEpisodePage:k,slug:p,user:h,freeSignup:m,freeSignupEmail:g,publication:b,reaction_token:_,onVisible:y,onChangeComment:Z,inlineComments:w,selectionFromQuery:C,imgSelectionFromQuery:B,onChange:S,bannedFromNotes:x,userContext:U})]})]})};class t_ extends a.Component{componentDidMount(){document.addEventListener(er.lO,this.handleFocusInput)}componentWillUnmount(){document.removeEventListener(er.lO,this.handleFocusInput)}render(e,t){let{commentsEnabled:i,inlineComments:n,isShowsEpisodePage:o,post:r,user:a,freeSignup:s,freeSignupEmail:d,publication:c,reaction_token:u,onVisible:p,onChangeComment:h,selectionFromQuery:m,slug:g,onChange:v,bannedFromNotes:f,imgSelectionFromQuery:b}=e,{comments:_,reactionSigninComment:y}=t;if(r.is_geoblocked)return null;let Z=(0,td.HD)({pub:c});if(n)return(0,l.tZ)("div",{id:ta.nK,children:(0,l.tZ)(eJ.rf,{slug:g,user:a,freeSignupEmail:d,freeSignup:s,post:r,publication:c,post_reaction_token:u,selectionFromQuery:m,imgSelectionFromQuery:b,initialComments:_,inline:!0,onChange:v})});let{iPlural:w}=this.I18N,k=async(e,t)=>(0,eJ.o_)({user:a,reactionToken:u,comments:_,id:e,reacted:t,setComments:e=>this.setState({comments:e}),onNeedsSignin:e=>new Promise(t=>this.setState({reactionSigninComment:e.comment},()=>{var e;return null===(e=this.modalRef.current)||void 0===e?void 0:e.open(t)}))}),C=(0,eJ.Os)(r,c);return(!(0,tm.tq)()||(null==a?void 0:a.is_contributor)||(C=(0,ec.K8_)(c.subdomain,r.slug,{params:{comments:!0,utm_source:ep.b3.post,utm_medium:ep.lP.web}})),Z&&!(0,eu.canSeeComments)(a,r))?(0,l.tZ)(ev.C,{post:r,publication:c,user:a,freeSignupEmail:d,showHeader:!1}):(0,l.tZ)("div",{className:"single-post-section comments-section",children:(0,l.BX)("div",{className:Z?o?"":tg.discussionContainerFP:"container",children:[(0,l.tZ)(eU.Z,{onVisible:()=>p("Post Comments Footer")}),i&&(0,l.tZ)(eJ._D,{user:a,freeSignup:s,freeSignupEmail:d,pub:c,post:r,token:u,ref:this.inputRef,bannedFromNotes:f}),_.length>0&&!i&&(0,l.tZ)(eJ.IO,{post:r}),_&&_.length>0&&c.community_enabled&&(0,l.tZ)(eG.AM,{className:"post-page-root-comment-list",user:a,freeSignup:s,freeSignupEmail:d,pub:c,post:r,comments:_,reaction_token:u,onChange:h,updateCommentReacted:k,noRestack:!0},"post:".concat(r.id)),r.comment_count>(_||[]).length&&(0,l.tZ)("a",{className:"more-comments",href:C,children:w("1 more comment...","%1 more comments...",r.comment_count-(_||[]).length)}),y&&(0,l.tZ)(ea.oq,{comment:y,pub:c,user:a,react:()=>k(y.id,!0),modalRef:this.modalRef})]})})}constructor(e,t){super(e,t),(0,n._)(this,"I18N",void 0),(0,n._)(this,"inputRef",void 0),(0,n._)(this,"modalRef",(0,a.createRef)()),(0,n._)(this,"onboardingModalRef",(0,a.createRef)()),(0,n._)(this,"handleFocusInput",void 0),this.I18N=I18N.i({pub:e.publication}),this.inputRef=(0,a.createRef)(),this.handleFocusInput=()=>{var e;null===(e=this.inputRef.current)||void 0===e||e.focus()},this.state={comments:e.comments,reactionSigninComment:null}}}let ty=e=>{let{pub:t,post:i}=e;return i?(0,l.tZ)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:p()((0,tp.Rg)(t,i),{json:!0,isScriptContext:!0})}}):null},tZ=e=>{var t;let{pub:i,post:n,hasPaywall:o}=e;if(!n.videoUpload)return null;let r=(null!==(t=n.videoUpload.preview_duration)&&void 0!==t?t:0)>0;return(0,l.tZ)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:p()((0,tp.L9)(i,n,n.videoUpload,{usePreview:o&&r}),{json:!0,isScriptContext:!0})}})};function tw(e){let{pub:t,post:i,selection:n,imgSelection:o}=e,r=(0,tn.i3)();return(0,s.d4)(()=>{r.open({restackUrl:(0,ec.uRy)(t,i,{urlParams:{selection:n,imgSelection:o}})})},[]),null}},47220:function(e,t,i){i.d(t,{C:()=>r});var n=i(16584),o=i(32351);let r=e=>{let{sitemapHeader:t,sitemapDescription:i,sitemapLinks:r}=e;return(0,n.BX)("div",{className:"container typography sitemap-page",children:[(0,n.tZ)(o.Metadata,{title:t,description:i}),(0,n.tZ)("h1",{children:t}),(0,n.tZ)("div",{children:r.map(e=>(0,n.tZ)("p",{children:(0,n.tZ)("a",{className:"sitemap-link",href:e.href,native:!0,children:e.text})}))})]})}},79408:function(e,t,i){i.d(t,{C:()=>E,Z:()=>I});var n=i(7409),o=i(99282),r=i(58865),l=i(16584),a=i(30396),s=i(14293),d=i.n(s),c=i(32224),u=i(80569),p=i.n(u),h=i(32351),m=i(95441),g=i(68833),v=i(65205),f=i(98914),b=i(15771),_=i(10510),y=i(60308),Z=i(84864),w=i(47929);function k(){let e=(0,r._)(["Substacks recommended by ","",""]);return k=function(){return e},e}function C(){let e=(0,r._)(["Recommended by ",""]);return C=function(){return e},e}function S(){let e=(0,r._)(["By ",""]);return S=function(){return e},e}function x(){let e=(0,r._)(["View all ",""]);return x=function(){return e},e}let B=function(e,t,i,n){let{trackOnly:o=!1,freeSignupEmail:r}=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return async()=>{if((0,g.j)(g.FP.RECOMMENDATION_SUBSCRIBE_BUTTON_CLICKED,{source:"recommendations-page",recommended_publication_id:e.id,recommending_publication_id:t.id}),!o)try{let o=i&&!i.is_magic&&i.email||r;await p().post("/api/v1/free").send({email:o,source:"recommendations_page",first_url:v.xY,first_referrer:v.ip,first_session_url:v.ac,first_session_referrer:v.qR,current_url:v.UE,current_referrer:v.xU,other_publication_id:e.id,referring_pub_id:t.id}),n(e)}catch(e){alert((0,f.zx)(e)||"Something went wrong")}}},P=function(e,t,i){let{trackOnly:n=!1}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return async()=>{if((0,g.j)(g.FP.RECOMMENDATION_UNSUBSCRIBE_BUTTON_CLICKED,{source:"recommendations-page",recommended_publication_id:e.id,recommending_publication_id:t.id}),!n)try{await p().delete("/api/v1/free").send({publication_id:e.id,source:"recommendations_page"}),i(e)}catch(e){alert((0,f.zx)(e)||"Something went wrong")}}},I=e=>{let{pub:t,recommendations:i,allSubscribedPubs:n,fullySubscribedPubs:o,user:r,freeSignupEmail:s}=e,{iString:d,iTemplate:u}=(0,m.M1)(),[p,v]=(0,a.eJ)(n),x=e=>{v([...p,e])},I=e=>{v(p.filter(t=>{let{id:i}=t;return i!==e.id}))};return(0,l.BX)("div",{className:"container",children:[(0,l.tZ)(h.Metadata,{title:u(k(),(0,Z.getByLine)(t)||t.name,(0,Z.getByLine)(t)?" | ".concat(t.name):"")}),(0,l.BX)("div",{className:"recommendations-page-container",children:[(0,l.tZ)("h2",{children:u(C(),(0,Z.getByLine)(t)||t.name)}),(0,l.tZ)("div",{className:"recommended-publications-container",children:i.map(e=>{let i=e.recommendedPublication;if(!i)return;let n="".concat((0,y.SVA)(i),"/?utm_source=").concat(w.b3.recommendationsPage,"&utm_campaign=").concat(t.id),a=(0,y.W1P)(i,{addBase:!0,utm_source:w.b3.recommendationsPage,referring_pub_ids:[t.id],simple:!0}),h=(0,Z.getByLine)(i),m=o.map(e=>{let{id:t}=e;return t}).includes(i.id);return(0,l.tZ)("div",{className:"recommended-publications-text-container with-blurb",children:(0,l.tZ)("div",{className:"recommendation-body",children:(0,l.BX)("div",{className:"publication-content",children:[(0,l.BX)("div",{className:"top-row",children:[(0,l.BX)("a",{className:"left",href:n,onClick:()=>{(0,g.j)(g.FP.PUBLICATION_RECOMMENDATION_LINK_CLICKED,{source:"recommendations-page",recommended_publication_id:i.id,recommending_publication_id:t.id})},children:[(0,l.tZ)(_.wk,{pub:i,size:48}),(0,l.BX)("div",{className:"pub-meta",children:[(0,l.tZ)("div",{className:"publication-title",children:i.name}),!!h&&(0,l.tZ)("div",{className:"publication-author",children:u(S(),h)})]})]}),p.map(e=>{let{id:t}=e;return t}).includes(i.id)?(0,l.tZ)(b.zx,{priority:"secondary",onClick:P(i,t,I,{trackOnly:m}),href:m?(0,y.mGw)(i,{addBase:!0}):void 0,className:"unsubscribe",children:d("Subscribed")}):(0,l.tZ)(b.zx,{priority:"primary",onClick:r&&!r.is_magic&&r.email||s?B(i,t,r,x,{freeSignupEmail:s}):()=>{(0,g.j)(g.FP.RECOMMENDATION_SUBSCRIBE_BUTTON_CLICKED,{source:"recommendations-page",recommended_publication_id:i.id,recommending_publication_id:t.id}),(0,f.uX)(a,{local_navigation:!1})},leading:(0,l.tZ)(c.Z,{size:20}),children:d("Subscribe")})]}),(0,l.tZ)("div",{className:"publication-suggestion-text-area",children:(i.editorial_bio||i.hero_text)&&(0,l.tZ)("div",{className:"publication-description",children:i.editorial_bio||i.hero_text})}),e.description&&(0,l.tZ)(N,{content:e.description,author:(0,Z.getByLine)(t)||t.name})]})})})})})]})]})},N=e=>{let{author:t,content:i}=e;return(0,l.BX)("div",{className:"blurb",children:[(0,l.tZ)("p",{className:"blurb-content",children:i}),(0,l.BX)("p",{className:"blurb-author",children:["- ",t]})]})},T=e=>{var t,i,r;let{recommendation:a,pub:s,signedIn:d,render:c}=e,{recommendedPublication:u}=a,p=(0,y.TJI)(u,{params:{utm_source:w.b3.homepageRecommendations,utm_campaign:s.id},signedIn:d}),h=()=>{(0,g.j)(g.FP.PUBLICATION_RECOMMENDATION_LINK_CLICKED,{recommending_publication_id:s.id,recommended_publication_id:u.id,source:"homepage-recommendations"})},m={pub:u,openInNewTab:!0,belowTheFold:!0};return c?c({pubAvatarProps:m,pubName:u.name,pubAuthor:null===(i=u.author)||void 0===i?void 0:i.name,url:p,onClick:h}):(0,l.tZ)("div",{className:"home-right-col",children:(0,l.tZ)("div",{className:"recommendation-row",children:(0,l.BX)("div",{className:"left",children:[(0,l.tZ)("a",{onClick:h,children:(0,l.tZ)(_.jM,(0,o._)((0,n._)({},m),{size:32}))}),(0,l.BX)("div",{className:"pub-meta",children:[(0,l.tZ)("a",{href:p,target:"_blank",onClick:h,children:u.name}),(0,l.tZ)("div",{className:"pub-author",children:null!==(r=null===(t=u.author)||void 0===t?void 0:t.name)&&void 0!==r?r:""})]})]})})})},E=e=>{let{recommendations:t,numRecommendations:i,pub:n,user:o,render:r,renderRecommendation:s}=e,{iString:c,iTemplate:u}=(0,m.M1)(),p=t.map(e=>(0,l.tZ)(T,{recommendation:e,pub:n,signedIn:!!o,render:s}));return((0,a.d4)(()=>{(0,g.j)(g.FP.PUBLICATION_RECOMMENDATIONS_SHOWN,{source:"pub-home",recommendations:t.map(e=>{let{recommendedPublication:t}=e;return t.id})})},[t]),r)?r({recommendations:p,canManage:!!(null==o?void 0:o.is_admin),manageUrl:(0,y.Li8)(n),hasMore:!d()(i)&&i>t.length,hasMoreUrl:(0,y.kfT)(n),recommendationsCount:i}):(0,l.BX)("div",{className:"home-right-group recommendations",children:[(0,l.BX)("div",{className:"home-right-group-title",children:[(0,l.tZ)("a",{href:(0,y.kfT)(n),children:"Recommendations"}),(null==o?void 0:o.is_admin)?(0,l.tZ)("a",{href:(0,y.Li8)(n),native:!0,children:c("Manage")}):!d()(i)&&i>t.length?(0,l.tZ)("a",{href:(0,y.kfT)(n),native:!0,children:u(x(),i)}):null]}),p]})}},22130:function(e,t,i){i.d(t,{v:()=>Z});var n=i(16584),o=i(94184),r=i.n(o),l=i(95441),a=i(55480),s=i(71e3),d=i(30733),c=i(12844),u=i(58175),p=i(24791),h=i(6070),m=i(60308),g=i(47929),v=i(89043);let f=e=>{let{}=e,{iString:t}=(0,l.M1)();return(0,n.tZ)("div",{className:v.Z.noPodcasts,children:t("No podcasts.")})},b=(e,t,i)=>{let n=e[t.id];return n||(n=(0,m.tS3)(t,{section:null,noSection:!1,addBase:!0,user:null,startAtSubscribeFlow:!i||!i.is_free_subscribed,params:{utm_source:g.b3.allPodcasts}})),n},_=e=>{let{pub:t,user:i,idToMagicLink:o,openInNewTab:r}=e;return"thebulwark"!==t.subdomain?null:(0,n.BX)(u.xv.B3,{translated:!0,paddingTop:16,paddingBottom:16,children:[(0,n.tZ)("a",{href:b(null!=o?o:{},t,i),target:r?"_blank":void 0,rel:"noopener",children:"Click here"})," ","to set up your podcast app for everything in one feed."]})},y=e=>{let{pub:t,user:i,idToMagicLink:o={}}=e,r=[],{iString:s}=(0,l.M1)();(0,p.hK)(t)&&(0,p.hK)(t).forEach(e=>{var n,l;if(!(0,p.aM)({pub:t,section:e}))return;let d=(0,a.d_)({pub:t,section:e});if(!d.title)return;let c={logoUrl:null!==(n=d.artUrl)&&void 0!==n?n:void 0,mainClickUrl:(0,m.UVC)({pub:t,section:e,addBase:!0}),buttonClickUrl:o[e.id]||(0,m.tS3)(t,{section:e,noSection:!1,addBase:!0,user:null,startAtSubscribeFlow:!i||!i.is_free_subscribed,params:{utm_source:g.b3.allPodcasts}}),name:d.title,description:null!==(l=d.description)&&void 0!==l?l:"",buttonText:s("Set up podcast")};r.push(c)}),(0,p.WD)(t)&&r.push((0,c.w)(t,b(o,t,i)));let d=Object.keys(o).length>0||(null==i?void 0:i.is_free_subscribed)?s("Private podcasts"):s("Podcasts"),h=(0,n.tZ)(n.HY,{children:(0,p.Ww)(t)?(0,n.BX)(n.HY,{children:[(0,n.tZ)(c.k,{showButton:!0,items:r}),(0,n.tZ)(_,{pub:t,user:i,idToMagicLink:o})]}):(0,n.tZ)(f,{})});return(0,n.BX)(n.HY,{children:[(0,n.tZ)(u.xv.H4,{paddingTop:20,paddingBottom:8,children:d}),h]})},Z=e=>{let{pub:t,user:i,idToMagicLink:o}=e;return(0,h.VL)({pub:t,includeTheRampart:!0})?(0,n.tZ)("div",{className:r()("page","typography",v.Z.container,v.Z.containerBulwark),children:(0,n.tZ)(s.A,{idToMagicLink:o,pub:t,user:i})}):(0,n.tZ)("div",{className:r()("page","typography",v.Z.container),children:(0,n.tZ)(d.N,{children:(0,n.tZ)(y,{idToMagicLink:o,pub:t,user:i})})})}},64650:function(e,t,i){i.d(t,{G:()=>L});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(94184),s=i.n(a),d=i(98661),c=i(55519),u=i(347),p=i(95441),h=i(68833),m=i(7882),g=i(98914),v=i(15771),f=i(82402),b=i(19081),_=i(38023),y=i(57640),Z=i(58175),w=i(51776),k=i(74312),C=i(60308),S=i(63651),x=i(47929);let B={questionListDisabled:"questionListDisabled-_qB8wZ",dropdown:"dropdown-pEz6Sx"},P=e=>["checkbox","checkbox_freeform","radio","radio_freeform"].includes(e||""),I=e=>["checkbox_freeform","radio_freeform"].includes(e||""),N={container:e=>(0,o._)((0,n._)({},e),{flex:1}),dropdownIndicator:e=>(0,o._)((0,n._)({},e),{color:"var(--color-fg-secondary)"}),control:e=>(0,o._)((0,n._)({},e),{fontSize:14,color:"var(--color-fg-secondary)",boxShadow:"none"}),option:(e,t)=>(0,o._)((0,n._)({},e),{fontSize:14,color:"var(--color-fg-secondary)",backgroundColor:t.isFocused?"var(--color-bg-secondary)":t.isSelected?"var(--color-bg-accent-primary-hover)":"white"}),noOptionsMessage:e=>(0,o._)((0,n._)({},e),{fontSize:14,color:"var(--color-fg-secondary)"})},T=e=>{let{question:t,responseData:i,onChange:a,disabled:s=!1,countries:d}=e,{iString:u}=(0,p.M1)(),h=(0,l.Ye)(()=>{if("country"===t.type&&i.value&&d){let e=String(i.value).split(",")[0],t=d.find(t=>t.countryShortCode===e);return t?{value:t.countryShortCode,label:t.countryName,regions:t.regions}:null}return null},[i.value]),m=(0,l.Ye)(()=>{if("country"===t.type&&(null==h?void 0:h.regions)&&d&&i.value){let e=String(i.value).split(",")[1],t=h.regions.find(t=>t.shortCode===e);return t?{value:t.shortCode,label:t.name}:null}return null},[h,i.value]);return(0,r.BX)(b.tu,{gap:16,children:[(0,r.BX)(Z.xv.H4,{children:[t.displayLabel,t.is_required&&(0,r.tZ)(Z.xv.H4,{as:"span",color:"error",children:"*"})]}),"text"===t.type&&(0,r.tZ)(_.g,{disabled:s,placeholder:u("Type here"),value:String(i.value||""),onChange:e=>{i.value=e.target.value,a(i)}}),"number"===t.type&&(0,r.tZ)(w.oi,{disabled:s,placeholder:u("Type number value here"),value:Number.isNaN(Number(i.value))?"":i.value,onChange:e=>{let t=e.currentTarget.value.replace(/[^\d]/g,"");i.value=Number(t)||0,a(i)}}),"country"===t.type&&(0,r.BX)(b.tu,{gap:24,children:[(0,r.tZ)(c.ZP,{className:B.dropdown,options:null==d?void 0:d.map(e=>({label:e.countryName,value:e.countryShortCode})),onChange:e=>{let t=e.value;a((0,o._)((0,n._)({},i),{value:t}))},value:h,placeholder:u("Select or search for a country..."),noOptionsMessage:()=>u("No options found."),theme:(0,g._I)({primary:"var(--color-fg-secondary)",neutral0:"white"}),isSearchable:!0,styles:N}),i.value&&(null==h?void 0:h.regions)&&(0,r.tZ)(c.ZP,{className:B.dropdown,options:h.regions.map(e=>({label:e.name,value:e.shortCode})),onChange:e=>{let t=e.value;a((0,o._)((0,n._)({},i),{value:"".concat(String(i.value).split(",")[0],",").concat(t)}))},value:m,placeholder:u("Select or search for a state, province, or region..."),noOptionsMessage:()=>u("No options found."),theme:(0,g._I)({primary:"var(--color-fg-secondary)",neutral0:"white"}),isSearchable:!0,styles:N})]}),P(t.type)&&t.options&&t.options.map(e=>(0,r.BX)(b.gq,{as:"label",gap:16,children:[("checkbox"===t.type||"checkbox_freeform"===t.type)&&(0,r.tZ)(f.X,{disabled:s,name:"".concat(t.id,"check"),checked:i.options.indexOf(String(e.id))>-1,onChange:t=>{let r=i.options.filter(t=>t!==String(e.id));t&&r.push(String(e.id)),a((0,o._)((0,n._)({},i),{options:r}))}}),("radio"===t.type||"radio_freeform"===t.type)&&(0,r.tZ)(y.Y,{disabled:s,value:String(e.id),name:"".concat(t.id,"check"),checked:i.options.indexOf(String(e.id))>-1,onClick:t=>{let i=[];t.target.checked&&i.push(String(e.id)),a({value:"",options:i})}}),(0,r.tZ)(Z.xv.B3,{children:e.label})]})),I(t.type)&&(0,r.BX)(b.gq,{as:"label",gap:16,alignItems:"center",children:[("checkbox"===t.type||"checkbox_freeform"===t.type)&&(0,r.tZ)(f.X,{disabled:s,name:"".concat(t.id,"check"),checked:String(i.value).length>0,onChange:e=>{e?a((0,o._)((0,n._)({},i),{value:" "})):a((0,o._)((0,n._)({},i),{value:""}))}}),("radio"===t.type||"radio_freeform"===t.type)&&(0,r.tZ)(y.Y,{disabled:s,value:"text",name:"".concat(t.id,"check"),checked:String(i.value).length>0,onClick:()=>{a({options:[],value:" "})}}),(0,r.tZ)(w.oi,{disabled:s,placeholder:"What is your gender?"===t.label?u("Prefer to self describe"):u("Other..."),value:String(i.value||""),onChange:e=>{i.value=e.currentTarget.value,i.value.length>0&&("radio"===t.type||"radio_freeform"===t.type)&&(i.options=[]),a(i)}})]})]})},E=e=>{let{surveyId:t,user:a,pub:c,token:h=""}=e,{iString:g}=(0,p.M1)(),[f,_]=(0,l.eJ)({}),{result:y,isLoading:w,refetch:N}=(0,m.ib)({pathname:"/api/v1/survey/".concat(t),auto:!0,query:{token:h||void 0}});(0,d.useEffect)(()=>{if(!w&&y&&!E){var e;(null===(e=y.questions)||void 0===e?void 0:e.some(e=>"country"===e.type))&&L()}},[y,w]);let{result:E,fetch:L}=(0,k.Oe)({module:"country-region-data/data.json",onRequest:()=>i.e("6537").then(i.t.bind(i,52727,19)),fetchImmediately:!1}),X=(0,m.ib)({method:"post",pathname:"/api/v1/survey/".concat(t,"/responses"),auto:!1,json:{responses:Object.keys(f).map(e=>({survey_question_id:e,data:f[e]}))},query:{token:h||void 0}}),M=(0,l.I4)(async()=>{X.isLoading||(await X.refetch(),await N())},[X]);if(!y&&!w)return(0,r.tZ)(b.tu,{paddingTop:48,gap:48,children:(0,r.tZ)(Z.xv.H1,{translated:!0,children:"There was an error fetching this survey."})});if(!y)return(0,r.tZ)("div",{});if(y.hasCurrentUserResponded)return(0,r.BX)(b.tu,{paddingTop:48,gap:24,alignItems:"center",justifyContent:"center",children:[(0,r.tZ)(Z.xv.H1,{translated:!0,children:"Thank you!"}),(0,r.tZ)(Z.xv.B3,{translated:!0,children:"Your response has been recorded."})]});let{questions:R=[],title:F}=y,U=!!a,O=a&&a.is_free_subscribed,A=U&&O,D=A&&R.reduce((e,t)=>{let i=!0;if(t.is_required){let e=f[t.id];if("text"===t.type)i=String((null==e?void 0:e.value)||"").length>0;else if("number"===t.type)i=!Number.isNaN(Number(null==e?void 0:e.value));else if("country"===t.type)i=2===String((null==e?void 0:e.value)||"").split(",").length;else if(P(t.type)){let n=e&&Array.isArray(null==e?void 0:e.options)?e.options:[],o=String((null==e?void 0:e.value)||"");i=I(t.type)?n.length>0||o.length>0:n.length>0}}return e&&i},!0);return(0,r.tZ)(u.h,{children:(0,r.BX)(b.tu,{paddingTop:48,gap:48,children:[(0,r.tZ)(Z.xv.H1,{color:"pub-primary-text",children:F}),!U&&(0,r.tZ)(b.gq,{alignItems:"center",justifyContent:"center",borderBottom:"detail",paddingBottom:48,children:(0,r.BX)(b.tu,{border:"detail",padding:24,gap:24,sizing:"border-box",radius:"md",children:[(0,r.BX)(Z.xv.H4,{translated:!0,children:["Sign in to answer this survey from ",I18N.p(c.name)]}),(0,r.tZ)(v.zx,{localNavigation:!1,priority:"primary",href:(0,C.uXE)({for_pub:c.subdomain,redirect:window.location.href}),children:g("Sign in")})]})}),U&&!O&&(0,r.tZ)(b.gq,{alignItems:"center",justifyContent:"center",borderBottom:"detail",paddingBottom:48,children:(0,r.BX)(b.tu,{border:"detail",padding:24,gap:24,sizing:"border-box",radius:"md",children:[(0,r.BX)(Z.xv.H4,{translated:!0,children:["Subscribe to ",I18N.p(c.name)," to answer this survey."]}),(0,r.tZ)(v.zx,{localNavigation:!1,priority:"primary",href:(0,S.W1P)(c,{params:{next:window.location.href,email:a.email,just_signed_up:!0,autoSubmit:!0,utm_source:x.b3.substack,utm_medium:x.lP.email,utm_content:x.fZ.readerSurveySubscribePrompt}}),children:g("Subscribe")})]})}),(A||!c.invite_only)&&(0,r.BX)(b.tu,{gap:48,className:s()({[B.questionListDisabled]:!A}),paddingBottom:48,children:[R.map(e=>{let t=f[e.id]?f[e.id]:{options:[],value:""};return(0,r.tZ)(T,{question:e,responseData:t,disabled:!A,countries:null==E?void 0:E.default,onChange:t=>{_((0,o._)((0,n._)({},f),{[e.id]:t}))}},e.id)}),(0,r.tZ)(v.zx,{disabled:!D,priority:"primary",onClick:M,children:g("Submit")})]})]})})},L=e=>{let{surveyId:t,user:i,pub:n,token:o=""}=e;return(0,d.useEffect)(()=>{(0,h.j)(h.FP.READER_SURVEY_SEEN,{surveyId:t,isLoggedIn:!!i,isSubscribed:null==i?void 0:i.is_free_subscribed})},[t]),(0,r.tZ)("div",{className:"container",children:(0,r.tZ)(E,{surveyId:t,user:i,pub:n,token:o})})}},15959:function(e,t,i){i.d(t,{Z:()=>m});var n=i(16584),o=i(347),r=i(67141),l=i(7882),a=i(33578),s=i(63391),d=i(98422),c=i(15400),u=i(6207),p=i(30733),h=i(6070);function m(e){var t,i,m;let{slug:g,pub:v,user:f,tagPagePreloads:b,utm:_}=e,{isTablet:y}=(0,d.v9)(),Z=(0,l.ib)({pathname:"/api/v1/publication/post-tag/slug/".concat(g),auto:(null==b?void 0:b.slug)!==g,initialResult:(null==b?void 0:b.slug)===g?b.postTag:null,deps:[b,g]}),w=(0,h.kb)({pub:v});return(0,h.HD)({pub:v})?(0,n.tZ)(n.HY,{children:Z.isLoading?(0,n.tZ)(p.N,{children:(0,n.tZ)("p",{className:"main-loader",children:"Loading..."})}):(0,n.tZ)(r.E,{isPodcast:!1,isTagPage:!0,newPosts:(null==b?void 0:b.slug)===g?b.posts:void 0,pub:v,section:null,tag:null!==(m=Z.result)&&void 0!==m?m:void 0,user:f,utm:_})}):(0,n.tZ)(p.N,{columns:w?4:2,children:Z.isLoading?(0,n.tZ)("p",{className:"main-loader"}):(0,n.tZ)(n.HY,{children:(0,n.BX)(o.h,{children:[(0,n.tZ)(u.M,{name:(null===(t=Z.result)||void 0===t?void 0:t.name)||"Page not found",description:null,logoUrl:null,pub:v}),(0,n.tZ)(s.f,{}),(0,n.tZ)(a.O,{user:f,pub:v,renderTabs:w?()=>null:void 0,renderLoading:()=>null,sort:"new",postTagId:null===(i=Z.result)||void 0===i?void 0:i.id,newPosts:(null==b?void 0:b.slug)===g?b.posts:null,source:"tag-archive",utm:_,children:e=>{var t;let{posts:i,linkToComments:o,onClickPost:r}=e;return(0,n.tZ)(c.B,{hideImages:null===(t=v.theme)||void 0===t?void 0:t.hide_images_from_list,hideHorizontalDividers:w,linkToComments:o,posts:i,variant:w?y?"three-column-grid":"four-column-grid":"two-column-list",onClickPost:r})}})]})})})}},12900:function(e,t,i){i.d(t,{H:()=>r});var n=i(16584),o=i(98661);let r=e=>{var t;let{children:i,expanded:r,renderWhenCollapsed:l,onEnter:a,flex:s,gap:d}=e,c=(0,o.useRef)(null),[u,p]=(0,o.useState)(r?"expanded":"collapsed"),[h,m]=(0,o.useState)(null),g="collapsed"===u||"startExpanding"===u||"collapsing"===u,v="expanded"===u||"startCollapsing"===u||"expanding"===u;return(0,o.useEffect)(()=>{r&&"collapsed"===u&&p("startExpanding"),"startExpanding"===u&&c.current&&(m(c.current.offsetHeight),p("expanding"),setTimeout(()=>{p("expanded"),a&&a()},250)),!r&&"expanded"===u&&c.current&&(m(c.current.offsetHeight),p("startCollapsing")),"startCollapsing"===u&&(p("collapsing"),setTimeout(()=>{p("collapsed")},250))},[r,u]),(0,n.tZ)("div",{style:{height:null!==(t=g?0:"expanded"===u?"auto":v?h:void 0)&&void 0!==t?t:void 0,transition:"height ".concat(250,"ms var(--animation-smoothing), opacity ").concat(250,"ms var(--animation-smoothing)"),display:s?"flex":"block",flexDirection:"column",opacity:g?0:v?1:void 0},children:(0,n.tZ)("div",{ref:c,style:{paddingTop:.05,paddingBottom:.05,display:s?"flex":"block",gap:d?"".concat(d,"px"):void 0,flex:"0 0 auto",flexDirection:"column",transition:"transform ".concat(250,"ms var(--animation-smoothing)")},children:("collapsed"!==u||l)&&i})})}},82402:function(e,t,i){i.d(t,{X:()=>m});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(94184),s=i.n(a),d=i(25380),c=i(19081),u=i(5844);let p={xs:{size:12,strokeWidth:3.5},sm:{size:14,strokeWidth:3},default:{size:18,strokeWidth:2.5}},h=e=>p[e]||p.default,m=e=>{var{name:t,size:i="md",checked:a,disabled:p=!1,theme:m="accent",onChange:g,className:v}=e,f=(0,r._)(e,["name","size","checked","disabled","theme","onChange","className"]);let b=h(i);return(0,l.tZ)("label",{className:s()("pencraft",v),children:(0,l.BX)(c.hs,{outline:"detail",sizing:"border-box",radius:"xs",alignItems:"center",justifyContent:"center",position:"relative",shadow:"xs",cursor:p?"not-allowed":"pointer",animate:!0,flex:"auto",tabIndex:-1,className:s()("pencraft",u.Z.checkbox,u.Z[i],p?u.Z.disabled:u.Z.enabled,a?u.Z.checked:u.Z.unchecked,u.Z["theme_".concat(m)]),children:[(0,l.tZ)(d.Z,{size:b.size,strokeWidth:b.strokeWidth,className:u.Z.icon}),(0,l.tZ)("input",(0,o._)((0,n._)({},f),{className:"pencraft",type:"checkbox",role:"checkbox",name:t,"data-testid":t,"data-state":a?"selected":"unselected",checked:a,disabled:p,"aria-label":t,tabIndex:0,onChange:e=>{var t,i;e.preventDefault(),p||g(!a,(0,o._)((0,n._)({},e.target),{name:null!==(i=null===(t=e.target)||void 0===t?void 0:t.name)&&void 0!==i?i:""}))}}))]})})}},96745:function(e,t,i){i.d(t,{Tz:()=>v});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(94184),s=i.n(a),d=i(79774),c=i(98661),u=i(95441),p=i(19081),h=i(51776),m=i(24548),g=i(68686);function v(e){var{className:t,min:i,max:a,value:d,onChange:u,disabled:h,readOnly:v,flex:_="auto",error:y=!1}=e,Z=(0,r._)(e,["className","min","max","value","onChange","disabled","readOnly","flex","error"]);let w=(0,c.useRef)(null);return(0,l.BX)(p.hs,{position:"relative",flex:_,minWidth:0,children:[(0,l.tZ)("input",(0,o._)((0,n._)({},Z),{type:"datetime-local",ref:w,className:s()(t,m.Z.datePicker,g.Z.input,g.Z.inputText,y&&g.Z.error,h&&g.Z.disabled,v&&g.Z.readOnly),value:b(d),min:b(i),max:b(a),onChange:u,disabled:h})),(0,l.tZ)(f,{inputRef:w})]})}let f=e=>{let{inputRef:t}=e,{iString:i}=(0,u.M1)();return(0,l.tZ)(h.cv,{className:m.Z.trailing,onClick:e=>{let{current:i}=t;if(i){var n;e.preventDefault(),e.stopPropagation(),i.focus(),null===(n=i.showPicker)||void 0===n||n.call(i)}},onMouseDown:e=>{e.preventDefault()},children:(0,l.tZ)(d.Z,{size:16,"aria-label":i("Calendar icon")})})};function b(e){return e instanceof Date?"".concat(e.getFullYear(),"-").concat(_(e.getMonth()+1),"-").concat(_(e.getDate()),"T").concat(_(e.getHours()),":").concat(_(e.getMinutes())):e}function _(e){let t=String(e);return t.length<2?"0".concat(t):t}},65523:function(e,t,i){i.d(t,{AM:()=>y,NO:()=>g,ZN:()=>Z,hQ:()=>b,xB:()=>m});var n=i(7409),o=i(16584),r=i(12048),l=i(71375);i(98661);var a=i(29032),s=i(97742),d=i(71068),c=i(15771),u=i(19081),p=i(58175),h=i(23750);let m=e=>{let t,i,{onClose:n,showClose:r=!1,title:l,description:a,icon:s,showDivider:d=!1,alignItems:c="start"}=e;return"center"===c?(t=d?I:B,i=E):(t=d?P:x,i=T),(0,o.BX)(t,{children:[s,(0,o.BX)(i,{children:[l&&(0,o.tZ)(v,{text:l}),a&&(0,o.tZ)(f,{text:a})]}),r&&n&&(0,o.tZ)(b,{onClose:n})]})},g=e=>{let{onClose:t,showClose:i=!1,image:n}=e;return(0,o.BX)(x,{children:[n,i&&t&&(0,o.tZ)(_,{onClose:t})]})},v=e=>{let{text:t}=e;return(0,o.tZ)(r.V.Title,{as:"span",children:(0,o.tZ)(p.xv.B2,{weight:"semibold",color:"primary",children:t})})},f=e=>{let{text:t}=e;return(0,o.tZ)(r.V.Description,{as:"span",children:(0,o.tZ)(p.xv.B3,{color:"secondary",children:t})})},b=e=>{let{onClose:t}=e;return(0,o.tZ)(c.hU,{priority:"quaternary",size:"sm",title:"Close",onClick:t,"aria-label":"close",position:"absolute",className:h.Z.closeButton,children:(0,o.tZ)(l.Z,{size:20})})},_=e=>{let{onClose:t}=e;return(0,o.tZ)(a.C,{children:(0,o.tZ)(c.GI,{priority:"secondary",size:"sm",title:"Close",onClick:t,"aria-label":"close",position:"absolute",className:h.Z.imageCloseButton,children:(0,o.tZ)(l.Z,{size:20})})})},y=e=>{let{icon:t,bg:i}=e;return(0,o.tZ)(w,{bg:i,children:t})},Z=()=>(0,o.tZ)(w,{bg:"accent-orange",children:(0,o.tZ)(s.Z,{height:20})}),w=e=>{let{children:t,bg:i="secondary"}=e;return(0,o.tZ)(u.X2,{display:"flex",flex:"auto",width:48,height:48,bg:i,radius:"sm",alignItems:"center",justifyContent:"center",outline:"detail",children:t})},k={display:"flex",direction:"column",gap:16,paddingX:20,paddingTop:20,alignItems:"start"},C={paddingTop:16,paddingBottom:16,borderBottom:"detail"},S={alignItems:"center"},x=(0,d.zo)((0,n._)({},k)),B=(0,d.zo)((0,n._)({},k,S)),P=(0,d.zo)((0,n._)({},k,C)),I=(0,d.zo)((0,n._)({},k,C,S)),N={display:"flex",direction:"column",gap:4},T=(0,d.zo)((0,n._)({},N)),E=(0,d.zo)((0,n._)({},N,{alignItems:"center",textAlign:"center"}))},43570:function(e,t,i){i.d(t,{D7:()=>v,NH:()=>h,Vp:()=>g});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(94184),s=i.n(a),d=i(98661),c=i(15771),u=i(19081);i(58175),i(76641);var p=i(66327);let h={size:14,strokeWidth:2.5},m={display:"flex",height:20,paddingX:6,paddingY:2,gap:4,fontSize:11,fontWeight:"medium",alignItems:"center"},g=(0,d.forwardRef)((e,t)=>{var{className:i,theme:a="default",priority:d="secondary",leading:h,trailing:g,children:v,fillIcon:f,radius:b="xs",onClick:_,href:y}=e,Z=(0,r._)(e,["className","theme","priority","leading","trailing","children","fillIcon","radius","onClick","href"]);let w=void 0!==_||void 0!==y;return(0,l.BX)(c.kG,(0,o._)((0,n._)((0,o._)((0,n._)({},Z),{className:s()(i,p.Z.tag,p.Z["theme_".concat(a)],p.Z["priority_".concat(d)],w&&p.Z.clickable),onClick:_,href:y,ref:t,radius:b,cursor:w?"pointer":"inherit",tabIndex:w?0:-1}),m),{children:[h&&(0,l.tZ)(u.hs,{className:s()(p.Z.leading,f&&p.Z.fillIcon),alignItems:"center",children:h}),v,g&&(0,l.tZ)(u.hs,{className:s()(p.Z.trailing,f&&p.Z.fillIcon),alignItems:"center",children:g})]}))}),v=(0,d.forwardRef)((e,t)=>{var{className:i,priority:a="primary",leading:d,trailing:h,children:g,fillIcon:v,radius:f="xs",onClick:b,href:_}=e,y=(0,r._)(e,["className","priority","leading","trailing","children","fillIcon","radius","onClick","href"]);let Z=void 0!==b||void 0!==_;return(0,l.BX)(c.kG,(0,o._)((0,n._)((0,o._)((0,n._)({},y),{className:s()(i,p.Z.tag,p.Z.media,p.Z["priority_".concat(a)],Z&&p.Z.clickable),onClick:b,href:_,ref:t,radius:f,cursor:Z?"pointer":"inherit",tabIndex:Z?0:-1}),m),{children:[d&&(0,l.tZ)(u.hs,{className:s()(p.Z.leading,v&&p.Z.fillIcon),alignItems:"center",children:d}),g,h&&(0,l.tZ)(u.hs,{className:s()(p.Z.trailing,v&&p.Z.fillIcon),alignItems:"center",children:h})]}))});v.displayName="MediaTag"},87185:function(e,t,i){i.d(t,{m:()=>l});var n=i(16584),o=i(82876),r=i(17688);let l=e=>{let{details:t,helpText:i,label:l,name:a,options:s,paddingBottom:d,paddingTop:c,flex:u,value:p,disabled:h,onChange:m}=e;return(0,n.tZ)(o.g,{label:l,details:t,helpText:i,paddingTop:c,paddingBottom:d,flex:u,wrapWithLabel:!0,children:(0,n.tZ)(r.i,{name:a,value:p,onChange:e=>{let t=e.target;m(t.value,{name:t.name})},disabled:h,children:s.map(e=>(0,n.tZ)("option",{value:e.value,children:e.label},e.value))})})}},76641:function(e,t,i){i(14293),i(84864)},45783:function(e,t,i){i.d(t,{R3:()=>v,eK:()=>h,rQ:()=>m});var n=i(7409),o=i(99282),r=i(16584),l=i(94184),a=i.n(l),s=i(56743),d=i(2564),c=i(98661),u=i(80026),p=i(68857);let h=function(e){let{inset:t=0,pageSizeAdjust:i=0,initialState:r,scrollFullPage:l=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[a,s]=(0,c.useState)(r||{showLeft:!1,showRight:!1});return(0,c.useEffect)(()=>{let{current:i}=e;if(i){let e=()=>{s(e=>{let r=e;!r.showLeft&&i.scrollLeft>t?r=(0,o._)((0,n._)({},e),{showLeft:!0}):r.showLeft&&i.scrollLeft<=t&&(r=(0,o._)((0,n._)({},e),{showLeft:!1}));let l=i.scrollWidth-i.offsetWidth-4-t;return!r.showRight&&i.scrollLeft=l&&(r=(0,o._)((0,n._)({},e),{showRight:!1})),r})};return i.addEventListener("scroll",e),setTimeout(()=>{e()},50),()=>{i.removeEventListener("scroll",e)}}},[]),{state:a,handleArrowClick:t=>()=>{let{current:n}=e;n&&n.scrollBy({left:t*(l?n.offsetWidth:n.offsetWidth/2-i),behavior:"smooth"})}}};function m(e){let{direction:t,isVisible:i=!0,onClick:n}=e;return(0,r.tZ)(u.hs,{alignItems:"center",justifyContent:"center",position:"absolute",className:a()(p.Z.arrowButtonContainer,p.Z.arrowButtonOffsetContainer,i&&p.Z.visible,p.Z[t]),children:(0,r.tZ)(g,{direction:t,isVisible:i,onClick:n})})}function g(e){let{direction:t,isVisible:i=!0,onClick:n,className:o}=e;return(0,r.tZ)(u.hU,{size:"sm",priority:"quaternary",disabled:!i,className:o,onClick:n,"aria-hidden":!i,"aria-label":i?"left"===t?"Previous":"Next":void 0,children:"left"===t?(0,r.tZ)(s.Z,{}):(0,r.tZ)(d.Z,{})})}function v(e){let{direction:t,isVisible:i=!0,children:n,bg:o="primary"}=e;return(0,r.BX)(u.hs,{alignItems:"center",className:a()(p.Z.arrowButtonContainer,p.Z.arrowButtonOverlaidContainer,i&&p.Z.visible,p.Z[t]),children:[(0,r.tZ)("div",{className:a()(p.Z.overlay,p.Z[o])}),n]})}},3021:function(e,t,i){i.d(t,{E$:()=>U,KL:()=>H,Zx:()=>W,_v:()=>D,au:()=>F,dg:()=>z,kJ:()=>A,rS:()=>j});var n=i(16584),o=i(30396),r=i(94184),l=i.n(r),a=i(71375),s=i(52066),d=i(20160),c=i(1548),u=i(46990),p=i(72241),h=i(50012),m=i(57391),g=i(35543),v=i(95441),f=i(60807),b=i(53678),_=i(68833),y=i(62981),Z=i(98750),w=i(98914),k=i(94874),C=i(17540),S=i(15771),x=i(95901),B=i(19081),P=i(58175),I=i(15503),N=i(40559),T=i(65575),E=i(46464),L=i(60308),X=i(33884),M=i(63651),R=i(25390);let F="inviteFriendsNuxDismissed";function U(e){let{feedUserSuggestion:t,surface:i,hoverCardPlacement:r}=e,{exposeExperiment:s,getExperimentVariant:c}=(0,m.jc)();s("social_context_in_pymk_feed_module_v2");let u=c("social_context_in_pymk_feed_module_v2"),p=(0,o.sO)(null),h=(0,g.Sv)(t.user,i),v=h.isFollowing?"Following":t.isFollowing&&(null==u?void 0:u.startsWith("treatment"))?"Follow Back":"Follow",f=h.isFollowing?"secondary":"primary",_=(0,E.Z)(t),[y,C]=(0,o.eJ)(!1),N="feed"===i?"pymk_notes_feed_item":"suggestions"===i?"pymk_notes_suggestions_page":"pymk_notes_sidebar";(0,Z.UM)(p,()=>{(0,I.MJ)(t,i,{extraEventProps:{has_social_context:!!t.mutualsContext}})});let[T,L]=(0,o.eJ)(!1),X=e=>{T||(L(!0),(0,I.CD)(t,i,e))},F=e=>{X("user-suggestion"),e.defaultPrevented||(0,w.uX)((0,M.NNq)(t.user,{utm_source:N}),{event:e})},U=e=>{e.preventDefault(),X("user-suggestion-cta"),h.toggle()},D=async e=>{e.preventDefault(),X("user-suggestion-dismiss"),C(!0),await fetch("/api/v1/reader/feed/user-suggestions/".concat(t.user.id,"/dismiss"),{method:"POST"})};return y?null:"feed"===i?(0,n.tZ)(d.W,{children:(0,n.BX)(B.tu,{ref:p,className:l()(R.Z.personYouMayKnow,R.Z.personYouMayKnowFeed,(null==u?void 0:u.startsWith("treatment"))&&R.Z.withSocialContext),alignItems:"center",bg:"primary",border:"detail",padding:12,gap:12,radius:"lg",shadow:"md",onClick:F,justifyContent:"space-between",children:[(0,n.tZ)(S.hU,{size:"sm",priority:"tertiary",className:R.Z.close,onClick:D,children:(0,n.tZ)(a.Z,{size:16})}),(0,n.tZ)(k.qE,{user:t.user,size:(null==u?void 0:u.startsWith("treatment"))?100:80}),(0,n.BX)(B.tu,{minWidth:0,flex:"grow",justifyContent:"start",alignSelf:"stretch",children:[(0,n.tZ)(P.xv.B4,{decoration:"hover-underline",weight:"semibold",textAlign:"center",ellipsis:!0,children:(0,n.tZ)(b.xG,{user:t.user,ellipsis:!0,children:t.user.name})}),(null==u?void 0:u.startsWith("treatment"))?t.mutualsContext?(0,n.tZ)(O,{mutualsContext:t.mutualsContext,showFacepile:"treatment-facepile"===u}):(0,n.tZ)(P.xv.B5,{align:"center",color:"secondary",clamp:2,style:{lineHeight:"13px",marginTop:"4px"},children:_}):(0,n.tZ)(P.xv.B4,{align:"center",color:"secondary",ellipsis:!0,children:_})]}),(0,n.tZ)(S.zx,{size:"sm",priority:f,onClick:U,alignSelf:"stretch",justifyContent:"center",children:v})]})}):(0,n.tZ)(A,{user:t.user,source:N,publication:t.publication,label:_,hoverCardPlacement:r,onClick:F,cta:(0,n.BX)(B.gq,{alignItems:"center",gap:8,children:[(0,n.tZ)(S.zx,{size:"sm",priority:f,onClick:U,children:v}),(0,n.tZ)(x.P,{size:"sm",priority:"tertiary",onClick:D})]}),boxRef:p})}function O(e){let{mutualsContext:t,showFacepile:i}=e,{iString:o}=(0,v.M1)(),r=t.users.sort(e=>e.photo_url?1:-1);return 0===r.length?null:(0,n.BX)(B.X2,{alignItems:"center",justifyContent:"center",gap:6,className:R.Z.personYouMayKnowMutuals,children:[i&&(0,n.tZ)(B.X2,{style:{paddingLeft:6},children:r.slice(0,3).map(e=>(0,n.tZ)(B.X2,{as:"a",className:R.Z.facepileLink,href:(0,M.NNq)(e),children:(0,n.tZ)(T.t5,{className:R.Z.facepileFace,src:e.photo_url||(0,L.I4e)(e.id),size:20})},e.id))}),(0,n.BX)(P.xv.B5,{color:"secondary",clamp:2,style:{lineHeight:"13px"},textAlign:i?"left":"center",children:[o("Followed by "),(0,n.tZ)(c.M,{array:r,limit:3,formatter:e=>(0,n.tZ)(b.hh,{href:(0,M.NNq)(e),children:e.name})})]})]})}function A(e){let{user:t,publication:i,label:o,hoverCardPlacement:r,onClick:l,cta:a,source:s,boxRef:d}=e,c=(0,f.aF)(),u=t&&t.id===(null==c?void 0:c.id);return(0,n.BX)(B.hs,{ref:d,className:R.Z.personYouMayKnow,alignItems:"center",justifyContent:"space-between",padding:8,gap:12,onClick:l,radius:"md",flex:"grow",children:[(0,n.BX)(B.hs,{gap:12,minWidth:0,children:[(0,n.tZ)(C.w,{pub:i||void 0,children:(0,n.tZ)(k.xV,{user:t,size:40})}),(0,n.BX)(B.tu,{minWidth:0,justifyContent:"center",children:[(0,n.tZ)(h.C,{subject:t,placement:r,utmSource:s,children:(0,n.tZ)(b.hh,{href:(0,M.NNq)(t),showBack:!0,ellipsis:!0,children:(0,n.tZ)(P.xv.B3,{as:"span",decoration:"hover-underline",weight:"semibold",clamp:1,children:t.name})})}),(0,n.tZ)(P.xv.B4,{color:"secondary",ellipsis:!0,as:i?"a":void 0,decoration:i?"hover-underline":void 0,target:"_blank",rel:"noopener","data-native":!0,onClick:e=>{e.stopPropagation()},href:i?(0,L.TJI)(i):void 0,children:o})]})]}),!u&&a]})}function D(){return(0,n.BX)(B.hs,{className:R.Z.personYouMayKnow,alignItems:"center",padding:8,gap:12,children:[(0,n.tZ)(T.Vm,{type:"circle",className:R.Z.personYouMayKnowImage}),(0,n.BX)(B.tu,{style:{width:"100%"},gap:8,children:[(0,n.tZ)(T.Vm,{type:"bar",width:"80%",height:16}),(0,n.tZ)(T.Vm,{type:"bar",width:"40%",height:16})]})]})}function z(){let[e,t]=(0,y.Z)("facebookPymkNuxDismissed",604800);return e?null:(0,n.tZ)(d.W,{children:(0,n.BX)(B.tu,{className:l()(R.Z.personYouMayKnow,R.Z.personYouMayKnowFeed),border:"detail",alignItems:"center",bg:"primary",padding:12,gap:12,style:{position:"relative"},radius:"md",children:[(0,n.tZ)(x.P,{className:R.Z.close,onClick:t}),(0,n.tZ)(u.Z,{fill:"var(--color-accent-fg-blue)",stroke:"none",height:64,width:64}),(0,n.BX)(B.tu,{alignItems:"center",minWidth:0,flex:"grow",children:[(0,n.tZ)(P.xv.B4,{align:"center",weight:"bold",ellipsis:!0,children:"Connect Facebook"}),(0,n.tZ)(P.xv.B4,{align:"center",color:"secondary",ellipsis:!0,children:"Find your friends"})]}),(0,n.tZ)(S.zx,{size:"sm",priority:"primary",href:(0,M.B6d)({type:"reader2",redirect:(0,L.E2n)()}),style:{backgroundColor:"var(--color-accent-fg-blue)"},localNavigation:!1,onClick:()=>(0,_.j)(_.FP.CONNECT_FACEBOOK_SCREEN_VIEWED,{source:"suggestions"}),children:"Connect"})]})})}function j(){return(0,n.BX)(B.tu,{alignItems:"center",gap:12,paddingX:32,paddingY:8,children:[(0,n.tZ)(s.Z,{size:32,fill:"var(--color-accent-fg-cyan)",stroke:"none"}),(0,n.BX)(B.tu,{alignItems:"center",gap:6,children:[(0,n.tZ)(P.xv.H4,{children:"Find people you know"}),(0,n.tZ)(P.xv.B4,{align:"center",color:"secondary",children:"Connect Twitter to see what the people you follow are reading."})]}),(0,n.tZ)(S.zx,{priority:"primary",href:(0,L.ISD)({type:"reader2",redirect:X.Ds}),localNavigation:!1,style:{backgroundColor:"var(--color-accent-fg-cyan)"},rounded:!0,children:"Connect Twitter"})]})}function H(){let[,e]=(0,y.Z)("sidebarFacebookNuxDismissed");return(0,n.BX)(B.tu,{position:"relative",alignItems:"center",gap:12,paddingX:32,paddingY:8,children:[(0,n.tZ)(x.P,{className:R.Z.close,onClick:()=>{e()}}),(0,n.tZ)(u.Z,{width:40,height:40}),(0,n.BX)(B.tu,{alignItems:"center",gap:6,children:[(0,n.tZ)(P.xv.H4,{children:"Find your friends"}),(0,n.tZ)(P.xv.B4,{align:"center",color:"secondary",children:"Connect Facebook to see what your friends are reading."})]}),(0,n.tZ)(S.zx,{priority:"primary",href:(0,M.B6d)({type:"reader2",redirect:(0,L.E2n)()}),localNavigation:!1,style:{backgroundColor:"var(--color-accent-fg-blue)"},rounded:!0,onClick:()=>(0,_.j)(_.FP.CONNECT_FACEBOOK_SCREEN_VIEWED,{source:"sidebar"}),children:"Connect Facebook"})]})}function W(e){let{utmSource:t}=e,[i,r]=(0,o.eJ)(!1),[l,a]=(0,o.eJ)(!1),{user:s,changeSetting:d}=(0,f.SE)(),[,c]=(0,y.Z)(F),[,u]=(0,y.Z)("sidebarInviteFriendsNuxDismissed");if(!s)return null;let h=()=>{d("invite_friends_nux_dismissed_at",new Date().toISOString()),c()};return(0,n.BX)(n.HY,{children:[(0,n.tZ)(B.tu,{children:(0,n.BX)(B.tu,{alignItems:"center",gap:12,padding:32,className:R.Z.shareProfile,children:[(0,n.tZ)(x.P,{className:R.Z.close,onClick:()=>{h(),u()}}),(0,n.BX)(B.tu,{className:R.Z.avatarContainer,children:[(0,n.tZ)(k.qE,{user:s,size:48}),(0,n.tZ)(B.hs,{className:R.Z.badge,padding:4,children:(0,n.tZ)(p.HA,{className:R.Z.badgeIcon})})]}),(0,n.BX)(B.tu,{alignItems:"center",gap:6,children:[(0,n.tZ)(P.xv.H4,{children:"Invite your friends"}),(0,n.tZ)(P.xv.B4,{align:"center",color:"secondary",children:"Share your profile to help your friends find you on Substack."})]}),(0,n.tZ)(S.zx,{priority:"primary",onClick:()=>{r(!0),(0,_.j)(_.FP.INVITE_FRIENDS_MODAL_SHOWN,{source:t})},rounded:!0,children:"Invite friends"})]})}),(0,n.tZ)(N.N,{isOpen:i,utmSource:t,onClose:()=>{r(!1),l&&h()},setShared:()=>a(!0)})]})}},88817:function(e,t,i){i.d(t,{Ly:()=>r,SJ:()=>a,qr:()=>l});var n=i(6400),o=i(30396);let r=(0,n.createContext)({setChildOptions:()=>{},onboardingModalRef:{current:null},isLoading:!1,subscriptions:[],publicationUsers:[],onPageScroll:()=>void 0,setPinTitle:()=>void 0,setDrawer:()=>null,checkFocus:()=>!1,requireLogin:null});function l(e){let{shouldShowGetAppPill:t=!0,style:i,alwaysPinTitle:n,backAction:r,onRefresh:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=a();return(0,o.bt)(()=>{var o;null===(o=s.setChildOptions)||void 0===o||o.call(s,{title:e,style:i,alwaysPinTitle:n,backAction:r,shouldShowGetAppPill:t,onRefresh:l})},[s,e,i,r,t,l]),(0,o.bt)(()=>{var e;null===(e=s.setPinTitle)||void 0===e||e.call(s,!1)},[]),s}function a(){return(0,o.qp)(r)}},75419:function(e,t,i){i.d(t,{Au:()=>j,i3:()=>H,oC:()=>W,pe:()=>O,sA:()=>U});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(6400),s=i(30396),d=i(94184),c=i.n(d),u=i(13639),p=i(20160),h=i(57391),m=i(95441),g=i(60807),v=i(68733),f=i(68833),b=i(48980),_=i(7882),y=i(97505),Z=i(94874),w=i(15771),k=i(19081),C=i(6490),S=i(58175),x=i(27744),B=i(74312),P=i(88817),I=i(91400),N=i(43254),T=i(50364),E=i(63651),L=i(84864),X=i(47929),M=i(7083);let R={utm_campaign:X.VX.notesPostAppUpsell,utm_source:X.b3.substack};function F(e){var{isOpen:t}=e,a=(0,r._)(e,["isOpen"]);return(0,l.tZ)(C.u_,{className:M.Z.composerModal,isOpen:t,onClose:a.onClose,fullscreenMobile:!0,width:600,children:(0,l.tZ)(B.cr,(0,o._)((0,n._)({},a),{module:"../feed/NoteComposer",resolve:e=>e.NoteComposer,onRequest:()=>Promise.all([i.e("9539"),i.e("5431"),i.e("9027"),i.e("6336"),i.e("5906"),i.e("3686"),i.e("5042"),i.e("5477"),i.e("5456"),i.e("4213")]).then(i.bind(i,5817)),whileLoading:(0,l.tZ)("div",{style:{height:336}})}))})}function U(e){let{disabled:t,parentPubId:i,parentPostId:r,parentCommentId:a,restackUrl:s,placeholder:d,tabId:u,surface:f,initialText:b,className:_,textClassName:y}=e,{iString:C}=(0,m.M1)(),x=H(),B=(0,g.aF)(),{requireLogin:I,onboardingModalRef:N}=(0,P.SJ)(),{getExperimentVariant:T}=(0,h.jc)(),E=(0,v.Fm)({onAddFiles:e=>{x.open({parentPubId:i,parentPostId:r,parentCommentId:a,restackUrl:s,initialFiles:e,tabId:u,surface:f,initialText:b})},acceptFile:v.N1});return(0,l.tZ)(k.tu,(0,o._)((0,n._)({},E.props),{position:"relative",children:(0,l.tZ)(w.kG,{onClick:()=>{if(!t){if(B)x.open({parentPubId:i,parentPostId:r,parentCommentId:a,restackUrl:s,tabId:u,surface:f,initialText:b});else if("control"===(T("homepage_welcome_card_2")||"control"))null==I||I();else{var e;null===(e=N.current)||void 0===e||e.open()}}},disabled:t,radius:"md",resetCss:!0,showFocus:!0,animate:!0,"aria-label":C("New post"),children:(0,l.tZ)(p.W,{children:(0,l.BX)(k.gq,{padding:16,gap:12,radius:"md",alignItems:"center",bg:"primary",border:"detail",shadow:"xs",cursor:"pointer",userSelect:"none",className:c()(M.Z.inlineComposer,E.isDragging&&M.Z.isDragging,_),animate:!0,children:[B?(0,l.tZ)(Z.qE,{size:36,user:B,"aria-hidden":!0}):(0,l.tZ)(k.hs,{flex:"auto",children:(0,l.tZ)(Z.qE,{size:36,"aria-hidden":!0})}),(0,l.tZ)(S.xv.B2,{align:"left",color:"secondary",flex:"grow",ellipsis:!0,className:y,children:d||"What's on your mind?"})]})})})}))}function O(e){let{disabled:t,parentPubId:i,parentPostId:r,parentCommentId:a,placeholder:s,tabId:d,surface:u}=e,p=H(),h=(0,g.aF)(),m=(0,I.XA)(),{requireLogin:f}=(0,P.SJ)(),b=(0,v.Fm)({onAddFiles:e=>{p.open({parentPubId:i,parentPostId:r,parentCommentId:a,initialFiles:e,tabId:d,surface:u})},acceptFile:v.N1});return(0,l.tZ)(k.tu,(0,o._)((0,n._)({},b.props),{children:(0,l.tZ)(w.kG,{onClick:()=>{!t&&(h?p.open({parentPubId:i,parentPostId:r,parentCommentId:a,tabId:d,surface:u}):null==f||f())},disabled:t,resetCss:!0,children:(0,l.BX)(k.gq,{padding:16,gap:12,alignItems:"center",bg:"primary",cursor:"pointer",className:c()(M.Z.mobileInlineComposer,{[M.Z.isDropping]:b.isDragging}),children:[h?(0,l.tZ)(Z.qE,{size:36,user:h}):(0,l.tZ)(k.hs,{flex:"auto",children:(0,l.tZ)(Z.qE,{size:36})}),(0,l.tZ)(S.xv.B3,{align:"left",color:"secondary",flex:"grow",children:s||"What's on your mind?"}),!m&&(0,l.tZ)(A,{})]})})}))}function A(){return(0,l.tZ)(k.hs,{fontSize:14,fontWeight:"semibold",font:"text",style:{backgroundColor:"var(--color-button-primary-bg)",opacity:.5},alignItems:"center",justifyContent:"center",height:40,paddingX:12,radius:"sm",color:"white",children:"Post"})}let D={isOpen:!1,firstComment:void 0},z=(0,a.createContext)({state:D,open:async()=>{throw Error("Not implemented")}});function j(e){var t,r,a;let{children:d}=e,c=(0,g.aF)(),u=!(null==c?void 0:c.name),p=(0,x.I0)(),[v,_]=(0,s.eJ)(D),[Z,w]=(0,s.eJ)(!1),{exposeExperiment:k,getExperimentVariant:S}=(0,h.jc)(),P=(0,g.SE)(),I=(0,s.sO)(),{iString:N}=(0,m.M1)(),{feedItem:T}=v,E=W(T),X=(null==T?void 0:T.type)==="comment"?null!==(r=null===(t=T.parentComments)||void 0===t?void 0:t[0])&&void 0!==r?r:T.comment:null;(0,s.d4)(()=>{c&&Promise.all([i.e("9539"),i.e("5431"),i.e("9027"),i.e("6336"),i.e("5906"),i.e("3686"),i.e("5042"),i.e("5477"),i.e("5456"),i.e("4213")]).then(i.bind(i,5817))},[c]),(0,s.d4)(()=>{v.isOpen&&i.e("6175").then(i.bind(i,21516))},[v.isOpen]),(0,s.d4)(()=>{v.appInstallUsers&&Promise.resolve().then(i.bind(i,83034))}),(0,s.d4)(()=>{v.isOpen&&u&&w(!0)},[I,u,v.isOpen]);let M=(0,s.Ye)(()=>({state:v,open:e=>new Promise((t,i)=>{_((0,o._)((0,n._)({},D,e),{isOpen:!0,resolve:t,reject:i}))})}),[v]),U=function(){var e,t,i;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};null===(t=document.activeElement)||void 0===t||null===(e=t.blur)||void 0===e||e.call(t),null===(i=v.onDismiss)||void 0===i||i.call(v),_((0,n._)((0,o._)((0,n._)({},v),{isOpen:!1}),r))};return(0,l.BX)(z.Provider,{value:M,children:[d,u?(0,l.tZ)(y.Z,{displaySignInModal:Z,onCloseSignInModal:()=>{w(!1),_((0,o._)((0,n._)({},v),{isOpen:!1}))},isStatic:!1,entry:"composer-new-post"}):E?(0,l.tZ)(C.u_,{isOpen:v.isOpen,onClose:()=>U(),width:316,children:(0,l.tZ)(q,{onClose:()=>U(),requirement:E,writerId:null!==(a=null==X?void 0:X.user_id)&&void 0!==a?a:0})}):(0,l.tZ)(F,(0,o._)((0,n._)({},v),{isOpen:v.isOpen,onClose:()=>U(),onSuccess:async e=>{var t,i;let r;if(c&&!c.reader_installed_at&&(null==P?void 0:P.userSettings)&&!P.userSettings.has_seen_notes_post_app_upsell&&(P.changeSetting("has_seen_notes_post_app_upsell",!0),k("app_upsell_after_posting_notes"),"treatment"===S("app_upsell_after_posting_notes")))try{r=await (0,b.rd)("/api/v1/app_install_facepile")}catch(e){r=[]}r?((0,f.j)(f.FP.APP_INSTALL_MODAL_OPENED,R),_((0,o._)((0,n._)({},v),{appInstallUsers:r}))):e.isFirstFeedCommentByUser?_((0,o._)((0,n._)({},v),{firstComment:e})):U(),p({type:v.editComment?"edit_comment":"new_comment",payload:{comment:e}}),null===(t=v.onCompose)||void 0===t||t.call(v,e),null===(i=v.resolve)||void 0===i||i.call(v,e)},onError:v.reject})),(0,l.tZ)(C.u_,{isOpen:v.isOpen&&!!v.firstComment,children:v.firstComment&&(0,l.tZ)(B.cr,{module:"@/frontend/feed/NuxModal",resolve:e=>e.FeedNuxShareFirstNote,onRequest:()=>i.e("6175").then(i.bind(i,21516)),onClose:()=>U(),comment:v.firstComment})}),v.appInstallUsers&&(0,l.tZ)(B.cr,(0,n._)({module:"../components/app_install_modal",resolve:e=>e.AppInstallModal,onRequest:()=>Promise.resolve().then(i.bind(i,83034)),onClose:()=>{U({appInstallUsers:void 0})},isOpen:!!v.appInstallUsers,overrideTitle:v.appInstallUsers.length>0?"Join ".concat((0,L.oxfordComma)([...v.appInstallUsers.map(e=>e.name),"others"]).toString()," in the Substack app"):"Notes is better in the Substack app",overrideCTA:N("Get the app"),width:500,facepileUsers:v.appInstallUsers,showMobileClose:!0},R))]})}function H(){return(0,s.qp)(z)}function W(e){var t,i;let n=(0,g.aF)(),o=null==e?void 0:e.post,r=(null==e?void 0:e.type)=="comment"?null!==(i=null===(t=e.parentComments)||void 0===t?void 0:t[0])&&void 0!==i?i:e.comment:null,{user_id:l}=null!=r?r:{},{reply_minimum_role:a}=null!=r?r:{},s=(0,N.K1)(null!=l?l:0);if(null==a&&(null==o?void 0:o.write_comment_permissions)==="only_paid"&&(a="paid_subscriber"),!l||!a||(null==e?void 0:e.canReply)||r&&n&&(0,T._N)(r,n.id))return null;if(a){if("free_subscriber"===a&&(!s||!["free_subscription","subscribed"].includes(s)))return"free_subscriber";if("paid_subscriber"===a&&"subscribed"!==s)return"paid_subscriber"}return null}function q(e){var t;let{requirement:i,writerId:n,onClose:o}=e,r=(0,g.aF)(),{result:a}=(0,_.ib)({pathname:"/api/v1/user/".concat(n,"/primary-publication"),deps:[n],auto:!0});return(0,l.BX)(k.tu,{padding:16,children:[(0,l.tZ)(k.hs,{justifyContent:"center",paddingTop:16,paddingBottom:20,children:(0,l.tZ)(u.Z,{size:32,color:"var(--color-fg-primary)"})}),(0,l.BX)(k.tu,{gap:20,children:[(0,l.BX)(k.tu,{gap:8,alignItems:"center",children:[(0,l.tZ)(S.xv.H3,{align:"center",children:"free_subscriber"===i?"Subscribers only":"Paid subscribers only"}),a&&(0,l.BX)(S.xv.B3,{color:"secondary",align:"center",children:["To join the conversation,"," ","free_subscriber"===i?"subscribe":"become a paying subscriber"," ","to ",null!==(t=a.name)&&void 0!==t?t:"this publication","."]})]}),(0,l.BX)(k.tu,{gap:8,children:[a&&(0,l.tZ)(w.zx,{priority:"primary",rounded:!0,href:(0,E.W1P)(a,{user:r,addBase:!0,params:{utm_source:X.b3.feedCommentReplyRestriction}}),children:"Subscribe"}),(0,l.tZ)(w.zx,{priority:"secondary",rounded:!0,onClick:o,children:"Cancel"})]})]})]})}},65575:function(e,t,i){i.d(t,{ET:()=>T,EU:()=>L,SC:()=>E,T3:()=>x,Uj:()=>Z,Vm:()=>y.V,_Y:()=>k,eK:()=>h.eK,fG:()=>w,gq:()=>u.gq,mE:()=>N,mb:()=>P,nv:()=>C,pe:()=>I,t5:()=>_.t,tu:()=>u.tu,zr:()=>X});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(98661),s=i(94184),d=i.n(s);i(1852);var c=i(80878);i(98914);var u=i(19081),p=i(58175),h=i(45783),m=i(66611),g=i(76566);i(91400);var v=i(63651),f=i(47929),b=i(28840),_=i(38202),y=i(36889);let Z=(0,a.forwardRef)((e,t)=>{var{isPadded:i=!0,className:a,linkClassName:s}=e,c=(0,r._)(e,["isPadded","className","linkClassName"]);return(0,l.tZ)("div",{ref:t,className:d()(b.Z.linkRow,i&&b.Z.isPadded,a),children:(0,l.tZ)(w,(0,o._)((0,n._)({},c),{className:s}))})});function w(e){var{children:t,className:i,href:a,newTab:s,onClick:p,noAnchor:h,native:m,utmCampaign:g,utmSource:_,isSelected:y}=e,Z=(0,r._)(e,["children","className","href","newTab","onClick","noAnchor","native","utmCampaign","utmSource","isSelected"]);let w="undefined"!=typeof location?location.pathname:"",k=h||null==a?"div":"a",C=a&&(0,v.n1t)(a,{utm_source:_||w,utm_medium:f.lP.reader2,utm_campaign:g});return(0,l.tZ)(u.hs,(0,o._)((0,n._)({as:k,className:d()(b.Z.linkRowA,i,(C||p)&&null==y&&b.Z.isClickable,y&&b.Z.isSelected,null!=y&&b.Z.isSelectable),"data-selected":y,href:C,target:s?"_blank":void 0,onClick:e=>{p&&p(e),!e.defaultPrevented&&h&&C&&(0,c.Q)(e,C,{native:m,newTab:s})},showFocus:!0,animate:!0},Z),{children:t}))}function k(e){let{icon:t,title:i,text:n,action:o,className:r}=e;return(0,l.BX)(u.tu,{gap:16,alignItems:"center",justifyContent:"center",flex:"grow",className:d()(b.Z.zero,r),children:[t,(0,l.BX)(u.tu,{gap:4,children:[(0,l.tZ)(p.xv.B4,{weight:"semibold",color:"primary",children:i}),(0,l.tZ)(p.xv.B4,{color:"secondary",children:n})]}),o]})}function C(e){var{className:t,variant:i,size:o,serif:a,isConstrained:s,maxLines:c=3}=e,u=(0,r._)(e,["className","variant","size","serif","isConstrained","maxLines"]);return(0,l.tZ)("div",(0,n._)({className:d()("reader2-paragraph",i&&"reader2-".concat(i),o&&"reader2-font-".concat(o),a&&"reader2-font-serif",s&&"reader2-clamp-lines reader2-".concat(c,"-lines"),t)},u))}function S(e){let{className:t,children:i}=e;return(0,l.tZ)("div",{className:d()("reader-nav-center",t),children:(0,l.tZ)("div",{className:"reader2-page reader2-font-base",children:i})})}function x(e){let{className:t,scrollRef:i,children:n}=e;return(0,l.tZ)(B,{ref:i,children:(0,l.tZ)(S,{className:t,children:n})})}let B=(0,a.forwardRef)((e,t)=>(0,l.tZ)(g.S,{children:(0,l.tZ)("div",(0,n._)({id:"reader-nav-page-scroll",className:d()("reader-nav-page-scroll",e.className),ref:t},e))}));function P(e){return(0,l.tZ)(u.tu,{bg:"secondary",border:"detail",radius:"md",paddingX:20,paddingY:64,justifyContent:"center",alignItems:"center",flex:"grow",children:(0,l.tZ)(k,(0,n._)({},e))})}function I(e){var{gap:t=16}=e,i=(0,r._)(e,["gap"]);return(0,l.tZ)(u.tu,(0,o._)((0,n._)({},i),{className:d()(b.Z.pageStack,b.Z["gap_".concat(t)])}))}(0,a.forwardRef)((e,t)=>{var{className:i,hasError:a}=e,s=(0,r._)(e,["className","hasError"]);return(0,l.tZ)("input",(0,o._)((0,n._)({className:d()(b.Z.input,a&&b.Z.error,i)},s),{ref:t}))}),(0,m.L)("reader2-page-top"),(0,m.L)(b.Z.pageTopFixed),(0,m.L)("reader2-page-body");let N=(0,m.L)(b.Z.pageStack),T=(0,m.L)("reader2-page-center");(0,m.L)("reader2-modal-title-text"),(0,m.L)("reader2-column"),(0,m.L)("reader2-text-h3"),(0,m.L)("reader2-text-h3 reader2-section-title"),(0,m.L)("reader2-text-h4"),(0,m.L)("reader2-item-title");let E=(0,m.L)("reader2-item-meta");(0,m.L)("reader2-text-b4"),(0,m.L)("reader2-form-error"),(0,m.L)("reader2-subtitle"),(0,m.L)("reader2-separator","hr"),(0,m.L)("reader2-page-section withTitle"),(0,m.L)("reader2-row reader2-split-row"),(0,m.L)("reader2-emphasis-box");let L=(0,m.L)(d()(b.Z.hoverLink,"pencraft"),"a");function X(e){return(0,l.tZ)(L,(0,n._)({target:"_blank"},e))}},46585:function(e,t,i){i.d(t,{KV:()=>d,WS:()=>c});var n=i(16584);i(30396);var o=i(48493),r=i(68494),l=i(95441);i(48980),i(15771);var a=i(44424);i(70379),i(8113),i(97842),i(98012);var s=i(44854);function d(e){let{onMute:t,customLabel:i}=e,{iString:r}=(0,l.M1)();return(0,n.tZ)(a.LY,{leading:(0,n.tZ)(o.Z,{className:s.Z.muteIcon}),content:i||r("Mute"),children:(0,n.tZ)(u,{onMute:t})})}function c(e){let{onClick:t,customLabel:i}=e,{iString:o}=(0,l.M1)();return(0,n.tZ)(a.sN,{leading:(0,n.tZ)(r.Z,{className:s.Z.muteIcon}),onClick:e=>{e.preventDefault(),t()},children:i||o("Unmute")})}function u(e){let{onMute:t}=e,{iString:i}=(0,l.M1)(),o=e=>i=>{i.preventDefault(),t(e)};return(0,n.tZ)(n.HY,{children:[["1hour",i("For 1 hour")],["8hours",i("For 8 hours")],["24hours",i("For 24 hours")],["indefinitely",i("Until I change it")]].map(e=>{let[t,i]=e;return(0,n.tZ)(a.sN,{onClick:o(t),children:i},t)})})}},15503:function(e,t,i){i.d(t,{CD:()=>Z,Eg:()=>u,Gv:()=>C,Kr:()=>k,MJ:()=>y,a2:()=>h,iI:()=>v,qG:()=>_,rw:()=>p,zi:()=>c});var n=i(7409),o=i(99282),r=i(41609),l=i.n(r),a=i(42375),s=i(68833);let d={search:function(e,t){var i;let o=g(e,null!==(i=t.tabId)&&void 0!==i?i:null);(0,s.j)(s.FP.NOTES_SEARCH_RESULT_CLICKED,(0,n._)({module:e.type},o,t))}};function c(e,t){let{extraEventProps:i={},tabId:n,primaryItem:o}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};b("seen",e,t,{extraEventProps:i,tabId:n,primaryItem:o})}function u(e,t,i){let{extraEventProps:r={},tabId:l,primaryItem:a}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};b("seen_for_duration",e,t,{extraEventProps:(0,o._)((0,n._)({},r),{timeVisible:i}),tabId:l,primaryItem:a})}function p(e,t,i){let{extraEventProps:r={},tabId:l,primaryItem:a}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(d[t]){var s;null===(s=d[t])||void 0===s||s.call(d,e,(0,o._)((0,n._)({clicked_element:i},r),{tabId:l,primaryItem:a}))}b("clicked",e,t,{extraEventProps:(0,o._)((0,n._)({clicked_element:i},r),{tabId:l,primaryItem:a})})}function h(e,t){let{extraEventProps:i={},tabId:r,primaryItem:l}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};b("swiped",e,t,{extraEventProps:(0,o._)((0,n._)({},i),{tabId:r,primaryItem:l})})}function m(e){var t,i,n,o,r,l,a,s,d,c;let u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,{primaryItem:p}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{item_primary_entity_key:p&&"entity_key"in p?p.entity_key:"entity_key"in e?e.entity_key:"",item_entity_key:"entity_key"in e?e.entity_key:"",item_type:e.type,item_content_user_id:"comment"in e?e.comment&&e.comment.user_id?e.comment.user_id:0:"post"in e?null!==(s=null===(i=e.post.publishedBylines)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:t.id)&&void 0!==s?s:e.publication.author_id:0,item_context_type:"context"in e?e.context.type:"",item_context_type_bucket:"context"in e&&null!==(d=e.context.typeBucket)&&void 0!==d?d:"",item_context_timestamp:new Date("context"in e?e.context.timestamp:new Date).toISOString(),item_context_user_id:"context"in e?null===(n=e.context.users[0])||void 0===n?void 0:n.id:void 0,item_context_user_ids:"context"in e&&(null!==(c=null===(o=e.context.users)||void 0===o?void 0:o.length)&&void 0!==c?c:0)>0?e.context.users.map(e=>{let{id:t}=e;return t}):[],item_publication_id:"publication"in e?null===(r=e.publication)||void 0===r?void 0:r.id:void 0,item_post_id:null===(l=e.post)||void 0===l?void 0:l.id,item_comment_id:null===(a=e.comment)||void 0===a?void 0:a.id,item_can_reply:!("canReply"in e)||e.canReply,item_source:"frontend",item_model_rank:null,item_model_score:null,tab_id:null!=u?u:void 0,item_module_id:"id"in e?e.id:void 0,followed_user_count:0,subscribed_publication_count:0,is_following:!1,is_explicitly_subscribed:!1}}function g(e,t){let{primaryItem:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"comment"===e.type||"post"===e.type||"featuredCollection"===e.type||"featuredPublication"===e.type?l()(e.trackingParameters)?m(e,t,{primaryItem:i}):e.trackingParameters:m(e,t,{primaryItem:i})}function v(e){let{primaryItem:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,o._)((0,n._)({},e),{trackingParameters:m(e,null,{primaryItem:t})})}let f=new Map([["featuredCollection","featured_collection"],["featuredPublication","featured_publication"]]);function b(e,t,i){let{extraEventProps:o={},tabId:r,primaryItem:l}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=g(t,null!=r?r:null,{primaryItem:l}),d=f.get(t.type);(0,s.j)("seen"===e?s.FP.FEED_ITEM_SEEN:"seen_for_duration"===e?s.FP.FEED_ITEM_SEEN_FOR_DURATION:"swiped"===e?s.FP.FEED_ITEM_SWIPED:s.FP.FEED_ITEM_CLICKED,(0,n._)({surface:i,tabId:r,module:d},a,o))}function _(e,t,i){let{extraEventProps:o={},tabId:r,primaryItem:l}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=g(t,null!=r?r:null,{primaryItem:l}),d=f.get(t.type);(0,s.j)("seen"===e?s.FP.FEED_MODULE_ITEM_SEEN:s.FP.FEED_MODULE_ITEM_CLICKED,(0,n._)({surface:i,tabId:r,module:d},a,o))}function y(e,t){let{extraEventProps:i={}}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};w("seen",e,t,{extraEventProps:i})}function Z(e,t,i){let{extraEventProps:o={}}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};w("clicked",e,t,{extraEventProps:(0,n._)({clicked_element:i},o)})}function w(e,t,i){var o,r,l;let{extraEventProps:a={}}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,s.j)("seen"===e?s.FP.FEED_USER_SUGGESTION_SEEN:s.FP.FEED_USER_SUGGESTION_CLICKED,(0,n._)({suggested_user_id:t.user.id,suggested_publication_id:null!==(r=null===(o=t.publication)||void 0===o?void 0:o.id)&&void 0!==r?r:null,suggestion_source:null!==(l=t.source)&&void 0!==l?l:null,surface:i},t.trackingParameters,a))}function k(e,t){let{tabId:i,noteId:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,s.j)(s.FP.FEED_HIDDEN_ATTACHMENT_SHOWN,{attachmentId:e,reason:t,tabId:i,noteId:n})}function C(e){let{props:t,isModuleItem:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=(0,a.rI)(),r=i?_:b;return i=>{r("clicked",e,o,{extraEventProps:(0,n._)({clicked_element:i},t)})}}},27744:function(e,t,i){i.d(t,{I0:()=>_,K5:()=>S,K6:()=>L,RR:()=>b,_H:()=>y,d6:()=>w,de:()=>C,ev:()=>Z,kc:()=>k});var n=i(7409),o=i(99282),r=i(6400),l=i(30396),a=i(39693),s=i.n(a),d=i(18446),c=i.n(d),u=i(12765),p=i(7882),h=i(98914),m=i(15503),g=i(98012),v=i(33884),f=i(63651);let b=(0,r.createContext)({dispatch:()=>Promise.resolve()});function _(){return(0,l.qp)(b).dispatch}let y={isSigningIn:!1,signInNoExit:!1,pages:[],readingQueue:[],posts:new Map,publications:new Map,referringPubByPostId:{},comments:new Map,inboxItems:new Map,hiddenItems:[],publicationSettings:new Map,publicationRecommendations:new Map,feedItemStats:new Map,activeLiveStreams:[],mutedFeedItems:new Set},Z=(0,r.createContext)(y);function w(){let{initialData:e={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,u.L)(S,e,e=>{let{feedItem:t,readingQueue:i,initialPost:n}=e,o=y;return t&&(o=P(o,t)),i&&(o=T(o,i)),n&&(o=N(o,{posts:[n.post],publications:s()([n.publication,n.referringPub]),publicationSettings:new Map([[n.publication.id,n.publicationSettings]]),recommendationsByPubId:n.referringRecommendation?new Map([[n.referringRecommendation.recommended_publication_id,n.referringRecommendation]]):void 0})),o})}function k(){return(0,l.qp)(Z)}function C(e){let t=k();return!!e&&"entity_key"in e&&t.hiddenItems.includes(e.entity_key)}function S(e,t){var i,r,l,a,s,d,u,b,_,Z,w;switch(t.type){case"sign_in":return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,isSigningIn:t.payload.isSigningIn,signInNoExit:null!==(i=t.payload.signInNoExit)&&void 0!==i&&i});case"page_load":{let{result:i}=t.payload;return(0,o._)((0,n._)({},B(e,i.items)),{lastDispatchType:t.type,pages:(0,p.x8)(e.pages,t)})}case"post_load":{let{post:i,publication:n}=t.payload;return N(e,{posts:[i],publications:[n]})}case"post_like":{let{postId:i,isLiked:n}=t.payload,o=e.posts.get(i);return I(e,t.type,i,(u=o,{reaction:null!=(b=n)?b:!u.reaction,reactions:{"❤":((null===(_=u.reactions)||void 0===_?void 0:_["❤"])||0)+(b?1:-1)}}))}case"post_restack":{let{postId:i,isRestacked:n}=t.payload,o=e.posts.get(i);return o?I(e,t.type,i,(Z=o,{restacked:w=n,restacks:(Z.restacks||0)+(w?1:-1)})):e}case"post_delete":{let{publication:i,post:r}=t.payload,l=new Map(e.posts);l.delete(r.id);let a=new Map([...e.comments].filter(e=>{let[t,i]=e;return i.post_id!==r.id}));return[(0,f.rcW)(r.id,{noBase:!0}),(0,f.mx9)(i,r,{noBase:!0})].includes(window.location.pathname)&&(0,h.uX)(v.Ds,{replace:!0}),(0,o._)((0,n._)({},e),{lastDispatchType:t.type,posts:l,comments:a,pages:e.pages.map(e=>(0,o._)((0,n._)({},e),{result:e.result?(0,o._)((0,n._)({},e.result),{items:e.result.items.filter(e=>{var t;return(null===(t=e.post)||void 0===t?void 0:t.id)!==r.id})}):e.result}))})}case"post_save":{let{postId:i,isSaved:n}=t.payload,o=e.posts.get(i),r=null==n?!(null==o?void 0:o.is_saved):n;return o?I(e,t.type,i,{is_saved:r}):e}case"comment_like":{let{commentId:i,isLiked:l}=t.payload,a=e.comments.get(i);if(!a)return e;return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,comments:E(e.comments,i,(0,o._)((0,n._)({},a),{reaction:l?"❤":void 0,reactions:(0,o._)((0,n._)({},a.reactions),{"❤":((null===(r=a.reactions)||void 0===r?void 0:r["❤"])||0)+(l?1:-1)}),reaction_count:(a.reaction_count||0)+(l?1:-1)}))})}case"comment_restack":{let{commentId:i,isRestacked:r}=t.payload,l=e.comments.get(i);return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,comments:l?E(e.comments,i,(0,o._)((0,n._)({},l),{restacked:r,restacks:(l.restacks||0)+(r?1:-1)})):e.comments})}case"comment_delete":{let{comment:i}=t.payload,r=new Map(e.posts),l=new Map([...e.comments].filter(e=>{let[t,n]=e;return n.id!==i.id&&!new RegExp("(^|.)".concat(i.id,"(.|$)")).test(n.ancestor_path)})),a=r.get(i.post_id),s=i.ancestor_path&&l.get(Number(i.ancestor_path.split(".").pop()));return s?l.set(s.id,(0,o._)((0,n._)({},s),{children_count:(s.children_count||1)-1,children:(s.children||[]).filter(e=>e.id!==i.id)})):a&&r.set(a.id,(0,o._)((0,n._)({},a),{child_comment_count:(a.child_comment_count||1)-1})),[(0,f.Sgq)(i,{noBase:!0})].includes(window.location.pathname)&&(0,h.uX)(v.Ds,{replace:!0}),(0,o._)((0,n._)({},e),{lastDispatchType:t.type,posts:r,comments:l,pages:e.pages.map(e=>(0,o._)((0,n._)({},e),{result:e.result?(0,o._)((0,n._)({},e.result),{items:e.result.items.filter(e=>{var t;return(null===(t=e.comment)||void 0===t?void 0:t.id)!==i.id&&!(e.parentComments||[]).filter(Boolean).map(e=>e.id).includes(i.id)})}):e.result}))})}case"new_post":return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,publications:new Map([...e.publications].concat([[t.payload.publication.id,t.payload.publication]])),posts:new Map([...e.posts].concat([[t.payload.post.id,t.payload.post]])),pages:[{error:null,isLoading:!1,result:{items:[{type:"post",entity_key:(0,v.vy)(t.payload.post.id),publication:t.payload.publication,post:t.payload.post,context:t.payload.context||{}}]}},...e.pages]});case"new_comment":{let{comment:i}=t.payload,r=new Map(e.posts),s=r.get(i.post_id);s&&r.set(s.id,(0,o._)((0,n._)({},s),{child_comment_count:(s.child_comment_count||0)+1}));let d=new Map(e.comments);d.set(i.id,i);let c=((null===(l=i.ancestor_path)||void 0===l?void 0:l.split("."))||[]).map(Number).filter(Boolean).map(e=>d.get(e)||null),u=null!==(a=c[c.length-1])&&void 0!==a?a:null;u&&d.set(u.id,(0,o._)((0,n._)({},u),{children_count:(u.children_count||0)+1,children:[i].concat(u.children||[])}));let p=[{error:null,isLoading:!1,result:{items:[(0,m.iI)({type:"comment",entity_key:(0,v.It)(i.id),comment:i,parentComments:c,publication:null,post:null,canReply:!0,context:{type:"comment",timestamp:new Date().toISOString(),users:[],fallbackReason:"",fallbackUrl:null}})]}},...e.pages];return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,posts:r,comments:d,pages:p})}case"edit_comment":{let{comment:i}=t.payload,r=new Map(e.comments);return r.set(i.id,i),(0,o._)((0,n._)({},e),{lastDispatchType:t.type,comments:r})}case"comments_load":{let{comments:i}=t.payload,r=[],l=i.slice();for(;l.length>0;){let e=l.pop();r.push(e),l.push(...e.children||[])}return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,comments:new Map([...e.comments].concat(r.map(e=>[e.id,e])))})}case"item_load":{let{item:i}=t.payload;return(0,o._)((0,n._)({},P(e,i)),{lastDispatchType:t.type})}case"items_load":{let{items:i}=t.payload;return(0,o._)((0,n._)({},B(e,i)),{lastDispatchType:t.type})}case"new_feed_items":{let i=[...e.pages];if(t.payload.insertLocation){let e={error:null,isLoading:!1,result:{items:t.payload.feedItems}};"prepend"===t.payload.insertLocation?i.unshift(e):"append"===t.payload.insertLocation&&i.push(e)}return(0,o._)((0,n._)({},B(x(e,10),t.payload.feedItems)),{lastDispatchType:t.type,pages:i})}case"items_cull":{let t=null===(d=e.pages.find(e=>{var t;return null===(t=e.result)||void 0===t?void 0:t.originalCursorTimestamp}))||void 0===d?void 0:null===(s=d.result)||void 0===s?void 0:s.originalCursorTimestamp;if(t&&(0,g.Z)(t).isBefore((0,g.Z)().subtract(10,"minutes")))return y;return x(e,10)}case"inbox_load":return T(e,t.payload);case"active_live_streams_load":if(c()(e.activeLiveStreams,t.payload))return e;return(0,o._)((0,n._)({},e),{activeLiveStreams:t.payload.filter(e=>(0,g.Z)(e.liveStream.started_streaming_at).isBefore((0,g.Z)().subtract(1,"minute")))});case"inbox_item_archive":{let{contentKey:i,isArchived:r}=t.payload,l=e.inboxItems.get(i);return(0,o._)((0,n._)({},e),{inboxItems:E(e.inboxItems,i,(0,o._)((0,n._)({},l),{archived_at:r?new Date().toISOString():null}))})}case"item_hide":{let{entityKey:i}=t.payload;return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,hiddenItems:[...e.hiddenItems,i]})}case"item_unhide":{let{entityKey:i}=t.payload;return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,hiddenItems:e.hiddenItems.filter(e=>e!==i)})}case"item_dismiss":{let{entityKey:i}=t.payload;return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,pages:e.pages.map(e=>(0,o._)((0,n._)({},e),{result:e.result?(0,o._)((0,n._)({},e.result),{items:e.result.items.filter(e=>"entity_key"in e&&e.entity_key!==i)}):e.result}))})}case"update_paused_notifications":{let i=new Set([...e.mutedFeedItems,...t.payload.map(e=>e.entity_key)]);return(0,o._)((0,n._)({},e),{mutedFeedItems:i})}case"item_pause_notifications":{let{entityKey:i}=t.payload,r=new Set(e.mutedFeedItems);return r.add(i),(0,o._)((0,n._)({},e),{mutedFeedItems:r})}case"item_unpause_notifications":{let{entityKey:i}=t.payload,r=new Set(e.mutedFeedItems);return r.delete(i),(0,o._)((0,n._)({},e),{mutedFeedItems:r})}}return(0,o._)((0,n._)({},e),{lastDispatchType:t.type,pages:(0,p.x8)(e.pages,t)})}function x(e,t){let i,r=0,l=[];for(let n of e.pages){var a;let e=null===(a=n.result)||void 0===a?void 0:a.items;if(!e||n.error||n.isLoading)break;for(let t of(i=n,e))l.push(t),r++;if(r>t)break}if(!(null==i?void 0:i.result))return e;let s=(0,o._)((0,n._)({},i),{result:(0,o._)((0,n._)({},i.result),{items:l})});return(0,o._)((0,n._)({},e),{pages:[s]})}function B(e,t){let i=new Map(e.publications),r=new Map(e.posts),l=new Map(e.comments),a=new Set(e.mutedFeedItems);for(let e of t){if("publication"in e&&e.publication&&i.set(e.publication.id,e.publication),"post"in e){let{post:t}=e;t&&r.set(t.id,t),e.isMuted&&a.add(e.entity_key)}if("comment"in e){let{comment:t}=e;if(t&&(l.set(t.id,t),t.attachments))for(let e of t.attachments)"post"===e.type&&(r.set(e.post.id,e.post),i.set(e.publication.id,e.publication));e.isMuted&&a.add(e.entity_key)}if("parentComments"in e)for(let t of e.parentComments)t&&l.set(t.id,t)}return(0,o._)((0,n._)({},e),{publications:i,posts:r,comments:l,mutedFeedItems:a})}function P(e,t){var i;return(0,o._)((0,n._)({},e),{posts:t.post?E(e.posts,t.post.id,t.post):e.posts,publications:t.publication?E(e.publications,t.publication.id,t.publication):e.publications,comments:new Map([...e.comments].concat([t.comment,...null!==(i=t.parentComments)&&void 0!==i?i:[]].filter(Boolean).map(e=>[e.id,e]))),feedItemStats:t.feedItemStats&&t.feedItemStats.entity_key?E(e.feedItemStats,t.feedItemStats.entity_key,t.feedItemStats):e.feedItemStats,mutedFeedItems:new Set(t.entity_key&&t.isMuted?[t.entity_key]:void 0)})}function I(e,t,i,r){let l=new Map(e.posts),a=l.get(i);return a&&l.set(a.id,(0,n._)({},a,r)),(0,o._)((0,n._)({},e),{lastDispatchType:t,posts:l})}function N(e,t){let{posts:i,publications:r,publicationSettings:l,recommendationsByPubId:a}=t,s=new Map(e.posts);for(let e of i)s.set(e.id,(0,n._)({},s.get(e.id),e));let d=new Map(e.publications);for(let e of r)d.set(e.id,(0,n._)({},d.get(e.id),e));let c=new Map([...e.publicationSettings.entries(),...l?l.entries():[]]),u=new Map([...e.publicationRecommendations.entries(),...a?a.entries():[]]);return(0,o._)((0,n._)({},e),{posts:s,publications:d,publicationSettings:c,publicationRecommendations:u})}function T(e,t){return(0,o._)((0,n._)({},N(e,t)),{readingQueue:t.inboxItems.map(e=>e.content_key),inboxItems:new Map([...e.inboxItems].concat(t.inboxItems.map(e=>[e.content_key,e]))),referringPubByPostId:(0,n._)({},e.referringPubByPostId,t.referringPubByPostId)})}function E(e,t,i){let n=new Map(e);return n.set(t,i),n}function L(e,t){var i;return(i=e,[t].map(e=>{var t,r,l;return(0,o._)((0,n._)({},e),{publication:"publication"in e&&e.publication?null!==(t=i.publications.get(e.publication.id))&&void 0!==t?t:e.publication:null,post:"post"in e&&e.post?null!==(r=i.posts.get(e.post.id))&&void 0!==r?r:e.post:null,comment:"comment"in e&&e.comment?null!==(l=i.comments.get(e.comment.id))&&void 0!==l?l:e.comment:null,parentComments:"parentComments"in e&&e.parentComments&&e.parentComments.map(e=>e&&i.comments.get(e.id)||null)||[]})}))[0]}},93630:function(e,t,i){i.d(t,{l6:()=>S});var n=i(7409),o=i(99282),r=i(16584),l=i(6400),a=i(30396),s=i(25380),d=i(32224),c=i(60807),u=i(98750),p=i(94874),h=i(15771),m=i(19081),g=i(10510),v=i(58175),f=i(65575),b=i(32189),_=i(64172),y=i(22419),Z=i(67914),w=i(60308),k=i(63651),C=i(47929);function S(e){let{items:t,surface:i,page_num:a=0,focusedPubId:s,onClickItem:d,onItemFirstVisible:c}=e,u=(0,_.Th)(),p=a*y.lq,h=new Map(t.map(e=>{var t,i;let{publication:n}=e;return[n.id,null===(i=u.result)||void 0===i?void 0:null===(t=i.subscriptions)||void 0===t?void 0:t.some(e=>e.publication_id===n.id&&e.membership_state&&(0,Z.hl)(e.membership_state))]}));return(0,r.tZ)(f.tu,{gap:8,children:t.map((e,t)=>{var r;return(0,l.createElement)(x,(0,o._)((0,n._)({},e),{key:e.publication.id,isSubscribed:null!==(r=h.get(e.publication.id))&&void 0!==r&&r,rank:t+p+1,surface:i,isFocused:s===e.publication.id,onClick:d,onFirstVisible:c}))})})}function x(e){let{user:t,publication:i,rank:n,isSubscribed:o,surface:l,isFocused:s,onClick:d,onFirstVisible:h,trackingParameters:b}=e,_=(0,c.aF)(),y=(0,a.sO)(null),Z=!!_&&_.id===(null==t?void 0:t.id);return(0,u.UM)(y,()=>{null==h||h({publication:i,rank:n,trackingParameters:b})}),(0,r.tZ)(f.fG,{id:i.id.toString(),bg:Z||s?"accent-orange":void 0,href:t?(0,k.NNq)(t):(0,w.SVA)(i),onClick:()=>d({publication:i,rank:n,trackingParameters:b}),children:(0,r.BX)(m.hs,{justifyContent:"space-between",flex:"grow",alignItems:"center",paddingX:12,ref:y,children:[(0,r.BX)(m.hs,{gap:16,alignItems:"center",children:[(0,r.tZ)(v.xv.Digit,{minWidth:16,children:n}),t&&(0,r.BX)(r.HY,{children:[(0,r.tZ)(p.qE,{user:t,size:40}),(0,r.BX)(f.tu,{children:[(0,r.tZ)(v.xv.B3,{weight:"semibold",children:t.name}),(0,r.tZ)(v.xv.B4,{color:"secondary",children:i.name})]})]}),!t&&(0,r.BX)(r.HY,{children:[(0,r.tZ)(g.wk,{radius:"full",pub:i,size:32}),(0,r.tZ)(f.tu,{children:(0,r.tZ)(v.xv.B3,{weight:"bold",children:i.name})})]})]}),!Z&&(0,r.tZ)(B,{pub:i,user:t,surface:l,isSubscribed:o,currentUser:_})]})})}function B(e){let{pub:t,user:i,surface:n,isSubscribed:o,currentUser:l}=e,a=(0,_.Th)(),c=(0,b.x)({surface:n})(t);return o?(0,r.tZ)(m.hs,{alignItems:"center",justifyContent:"center",padding:8,children:(0,r.tZ)(s.Z,{size:16,stroke:"var(--color-fg-tertiary)"})}):(0,r.tZ)(h.hU,{priority:"secondary",size:"sm",newTab:!0,href:(0,w.W1P)(t,{addBase:!0,user:l,utm_source:C.b3.substack,utm_medium:C.lP.web,utm_campaign:C.VX.reader2}),onClick:e=>{if(e.stopPropagation(),i){let e="visibilitychange",i=()=>{"visible"===document.visibilityState&&(document.removeEventListener(e,i),a.refetchPublication(t.id))};document.addEventListener(e,i)}c(e)},children:(0,r.tZ)(d.Z,{size:20})})}},73674:function(e,t,i){i.d(t,{T7:()=>y,aG:()=>f,hk:()=>b});var n=i(16584),o=i(30396),r=i(94184),l=i.n(r),a=i(1852),s=i(20160),d=i(86374),c=i(95441),u=i(80026),p=i(49572),h=i(78513),m=i(49883),g=i(92039),v=i(78489);let f=e=>{let{liveStream:t,handle:i,subscriptions:o,setSubscriptions:r}=e,{iString:l}=(0,c.M1)(),s=(0,a.useMediaQuery)({maxWidth:800});return(0,n.BX)(u.sg,{display:i.active||s?"none":"flex",width:400,alignSelf:"stretch",sizing:"border-box",borderLeft:"detail",children:[(0,n.tZ)(u.xv.H4,{padding:16,borderBottom:"detail",userSelect:"none",children:l("Live Chat")}),(0,n.tZ)(b,{liveStream:t}),(0,n.tZ)(p.A,{liveStream:t,subscriptions:o,setSubscriptions:r})]})},b=e=>{let{liveStream:t}=e,[i,r]=(0,o.eJ)([]),[l,a]=(0,o.eJ)(!0),s=(0,o.sO)(null),d=(0,g.rG)(),c=e=>{r(t=>t.find(t=>t.id===e.id)?t:[...t,e].slice(-1e3))};return((0,o.d4)(()=>null==d?void 0:d.listen({["live-stream:".concat(t.liveStream.id)]:e=>{var t,i;let{data:n}=e;(null==n?void 0:null===(t=n.message)||void 0===t?void 0:t.type)==="live-stream:message-sent"&&c(n.message.message),(null==n?void 0:null===(i=n.message)||void 0===i?void 0:i.type)==="live-stream:viewer-count-updated"&&n.message.num_viewers_joined>0&&c(n.message),l&&setTimeout(()=>{s.current&&(s.current.scrollTop=s.current.scrollHeight)},0)}}),[d,t.liveStream.id,l]),(0,o.d4)(()=>{s.current&&!t.liveStreamInformation.desktopPlaybackUrl&&(s.current.scrollTop=s.current.scrollHeight)},[t.liveStreamInformation.desktopPlaybackUrl]),t.liveStreamInformation.desktopPlaybackUrl)?(0,n.BX)(u.sg,{flex:"grow",position:"relative",children:[(0,n.tZ)(_,{ref:s,onScroll:()=>{s.current&&a(32>=Math.abs(s.current.scrollTop))},children:(0,n.tZ)(y,{children:i.map(e=>"user"in e?(0,n.tZ)(h.M,{message:e},e.id):e.num_viewers_joined>0?(0,n.tZ)(h.G,{message:e},e.id):null)})}),(0,n.tZ)(Z,{scrollRef:s,hidden:l})]}):(0,n.tZ)(m.j,{})},_=(0,u.zo)({display:"flex",direction:"column-reverse",flex:"grow",scrollBar:"hidden",overflow:"auto",position:"relative"}),y=(0,u.zo)({display:"flex",direction:"column",padding:16,gap:16}),Z=e=>{let{scrollRef:t,hidden:i}=e;return(0,n.tZ)(s.W,{children:(0,n.tZ)(u.hs,{bg:"primary",radius:"full",className:l()(v.Z.jumpButton,i&&v.Z.hidden),children:(0,n.tZ)(u.hU,{priority:"secondary-outline",rounded:!0,onClick:()=>{setTimeout(()=>{var e;null===(e=t.current)||void 0===e||e.scrollTo({top:t.current.scrollHeight,behavior:"smooth"})},0)},children:(0,n.tZ)(d.Z,{})})})})}},70839:function(e,t,i){i.d(t,{x:()=>E});var n=i(7409),o=i(99282),r=i(58865),l=i(16584),a=i(30396),s=i(69983),d=i.n(s),c=i(25380),u=i(66440),p=i(88812),h=i(95441),m=i(27104),g=i(68833),v=i(48980),f=i(15771),b=i(19081),_=i(6490),y=i(58175),Z=i(51776),w=i(70379),k=i(38202),C=i(63651),S=i(47929),x=i(56199);function B(){let e=(0,r._)([""," added"]);return B=function(){return e},e}function P(){let e=(0,r._)([""," removed"]);return P=function(){return e},e}function I(){let e=(0,r._)([""," updated"]);return I=function(){return e},e}function N(){let e=(0,r._)([""," created"]);return N=function(){return e},e}function T(){let e=(0,r._)(["Manage Substacks (",")"]);return T=function(){return e},e}let E=e=>{let{reads:t,open:i,close:n}=e;return(0,l.tZ)(L,{reads:t,open:i,close:n})},L=e=>{var t,i,r;let{list:s,reads:d,open:p,close:m}=e,{popToast:k}=(0,w.pm)(),{iTemplate:C,iString:S}=(0,h.M1)(),[T,E]=(0,a.eJ)(null!==(t=null==s?void 0:s.name)&&void 0!==t?t:"My list"),[L]=(0,a.eJ)(null!==(i=null==s?void 0:s.slug)&&void 0!==i?i:""),[M,F]=(0,a.eJ)(null!==(r=null==s?void 0:s.publications)&&void 0!==r?r:[]),[U,O]=(0,a.eJ)(!1),A=M?null==d?void 0:d.filter(e=>!(null==M?void 0:M.map(e=>e.id).includes(e.id))):d;(0,a.d4)(()=>{(0,g.j)(g.FP.LIST_MANAGEMENT_MODAL_SEEN,{editing:!!s})},[]);let D=()=>{var e,t;E(null!==(e=null==s?void 0:s.name)&&void 0!==e?e:"My list"),F(null!==(t=null==s?void 0:s.publications)&&void 0!==t?t:[]),O(!1)},z=e=>{F(null==M?void 0:M.filter(t=>t.id!==e.id)),O(!0),(0,g.j)(g.FP.LIST_MANAGEMENT_MODAL_PUBLICATION_REMOVED,{pub_id:e.id}),k(t=>(0,l.tZ)(w.FN,(0,o._)((0,n._)({},t),{Icon:u.Z,text:C(P(),e.name)})))},j=async()=>{let e,t;let i={name:T,slug:L.length>0?L:void 0,publications:null==M?void 0:M.map(e=>e.id)};try{var r;s?(e=C(I(),T),t=await (0,v.rd)("/api/v1/list/".concat(s.id),{method:"PUT",json:i})):(e=C(N(),T),t=await (0,v.rd)("/api/v1/list",{method:"POST",json:i})),(0,g.j)(g.FP.LIST_MANAGEMENT_MODAL_SUBMITTED,{data:i,editing:!!s}),k(t=>(0,l.tZ)(w.FN,(0,o._)((0,n._)({},t),{Icon:c.Z,text:e}))),D(),m(null!==(r=null==t?void 0:t.list)&&void 0!==r?r:{})}catch(e){k(e=>(0,l.tZ)(w.FN,(0,o._)((0,n._)({},e),{text:S("Something went wrong. Please try again")})))}},H=()=>{(0,g.j)(g.FP.LIST_MANAGEMENT_MODAL_CLOSED,{editing:!!s}),D(),m()};return(0,l.BX)(_.u_,{isOpen:p,onClose:H,className:x.Z.modalContainer,children:[(0,l.tZ)(_.xB,{onClose:H,showClose:!0,title:s?S("Edit list"):S("Create new list")}),(0,l.tZ)(_.fe,{children:(0,l.BX)(b.tu,{gap:48,alignItems:"stretch",justifyContent:"start",children:[(0,l.BX)(b.tu,{flex:"grow",gap:8,children:[(0,l.tZ)(y.xv.B3,{translated:!0,weight:"semibold",children:"List Name"}),(0,l.tZ)(Z.oi,{placeholder:S("My List"),value:T,onChange:e=>{E(e.currentTarget.value),U||O(!0)}})]}),(0,l.tZ)(X,{currentPublicationIds:null==M?void 0:M.map(e=>e.id),existingSubscriptions:null==d?void 0:d.map(e=>e.id),possibleSuggestions:A,onAdd:e=>{F([...M,e]),O(!0),(0,g.j)(g.FP.LIST_MANAGEMENT_MODAL_PUBLICATION_ADDED,{pub_id:e.id}),k(t=>(0,l.tZ)(w.FN,(0,o._)((0,n._)({},t),{Icon:c.Z,text:C(B(),e.name)})))},onRemove:z}),M.length>0&&(0,l.tZ)(R,{pubs:M,removePub:z})]})}),(0,l.tZ)(_.mz,{primaryButton:(0,l.tZ)(f.zx,{priority:"primary",disabled:!(U&&T&&M.length>=1),onClick:j,children:(0,l.tZ)(y.xv.B3,{color:"primary",children:s?S("Update"):S("Create")})}),secondaryButton:(0,l.tZ)(f.zx,{priority:"secondary",onClick:H,children:(0,l.tZ)(y.xv.B3,{translated:!0,children:"Cancel"})}),showDivider:!0})]})},X=e=>{let t,{currentPublicationIds:i,existingSubscriptions:n,possibleSuggestions:o,onAdd:r,onRemove:s}=e,{iString:c}=(0,h.M1)(),[u,v]=(0,a.eJ)(""),[f,_]=(0,a.eJ)(),{language:w}=(0,h.M1)(),{allResults:k,onSearch:C,isLoading:S}=(0,m.$)({defaultQuery:u,language:w}),B=new Set(n);(0,a.d4)(()=>{u&&(C(u),(0,g.j)(g.FP.LIST_MANAGEMENT_MODAL_PUBLICATION_SEARCHED,{query:u}))},[u]),(0,a.d4)(()=>{o&&_(d()(o).slice(0,3))},[i,o]);let P=k.results;return t=""===u?[]:P.sort((e,t)=>+!B.has(e.id)-+!B.has(t.id)||P.indexOf(e)-P.indexOf(t)),(0,l.BX)(b.tu,{justifyContent:"start",gap:20,flex:"grow",children:[(0,l.tZ)(y.xv.B3,{translated:!0,align:"left",className:x.Z.fullWidth,weight:"semibold",children:"Add Substacks"}),(0,l.BX)(b.gq,{justifyContent:"space-between",alignItems:"center",children:[(0,l.tZ)(Z.oi,{placeholder:"Search for Substacks",value:u,onChange:e=>v(e.currentTarget.value)}),!!t.length&&(0,l.tZ)("div",{onClick:()=>v(""),children:(0,l.tZ)(p.Z,{width:30,style:{cursor:"pointer"}})})]}),(0,l.tZ)(l.HY,{children:t.length?(0,l.tZ)(b.tu,{flex:"grow",gap:20,justifyContent:"start",paddingTop:4,children:t.map(e=>{let t=null==i?void 0:i.includes(e.id);return(0,l.tZ)(F,{pub:e,buttonText:t?c("Remove"):c("Add"),onClick:t?()=>s(e):()=>r(e)},e.id)})}):u&&S?(0,l.tZ)(y.xv.Meta,{translated:!0,children:"Searching..."}):u&&0===t.length?(0,l.tZ)(y.xv.Meta,{translated:!0,children:"No publications found"}):(0,l.tZ)(M,{pubs:f,onAdd:r,onRemove:s})})]})},M=e=>{let{pubs:t,currentPubs:i,onAdd:n,onRemove:o}=e,{iString:r}=(0,h.M1)();return(null==t?void 0:t.length)?(0,l.BX)(b.tu,{justifyContent:"start",gap:12,children:[(0,l.tZ)(y.xv.Meta,{translated:!0,children:"Suggestions"}),t.map(e=>{let t=null==i?void 0:i.includes(e.id);return(0,l.tZ)(F,{pub:e,buttonText:t?r("Remove"):r("Add"),onClick:()=>{t?o(e):((0,g.j)(g.FP.LIST_MANAGEMENT_MODAL_PUBLICATION_SUGGESTION_ADDED,{pub_id:e.id}),n(e))}},e.id)})]}):(0,l.tZ)(y.xv.Meta,{translated:!0,children:"Search publications to get started"})},R=e=>{let{pubs:t,removePub:i}=e,{iTemplate:n}=(0,h.M1)();return(0,l.BX)(b.tu,{justifyContent:"start",gap:20,flex:"grow",children:[(0,l.tZ)(y.xv.B3,{align:"left",weight:"semibold",children:n(T(),t.length)}),(0,l.tZ)(b.tu,{justifyContent:"start",gap:16,flex:"grow",children:t.map(e=>(0,l.tZ)(F,{pub:e,buttonText:"Remove",onClick:()=>i(e)},e.id))})]})},F=e=>{var t;let{pub:i,buttonText:n,onClick:o,disable:r}=e;return(0,l.tZ)("a",{href:(0,C.n1t)((0,C.SVA)(i),{utm_source:S.b3.listManagementModal}),target:"_blank",rel:"noopener",children:(0,l.BX)(b.gq,{alignItems:"center",justifyContent:"space-between",gap:12,flex:"grow",children:[(0,l.tZ)(k.t,{src:null!==(t=i.logo_url)&&void 0!==t?t:"",width:40,height:40,className:x.Z.previewImage}),(0,l.BX)(b.tu,{minWidth:0,flex:"grow",children:[(0,l.tZ)(y.xv.B4,{weight:"semibold",ellipsis:!0,children:i.name}),(0,l.tZ)(y.xv.B4,{color:"secondary",ellipsis:!0,children:i.author_name})]}),(0,l.tZ)(f.zx,{onClick:e=>{e.preventDefault(),o()},priority:"secondary",disabled:r,children:n})]})})}},39493:function(e,t,i){i.d(t,{K:()=>x,y:()=>B});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(74655),s=i(17876),d=i(38457),c=i(95441),u=i(60807),p=i(7882),h=i(98914),m=i(15771),g=i(19081),v=i(44424),f=i(6490),b=i(58175),_=i(70379),y=i(27744),Z=i(75419),w=i(61412),k=i(33884),C=i(60836),S=i(63651);function x(e){var t,i;let{pub:m,post:g,comment:f,feedItem:b,onRestack:x,tabId:P,surface:I,renderWithoutUser:N=!1}=e,T=(0,u.aF)(),E=(0,_.pm)(),L=(!!T||N)&&!(null==m?void 0:m.hide_post_restacks)&&!(null==m?void 0:m.invite_only),X=!!(null===(t=f||g)||void 0===t?void 0:t.restacked),M=(null===(i=f||g)||void 0===i?void 0:i.restacks)||0,R=(0,y.I0)(),F=(0,Z.i3)(),[U,O]=(0,l.eJ)(!1),A=(0,p.ib)({pathname:"/api/v1/restack/feed"}),{iString:D}=(0,c.M1)(),{nuxModal:z,showRestackNux:j}=B(f&&!f.post_id?"note":f?"comment":"post"),H=async()=>{if(!T){O(!0);return}let e=await A.refetch({method:"POST",json:{postId:f?null:null==g?void 0:g.id,commentId:(null==f?void 0:f.id)||null,tabId:P,surface:I}});if(e instanceof Error){alert((0,h.zx)(e));return}E.popToast(t=>(0,r.tZ)(_.FN,(0,o._)((0,n._)({},t),{text:e.comment?D("Note restacked"):D("Post restacked"),Icon:a.Z,cta:D("View"),href:(0,k.E2)()}))),e.comment?R({type:"comment_restack",payload:{commentId:e.comment.id,isRestacked:!0}}):R({type:"post_restack",payload:{postId:e.post.id,isRestacked:!0}}),j(),null==x||x(!0)},W=async()=>{let e=await A.refetch({method:"DELETE",json:{postId:f?null:null==g?void 0:g.id,commentId:(null==f?void 0:f.id)||null,tabId:P}});if(e instanceof Error){alert((0,h.zx)(e));return}E.popToast(e=>(0,r.tZ)(_.FN,(0,o._)((0,n._)({},e),{text:D("Restack undone"),Icon:s.Z}))),f?R({type:"comment_restack",payload:{commentId:f.id,isRestacked:!1}}):g&&R({type:"post_restack",payload:{postId:g.id,isRestacked:!1}}),null==x||x(!1)},q=async()=>{if(!T){O(!0);return}try{var e;await F.open((0,n._)({feedItem:b,restackUrl:f?(0,C.aE)(g,f,m):(0,S.uRy)(m,g),tabId:P,surface:I},(null==b?void 0:b.type)==="post"&&{mediaClipId:null===(e=b.mediaClip)||void 0===e?void 0:e.id})),j()}catch(e){}};return(0,w.B)({name:"restack-comment",action:()=>{L&&q()}}),{canRestack:L,isRestacked:X,restacks:M,nuxModal:z,loggedOutRestackAttempt:U,menuItems:[X?(0,r.tZ)(v.sN,{leading:(0,r.tZ)(s.Z,{}),onClick:W,children:D("Undo restack")}):(0,r.tZ)(v.sN,{leading:(0,r.tZ)(a.Z,{}),onClick:H,children:D("Restack")}),(0,r.tZ)(v.sN,{leading:(0,r.tZ)(d.Z,{}),onClick:q,children:D("Restack with a note")})]}}function B(e){let t=function(e){let{entityType:t}=e,[i,n]=(0,l.eJ)(!1),o=()=>{n(!1)};return{open:()=>{n(!0)},element:(0,r.tZ)(f.u_,{isOpen:i,onClose:o,children:(0,r.tZ)(P,{onClose:o,entityType:t})})}}({entityType:e}),i=(0,p.ib)({pathname:"/api/v1/feed/has-restacked",auto:!1,cacheTtl:1/0}),n=async()=>{var e;let n=null!==(e=i.result)&&void 0!==e?e:await i.refetch();n instanceof Error||(null==n?void 0:n.hasRestacked)!==!1||(t.open(),i.setResult({hasRestacked:!0}))};return{nuxModal:t.element,showRestackNux:n}}function P(e){let{onClose:t,entityType:i}=e,{iString:n}=(0,c.M1)();return(0,r.BX)(g.tu,{paddingX:16,children:[(0,r.tZ)(g.hs,{justifyContent:"center",paddingTop:32,paddingBottom:24,children:(0,r.tZ)(a.Z,{size:40,stroke:"var(--color-fg-primary)"})}),(0,r.BX)(g.tu,{gap:12,children:[(0,r.BX)(b.xv.H3,{align:"center",children:["comment"===i&&n("You restacked a comment"),"note"===i&&n("You restacked a note"),"post"===i&&n("You restacked a post")]}),(0,r.BX)(b.xv.B3,{color:"secondary",align:"center",children:["comment"===i&&n("Restack comments that inspire you to share them with more people."),"note"===i&&n("Restack notes that inspire you to share them with more people."),"post"===i&&n("Restack posts that inspire you to share them with more people.")," ",n("Subscribers can see your restacks in the Notes tab and on your profile.")]})]}),(0,r.BX)(g.tu,{paddingBottom:16,paddingTop:20,gap:8,children:[(0,r.tZ)(m.zx,{priority:"primary",href:(0,k.E2)(),children:n("View now")}),(0,r.tZ)(m.zx,{priority:"secondary-outline",onClick:t,children:n("OK")})]})]})}},70125:function(e,t,i){i(63018)},64172:function(e,t,i){i.d(t,{Th:()=>v,Y0:()=>b,_V:()=>_,e:()=>g,lV:()=>h,p6:()=>f});var n=i(7409),o=i(99282),r=i(98848),l=i(6400),a=i(30396),s=i(45578),d=i.n(s),c=i(48980),u=i(17440);let p={hasLoadedOnce:!1,publications:[],subscriptions:[],publicationUsers:[],publicationMap:new Map,subscriptionMap:new Map,publicationUserMap:new Map,publicationsWithPledges:[]};function h(e){let{isLoggedIn:t,includePodcasts:i}=e,[r,l]=(0,a.eJ)((0,o._)((0,n._)({},p),{hasLoadedOnce:!t})),s=e=>{l(t=>{let i=d()([...t.publications,...e.publications],e=>e.id),o=d()([...t.subscriptions,...e.subscriptions],e=>e.publication_id),r=d()([...t.publicationUsers,...e.publicationUsers],e=>e.publication_id);return{hasLoadedOnce:!0,publications:i,subscriptions:o,publicationUsers:r,publicationMap:new Map(i.map(e=>[e.id,e])),subscriptionMap:new Map(o.map(e=>[e.publication_id,e])),publicationUserMap:new Map(r.map(e=>[e.publication_id,e])),publicationsWithPledges:[...t.publicationsWithPledges,...e.publicationsWithPledges],latestVoiceoverData:(0,n._)({},t.latestVoiceoverData,null==e?void 0:e.latestVoiceoverData),latestPodcastEpisodeData:(0,n._)({},t.latestPodcastEpisodeData,null==e?void 0:e.latestPodcastEpisodeData)}})};(0,a.d4)(()=>{if("serviceWorker"in navigator){let e=async e=>{var t;if((null===(t=e.data)||void 0===t?void 0:t.type)==="subscriptions-update"){let{payload:t}=e.data;t.ok&&s(t.json)}};return navigator.serviceWorker.addEventListener("message",e),()=>{navigator.serviceWorker.removeEventListener("message",e)}}},[]),(0,a.d4)(()=>{t&&(async()=>{try{for await(let e of y("/api/v1/subscriptions",{query:{include_podcasts:i?"1":void 0},getPageInit(e,t){let i=null==e?void 0:e.nextCursor;return i?(0,o._)((0,n._)({},t),{query:(0,o._)((0,n._)({},t.query),{cursor:i})}):null}}))s(e)}catch(e){console.warn(e)}})()},[t]);let h=(e,t)=>{let{subscription:i,publicationUser:r}=t;l(t=>(t=i?(0,o._)((0,n._)({},t),{subscriptions:t.subscriptions.map(e=>e.publication_id===i.publication_id?i:e),subscriptionMap:(0,u.Rg)(t.subscriptionMap,e,i)}):m(t,e),t=r?(0,o._)((0,n._)({},t),{publicationUsers:function(e,t,i){let n=(e=e.slice()).findIndex(t);return n>=0?e[n]=i:e.push(i),e}(t.publicationUsers,t=>t.publication_id===e,r),publicationUserMap:(0,u.Rg)(t.publicationUserMap,e,r)}):(0,o._)((0,n._)({},t),{publicationUsers:t.publicationUsers.filter(t=>t.publication_id!==e),publicationUserMap:(0,u.i4)(t.publicationUserMap,e)})))},g=async e=>{try{let t=await (0,c.rd)("/api/v1/subscription/".concat(e));h(e,t)}catch(t){t instanceof c.kp&&(404===t.response.status?l(t=>m(t,e)):console.error(t))}};return{result:r,isLoading:!1,hasLoadedOnce:r.hasLoadedOnce,refetch:async()=>r,refetchPublication:g,updatePublication:h,removeByPubId:e=>l(t=>m(t,e))}}function m(e,t){let i=e.subscriptions.filter(e=>e.publication_id!==t);return(0,o._)((0,n._)({},e),{subscriptions:i,subscriptionMap:new Map(i.map(e=>[e.publication_id,e]))})}let g=(0,l.createContext)({result:null,isLoading:!1,hasLoadedOnce:!1,refetch:()=>Promise.resolve(p),refetchPublication:()=>Promise.resolve(),updatePublication(){},removeByPubId:()=>{}});function v(){return(0,a.qp)(g)}function f(e){var t;let{subscriptionMap:i,publicationUserMap:n,publicationsWithPledges:o}=null!==(t=v().result)&&void 0!==t?t:{subscriptionMap:new Map,publicationUserMap:new Map,publicationsWithPledges:[]};return{subscription:i.get(e),publicationUser:n.get(e),is_pledged:!!(null==o?void 0:o.includes(e))}}function b(e){let{subscription:t,publicationUser:i,is_pledged:n}=f(e),o=(null==t?void 0:t.membership_state)==="free_signup",r=(null==t?void 0:t.membership_state)==="subscribed",l=!!(null==t?void 0:t.is_founding),a=!!(i&&["contributor","admin"].includes(i.role));return{subscription:t,publicationUser:i,isFreeSubscribed:o,isPaid:r,isSubscribed:o||r||a,isAuthor:a,isFounding:l,isPledged:n}}function _(e){var t,i;let{publicationUsers:n}=null!==(t=v().result)&&void 0!==t?t:{publicationUsers:[]};return null!==(i=n.find(t=>t.publication_id===e))&&void 0!==i?i:null}async function*y(e,t){var{getPageInit:i}=t,n=(0,r._)(t,["getPageInit"]);let o=await (0,c.rd)(e,n);yield o;let l=i(o,n);for(;null!=l;)o=await (0,c.rd)(e,l),yield o,l=i(o,n)}},91432:function(e,t,i){i.d(t,{Fb:()=>P,lU:()=>B});var n=i(7409),o=i(16584),r=i(30396),l=i(94184),a=i.n(l),s=i(86657),d=i(29032),c=i(95441),u=i(98422),p=i(71068),h=i(19081),m=i(4158),g=i(14283),v=i(18618),f=i(54480),b=i(28226),_=i(70958),y=i(61404),Z=i(43905),w=i(24791),k=i(6070),C=i(31377),S=i(93370),x=i(73015);let B=e=>{let{isFreeSubscribed:t,isSubscribed:i,isTesting:n,post:l,pub:a,section:s,variant:d,reaction_token:c,trackingProps:u}=e,[p,h]=(0,r.eJ)(!1),m=(0,r.sO)(null),g=!i&&(0,C.isPaidAudience)(l.audience);if(!l.podcastUpload)return null;let v=(0,k.lp)({post:l}),f=l.podcastUpload.is_free_preview,_=!v&&g&&(p||!f&&"notes-embed"!==d)&&!(0,w.sv)({post:l});return(0,o.BX)(o.HY,{children:[(0,o.tZ)(N,{audioFileUrl:l.podcast_url,audioPlayerRef:m,metricsPost:l,hidePreviewUI:v,paywallComponent:_?(0,o.tZ)(b.Y,{inlineIcon:"notes-embed"===d,isFreeSubscribed:t,post:l,pub:a,medium:"audio",variant:"overlay",onRestart:f?()=>{var e;(null===(e=m.current)||void 0===e?void 0:e.player)&&(h(!1),m.current.player.currentTime=0,m.current.player.play())}:void 0,magicToken:c}):void 0,podcastDuration:l.podcast_duration,podcastUpload:l.podcastUpload,post:l,postId:l.id,postTitle:l.title,pub:a,section:s,showPaidLabel:g&&!f,user:null,variant:d,onFinishAudio:()=>{h(!0)},useBlur:!0,trackingProps:u}),n&&(0,o.tZ)("button",{onClick:()=>{h(!0)},children:"finish audio"})]})},P=e=>{var t;let{audioPlayerRef:i,explicitHeight:n,explicitPodcastUrl:l,feedUrl:a,hasPaywall:s,isPrivateFeed:d,isServingFreePodcastUrl:c,post:u,pub:p,radius:h,section:m,ufiComponent:g,user:v,freeSignup:f,reaction_token:_}=e,[y,Z]=(0,r.eJ)(!1),w=(0,k.lp)({post:u}),C=null===(t=u.podcastUpload)||void 0===t?void 0:t.is_free_preview,S=!w&&s&&(!C||y)&&!c;return(0,o.tZ)(N,{audioFileUrl:u.podcast_url,audioPlayerRef:i,feedUrl:a,explicitHeight:n,explicitPodcastUrl:l,hidePreviewUI:w,isPrivateFeed:d,isServingFreePodcastUrl:c,metricsPost:u,paywallComponent:S?(0,o.tZ)(b.Y,{isFreeSubscribed:!!(null==v?void 0:v.is_free_subscribed)||!!f,post:u,pub:p,medium:"audio",variant:"overlay",onRestart:C?()=>{var e;(null===(e=i.current)||void 0===e?void 0:e.player)&&(Z(!1),i.current.player.currentTime=0,i.current.player.play())}:void 0,magicToken:_}):void 0,podcastDuration:u.podcast_duration,podcastUpload:u.podcastUpload,post:u,postId:u.id,postTitle:u.title,pub:p,radius:h,section:m,ufiComponent:g,user:v,variant:"episode-page",onFinishAudio:()=>{Z(!0)}})},I={"episode-page":400,editor:320,"notes-embed":128,"notes-full":250},N=e=>{var t,i,r;let{audioFileUrl:l,audioPlayerRef:b,explicitHeight:w,explicitPodcastUrl:k,feedUrl:C,hasFreePodcastUrlSet:B,hidePreviewUI:P,hideUfi:N,isPrivateFeed:T,isServingFreePodcastUrl:E,metricsPost:L,postId:X,postTitle:M,podcastDuration:R,pub:F,podcastUpload:U,radius:O,section:A,showPaidLabel:D,podcastPreviewUpload:z,post:j,ufiComponent:H,editComponent:W,paywallComponent:q,variant:Y,user:V,onFinishAudio:K,useBlur:J,trackingProps:G}=e,{isMobile:Q}=(0,u.v9)(),{iString:$}=(0,c.M1)(),ee=A?null!==(t=A.podcastPalette)&&void 0!==t?t:null:null!==(i=F.podcastPalette)&&void 0!==i?i:null,{title:et,backgroundUrl:ei,artUrl:en}=(0,Z.Mv)({pub:F,podcastUpload:U,section:A,thumbnailInfo:(null==U?void 0:U.full_podcast_info)&&X?{post_id:X,media_upload_id:U.full_podcast_info.media_upload_id,thumbnail_id:U.full_podcast_info.thumbnail_id}:null}),eo=null!=w?w:I[Y],er="notes-embed"===Y,el=Q||er,ea=!!q,es=J||en===ei,ed=!!W,ec=(null==U?void 0:U.is_free_preview)||z;return(0,o.tZ)(s.Z,{ref:b,duration:R,metricsPost:L,preventSnappingToCurrentTime:!0,pub:F,skipPreloading:E,src:l,updateOnEveryFrame:R<300,onFinishAudio:K,mediaUpload:null!=U?U:void 0,trackingProps:(0,n._)({contentType:"post",entityType:"post",entityKey:null!==(r=null==j?void 0:j.id)&&void 0!==r?r:"unknown",surface:"editor"===Y?"editor":"post"},G),render:e=>{var t;let{currentTime:i,dragTime:n,isPlaying:r,playbackRate:s,progress:c,progressBarRef:u,progressBarOnMouseDown:b,remainingTime:Z,setPlaybackRate:w,skipBack:I,skipForward:L,togglePlayback:X}=e;return(0,o.tZ)(d.C,{children:(0,o.BX)(p.xu,{position:"relative",style:{minHeight:Q?Math.min(200,eo):eo},children:[(0,o.tZ)(m.z,{backgroundUrl:er?null:ei,blurAmount:er?40:120,isBlurred:es,palette:ee,radius:O}),(0,o.BX)(h.tu,{position:"absolute",inset:0,justifyContent:el?"space-between":void 0,children:[(0,o.BX)(h.gq,{alignItems:"stretch",flex:el?void 0:"grow",justifyContent:"space-between",children:[(!el||!ea)&&(0,o.tZ)(p.xu,{padding:el||"notes-full"===Y?16:24,paddingBottom:"notes-embed"===Y?0:void 0,overflow:"hidden",flex:"grow",children:(0,o.tZ)(g.o,{isDisabled:ea,explicitPodcastUrl:k,pub:F,post:j,postTitle:M,section:A,showUpgradeButton:E,showTitle:et,variant:"notes-embed"===Y?"notes-embed":Q||"notes-full"===Y?"mini":"regular"})}),!el&&!ea&&!N&&H&&(0,o.tZ)(h.gq,{alignItems:"center",paddingX:24,children:H}),null!=W?W:null]}),!ea&&"notes-embed"!==Y&&(0,o.tZ)(h.tu,{paddingX:16,position:el?void 0:"absolute",className:a()({[x.Z.controlsCentered]:!el}),children:(0,o.tZ)(f.n,{audioFileUrl:l,feedUrl:C,isPlaying:null!=r&&r,isPrivateFeed:!!T,playbackRate:s,sectionId:A?A.id:null,user:V,onChangePlaybackRate:w,onSkipBack:I,onSkipForward:L,onTogglePlayback:X})}),(!el||!ea)&&(0,o.BX)(h.gq,{className:a()(x.Z.track),alignItems:"center",gap:16,opacity:ea?20:void 0,padding:el||"notes-full"===Y?16:24,paddingTop:"notes-embed"===Y?8:void 0,pointerEvents:ea?"none":void 0,onClick:e=>{D||(e.stopPropagation(),e.preventDefault())},children:[ec&&ed&&z&&(0,o.tZ)(_.l,{children:(0,S.DL)(null!==(t=z.duration)&&void 0!==t?t:0)}),ec&&!P&&!ed&&(0,o.tZ)(_.l,{children:$("Preview")}),D&&(0,o.tZ)(_.l,{children:$("Paid")}),B&&(0,o.tZ)(_.l,{children:$("Free url set")}),(0,o.tZ)(y.w,{containerRef:u,currentTime:i,dragTime:n,hideStartingTimestamp:Q,progress:c,remainingTime:Z,onMouseDown:b}),"notes-embed"===Y&&(0,o.tZ)(v.D,{isPlaying:null!=r&&r,size:40,onTogglePlayback:X})]})]}),q]})})}})}},43905:function(e,t,i){i.d(t,{Mv:()=>_,U6:()=>k,a9:()=>x,bf:()=>w,mr:()=>T,nK:()=>I,tc:()=>S,ty:()=>P,wq:()=>N});var n=i(7409),o=i(99282),r=i(58865),l=i(39693),a=i.n(l),s=i(24350),d=i.n(s),c=i(49995),u=i(68833),p=i(55480),h=i(98914),m=i(24791),g=i(31377),v=i(60308),f=i(63651);function b(){let e=(0,r._)(['Invalid URL. URL should start with "','"']);return b=function(){return e},e}let _=e=>{let{pub:t,podcastUpload:i,section:r,thumbnailInfo:l,useSection:a}=e;if(a){let e=r?(0,f.Ucy)(t,{section:r}):(0,f.SVA)(t);return r?{artUrl:r.logo_url,backgroundUrl:r.cover_photo_url,description:r.description,paidArtUrl:null,title:r.name,url:e}:{artUrl:t.logo_url,backgroundUrl:t.cover_photo_url,description:null,paidArtUrl:null,title:t.name,url:e}}let{title:s,description:d,artUrl:c,paidEpisodeArtUrl:u}=r&&!a?(0,p.d_)({pub:t,section:r}):(0,p.jU)({pub:t}),h=r?(0,f.Ucy)(t,{section:r}):(0,f.SVA)(t),m=c;if(i&&l&&l.thumbnail_id>1){let e=(0,v.kOB)((0,o._)((0,n._)({},i),{id:l.media_upload_id,post_id:l.post_id,thumbnail_id:l.thumbnail_id}));e&&(m=e)}else if(i&&i.thumbnail_id>1){let e=(0,v.kOB)(i);e&&(m=e)}return{artUrl:c,backgroundUrl:m,description:d,paidArtUrl:null!=u?u:null,title:s,url:h}},y=[{key:"apple_podcasts",label:"Apple Podcasts",fieldName:"apple_podcasts_url"},{key:"spotify",label:"Spotify",fieldName:"spotify_url"},{key:"spotify_for_paid_users",label:"Spotify",fieldName:"spotify_for_paid_users_url"},{key:"youtube_music",label:"YouTube Music",fieldName:"youtube_music_url"},{key:"youtube",label:"YouTube",fieldName:"youtube_url"},{key:"overcast",label:"Overcast",fieldName:"overcast_url"},{key:"pocket_casts",label:"Pocket Casts",fieldName:"pocket_casts_url"}],Z=e=>{let{platform:t,feedUrl:i,isApple:n,isMobile:o}=e;return i?"apple_podcasts"===t&&n?"podcast://".concat((0,v.G1C)(i)):"overcast"===t&&o?"overcast://x-callback-url/add?url=".concat(encodeURIComponent(i)):"pocket_casts"===t&&o?"pktc://subscribe/".concat((0,v.G1C)(i)):null:null},w=e=>{let{feedUrl:t,isApple:i,isMobile:n,showLinks:o,userIsSubscribed:r}=e,l=[],a=d()(y,"key"),s=!1;for(let e of y){let d;if(["spotify","spotify_for_paid_users","spotify_open_access"].includes(e.key)){if(s)continue;let e=function(e){let{showLinks:t,userIsSubscribed:i}=e;return i&&t.spotify_for_paid_users_url?{label:"Spotify",platform:"spotify_for_paid_users",url:t.spotify_for_paid_users_url}:!i&&t.spotify_url?{label:"Spotify",platform:"spotify",url:t.spotify_url}:t.spotify_open_access_url?{label:"Spotify",platform:"spotify",url:t.spotify_open_access_url}:null}({showLinks:o,userIsSubscribed:r});if(e){l.push(e),s=!0;continue}}if(r&&"youtube"!==e.key)d=Z({platform:e.key,feedUrl:t,isApple:i,isMobile:n});else{var c;d=null!==(c=o[e.fieldName])&&void 0!==c?c:Z({platform:e.key,feedUrl:t,isApple:i,isMobile:n})}d&&l.push({label:a[e.key].label,platform:e.key,url:d}),"spotify"===e.key&&o.spotify_open_access_url&&l.push({label:"Spotify",platform:"spotify_open_access",url:o.spotify_open_access_url})}return l},k=e=>{let{feedUrl:t,isApple:i,isMobile:n,render:o,showLinks:r,user:l,analyticsSource:s="shows_episode_page"}=e,p=d()(y,"key");return a()([...w({feedUrl:t,isApple:i,isMobile:n,showLinks:r,userIsSubscribed:!!(null==l?void 0:l.is_subscribed)}).map(e=>{let i="spotify_open_access"===e.platform?"Spotify":p[e.platform].label;return o({key:e.platform,label:i,url:e.url,onClick:()=>{(0,u.j)(u.FP.PODCAST_APP_LINK_CLICK,{appName:i,feedUrl:t,url:e.url,source:s}),n||window.open(e.url,"_blank")}})}),t&&o({key:"rss",label:"RSS Feed",url:t,onClick:()=>{(0,u.j)(u.FP.PODCAST_FEED_URL_COPIED,{feedUrl:t,source:s}),(0,c.ZP)("RSS feed URL copied"),(0,h.vQ)(t)}})])},C={apple_podcasts:["https://podcasts.apple.com/","https://itunes.apple.com/"],overcast:["https://overcast.fm/"],pocket_casts:["https://pca.st/"],spotify:["https://open.spotify.com/"],spotify_for_paid_users:["https://open.spotify.com/"],youtube:["https://youtube.com/","https://www.youtube.com/"],youtube_music:["https://music.youtube.com/"]},S=e=>{let{platform:t,url:i,language:n}=e,{iString:o,iTemplate:r}=I18N.i(n),l=C[t];if(l.every(e=>!i.startsWith(e))){var a;return{isValid:!1,message:r(b(),null!==(a=l[0])&&void 0!==a?a:"undefined")}}return i.length>255?{isValid:!1,message:o("URL can't be longer than 255 characters")}:{isValid:!0,message:null}},x=e=>{let{pub:t,section:i,spotifySettings:n}=e;return B({showLinks:i?i.showLinks:t.show_links,spotifySettings:n})},B=e=>{let{showLinks:t,spotifySettings:i}=e,n={apple_podcasts_url:null,overcast_url:null,pocket_casts_url:null,spotify_url:null,spotify_for_paid_users_url:null,youtube_url:null,youtube_music_url:null,spotify_open_access_url:null};if(i&&(n.spotify_open_access_url=i.spotify_show_url),!t)return n;for(let e of t)n["".concat(e.platform,"_url")]=e.url;return n},P="https://support.substack.com/hc/en-us/articles/4519588148244-How-do-I-listen-to-episodes-on-my-podcast-app-",I="comments-for-scroll",N=e=>{var t,i,n,o;let{post:r,pub:l,user:a}=e,s=r.section_id&&null!==(i=l.sections.find(e=>e.id===r.section_id))&&void 0!==i?i:null;if((0,m.uo)({post:r,section:s,pub:l}))return null;if((null===(t=r.podcastFields)||void 0===t?void 0:t.free_podcast_url)&&!(null==a?void 0:a.is_subscribed))return{url:r.podcastFields.free_podcast_url,type:"free_podcast_url"};if(r.podcastUpload&&r.podcast_url){let e=!!r.podcastUpload.src_media_upload_id||!(0,g.isPaidAudience)(r.audience)||(null==a?void 0:a.is_subscribed)||null!==(o=null===(n=r.videoUpload)||void 0===n?void 0:n.preview_duration)&&void 0!==o&&o,t=(0,g.isPaidAudience)(r.audience)&&!(null==a?void 0:a.is_subscribed);return{url:r.podcast_url,type:t?e?"alternate_audio_preview":"extra_audio_preview":"alternate_full_audio"}}return null},T=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0,i=(null==t?void 0:t.decimals)===1,n=Math.floor(e/3600),o=Math.floor(e%3600/60),r=Math.floor(e%60),l=n?"".concat(n,":").concat(o<10?"0":"").concat(o,":").concat(r<10?"0":"").concat(r):"".concat(o,":").concat(r<10?"0":"").concat(r);if(i){let t=Math.round(e%1*10);return"".concat(l,".").concat(t)}return l}},79403:function(e,t,i){i.d(t,{JU:()=>J,wi:()=>K,MQ:()=>V});var n=i(7409),o=i(99282),r=i(98848),l=i(16584),a=i(30396),s=i(94184),d=i.n(s),c=i(93974),u=i(41293),p=i(58865),h=i(3312),m=i.n(h),g=i(92592),v=i(32351),f=i(95441),b=i(68833),_=i(94874),y=i(61254),Z=i(19081),w=i(58175),k=i(6163),C=i(60308),S=i(63651),x=i(81821),B=i(84864),P=i(47929);let I={threadsLinkContainer:"threadsLinkContainer-JACRi5",threadsLinkFallback:"threadsLinkFallback-sQtc8r",qrCode:"qrCode-JMB0bK",appBadge:"appBadge-jMueor",webChatLink:"webChatLink-DvDRdZ"};function N(){let e=(0,p._)([""," started a thread"]);return N=function(){return e},e}function T(){let e=(0,p._)(["Join "," subscriber chat "]);return T=function(){return e},e}function E(e){let{pub:t,utm_campaign:i}=e;return(0,l.BX)(Z.tu,{alignItems:"center",justifyContent:"center",gap:12,children:[(0,l.tZ)(O,{utm_campaign:i}),(0,l.BX)(w.xv.B4,{translated:!0,size:12,color:"secondary",className:I.threadsLinkFallback,children:["Already have the app? ",(0,l.tZ)("a",{href:(0,C.wrY)(t),children:"Open now"})]})]})}function L(e){let{pub:t,utm_campaign:i}=e;return(0,l.BX)(Z.tu,{alignItems:"center",justifyContent:"center",gap:12,children:[(0,l.tZ)(A,{utm_campaign:i}),(0,l.BX)(w.xv.B4,{translated:!0,size:12,color:"secondary",className:I.threadsLinkFallback,children:["Already have the app? ",(0,l.tZ)("a",{href:(0,C.wrY)(t),children:"Open now"})]})]})}function X(e){var t,i,n,o;let{pub:r,communityAction:a}=e,{iString:s,iTemplate:d}=(0,f.M1)(),c=a?d(N(),(null===(t=a.author)||void 0===t?void 0:t.name)||s("Someone")):d(T(),(0,B.possessive)(r.author_name)),u=(null==a?void 0:a.communityPost)?null===(i=a.communityPost.body)||void 0===i?void 0:i.slice(0,128):"Subscribe to ".concat(r.name," and join the conversation."),p=(null!==(o=null==a?void 0:a.communityPost.media_assets)&&void 0!==o?o:[])[0],h=(null==a?void 0:null===(n=a.communityPost)||void 0===n?void 0:n.type)==="media"&&!!p,g=h?p.url:r.logo_url,b=(0,S.ZVW)({pubKey:r.subdomain});return(0,l.BX)(l.HY,{children:[(0,l.tZ)(v.Metadata,{title:c,socialTitle:c,description:u,image:g,isLargeImage:h}),(0,l.tZ)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:m()((0,k.hd)(r,{name:c,url:b,description:u,potentialAction:null}),{json:!0,isScriptContext:!0})}})]})}function M(e){let{publication:t,communityAction:i,publicationAuthor:n,utm_campaign:o}=e,r=(0,x.tq)(),a=(0,x.Dt)();return(0,l.BX)(Z.tu,{gap:r?20:24,justifyContent:"center",alignItems:"center",children:[(0,l.tZ)(_.qE,{user:n,size:88}),(0,l.tZ)(Z.tu,{gap:8,children:(0,l.BX)(w.xv.H2,{translated:!0,size:24,align:"center",weight:"bold",color:"pub-primary-text",children:["Join ",I18N.p(n.name||"Substack user"),"'s subscriber chat"]})}),!r&&(0,l.tZ)("div",{className:I.threadsLinkContainer,children:(0,l.tZ)(F,{utm_campaign:o,subdomain:t.subdomain})}),r&&(a?(0,l.tZ)(L,{pub:t,utm_campaign:o}):(0,l.tZ)(E,{pub:t,utm_campaign:o})),(0,l.tZ)(R,{publication:t,source:"pub-nav-bar"}),(0,l.tZ)(X,{pub:t,communityAction:i})]})}function R(e){let{publication:t,source:i,postId:n,commentId:o,targetReplyId:r,showTarget:a,text:s}=e,{iString:d}=(0,f.M1)();return s||(s=d("Or open on web")),(0,l.tZ)("a",{href:(0,S.xC8)({pubId:t.id,postId:n,commentId:o,params:{utm_source:i,targetReplyId:r,showTarget:a}}),className:I.webChatLink,children:(0,l.tZ)(w.xv.B3,{weight:"semibold",align:"center",as:"p",color:"pub-secondary-text",children:s})})}function F(e){let{utm_campaign:t,postId:i,subdomain:n,commentId:o,targetReplyId:r}=e;return(0,l.BX)(Z.tu,{gap:24,children:[(0,l.tZ)(Z.hs,{justifyContent:"center",children:(0,l.tZ)(w.xv.B4,{translated:!0,as:"span",weight:"bold",children:"Scan the QR code below"})}),(0,l.tZ)(Z.hs,{flex:"auto",justifyContent:"center",alignSelf:"center",border:"detail",radius:"sm",className:I.qrCode,children:(0,l.tZ)(U,{utm_campaign:t,postId:i,subdomain:n,commentId:o,targetReplyId:r})}),(0,l.tZ)(y.ZC,{}),(0,l.BX)(Z.hs,{gap:16,justifyContent:"center",children:[(0,l.tZ)(O,{utm_campaign:t}),(0,l.tZ)(A,{utm_campaign:t})]})]})}function U(e){let{utm_campaign:t,postId:i,subdomain:n,commentId:o,targetReplyId:r}=e,s=(0,a.sO)(),d=o?(0,S.lsD)({commentId:o,targetReplyId:r,utm_campaign:t}):i?(0,S._5K)({postId:i,utm_campaign:t}):(0,S.ZVW)({pubKey:n,redirect:"app-store",utm_campaign:t});return(0,a.d4)(()=>{let{current:e}=s;e&&g.toCanvas(e,d,{width:180,margin:2})},[]),(0,l.tZ)("canvas",{ref:s})}function O(e){let{utm_campaign:t}=e;return(0,l.tZ)("a",{className:I.appBadge,href:(0,C.RMm)({utm_campaign:t,utm_source:P.b3.substack}),onClick:()=>{(0,b.j)(b.FP.APP_STORE_LINK_CLICKED,{app_store:"ios"})},children:(0,l.tZ)("img",{src:(0,C.zF4)("/img/app_page/app-store.png",400),height:40})})}function A(e){let{utm_campaign:t}=e;return(0,l.tZ)("a",{className:I.appBadge,href:(0,C.AaB)({utm_campaign:t,utm_source:P.b3.substack}),onClick:()=>{(0,b.j)(b.FP.APP_STORE_LINK_CLICKED,{app_store:"android"})},children:(0,l.tZ)("img",{src:(0,C.zF4)("/img/app_page/google-play.png",400),height:40})})}var D=i(66328),z=i(7845),j=i(15771),H=i(6490),W=i(91400);let q={pageContainer:"pageContainer-QRoB4X",layoutTop:"layoutTop-HNorD1",layoutCentered:"layoutCentered-puapcv",header:"header-LFnrx6"};function Y(e){let{children:t,pub:i,user:n,showHeader:o,layoutTop:r}=e;return(0,l.BX)("div",{className:d()(q.pageContainer,r?q.layoutTop:q.layoutCentered),children:[(0,l.tZ)("div",{className:q.header,children:o&&i&&n&&(0,l.tZ)(D.v,{pub:i,user:n,hideNavBar:!0,hideTitle:!0,selectedSectionId:null})}),t]})}function V(e){let{publication:t,communityAction:i,user:n,showHeader:o,activeChatInfo:r}=e;return(0,x.tq)()?(0,l.tZ)(Z.tu,{alignItems:"center",justifyContent:"center",paddingX:16,paddingTop:56,children:(0,l.tZ)(z.G,{pub:t,chatInformation:r,canSkip:!1,onNext:()=>{},hasAppInstalled:!!(null==n?void 0:n.reader_installed_at),redirectToChat:!0,upsellGroup:"publication-chat-page"})}):(0,l.tZ)(Y,{pub:t,user:n,showHeader:o,children:(0,l.tZ)(Z.tu,{flex:"grow",alignSelf:"stretch",justifyContent:"center",children:(0,l.tZ)(Z.hs,{flex:"grow",justifyContent:"center",paddingBottom:56,children:(0,l.tZ)(M,{publication:t,communityAction:i,publicationAuthor:t.author||{id:t.author_id||0,name:t.author_name||"",photo_url:t.author_photo_url},utm_campaign:P.VX.threadsPage})})})})}function K(e){let{publication:t,communityAction:i,user:n,layoutTop:o,appModalOpenByDefault:r}=e,s=(0,W.XA)(),[d,p]=(0,a.eJ)(!s&&r),h=P.VX.threadPage,{iString:m}=(0,f.M1)(),g=(0,l.BX)(Z.tu,{gap:8,children:[(0,l.tZ)(j.zx,{href:(0,S._5K)({postId:i.communityPost.id,utm_source:P.b3.chatPostLanding,redirect:"app-store",utm_campaign:h}),onClick:s?null:e=>{e.preventDefault(),p(!0)},children:m("Open in app")}),(0,l.tZ)(R,{publication:t,postId:i.communityPost.id,text:m("Or join the conversation on web"),source:"post-permalink"})]});return(0,l.tZ)(Y,{pub:t,user:n,layoutTop:o,children:(0,l.BX)(u.I,{children:[(0,l.BX)(Z.tu,{flex:"grow",alignSelf:"stretch",justifyContent:"center",children:[(0,l.tZ)(Z.hs,{flex:"grow",justifyContent:"center",paddingBottom:16,children:(0,l.tZ)(Z.tu,{style:{maxWidth:580},flex:"grow",justifyContent:"center",children:"open"===i.status?(0,l.tZ)(c.Jg,{communityPost:i.communityPost,author:i.author,withAttribution:!0,extras:s?null:g,flex:"auto",isReadOnly:!0}):(0,l.tZ)(Z.tu,{children:(0,l.tZ)(c.V8,{author:i.author,extras:s?null:g,commenters:i.communityPost.recent_commenters,count:i.communityPost.comment_count,audience:i.communityPost.audience})})})}),s&&(0,l.tZ)(Z.tu,{sizing:"border-box",borderTop:"detail-themed",paddingY:16,alignSelf:"stretch",children:g}),(0,l.tZ)(X,{pub:t,communityAction:i})]}),(0,l.tZ)(G,{utm_campaign:h,isOpen:d,postId:i.communityPost.id,onClose:()=>p(!1),subdomain:t.subdomain})]})})}function J(e){var t;let{publication:i,communityAction:n,user:o,layoutTop:r,appModalOpenByDefault:s}=e,{iString:d}=(0,f.M1)(),u=(0,W.XA)(),[p,h]=(0,a.eJ)(!u&&s),m=P.VX.commentPage,g=null!==(t=n.communityComment.parent_id)&&void 0!==t?t:n.communityComment.id,v=n.communityComment.parent_id?n.communityComment.id:void 0,b=n.communityComment.post_id,_=(0,l.BX)(Z.tu,{gap:8,children:[(0,l.tZ)(j.zx,{href:(0,S.lsD)({commentId:g,targetReplyId:v,utm_source:P.b3.chatPostLanding,redirect:"app-store",utm_campaign:m}),onClick:u?null:e=>{e.preventDefault(),h(!0)},children:d("Open in app")}),(0,l.tZ)(R,{publication:i,postId:b,commentId:g,targetReplyId:v,showTarget:!!v||void 0,text:d("Or join the conversation on web"),source:"post-permalink"})]});return(0,l.BX)(Y,{pub:i,user:o,layoutTop:r,children:[(0,l.BX)(Z.tu,{flex:"grow",alignSelf:"stretch",justifyContent:"center",children:[(0,l.tZ)(Z.hs,{flex:"grow",justifyContent:"center",paddingBottom:16,children:(0,l.tZ)(Z.tu,{style:{maxWidth:580},flex:"grow",justifyContent:"center",children:"VISIBLE"!==n.status&&n.status?"PAID_SUBSCRIPTION_REQUIRED"===n.status||"FOUNDING_SUBSCRIPTION_REQUIRED"===n.status?(0,l.tZ)(Z.tu,{children:(0,l.tZ)(c.V8,{author:n.author,extras:u?null:_,commenters:n.communityComment.recent_commenters,count:n.communityComment.reply_count,audience:"FOUNDING_SUBSCRIPTION_REQUIRED"===n.status?"only_founding":"only_paid"})}):(0,l.tZ)(Z.tu,{children:(0,l.tZ)(c.Q4,{author:n.author,extras:u?null:_,commenters:n.communityComment.recent_commenters,count:n.communityComment.reply_count})}):(0,l.tZ)(c.rk,{chatPublicationId:i.id,communityComment:n.communityComment,author:n.author,extras:u?null:_,isReadOnly:!0,isBanned:!1,quoteReply:n.quote,chatAuthorNameAttribution:i.author_name,flex:"auto"})})}),u&&(0,l.tZ)(Z.tu,{sizing:"border-box",borderTop:"detail-themed",paddingY:16,alignSelf:"stretch",children:_})]}),(0,l.tZ)(G,{utm_campaign:m,isOpen:p,postId:b,commentId:g,targetReplyId:v,onClose:()=>h(!1),subdomain:i.subdomain})]})}function G(e){var{postId:t,utm_campaign:i,subdomain:a,commentId:s,targetReplyId:d}=e,c=(0,r._)(e,["postId","utm_campaign","subdomain","commentId","targetReplyId"]);let{iString:u}=(0,f.M1)();return(0,l.BX)(H.u_,(0,o._)((0,n._)({},c),{children:[(0,l.tZ)(H.xB,{title:u("Open in the Substack app"),showClose:!0,onClose:c.onClose,showDivider:!0}),(0,l.tZ)(Z.tu,{paddingY:32,paddingX:40,children:(0,l.tZ)(F,{utm_campaign:i,postId:t,subdomain:a,commentId:s,targetReplyId:d})})]}))}},25479:function(e,t,i){i.d(t,{ol:()=>h,yk:()=>v,ze:()=>g});var n=i(16584),o=i(6400),r=i(30396),l=i(45578),a=i.n(l);i(60807);var s=i(59176),d=i(63651),c=i(54416);let u={surfaces:[],addSurface:()=>void 0},p=e=>{let[t,i]=(0,r.eJ)([]),n=(0,r.Ye)(()=>e?"".concat("user-recent-surfaces","-").concat(e.id):"",[e]);(0,r.d4)(()=>{if(!e)return;let t=(0,s.mM)(n);i(null!=t?t:[])},[e,n]);let o=(0,r.I4)(e=>{var t;let o=null!==(t=(0,s.mM)(n))&&void 0!==t?t:[],r="visited-publication"===e.type?{type:e.type,publication:{id:e.publication.id,name:e.publication.name,base_url:e.publication.base_url,logo_url:e.publication.logo_url,custom_domain:e.publication.custom_domain,custom_domain_optional:e.publication.custom_domain_optional,subdomain:e.publication.subdomain,theme:e.publication.theme,theme_var_background_pop:e.publication.theme_var_background_pop,author_photo_url:e.publication.author_photo_url,author:e.publication.author,cover_photo_url:e.publication.cover_photo_url}}:{type:e.type,profile:{name:e.profile.name,id:e.profile.id,photo_url:e.profile.photo_url}},l=a()([r,...o],e=>"visited-publication"===e.type?"pub-".concat(e.publication.id):"profile-".concat(e.profile.id)).slice(0,10);i(l);try{(0,s.ex)(n,l)}catch(e){console.error("Failed to update local recent surfaces:",e)}},[n]);return e?{surfaces:t,addSurface:o}:u},h=e=>{let{pub:t}=e,i=(0,r.sO)(null),[o,l]=(0,r.eJ)(!1);(0,r.d4)(()=>(window.addEventListener("message",a),()=>window.removeEventListener("message",a))),(0,r.d4)(()=>{var e;if(o&&(null===(e=i.current)||void 0===e?void 0:e.contentWindow)&&t){let e=i.current.contentWindow;null==e||e.postMessage({pub:t},"".concat((0,d.ZJn)()))}},[t,o]);let a=()=>{l(!0)};return"undefined"==typeof window?null:(0,n.tZ)("iframe",{className:c.Z.visitedSurfacesIFrame,ref:i,src:"".concat((0,d.ZJn)(),"/visited-surface-frame"),width:"0",height:"0"})},m=(0,o.createContext)(u);function g(){return(0,r.qp)(m)}function v(e){let{user:t,children:i}=e,{surfaces:o,addSurface:r}=p(t);return(0,n.tZ)(m.Provider,{value:{surfaces:o,addSurface:r},children:i})}},50364:function(e,t,i){i.d(t,{Hz:()=>l,Ng:()=>c,Sh:()=>a,Zu:()=>r,_N:()=>u,hO:()=>function e(t,i){if(Symbol.iterator in Object(t)){for(let n of t)if(!1===i(n)||!1===e(n.children||[],i))return!1}},ql:()=>s});var n=i(1835),o=i(26042);let r=9999,l=function(){let{likesEnabled:e=!0,language:t="en"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{iString:i}=I18N.i(t),n=[];return e&&n.push({key:"best_first",text:i("Top first"),description:i("Top comments first")}),n.push({key:"most_recent_first",text:i("Newest first"),description:i("Newest comments first")}),n.push({key:"oldest_first",text:i("Oldest first"),description:i("Oldest comments first")}),n},a=(e,t)=>{var i;return null===(i=l({language:t}).find(t=>t.key===e))||void 0===i?void 0:i.text},s={review_required:"review_required",edit_review_required:"edit_review_required",published:"published",flagged:"flagged",deleted:"deleted",moderator_approved:"moderator_approved",moderator_removed:"moderator_removed",new_commenter_approval_required:"new_commenter_approval_required"},d=new Set([s.review_required,s.edit_review_required,s.published,s.moderator_approved,s.new_commenter_approval_required]),c=e=>!e.deleted&&!!e.status&&d.has(e.status);function u(e,t){let{attachments:i}=e;if(i&&i.length>0){for(let e of i)if("post"===e.type){for(let i of e.post.publishedBylines)if(i.id===t)return!0;if((0,n.wN)(e.publication,t))return!0}else if("comment"===e.type){if(e.comment.user_id===t)return!0}else if("publication"===e.type&&(0,n.wN)(e.publication,t))return!0}return(function(e){let t=[];if(e.body_json)for(let l of(0,o.Z)(e.body_json)){var i,n,r;"substack_mention"!==l.type||(null===(i=l.attrs)||void 0===i?void 0:i.mentionType)!=="user"&&(null===(n=l.attrs)||void 0===n?void 0:n.mentionType)||t.push(null===(r=l.attrs)||void 0===r?void 0:r.id)}return new Set(t)})(e).has(t)}},75561:function(e,t,i){function n(e,t){for(let[i,n]of Object.entries(t))null!=n&&(e[i]=n);return e}function o(e,t){return Object.entries(e).every(e=>{let[i,n]=e;return n===t[i]})}i.d(t,{CD:()=>n,wU:()=>o})},6163:function(e,t,i){i.d(t,{L9:()=>g,Rg:()=>h,hd:()=>u,v_:()=>m});var n=i(7409),o=i(99282),r=i(49762),l=i(98012),a=i(31377),s=i(60308),d=i(84864),c=i(47929);function u(e){let{name:t,url:i,description:o,potentialAction:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===r&&(r={"@type":"SearchAction",name:"Search ".concat(e.name),target:"".concat(e.base_url).concat((0,s.nxG)(e),"?utm_source=").concat(c.b3.google,"&sort=search&search={search_term_string}"),"query-input":"required name=search_term_string"}),{"@context":"https://schema.org","@type":"WebSite",name:t||e.name,publisher:(0,n._)({"@type":"Organization",name:e.name,url:e.base_url},e.logo_url?{logo:{"@type":"ImageObject",url:e.logo_url}}:{},e.twitter_screen_name?{sameAs:["https://twitter.com/".concat(e.twitter_screen_name)]}:{}),url:i||e.base_url,mainEntityOfPage:{"@type":"WebPage",url:i||e.base_url},description:o||e.hero_text,potentialAction:r}}function p(e){var t,i,r,l;return(0,n._)((0,o._)((0,n._)({"@type":"Organization",name:e.name,url:(0,s.SVA)(e),description:e.hero_text},e.rankingDetailFreeIncludedOrderOfMagnitude&&{interactionStatistic:{"@type":"InteractionCounter",name:"Subscribers",interactionType:"https://schema.org/SubscribeAction",userInteractionCount:e.rankingDetailFreeIncludedOrderOfMagnitude}}),{identifier:"pub:".concat(e.id)}),e.logo_url&&{logo:{"@type":"ImageObject",url:e.logo_url,contentUrl:(0,s.zF4)(null!==(t=e.logo_url)&&void 0!==t?t:""),thumbnailUrl:(0,s.zF4)(null!==(i=e.logo_url)&&void 0!==i?i:"",128,{height:128})},image:{"@type":"ImageObject",url:e.logo_url,contentUrl:(0,s.zF4)(null!==(r=e.logo_url)&&void 0!==r?r:""),thumbnailUrl:(0,s.zF4)(null!==(l=e.logo_url)&&void 0!==l?l:"",128,{height:128})}},e.twitter_screen_name&&{sameAs:["https://twitter.com/".concat(e.twitter_screen_name)]})}function h(e,t){var i,c;let u=(0,d.getBylineUsers)(t),h=p(e),m=(0,r.default)("add_section_and_tag_metadata");return(0,n._)((0,o._)((0,n._)({"@context":"https://schema.org","@type":"NewsArticle",url:(0,s.uRy)(e,t),mainEntityOfPage:(0,s.uRy)(e,t),headline:t.search_engine_title||t.social_title||t.title,description:t.search_engine_description||t.description,image:t.cover_image?[{"@type":"ImageObject",url:t.cover_image}]:[],datePublished:(0,l.Z)(t.post_date).format("YYYY-MM-DDTHH:mm:ssZ"),dateModified:(0,l.Z)(t.post_date).format("YYYY-MM-DDTHH:mm:ssZ"),isAccessibleForFree:!(0,a.isPaidAudience)(t.audience)},t.post_paywall_content_for_google&&{hasPart:[{"@type":"WebPageElement",isAccessibleForFree:!0,cssSelector:".available-content"},{"@type":"WebPageElement",isAccessibleForFree:!1,cssSelector:".paywall-content"}]}),{author:u.length>0?u.map(e=>(0,n._)({"@type":"Person",name:e.name,url:(0,s.NNq)(e),description:e.bio,identifier:"user:".concat(e.id)},e.twitter_screen_name&&{sameAs:["https://twitter.com/".concat(e.twitter_screen_name)]},e.photo_url&&{image:{"@type":"ImageObject",contentUrl:(0,s.zF4)(e.photo_url),thumbnailUrl:(0,s.zF4)(e.photo_url,128,{height:128})}})):h,publisher:h}),m&&{articleSection:null===(i=t.section)||void 0===i?void 0:i.name,keywords:null===(c=t.postTags)||void 0===c?void 0:c.map(e=>e.slug)})}function m(e){return(0,n._)({"@context":"https://schema.org","@type":"Person",image:(null==e?void 0:e.photo_url)&&(0,s.zF4)(e.photo_url),name:"".concat(null==e?void 0:e.name),url:e&&(0,s.NNq)(e),jobTitle:null==e?void 0:e.bio,description:null==e?void 0:e.bio},(null==e?void 0:e.twitter_screen_name)?{sameAs:["https://twitter.com/".concat(e.twitter_screen_name)]}:{})}function g(e,t,i,o){let{usePreview:r}=o,a=(0,d.getBylineUsers)(t),c=p(e);return(0,n._)({"@context":"https://schema.org","@type":"VideoObject",name:t.search_engine_title||t.social_title||t.title,description:t.search_engine_description||t.description,thumbnailUrl:(0,s.ow1)(i),uploadDate:(0,l.Z)(t.post_date).format("YYYY-MM-DDTHH:mm:ssZ"),contentUrl:(0,s.rhs)("".concat((0,s.SVA)(e),"/api/v1/video/upload/").concat(i.id,"/src"),{preview:r,override_publication_id:e.id,type:"mp4"}),publisher:c,author:a.length>0?a.map(e=>(0,n._)({"@type":"Person",name:e.name,url:(0,s.NNq)(e),description:e.bio,identifier:"user:".concat(e.id)},e.twitter_screen_name&&{sameAs:["https://twitter.com/".concat(e.twitter_screen_name)]},e.photo_url&&{image:{"@type":"ImageObject",contentUrl:(0,s.zF4)(e.photo_url),thumbnailUrl:(0,s.zF4)(e.photo_url,128,{height:128})}})):c},i.duration&&{duration:"PT".concat(Math.floor(i.duration),"S")})}},62841:function(e,t,i){i.d(t,{Fl:()=>h,b8:()=>d,di:()=>c,eP:()=>u,ne:()=>p,zM:()=>l});var n=i(7409),o=i(99282);i(30396);var r=i(95441);let l={newspaper:{id:"newspaper",legacyEquivalent:"newspaper",postCount:{desktop:1,tablet:1,mobile:1}},magaziney:{id:"magaziney",legacyEquivalent:"magaziney",postCount:{desktop:3,tablet:3,mobile:3}},"magazine-5":{id:"magazine-5",legacyEquivalent:"magaziney",postCount:{desktop:5,tablet:3,mobile:5}},"feature-media":{id:"feature-media",legacyEquivalent:"newspaper",postCount:{desktop:1,tablet:1,mobile:1}},feature:{id:"feature",legacyEquivalent:"magaziney",postCount:{desktop:5,tablet:5,mobile:5}},podcast:{id:"podcast",legacyEquivalent:"newspaper",postCount:{desktop:0,tablet:0,mobile:0}}},a=["list","grid","grid-groups","custom"],s=()=>{let{iString:e}=(0,r.M1)();return{list:{id:"list",label:e("List"),description:e("A list of posts"),postCount:{desktop:7,tablet:7,mobile:7}},grid:{id:"grid",label:e("Grid"),description:e("A grid of nine posts"),postCount:{desktop:9,tablet:9,mobile:7}},"grid-groups":{id:"grid-groups",label:e("Groups (sections or tags)"),description:e("A grid of nine posts, grouped by section or tag"),postCount:{desktop:9,tablet:9,mobile:7}},custom:{id:"custom",label:e("Custom"),description:e("Custom layout"),postCount:{desktop:0,tablet:0,mobile:0}}}},d=()=>{let e=s();return a.reduce((t,i)=>(0,o._)((0,n._)({},t),{[i]:e[i].postCount}),{})},c={posts:{min:3,default:6,max:7},rows:{min:1,default:2,max:4}},u=e=>{let{contentBlock:t,breakpoint:i="desktop",isTheFP:n}=e;if("list"===t.block_type)return t.num_posts||c.posts.default;if("grid"===t.block_type){let e=t.num_rows||c.rows.default;if("desktop"===i||"mobile"===i){let i=4;return t.primary_sidebar_modules.length>0&&(i-=1),t.secondary_sidebar_modules.length>0&&(i-=1),i*e}if("tablet"===i){let i=3;return(t.primary_sidebar_modules.length>0||t.secondary_sidebar_modules.length>0)&&(i-=1),i*e}}if("feature"===t.block_type){if(n){var o;return t.attrs.feature&&(null===(o=t.attrs.feature)||void 0===o?void 0:o.variant)!=="special-feature"?5:8}return 5}return"podcast_plus_three"===t.block_type?4:"single_post"===t.block_type?1:"half_feature"===t.block_type?"tablet"===i?3:4:0},p=e=>{let{contentBlocks:t,breakpoint:i,isTheFP:n,recentPosts:o,postsBySectionId:r,postsByTagId:l,postsForContentBlockPins:a}=e,s={},d=0;for(let e of t){var c,p,m;let t=[];if("latest"===e.post_source){let r=u({contentBlock:e,breakpoint:i,isTheFP:n});t=o.slice(d,d+r),d+=r}else"section"===e.post_source&&e.section_id?t=null!==(c=r[e.section_id])&&void 0!==c?c:[]:"tag"===e.post_source&&e.post_tag_id&&(t=null!==(p=l[e.post_tag_id])&&void 0!==p?p:[]);let{posts:g,numPostsDisplaced:v}=h({posts:t,contentBlockPins:null!==(m=e.contentBlockPins)&&void 0!==m?m:[],pinnedPosts:a});d-=v,s[e.id]={posts:g,postsWithoutPins:t}}return s},h=e=>{let{posts:t,contentBlockPins:i,pinnedPosts:n}=e,o=[...t],r=0;if(!i||0===i.length)return{posts:o,numPostsDisplaced:r};for(let e of i.sort((e,t)=>e.position-t.position)){let i=n[e.post_id];if(!i)continue;let l=o.findIndex(e=>e.id===i.id);-1===l?(o.splice(e.position,0,i),o=o.slice(0,t.length),r+=1):(o.splice(l,1),o.splice(e.position,0,i))}return{posts:o,numPostsDisplaced:r}}},9799:function(e,t,i){i.d(t,{I:()=>v,M:()=>g});var n=i(7409),o=i(99282),r=i(16584),l=i(30396),a=i(23493),s=i.n(a),d=i(80569),c=i.n(d),u=i(95441),p=i(68833),h=i(70379),m=i(47929);let g=e=>{let t=(0,h.pm)(),{iString:i}=(0,u.M1)(),[a,d]=(0,l.eJ)(0),g=s()(e=>{d(e)},100),v=(0,l.I4)(async()=>{var t;let i,n;let o="/api/v1/video/upload/".concat(e.id,"/src.json?type=original"),{body:{src:r}}=await c().get(o),l=await fetch(r),a=null===(t=l.body)||void 0===t?void 0:t.getReader(),s=l.headers.get("Content-Length");if(!a||!s)throw Error("Failed to read the response body or content length is missing.");let u=parseInt(s),h=0,v=[];do{let e=await a.read();i=e.done,(n=e.value)&&(v.push(n),g((h+=n.length)/u*100))}while(!i);let f=new Blob(v),b=window.URL.createObjectURL(f),_=document.createElement("a");_.href=b,_.download="undefined"!==e.name&&e.name?e.name:"original.webm",_.target="_blank",_.rel="noopener noreferrer",_.style.display="none",document.body.appendChild(_),_.click(),document.body.removeChild(_),(0,p.j)(p.FP.VIDEO_CLIP_DOWNLOAD_BUTTON_CLICKED,{name:"download",post_id:e.post_id,utm_campaign:m.VX.substackClips,utm_medium:m.lP.web}),setTimeout(()=>d(0),200)},[e]);return{startDownload:()=>{d(0),v(),t.popToast(e=>(0,r.tZ)(h.FN,(0,o._)((0,n._)({},e),{text:i("Download started, do not close the window until download is completed")})))},downloadPercentage:a}},v=async function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"original",n="/api/v1/video/upload/".concat(e.id,"/src.json?type=").concat(i),{body:{src:o},status:r}=await c().get(n);if(r>=400){let e="there was an error generating the pre-signed url of the original source";throw console.warn(e),Error(e)}let l=await fetch(o);if(l.status>=400){let e="there was an error downloading the original source";throw console.warn(e),Error(e)}let a=await l.blob(),s=window.URL.createObjectURL(a),d=document.createElement("a");d.href=s,d.download=t?"".concat(t,".mp4"):"".concat(e.name),d.target="_blank",d.rel="noopener noreferrer",d.style.display="none",document.body.appendChild(d),d.click(),document.body.removeChild(d),(0,p.j)(p.FP.VIDEO_CLIP_DOWNLOAD_BUTTON_CLICKED,{name:"download",post_id:e.post_id,utm_campaign:m.VX.substackClips,utm_medium:m.lP.web})}}}]);