(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["4834"],{56029:function(e,t,n){var i=n(33448);e.exports=function(e,t,n){for(var r=-1,l=e.length;++rt}},84753:function(e,t,n){var i=n(56029),r=n(53325),l=n(67206);e.exports=function(e,t){return e&&e.length?i(e,l(t,2),r):void 0}},43174:function(e,t,n){var i=n(55189)(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]});e.exports=i},35047:function(e,t,n){"use strict";n.d(t,{ED:()=>G,Eh:()=>q,ZP:()=>U,sv:()=>H});var i=n(7409),r=n(99282),l=n(58865),a=n(16584),o=n(98661),s=n(30396),c=n(94184),u=n.n(c),d=n(36808),h=n(2564),p=n(71375),m=n(91925),g=n(12620),b=n(64343),_=n(21312),v=n(20888),f=n(75744),Z=n(57391),w=n(95441),y=n(56629),N=n(40647),S=n(35702),k=n(68833),x=n(98914),P=n(71068),C=n(15771),B=n(19081),E=n(10510),I=n(58175),T=n(64528),A=n(55722),R=n(74312),L=n(31377),X=n(60308),D=n(26111),F=n(70408),O=n(84864),W=n(47929),z=n(31190);function J(){let e=(0,l._)(["By ",""]);return J=function(){return e},e}let M="intro_popup_last_hidden_at";function H(e){let{includePrice:t=!0,includeRankingDetail:i=!0,includeByline:r=!0,includeBadge:l=!1,rankingDetailOverrideText:o=null,language:s="en"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=s||e.language,{iTemplate:u}=I18N.i(s||e.language),d=(0,O.getByLine)(e),h=null;return i&&(h=o||(e.rankingDetailByLanguage&&"en"!==c&&e.rankingDetailByLanguage[c]?e.rankingDetailByLanguage[c].rankingDetail:e.rankingDetail)),(0,a.BX)(T.N,{separator:" \xb7 ",children:[r&&d?(0,a.BX)(B.hs,{inline:!0,gap:4,children:[u(J(),d),l&&(0,a.tZ)(R.cr,{module:"../pencraft/unstable/UserBadge",resolve:e=>e.UserBadge,onRequest:()=>Promise.all([n.e("565"),n.e("1400")]).then(n.bind(n,71460)),size:"sm",tier:e.author_bestseller_tier,userId:e.author_id,whileLoading:e.author_bestseller_tier?(0,a.tZ)(B.hs,{alignItems:"center",children:(0,a.tZ)(A.o,{size:"sm",tier:e.author_bestseller_tier})}):(0,a.tZ)(a.HY,{})})]}):null,h,t&&function(e,t){let{language:n}=t,i=!e.disable_monthly_subscriptions&&e.plans&&e.plans.filter(e=>"month"===e.interval).sort((e,t)=>e.amount-t.amount)[0],r=!e.disable_annual_subscriptions&&e.plans&&e.plans.filter(e=>"year"===e.interval).sort((e,t)=>e.amount-t.amount)[0],l=i||r;if(l)return(0,O.planBasePricing)(l,{language:n})}(e,{language:s})]})}let U=(0,o.memo)(e=>{var t,n,l;let{publication:o,user:c,post:u,onHide:h,freeSignup:p,hidden:g,alwaysShow:b,showOnMount:_,freeSignupEmail:v,email:f,referralCode:w,blurbs:P,launchWelcomePage:C,topThreePosts:B,topThreeSubscribers:E}=e,{getConfigFor:I}=(0,N.xR)(),T=I("welcome_page_query_params"),[A,R]=(0,s.eJ)(!1),[F,z]=(0,s.eJ)(!!(C||b)),J=(e,t)=>{var n;return T&&null!==(n=(0,D.x)(e))&&void 0!==n?n:t},[H]=(0,s.eJ)(J("no_skip",void 0)),[U]=(0,s.eJ)(J("no_blurbs",!1)),[q]=(0,s.eJ)(()=>{let e=J("hero_text",void 0);return e?decodeURIComponent(e):void 0}),{getExperimentVariant:Y,exposeExperiment:K}=(0,Z.jc)(),{getSettingFor:Q}=(0,y.So)(),$=null!==(t=(0,D.x)("force"))&&void 0!==t?t:void 0;(0,s.d4)(()=>{let e=e=>{"Escape"===e.key&&ei(!0)};if(F)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[F]),(0,s.d4)(()=>{if(C&&!er()||et()){if("undefined"!=typeof window&&(0,x.cn)(document.documentElement,"has-intro-popup"),(0,D.x)("r")){let e=(0,D.x)("r");c&&(0,O.userReferralKey)(c)===e||(0,k.j)(k.FP.COVER_PAGE_REFERRAL_VISIT,{referral_key:e,referring_user:(0,O.userFromReferralKey)(e)})}ee()}else h&&h(),(0,S.a)({hide_intro_popup:!0}),"undefined"!=typeof window&&(0,x.IV)(document.documentElement,"has-intro-popup"),!b&&"undefined"!=typeof window&&(0,x.pv)(document.documentElement,"show-intro-popup")&&(0,x.IV)(document.documentElement,"show-intro-popup");return["no_skip","no_blurbs","hero_text","hide_intro_popup"].forEach(e=>(0,x.iO)(e)),()=>{"undefined"!=typeof window&&(0,x.IV)(document.documentElement,"has-intro-popup"),ei(!0)}},[]);let ee=()=>{"undefined"==typeof window||((0,x.cn)(document.documentElement,"show-intro-popup"),(0,k.j)(k.FP.COVER_PAGE_SHOWN,{has_cover_photo:!!o.cover_photo_url,has_free_signup_email:!!v,has_free_signup:!!p,functional_version:!0,launch_welcome_page:C,always_show:b,hidden:g,screen_height:"undefined"!=typeof window?window.innerHeight:null,screen_width:"undefined"!=typeof window?window.innerWidth:null,test_experiment_variant_v5:Y("test_experiment_v5")}),K("test_experiment_v5"),b||(0,k.XY)("pageview",{dl:"".concat(document.location.origin,"/welcome").concat(document.location.search)})),z(!0)},et=(0,s.I4)(()=>!!b||!g&&(!!_||!!A||!er()&&!!(null==u||u&&!(0,L.isPaidAudience)(u.audience))&&!p&&(!c||!c.is_free_subscribed&&!c.is_subscribed)),[b,p,g,u,_,A,c]),en=Q("display_welcome_page_details")&&o.freeSubscriberCount&&!(0,x.K1)()&&!$&&!o.invite_only&&!w&&!o.custom_domain&&(null==B?void 0:B.length)&&(null==E?void 0:E.length)&&!H&&!q;(0,s.d4)(()=>{F&&et()&&en&&K("welcome_page_update_desktop_visuals_limited")},[K,Q,en,et,F]);let ei=e=>{e||(el(),setTimeout(()=>{(0,S.a)({hide_intro_popup:!0})},500)),h&&h(),!b&&"undefined"!=typeof window&&(0,x.pv)(document.documentElement,"show-intro-popup")&&(0,x.IV)(document.documentElement,"show-intro-popup")},er=()=>{let e=d.get(M);return!!(e&&new Date(e)>new Date(Date.now()-864e5))},el=()=>{d.set(M,new Date().toJSON(),{expires:3650})},ea=async e=>{(0,k.j)(k.FP.COVER_PAGE_EMAIL_SUBMITTED,{is_paying_sub:!!e.body.prompt_to_login,has_plans:!!o.plans,functional_version:!0,homepage_type:o.homepage_type}),el(),R(!0),(0,S.a)({freeSignup:!0,freeSignupEmail:e.body.email});let t=b?"/":document.location.href;e.body.prompt_to_login?setTimeout(()=>{document.location.href=(0,X.n1t)("/account/login",{redirect:t,email:e.body.email})},30):document.location.href=(0,X.n1t)("/subscribe",(0,r._)((0,i._)({next:t,later:!0,just_signed_up:!0},e.body.subscription_id&&{subscription_id:e.body.subscription_id},e.body.referral_token&&{referral_token:e.body.referral_token}),{requires_confirmation:e.body.requires_confirmation?"true":"",utm_source:W.b3.coverPage,email:e.body.email,skip_redirect_check:!0}))},eo=()=>{(0,k.j)(k.FP.COVER_PAGE_MAYBE_LATER_CLICKED,{functional_version:!0}),ei()};if(!F||!et())return null;let es=(0,a.tZ)(G,{source:"cover_page",email:f,pub:o,user:null!=c?c:null,freeSignup:p,freeSignupEmail:v,referralCode:w,forceSignup:null!==(l=null!==(n=(0,D.x)("force"))&&void 0!==n?n:H)&&void 0!==l?l:void 0,onMaybeLater:H?void 0:eo,onFreeSignup:ea,blurbs:P,hideBlurbs:U,overrideSubtitle:q});if(en)switch(Y("welcome_page_update_desktop_visuals_limited")){case"treatment_social_proof":es=(0,a.tZ)(j,{email:f,pub:o,user:null!=c?c:null,freeSignup:p,freeSignupEmail:v,onMaybeLater:eo,onFreeSignup:ea,blurbs:P,topThreeSubscribers:E});break;case"treatment_large_fonts":es=(0,a.tZ)(V,{email:f,pub:o,user:null!=c?c:null,freeSignup:p,freeSignupEmail:v,onMaybeLater:eo,onFreeSignup:ea,blurbs:P})}return(0,a.tZ)(m.s,{children:(0,a.tZ)("div",{className:"intro-popup",children:(0,a.tZ)("div",{className:"intro-popup-page",children:es})})})}),q=e=>(0,a.tZ)("div",{className:"intro-inline",children:(0,a.tZ)(G,(0,i._)({},e))}),j=e=>{var t,r,l,o,c;let{pub:d,user:h,email:p,freeSignup:m,freeSignupEmail:Z,onMaybeLater:N,onFreeSignup:S,blurbs:x,topThreeSubscribers:C}=e,T="cover_page",A=(0,s.qp)(y.vz),{iString:L,language:D}=(0,w.M1)(),{title:O,subtitle:W,logoUrl:J,coverPhotoUrl:M,hideTitle:U,hideSubtitle:q}=Y(d),j=M&&(0,X.zJH)(M),V=j&&j.width/j.height,G=!!(V&&V<2),K=!U||M&&G,$=!q||M&&G;(0,s.d4)(()=>{(0,k.j)(k.FP.FULL_EMAIL_FORM_SHOWN,{source:T,functional_version:!0,version:"social-proof"})},[T]);let ee=x?x.filter(e=>""!=e.description):[],et=H(d,{includePrice:!1,includeBadge:!0,includeRankingDetail:!1,language:D});return(0,a.BX)("div",{className:"full-email-form",children:[(0,a.BX)("div",{className:"vertically-centered",children:[(0,a.tZ)(Q,{onClick:N}),M?G?null:(0,a.tZ)(P.xu,{paddingBottom:48,children:(0,a.tZ)(v.e,{className:z.Z.publicationCoverPhotoCenter,src:M,imageProps:{quality:"auto:best"},maxWidth:840,loading:"eager",style:(0,i._)({},j&&j.width&&{height:"min(168px, ".concat(840*j.height/j.width,"px)")}),imageIsFixedWidth:!0})}):J&&(0,a.tZ)(P.xu,{paddingBottom:32,children:(0,a.tZ)(E.wk,{logoUrl:J,size:88})}),(0,a.BX)(B.hs,{gap:48,children:[(0,a.BX)(B.tu,{className:G?z.Z.column:z.Z.centeredColumn,gap:32,children:[(0,a.BX)(B.tu,{gap:16,children:[K?(0,a.tZ)(I.xv.H1,{textAlign:G?"left":"center",font:"pub-headings",className:z.Z.coverPrimary,textWrap:"balance",children:O}):null,$?(0,a.tZ)(I.xv.B3,{textAlign:G?"left":"center",font:"display",size:15,lineHeight:20,className:z.Z.coverSecondary,textWrap:"balance",children:W}):null,et&&(null===(o=et.props)||void 0===o?void 0:null===(l=o.children)||void 0===l?void 0:null===(r=l.filter)||void 0===r?void 0:null===(t=r.call(l,Boolean))||void 0===t?void 0:t.length)?(0,a.tZ)(I.xv.B2,{textAlign:G?"left":"center",weight:"semibold",font:"display",size:17,lineHeight:24,className:z.Z.coverSecondary,children:et}):null]}),(0,a.BX)(B.tu,{gap:16,children:[(0,a.BX)(B.hs,{alignItems:"center",alignSelf:G?"start":"center",gap:8,children:[(0,a.tZ)(B.hs,{alignItems:"center",className:u()(z.Z.faces),children:C.map((e,t)=>{let{id:i,photo_url:r}=e,l=(0,a.tZ)(v.e,{className:u()(z.Z.face,0===t&&z.Z.first,t===C.length-1&&z.Z.last),style:{zIndex:C.length-t},maxWidth:80,src:(0,X.zF4)(r||(0,F.I4)(i),64),imageIsFixedWidth:!0});return(0,a.tZ)(R.cr,{module:"@/frontend/components/ProfileHoverCard",resolve:e=>e.ProfileHoverCard,onRequest:()=>Promise.all([n.e("6304"),n.e("1426"),n.e("565"),n.e("881"),n.e("5330"),n.e("1262"),n.e("222"),n.e("4803"),n.e("9340")]).then(n.bind(n,85685)),whileLoading:l,subject:e,dontStopPropagation:!1,disabled:!1,placement:"top-start",children:l})})}),d.freeSubscriberCount?(0,a.BX)(I.xv.H3,{font:"display",weight:"semibold",size:20,lineHeight:24,className:z.Z.coverPrimary,translated:!0,children:["Join over ",I18N.p(d.freeSubscriberCount)," subscribers"]}):null]}),(0,a.tZ)(g.Z,{email:p,isWelcomePageColor:!0,freeSignup:m,freeSignupEmail:Z,pub:d,source:T,user:h,onConfirmationRequired:"enabled"===d.payments_state?()=>null:void 0,onSuccess:S||(()=>document.location.href="/"),autoFocus:!0,className:z.Z.containerClassName,promptClassName:z.Z.promptClassName,inputClassName:z.Z.inputClassName,subscribeButtonClassName:z.Z.subscribeButtonClassName}),(0,a.BX)(B.hs,{gap:4,cursor:"pointer",alignItems:"center",alignSelf:G?"start":"center",inline:!0,onClick:N,children:[(0,a.tZ)(I.xv.B3,{style:{color:"var(--cover_print_secondary)"},children:"No thanks"===A.getSettingFor("welcome_page_opt_out_text")?L("No thanks"):null!==(c=A.getSettingFor("welcome_page_opt_out_text"))&&void 0!==c?c:L("No thanks")}),(0,a.tZ)(b.Z,{height:18,stroke:"var(--cover_print_secondary)",strokeWidth:2})]})]})]}),M&&G?(0,a.tZ)(B.tu,{className:u()(z.Z.column,z.Z.hideColumnSmallScreens),gap:32,children:(0,a.tZ)(v.e,{className:z.Z.publicationCoverPhotoRight,src:M,imageProps:{quality:"auto:best"},maxWidth:476,loading:"eager",imageIsFixedWidth:!0})}):null]}),!!(null==ee?void 0:ee.length)&&(0,a.tZ)("div",{className:"blurb-buffer"}),!!(null==ee?void 0:ee.length)&&(0,a.tZ)(B.gq,{className:"blurbs",gap:20,children:ee.map(e=>(0,a.BX)(B.tu,{gap:8,className:"blurb",children:[(0,a.tZ)(I.xv.B4,{className:"blurb-text",children:(0,a.tZ)(_.Z,{maxLines:4,ellipsesText:"...”",text:"“".concat(e.description,"”")})}),(0,a.BX)(I.xv.B4,{weight:"semibold",className:"blurb-text",children:[e.author_name||e.recommendingPublication.email_from_name||e.recommendingPublication.copyright,", ",(0,a.tZ)("a",{href:(0,X.SVA)(e.recommendingPublication),children:e.recommendingPublication.name})]})]}))})]}),(0,a.tZ)(f.fJ,{publication:d})]})},V=e=>{var t;let{pub:n,user:r,email:l,freeSignup:o,freeSignupEmail:c,onMaybeLater:d,onFreeSignup:h,blurbs:p}=e,m="cover_page",Z=(0,s.qp)(y.vz),{getSettingFor:N}=(0,y.So)(),{iString:S,language:x}=(0,w.M1)(),{title:C,subtitle:T,logoUrl:A,coverPhotoUrl:R,hideTitle:L,hideSubtitle:D}=Y(n),F=R&&(0,X.zJH)(R),O=F&&F.width/F.height,W=!!(O&&O<2),J=!L||R&&W,M=!D||R&&W;(0,s.d4)(()=>{(0,k.j)(k.FP.FULL_EMAIL_FORM_SHOWN,{source:m,functional_version:!0,version:"large-fonts"})},[m]);let U=p?p.filter(e=>""!=e.description):[],q=N("display_welcome_page_details");return(0,a.BX)("div",{className:"full-email-form",children:[(0,a.BX)("div",{className:"vertically-centered",children:[(0,a.tZ)(Q,{onClick:d}),R?W?null:(0,a.tZ)(P.xu,{paddingBottom:48,children:(0,a.tZ)(v.e,{className:z.Z.publicationCoverPhotoCenter,src:R,imageProps:{quality:"auto:best"},maxWidth:840,loading:"eager",style:(0,i._)({},F&&F.width&&{height:"min(168px, ".concat(840*F.height/F.width,"px)")}),imageIsFixedWidth:!0})}):A&&(0,a.tZ)(P.xu,{paddingBottom:32,children:(0,a.tZ)(E.wk,{logoUrl:A,size:88})}),(0,a.BX)(B.hs,{gap:48,children:[(0,a.BX)(B.tu,{className:W?z.Z.largeColumn:z.Z.largeCenteredColumn,gap:32,children:[(0,a.BX)(B.tu,{gap:16,children:[J?(0,a.tZ)(I.xv.H1,{textAlign:W?"left":"center",font:"pub-headings",className:u()(z.Z.coverPrimary,z.Z.largeHeading),textWrap:"balance",children:C}):null,M?(0,a.tZ)(I.xv.B3,{textAlign:W?"left":"center",font:"display",size:15,lineHeight:20,className:u()(z.Z.coverSecondary,z.Z.largeSubHeading),textWrap:"balance",children:T}):null,(0,a.tZ)(I.xv.B2,{textAlign:"left",weight:"semibold",font:"display",size:17,lineHeight:24,className:z.Z.coverSecondary,alignSelf:W?"start":"center",children:H(n,{includePrice:!1,includeBadge:!0,rankingDetailOverrideText:n.rankingDetailFreeSubscriberCount,includeRankingDetail:!!q,language:x})})]}),(0,a.BX)(B.tu,{gap:16,children:[(0,a.tZ)(g.Z,{email:l,isWelcomePageColor:!0,freeSignup:o,freeSignupEmail:c,pub:n,source:m,user:r,onConfirmationRequired:"enabled"===n.payments_state?()=>null:void 0,onSuccess:h||(()=>document.location.href="/"),autoFocus:!0,className:z.Z.containerClassName,promptClassName:z.Z.largePromptClassName,inputClassName:z.Z.largeInputClassName,inputWrapperClassName:z.Z.largeInputWrapperClassName,subscribeButtonClassName:z.Z.largeSubscribeButtonClassName}),(0,a.BX)(B.hs,{gap:4,cursor:"pointer",alignItems:"center",alignSelf:"center",inline:!0,onClick:d,children:[(0,a.tZ)(I.xv.B1,{size:20,lineHeight:30,weight:"semibold",style:{color:"var(--cover_print_secondary)"},children:"No thanks"===Z.getSettingFor("welcome_page_opt_out_text")?S("No thanks"):null!==(t=Z.getSettingFor("welcome_page_opt_out_text"))&&void 0!==t?t:S("No thanks")}),(0,a.tZ)(b.Z,{height:18,stroke:"var(--cover_print_secondary)",strokeWidth:2})]})]})]}),R&&W?(0,a.tZ)(B.tu,{className:u()(z.Z.largeColumn,z.Z.hideLargeColumnSmallScreens),gap:32,children:(0,a.tZ)(v.e,{className:z.Z.largePublicationCoverPhotoRight,src:R,imageProps:{quality:"auto:best"},maxWidth:568,loading:"eager",imageIsFixedWidth:!0})}):null]}),!!(null==U?void 0:U.length)&&(0,a.tZ)("div",{className:"blurb-buffer"}),!!(null==U?void 0:U.length)&&(0,a.tZ)(B.gq,{className:"blurbs",gap:20,children:U.map(e=>(0,a.BX)(B.tu,{gap:8,className:"blurb",children:[(0,a.tZ)(I.xv.B4,{className:"blurb-text",children:(0,a.tZ)(_.Z,{maxLines:4,ellipsesText:"...”",text:"“".concat(e.description,"”")})}),(0,a.BX)(I.xv.B4,{weight:"semibold",className:"blurb-text",children:[e.author_name||e.recommendingPublication.email_from_name||e.recommendingPublication.copyright,", ",(0,a.tZ)("a",{href:(0,X.SVA)(e.recommendingPublication),children:e.recommendingPublication.name})]})]}))})]}),(0,a.tZ)(f.fJ,{publication:n})]})},G=e=>{var t;let{autoFocus:r=!0,pub:l,user:o,email:c,freeSignup:d,freeSignupEmail:p,referralCode:m,source:b,forceSignup:v,submitButtonText:f,onMaybeLater:Z,onFreeSignup:N,blurbs:S,hideBlurbs:x,overrideSubtitle:P}=e,E=(0,s.qp)(y.vz),{iString:T}=(0,w.M1)(),A=(0,D.x)("referralCode"),L=(0,D.x)("refSource"),F=T("Learn More"),O=(0,X.d6h)(l,{params:(0,i._)({utm_source:W.b3.subscribeEmail,utm_content:W.fZ.learnMore},A&&{referralCode:A},L&&{refSource:L})});(0,s.d4)(()=>{"subscribe_page"===b&&(0,k.j)(k.FP.SUBSCRIBE_EMAIL_FULL_SCREEN_SHOWN,{functional_version:!0}),(0,k.j)(k.FP.FULL_EMAIL_FORM_SHOWN,{source:b,functional_version:!0})},[b]);let J=S&&!x?S.filter(e=>""!=e.description):[];return(0,a.tZ)("div",{className:"full-email-form",children:(0,a.BX)("div",{className:"vertically-centered",children:[Z&&!l.invite_only&&(0,a.tZ)(Q,{onClick:Z}),(0,a.tZ)(K,{pub:l,overrideSubtitle:P}),!l.invite_only||o&&o.is_free_subscribed?(0,a.BX)(a.HY,{children:[(0,a.tZ)(B.gq,{justifyContent:"center",style:{width:"100%"},children:(0,a.BX)(B.tu,{gap:4,style:{width:"100%",maxWidth:"380px"},children:[(0,a.tZ)(g.Z,{email:c,isWelcomePageColor:!0,freeSignup:d,freeSignupEmail:p,pub:l,referralCode:m,source:b,submitButtonText:f,user:o,onConfirmationRequired:"enabled"===l.payments_state?()=>null:void 0,onSuccess:N||(()=>document.location.href="/"),autoFocus:r}),(0,a.BX)(I.xv.B4,{paddingX:{mobile:16,desktop:0},paddingTop:16,className:z.Z.tosText,translated:!0,children:["By subscribing, I agree to Substack’s"," ",(0,a.tZ)("a",{className:z.Z.tosLink,href:(0,X._QN)(),target:"_blank",rel:"noopener noreferrer",children:"Terms of Use"})," ","and acknowledge its"," ",(0,a.tZ)("a",{className:z.Z.tosLink,href:(0,X.WFt)(),target:"_blank",rel:"noopener noreferrer",children:"Information Collection Notice"})," ","and"," ",(0,a.tZ)("a",{className:z.Z.tosLink,href:(0,X.Zzu)(),target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"})]})]})}),!v&&(Z?(0,a.tZ)("a",{onClick:e=>e.preventDefault(),className:"no-styles",children:(0,a.BX)(C.zx,{priority:"quaternary",className:z.Z.maybeLater,onClick:Z,"data-testid":"maybeLater",children:["No thanks"===E.getSettingFor("welcome_page_opt_out_text")?T("No thanks"):null!==(t=E.getSettingFor("welcome_page_opt_out_text"))&&void 0!==t?t:T("No thanks"),(0,a.tZ)(h.Z,{size:20})]})}):(0,a.BX)(C.zx,{priority:"quaternary",className:z.Z.maybeLater,href:O,localNavigation:!1,children:[F,(0,a.tZ)(h.Z,{size:20})]}))]}):(0,a.tZ)(R.cr,{onRequest:()=>n.e("2457").then(n.bind(n,51323)),resolve:e=>e.InviteActions,module:"./InviteActions",pub:l,user:o,freeSignupEmail:p}),!!(null==J?void 0:J.length)&&(0,a.tZ)("div",{className:"blurb-buffer"}),!!(null==J?void 0:J.length)&&(0,a.tZ)(B.gq,{className:"blurbs",gap:20,children:J.map(e=>(0,a.BX)(B.tu,{gap:8,className:"blurb",children:[(0,a.tZ)(I.xv.B4,{className:u()("blurb-text",z.Z.blurbText),children:(0,a.tZ)(_.Z,{maxLines:4,ellipsesText:"...”",text:"“".concat(e.description,"”")})}),(0,a.BX)(I.xv.B4,{weight:"semibold",className:u()("blurb-text",z.Z.blurbText),children:[e.author_name||e.recommendingPublication.email_from_name||e.recommendingPublication.copyright,", ",(0,a.tZ)("a",{href:(0,X.SVA)(e.recommendingPublication),children:e.recommendingPublication.name})]})]}))})]})})},Y=(e,t)=>{let n,i,r,l,a,o;let{getConfigFor:s}=(0,N.xR)();if(s("section_specific_welcome_pages")&&e.section){var c;n=e.section.name,i=e.section.description,r=null!==(c=e.section.logo_url)&&void 0!==c?c:e.logo_url,a=!!((l=e.section.cover_photo_url)&&e.section.hide_intro_title),o=!!(l&&e.section.hide_intro_subtitle)}else n=e.name,i=e.hero_text,r=e.logo_url,a=!!((l=e.cover_photo_url)&&e.hide_intro_title),o=!!(l&&e.hide_intro_subtitle);return t&&(i=t),{title:n,subtitle:i,logoUrl:r,coverPhotoUrl:l,hideTitle:a,hideSubtitle:o}},K=e=>{let{pub:t,overrideSubtitle:n}=e,{getSettingFor:r}=(0,y.So)(),{language:l}=(0,w.M1)(),{title:o,subtitle:s,logoUrl:c,coverPhotoUrl:d,hideTitle:h,hideSubtitle:p}=Y(t,n),m=r("display_welcome_page_details"),g=d&&(0,X.zJH)(d);return(0,a.BX)(a.HY,{children:[d?(0,a.tZ)(v.e,{className:"publication-cover-photo",src:d,imageProps:{quality:"auto:best"},maxWidth:1360,loading:"eager",style:(0,i._)({},g&&g.width&&{height:"min(35vh, ".concat(680*g.height/g.width,"px)")})}):c&&(0,a.tZ)(P.xu,{paddingBottom:32,children:(0,a.tZ)(E.wk,{logoUrl:c,size:88})}),!h&&(0,a.tZ)("h1",{className:u()("publication-name",{"no-logo":!c,"with-cover":d},z.Z.balancedText),children:o}),!p&&s&&(0,a.tZ)("p",{className:u()("publication-tagline with-cover",{verbose:!0,"with-cover":d},z.Z.balancedText),children:s}),(0,a.tZ)("div",{className:"publication-meta",children:H(t,{includePrice:!1,includeBadge:!0,rankingDetailOverrideText:t.rankingDetailFreeSubscriberCount,includeRankingDetail:!!m,language:l})})]})},Q=e=>{let{onClick:t}=e;return(0,a.tZ)(C.hU,{onClick:t,"aria-label":"Close","data-testid":"close-welcome-modal",priority:"tertiary",className:z.Z.closeWelcomeModal,children:(0,a.tZ)(p.Z,{size:20})})}},16104:function(e,t,n){"use strict";if(n.d(t,{Z:()=>s}),3270==n.j)var i=n(7409);if(3270==n.j)var r=n(99282);if(3270==n.j)var l=n(98848);var a=n(16584),o=n(64515);let s=3270==n.j?e=>{var t,{color:n,stroke:s,strokeWidth:c=1}=e,u=(0,l._)(e,["color","stroke","strokeWidth"]);return(0,a.tZ)(o.l,(0,r._)((0,i._)({},u),{stroke:null!=n?n:s,strokeWidth:c,name:"CaretRightIcon",svgParams:{height:14,width:8,viewBox:"0 0 8 14"},children:(0,a.tZ)("path",{d:"M1 13L7 7L1 1",stroke:null!==(t=null!=n?n:s)&&void 0!==t?t:"#1C110B","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":null!=c?c:1})}))}:null},55438:function(e,t,n){"use strict";n.d(t,{Z:()=>c});var i=n(7409),r=n(99282),l=n(98848),a=n(16584),o=n(64515),s=n(90406);let c=e=>{var{svgParams:t}=e,n=(0,l._)(e,["svgParams"]);return(0,a.BX)(o.l,(0,r._)((0,i._)({},n),{name:"SubstackIcon",svgParams:(0,i._)({height:1e3,width:1e3,fill:s.Hu,stroke:"none"},t),children:[(0,a.tZ)("path",{d:"M764.166 348.371H236.319V419.402H764.166V348.371Z"}),(0,a.tZ)("path",{d:"M236.319 483.752V813.999L500.231 666.512L764.19 813.999V483.752H236.319Z"}),(0,a.tZ)("path",{d:"M764.166 213H236.319V284.019H764.166V213Z"})]}))}},30363:function(e,t,n){"use strict";n.d(t,{ZP:()=>u});var i=n(16584),r=n(94184),l=n.n(r),a=n(55438),o=n(90406),s=n(10510);let c=e=>{let{publication:t,logo_size:n=60,className:r="",children:c}=e;return(0,i.tZ)("table",{role:"presentation",className:l()("publication","card",r,t.logo_url?"has-logo":"no-logo"),width:"auto",cellpadding:0,cellspacing:0,border:"0",children:(0,i.BX)("tr",{cellpadding:"0",height:"100%",children:[n&&(0,i.tZ)("td",{rowspan:3,className:"logo",children:(0,i.tZ)("figure",{className:"logo",children:t.logo_url?(0,i.tZ)(s.CN,{pub:t,size:n}):(0,i.tZ)(a.Z,{isStatic:!0,fill:t.theme_var_background_pop||o.Hu,width:n,height:n})})}),(0,i.tZ)("td",{children:(0,i.BX)("table",{cellpadding:"0",cellspacing:"0",children:[(0,i.tZ)("tr",{children:(0,i.tZ)("td",{className:"title",children:t.name})}),(0,i.tZ)("tr",{cellpadding:"0",height:"80%",children:(0,i.tZ)("td",{className:"description",children:t.hero_text})}),c]})})]})})},u=e=>{let{publication:t,logo_size:n=60,isStatic:r=!1,children:l}=e;return r?(0,i.tZ)(c,{publication:t,logo_size:n,children:l}):(0,i.BX)("div",{className:"publication card",children:[n&&(0,i.tZ)("figure",{className:"logo",children:(0,i.tZ)(s.wk,{pub:t,size:n})}),(0,i.BX)("div",{className:"title",children:[(0,i.tZ)("div",{className:"name",children:t.name}),(0,i.tZ)("div",{className:"description",children:t.hero_text}),l]})]})}},32582:function(e,t,n){"use strict";n.d(t,{G6:()=>z,PH:()=>L,gQ:()=>W});var i=n(7409),r=n(99282),l=n(16584),a=n(6400),o=n(30396),s=n(85564),c=n.n(s),u=n(84753),d=n.n(u),h=n(43174),p=n.n(h),m=n(89734),g=n.n(m),b=n(45578),_=n.n(b),v=n(20042),f=n(80569),Z=n.n(f),w=n(20253),y=n(39535),N=n(94499),S=n(30363),k=n(32261),x=n(98914),P=n(15771),C=n(43570),B=n(98012),E=n(60308),I=n(26111),T=n(47929);let A=e=>{let{onClick:t,checked:n}=e;return(0,l.BX)("div",{className:"select-all",children:[(0,l.tZ)("input",{name:"all",type:"checkbox",onInput:t,checked:n}),(0,l.BX)("label",{for:"all",onClick:t,children:["Select ",n?"none":"all"]})]})},R=e=>{let{disabled:t,onClick:n,children:i}=e;return(0,l.tZ)(P.zx,{type:"submit",priority:"primary",size:"lg",disabled:t,onClick:n,children:i})},L=e=>{let{extraProps:t={},linkType:n=null,discoverable:a=null,text:o,icon:s=!0,onClick:c=null}=e,u={};null!==n&&(u.type=n),null!==a&&(u.discoverable=a);let d=(0,E.nRe)(u);return(0,l.tZ)("div",(0,r._)((0,i._)({className:"twitter-discover"},t),{children:(0,l.tZ)("a",(0,r._)((0,i._)({className:"twitter-link",href:d},c&&{onClick:c}),{native:!0,children:(0,l.BX)("div",{className:"inner",children:[s&&(0,l.tZ)(y.Z,{fill:"white"}),(0,l.tZ)("span",{className:"twitter-link-text",children:o||"Find writers and creators I follow"})]})}))}))},X=e=>{let{pub:t,checked:n,onToggle:i,isSubscribed:r,author:a,screenName:o}=e;return(0,l.tZ)("li",{className:"linked-pub",children:(0,l.BX)("div",{className:"linked-pub",children:[(0,l.BX)("div",{className:"photo",children:[(0,l.tZ)("div",{className:"subscribed-status",children:(0,l.tZ)("input",{type:"checkbox",checked:n||r,disabled:r,onInput:()=>i(t.id)})}),(0,l.tZ)(k.fi,{size:60,photo_url:a.photo_url}),(0,l.BX)("div",{className:"twitter-handle",children:[(0,l.tZ)("span",{className:"author",children:null==a?void 0:a.name}),(0,l.BX)("span",{className:"handle",children:[" @",o]})]})]}),(0,l.tZ)("div",{className:"info",children:(0,l.tZ)("div",{className:"publication-row",children:(0,l.tZ)("a",{className:"publication",href:(0,E.rhs)("".concat((0,E.SVA)(t),"/"),{utm_source:T.b3.substack,utm_medium:T.lP.web,utm_content:T.fZ.discoverTwitter}),target:"_blank",native:!0,children:(0,l.tZ)(S.ZP,{publication:t,logo_size:30,children:r?(0,l.tZ)("div",{className:"subscribed",children:(0,l.tZ)(C.Vp,{children:"Subscribed"})}):null})})})})]})})},D=e=>{var t;let{result:n,selectedPubs:i,onToggle:r}=e,{publicationAuthor:a,screen_name:o,publication_id:s}=n,{name:c,ownedPublications:u}=a,d=_()(u,e=>e.id),h=g()(d,e=>{var t;return(null===(t=e.latestPost)||void 0===t?void 0:t[0])?(0,B.Z)(e.latestPost[0].post_date).toDate():B.Z.unix(1).toDate()}).reverse(),p=a.photo_url||(null===(t=u.find(e=>e.id===s))||void 0===t?void 0:t.logo_url);return h.map(e=>{var t;let n=!!(null===(t=e.subscriptions)||void 0===t?void 0:t.length);return(0,l.tZ)(X,{author:a,screenName:o,authorName:c,showLogo:p!==a.photo_url,pub:e,checked:i.has(e.id),onToggle:r,isSubscribed:n})})},F=e=>{let{user:t,freeSignupEmail:n,twitterEmail:i,twitterToken:r,onConfirmed:a,onSubscribed:s,formAction:c,pubIds:u,subscribeToken:d,redirect:h,showDiscover:p,editable:m,showLogout:g}=e,b=(null==t?void 0:t.email)||n||i,[_,v]=(0,o.eJ)(!1),[f,Z]=(0,o.eJ)(!0),[y,N]=(0,o.eJ)(b);h=u?(0,E.rhs)(h,{pubIds:u,t:r}):(0,E.rhs)(h,{t:r,d:f});let S=e=>{let{userExists:t,subscribed:n}=e.body;n?null==s||s(n):t?t&&(0,x.uX)((0,E.n1t)("".concat((0,E.ZJn)(),"/sign-in"),{with_password:!1,email:y,redirect:h})):null==a||a()};return(0,l.tZ)("div",{className:"twitter-publications container",children:(0,l.tZ)("section",{children:(0,l.tZ)("div",{className:"terms-check",children:(0,l.BX)(w.ZP,{onSuccess:e=>S(e),method:"post",action:c,loading:!1,autoLock:!0,children:[(0,l.tZ)("input",{name:"t",type:"hidden",value:r}),u&&(0,l.tZ)("input",{name:"pubIds",type:"hidden",value:u}),d&&(0,l.tZ)("input",{name:"subscribeToken",type:"hidden",value:d}),(0,l.tZ)("input",{name:"email",type:"text",disabled:!m&&!!b,value:y,onInput:e=>{N(e.target.value)}}),(0,l.BX)("label",{children:[(0,l.tZ)("input",{type:"checkbox",checked:_,onInput:()=>v(!_)}),"I accept the"," ",(0,l.tZ)("a",{href:"/tos",target:"_blank",native:!0,children:"Terms of Use"})]}),p&&(0,l.BX)("label",{children:[(0,l.tZ)("input",{name:"allow_discover",type:"checkbox",checked:f,onInput:()=>Z(!_)}),"Allow people to find my publications via Twitter"]}),g&&(0,l.tZ)("label",{children:(0,l.tZ)("a",{className:"login-button",href:(0,E.ZPN)(),native:!0,children:"Not you?"})}),(0,l.tZ)(R,{disabled:!_,children:"Next →"})]})})})})},O=()=>(0,l.BX)("div",{className:"twitter-publications container landing",children:[(0,l.tZ)("h2",{children:"Your favorite writers and creators and their communities are already on Substack."}),(0,l.BX)("section",{children:[(0,l.BX)("p",{children:["Find writers and creators I follow and subscribe to their publications."," ",(0,l.tZ)("span",{className:"light",children:"(We'll never post to your Twitter without permission or abuse your data.)"})]}),(0,l.tZ)("div",{className:"banner",children:(0,l.tZ)(L,{})})]})]}),W=e=>{let{user:t,stage:n,twitterEmail:i,freeSignupEmail:r,twitterToken:a}=e;return(a||t)&&"connect"!=n?(0,l.tZ)(z,{user:t,stage:n,twitterEmail:i,freeSignupEmail:r,twitterToken:a}):(0,l.tZ)(O,{})},z=e=>{let t,{user:n,stage:i,twitterEmail:r,freeSignupEmail:s,twitterToken:u,buttonText:d=null,onSignup:h=null,requireSignup:p=!0,needsEmailConfirm:m=!0,renderIfNoneFound:g=null,useProfilePrefix:b=!1}=e,[_,f]=(0,o.eJ)(null),[w,y]=(0,o.eJ)(null),[N,S]=(0,o.eJ)(null),[k,x]=(0,o.eJ)(null),[P,C]=(0,o.eJ)(!m),[B,E]=(0,o.eJ)(null),[T,A]=(0,o.eJ)(!1),[R,X]=(0,o.eJ)(new Set),[D,O]=(0,o.eJ)(null),W=(0,I.x)("subscribed"),z=b?"/profile":"";W?h?h():(S(W.split(",")),(0,v.route)("/discover-twitter/success")):!i||"connect"===i||_||N||(0,v.route)("/discover-twitter");let J=e=>c()(e.map(e=>{var t;return(null===(t=e.publicationAuthor)||void 0===t?void 0:t.ownedPublications)||[]}));(0,o.d4)(()=>{(async()=>{if(!T){A(!0);try{let e=(await Z().get("/api/v1/twitter/publications")).body;if("needsConnect"in e&&e.needsConnect)(0,v.route)("/discover-twitter/connect");else{let t;let{results:n,subscribeToken:i,needsTwitterConfirm:r}=e,l=J(n),a=new Set(l.filter(e=>{var t;return(null===(t=e.subscriptions)||void 0===t?void 0:t.length)===0}).map(e=>e.id));t=a.size<=30?new Set(a):new Set,f(n),E(!1),O(i),y(a),X(t),x(!r)}}catch(e){E(e)}A(!1)}})()},[]),_&&(_.length>0?t=k?"We found ".concat(_.length," account").concat(_.length>1?"s":""," you follow on Twitter"):"Confirm your email to see ".concat(_.length," account").concat(_.length>1?"s":""," you follow on Twitter"):k||(t="Confirm your email to continue")),"confirm"===i&&(t="Confirm your email"),N&&(t="Success!");let H=_?J(_):null,q=async()=>{A(!0);try{let e=await Z().post("/api/v1/twitter/subscribe").send({pubIds:[...R].join(","),t:u,subscribeToken:D});if(h)h();else{let{subscribed:t}=e.body;S(t),(0,v.route)("/discover-twitter/success")}}catch(e){console.error("error subscribing",e)}A(!1)};return(0,l.BX)("div",{className:"twitter-publications pub-list",children:[(0,l.tZ)("h2",{className:i,children:t}),T&&(0,l.tZ)("p",{className:"loading",children:"Loading..."}),B&&(0,l.BX)(a.Fragment,{children:[(0,l.tZ)("p",{className:"error",children:"Sorry, there was an error getting your results!"}),(0,l.tZ)("div",{className:"banner",children:(0,l.tZ)(L,{})})]}),(0,l.BX)(v.default,{children:[_&&!N&&k&&!T&&(0,l.tZ)(U,{path:"".concat(z,"/discover-twitter"),results:_,selectedPubs:R,subscribablePubs:null!=w?w:new Set([]),onToggleChecked:e=>{let t=new Set(R);R.has(e)?t.delete(e):t.add(e),X(t)},onToggleAll:e=>{let t;X(e?new Set(w):new Set)},onNext:()=>{!m||P?q():(0,v.route)("/discover-twitter/confirm")},loading:T,buttonText:d,requireSignup:p,renderIfNoneFound:g}),!1==k&&(0,l.tZ)(F,{path:"".concat(z,"/discover-twitter"),formAction:"/api/v1/twitter/confirm",redirect:"/api/v1/twitter/continue-confirm",user:n,onConfirmed:()=>{C(!0),x(!0)},twitterEmail:r,twitterToken:u,freeSignupEmail:s,pubIds:[...R],showDiscover:!0}),!P&&(0,l.tZ)(F,{path:"".concat(z,"/discover-twitter/confirm"),redirect:"/api/v1/twitter/continue-subscribe",formAction:"/api/v1/twitter/subscribe",user:n,onSubscribed:e=>{S(e),(0,v.route)("/discover-twitter/success")},twitterEmail:r,twitterToken:u,freeSignupEmail:s,pubIds:[...R],subscribeToken:D,editable:!1,showLogout:!0}),_&&N&&(0,l.tZ)(M,{path:"".concat(z,"/discover-twitter/success"),user:n,subscribed:N,pubs:null!=H?H:[],results:_})]})]})},J=e=>{let{pub:t,result:n}=e,{hero_text:i,stripeAccount:r,logo_url:a}=t,{screen_name:o,publicationAuthor:{name:s,photo_url:c}}=n,u=null==r?void 0:r.plans;return(0,l.tZ)("li",{className:"linked-pub subscribed",children:(0,l.BX)("div",{className:"linked-pub",children:[(0,l.tZ)("div",{className:"photo",children:(0,l.tZ)(k.fi,{size:60,photo_url:a||c})}),(0,l.tZ)("div",{className:"info",children:(0,l.BX)("div",{className:"publication-row",children:[(0,l.BX)("div",{className:"publication",children:[(0,l.BX)("div",{className:"name",children:["@",o," - ",s]}),(0,l.tZ)("div",{className:"description",children:i})]}),(0,l.tZ)("div",{children:u&&(0,l.tZ)(N.Z,{className:"outline small button",href:"".concat((0,E.SVA)(t),"/subscribe"),target:"_blank",children:"Upgrade"})})]})})]})})},M=e=>{let{subscribed:t,pubs:n,results:i}=e,r=_()(n.filter(e=>t.find(t=>t===e.subdomain)),e=>e.id),[o,s]=p()(r,e=>{var t;return null===(t=e.stripeAccount)||void 0===t?void 0:t.plans}),c=[...o,...s].length>1,u=o.length>1;return(0,l.BX)("ul",{children:[(0,l.tZ)("div",{className:"sign-up",children:o.length>0?(0,l.BX)(a.Fragment,{children:[u?"".concat(o.length," of the newsletters"):c?"One of the newsletters":"The newsletter"," ","you subscribed to ",u?"have":"has"," a paid version. You can upgrade"," ",u?"those subscriptions":"that subscription"," now or later."]}):"You're subscribed to the free version of ".concat(c?"these newsletters":"this newsletter",". Happy reading!")}),[...o,...s].map(e=>{let t=i.find(t=>{var n;return t.screen_name===(null===(n=e.twitterAccount)||void 0===n?void 0:n.screen_name)});return t?(0,l.tZ)(J,{pub:e,result:t}):null})]})},H=e=>{let{onNext:t}=e;return(0,l.tZ)("div",{children:(0,l.BX)("ul",{children:[(0,l.tZ)("p",{children:"It doesn't appear anyone you follow on Twitter has a Substack yet. We'll let you know if that changes."}),(0,l.tZ)(N.Z,{className:"primary button",onClick:()=>{t()},children:"Continue"})]})})},U=e=>{let{results:t,selectedPubs:n,onNext:i,onToggleChecked:r,onToggleAll:o,subscribablePubs:s,loading:c,buttonText:u,requireSignup:h,renderIfNoneFound:m}=e;if(0===t.length)return m||(0,l.tZ)(H,{onNext:i});let b=g()(t,e=>{var t,n,i;let r;return(null==(r=(null===(t=e.publicationAuthor)||void 0===t?void 0:t.ownedPublications)?d()(e.publicationAuthor.ownedPublications,e=>{var t;return(null===(t=e.latestPost)||void 0===t?void 0:t[0])?(0,B.Z)(e.latestPost[0].post_date).toDate():null}):null)?void 0:null===(n=r.latestPost)||void 0===n?void 0:n[0])?(0,B.Z)(null===(i=r.latestPost[0])||void 0===i?void 0:i.post_date).toDate():B.Z.unix(1).toDate()}).reverse(),[_,v]=p()(b,e=>(e.publicationAuthor.ownedPublications||[]).some(e=>{var t;return(null===(t=e.subscriptions)||void 0===t?void 0:t.length)===0})),f=s.size===n.size,Z=(!h||n.size>0)&&!c,w=!h||s.size>0?(0,l.tZ)(R,{onClick:i,disabled:!Z,children:u?(n.size>0?"Subscribe and ":"")+u:"Sign up →"}):null;return(0,l.BX)("div",{children:[(0,l.tZ)("section",{className:"sign-up",children:"Subscribe to free newsletters from the people you already follow on Twitter"}),(0,l.BX)("ul",{children:[(!h||s.size>0)&&(0,l.BX)(a.Fragment,{children:[(s.size>3||!h)&&w,(0,l.tZ)("li",{children:s.size<30&&(0,l.tZ)(A,{checked:f,onClick:()=>{f?o(!1):o(!0)}})})]}),[..._,...v].map(e=>(0,l.tZ)(D,{result:e,selectedPubs:n,onToggle:r})),w]})]})}},39341:function(e,t,n){"use strict";if(n.d(t,{AY:()=>o,DJ:()=>s,_p:()=>c}),3270==n.j)var i=n(7409);var r=n(16584),l=n(6400),a=n(30396);let o=(0,l.createContext)({});o.displayName="WWWContext";let s=e=>{let t=t=>{let n=(0,a.qp)(o);return(0,r.tZ)(e,(0,i._)({},n,t))};return t.displayName="withWWWContext(".concat(e.name||e.displayName||"Anonymous",")"),t},c=()=>(0,a.qp)(o)},62514:function(e,t,n){"use strict";if(n.d(t,{z:()=>u}),3270==n.j)var i=n(7409);var r=n(30396),l=n(20042),a=n(39341),o=n(68833),s=n(48980);if(3270==n.j)var c=n(22419);function u(e){let t=(0,a._p)(),{categories:n,publications:s=[],categoryId:u,featuredPublications:g=[],user:b,categorySlug:_="featured",rankingSlug:v,hasMore:f,updateUrl:Z=!1,maxPublications:w=5,showTwitterBanner:y,homepageFeaturedPublications:N=[],isHomepage:S}=(0,i._)({},t,e),k=S?8:w,[x,P]=(0,r.eJ)(null!=n?n:[]),[C,B]=(0,r.eJ)(d(s,w)),[E,I]=(0,r.eJ)(null!=u?u:"featured"),[T,A]=(0,r.eJ)(S&&N.length?d(N,k):d(g,w)),[R,L]=(0,r.eJ)(null),[X,D]=(0,r.eJ)("paid"),[F,O]=(0,r.eJ)(null),[W,z]=(0,r.eJ)(0),[J,M]=(0,r.eJ)(!!f);(0,r.d4)(()=>{let e=v||"paid";D(e),x||h().then(t=>{let{categories:n,publications:i,featuredPublications:r}=t;P(n);let l=(0,c.Wq)(_,n);return(I(l),A(d(r,w)),"featured"===l)?i:p(l,e,0).then(e=>{let{publications:t,more:n}=e;return z(0),w||M(n),t})}).then(e=>{B(d(e,w))})},[x,_,v,w]);let H=(0,r.I4)(()=>{let e=W+1;(0,o.j)(o.FP.VIEWED_MORE_CATEGORY,{categoryId:E,ranking:X,page:e}),p(E,X,e).then(t=>{let{publications:n,more:i}=t,r=new Set(C.map(e=>e.id));z(e),B(C.concat(n.filter(e=>!r.has(e.id)))),M(i)})},[E,X,W,C,z,B,M]),U=(0,r.I4)(async e=>{let{categoryId:t,ranking:n}=e;if(I(t),z(0),"featured"===t||"twitter"===t){L(null),O(null),M(!1),"featured"===t&&B(d(T,w));return}L(t),O(n),B([]),M(!1);let{publications:i,more:r}=await p(t,n,0);I(t),L(null),O(null),D(n),z(0),w||M(r),B(d(i,w))},[L,O,I,z,M,B,T,w]);return{categories:x,publications:"featured"===E?T:C,categoryId:E,ranking:null!=X?X:void 0,loadingCategoryId:R,loadingRanking:F,featuredPublications:T,user:b,categorySlug:_,rankingSlug:v,hasMore:J,viewMore:H,loadPublications:U,onCategoryClicked:e=>{let{categoryId:t,ranking:n,categories:i}=e;(0,o.j)(o.FP.CLICKED_CATEGORY,{categoryId:t,ranking:n}),Z&&(0,l.route)(m({categoryId:t,categories:i,ranking:n}),!0),U({categoryId:t,ranking:n})},getCategoryIdFromSlug:c.Wq,setCategoryId:I,setRanking:D,onRankingChange:e=>{D(e),Z&&(0,l.route)(m({categoryId:E,categories:x,ranking:e}),!0),U({categoryId:E,ranking:e})},maxPublications:w,showTwitterBanner:!!y}}let d=(e,t)=>t?e.slice(0,t):e,h=()=>(0,s.rd)("/api/v1/homepage/initial-category-data"),p=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return(0,s.rd)("/api/v1/category/public/".concat(e,"/").concat(t,"?page=").concat(n))},m=e=>{let{categoryId:t,ranking:n,categories:i}=e,r="";"string"==typeof t&&["twitter"].includes(t)&&(r=t);let l=i.find(e=>e.id===t);return((null==l?void 0:l.slug)&&(r="".concat(l.slug,"/").concat(n)),r)?"/discover/category/".concat(r):"/discover"}},78118:function(e,t,n){"use strict";n.r(t),n.d(t,{ReaderOnboardingModal:()=>X,ReaderOnboardingModalWithUserContext:()=>D,TwitterStage:()=>A});var i=n(27412),r=n(7409),l=n(99282),a=n(98848),o=n(16584),s=n(98661),c=n(30396),u=n(97742),d=n(93666),h=n(32582),p=n(57391),m=n(60807),g=n(68833),b=n(98914),_=n(341),v=n(30378),f=n(57601),Z=n(64799),w=n(14861),y=n(4564),N=n(45930),S=n(76971),k=n(48146),x=n(48450),P=n(7759),C=n(29191),B=n(76560),E=n(60308),I=n(63651),T=n(81821);let A=e=>{let{user:t,useProfilePrefix:n}=e;return(null==t?void 0:t.has_linked_twitter)?(0,o.tZ)(L,{user:t,useProfilePrefix:n}):(0,o.tZ)(R,{})},R=()=>{let[e,t]=(0,c.eJ)(!0);return(0,o.BX)("div",{className:"inbox-access-form link-twitter",children:[(0,o.tZ)(u.Z,{className:"onboarding-main-icon",width:38,height:43}),(0,o.tZ)("h2",{children:"Find writers you follow"}),(0,o.tZ)("section",{className:"twitter-description",children:"Find writers you know on Substack, and let your Twitter followers find you. We’ll never post without your permission."}),(0,o.tZ)("p",{children:(0,o.BX)("label",{className:"let-others-find-me",children:[(0,o.tZ)("input",{type:"checkbox",checked:e,onChange:()=>t(!e)}),"Let others find me via Twitter"]})}),(0,o.tZ)(h.PH,{linkType:"reader",discoverable:e,icon:!1,text:"Connect Twitter"}),(0,o.tZ)("a",{className:"skip",href:"".concat((0,E.ZJn)(),"/profile/fill"),native:!0,children:"Skip for now"})]})},L=e=>{let{user:t,useProfilePrefix:n}=e;return(0,o.tZ)(h.G6,{user:t,onSignup:()=>{let e=(null==t?void 0:t.profile_set_up_at)?(0,E.HMK)():"".concat((0,E.ZJn)(),"/profile/fill");(0,b.uX)(e)},buttonText:"Continue",requireSignup:!1,needsEmailConfirm:!1,useProfilePrefix:n})};class X extends d.p{componentDidMount(){super.componentDidMount(),(0,T.tq)()&&(this.context.exposeExperiment("reader_onboarding_app_first"),this.inAppExperimentTreatment())}componentWillReceiveProps(e){this.setState({skipRedirectOnExit:e.skipRedirectOnExit,zIndex:e.zIndex,entry:e.entry,onBeforeClose:e.onBeforeClose})}getDefaultStep(){return this.state.appOnboardingTreatment?B.c.APP_UPSELL:B.c.CATEGORIES}inAppExperimentTreatment(){if(this.state.appOnboardingTreatment)return this.state.appOnboardingTreatment;let e=(0,T.tq)()&&["treatment","treatment_no_skip"].includes(this.context.getExperimentVariant("reader_onboarding_app_first"));return e&&this.setState({step:B.c.APP_UPSELL,appOnboardingTreatment:!0}),e}inNewCategoriesStepExperimentTreatment(){return this.context.exposeExperiment("new_reader_onboarding_categories_step"),"treatment"===this.context.getExperimentVariant("new_reader_onboarding_categories_step")}openForPub(e,t){this.setState({pub:e,profile:t,step:t?this.props.user?B.c.CATEGORIES:B.c.PUB_SIGNUP:B.c.PUB_LANDING}),this.open()}openToPubSignup(e){this.setState({pub:e,step:B.c.PUB_SIGNUP,profile:null}),this.open()}setStep(e){if(e===B.c.APP_UPSELL&&this.state.appOnboardingTreatment&&this.state.previousStepData[B.c.APP_UPSELL]&&(e=B.c.WELCOME),(0,g.j)(g.FP.READER_ONBOARDING_STEP_CHANGED,{from_step:this.state.step,to_step:e,modal:!0}),e===B.c.EXIT){if(this.state.skipRedirectOnExit)this.close();else{var t;let e=null!==(t=this.redirect)&&void 0!==t?t:this.state.pub&&"reader2"===this.state.entry?(0,E.SVA)(this.state.pub):(0,I.E2n)();document.location.href=e}}else setTimeout(()=>this.setState({step:e}),0)}setPreviousStepData(e,t){this.setState({previousStepData:(0,l._)((0,r._)({},this.state.previousStepData),{[e]:t})})}getClassName(){return"reader-onboarding-modal wide"}onClose(){(0,g.j)(g.FP.READER_ONBOARDING_MODAL_CLOSED,{entry:this.props.entry,step:this.state.step}),this.setStep(this.getDefaultStep())}onOpen(){var e;(0,g.j)(g.FP.READER_ONBOARDING_MODAL_OPENED,{entry:this.props.entry,step:this.state.step,for_pub_id:null===(e=this.state.pub)||void 0===e?void 0:e.id})}handleError(e){let{ignore:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{step:n}=this.state;console.error("Error in reader onboarding ".concat(n," step: ").concat(e)),(0,g.j)(g.FP.READER_ONBOARDING_ERROR,{step:n,entry:this.props.entry,ignore:t}),t||this.setStep(B.c.ERROR)}renderStep(){let e=this.props,{ref:t}=e,n=(0,a._)(e,["ref"]),{step:i,open:s,pub:c,profile:u,previousStepData:d,appOnboardingTreatment:h}=this.state,p={setStep:this.setStep,handleError:this.handleError,close:this.close,setPreviousStepData:this.setPreviousStepData,appOnboardingTreatment:h};if(!s)return null;switch(i){case B.c.SIGNUP:return(0,o.tZ)(x.Z,(0,l._)((0,r._)({},n,p),{previousStepData:d}));case B.c.PUB_LANDING:return(0,o.tZ)(S.Z,(0,l._)((0,r._)({},n,p),{pub:c}));case B.c.PUB_SIGNUP:return(0,o.tZ)(k.Z,(0,l._)((0,r._)({},n,p),{pub:c,profile:null!=u?u:null}));case B.c.CATEGORIES:return this.inNewCategoriesStepExperimentTreatment()?(0,o.tZ)(y.r,(0,l._)((0,r._)({},n,p),{pub:c})):(0,o.tZ)(v.Z,(0,l._)((0,r._)({},n,p),{pub:c}));case B.c.PROFILE:return(0,o.tZ)(N.Z,(0,r._)({},n,p));case B.c.START_WRITING:return(0,o.tZ)(P.Z,(0,r._)({},n,p));case B.c.CREATE_PUBLICATION:return(0,o.tZ)(f.Z,(0,r._)({},n,p));case B.c.CREATE_PUBLICATION_SUCCESS:return(0,o.tZ)(Z.Z,(0,l._)((0,r._)({},n,p),{previousStepData:d}));case B.c.ERROR:return(0,o.tZ)(w.Z,(0,r._)({},n,p));case B.c.APP_UPSELL:return(0,o.tZ)(_.Z,{onComplete:()=>{this.setPreviousStepData(B.c.APP_UPSELL,!0),h?this.setStep(B.c.CATEGORIES):this.setStep(B.c.WELCOME)}});case B.c.WELCOME:default:return(0,o.tZ)(C.Z,(0,l._)((0,r._)({},n,p),{pub:c,profile:null!=u?u:null}))}}renderChildren(){return(0,o.tZ)("div",{className:"reader-onboarding-modal-container",children:this.renderStep()})}constructor(e,t){var n;super(e,t),(0,i._)(this,"redirect",void 0),this.setStep=this.setStep.bind(this),this.state.pub=e.pub||null,this.handleError=this.handleError.bind(this),this.state.previousStepData={},this.setPreviousStepData=this.setPreviousStepData.bind(this),this.state.skipRedirectOnExit=null!==(n=e.skipRedirectOnExit)&&void 0!==n&&n,this.redirect=e.redirect&&"/"!==e.redirect?e.redirect:null,this.state.appOnboardingTreatment=!1,this.state.step=e.step||this.getDefaultStep()}}(0,i._)(X,"contextType",p.kx);let D=(0,s.forwardRef)((e,t)=>{let n=(0,m.SE)(),i=e.onBeforeClose,a=i?()=>i(n.user):void 0,s=(0,l._)((0,r._)({},e),{onBeforeClose:a,user:n.user});return(0,o.tZ)(X,(0,l._)((0,r._)({},s),{ref:t}))})},22419:function(e,t,n){"use strict";n.d(t,{Wq:()=>l,lq:()=>i,u8:()=>r});let i=25,r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"en",{iString:t}=I18N.i(e);return{482856:{blurb:t("Since retiring from the NBA, Kareem Abdul-Jabbar has authored 17 books and written award-winning columns. Now, the basketball legend makes Substack his home for thoughts on sports, politics, and pop culture, and how they define America."),rank:1},260347:{blurb:t("A new media company founded by journalist Bari Weiss, The Free Press employs more than 25 full-time staff. From podcasts, events, and investigative stories to their signature commentary, The Free Press produces work that drives the news and shifts the culture."),rank:2},567420:{blurb:t("New York Times bestseller, Booker Prize winner, and creative writing professor at Syracuse University, George Saunders offers a masterclass in storytelling and the craft of short fiction with a unique, educational Substack. Since 2021, his community has grown to more than 125,000 subscribers."),rank:3},220361:{blurb:t("Recipe developer and cookbook author Caroline Chambers’ number one food newsletter offers family-friendly meals and no-nonsense cooking. She also hosts [So Into That](https://whattocook.substack.com/podcast), a new Substack show featuring acclaimed guests diving into recommendations and lifestyle hacks."),rank:4},1662278:{blurb:t("Painter, fashion director, and illustrator Jenny Walton offers glimpses into her fabulous life in Milan. From vintage shopping and flea market finds to a guide to personal style, Jenny calls her Substack “a nice little place to chat that isn’t Instagram.”"),rank:5},445285:{blurb:t("Fashion and culture writer Viv Chen delivers thoughtful reflections and recommendations for secondhand and designer fashion enthusiasts. If you identify as an eBay gremlin, The Molehill is for you."),rank:6},2325511:{blurb:t("Founded by award-winning journalist Mehdi Hasan, Zeteo is a new media organization with more than 150,000 subscribers. Zeteo publishes a weekly streaming show, [Mehdi Unfiltered](https://zeteo.com/s/mehdi-unfiltered), alongside podcasts and essays from contributors including Greta Thunberg, John Harwood, Viet Thanh Nguyen, and Naomi Klein."),rank:7},61371:{blurb:t("Pioneering blogger and journalist Andrew Sullivan publishes essays on politics and the culture wars on his Substack The Weekly Dish, which is also home to his podcast, [The Dishcast](https://andrewsullivan.substack.com). With more than 160,000 subscribers, Sullivan is among the most influential writers in U.S. politics."),rank:8}}},l=(e,t)=>{if(!e)return"featured";if("featured"===e||"twitter"===e||"podcast"===e)return e;let n=t.find(t=>t.slug===e);return n?n.id:"featured"}}}]);