"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["7949"],{44854:function(e,t,n){n.d(t,{Z:()=>r});let r={root:"root-MjHNqP",isOnInbox:"isOnInbox-pP0vQF",paywallStack:"paywallStack-RdkSad",pubChatColumn:"pubChatColumn-Zck7MX",pubChatFull:"pubChatFull-tEPJ4X",submit:"submit-T76OjY",inactive:"inactive-RF_jH9",chatPublicationContainer:"chatPublicationContainer-y1FRFU",invitesRow:"invitesRow-QZEeej",show:"show-vL_rsU",unfurl:"unfurl-n5q4dW",sticky:"sticky-ykmBOy",unreadDot:"unreadDot-fNgNDl",unreadTabDot:"unreadTabDot-aqz7wG",selected:"selected-oDAfJA",currentVisibilityBox:"currentVisibilityBox-VAGH9Q",headerPubLink:"headerPubLink-uygNA1",sidebarRowTitle:"sidebarRowTitle-wepYF4",headerPubAvatar:"headerPubAvatar-jFmd9c",inputBox:"inputBox-UuLYvf",modalContext:"modalContext-nC14Y0",textInputInset:"textInputInset-jnSii9",invisible:"invisible-AW4ANv",textInput:"textInput-zlmYim",dropzone:"dropzone-W750JH",submitButton:"submitButton-_zJ5fy",newThreadButton:"newThreadButton-POT_Ph",roundedFooterPlaceholder:"roundedFooterPlaceholder-k7TSWJ",chatContainer:"chatContainer-fnFgIy",fade:"fade-HKCqnN",composerLinkPreview:"composerLinkPreview-cBU00h",composer:"composer-rYAaNa",imageBox:"imageBox-NAFgde",image:"image-PfNhry",deleteFile:"deleteFile-gv_fWj",modalColumn:"modalColumn-fVvKpE",visibilityDropdown:"visibilityDropdown-mnqCEz",visibilityDropdownText:"visibilityDropdownText-uW5qxU",messageSquareIcon:"messageSquareIcon-_NUoeX",paywall:"paywall-hfm67h",modalChatEditor:"modalChatEditor-bbcasD",newText:"newText-IkD33N",newBorder:"newBorder-fycRk_",jumpButton:"jumpButton-yc047J",jumpBadge:"jumpBadge-IO2hJP"}},32261:function(e,t,n){n.d(t,{FI:()=>v,fi:()=>_});var r=n(27412),i=n(7409),o=n(98848),a=n(16584),l=n(6400),s=n(94184),c=n.n(s),d=n(70149),u=n(93666),m=n(48980),h=n(98012),p=n(60308),f=n(84864);class g extends l.Component{componentDidMount(){this.props.manualLoad||this.loadProfileUser()}componentDidUpdate(e){this.props.manualLoad||e.profileUser.id===this.props.profileUser.id||(this.setState({profileUser:null}),this.loadProfileUser())}async loadProfileUser(){if(!this.state.loadingProfile){this.setState({loadingProfile:!0});try{let e=await (0,m.rd)("/api/v1/user/".concat(this.props.profileUser.id,"/profile"));this.setState({profileUser:e})}catch(e){console.error("Failed to load profile:",e)}this.setState({loadingProfile:!1})}}getProfileUser(){return this.state.profileUser||this.props.profileUser}render(e){var t,n;let{pub:r}=e,i=this.getProfileUser(),o="publications"in i&&r&&(null===(t=i.publications)||void 0===t?void 0:t.filter(e=>e.id!==r.id))||[];return(0,a.BX)("div",{className:"user-profile ".concat(this.props.isBanned?"banned":""),children:[(0,a.tZ)(_,{photo_url:(0,p.SMH)(i),banned:this.props.isBanned,email:"email"in i?i.email:void 0,pub:r}),(0,a.tZ)("div",{className:"user-profile-name",children:"name"in i?i.name:""}),(0,a.tZ)("div",{className:"user-profile-status",children:r&&i.id===r.author_id?(0,a.BX)("b",{children:["Author of ",r.name]}):r&&"subscribed_at"in i&&i.subscribed_at?"Subscriber to ".concat(r.name," since ").concat((0,h.Z)(i.subscribed_at).standardDate()):"\xa0"}),o.length>0&&(0,a.BX)("div",{className:"user-profile-publication",children:["Author of"," ",(0,f.oxfordComma)(o.map(e=>(0,a.tZ)("a",{href:e.base_url,native:!0,children:e.name})))]}),this.props.isBanned&&(0,a.BX)("div",{className:"user-profile-banned",children:["Banned from commenting on ",null!==(n=null==r?void 0:r.name)&&void 0!==n?n:""]})]})}}class v extends u.p{onBeforeOpen(){var e;null===(e=this.profile)||void 0===e||e.loadProfileUser()}renderChildren(){let e=this.props,{ref:t}=e,n=(0,o._)(e,["ref"]);return(0,a.tZ)("div",{className:"user-profile-modal",children:(0,a.tZ)(g,(0,i._)({ref:this.assignProfile,manualLoad:!0},n))})}constructor(...e){super(...e),(0,r._)(this,"profile",void 0),(0,r._)(this,"assignProfile",e=>{this.profile=e})}}let b=e=>{let{children:t,email:n,pub:r}=e;return(0,a.tZ)("a",{target:"_blank",href:(0,p.pN7)(r,n),children:t})},_=e=>{let{photo_url:t,size:n=92,banned:r=!1,email:i="",className:o="",pub:l=null,children:s}=e,u=(0,a.tZ)("img",{className:"user-profile-head",height:n,width:n,src:(0,p.zF4)(null!=t?t:"",2*n,{height:2*n,crop:"fill"})});return(0,a.BX)("div",{className:c()(o,"profile-image-wrapper"),children:[i&&l?(0,a.tZ)(b,{email:i,pub:l,children:u}):u,r&&(0,a.tZ)(d.Z,{height:n}),s]})}},77906:function(e,t,n){n.d(t,{UK:()=>C});var r=n(7409),i=n(99282),o=n(58865),a=n(16584),l=n(20160),s=n(95441),c=n(92291),d=n(77338),u=n(5952),m=n(79251),h=n(25991),p=n(53678),f=n(76721),g=n(93252),v=n(94874),b=n(19081),_=n(58175),Z=n(71460),y=n(2009),w=n(50312),B=n(63651),x=n(47929),P=n(5749);function k(){let e=(0,o._)(["This content is only visible to paid subscribers of ",""]);return k=function(){return e},e}function C(e){let{parent:t,comment:n,publication:r,readOnly:i,onAttachmentClick:o,utm_content:s,isDm:c,isPermalink:d}=e,u=(0,w.F)({onClick:()=>null==o?void 0:o({commentId:String(n.id)}),href:i?void 0:(0,B.Sgq)(n,{noBase:y.L}),state:{showBack:!0}});return(0,a.tZ)(l.W,{children:(0,a.tZ)(S,{readOnly:i,linkProps:u,isEmbed:g.P,children:(0,a.tZ)(N,{parent:t,comment:n,publication:r,readOnly:i,onAttachmentClick:o,utm_content:s,isDm:c,isPermalink:d})})})}function S(e){let{children:t,readOnly:n,linkProps:o,isEmbed:l}=e;return(0,a.tZ)(b.tu,(0,i._)((0,r._)({as:n?"div":"a",bg:"primary",border:"detail",radius:"md",padding:12,gap:8,target:l()?"_blank":void 0,draggable:!1},o),{showFocus:!0,animate:!0,className:P.Z.commentContainer,children:t}))}function N(e){var t,n,r;let{parent:i,comment:o,publication:l,readOnly:s,onAttachmentClick:c,utm_content:d,isDm:u,isPermalink:m}=e,{truncatedBodyJson:h}=(0,f.Z)(o,{truncationProfile:"small"}),p=null!==(r=o.user)&&void 0!==r?r:o.user_id?{id:o.user_id,name:null!==(t=o.name)&&void 0!==t?t:"",photo_url:o.photo_url,bestseller_tier:null!==(n=o.user_bestseller_tier)&&void 0!==n?n:void 0}:null;return(0,a.BX)(a.HY,{children:[p&&(0,a.tZ)(F,{commentUser:p,comment:o,readOnly:s,utm_content:d}),(0,a.tZ)(I,{parent:i,comment:o,publication:l,truncatedBodyJson:h,isDm:u,onAttachmentClick:c,utm_content:d,readOnly:s,isPermalink:m})]})}function F(e){let{commentUser:t,comment:n,readOnly:r,utm_content:i}=e;return t?(0,a.BX)(b.hs,{gap:6,alignItems:"center",justifyContent:"start",children:[(0,a.tZ)(w.r,{href:(0,B.NNq)(t,{noBase:y.L,utm_content:x.fZ.substackFeedItem,utm_source:null!=i?i:void 0}),target:(0,g.P)()?"_blank":void 0,showBack:!0,radius:"full",showFocus:!0,animate:!0,children:(0,a.tZ)(v.qE,{size:20,user:t})}),(0,a.tZ)(_.xv.B4,{weight:"medium",color:"primary",children:r?t.name:(0,a.BX)(b.hs,{gap:8,direction:"row",justifyContent:"space-between",children:[(0,a.tZ)(p.xG,{user:t,utm_source:x.b3.substackFeedItem,utm_content:i,children:t.name}),(null==t?void 0:t.bestseller_tier)!=null&&(0,a.tZ)(Z.UserBadge,{tier:t.bestseller_tier,userId:t.id,tooltipOnHover:!0,size:"sm"})]})}),(0,a.tZ)(_.xv.B4,{as:"span",color:"secondary",children:(0,a.tZ)(h.mn,{timestamp:n.date,comment:n})})]}):null}function I(e){var t,n,r,i,o;let{parent:l,comment:c,publication:d,truncatedBodyJson:u,isDm:m,isPermalink:h,readOnly:p,onAttachmentClick:f,utm_content:g}=e,{iString:v,iTemplate:b}=(0,s.M1)(),_=null!==(o=null==d?void 0:d.name)&&void 0!==o?o:v("this publication"),Z=b(k(),_),y=null==l?void 0:null===(t=l.attachments)||void 0===t?void 0:t.some(e=>"image"===e.type||"video"===e.type),w=null===(n=c.attachments)||void 0===n?void 0:n.some(e=>"image"===e.type||"video"===e.type),B=null===(r=c.attachments)||void 0===r?void 0:r.some(e=>"image"!==e.type&&"video"!==e.type&&"live_stream"!==e.type),x=null===(i=c.attachments)||void 0===i?void 0:i.some(e=>"post"===e.type&&e.postSelection),P=!1;return y||w&&B||B&&!x?(0,a.tZ)(U,{comment:c,truncatedBodyJson:u,hiddenText:Z,onAttachmentClick:f,utm_content:g}):(0,a.tZ)(T,{comment:c,truncatedBodyJson:u,hiddenText:Z,onAttachmentClick:f,utm_content:g,readOnly:p,isDm:m,isPermalink:h})}function U(e){var t,n;let{comment:r,truncatedBodyJson:i,hiddenText:o,onAttachmentClick:l,utm_content:s}=e;return(0,a.tZ)(a.HY,{children:(0,a.BX)(b.hs,{gap:8,direction:"row",flex:"grow",justifyContent:"space-between",children:[(0,a.BX)(b.tu,{gap:4,children:[(0,a.tZ)(d.h,{content:i,isHidden:r.hidden,hiddenText:o,attachedLinks:(0,u.Bk)(r)}),(0,a.tZ)(m.Mi,{attachments:null!==(t=r.attachments)&&void 0!==t?t:[],onAttachmentClick:l,utm_content:s})]}),(0,a.tZ)(c.Gn,{attachments:null!==(n=r.attachments)&&void 0!==n?n:[]})]})})}function T(e){var t;let{comment:n,truncatedBodyJson:r,hiddenText:i,onAttachmentClick:o,utm_content:l,readOnly:s,isDm:m,isPermalink:h}=e;return(0,a.BX)(a.HY,{children:[(0,a.tZ)(d.h,{content:r,isHidden:n.hidden,hiddenText:i,attachedLinks:(0,u.Bk)(n)}),(0,a.tZ)(c.yd,{attachments:null!==(t=n.attachments)&&void 0!==t?t:[],onAttachmentClick:o,utm_content:l,isRestack:!0,readOnly:s,isDm:m,isPermalink:h})]})}},85527:function(e,t,n){n.d(t,{F:()=>a,q:()=>o});var r=n(98661),i=n(30396);let o=(0,r.createContext)(void 0);function a(){return(0,i.qp)(o)}},87077:function(e,t,n){n.d(t,{u:()=>Z});var r=n(7409),i=n(99282),o=n(98848),a=n(16584),l=n(19425),s=n(94184),c=n.n(s),d=n(98661),u=n(62372),m=n(29032),h=n(20888),p=n(71068),f=n(19081),g=n(58175),v=n(165);let b=["top-start","top-center","top-end","bottom-start","bottom-center","bottom-end"],_=["left-start","left-center","left-end","right-start","right-center","right-end"],Z=e=>{var{children:t,text:n,title:l,imageUrl:s,as:m="span",leading:h,trailing:p,preferPlacement:f="top-center",layerOptions:g,disabled:Z,hoverOptions:w={}}=e,B=(0,o._)(e,["children","text","title","imageUrl","as","leading","trailing","preferPlacement","layerOptions","disabled","hoverOptions"]);let{layerProps:x,triggerProps:P,hoverProps:k,transitionProps:C,renderLayer:S,shouldShow:N}=function(){var e;let{hoverOptions:t,layerOptions:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},[i,o]=(0,d.useState)(!1),[a,l]=(0,u.XI)((0,r._)({},t)),{triggerProps:s,layerProps:m,renderLayer:h}=(0,u.sJ)((0,r._)({isOpen:a,auto:!0,triggerOffset:8},n)),p=null!==(e=null==n?void 0:n.placement)&&void 0!==e?e:"top-center",f="",g="";switch(p){case"top-start":case"top-center":case"top-end":default:f=c()(v.Z.hide,v.Z.fromBelow),g=c()(v.Z.hide,v.Z.fromBelow);break;case"bottom-start":case"bottom-center":case"bottom-end":f=c()(v.Z.hide,v.Z.fromAbove),g=c()(v.Z.hide,v.Z.fromAbove);break;case"left-start":case"left-center":case"left-end":f=c()(v.Z.hide,v.Z.fromRight),g=c()(v.Z.hide,v.Z.fromRight);break;case"right-start":case"right-center":case"right-end":f=c()(v.Z.hide,v.Z.fromLeft),g=c()(v.Z.hide,v.Z.fromLeft)}return{layerProps:m,triggerProps:s,hoverProps:l,transitionProps:{show:a,beforeEnter:()=>o(!0),afterLeave:()=>o(!1),enterFrom:f,leaveTo:g},renderLayer:h,shouldShow:a||i}}({layerOptions:(0,r._)({placement:f,possiblePlacements:_.includes(f)?_:b},g),hoverOptions:(0,r._)({delayLeave:50},w)}),{style:F}=x,I=(0,o._)(x,["style"]);return Z?(0,a.tZ)(a.HY,{children:t}):(0,a.BX)(a.HY,{children:[(0,a.tZ)(m,(0,i._)((0,r._)({},P,k,B),{children:t})),N&&S((0,a.tZ)(y,{transitionProps:C,tooltipProps:(0,i._)((0,r._)({},I,k),{style:(0,i._)((0,r._)({},F),{maxWidth:320,zIndex:Number.MAX_SAFE_INTEGER})}),text:n,title:l,imageUrl:s,leading:h,trailing:p}))]})};function y(e){let{transitionProps:t,tooltipProps:n,leading:o,trailing:l,text:s,title:c,imageUrl:u}=e,p=s&&!c&&!u;return(0,a.tZ)("div",(0,i._)((0,r._)({},n),{children:(0,a.tZ)(C,(0,i._)((0,r._)({},t),{children:(0,a.tZ)(m.C,{children:(0,a.BX)(k,{textOnly:p,children:[u&&(0,a.tZ)(P,{children:(0,a.tZ)(h.e,{src:u,maxWidth:296,useRetinaSizing:!0,imageIsFixedWidth:!0})}),(0,a.BX)(x,{hasTitle:!!c,children:[o&&(0,a.tZ)(B,{children:o}),(0,a.BX)(w,{children:[c&&(0,a.tZ)(g.xv.B4,{weight:"medium",color:"primary",className:v.Z.title,children:c}),(0,a.tZ)(g.xv.B4,{color:"primary",opacity:80,lineHeight:16,children:"string"==typeof s?s.split("\n").map((e,t)=>(0,a.BX)(d.Fragment,{children:[t>0&&(0,a.tZ)("br",{}),e]},t)):s})]}),l&&(0,a.tZ)(B,{children:l})]})]})})}))}))}let w=(0,p.zo)({display:"flex",direction:"column",gap:2});function B(e){let{children:t}=e;return(0,a.tZ)(f.X2,{alignItems:"center",justifyContent:"center",className:v.Z.endcapContainer,flex:"auto",gap:8,children:t})}function x(e){let{hasTitle:t,children:n}=e;return(0,a.tZ)(f.X2,{alignItems:t?"start":"center",gap:8,children:n})}function P(e){let{children:t}=e;return(0,a.tZ)(f.sg,{border:"detail",radius:"sm",className:v.Z.imageContainer,overflow:"hidden",children:t})}function k(e){let{textOnly:t,children:n}=e;return(0,a.tZ)(f.sg,{alignItems:"center",paddingY:t?6:12,paddingX:t?8:12,gap:8,radius:"md",shadow:"md",border:"detail",bg:"secondary",children:n})}function C(e){return(0,a.tZ)(l.u,(0,r._)({appear:!0,unmount:!1,className:v.Z.animate,enterTo:v.Z.show,leaveFrom:v.Z.show},e))}},1669:function(e,t,n){n.d(t,{o:()=>a});var r=n(16584),i=n(98914),o=n(58175);let a=e=>{let{error:t}=e,n=(0,i.HM)(t);return(null==n?void 0:n.html)?(0,r.tZ)(o.xv.B4,{weight:"medium",color:"error",dangerouslySetInnerHTML:{__html:n.html}}):(0,r.tZ)(o.xv.B4,{weight:"medium",color:"error",children:(null==n?void 0:n.msg)||"Something went wrong"})}},76566:function(e,t,n){n.d(t,{S:()=>u});var r=n(27412),i=n(16584),o=n(20042),a=n(98661),l=n(20888),s=n(9682),c=n(19081),d=n(58175);class u extends a.Component{static getDerivedStateFromError(e){return{error:e}}componentDidMount(){Promise.all([n.e("7152"),n.e("6993")]).then(n.bind(n,91985)).then(e=>{this.Sentry=e.Sentry})}componentDidCatch(e){console.error(e),this.Sentry&&this.Sentry.captureException(e)}render(){let{error:e}=this.state;return(0,i.tZ)(m,{onReset:()=>this.setState({error:null}),error:e,children:e?(0,i.tZ)(h,{}):this.props.children})}constructor(e){super(e),(0,r._)(this,"Sentry",null),this.state={error:null}}}function m(e){let{onReset:t,error:n,children:r}=e,l=(0,a.useRef)((0,o.getCurrentUrl)());return(0,s.js)(e=>{n&&l.current!==e&&t(),l.current=e},[]),n?(0,i.tZ)(h,{}):r}function h(){return(0,i.BX)(c.tu,{flex:"grow",justifyContent:"center",alignItems:"center",gap:32,padding:20,children:[(0,i.tZ)(l.e,{src:"/img/reader/toad.png",maxWidth:200}),(0,i.BX)(c.tu,{gap:8,children:[(0,i.tZ)(d.xv.H3,{weight:"semibold",align:"center",children:"Oh no—this page croaked."}),(0,i.tZ)(d.xv.B3,{color:"secondary",align:"center",children:"Try again, or hop to another page."})]})]})}},50312:function(e,t,n){n.d(t,{F:()=>h,r:()=>m});var r=n(7409),i=n(99282),o=n(98848),a=n(16584),l=n(98661),s=n(20042),c=n(21811),d=n(93252),u=n(71068);let m=(0,l.forwardRef)((e,t)=>{var{href:n,onClick:l,campaign:s,replace:c,state:d,showBack:m}=e,p=(0,o._)(e,["href","onClick","campaign","replace","state","showBack"]);let f=h({href:n,onClick:l,campaign:s,replace:c,state:d=m?(0,i._)((0,r._)({},d),{showBack:!0}):d});return(0,a.tZ)(u.xu,(0,r._)((0,i._)((0,r._)({as:"a"},p),{ref:t}),f))});function h(e){let{onClick:t,href:n,campaign:i,replace:o,state:a}=e;if(n&&!(0,d.P)()){let e;try{e=new URL(n)}catch(t){try{e=new URL("".concat(document.location.origin).concat(n))}catch(e){}}if(e){if(e.origin!==document.location.origin||i){if(e.origin!==document.location.origin&&i){for(let[t,n]of Object.entries(i)){let r="name"===t?"campaign":t;e.searchParams.set("utm_".concat(r),n)}n=e.toString()}}else{let t=new URLSearchParams,r={};for(let[n,i]of e.searchParams)n.startsWith("utm_")?"utm_campaign"===n?r.name=i:r[n.replace(/^utm_/,"")]=i:t.append(n,i);i=r,n="".concat(e.pathname,"?").concat(t)}}}return{href:n,onClick:e=>{if(null==t||t(e),!e.ctrlKey&&!e.shiftKey&&!e.metaKey&&n&&!(0,d.P)()){if(e.defaultPrevented){e.stopPropagation();return}(0,c.j)((0,r._)({},i)),e.preventDefault(),e.stopPropagation(),(0,s.route)(n,o),a&&history.replaceState(a,"")}}}}},69304:function(e,t,n){n(16584),n(19081),n(58175),n(44854)},93502:function(e,t,n){n(48980)},65958:function(e,t,n){n.d(t,{s:()=>p});var r=n(7409),i=n(99282),o=n(16584),a=n(48980),l=n(80878),s=n(7882),c=n(70379),d=n(97842),u=n(95551),m=n(62515),h=n(36186);function p(e){let{source:t}=e,n=function(e){let{source:t}=e,n=(0,d.I0)(),o=(0,s.ib)({pathname:"/api/v1/messages/dm/start",method:"POST"}),a=async e=>{let r=await o.refetch({json:{user_ids:e,source:t}});return r instanceof Error||n({type:"conversation-load_more",payload:{edge:"before",cursor:null,page:r}}),r};return(0,i._)((0,r._)({},o),{handleStart:a})}({source:t}),p=(0,u.d)(),f=(0,c.pm)(),g=async e=>{var t;let s=await n.handleStart(e);return s instanceof Error?(s instanceof a.kp&&(null===(t=s.body)||void 0===t?void 0:t.type)==="profile_not_set_up"?f.popToast(e=>(0,o.tZ)(c.FN,(0,i._)((0,r._)({},e),{text:"Please set up your profile before sending a message.",cta:"Set up profile",href:(0,h.Nh)({utm_source:"substack",utm_campaign:"chat_dm_button",redirect:window.location}),localNavigation:!1}))):p(s,"Could not start conversation."),!1):((0,l._)((0,m.Rm)(s.thread.id)),!0)};return(0,i._)((0,r._)({},n),{handleStart:g})}},32189:function(e,t,n){n.d(t,{x:()=>l});var r=n(30396),i=n(60807),o=n(68833),a=n(88817);function l(e){let{surface:t,zIndex:n=null}=e,l=(0,i.aF)(),{onboardingModalRef:s}=(0,a.SJ)();return(0,r.d4)(()=>{s.current&&null!==n&&(s.current.props.zIndex=n)},[s,n]),(e,n)=>r=>{if(!e){console.warn("No publication provided to usePubOnboardingHandler handler");return}if(!l){var i,a;if(!s.current)return;r.preventDefault(),n?null===(i=s.current)||void 0===i||i.openForPub(e,n):null===(a=s.current)||void 0===a||a.openToPubSignup(e);return}(0,o.x6)(e,t)}}}}]);