"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["3290"],{22233:function(e,t,i){i.d(t,{Z:()=>n});let n=2787!=i.j?{icon:"icon-JCPlCw",toggleSetting:"toggleSetting-UDN_Qn",transcriptionPlayer:"transcriptionPlayer-eiECcl",hidePlayer:"hidePlayer-TfzId9",nonActiveText:"nonActiveText-JfTKb8",transcriptionChunk:"transcriptionChunk-bCQeJ2",editableChunk:"editableChunk-k4Fatu",startTime:"startTime-tjpyBE",text:"text-Ou5QC2",activeStartTime:"activeStartTime-ozZC_j",chunkWithSpeaker:"chunkWithSpeaker-iYPDkU",speaker:"speaker-GFTaOB",transcription:"transcription-hfRyWl",popover:"popover-tZdxdX",divider:"divider-ah0vWs",resultsValue:"resultsValue-uYlTxH",searchResult:"searchResult-_1_8Y9",isFocused:"isFocused-CIwNEb",searchForm:"searchForm-gEUJ79"}:null},12936:function(e,t,i){i.d(t,{S$:()=>w,Su:()=>_,_e:()=>b});var n=i(16584),r=i(6400),a=i(30396),l=i(53836),o=i.n(l),s=i(97742);i(70522);var d=i(57391),c=i(95441),u=i(68833);i(62981);var p=i(98914);i(15771),i(19081),i(58175);var h=i(66611),v=i(60308);if(/^(3154|6909)$/.test(i.j))var m=i(26111);if(i(63651),/^(3154|6909)$/.test(i.j))var Z=i(81821);if(/^(3154|6909)$/.test(i.j))var f=i(47929);let g=(0,r.createContext)({hidden:!1});function _(){let{setHidden:e}=(0,a.qp)(g);return()=>null==e?void 0:e(!0)}function b(e){let{children:t}=e,[i,r]=(0,a.eJ)(!1);return(0,n.tZ)(g.Provider,{value:{hidden:i,setHidden:r},children:t})}function w(e){let{post:t,subdomain:i,readerInstalled:r,isContributor:l}=e,s=(0,Z.s)()?"ios":(0,Z.Dt)()?"android":null,{iString:h}=(0,c.M1)(),{hidden:_}=(0,a.qp)(g),{exposeExperiment:b,getExperimentVariant:w}=(0,d.jc)(),k=_||!(0,Z.tq)({checkFirst4:!0})||!s;if((0,a.d4)(()=>{k||!r||l||t.is_draft||(0,m.x)("triedRedirect")||(0,p.AE)()?k||b("app_install_prompts"):(0,p.uX)((0,v.K8_)(i,t.slug,{params:{utm_medium:f.lP.web,utm_campaign:f.VX.postsOpenInApp,utm_source:f.b3.postBanner}}))},[]),k)return null;let S=w("app_install_prompts")||"none";if(!["our_banner","native_banner_if_supported"].includes(S))return null;let N=h("Read in the Substack app");"podcast"==t.type?N=h("Listen in the Substack app"):"video"==t.type&&(N=h("Watch in the Substack app"));let E=(0,v.K8_)(i,t.slug,{redirect:"app-store",source:f.b3.postBanner});return(0,Z.IT)()&&"native_banner_if_supported"===S?(0,n.BX)(n.HY,{children:[(0,n.tZ)(o(),{meta:[{name:"apple-itunes-app",content:"app-id=1581650857, app-argument=".concat(E)}]}),(0,n.tZ)(y,{surface:"post",bannerType:"safari-native-app-banner"})]}):(0,n.BX)(P,{className:"app-banner-post",children:[(0,n.tZ)(y,{surface:"post"}),(0,n.tZ)(x,{}),(0,n.tZ)(C,{children:(0,n.tZ)("div",{children:N})}),(0,n.tZ)("a",{className:"app-banner-cta",href:E,onClick:()=>{(0,u.j)(u.FP.APP_BANNER_TAPPED,{surface:"post",type:"header"})},children:h("Open app")})]})}function y(e){let{surface:t,bannerType:i}=e;return(0,a.d4)(()=>{(0,u.j)(u.FP.APP_BANNER_VIEWED,{surface:t,bannerType:i})},[]),null}let P=(0,h.L)("app-banner"),C=(0,h.L)("app-banner-text");function x(){return(0,n.tZ)("div",{className:"app-banner-icon",children:(0,n.tZ)(s.Z,{height:16})})}},72508:function(e,t,i){i.d(t,{ZP:()=>M,ml:()=>$,sZ:()=>H});var n=i(7409),r=i(99282),a=i(16584),l=i(30396),o=i(94184),s=i.n(o),d=i(74691),c=i.n(d),u=i(18029),p=i.n(u),h=i(44908),v=i.n(h),m=i(40423),Z=i(96862),f=i(3039),g=i(19298),_=i(80569),b=i.n(_),w=i(61649),y=i(29032),P=i(93678),C=i(44881),x=i(95441),k=i(57952),S=i(96904),N=i(53030),E=i(68833),T=i(33224),R=i(71068),B=i(19081),O=i(58175),I=i(17564),D=i(74571),j=i(61468),A=i(84864),L=i(93370),X=i(24271),U=i(63523);function M(e){var t,i;let{disableSelection:o,player:s,postId:d,renderTranscriptionChunk:u,transcription:p,onUpdateActiveRowIndex:h}=e,{iString:m}=(0,x.M1)(),{onStartClipping:Z}=(0,w.Sr)(),f=(0,l.sO)(null),{selection:g,clearSelection:_,selectEndRef:y,selectStartRef:P}=(0,D.LW)({containerRef:f,disable:null!=o&&o,playerRef:s}),[R,I]=(0,l.eJ)(!0),[A,L]=(0,l.eJ)(),[X,M]=(0,l.eJ)(["nick","mills"]),[$,H]=(0,l.eJ)({}),[W,J]=(0,l.eJ)(!1),[G,Y]=(0,l.eJ)(!1),[q,K]=(0,l.eJ)(),{currentTime:Q,isPlaying:ee}=(0,N.FI)(s),et=$?Object.values($).filter(e=>e):[],ei=!!((null==X?void 0:X.length)&&et.length),{setItems:en}=(0,k.pH)(),er=null==A?void 0:A.findIndex(e=>e.start<=Q&&e.end>Q);if((0,l.d4)(()=>{h&&void 0!==er&&-1!==er&&h(er)},[er,h]),(0,l.d4)(()=>{I(!0),p.cdn_url&&b().get(p.cdn_url).then(e=>{if(!e.text)return;let t=JSON.parse(e.text),i=(0,j.Ap)({rows:t});L(i),en(i);let n=v()(i.map(e=>{var t;return null!==(t=e.speaker)&&void 0!==t?t:""})).filter(e=>e).sort();n.length&&M(n)}).finally(()=>{I(!1)}),p.speaker_map&&Object.values(p.speaker_map).length&&H(p.speaker_map)},[null==A?void 0:A.length,en,p.cdn_url,p.cdn_unaligned_url,p.speaker_map]),R)return(0,a.tZ)(F,{});if(!(null==A?void 0:A.length))return(0,a.tZ)("div",{className:U.Z.transcriptionStatus,children:(0,a.tZ)(O.xv.Meta,{children:m((null==p?void 0:p.status)==="in_progress"?"Transcription in progress...":"No transcript...")})});let ea=(null==s?void 0:null===(i=s.current)||void 0===i?void 0:null===(t=i.player)||void 0===t?void 0:t.tagName)==="VIDEO",el=ea?"videogram":"audiogram";return(0,a.BX)(B.tu,{ref:f,children:[g&&(0,a.tZ)(z,{isVideo:ea,selection:g,onSelect:ea?()=>{if(!g||!A||!P.current||!y.current)return;let e=P.current,t=y.current;(e.rowIndex>t.rowIndex||e.rowIndex===t.rowIndex&&e.offset>t.offset)&&([e,t]=[t,e]);let i=(0,T.xm)({startRow:A[e.rowIndex],endRow:A[t.rowIndex],startOffset:e.offset,endOffset:t.offset,startNodeText:e.text,endNodeText:t.text});_(),Z((0,r._)((0,n._)({},i),{source:"transcription",title:null}))}:function(){if(g&&y.current&&P.current&&A){let e=(0,n._)({},P.current),t=(0,n._)({},y.current),[i,r]=(0,T.lF)({selectStart:e,selectEnd:t,alignedRows:A});i>r&&([i,r]=[r,i]),J(!0),b().post("/api/v1/audiogram").send({post_id:d,start_idx:i,end_idx:r,use_draft:!1}).then(e=>{var t,i;(null===(t=e.body)||void 0===t?void 0:t.data)&&(K(e.body.data),_(),(null==s?void 0:null===(i=s.current)||void 0===i?void 0:i.player)&&s.current.player.pause())}).finally(()=>J(!1))}}}),u&&A.map((e,t)=>{var i;return u({isPlaying:ee,row:e,rowIndex:t,words:e.words,showSpeaker:(0===t?void 0:null===(i=A[t-1])||void 0===i?void 0:i.speaker)!==e.speaker,speakerName:ei&&e.speaker?$[e.speaker]:void 0,onPause:()=>{var e;(null==s?void 0:null===(e=s.current)||void 0===e?void 0:e.player)&&s.current.player.pause()},onPlay:()=>{var t;(null==s?void 0:null===(t=s.current)||void 0===t?void 0:t.player)&&(s.current.player.currentTime=e.start+1e-4,s.current.player.play())}})}),!u&&A.map((e,t)=>(0,a.tZ)(V,{idx:t,row:e,rows:A,speakerName:ei&&e.speaker?$[e.speaker]:void 0,onReassign:()=>Y(!0),currentTime:Q,isPlaying:ee,isSelected:!!(g&&y.current&&P.current&&t===c()(t,Math.min(P.current.rowIndex,y.current.rowIndex),Math.max(P.current.rowIndex,y.current.rowIndex))),onClick:()=>{_()},onPause:()=>{var e;(null==s?void 0:null===(e=s.current)||void 0===e?void 0:e.player)&&s.current.player.pause()},onPlay:()=>{var t;(null==s?void 0:null===(t=s.current)||void 0===t?void 0:t.player)&&(s.current.player.currentTime=e.start+1e-4,s.current.player.play())}},t)),(0,a.tZ)(S.G,{isOpen:!!(W||q),onClose:()=>K(void 0),isGenerating:W,finishedGram:q,noun:el,postId:d,onDownload:function(e){return(0,E.j)(E.FP.AUDIOGRAM_DOWNLOAD_CLICKED,{post_id:d,audiogram_id:null==q?void 0:q.id,media_upload_id:p.media_upload_id}),fetch(e,{method:"GET"}).then(e=>e.blob()).then(e=>{var t;let i=null==q?void 0:null===(t=q.video_url)||void 0===t?void 0:t.split("/").pop(),n=null==i?void 0:i.match(/^([^-]+-[^_]+)_/),r=(null==n?void 0:n[1])||"",a=URL.createObjectURL(e),l=document.createElement("a");l.href=a,l.download="substack-".concat(el,"-").concat(d,"-").concat(r,".mp4"),document.body.appendChild(l),l.click(),URL.revokeObjectURL(a),l.remove()})}}),(0,a.tZ)(C.O,{isOpen:X&&!!X.length&&!!G,onClose:()=>Y(!1),speakers:X,speakerMap:$,onChangeSpeakerMap:H,postId:d})]})}function z(e){var t,i;let{isVideo:n,selection:r,onSelect:l}=e,{iString:o}=(0,x.M1)(),d=null===(i=r.anchorNode)||void 0===i?void 0:null===(t=i.parentElement)||void 0===t?void 0:t.getBoundingClientRect();return d?(0,a.tZ)(y.C,{children:(0,a.tZ)(B.tu,{style:{top:(0,A.isTouchDevice)()?Math.max(d.y,0)+d.height+12:Math.max(d.bottom,0)+12,left:d.x+d.width/2,transform:"translateX(-50%)",pointerEvents:"auto",maxWidth:240},justifyContent:"center",outline:"detail",shadow:"md",radius:"md",className:s()(X.Z.popover,X.Z.mounted),padding:4,gap:4,children:n?(0,a.BX)(P.O7,{onClick:l,children:[(0,a.tZ)(m.Z,{color:"var(--color-utility-white)",size:20}),(0,a.tZ)(O.xv.B4,{color:"white",weight:"medium",children:o("Create clip")})]}):(0,a.BX)(P.O7,{onClick:l,children:[(0,a.tZ)(Z.Z,{color:"var(--color-utility-white)",size:20}),(0,a.tZ)(O.xv.B4,{color:"white",weight:"medium",children:o("Make audiogram")})]})})}):null}function F(){return(0,a.BX)(a.HY,{children:[(0,a.tZ)(I.S,{width:"80%",height:"24px",className:U.Z.loadingSilhouette}),(0,a.tZ)(I.S,{width:"34%",height:"24px",className:U.Z.loadingSilhouette}),(0,a.tZ)(I.S,{width:"75%",height:"24px",className:U.Z.loadingSilhouette}),(0,a.tZ)(I.S,{width:"100%",height:"24px",className:U.Z.loadingSilhouette}),(0,a.tZ)(I.S,{width:"68%",height:"24px",className:U.Z.loadingSilhouette})]})}function $(e){if(!e)return"Unknown Speaker";let t=e.split("_"),i=parseInt(t[1]);return"".concat(p()(t[0])," ").concat(i+1)}function V(e){let{row:t,currentTime:i,onPlay:o,isPlaying:d,onPause:c,isSelected:u,onClick:p,idx:h,rows:v,onReassign:m,speakerName:Z}=e,[_,b]=(0,l.eJ)(!1),w=(0,l.sO)(null),y=t.start<=i&&t.end>=i,P=t.words.map(e=>e.start<=i&&e.end>=i?(0,a.BX)(a.HY,{children:[(0,a.tZ)("span",{className:U.Z.activeWord,children:e.word})," "]}):"".concat(e.word," "));P.length||(P=t.text.split(" ").map(e=>(0,a.BX)("span",{children:[e," "]})));let C=null;if(t.speaker&&Z){var x;let e=0===h?void 0:null===(x=v[h-1])||void 0===x?void 0:x.speaker;t.speaker!==e&&(C=(0,a.tZ)("div",{className:U.Z.speakerText,onClick:m,children:Z}))}return(0,a.BX)("div",{ref:w,onClick:p,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),style:{display:"flex",width:"100%",alignItems:"center"},children:[d&&(!_||y)?(0,a.tZ)(g.Z,{onClick:c,size:24,className:U.Z.playCircle,style:(0,r._)((0,n._)({},_&&{color:"var(--color-accent-themed)"}),{visibility:y||_?"visible":"hidden"})}):(0,a.tZ)(f.Z,{onClick:o,size:24,className:U.Z.playCircle,style:(0,r._)((0,n._)({},_&&{color:"var(--color-accent-themed)"}),{visibility:y||_?"visible":"hidden"})}),(0,a.BX)("div",{className:s()(U.Z.transcriptionChunk,{[U.Z.activeRow]:y||u,[U.Z.hoverChunk]:_}),"data-chunk-index":h,children:[(0,a.tZ)("div",{className:s()(U.Z.rowIndicator,{[U.Z.hoverRow]:_})}),(0,a.BX)("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"5px 0"},children:[C,(0,a.tZ)("div",{className:U.Z.rowText,"data-chunk-index":h,children:P})]})]})]})}let H=e=>{let{isActiveRow:t,isPlaying:i,row:n,rowIndex:r,onPause:l,onPlay:o,postId:d,children:c,className:u,activeClassName:p,editable:h}=e,v=t&&i;return(0,a.tZ)(R.xu,{id:"transcription-".concat(r),paddingRight:16,className:s()(u,{[null!=p?p:""]:v}),onClick:()=>{var e;(null===(e=window.getSelection())||void 0===e||!e.toString())&&!h&&((0,E.j)(E.FP.TRANSCRIPTION_TIMESTAMP_CLICKED,{post_id:d,timestamp:(0,L.DL)(n.start)}),v?l():o())},children:c})}},2689:function(e,t,i){if(i.d(t,{Z:()=>s}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var r=i(99282);if(/^(3154|6909)$/.test(i.j))var a=i(98848);var l=i(16584),o=i(64515);let s=/^(3154|6909)$/.test(i.j)?e=>{var{size:t=20,fill:i="var(--color-fg-primary)"}=e,s=(0,a._)(e,["size","fill"]);return(0,l.tZ)(o.l,(0,r._)((0,n._)({},s),{name:"PauseIconFilled",svgParams:{viewBox:"0 0 20 20"},width:t,height:t,fill:i,children:(0,l.tZ)("path",{stroke:"none",d:"M5.29883 17.9082H7.52539C8.375 17.9082 8.82422 17.459 8.82422 16.5996V3.29883C8.82422 2.41016 8.375 2 7.52539 2H5.29883C4.44922 2 4 2.44922 4 3.29883V16.5996C4 17.459 4.44922 17.9082 5.29883 17.9082ZM12.3984 17.9082H14.6152C15.4746 17.9082 15.9141 17.459 15.9141 16.5996V3.29883C15.9141 2.41016 15.4746 2 14.6152 2H12.3984C11.5391 2 11.0898 2.44922 11.0898 3.29883V16.5996C11.0898 17.459 11.5391 17.9082 12.3984 17.9082Z"})}))}:null},9970:function(e,t,i){if(i.d(t,{Z:()=>s}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var r=i(99282);if(/^(3154|6909)$/.test(i.j))var a=i(98848);var l=i(16584),o=i(64515);let s=/^(3154|6909)$/.test(i.j)?e=>{var{size:t=20,fill:i="var(--color-fg-primary)"}=e,s=(0,a._)(e,["size","fill"]);return(0,l.tZ)(o.l,(0,r._)((0,n._)({},s),{name:"PlayIconFilled",svgParams:{viewBox:"0 0 20 20"},width:t,height:t,fill:i,children:(0,l.tZ)("path",{stroke:"none",d:"M5.04688 18.5527C5.4375 18.5527 5.76953 18.3965 6.16016 18.1719L17.5469 11.5898C18.3574 11.1113 18.6406 10.7988 18.6406 10.2812C18.6406 9.76367 18.3574 9.45117 17.5469 8.98242L6.16016 2.39063C5.76953 2.16602 5.4375 2.01953 5.04688 2.01953C4.32422 2.01953 3.875 2.56641 3.875 3.41602V17.1465C3.875 17.9961 4.32422 18.5527 5.04688 18.5527Z"})}))}:null},55438:function(e,t,i){i.d(t,{Z:()=>d});var n=i(7409),r=i(99282),a=i(98848),l=i(16584),o=i(64515),s=i(90406);let d=e=>{var{svgParams:t}=e,i=(0,a._)(e,["svgParams"]);return(0,l.BX)(o.l,(0,r._)((0,n._)({},i),{name:"SubstackIcon",svgParams:(0,n._)({height:1e3,width:1e3,fill:s.Hu,stroke:"none"},t),children:[(0,l.tZ)("path",{d:"M764.166 348.371H236.319V419.402H764.166V348.371Z"}),(0,l.tZ)("path",{d:"M236.319 483.752V813.999L500.231 666.512L764.19 813.999V483.752H236.319Z"}),(0,l.tZ)("path",{d:"M764.166 213H236.319V284.019H764.166V213Z"})]}))}},30363:function(e,t,i){i.d(t,{ZP:()=>c});var n=i(16584),r=i(94184),a=i.n(r),l=i(55438),o=i(90406),s=i(10510);let d=e=>{let{publication:t,logo_size:i=60,className:r="",children:d}=e;return(0,n.tZ)("table",{role:"presentation",className:a()("publication","card",r,t.logo_url?"has-logo":"no-logo"),width:"auto",cellpadding:0,cellspacing:0,border:"0",children:(0,n.BX)("tr",{cellpadding:"0",height:"100%",children:[i&&(0,n.tZ)("td",{rowspan:3,className:"logo",children:(0,n.tZ)("figure",{className:"logo",children:t.logo_url?(0,n.tZ)(s.CN,{pub:t,size:i}):(0,n.tZ)(l.Z,{isStatic:!0,fill:t.theme_var_background_pop||o.Hu,width:i,height:i})})}),(0,n.tZ)("td",{children:(0,n.BX)("table",{cellpadding:"0",cellspacing:"0",children:[(0,n.tZ)("tr",{children:(0,n.tZ)("td",{className:"title",children:t.name})}),(0,n.tZ)("tr",{cellpadding:"0",height:"80%",children:(0,n.tZ)("td",{className:"description",children:t.hero_text})}),d]})})]})})},c=e=>{let{publication:t,logo_size:i=60,isStatic:r=!1,children:a}=e;return r?(0,n.tZ)(d,{publication:t,logo_size:i,children:a}):(0,n.BX)("div",{className:"publication card",children:[i&&(0,n.tZ)("figure",{className:"logo",children:(0,n.tZ)(s.wk,{pub:t,size:i})}),(0,n.BX)("div",{className:"title",children:[(0,n.tZ)("div",{className:"name",children:t.name}),(0,n.tZ)("div",{className:"description",children:t.hero_text}),a]})]})}},8845:function(e,t,i){i.d(t,{C:()=>d,T:()=>s});var n=i(16584),r=i(6400),a=i(30396),l=i(6070);let o=(0,r.createContext)({theme:null,setTheme:()=>void 0}),s=()=>(0,a.qp)(o),d=e=>{var t;let{pub:i,post:r,children:s}=e,[d,c]=(0,a.eJ)(null!==(t=null==r?void 0:r.postTheme)&&void 0!==t?t:null);return(0,l.HD)({pub:i})?(0,n.tZ)(o.Provider,{value:{theme:d,setTheme:c},children:s}):(0,n.tZ)(n.HY,{children:s})}},96904:function(e,t,i){i.d(t,{G:()=>v});var n=i(58865),r=i(16584),a=i(71212),l=i(33804),o=i(95441),s=i(68833),d=i(15771),c=i(6490),u=i(98248);function p(){let e=(0,n._)(["Generating ","..."]);return p=function(){return e},e}function h(){let e=(0,n._)(["Shareable ",""]);return h=function(){return e},e}function v(e){let{isOpen:t,onClose:i,isGenerating:n,finishedGram:v,noun:m,postId:Z,onDownload:f}=e,{iString:g,iTemplate:_}=(0,o.M1)();return(0,r.tZ)(c.u_,{isOpen:t,onClose:i,children:(0,r.BX)(l.w,{children:[(0,r.tZ)(c.xB,{title:_(n?p():h(),m),showClose:!0,showDivider:!0,onClose:i}),(0,r.tZ)(c.fe,{children:v?(0,r.tZ)("video",{src:v.cdn_url,style:{borderRadius:12},controls:!0,download:!0,width:400}):(0,r.tZ)(u.$j,{alignItems:"center",justifyContent:"center",minHeight:220})}),v&&(0,r.tZ)(c.mz,{direction:"column",primaryButton:(0,r.tZ)(d.zx,{priority:"primary",leading:(0,r.tZ)(a.Z,{size:20}),onClick:()=>{(0,s.j)(s.FP.AUDIOGRAM_DOWNLOAD_CLICKED,{post_id:Z,audiogram_id:null==v?void 0:v.id,media_upload_id:null==v?void 0:v.media_upload_id}),f(v.cdn_url)},children:g("Download")})})]})})}},55014:function(e,t,i){i.d(t,{G:()=>v});var n=i(16584),r=i(30396),a=i(94184),l=i.n(a);if(2787!=i.j)var o=i(11043);var s=i(95441),d=i(15771),c=i(19081),u=i(58175);if(2787!=i.j)var p=i(81821);var h=i(52478);let v=e=>{let{onFileSelected:t,dropCTA:i,pickCTA:a,pickCTAHandler:v,acceptableTypes:m,loading:Z,className:f,multiple:g=!1,addMode:_=!1,onDrop:b,onPick:w,info:y}=e,[P,C]=(0,r.eJ)(!1),x=(0,r.sO)(null),{iString:k}=(0,s.M1)();a||v||(a=(0,n.tZ)(d.zx,{size:"sm",priority:"secondary-outline",children:g?k("Choose files"):k("Choose file")})),i||(i=k("Drop file here"));let S=e=>{e.preventDefault(),C(!0)},N=async e=>{var i,n,r,a;let l,o;if(e.preventDefault(),C(!1),(null===(n=e.dataTransfer)||void 0===n?void 0:null===(i=n.items)||void 0===i?void 0:i.length)>0){let t=Array.from(e.dataTransfer.items);for(let e of t)if("file"!==e.kind){alert(k("Please only drag files!"));return}l=e.dataTransfer.items[0].getAsFile(),o=t.map(e=>e.getAsFile())}else if((null===(a=e.dataTransfer)||void 0===a?void 0:null===(r=a.files)||void 0===r?void 0:r.length)>0)l=e.dataTransfer.files[0],o=e.dataTransfer.files;else{alert(k("Something went wrong!"));return}g?await t(o):await t(l),null==b||b(g?o:l)};return(0,n.BX)(n.HY,{children:[(0,n.BX)(c.sg,{alignItems:"center",justifyContent:"center",gap:12,radius:"md",className:l()(h.Z.dragArea,f,{[h.Z.dragActive]:P,"test-drag-active":P}),onDragEnter:S,onDragOver:S,onDragLeave:e=>{e.preventDefault(),C(!1)},onDrop:N,"aria-label":k("File Picker"),onClick:()=>{if(!v){var e;null===(e=x.current)||void 0===e||e.click()}},children:[!_&&(0,n.tZ)(o.Z,{size:32,strokeWidth:1.5}),!p.tq&&(0,n.tZ)("p",{className:h.Z.text,children:Z?k("Loading..."):P?k("Release to upload"):_?k("Add another image"):(0,n.BX)(n.HY,{children:[i," ",k("or")," "]})}),(0,n.BX)(c.sg,{gap:4,children:[(0,n.tZ)(u.xv.B3,{color:"primary",weight:"medium",children:_?k("Add another file"):k("Drag files here to upload")}),y?"string"==typeof y?(0,n.tZ)(u.xv.B4,{color:"secondary",children:y}):y:null]}),a||(v?v(()=>{var e;null===(e=x.current)||void 0===e||e.click()}):null)]}),(0,n.tZ)("input",{className:l()(h.Z.file,"file-picker-input"),ref:x,type:"file",name:"file",accept:m,multiple:g,onInput:async e=>{let i=e.target,n=i.files;n&&n[0]&&(g?await t(n):await t(n[0]),null==w||w(g?n:n[0])),i.value=""}})]})}},91246:function(e,t,i){i(16584),i(98661),i(19081),i(44424),i(42450)},17564:function(e,t,i){i.d(t,{S:()=>o});var n=i(16584),r=i(94184),a=i.n(r),l=i(12517);let o=e=>{let{animated:t=!0,width:i,height:r,aspectRatio:o,className:s,multiply:d}=e,c=a()(l.Z.container,s,{[l.Z.containerAnimated]:t,[l.Z.containerMultiply]:d});return o?(0,n.tZ)("div",{style:"aspect-ratio:".concat(o),children:(0,n.tZ)("div",{className:c,style:{width:i,height:null!=r?r:"100%"}})}):(0,n.tZ)("div",{className:c,style:{width:i,height:r}})}},78118:function(e,t,i){i.r(t),i.d(t,{ReaderOnboardingModal:()=>j,ReaderOnboardingModalWithUserContext:()=>A,TwitterStage:()=>O});var n=i(27412),r=i(7409),a=i(99282),l=i(98848),o=i(16584),s=i(98661),d=i(30396),c=i(97742),u=i(93666),p=i(32582),h=i(57391),v=i(60807),m=i(68833),Z=i(98914),f=i(341),g=i(30378),_=i(57601),b=i(64799),w=i(14861),y=i(4564),P=i(45930),C=i(76971),x=i(48146),k=i(48450),S=i(7759),N=i(29191),E=i(76560),T=i(60308),R=i(63651),B=i(81821);let O=e=>{let{user:t,useProfilePrefix:i}=e;return(null==t?void 0:t.has_linked_twitter)?(0,o.tZ)(D,{user:t,useProfilePrefix:i}):(0,o.tZ)(I,{})},I=()=>{let[e,t]=(0,d.eJ)(!0);return(0,o.BX)("div",{className:"inbox-access-form link-twitter",children:[(0,o.tZ)(c.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)(p.PH,{linkType:"reader",discoverable:e,icon:!1,text:"Connect Twitter"}),(0,o.tZ)("a",{className:"skip",href:"".concat((0,T.ZJn)(),"/profile/fill"),native:!0,children:"Skip for now"})]})},D=e=>{let{user:t,useProfilePrefix:i}=e;return(0,o.tZ)(p.G6,{user:t,onSignup:()=>{let e=(null==t?void 0:t.profile_set_up_at)?(0,T.HMK)():"".concat((0,T.ZJn)(),"/profile/fill");(0,Z.uX)(e)},buttonText:"Continue",requireSignup:!1,needsEmailConfirm:!1,useProfilePrefix:i})};class j extends u.p{componentDidMount(){super.componentDidMount(),(0,B.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?E.c.APP_UPSELL:E.c.CATEGORIES}inAppExperimentTreatment(){if(this.state.appOnboardingTreatment)return this.state.appOnboardingTreatment;let e=(0,B.tq)()&&["treatment","treatment_no_skip"].includes(this.context.getExperimentVariant("reader_onboarding_app_first"));return e&&this.setState({step:E.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?E.c.CATEGORIES:E.c.PUB_SIGNUP:E.c.PUB_LANDING}),this.open()}openToPubSignup(e){this.setState({pub:e,step:E.c.PUB_SIGNUP,profile:null}),this.open()}setStep(e){if(e===E.c.APP_UPSELL&&this.state.appOnboardingTreatment&&this.state.previousStepData[E.c.APP_UPSELL]&&(e=E.c.WELCOME),(0,m.j)(m.FP.READER_ONBOARDING_STEP_CHANGED,{from_step:this.state.step,to_step:e,modal:!0}),e===E.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,T.SVA)(this.state.pub):(0,R.E2n)();document.location.href=e}}else setTimeout(()=>this.setState({step:e}),0)}setPreviousStepData(e,t){this.setState({previousStepData:(0,a._)((0,r._)({},this.state.previousStepData),{[e]:t})})}getClassName(){return"reader-onboarding-modal wide"}onClose(){(0,m.j)(m.FP.READER_ONBOARDING_MODAL_CLOSED,{entry:this.props.entry,step:this.state.step}),this.setStep(this.getDefaultStep())}onOpen(){var e;(0,m.j)(m.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:i}=this.state;console.error("Error in reader onboarding ".concat(i," step: ").concat(e)),(0,m.j)(m.FP.READER_ONBOARDING_ERROR,{step:i,entry:this.props.entry,ignore:t}),t||this.setStep(E.c.ERROR)}renderStep(){let e=this.props,{ref:t}=e,i=(0,l._)(e,["ref"]),{step:n,open:s,pub:d,profile:c,previousStepData:u,appOnboardingTreatment:p}=this.state,h={setStep:this.setStep,handleError:this.handleError,close:this.close,setPreviousStepData:this.setPreviousStepData,appOnboardingTreatment:p};if(!s)return null;switch(n){case E.c.SIGNUP:return(0,o.tZ)(k.Z,(0,a._)((0,r._)({},i,h),{previousStepData:u}));case E.c.PUB_LANDING:return(0,o.tZ)(C.Z,(0,a._)((0,r._)({},i,h),{pub:d}));case E.c.PUB_SIGNUP:return(0,o.tZ)(x.Z,(0,a._)((0,r._)({},i,h),{pub:d,profile:null!=c?c:null}));case E.c.CATEGORIES:return this.inNewCategoriesStepExperimentTreatment()?(0,o.tZ)(y.r,(0,a._)((0,r._)({},i,h),{pub:d})):(0,o.tZ)(g.Z,(0,a._)((0,r._)({},i,h),{pub:d}));case E.c.PROFILE:return(0,o.tZ)(P.Z,(0,r._)({},i,h));case E.c.START_WRITING:return(0,o.tZ)(S.Z,(0,r._)({},i,h));case E.c.CREATE_PUBLICATION:return(0,o.tZ)(_.Z,(0,r._)({},i,h));case E.c.CREATE_PUBLICATION_SUCCESS:return(0,o.tZ)(b.Z,(0,a._)((0,r._)({},i,h),{previousStepData:u}));case E.c.ERROR:return(0,o.tZ)(w.Z,(0,r._)({},i,h));case E.c.APP_UPSELL:return(0,o.tZ)(f.Z,{onComplete:()=>{this.setPreviousStepData(E.c.APP_UPSELL,!0),p?this.setStep(E.c.CATEGORIES):this.setStep(E.c.WELCOME)}});case E.c.WELCOME:default:return(0,o.tZ)(N.Z,(0,a._)((0,r._)({},i,h),{pub:d,profile:null!=c?c:null}))}}renderChildren(){return(0,o.tZ)("div",{className:"reader-onboarding-modal-container",children:this.renderStep()})}constructor(e,t){var i;super(e,t),(0,n._)(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!==(i=e.skipRedirectOnExit)&&void 0!==i&&i,this.redirect=e.redirect&&"/"!==e.redirect?e.redirect:null,this.state.appOnboardingTreatment=!1,this.state.step=e.step||this.getDefaultStep()}}(0,n._)(j,"contextType",h.kx);let A=(0,s.forwardRef)((e,t)=>{let i=(0,v.SE)(),n=e.onBeforeClose,l=n?()=>n(i.user):void 0,s=(0,a._)((0,r._)({},e),{onBeforeClose:l,user:i.user});return(0,o.tZ)(j,(0,a._)((0,r._)({},s),{ref:t}))})},50167:function(e,t,i){if(i.d(t,{QC:()=>h}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var r=i(99282);var a=i(16584),l=i(30396),o=i(95441),s=i(7882),d=i(98914),c=i(15771);i(91246);var u=i(70379),p=i(60308);function h(e){let{profile:t,publicationUser:i}=e,{iString:h}=(0,o.M1)(),{onClick:v,href:m,isLoading:Z,willRedirect:f}=function(e,t,i){let{popToast:o}=(0,u.pm)(),[c,h]=(0,l.eJ)(!1),[v,m]=(0,l.eJ)(void 0),{refetch:Z,isLoading:f}=(0,s.ib)({pathname:"/api/v1/@".concat(null==e?void 0:e.handle,"/personal-initialize"),method:"post"}),g=!t&&e.isPersonalEligible,_=(null==e?void 0:e.isPersonalEligible)||g?async()=>{let e=await Z({query:{action:"post"}});e instanceof Error?(console.error(e),o(e=>(0,a.tZ)(u.FN,(0,r._)((0,n._)({},e),{text:"Something went wrong. Please try again."})))):(h(!0),"undefined"!=typeof window&&(window.location.href=e.redirectUrl))}:async()=>(0,d.uX)((0,p.DeU)(),{local_navigation:!1});return(0,l.d4)(()=>{"undefined"!=typeof window&&(null==t?void 0:t.publication)&&!g&&m((0,p.n1t)("".concat((0,p.SVA)({subdomain:t.publication.subdomain}),"/publish/post"),{back:window.location.href,type:void 0}))},[t,g]),{onClick:_,href:v,isLoading:f,willRedirect:c}}(t,i);return(0,a.tZ)(c.zx,{priority:"primary",href:m,onClick:v,disabled:Z||f,localNavigation:!1,children:h("New post")})}},5623:function(e,t,i){i.d(t,{R5:()=>eE});var n=i(7409),r=i(99282),a=i(98848);if(/^(3154|6909)$/.test(i.j))var l=i(58865);var o=i(16584),s=i(98661),d=i(30396),c=i(94184),u=i.n(c);if(/^(3154|6909)$/.test(i.j))var p=i(18693);if(/^(3154|6909)$/.test(i.j))var h=i(84967);if(/^(3154|6909)$/.test(i.j))var v=i(49336);if(/^(3154|6909)$/.test(i.j))var m=i(71375);if(/^(3154|6909)$/.test(i.j))var Z=i(8618);if(/^(3154|6909)$/.test(i.j))var f=i(7617);if(/^(3154|6909)$/.test(i.j))var g=i(31131);if(/^(3154|6909)$/.test(i.j))var _=i(13808);if(/^(3154|6909)$/.test(i.j))var b=i(85200);if(/^(3154|6909)$/.test(i.j))var w=i(99869);if(/^(3154|6909)$/.test(i.j))var y=i(77600);if(/^(3154|6909)$/.test(i.j))var P=i(44276);if(/^(3154|6909)$/.test(i.j))var C=i(77475);if(/^(3154|6909)$/.test(i.j))var x=i(47655);if(/^(3154|6909)$/.test(i.j))var k=i(20817);if(/^(3154|6909)$/.test(i.j))var S=i(98643);if(/^(3154|6909)$/.test(i.j))var N=i(59543);if(/^(3154|6909)$/.test(i.j))var E=i(7073);var T=i(61649),R=i(59708),B=i(51455),O=i(50137),I=i(2689),D=i(9970),j=i(26582),A=i(51534),L=i(96726),X=i(56219),U=i(94442),M=i(67203),z=i(10878),F=i(51014),$=i(75697),V=i(72392),H=i(95441),W=i(93155),J=i(40647),G=i(60807),Y=i(6246),q=i(68833),K=i(48980),Q=i(7882),ee=i(21599);i(9682);var et=i(32129),ei=i(94874),en=i(15771),er=i(19081),ea=i(84370),el=i(44424),eo=i(98248),es=i(10510),ed=i(58175),ec=i(70379),eu=i(87077),ep=i(40949),eh=i(74312),ev=i(88817),em=i(65575),eZ=i(44312),ef=i(32189),eg=i(39493),e_=i(61412),eb=i(91400),ew=i(64172),ey=i(60308),eP=i(63651),eC=i(84864);if(/^(3154|6909)$/.test(i.j))var ex=i(47929);var ek=i(78691);function eS(){let e=(0,l._)(["You subscribed to "," by "," because it was recommended by ","."]);return eS=function(){return e},e}function eN(){let e=(0,l._)(["You subscribed to "," because it was recommended by ","."]);return eN=function(){return e},e}function eE(e){var t;let i=(0,ev.SJ)();return(0,d.d4)(()=>()=>{var e;null===(e=i.setDrawer)||void 0===e||e.call(i,null)},[]),i.setDrawer&&null!==(t=i.setDrawer((0,o.tZ)(eR,(0,n._)({},e))))&&void 0!==t?t:null}function eT(e){var t,i,a,l,s,c,Z,f,g,_,b,w,y;let P,{postId:C,post:x,publication:k,videoPlayerRef:S,onClose:N,onPrevious:E,onNext:T,onSave:B,onArchive:O,onLike:L,onLoad:U,isArchived:M,publicationSettings:F,referringRecommendation:W,referringPub:J}=e,[Y,et]=(0,d.eJ)(!1),[el,eh]=(0,d.eJ)(!1),eg=(0,ew.Th)(),e_=(0,ef.x)({surface:"post-viewer"}),ey=(0,G.aF)(),eE=(0,eb.XA)(),eT=(0,ec.pm)(),{iString:eR,iTemplate:eO}=(0,H.M1)(),ej=(0,d.sO)(null);(0,d.d4)(()=>{(0,q.j)(q.FP.POST_VIEWER_VIEWED,{post_id:C})},[C]);let eX=(0,ep.y)(),eU=(0,d.I4)(()=>{(0,q.j)(q.FP.POST_VIEWER_CLOSED,{post_id:C}),N()},[N,C]),eM=O&&(e=>{(0,q.j)(q.FP.POST_ARCHIVED,{post_id:e,surface:"post viewer"}),O(e)});x&&k&&F&&(P={post:x,publication:k,publicationSettings:F,referringRecommendation:W,referringPub:J});let ez=new URLSearchParams(document.location.search),{result:eF,isLoading:e$}=(0,Q.ib)({pathname:"/api/v1/posts/by-id/".concat(C),query:{preview:null!==(Z=ez.get("postPreview"))&&void 0!==Z?Z:void 0},deps:[C],auto:!P,initialResult:P});(0,d.d4)(()=>{eF&&eg.updatePublication(eF.publication.id,eF)},[eF]);let eV=(0,ee.S2)(null,{ignoreSafari:!0});(0,d.d4)(()=>{U&&eF&&U(eF)},[eF]),(0,d.d4)(()=>{eF&&eV.postSelection&&eV.highlightSelection()},[eF,eV.postSelection]);let eH=null!==(f=null==eF?void 0:eF.publication)&&void 0!==f?f:k,eW=null!==(g=null==eF?void 0:eF.publicationSettings)&&void 0!==g?g:{},eJ=(null==eH?void 0:eH.payments_state)==="enabled",{subscription:eG,publicationUser:eY,isFreeSubscribed:eq,isPaid:eK,isAuthor:eQ,isPledged:e0}=(0,ew.Y0)(null!==(_=null==eF?void 0:null===(t=eF.post)||void 0===t?void 0:t.publication_id)&&void 0!==_?_:0),e1=!(eJ?eK:eK||eq),[e4,e9]=(0,d.eJ)(!1),e8=(0,d.sO)(0),{setIsReading:e6}=(0,ev.SJ)(),e2=async e=>{let{reportCategory:t,details:i}=e;await (0,K.rd)("/api/v1/publications/".concat(null==eH?void 0:eH.id,"/posts/").concat(C,"/report"),{method:"POST",json:{details:i,reportCategory:t}}),et(!1),eT.popToast(e=>(0,o.tZ)(ec.FN,(0,r._)((0,n._)({},e),{text:eR("We received your report"),Icon:p.Z})))},e5=eF&&(w=eF.post,y=x,(0,n._)({},w,Object.fromEntries(Object.entries(null!=y?y:{}).filter(e=>{let[t,i]=e;return null!=i})))),e3=(0,R.N1)(null!==(b=null==eF?void 0:null===(i=eF.post)||void 0===i?void 0:i.body_html)&&void 0!==b?b:""),e7=eF&&(null===(a=eF.publication)||void 0===a?void 0:a.id)?null===(l=eg.result)||void 0===l?void 0:l.publicationUserMap.get(eF.publication.id):void 0,te=eF&&e7&&["admin","contributor"].includes(e7.role)?()=>{(0,q.j)(q.FP.READER_EDIT_POST_BUTTON_CLICKED,{publication_id:eF.publication.id,post_id:eF.post.id}),location.href=(0,eP.ANx)(eF.publication,eF.post.id,{addBase:!0})}:void 0,{activePost:tt,isPlaying:ti,onToggle:tn,onPlay:tr}=(0,eZ.G)(),ta=!!(ti&&tt&&tt.id===(null==eF?void 0:eF.post.id)),tl=(null==eF?void 0:eF.post)&&(0,X.sY)(eF.post);return(0,o.BX)(er.hs,{id:"post-viewer",className:ek.Z.viewerContainer,padding:12*!eE,minWidth:0,children:[(0,o.tZ)(z.u,{isOpen:Y,onSubmit:e2,onClose:()=>et(!1)}),(0,o.BX)(er.tu,(0,r._)((0,n._)({className:u()(ek.Z.viewer,e4&&ek.Z.isReading),bg:"primary",flex:"grow",position:"relative",minWidth:0},eE?null:{border:"detail",radius:"md"}),{children:[(0,o.BX)(er.tu,{className:ek.Z.viewerOffset,flex:"grow",children:[(0,o.BX)(er.hs,{className:ek.Z.nav,justifyContent:"space-between",paddingY:16,alignItems:"center",children:[(0,o.tZ)(er.hs,{className:ek.Z.logoContainer,justifyContent:"center",zIndex:-1,children:e$?(0,o.tZ)(em.Vm,{size:40}):eH&&(0,o.tZ)(er.hs,{as:"a",href:(0,eP.SVA)(eH),children:(0,o.tZ)(es.wk,{pub:eH,size:40,shadow:"sm",radius:"sm"})})}),(0,o.tZ)(er.hs,{gap:8,children:(0,o.tZ)(eL,{onClick:eU})}),(0,o.BX)(er.hs,{gap:8,children:[!eE&&!eQ&&eH&&(0,o.tZ)(en.zx,{priority:e1?"primary":"secondary",rounded:!0,newTab:!0,href:(0,eP.W1P)(eH,{user:ey,addBase:!0,params:{utm_source:ex.b3.substack,utm_medium:ex.lP.web,utm_campaign:ex.VX.postViewer}}),onClick:e=>{if(!ey&&eH){e_(eH)(e);return}setTimeout(()=>{eg.refetchPublication(eH.id)},5e3)},children:(0,o.tZ)(er.gq,{alignItems:"center",gap:8,children:e1?(0,eC.getSubscribeText)(eH,{isFreeSubscribed:eq}):"Subscribed"})}),(null==eF?void 0:eF.post)&&(0,X.a7)(eF.post)&&(0,o.tZ)(eu.u,{leading:tl?(0,o.tZ)(A.Z,{size:12}):void 0,text:tl?"Paid subscribers only":"Play audio",preferPlacement:"bottom-center",hoverOptions:{delayEnter:0,delayLeave:0},children:(0,o.tZ)(en.hU,{onClick:()=>{!tl&&(ta?tn():tr({post:eF.post,publication:eF.publication}))},disabled:tl,children:tl?(0,o.tZ)(j.Z,{size:20,fill:"var(--color-fg-secondary)"}):ta?(0,o.tZ)(I.Z,{size:20}):(0,o.tZ)(D.Z,{size:20})})}),e$?(0,o.tZ)(em.Vm,{radius:"sm",size:40}):eF&&(0,o.tZ)(eA,{post:eF.post,publication:eH,onArchive:eM,onSavePost:B,onCopyLink:()=>{eX((0,$.O1)(null,{post:x,pub:eH,user:ey,useCustomDomainOverOpen:!0}))},onReport:()=>et(!0),onEditPost:te,isArchived:M})]})]}),(0,o.BX)(er.tu,{className:ek.Z.content,flex:"grow",children:[(T||E)&&(0,o.BX)(er.tu,{gap:8,className:ek.Z.navArrows,children:[(0,o.tZ)(eu.u,{text:"Previous post",trailing:(0,o.tZ)(ea.T,{children:"K"}),preferPlacement:"right-center",children:(0,o.tZ)(en.hU,{onClick:null!=E?E:void 0,disabled:!E,tabIndex:2,className:ek.Z.navArrow,children:(0,o.tZ)(h.Z,{size:20})})}),(0,o.tZ)(eu.u,{text:"Next post",trailing:(0,o.tZ)(ea.T,{children:"J"}),preferPlacement:"right-center",children:(0,o.tZ)(en.hU,{onClick:null!=T?T:void 0,disabled:!T,tabIndex:1,className:ek.Z.navArrow,children:(0,o.tZ)(v.Z,{size:20})})})]}),(0,o.tZ)(er.tu,{className:ek.Z.post,flex:"grow",onScroll:e=>{let t=e.currentTarget,i=t.scrollTop;i>t.scrollHeight-t.offsetHeight-100?(e9(!1),null==e6||e6(!1)):i>e8.current?(e9(!0),null==e6||e6(!0)):(e9(!1),null==e6||e6(!1)),e8.current=i},ref:ej,children:e$?(0,o.tZ)(er.tu,{flex:"grow",alignItems:"center",justifyContent:"center",children:(0,o.tZ)(eo.$j,{})}):eF&&eF.post.id===C&&(0,o.BX)(o.HY,{children:[!el&&!!eF.referringPub&&(0,o.BX)(er.hs,{position:"relative",className:u()(!eE&&"container",ek.Z.referringPubContainer),radius:"md",shadow:"sm",border:"detail",gap:16,padding:16,children:[(0,o.tZ)(er.hs,{className:ek.Z.close,position:"absolute",cursor:"pointer",onClick:async()=>{await (0,K.rd)("/api/v1/publication_user_settings/user",{method:"PUT",json:{publication_id:eF.publication.id,type:"hide_referring_recommendation",value:!0}}),eh(!0)},children:(0,o.tZ)(m.Z,{size:16,strokeWidth:1})}),!eE&&(0,o.tZ)(ei.qE,{user:{id:eF.referringPub.author_id,name:eF.referringPub.author_name},photoUrl:eF.referringPub.author_photo_url,size:56}),(0,o.tZ)(er.tu,{alignItems:"start",gap:16,className:ek.Z.referringPubTextContainer,children:(0,o.BX)(er.tu,{gap:4,paddingRight:24,children:[(0,o.BX)(ed.xv.B3,{fontWeight:"semibold",children:[eF.publication.author_name?eO(eS(),eF.publication.name,eF.publication.author_name,eF.referringPub.author_name||eF.referringPub.name):eO(eN(),eF.publication.name,eF.referringPub.author_name||eF.referringPub.name)," ",(0,o.BX)(ed.xv.B3,{as:"span",translated:!0,children:["Manage your subscription"," ",(0,o.tZ)(ed.xv.B3,{as:"a",href:(0,eP.zRj)(eF.publication),decoration:"underline",children:"here"}),"."]})]}),(null===(s=eF.referringRecommendation)||void 0===s?void 0:s.description)&&(0,o.BX)(ed.xv.B4,{color:"secondary",children:["“",null===(c=eF.referringRecommendation)||void 0===c?void 0:c.description,"”"," ","–"," ",eF.referringPub.author_name||eF.referringPub.name]})]})})]}),(0,o.tZ)(eB,{post:e5,publication:eF.publication,publicationUser:eY,subscription:eG,publicationSettings:eW,isPledged:e0,postContainerRef:ej,videoPlayerRef:S})]})})]}),(0,o.tZ)(er.hs,{className:ek.Z.bottomNav,justifyContent:"center",borderTop:"detail",children:(0,o.tZ)(er.hs,{className:ek.Z.ufi,justifyContent:"space-between",alignItems:"center",gap:32,children:e$?(0,o.tZ)(eD,{}):eF&&e5&&(0,o.tZ)(eI,{publication:eF.publication,post:e5,user:ey,onLike:L})})})]}),e3&&(0,o.tZ)(V.o,{toc:e3,position:"absolute"})]}))]})}let eR=e=>{let t=(0,d.sO)(null);return(0,o.tZ)(T.BY,{postId:e.postId,videoPlayerRef:t,children:(0,o.tZ)(eT,(0,r._)((0,n._)({},e),{videoPlayerRef:t}))})};function eB(e){let{post:t,publication:a,publicationUser:l,subscription:s,publicationSettings:d,isPledged:c,postContainerRef:u,videoPlayerRef:p}=e,h=(0,J.xR)(),v=(0,G.aF)(),m=v?(0,r._)((0,n._)({},v),{is_contributor:(null==l?void 0:l.role)==="contributor",is_admin:(null==l?void 0:l.role)==="admin",is_public_admin:!!(null==l?void 0:l.public),is_subscribed:(null==s?void 0:s.membership_state)==="subscribed",is_free_subscribed:(null==s?void 0:s.membership_state)==="free_signup",is_pledged:c}):null;return(0,o.BX)(G.dr,{defaultValue:m,children:[(0,o.tZ)(et.PostMetaTags,{post:t,publication:a,siteConfigs:h.allConfigs}),(0,o.tZ)(eh.cr,{module:"@/frontend/reader2/PostRenderer",onRequest:()=>i.e("2926").then(i.bind(i,81033)),resolve:e=>e.ReaderPost,post:t,pub:a,user:m,publicationSettings:d,postContainerRef:u,videoPlayerRef:p})]})}let eO=(0,s.forwardRef)((e,t)=>{var{count:i,children:l,tooltipText:s,tooltipTrailing:d,disabled:c}=e,u=(0,a._)(e,["count","children","tooltipText","tooltipTrailing","disabled"]);return(0,o.tZ)(er.hs,{justifyContent:"center",alignItems:"center",ref:t,children:(0,o.tZ)(eu.u,{preferPlacement:"top-center",text:null!=s?s:"",trailing:d,disabled:c,children:(0,o.BX)(en.hU,(0,r._)((0,n._)({priority:"tertiary",disabled:c},u),{children:[l,null!=i&&i>0&&(0,o.tZ)(ed.xv.B4,{weight:"bold",color:c?"tertiary":"primary",children:null!=i?(0,Y.T)(i):"0"})]}))})})});function eI(e){var t;let{publication:i,post:n,user:r,onLike:a}=e,l=(0,d.sO)(),s=!!n.reaction,c=null!==(t=n.reactions["❤"])&&void 0!==t?t:0,p=!r||!i.community_enabled,h=(0,eC.showCommentsOnPost)({publication:i,post:n});return(0,e_.B)({name:"share",action:()=>{var e;null===(e=l.current)||void 0===e||e.open()}}),(0,o.BX)(o.HY,{children:[(0,o.tZ)(eO,{className:u()(ek.Z.ufiButton,ek.Z.likeButton,s&&ek.Z.isLiked),onClick:a?()=>a(n.id,!s):void 0,count:c,disabled:p,tooltipText:"Like",tooltipTrailing:(0,o.tZ)(ea.T,{children:"L"}),children:(0,o.tZ)(Z.Z,{size:20})}),(0,o.tZ)(eO,{href:"profile"===i.homepage_type?(0,eP.mx9)(i,n):(0,ey.uRy)(i,n,{comments:!0,urlParams:{utm_source:ex.b3.substack,utm_medium:ex.lP.web,utm_campaign:ex.VX.postViewer}}),count:n.comment_count,newTab:"profile"!==i.homepage_type,disabled:p||!h,className:u()(ek.Z.ufiButton,ek.Z.commentButton),tooltipText:"Comment",children:(0,o.tZ)(f.Z,{size:20})}),(0,o.tZ)(ej,{pub:i,post:n}),(0,o.tZ)(M.sp,{post:n,user:r||void 0,pub:i,showClipping:!!n.videoUpload,trigger:(0,o.tZ)(eO,{className:u()(ek.Z.ufiButton,ek.Z.shareButton),tooltipText:"Share",children:(0,o.tZ)(g.Z,{height:20,strokeWidth:2})})}),(0,o.tZ)(L.h,{children:(0,o.tZ)(F.ZP,{ref:l,medium:"post viewer",user:r,post:n,pub:i,onClick:e=>e.preventDefault()})})]})}function eD(){return(0,o.BX)(o.HY,{children:[(0,o.tZ)(eO,{disabled:!0,children:(0,o.tZ)(Z.Z,{size:20})}),(0,o.tZ)(eO,{disabled:!0,children:(0,o.tZ)(f.Z,{size:20})}),(0,o.tZ)(eO,{disabled:!0,children:(0,o.tZ)(_.Z,{size:20})}),(0,o.tZ)(eO,{disabled:!0,children:(0,o.tZ)(g.Z,{height:20,strokeWidth:2})})]})}function ej(e){let{pub:t,post:i}=e,a=!(0,G.aF)()||!t.community_enabled,[l,s]=(0,d.eJ)(!!i.restacked),[c,p]=(0,d.eJ)(Number(i.restacks)),{canRestack:h,menuItems:v,nuxModal:m}=(0,eg.K)({pub:t,post:(0,r._)((0,n._)({},i),{restacked:l,restacks:c}),onRestack:e=>{l!==e&&p(c+(e?1:-1)),s(e)}});return h?(0,o.BX)(o.HY,{children:[m,(0,o.tZ)(el.v2,{trigger:(0,o.tZ)(eO,{className:u()(ek.Z.restackButton,ek.Z.ufiButton,l&&ek.Z.isRestacked),count:c,disabled:a,tooltipText:"Restack","aria-label":"menu",children:(0,o.tZ)(O.Z,{className:ek.Z.actionIcon})}),children:v})]}):null}function eA(e){let{post:t,publication:i,onArchive:n,onSavePost:r,onCopyLink:a,onReport:l,onEditPost:s,isArchived:d}=e,{isSaved:c,onSave:u}=(0,U.vk)({post:t}),{iString:p}=(0,H.M1)(),{openModal:h,closeModal:v}=(0,W.dd)(),{activePost:m,isPlaying:Z,onToggle:f,onPlay:g}=(0,eZ.G)(),T=!!(Z&&m&&m.id===t.id);return(0,o.BX)(el.v2,{trigger:(0,o.tZ)(en.hU,{"aria-label":"View more",priority:"secondary",children:(0,o.tZ)(b.Z,{size:20})}),children:[(0,o.tZ)(el.sN,{onClick:a,leading:(0,o.tZ)(w.Z,{}),children:p("Copy link")}),(0,o.tZ)(el.sN,{leading:(0,o.tZ)(y.Z,{}),onClick:()=>{h({children:(0,o.tZ)(B.I,{post:t,pub:i,onClose:v}),width:540})},children:p("Embed")}),(0,o.BX)(el.xw,{children:[(0,X.a7)(t)&&!(0,X.sY)(t)&&(0,o.tZ)(el.sN,{onClick:()=>{T?f():g({post:t,publication:i})},leading:T?(0,o.tZ)(P.Z,{}):(0,o.tZ)(C.Z,{}),trailing:(0,o.tZ)(ea.T,{children:"P"}),children:p(T?"Pause audio":"Play audio")}),r&&(0,o.tZ)(el.sN,{onClick:()=>r({post:t,isSaved:u()}),target:"_blank",leading:c?(0,o.tZ)(x.Z,{}):(0,o.tZ)(_.Z,{}),trailing:(0,o.tZ)(ea.T,{children:"S"}),children:p(c?"Unsave":"Save")}),n&&(d?(0,o.tZ)(el.sN,{onClick:()=>n(t.id),leading:(0,o.tZ)(k.Z,{}),trailing:(0,o.tZ)(ea.T,{children:"E"}),children:p("Unarchive")}):(0,o.tZ)(el.sN,{onClick:()=>n(t.id),leading:(0,o.tZ)(S.Z,{}),trailing:(0,o.tZ)(ea.T,{children:"E"}),children:p("Archive")})),s&&(0,o.tZ)(el.xw,{children:(0,o.tZ)(el.sN,{onClick:s,leading:(0,o.tZ)(N.Z,{}),children:p("Edit post")})})]}),(0,o.tZ)(el.xw,{children:l&&(0,o.tZ)(el.sN,{priority:"destructive",onClick:l,leading:(0,o.tZ)(E.Z,{}),children:p("Report")})})]})}function eL(e){let{onClick:t}=e;return(0,o.tZ)(eu.u,{text:"Close",trailing:(0,o.tZ)(ea.T,{children:"ESC"}),preferPlacement:"right-center",children:(0,o.tZ)(en.hU,{onClick:t,priority:"secondary","aria-label":"Close",children:(0,o.tZ)(m.Z,{size:20,"aria-hidden":!0})})})}},31541:function(e,t,i){i.d(t,{Eb:()=>u,in:()=>p,r8:()=>d});var n=i(16584),r=i(30396),a=i(94184),l=i.n(a),o=i(11163),s=i(83234);function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,n.tZ)(c,{}),[i,a]=(0,r.eJ)(e);return[i&&t,()=>{a(!1)}]}function c(){return(0,n.tZ)(u,{})}function u(e){let{className:t}=e;return(0,n.tZ)(p,{className:l()(t,"reader2-unread-dot")})}let p=(0,o.L)(s.Z.unreadDot)},15850:function(e,t,i){i(16584);var n=i(98661);i(30396);var r=i(23493),a=i.n(r);(0,n.createContext)({listeningProgress:{},onUpdateListeningProgress:()=>void 0});let l=e=>{let{user:t}=e;return"podcasts:listening_progress:".concat(t.id)};a()(e=>{let{allProgress:t,user:i}=e,n=l({user:i});localStorage.setItem(n,JSON.stringify(t))},1e3)},44312:function(e,t,i){i.d(t,{G:()=>l}),i(16584);var n=i(98661),r=i(30396);i(59854),i(15850);let a=(0,n.createContext)({activePodcast:null,activePost:null,activePublication:null,lastActivePost:null,lastActivePodcast:null,lastActivePublication:null,audioPlayerRef:{current:null},currentTime:0,duration:null,isPlaying:!1,listeningProgress:{},onClear:()=>void 0,onPlay:()=>void 0,onToggle:()=>void 0}),l=()=>(0,r.qp)(a)},70293:function(e,t,i){i.d(t,{M:()=>r});var n=i(30396);function r(e,t,i){let{shouldCheck:r,threshold:a=200,bodyRef:l}=i,o=(0,n.sO)(),s=null!=l?l:o,d=()=>{let t=s.current;if(t){let{bottom:i}=t.getBoundingClientRect();i{if(r)return window.addEventListener("scroll",d,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",d,{capture:!0})}},t),{bodyRef:s,check:d}}},98905:function(e,t,i){i.d(t,{K:()=>p});var n=i(7409),r=i(99282),a=i(98848),l=i(16584),o=i(98661),s=i(94184),d=i.n(s),c=i(19081),u=i(37381);let p=(0,o.forwardRef)((e,t)=>{var{className:i,error:o=!1,type:s="text",width:p,background:h,font:v,leftIcon:m,rightIcon:Z}=e,f=(0,a._)(e,["className","error","type","width","background","font","leftIcon","rightIcon"]);let g=(0,l.tZ)("input",(0,r._)((0,n._)({},f),{className:d()(i,u.Z.inputWithIcons,{[u.Z.error]:o},v&&u.Z["font-".concat(v)]),style:{width:p,background:h},type:s,ref:t}));return(0,l.BX)(c.gq,{paddingX:12,className:d()(i,u.Z.inputWrapper,{[u.Z.error]:o}),style:{width:p,background:h},children:[m&&(0,l.tZ)("span",{children:m}),g,Z&&(0,l.tZ)("span",{children:Z})]})})}}]);