"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["8336"],{18787:function(t,e,l){if(l.d(e,{f1:()=>K,qV:()=>V,sF:()=>M}),l(27412),!/^(2787|4716|5288)$/.test(l.j))var a=l(7409);if(!/^(2787|4716|5288)$/.test(l.j))var i=l(98848);var n=l(58865),r=l(16584),o=l(30396),s=l(94184),c=l.n(s),u=l(80569),d=l.n(u),p=l(60826),h=l(83034),m=l(12620),b=l(75021),f=l(93666),_=l(33665),v=l(12281),y=l(95441),w=l(68833),g=l(98914),Z=l(94874),k=l(15771),N=l(19081),S=l(58175),C=l(24791),P=l(60308),U=l(26111),X=l(23945),x=l(81821),B=l(47929),A=l(71004);function E(){let t=(0,n._)(["Available now for iOS and Android"]);return E=function(){return t},t}function T(){let t=(0,n._)([""," gifted you this paid post. Unlock it in the free Substack app"]);return T=function(){return t},t}function I(){let t=(0,n._)(["Upgrade to ",""]);return I=function(){return t},t}function L(){let t=(0,n._)(["Upgrade to ",""]);return L=function(){return t},t}function O(){let t=(0,n._)(["Already in the "," plan?"]);return O=function(){return t},t}function F(){let t=(0,n._)(["Already in the Founding Member plan?"]);return F=function(){return t},t}let K=t=>{var e,l,a;let i,{className:n=null,title:s,subtitle:u=null,reauthenticationTitle:p,publication:f,post:v,user:k,freeSignup:C=null,freeSignupEmail:A=null,email_form:I=!1,autoFocus:L=!1,isStatic:O=!1,coupon:F=null,showPostUnlockPrompt:K=!1,magicToken:H=null,onPostUnlockError:W=null,giftingUser:G=null,treatmentVariantForGiftPostPaywall:q=null}=t,M=null==k?void 0:k.reader_installed_at,{iString:R,iTemplate:z}=(0,y.M1)(),[Y,J]=(0,o.eJ)(!1),[Q,tt]=(0,o.eJ)(!1),{modal:te,open:tl}=(0,h.useAppModal)({utm_campaign:B.VX.paywallPostUnlockPrompt,utm_source:B.b3.substack,overrideCTA:M?R("Open in app"):void 0,overrideTitle:R(M?"Unlock your free post in the Substack app":"Get the free Substack app to unlock this post"),subTitle:z(E()),openUrl:null!==(e=M&&(0,P.K8_)(f.subdomain,v.slug))&&void 0!==e?e:void 0}),ta=k&&k.email||A||null,ti=!!((null==k?void 0:k.is_subscribed)&&(null==k?void 0:k.is_magic)),tn=(null==v?void 0:v.audience)==="founding",tr=!!((null==k?void 0:k.is_free_subscribed)||C),to=(0,P.uRy)(f,v),ts=(0,x.tq)({checkFirst4:!0}),tc=(0,o.I4)(async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,w.j)(w.FP.PAYWALL_UNLOCK_CTA_CLICKED,{post_id:v.id,publication_id:f.id,from_email:t});try{await d().post("/api/v1/post_unlock_token").send({post_id:v.id,token:H}),ts?window.location.href=M?(0,P.K8_)(f.subdomain,v.slug,{redirect:"app-store",params:{utm_campaign:B.VX.paywallPostUnlockPrompt,utm_source:B.b3.paywall}}):(0,P.D4e)({utm_campaign:B.VX.paywallPostUnlockPrompt,utm_source:B.b3.paywall}):tl()}catch(t){null==W||W()}},[v.id,v.slug,f.id,f.subdomain,H,M,tl,W,ts]);(0,o.d4)(()=>{K&&(0,w.j)(w.FP.PAYWALL_UNLOCK_CTA_VIEWED,{publication_id:f.id,post_id:v.id})},[v.id,f.id,K]),(0,o.d4)(()=>{(0,U.x)("launch_post_unlock_offer")&&(tc(!0),window.history.replaceState({},document.title,(0,P.rhs)({launch_post_unlock_offer:null})))},[tc]);let tu=!!F&&!!F.id&&!tn&&!K;i=tu?R((null==v?void 0:v.type)==="podcast"?"Listen to this episode with a 7-day free trial":(null==v?void 0:v.type)==="video"?"Watch with a 7-day free trial":"Keep reading with a 7-day free trial"):ti?p:s;let td=async()=>{if(!G){console.warn("tried to claim gift post, but no gifting user");return}if((0,w.j)(w.FP.GIFT_POST_CLAIM_CTA_CLICKED,{post_id:v.id,pub_id:f.id,referring_user_id:G.id,user_id:null==k?void 0:k.id,variant:q,source:"paywall"}),!k){tt(!0);return}J(!0);try{await d().post("/api/v1/post_unlock_token").send({post_id:v.id,gifting_user_id:G.id,email:ta}),(0,g.uX)((0,P.K8_)(f.subdomain,v.slug,{redirect:"app-store",source:B.b3.paywall}))}catch(t){null==W||W()}finally{J(!1)}};return G&&q&&K?(0,r.BX)("div",{role:"region","aria-label":R("Gift post paywall"),children:[Q&&(0,r.tZ)(b.f,{user:k,post:v,pub:f,referringUser:G,freeSignupEmail:null!=A?A:void 0,variant:q,startOnEmailCollection:!0}),(0,r.BX)("div",{className:c()("paywall",n),"data-testid":"paywall","data-component-name":"Paywall",children:[(0,r.tZ)(Z.qE,{photoUrl:null!==(l=G.photo_url)&&void 0!==l?l:void 0,size:64,className:O?"paywall-unlock-avatar-static":"paywall-unlock-avatar"}),(0,r.tZ)(b.E,{style:{position:"absolute",left:"calc(50% + 5px)",top:"5px"},size:24}),(0,r.tZ)(S.xv,{weight:"light",className:c()("paywall-title","unlock-treatment-new"),children:z(T(),(0,X.Q1)(G.name))}),(0,r.tZ)(D,{isStatic:O,onClick:()=>td(),btnClassName:c()(K&&"paywall-cta-icon"),disabled:Y,children:R("Claim my free post")}),tr?(0,r.BX)($,{isStatic:O,publication:f,post:v,postUrl:to,coupon:F,useCoupon:tu,children:[R("Or upgrade your subscription.")," ",(0,r.tZ)("b",{children:(0,r.tZ)(_.n,{pub:f,user:k,isStatic:!0})})]}):(0,r.tZ)("div",{className:"paywall-login",children:(0,r.BX)("a",{href:(0,P.uXE)({for_pub:f.subdomain,change_user:!!ta}),native:!0,children:[V({post:v,publication:f,isPaid:!I})," ",(0,r.tZ)("b",{children:R(ta?"Switch accounts":"Sign in")})]})})]})]}):(0,r.BX)("div",{className:c()("paywall",n),"data-testid":"paywall","data-component-name":"Paywall",role:"region","aria-label":R("Paywall"),children:[K&&(0,r.tZ)(Z.qE,{photoUrl:null!==(a=f.author_photo_url)&&void 0!==a?a:void 0,size:64,className:O?"paywall-unlock-avatar-static":"paywall-unlock-avatar"}),ta&&!K&&(0,r.BX)(S.xv,{translated:!0,as:"div",className:"paywall-intro",paddingBottom:8*!!K,children:["Hi ",(0,r.tZ)("b",{children:I18N.p(ta)})]}),(0,r.tZ)("h2",{className:c()("paywall-title",K&&"unlock-treatment-new"),children:i}),u&&!tu&&(0,r.tZ)("p",{className:"paywall-subtitle",children:u}),tu&&(0,r.BX)("div",{className:"paywall-free-trial-subtitle",children:[(null==v?void 0:v.type)==="podcast"&&(0,r.BX)(S.xv,{translated:!0,as:"p",className:"paywall-subtitle",children:["Subscribe to"," ",(0,r.tZ)(S.xv,{as:"span",weight:"bold",fontStyle:"italic",children:I18N.p(f.name)})," ","to listen to this post and get 7 days of free access to the full post archives."]}),(null==v?void 0:v.type)==="video"&&(0,r.BX)(S.xv,{translated:!0,as:"p",className:"paywall-subtitle",children:["Subscribe to"," ",(0,r.tZ)(S.xv,{as:"span",weight:"bold",fontStyle:"italic",children:I18N.p(f.name)})," ","to watch this video and get 7 days of free access to the full post archives."]}),(null==v?void 0:v.type)==="newsletter"&&(0,r.BX)(S.xv,{translated:!0,as:"p",className:"paywall-subtitle",children:["Subscribe to"," ",(0,r.tZ)(S.xv,{as:"span",weight:"bold",fontStyle:"italic",children:I18N.p(f.name)})," ","to keep reading this post and get 7 days of free access to the full post archives."]}),(null==v?void 0:v.type)==="adhoc_email"&&(0,r.BX)(S.xv,{translated:!0,as:"p",className:"paywall-subtitle",children:["Subscribe to"," ",(0,r.tZ)(S.xv,{weight:"bold",fontStyle:"italic",children:I18N.p(f.name)})," ","to keep reading this email and get 7 days of free access to the full post archives."]})]}),I?!tr&&(0,r.tZ)(N.gq,{paddingTop:24,justifyContent:"center",children:(0,r.tZ)(m.Z,{autoFocus:null==L||L,email:ta,freeSignup:C,freeSignupEmail:A,onAccentBackground:!0,pub:f,source:"post-unlock",submitButtonText:R((null==v?void 0:v.type)==="podcast"?"Start listening":(null==v?void 0:v.type)==="video"?"Start watching":"Start reading"),user:k,onSuccess:()=>document.location.reload()})}):K?(0,r.BX)(r.HY,{children:[te,(0,r.tZ)(D,{isStatic:O,onClick:()=>tc(!1),btnClassName:c()(K&&"paywall-cta-icon"),children:R("Claim my free post")})]}):(0,r.tZ)(j,{coupon:F,email:ta,isStatic:O,post:v,postUrl:to,publication:f,useCoupon:tu,user:k}),K&&(0,r.BX)($,{isStatic:O,publication:f,post:v,postUrl:to,coupon:F,useCoupon:tu,children:[R("Or upgrade your subscription.")," ",(0,r.tZ)("b",{children:(0,r.tZ)(_.n,{pub:f,user:k,isStatic:!0})})]}),!ti&&!O&&!K&&(0,r.tZ)("div",{className:"paywall-login",children:(0,r.BX)("a",{href:(0,P.uXE)({for_pub:f.subdomain,change_user:!!ta}),native:!0,children:[V({post:v,publication:f,isPaid:!I})," ",(0,r.tZ)("b",{children:R(ta?"Switch accounts":"Sign in")})]})})]})},j=t=>{var e,l;let{coupon:a,email:i,isStatic:n,post:o,postUrl:s,publication:c,useCoupon:u,user:d}=t,h=!!(null==d?void 0:d.is_founding),m=!!(null==d?void 0:d.is_subscribed),b=!!((null==d?void 0:d.is_subscribed)&&(null==d?void 0:d.is_magic)),f=(null==o?void 0:o.audience)==="founding",{iString:v,iTemplate:w}=(0,y.M1)();if(n){if(!c.plans)return null;let t=f?p.W.FOUNDING_CHECKOUT_URL:p.W.CHECKOUT_URL,l=u?"&coupon=".concat(null==a?void 0:a.id):"",i=f?w(I(),null!==(e=(0,C.H$)(c))&&void 0!==e?e:""):u?v("Start trial"):(0,r.tZ)(_.n,{pub:c,user:d,isStatic:n});return(0,r.tZ)(H,{href:"".concat(t,"simple=true&utm_source=").concat(B.b3.paywall,"&utm_medium=").concat(B.lP.email,"&utm_content=").concat(o.id,"&next=").concat(s).concat(l),children:i})}return!h&&f?c.plans?(0,r.tZ)(W,{href:(0,P.Zs0)(c,{simple:!0,next:document.location.href,utm_source:B.b3.paywall,utm_medium:B.lP.web,utm_content:o?o.id:null,plan:"founding"}),children:w(L(),null!==(l=(0,C.H$)(c))&&void 0!==l?l:"")}):null:m?b?(0,r.tZ)(W,{href:(0,P.uXE)({for_pub:c.subdomain,email:i}),children:v("Click here to sign in")}):null:c.plans?(0,r.tZ)(W,{href:(0,P.Zs0)(c,{simple:!0,next:document.location.href,utm_source:u?B.b3.paywallFreeTrial:B.b3.paywall,utm_medium:n?B.b3.email:B.b3.web,utm_content:o?o.id:null,coupon:u?null==a?void 0:a.id:null}),children:u?v("Start trial"):(0,r.tZ)(_.n,{pub:c,user:d,isStatic:n})}):null},H=t=>{let{children:e,href:l}=t;return(0,r.tZ)("div",{className:"paywall-cta",children:(0,r.tZ)("a",{className:"button primary subscribe-btn",href:l,children:(0,r.tZ)("span",{children:e})})})},W=t=>{let{children:e,href:l}=t;return(0,r.tZ)("div",{className:"paywall-cta",children:(0,r.tZ)("a",{href:l,native:!0,children:(0,r.tZ)(k.kG,{resetCss:!0,className:c()("subscribe-btn",A.Z.subscribeButton),children:e})})})},$=t=>{let{post:e,isStatic:l,publication:a,onClick:i,children:n,postUrl:o,coupon:s,useCoupon:c}=t,u=(0,P.Zs0)(a,{simple:!0,next:document.location.href,utm_source:B.b3.paywall,utm_medium:l?B.lP.email:B.lP.web,utm_content:e?e.id:null,just_signed_up:!1});i=async()=>{window.location.href=u};let d=c?"&coupon=".concat(null==s?void 0:s.id):"",p="".concat(u,"simple=true&utm_source=").concat(B.b3.paywall,"&utm_medium=").concat(B.lP.email,"&utm_content=").concat(e.id,"&next=").concat(o).concat(d);return l?(0,r.tZ)(G,{href:p,children:n}):(0,r.tZ)(q,{onClick:i,href:p,children:n})},G=t=>{let{children:e,href:l}=t;return(0,r.tZ)("div",{className:"paywall-secondary-cta",children:(0,r.tZ)("a",{href:l,children:e})})},q=t=>{let{children:e,href:l,onClick:a}=t;return(0,r.tZ)("div",{className:"paywall-secondary-cta",children:(0,r.tZ)("a",{onClick:a,href:l,native:!0,children:e})})},D=t=>{let{isStatic:e,onClick:l,children:a,btnClassName:i,disabled:n}=t;return e?(0,r.tZ)("div",{className:"paywall-cta",children:(0,r.tZ)("a",{className:c()("button","primary",i),href:"".concat(p.W.POST_URL,"&launch_post_unlock_offer=true"),children:a})}):(0,r.tZ)("div",{className:"paywall-cta",children:(0,r.tZ)("a",{onClick:l,native:!0,children:(0,r.tZ)(k.kG,{resetCss:!0,className:c()("subscribe-btn",A.Z.subscribeButton,i),disabled:n,children:a})})})};class M extends(/^(2787|4716|5288)$/.test(l.j)?null:f.p){renderChildren(){let t=this.props,{ref:e}=t,l=(0,i._)(t,["ref"]);return(0,r.tZ)(K,(0,a._)({className:"modal-paywall"},l))}}function V(){let{post:t,publication:e,isPaid:l=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{iString:a,iTemplate:i}=I18N.i(e?{pub:e}:"en");if(!l)return a("Already a subscriber?");if((null==t?void 0:t.audience)==="founding"){var n;return(0,C.H$)(e)?i(O(),null!==(n=(0,C.H$)(e))&&void 0!==n?n:""):i(F())}return a("Already a paid subscriber?")}v.Z}}]);