"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["2926"],{10047:function(e,t,i){i.d(t,{J:()=>n,M:()=>o});var l=i(30396);function n(){let e=e=>{var t,i;"https://embed.bsky.app"===e.origin?function(e){if(!e.data.id||!e.data.height)return;let t=document.querySelector('[data-bluesky-id="'.concat(e.data.id,'"]'));t&&(t.style.height="".concat(e.data.height,"px"))}(e):("3pc.supported"===e.data||"3pc.unsupported"===e.data)&&("3pc.supported"===e.data&&Array.from(document.getElementsByClassName("tiktok-wrap outer")).forEach(e=>{var t,i;let l=e.querySelector(".tiktok-iframe");if(!l)return;l.classList.add("visible"),null===(t=e.querySelector(".tiktok-wrap.static"))||void 0===t||t.classList.add("hidden");let n=e.querySelector(".fallback-failure");null==n||n.classList.add("no-border");try{let e=l.contentDocument||(null===(i=l.contentWindow)||void 0===i?void 0:i.document);(null==e?void 0:e.readyState)=="complete"&&(null==n||n.classList.add("visible"))}catch(e){}l.onload=()=>{null==n||n.classList.add("visible")},l.onerror=()=>{null==n||n.classList.add("visible")},l.onabort=()=>{null==n||n.classList.add("visible")}}),null===(i=Array.from(document.getElementsByClassName("third-party-cookie-check-iframe")))||void 0===i||null===(t=i.forEach)||void 0===t||t.call(i,e=>e.remove()))};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}}function o(){(0,l.d4)(n,[])}},81033:function(e,t,i){i.r(t),i.d(t,{ReaderPost:()=>A});var l=i(7409),n=i(99282),o=i(16584),r=i(98661),a=i(30396),d=i(94184),s=i.n(d),u=i(69241),c=i(16564),p=i(18787),v=i(56219),b=i(90311),h=i(94442),f=i(3862),m=i(11712),y=i(94594),_=i(30372),g=i(40647),k=i(68833),w=i(8090),S=i(10047),Z=i(21159),x=i(98914),E=i(19081),P=i(58175),L=i(9459),U=i(91432),T=i(24791),B=i(31377),R=i(26111),C=i(63651),I=i(84864);function A(e){var t,i,r,d,A,j,q,M,H,N;let{post:O,pub:W,user:F,publicationSettings:K,postContainerRef:D,videoPlayerRef:G}=e,{mutate:J}=(0,u.kY)(),{startInterval:Y,stopInterval:$,trackInterval:V,getCurrentUuid:z}=(0,_.PS)(),{getConfigFor:Q}=(0,g.xR)(),{onSave:ee}=(0,h.nA)({postId:O.id,trackSurface:"post-viewer"}),et=!!((null==F?void 0:F.is_subscribed)||(null==F?void 0:F.is_contributor)||(null==F?void 0:F.is_admin)),ei=!!((null==F?void 0:F.is_subscribed)||(null==F?void 0:F.is_free_subscribed)),el=null==F?void 0:F.email,en=O.section_id&&null!==(j=null===(t=W.sections)||void 0===t?void 0:t.find(e=>e.id===O.section_id))&&void 0!==j?j:null,eo=!(!O.hidden&&(et||O&&!(0,B.isPaidAudience)(O.audience)||O&&!O.slug)),er="paid subscribers";"founding"===O.audience&&(er="subscribers in the ".concat(null!==(q=(0,T.H$)(W))&&void 0!==q?q:"Founding Member"," plan"));let ea=!!((null==K?void 0:K.paywall_unlock_tokens)&&"only_paid"===O.audience&&O.teaser_post_eligible)&&!(null==F?void 0:F.is_subscribed)&&((null==F?void 0:F.is_free_subscribed)||ei)&&!(null==F?void 0:F.has_redeemed_post_unlock_token),ed=(0,v.eu)(W,F),es=!eo&&!O.hidden&&O.body_html&&(0,v.Rs)(O.body_html)&&(0,v.xw)(W,F,!!(null==K?void 0:K.payment_pledges_enabled),ed);(0,S.M)();let eu=(0,a.sO)(),ec="true"===(0,R.x)("autoPlay"),ep="true"===(0,R.x)("triggerSave");(0,a.d4)(()=>{ep&&(ee(),(0,x.iO)("triggerSave"))},[]),(0,a.d4)(()=>{let e="post viewer",t=!!eo;(0,k.jJ)({post:O,hasPaywall:t,surface:e,markRead:!0,user:F,trackerUuid:z()}),F&&J("/api/v1/inbox/top",async e=>{if(await (0,w.c$)(O.id),e)return(0,n._)((0,l._)({},e),{inboxItems:e.inboxItems.map(e=>e.post_id!==O.id||e.seen_at?e:(0,n._)((0,l._)({},e),{seen_at:new Date().toISOString()}))})},{revalidate:!1}),(null==D?void 0:D.current)&&O.read_progress&&O.read_progress>0&&O.read_progress<1&&(D.current.scrollTop=(0,Z.m)(D.current,100*O.read_progress));let i=!1,o=()=>{if(!i){let l=eu.current;l&&l.getBoundingClientRect().top{window.removeEventListener("scroll",o,{capture:!0}),V(),$()}},[O.id]);let{publishedBylines:ev}=O,eb=(0,a.sO)();return(0,a.d4)(()=>{if((null==eb?void 0:eb.current)&&(null==F?void 0:F.email))for(let e of eb.current.querySelectorAll('article.post input[type="email"]'))e.value||(e.value=F.email)},[O.id,null==F?void 0:F.email]),(0,o.BX)(E.tu,{as:"article",className:s()("typography ".concat(O.type,"-post post post-viewer-post")),gap:16,children:[O.videoUpload&&(0,o.tZ)(E.hs,{justifyContent:"center",children:(0,o.tZ)(E.tu,{justifyContent:"center",flex:"grow",style:{maxWidth:900},children:(0,o.tZ)(L.L,{disableAutoPlay:!0,forceAutoPlay:ec,isFreeSubscribed:!!(null==F?void 0:F.is_free_subscribed),isSubscribed:!!(null==F?void 0:F.is_subscribed),mediaUpload:O.videoUpload,post:O,pub:W,variant:"inbox",videoPlayerRef:G,videoType:"post",entityKey:String(O.id),entityType:"post",surface:"post",contentType:"post"})})}),O.podcastUpload&&!O.videoUpload&&(0,o.tZ)(E.hs,{justifyContent:"center",children:(0,o.tZ)(E.tu,{justifyContent:"center",flex:"grow",style:{maxWidth:600},children:(0,o.tZ)(U.lU,{isFreeSubscribed:!!(null==F?void 0:F.is_free_subscribed),isSubscribed:!!(null==F?void 0:F.is_subscribed),post:O,pub:W,section:en,variant:"notes-full",trackingProps:{surface:"post",entityKey:O.id,entityType:"post",contentType:"post"}})})}),(0,o.tZ)(E.hs,{justifyContent:"center",children:(0,o.BX)(E.tu,{gap:16,style:{maxWidth:600},flex:"grow",children:[(0,o.BX)(E.tu,{gap:4,alignItems:"start",children:[(0,o.tZ)(P.xv.Meta,{as:"a",href:"profile"===W.homepage_type&&W.author_id&&(null===(i=W.author)||void 0===i?void 0:i.name)?(0,C.GR3)(W.author_id,null===(r=W.author)||void 0===r?void 0:r.name):(0,C.SVA)(W),target:"_blank",decoration:"hover-underline",children:W.name}),(0,o.BX)(E.tu,{gap:8,alignItems:"start",children:[(0,o.tZ)(P.xv.H1,{as:"a",href:null!==(M=O.canonical_url)&&void 0!==M?M:(0,C.uRy)(W,O),target:"_blank",decoration:"hover-underline",children:O.title}),"podcast"!==O.type&&O.subtitle&&(0,o.tZ)(P.xv.B3,{color:"secondary",children:O.subtitle})]})]}),ev.length>0&&(0,o.tZ)(f.E,{post:O,pub:W,relativeLinks:!0}),(0,o.tZ)("hr",{style:"margin: 16px 0"})]})}),(0,o.BX)("div",{ref:eb,children:[(O.has_voiceover||!!O.voiceoverUpload)&&(0,o.tZ)(X,{children:(0,o.tZ)(c.KH,{pub:W,post:O,mediaUploadId:O.voiceover_upload_id,duration:null===(d=O.voiceoverUpload)||void 0===d?void 0:d.duration,href:O.canonical_url,isPaywalled:!O.voiceover_upload_id})}),(0,o.tZ)("div",{className:"available-content reader2-post-content",children:(0,o.tZ)(m.Z,{html:null!==(H=O.body_html)&&void 0!==H?H:null,pub:W,trackSelection:!0,post:O,canRestackImage:!!Q("restack_with_image"),user:F,freeSignup:ei,freeSignupEmail:el,paywall:eo})}),(0,o.BX)(X,{children:[es&&(0,o.tZ)(v.nM,{user:F,pub:W,freeSignup:ei,freeSignupEmail:el,post:O,overridePledgesEnabled:null==K?void 0:K.payment_pledges_enabled}),!es&&ed&&(0,o.tZ)(y.o,{pub:W})]}),(0,o.BX)(X,{paddingY:24,borderTop:"detail",ref:eu,children:[eo&&(0,o.tZ)(p.f1,(0,l._)({user:F,freeSignupEmail:el,freeSignup:ei,publication:W,post:O,title:"".concat("video"===O.type&&(null!==(N=null===(A=O.videoUpload)||void 0===A?void 0:A.preview_duration)&&void 0!==N?N:0)>0?"The full":"This"," ").concat((0,I.getPrintedPostType)(O.type)," is for ").concat(er),reauthenticationTitle:"To read this, please re-authenticate.",showPostUnlockPrompt:ea},eo)),(0,o.tZ)(b.hp,{post:O,pub:W,user:F})]})]})]})}let X=(0,r.forwardRef)((e,t)=>(0,o.tZ)(E.tu,(0,l._)({style:{width:"var(--page-width)",margin:"0 auto"},ref:t},e)))}}]);