"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["3330"],{31190:function(e,t,i){i.d(t,{Z:()=>n});let n={closeWelcomeModal:"closeWelcomeModal-KVUfKQ",maybeLater:"maybeLater-PlK9NK",publicationCoverPhotoLeft:"publicationCoverPhotoLeft-txdH2G",publicationCoverPhotoRight:"publicationCoverPhotoRight-RHPl8T",largePublicationCoverPhotoRight:"largePublicationCoverPhotoRight-A77S35",column:"column-_rp_8U",largeColumn:"largeColumn-bqn6Me",centeredColumn:"centeredColumn-M8Fujf",largeCenteredColumn:"largeCenteredColumn-AfeswM",hideColumnSmallScreens:"hideColumnSmallScreens-rlLOgZ",hideLargeColumnSmallScreens:"hideLargeColumnSmallScreens-LQBTX8",publicationCoverPhotoCenter:"publicationCoverPhotoCenter-rMU5R1",publicationLogo:"publicationLogo-EWjoMq",coverPrimary:"coverPrimary-cGRhhL",coverSecondary:"coverSecondary-pfbfwO",blurbImage:"blurbImage-bS0Pkx",containerClassName:"containerClassName-iHFmrN",promptClassName:"promptClassName-fM9VHe",inputClassName:"inputClassName-v5NZvy",subscribeButtonClassName:"subscribeButtonClassName-wpxkEl",largeHeading:"largeHeading-ZEJJF0",largeSubHeading:"largeSubHeading-lGmUwg",largePromptClassName:"largePromptClassName-Uexj1F",largeInputWrapperClassName:"largeInputWrapperClassName-VqAUAb",largeInputClassName:"largeInputClassName-zCK22A",largeSubscribeButtonClassName:"largeSubscribeButtonClassName-gTO6Dt",postContainer:"postContainer-iqizM2",postTitle:"postTitle-uVmG1_",postSubtitle:"postSubtitle-sIac6Y",postImage:"postImage-nsvz_r",faces:"faces-igzFCe",face:"face-G_PpVO",first:"first-bCHdQ8",last:"last-GRcjMY",bigSubtitle:"bigSubtitle-o28Z4u",balancedText:"balancedText-oQ__Kv",tosLink:"tosLink-n6HoHl",blurbText:"blurbText-isJ4mY",tosText:"tosText-yAQHNw"}},78691:function(e,t,i){i.d(t,{Z:()=>n});let n=/^(3154|6909)$/.test(i.j)?{viewer:"viewer-ecNuD7",nav:"nav-XSY6_G",navArrows:"navArrows-yQyPsn",bottomNav:"bottomNav-cjoblk",isReading:"isReading-OrZu1k",viewerContainer:"viewerContainer-hf71i1",viewerOffset:"viewerOffset-T8duEs",actionIcon:"actionIcon-uFP5Oe",content:"content-cFaSRD",navArrow:"navArrow-xdopTu",post:"post-XKrpvd",ufi:"ufi-l5oCA2",logoContainer:"logoContainer-m31AvM",ufiButton:"ufiButton-nSWhO0",likeButton:"likeButton-cDwe1L",isLiked:"isLiked-xJDjjp",commentButton:"commentButton-sQzbUO",restackButton:"restackButton-sMOIvG",isRestacked:"isRestacked-EvdZvU",shareButton:"shareButton-oCXda_",shortcutTooltip:"shortcutTooltip-pU9wZf",close:"close-zwyGNy",referringPubContainer:"referringPubContainer-BWGotX",referringPubTextContainer:"referringPubTextContainer-tL5sbE"}:null},91925:function(e,t,i){i.d(t,{s:()=>r});var n=i(16584),o=i(4615);function r(e){let{children:t}=e;return(0,n.tZ)(o.f6,{theme:"coverTheme-PJLqY5",children:t})}},22259:function(e,t,i){if(i.d(t,{Z:()=>a}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var o=i(99282);var r=i(16584),l=i(64515);let a=/^(3154|6909)$/.test(i.j)?e=>(0,r.tZ)(l.l,(0,o._)((0,n._)({},e),{name:"LucideTabActivityFilled",svgParams:{height:e.height||32,width:e.width||32,stroke:"none",strokeWidth:0,fill:e.fill||"var(--color-fg-primary)"},children:(0,r.tZ)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.6354 5.39295C15.3726 4.86902 17.2257 4.86902 18.9629 5.39295L18.965 5.39358C19.9065 5.6798 21.9952 6.71781 23.1135 8.75755C23.8119 10.0313 24.0354 11.5182 24.1434 12.743C24.1795 13.1521 24.2046 13.5635 24.227 13.9305C24.2379 14.109 24.2481 14.2769 24.2587 14.429C24.2939 14.9361 24.3328 15.2684 24.3886 15.4718C24.5224 15.9599 24.7588 16.4033 25.0855 16.9664C25.1203 17.0264 25.1562 17.0878 25.1929 17.1506C25.4885 17.6566 25.8379 18.2549 26.1303 18.9658C26.2816 19.3338 26.4002 19.666 26.4927 19.9715C26.7681 20.8818 26.4813 21.7367 25.9336 22.3253C25.4017 22.8969 24.6191 23.2341 23.7991 23.2341H8.79915C7.97918 23.2341 7.19663 22.8969 6.66473 22.3253C6.11704 21.7367 5.83022 20.8818 6.10562 19.9715C6.19807 19.666 6.31673 19.3338 6.46804 18.9658C6.76035 18.2549 7.10985 17.6566 7.40542 17.1506C7.44211 17.0878 7.47796 17.0264 7.51277 16.9664C7.8395 16.4033 8.07592 15.9599 8.20973 15.4718C8.26548 15.2684 8.30441 14.9361 8.33962 14.429C8.35018 14.2769 8.36043 14.109 8.37132 13.9305C8.39372 13.5635 8.41883 13.1521 8.45491 12.743C8.56293 11.5182 8.78643 10.0313 9.48479 8.75755C10.6031 6.71781 12.6918 5.6798 13.6333 5.39359L13.6354 5.39295ZM13.4047 24.5528C13.6517 24.0588 14.2524 23.8586 14.7463 24.1056C15.7238 24.5943 16.8744 24.5943 17.8519 24.1056C18.3459 23.8586 18.9466 24.0588 19.1936 24.5528C19.4406 25.0468 19.2403 25.6474 18.7464 25.8944C17.2058 26.6647 15.3925 26.6647 13.8519 25.8944C13.3579 25.6474 13.1577 25.0468 13.4047 24.5528Z"})})):null},46411:function(e,t,i){if(i.d(t,{Z:()=>a}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var o=i(99282);var r=i(16584),l=i(64515);let a=/^(3154|6909)$/.test(i.j)?e=>(0,r.tZ)(l.l,(0,o._)((0,n._)({},e),{name:"LucideTabChatFilled",svgParams:{height:e.height||32,width:e.width||32,stroke:"none",strokeWidth:0,fill:e.fill||"var(--color-fg-primary)"},children:(0,r.tZ)("path",{d:"M8.40825 6.34908C12.0215 5.10592 18.2609 4.07567 24.5673 6.33189C26.1123 6.88465 26.9999 8.37804 26.9999 9.91221V18.6258C26.9999 20.1327 26.1383 21.619 24.5904 22.1515C22.257 22.9541 18.8542 23.6605 15.0513 23.4681C13.6701 25.5308 10.9829 26.5001 8.49994 26.5001C8.09548 26.5001 7.73084 26.2564 7.57606 25.8828C7.42128 25.5091 7.50683 25.079 7.79283 24.793C8.10239 24.4834 8.3763 23.9026 8.52252 23.2262C8.59245 22.9028 8.62494 22.5937 8.62494 22.336C8.62494 22.302 8.62437 22.2699 8.62335 22.2398L8.55226 22.213L8.46911 22.1818L8.44202 22.1717L8.43379 22.1687L8.43112 22.1677C6.8857 21.6147 5.99994 20.1215 5.99994 18.5879V9.87431C5.99994 8.36797 6.85998 6.88177 8.40825 6.34908Z"})})):null},85626:function(e,t,i){i.d(t,{Z:()=>o});var n=i(16584);let o=/^(3154|6909)$/.test(i.j)?e=>{let{size:t=24,stroke:i="currentColor",strokeWidth:o=2}=e;return(0,n.BX)("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.tZ)("path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3"}),(0,n.tZ)("path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7",fill:i,stroke:"none"}),(0,n.tZ)("path",{d:"M21 12v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",fill:i,stroke:"none"})]})}:null},60982:function(e,t,i){if(i.d(t,{Z:()=>a}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var o=i(99282);var r=i(16584),l=i(64515);let a=/^(3154|6909)$/.test(i.j)?e=>(0,r.tZ)(l.l,(0,o._)((0,n._)({},e),{name:"LucideTabHomeFilled",svgParams:{height:e.height||32,width:e.width||32,stroke:"none",strokeWidth:0,fill:e.fill||"var(--color-fg-primary)"},children:(0,r.tZ)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.315 5.49313C16.5616 4.83562 15.4384 4.83562 14.685 5.49313L6.02743 13.0485C5.37462 13.6183 5 14.4424 5 15.3089L5 23.6727C5 25.8819 6.79086 27.6727 9 27.6727L23 27.6727C25.2091 27.6727 27 25.8819 27 23.6727V15.3089C27 14.4424 26.6254 13.6183 25.9726 13.0485L17.315 5.49313ZM14.4472 21.7783C13.9532 21.5313 13.3525 21.7315 13.1055 22.2255C12.8586 22.7195 13.0588 23.3201 13.5528 23.5671C15.0933 24.3374 16.9067 24.3374 18.4472 23.5671C18.9412 23.3201 19.1414 22.7195 18.8944 22.2255C18.6474 21.7315 18.0468 21.5313 17.5528 21.7783C16.5753 22.267 15.4247 22.267 14.4472 21.7783Z",strokeLinecap:"round",strokeLinejoin:"round"})})):null},890:function(e,t,i){if(i.d(t,{Z:()=>a}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var o=i(99282);var r=i(16584),l=i(64515);let a=/^(3154|6909)$/.test(i.j)?e=>(0,r.tZ)(l.l,(0,o._)((0,n._)({},e),{name:"LucideTabInboxFilled",svgParams:{height:e.height||34,width:e.width||34,stroke:"none",strokeWidth:0,fill:e.fill||"var(--color-fg-primary)"},children:(0,r.tZ)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6,8C6,6.343 7.343,5 9,5H13C14.657,5 16,6.343 16,8V12C16,13.657 14.657,15 13,15H9C7.343,15 6,13.657 6,12V8ZM18,8C18,6.343 19.343,5 21,5H25C26.657,5 28,6.343 28,8V12C28,13.657 26.657,15 25,15H21C19.343,15 18,13.657 18,12V8ZM6,20C6,18.343 7.343,17 9,17H13C14.657,17 16,18.343 16,20V24C16,25.657 14.657,27 13,27H9C7.343,27 6,25.657 6,24V20ZM18,20C18,18.343 19.343,17 21,17H25C26.657,17 28,18.343 28,20V24C28,25.657 26.657,27 25,27H21C19.343,27 18,25.657 18,24V20Z"})})):null},26582: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 o=i(99282);if(/^(3154|6909)$/.test(i.j))var r=i(98848);var l=i(16584),a=i(64515);let s=/^(3154|6909)$/.test(i.j)?e=>{var{size:t=20,fill:i="var(--color-fg-primary)"}=e,s=(0,r._)(e,["size","fill"]);return(0,l.tZ)(a.l,(0,o._)((0,n._)({},s),{name:"PlayIconLockFilled",svgParams:{viewBox:"0 0 20 20"},width:t,height:t,fill:i,children:(0,l.tZ)("path",{stroke:"none",fillRule:"evenodd",clipRule:"evenodd",d:"M4.04688 18.5527C4.4375 18.5527 4.76953 18.3965 5.16016 18.1719L6.2041 17.5685V14.633V13.4815C6.2041 12.4757 6.61309 11.9682 7.46663 11.9001C7.46663 10 9.07077 8.01343 11.4472 8.01343C13.8237 8.01343 15.4278 10 15.4278 11.901C15.5875 11.9144 15.7314 11.9429 15.86 11.9869L16.5469 11.5898C17.3574 11.1113 17.6406 10.7988 17.6406 10.2812C17.6406 9.76367 17.3574 9.45117 16.5469 8.98242L5.16016 2.39062C4.76953 2.16602 4.4375 2.01953 4.04688 2.01953C3.32422 2.01953 2.875 2.56641 2.875 3.41602V17.1465C2.875 17.9961 3.32422 18.5527 4.04688 18.5527ZM10.1094 12.9648H12.7852V11.8418C12.7852 10.8262 12.2871 10.2793 11.4473 10.2793C10.6074 10.2793 10.1094 10.8262 10.1094 11.8418V12.9648ZM14.0645 12.9707V11.9492C14.0645 10.1816 13.0098 9 11.4473 9C9.8848 9 8.8301 10.1816 8.8301 11.9492V12.97C8.2689 13.0149 8 13.3485 8 14.0098V17.8086C8 18.5215 8.3125 18.8535 8.9668 18.8535H13.918C14.582 18.8535 14.8945 18.5215 14.8945 17.8086V14.0098C14.8945 13.3515 14.6281 13.0179 14.0645 12.9707Z"})}))}:null},64343:function(e,t,i){i.d(t,{Z:()=>a});var n=i(7409),o=i(99282),r=i(16584),l=i(64515);let a=e=>(0,r.tZ)(l.l,(0,o._)((0,n._)({},e),{name:"RightArrowIcon",svgParams:{height:20,width:20},children:(0,r.tZ)("path",{d:"M7.5 15L12.5 10L7.5 5",strokeWidth:"1.5",strokeLinecap:"round","stroke-linejoin":"round"})}))},21312:function(e,t,i){i.d(t,{Z:()=>r});var n=i(16584),o=i(30396);function r(e){let{text:t,maxLines:i,ellipsesText:r="..."}=e,l=(0,o.sO)(null),[a,s]=(0,o.eJ)(t);return(0,o.d4)(()=>{(()=>{if(!l.current)return;l.current.innerText="-";let e=(l.current.clientHeight+1)*i+1,n=0,o=0,a=t.length;for(;n<=a;){if(o=Math.floor((n+a)/2),l.current.innerText=t.slice(0,o),o===t.length&&l.current.clientHeight<=e){l.current.innerText="",s(t);return}l.current.clientHeight<=e?n=o+1:a=o-1}let d=t.slice(0,o-r.length-2);l.current.innerText="",s(d+r)})()},[l,t,i,r]),(0,n.BX)("div",{style:{position:"relative"},children:[(0,n.tZ)("div",{children:a}),(0,n.tZ)("div",{ref:l,style:{visibility:"hidden",position:"absolute",width:"100%"}})]})}},56219:function(e,t,i){i.d(t,{Ao:()=>e4,Rs:()=>e8,SO:()=>eK,_q:()=>e0,a7:()=>e6,eu:()=>eY,lO:()=>eW,mV:()=>e1,nM:()=>eQ,sY:()=>e3,xw:()=>eq});var n=i(27412),o=i(7409),r=i(99282),l=i(58865),a=i(16584),s=i(6400),d=i(30396),c=i(94184),u=i.n(c),p=i(39693),h=i.n(p),m=i(85564),g=i.n(m),v=i(7739),f=i.n(v),b=i(93220),_=i.n(b),y=i(59543),Z=i(80569),C=i.n(Z),w=i(60826),S=i(7464),P=i(84844),T=i(16564),x=i(9573),k=i(89074),I=i(59708),N=i(92828),E=i(75021),R=i(18787),D=i(90311),B=i(17350),L=i(16944),j=i(94442),M=i(3862),F=i(21316),A=i(85685),U=i(11712),H=i(94594),X=i(47851),O=i(33665),V=i(90156),z=i(72392),$=i(16506),W=i(85721),Y=i(89276),q=i(25956),J=i(79160),K=i(70522),G=i(58319),Q=i(57391),ee=i(37168),et=i(95441),ei=i(30372),en=i(56629),eo=i(68833),er=i(48980),el=i(49762),ea=i(27036),es=i(98914),ed=i(29927),ec=i(15771),eu=i(61254),ep=i(19081),eh=i(1844),em=i(58175),eg=i(70379),ev=i(87989),ef=i(23776),eb=i(57641),e_=i(98012),ey=i(24791),eZ=i(6070),eC=i(67914),ew=i(60308),eS=i(26111),eP=i(63651),eT=i(81821),ex=i(84864),ek=i(47929),eI=i(59961);function eN(){let e=(0,l._)(["The full video is for subscribers in the "," plan"]);return eN=function(){return e},e}function eE(){let e=(0,l._)(["The full video is for subscribers in the Founding Member plan"]);return eE=function(){return e},e}function eR(){let e=(0,l._)(["The full video is for paid subscribers"]);return eR=function(){return e},e}function eD(){let e=(0,l._)(["This email is for subscribers in the "," plan"]);return eD=function(){return e},e}function eB(){let e=(0,l._)(["This email is for subscribers in the Founding Member plan"]);return eB=function(){return e},e}function eL(){let e=(0,l._)(["This email is for paid subscribers"]);return eL=function(){return e},e}function ej(){let e=(0,l._)(["Continue reading this post for free, courtesy of ","."]);return ej=function(){return e},e}function eM(){let e=(0,l._)(["This post is for subscribers in the "," plan"]);return eM=function(){return e},e}function eF(){let e=(0,l._)(["This post is for subscribers in the Founding Member plan"]);return eF=function(){return e},e}function eA(){let e=(0,l._)(["This post is for paid subscribers"]);return eA=function(){return e},e}function eU(){let e=(0,l._)(["Subscribe to "," to continue reading"]);return eU=function(){return e},e}function eH(){let e=(0,l._)(["Visit the author’s Substack to subscribe and read more."]);return eH=function(){return e},e}function eX(){let e=(0,l._)(["Visit ",""]);return eX=function(){return e},e}function eO(){let e=(0,l._)(["Support ",""]);return eO=function(){return e},e}function eV(){let e=(0,l._)(["Subscribe to ",""]);return eV=function(){return e},e}function ez(){let e=(0,l._)(["By ",""]);return ez=function(){return e},e}function e$(){let e=(0,l._)(["Subscribe to ",""]);return e$=function(){return e},e}let eW="focus-comment-input",eY=(e,t)=>!!e&&!e.invite_only&&!!t&&t.has_publication&&!t.is_admin&&!t.is_contributor&&!t.is_public_admin&&(0,ea.P)(t,e),eq=(e,t,i,n)=>"enabled"===e.payments_state?!(null==t?void 0:t.is_subscribed):(null==t?void 0:t.is_free_subscribed)&&"disabled"===e.payments_state&&!e.invite_only?!n&&i&&!(null==t?void 0:t.is_pledged):!(null==t?void 0:t.is_free_subscribed);class eJ extends s.Component{async loadReactors(){let e=await C().get("/api/v1/post/".concat(this.props.post.id,"/facepile"));this.setState({reactors:e.body.reactors,restackers:e.body.restackers})}async componentDidMount(){var e;this.props.paywall&&!this.props.postPreview&&(0,eo.j)(eo.FP.POST_PAYWALL_SHOWN,{post_id:this.props.post.id,post_audience:this.props.post.audience,post_type:this.props.post.type,user:this.props.user}),this._triggerShare=()=>this.triggerShare(),null===(e=this.containerRef.current)||void 0===e||e.addEventListener("share-post",this._triggerShare),this.props.post&&this.loadReactors(),.001>Math.random()&&(0,eo.K8)({post:this.props.post});let t=(0,eS.x)("subscribe_prompt");t&&("paid"===t?this.props.popToast(e=>(0,a.tZ)(eg.FN,(0,r._)((0,o._)({},e),{text:"Subscription purchased for ".concat(this.props.pub.name)}))):this.props.popToast(e=>(0,a.tZ)(eg.FN,(0,r._)((0,o._)({},e),{text:"Subscribed to ".concat(this.props.pub.name)}))));let i=null;0x9f7afc3===this.props.post.id&&alert("userAgent: ".concat(navigator.userAgent)),(0,eT.tq)({checkFirst4:!0})&&(/Instagram/i.test(navigator.userAgent)?i="instagram":/(Messenger|FBAN|FBAV|FB_IAB)/i.test(navigator.userAgent)?i="facebook":/Twitter/i.test(navigator.userAgent)?i="twitter":/LinkedIn/i.test(navigator.userAgent)&&(i="linkedin")),i?this.setWebviewModalState(i):this.setPostPromptState()}componentWillUnmount(){if(this._triggerShare){var e;null===(e=this.containerRef.current)||void 0===e||e.removeEventListener("share-post",this._triggerShare)}this.props.stopInterval&&this.props.stopInterval()}isGiftPostEligible(){var e,t;let{getSettingFor:i,post:n,pub:o,referringUser:r,user:l}=this.props;return i("paywall_unlock_tokens")&&"only_paid"===n.audience&&n.teaser_post_eligible&&(!l||!l.is_subscribed)&&(0,eT.tq)({checkFirst4:!0})&&(null==r?void 0:null===(t=r.subscriptions)||void 0===t?void 0:null===(e=t.find(e=>e.publication_id===o.id))||void 0===e?void 0:e.membership_state)==="subscribed"}async setWebviewModalState(e){if(["facebook","twitter","linkedin"].includes(e)){let t="webview_app_upsell_".concat(e);this.context.exposeExperiment(t);let i=this.context.getExperimentVariant(t);i&&"control"!==i&&this.setState({showWebViewModal:{action:i,platform:e}})}else this.setState({showWebViewModal:{action:"follow",platform:e}})}async setPostPromptState(){var e;let{post:t,disableSubscribePrompt:i,readerIsSearchCrawler:n,pub:o,user:r,readerInstalledAt:l,referringUser:a,forceFollowPrompt:s}=this.props,d="newsletter"===t.type&&!0===this.props.getSettingFor("enable_post_page_conversion")&&!i&&!(0,es.AE)()&&!n,c=!1;if(null===(e=document)||void 0===e?void 0:e.referrer)try{let e=new URL(document.referrer);c=!!e.hostname.match(/(^|\.)substack\.com$/)||e.hostname===window.location.hostname}catch(e){}let u=!1,p=this.props.skipFollowPrompt;this.isGiftPostEligible()&&["treatment_more_gifty","treatment_popover_gifty"].includes(this.context.getExperimentVariant("gift_post_unlocks_recipient_2"))&&(u=!0,p=!0);let h=!1;if(s)h=!0;else if(!ex.PUB_IDS_TO_NOT_SHOW_FOLLOW_PROMPT_ON.includes(o.id)&&!p&&d&&a&&a.name&&a.id!==(null==r?void 0:r.id)&&o.author_id!==a.id&&o.contributors.every(e=>e.user_id!==a.id)){let e=[];if(r)try{e=await (0,er.rd)("/api/v1/feed/following")}catch(e){console.warn("Failed to fetch following state",e)}h=!e.includes(a.id)}let m=d&&!u&&!h&&!this.props.paywall&&!this.props.freeSignup&&!r,g=!u&&!["video","podcast"].includes(t.type)&&!n&&(0,eT.tq)({checkFirst4:!0})&&!l&&!c,v=!1;g&&!m&&(this.context.exposeExperiment("app_install_prompts"),"drawer"===this.context.getExperimentVariant("app_install_prompts")&&(v=!0,h=!1)),this.setState({shouldShowGiftPostPrompt:u,shouldShowFollowPrompt:h,shouldShowSubscribePrompt:m,appUpsellEligible:g,mountAppUpsellFooter:v})}triggerShare(){var e,t;let{fromEmail:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i?null===(e=this.shareDialogRef.current)||void 0===e||e.fromEmail():null===(t=this.shareDialogRef.current)||void 0===t||t.open()}onBottomReached(e){this.state.bottomReached||this.props.postPreview||(this.setState({bottomReached:!0}),(0,eo.xG)({post:this.props.post,hasPaywall:e,surface:"publication",trackerUuid:this.props.getCurrentUuid()}))}shouldShowUFI(){let{fromPostPage:e,user:t,pub:i,getSettingFor:n}=this.props,{canShowSubscribeFooterAfterPost:o}=this.state;return!!e&&!!o&&eq(i,t,!!n("payment_pledges_enabled"),this.shouldShowRecommendCta)}shouldTrackPaywallPostSeen(){if("undefined"==typeof window)return!1;let e=document.createElement("div"),t=this.props.post.body_html;e.innerHTML=t;let i=this.props.pub.post_preview_limit||ex.DEFAULT_PREVIEW_LIMIT,n="",o=!1;for(let t=e.childNodes.length-1;t>=0;t--){let r=e.childNodes[t];if(r&&(n+=r.textContent).length>i){o=!0;break}}return o}render(e,t){var i,n,l,s,d,c,p,h;let m,{user:g,pub:v,post:f,freeSignup:b,freeSignupEmail:_,isServingFreePodcastUrl:Z,isShowsPost:C,isTheFreePressTheme:w,reaction_token:P,invisible:x,paywall:L,onChange:M,hideTitle:F,noTitleLink:A,showComments:O,fromPostPage:q,freeTrialCoupon:K,showRestackModal:Q,stripe_publishable_key:ee,crossPostInfo:et,iString:ei,iTemplate:en,themeVariables:er,referringUser:ea,renderComments:es,renderContent:ed,getSettingFor:eu,startInterval:eh,forceFollowPrompt:em}=e,{showTranscription:ev,truncated:eb,autoPlayVoiceOver:e_,reactors:eC,restackers:ew,shouldShowFollowPrompt:eS,shouldShowSubscribePrompt:ex,shouldShowGiftPostPrompt:ek,appUpsellEligible:eU,mountAppUpsellFooter:eH,showWebViewModal:eX}=t;if(f.is_geoblocked)return(0,a.tZ)(e9,{});let eO=(0,eZ.HD)({pub:v}),eV=!!this.context.getConfigFor("like_posts_enabled"),ez=(0,I.N1)(null!==(s=eb||f.body_html)&&void 0!==s?s:"",eO?"h1, h2, h3":"h1, h2, h3, h4"),e$=!L||L&&this.shouldTrackPaywallPostSeen();eh&&e$&&eh({postId:this.props.post.id,containerElementRef:this.containerRef,elementIsStatic:!0});let eW="video"===f.type&&!L&&(null===(i=f.videoUpload)||void 0===i?void 0:i.transcription),eY=this.shouldShowUFI()&&!(0,eZ.HD)({pub:v}),eq=e6(f),eJ=!!eC&&eC.length>0,eK=!!(eu("paywall_unlock_tokens")&&"only_paid"===f.audience&&f.teaser_post_eligible),e0=eK&&!(null==g?void 0:g.is_subscribed)&&((null==g?void 0:g.is_free_subscribed)||b)&&!(null==g?void 0:g.has_redeemed_post_unlock_token),e4=(0,eT.tq)({checkFirst4:!0});eK&&this.isGiftPostEligible()&&(this.context.exposeExperiment("gift_post_unlocks_recipient_2"),["treatment_more_gifty","treatment_popover_gifty"].includes(this.context.getExperimentVariant("gift_post_unlocks_recipient_2"))&&(e0=!0,m=this.context.getExperimentVariant("gift_post_unlocks_recipient_2")));let e8="";e8="video"===f.type?"founding"===f.audience&&(0,ey.H$)(v)?en(eN(),null!==(d=(0,ey.H$)(v))&&void 0!==d?d:""):en("founding"===f.audience?eE():eR()):"adhoc_email"===f.type?"founding"===f.audience&&(0,ey.H$)(v)?en(eD(),null!==(c=(0,ey.H$)(v))&&void 0!==c?c:""):en("founding"===f.audience?eB():eL()):e0?e4?ei("Continue reading this post for free in the Substack app"):en(ej(),v.author_name||v.name):"founding"===f.audience&&(0,ey.H$)(v)?en(eM(),null!==(p=(0,ey.H$)(v))&&void 0!==p?p:""):en("founding"===f.audience?eF():eA());let e3=(0,a.BX)(Y.j,{disabled:!w,post:f,isShowsPost:C,children:[(0,a.tZ)("div",{className:"available-content",children:ev?(0,a.tZ)("div",{className:"container tw-py-12",children:(0,a.tZ)(ef.Z,{post:f,pub:v,user:g,playerRef:this.videoPlayer})}):(0,a.tZ)(U.Z,{html:eb||f.body_html||null,pub:v,trackSelection:!0,post:f,themeVariables:er,canRestackImage:this.context.getConfigFor("restack_with_image"),user:g,freeSignup:b,freeSignupEmail:_,paywall:L,showing_behind_paywall:!!f.post_paywall_content_for_google})}),f.post_paywall_content_for_google&&(0,a.tZ)("div",{className:"paywall-content",children:(0,a.tZ)(U.Z,{html:f.post_paywall_content_for_google,pub:v,trackSelection:!1,post:f,user:g,freeSignup:b,freeSignupEmail:_,paywall:L})}),!x&&e$&&(0,a.tZ)(G.Z,{onVisible:()=>this.onBottomReached(!!L)})]}),e7=(0,eZ.kb)({pub:v}),te=eO?(0,a.tZ)($.Z,{post:f,user:g,pub:v,freeSignupEmail:_}):(0,a.tZ)(R.f1,(0,o._)({user:g,freeSignupEmail:_,freeSignup:b,publication:v,post:f,coupon:!0===this.props.paywall&&this.props.pub.paywall_free_trial_enabled?K:null,showPostUnlockPrompt:!!e0,magicToken:P,giftingUser:ea,treatmentVariantForGiftPostPaywall:m,onPostUnlockError:()=>this.props.popToast(e=>(0,a.tZ)(eg.FN,(0,r._)((0,o._)({},e),{text:ei("Teaser posts are not currently available for this content")})))},Object.assign({title:e8,reauthenticationTitle:ei("To read this, please re-authenticate.")},L)));return(0,a.BX)("article",{className:u()("typography ".concat(f.type,"-post post"),{"tw-p-0":"podcast"===f.type,"shows-post":C,"full-width-image-header":(null===(n=f.postTheme)||void 0===n?void 0:n.header_variant)==="full-width-image",[null!==(h=eI.Z.bottomWithTos)&&void 0!==h?h:"undefined"]:v.has_custom_tos}),ref:this.containerRef,children:[(null==g?void 0:g.is_contributor)&&(null==f?void 0:f.id)&&(null==f?void 0:f.type)==="page"&&(0,a.tZ)(ec.zx,{priority:"secondary",href:(0,eP.ANx)(v,f.id,{params:{back:document.location.href}}),localNavigation:!1,leading:(0,a.tZ)(y.Z,{size:20}),children:ei("Edit")}),(0,a.tZ)(e5,{post:f,user:g,onChange:M}),(0,a.tZ)(X.Z,{ref:this.shareDialogRef,user:g,pub:v,post:f,reaction_token:P,source:"email-share"}),ek&&(0,a.tZ)(E.f,{user:g,post:f,pub:v,referringUser:ea,freeSignupEmail:_,variant:this.context.getExperimentVariant("gift_post_unlocks_recipient_2")}),eS&&(0,a.tZ)(N.yi,{pub:v,post:f,referringUser:ea,freeSignupEmail:_,forceFollowPrompt:em,surface:"post-follow-referrer-prompt"}),ex&&(0,a.tZ)(V.H,{pub:v,post:f,stripe_publishable_key:ee,sharer:ea,appUpsellEligible:!!eU}),eH&&(0,a.tZ)(S.m,{pub:v,slug:f.slug}),eX&&(0,a.tZ)(S.p,{pub:v,slug:f.slug,action:eX.action,platform:eX.platform}),ed?(0,a.BX)(a.HY,{children:[!x&&(0,a.tZ)(G.Z,{onVisible:()=>{this.onTopReached(!!L)}}),ed({comments:es?es():null,crossPostInfo:et,postContent:(0,a.BX)(a.HY,{children:[e3,!!(L&&!f.post_paywall_content_for_google&&!Z)&&te]})})]}):(0,a.BX)(a.HY,{children:[(0,a.tZ)(e1,{user:null!=g?g:null,pub:v,post:f,isOnPostPage:!0,reaction_token:P,allowEdit:!0,showShare:!0,showSubtitle:!0,showPhoto:!0,showCommentRestack:!v.hide_post_restacks,hideTitle:!!F,noTitleLink:!!A,onChange:M,hideDate:"page"===f.type,hideAudience:"page"===f.type,showReactions:eV,showComments:!!O,showLabel:!0,showUpdatedIcons:!0,fromPostPage:!!q,onClickCommentButton:this.onCommentButtonClicked,reactors:eC,showRestackModal:!!Q,showTranscriptionButton:!!eW,onTranscriptionClick:this.onTranscriptionClick,autoPlayVoiceOver:e_}),!x&&e$&&(0,a.tZ)(G.Z,{onVisible:()=>this.onTopReached(!!L)}),(f.has_voiceover||!!f.voiceoverUpload)&&!w&&(0,a.tZ)(T.KH,{pub:v,post:f,mediaUploadId:f.voiceover_upload_id,duration:null===(l=f.voiceoverUpload)||void 0===l?void 0:l.duration,autoPlay:e_,href:f.canonical_url,isPaywalled:!f.voiceover_upload_id}),!f.voiceoverUpload&&e_&&eq&&(0,a.tZ)(J.r,{postId:f.id,onClose:()=>{(0,eo.j)(eo.FP.LISTEN_TO_THIS_POST_MODAL_DISMISSED,{post_id:f.id}),this.setState({autoPlayVoiceOver:!1})}}),et?(0,a.tZ)(k.F,{postType:f.type,crossPostInfo:et}):null,(0,a.BX)("div",{children:[ez&&eO&&(0,a.tZ)(W.T,{toc:ez,title:f.title,commentCount:f.comment_count,wordCount:f.wordcount}),ez&&!eO&&(0,a.tZ)(z.o,{toc:ez,position:"fixed"}),e3,L&&!f.post_paywall_content_for_google?(0,a.BX)(a.HY,{children:[te,(0,a.tZ)(B.i,{post:f})]}):eb?(0,a.tZ)("p",{children:(0,a.BX)(ec.zx,{className:"expander",onClick:()=>this.setState({truncated:null}),children:["+ ",ei("show full post")]})}):!["page"].includes(null==f?void 0:f.type)&&(0,a.BX)(a.HY,{children:[eY&&(0,a.tZ)(eQ,{pub:v,post:f,user:g,freeSignup:!!b,freeSignupEmail:_}),!eY&&this.shouldShowRecommendCta&&(0,a.tZ)(H.o,{pub:v}),et&&("only_paid"===f.audience||"founding"===f.audience)&&(0,a.tZ)(eG,{pub:v}),(0,el.default)("like_posts_enabled")&&v.community_enabled&&eJ&&!w&&(0,a.tZ)(ep.X2,{borderTop:"detail-themed",paddingY:16,children:(0,a.tZ)(D.fB,{post:f,pub:v,user:g,reactors:eC,secondaryFaces:ew})}),!w&&(0,a.tZ)("div",{className:"post-footer",children:(0,a.tZ)(j.Mp,{post:f,pub:v,user:g,onChange:M,postReactionToken:P})}),(0,a.tZ)(B.i,{post:f})]}),f.show_guest_bios&&"podcast"!==f.type&&!eO&&!e7&&(0,a.tZ)(e2,{user:g,pub:v,post:f})]})]})]})}constructor(e,t){var i,o;super(e,t),(0,n._)(this,"containerRef",void 0),(0,n._)(this,"shareDialogRef",void 0),(0,n._)(this,"podcastCommentInput",void 0),(0,n._)(this,"podcastPlayer",void 0),(0,n._)(this,"videoPlayer",void 0),(0,n._)(this,"shouldShowRecommendCta",void 0),(0,n._)(this,"_triggerShare",void 0),(0,n._)(this,"onTopReached",e=>{this.state.topReached||this.props.postPreview||(this.setState({topReached:!0}),(0,eo.jJ)({post:this.props.post,hasPaywall:e,surface:"publication",markRead:!!this.props.user&&!this.props.noPageView,user:this.props.user,trackerUuid:this.props.getCurrentUuid()}))}),(0,n._)(this,"onTranscriptionClick",()=>{this.setState(e=>({showTranscription:!e.showTranscription}))}),(0,n._)(this,"onCommentButtonClicked",e=>{this.props.showComments&&!this.props.post.comment_count&&(e.stopPropagation(),e.preventDefault(),document.dispatchEvent(new CustomEvent(eW)))});let r={showTranscription:!1,autoPlay:!1,autoPlayVoiceOver:!1,commentSort:null!==(o=e.post.default_comment_sort)&&void 0!==o?o:"best_first",loadedWithHeaderLink:"undefined"!=typeof window&&(null===(i=window.location.hash)||void 0===i?void 0:i.startsWith("#".concat(encodeURIComponent("\xa7")))),reactors:null,feedUrl:null,shouldShowSubscribePrompt:!1,shouldShowFollowPrompt:!1};e.paywall||e.post.hidden||!e.post.body_html||(r.canShowSubscribeFooterAfterPost=e8(e.post.body_html),r.truncated=e.truncateAt?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;if("undefined"==typeof window)return null;let n=document.createElement("div");if(n.innerHTML=e,null===n.textContent||n.textContent.length1&&n.textContent.length>i);return n.innerHTML}(e.post.body_html,e.truncateAt,e.truncateTo):null),"undefined"!=typeof window&&window.history.replaceState&&("true"===(0,eS.x)("autoPlay")&&(window.history.replaceState({},document.title,(0,ew.rhs)({autoPlay:null})),r.autoPlay=!0),"true"===(0,eS.x)("play_audio")&&(window.history.replaceState({},document.title,(0,ew.rhs)({play_audio:null})),r.autoPlayVoiceOver=!0)),this.state=r,this.containerRef=(0,s.createRef)(),this.shareDialogRef=(0,s.createRef)(),this.podcastCommentInput=(0,s.createRef)(),this.podcastPlayer=(0,s.createRef)(),this.videoPlayer=(0,s.createRef)(),this.shouldShowRecommendCta=eY(e.pub,e.user)}}(0,n._)(eJ,"contextType",ee.WH),(0,n._)(eJ,"displayName","Post");let eK=(0,eg.dd)((0,Q.f9)((0,en.us)((0,et.fz)((0,ei.aG)(eJ))))),eG=e=>{let{pub:t}=e,{iTemplate:i}=(0,et.M1)();return(0,a.BX)(a.HY,{children:[(0,a.tZ)(eu.iz,{paddingTop:16}),(0,a.BX)(ep.sg,{gap:16,paddingY:32,alignItems:"center",children:[(0,a.BX)(ep.sg,{gap:8,paddingBottom:8,children:[(0,a.tZ)(em.xv.H4,{flex:"grow",align:"center",children:i(eU(),t.name)}),(0,a.tZ)(em.xv.B3,{flex:"grow",align:"center",color:"secondary",children:i(eH())})]}),(0,a.tZ)(ec.zx,{priority:"primary",onClick:()=>{(0,eo.j)(eo.FP.POST_END_CTA_CLICKED,{type:"cross-post"}),(0,es.uX)((0,eP.W1P)(t,{params:{utm_source:ek.b3.postEndCta,addBase:!0}}),{local_navigation:!1})},children:i(eX(),t.name)})]})]})},eQ=e=>{let{pub:t,post:i,user:n,freeSignup:o,freeSignupEmail:r,overridePledgesEnabled:l}=e,{iString:s,iTemplate:c}=(0,et.M1)(),{getSettingFor:u}=(0,en.So)(),[p,h]=(0,d.eJ)(null),m=(0,eS.x)("just_subscribed"),g="disabled"===t.payments_state&&!t.invite_only&&(u("payment_pledges_enabled")||l),v="enabled"===t.payments_state&&(null==n?void 0:n.is_free_subscribed)&&!(null==n?void 0:n.is_subscribed)?"paid_upsell":g&&(null==n?void 0:n.is_free_subscribed)&&!(null==n?void 0:n.is_pledged)?"pledge_upsell":"free_upsell",f=g&&(null==n?void 0:n.is_free_subscribed)&&!(null==n?void 0:n.is_pledged);(0,d.d4)(()=>{(0,eo.j)(eo.FP.POST_END_CTA_RENDERED,{pub_id:t.id,post_id:i.id,type:v})},[t.id,i.id,v,f,null==n?void 0:n.is_free_subscribed]);let b=(0,ex.getByLine)(t);return(0,a.BX)(a.HY,{children:[(0,a.tZ)(eu.iz,{paddingTop:16}),(0,a.tZ)(G.Z,{onVisible:()=>{(0,eo.j)(eo.FP.POST_END_CTA_SEEN,{pub_id:t.id,post_id:i.id,type:v})}}),(0,a.BX)(ep.sg,{gap:16,paddingY:32,children:[(0,a.BX)(ep.sg,{gap:8,paddingBottom:8,children:[(0,a.tZ)(em.xv.H4,{flex:"grow",align:"center",children:c(g&&(null==n?void 0:n.is_free_subscribed)?eO():eV(),t.name)}),(0,a.BX)(em.xv.B3,{flex:"grow",align:"center",color:"secondary",children:[b?c(ez(),b):null,b&&t.rankingDetail?" \xb7 ":null,t.rankingDetail]}),t.hero_text&&(0,a.tZ)(em.xv.B3,{color:"primary",flex:"grow",align:"center",children:t.hero_text})]}),(0,a.tZ)(ep.sg,{alignItems:"center",gap:16,children:f?(0,a.tZ)(ec.zx,{priority:"primary",onClick:()=>{(0,eo.j)(eo.FP.POST_END_CTA_CLICKED,{type:"pledge"}),(0,es.uX)((0,eP.W1P)(t,{params:{utm_source:ek.b3.postEndCta}}),{local_navigation:!1})},children:s("Pledge your support")}):(0,a.BX)(a.HY,{children:[(0,a.tZ)(O.Z,{pub:t,post:i,user:n,freeSignup:o,freeSignupEmail:r,isStatic:!1,onPrepareData:()=>{h(null)},source:"post-end-cta",className:eI.Z.subscribeWidget}),p&&(0,a.tZ)(eh.y,{align:"center",children:p}),!(null==n?void 0:n.is_free_subscribed)&&!m&&(0,a.tZ)(ep.sg,{maxWidth:400,children:(0,a.tZ)(eb.O,{includeCheckbox:!1,addSubscribePreamble:!0,color:"secondary",textAlign:"center"})})]})})]})]})},e0=e=>{let{pub:t}=e;return(0,a.BX)("div",{className:"post-silhouette",children:[(0,a.tZ)("div",{className:"post-silhouette-title"}),(0,a.tZ)("div",{className:"post-silhouette-meta ".concat(t&&t.bylines_enabled&&t.byline_images_enabled?"with-byline-image":"")}),(0,a.tZ)("div",{className:"post-silhouette-body"})]})},e1=e=>{var t,i,n,o;let r,{allowEdit:l,allowSendEmail:s,allowTruncate:d,base_url:c,children:p,className:h,hideAudience:m,hideDate:g,hideTitle:v,hidePinning:f,noTitleLink:b,isStatic:_,isFreePreview:y,is_draft:Z,onChange:C,post:S,pub:T,reaction_token:k,showComments:I,showDatetime:N,showEmailSent:E,showReactions:R,showShare:B,showAppUpsell:A,showSubtitle:U,showPhoto:H,showLabel:X,showRestack:O,showCommentRestack:V,hideAuthor:z,user:$,utm_source:W,showUpdatedIcons:Y,fromPostPage:J,onClickCommentButton:K,reactors:G,inThreadHead:Q,publishedPost:ee,compEndsSoon:ei,compEndedRecently:en,siteConfigValues:eo={},eligibleForTTS:er,showRestackModal:el,showIcon:ea,isOnPostPage:es,showTranscriptionButton:ed,onTranscriptionClick:ec,isAppMode:eu=!1,republishingPost:eh,autoPlayVoiceOver:eg=!1}=e,{iString:ev}=(0,et.M1)(),ef=(0,eT.tq)({checkFirst4:!0}),eb=eh||S,e_="number"==typeof d?d:45,ey=S.title&&S.title.length>e_,ew=Z?S.draft_title:S.title,eS=[(ea||"thread"===S.type)&&(0,a.tZ)(F.m,{postType:S.type,isStatic:_,height:15,className:S.type}),ey&&d?(0,ex.truncateWords)(ew,e_):ew],eI=Z?S.draft_subtitle:S.subtitle;S.section_id&&T.sections&&T.sections.length&&(S.section=T.sections.find(e=>e.id===S.section_id));let eN=(0,eC.B9)({pub:T,subscriptionType:null==$?void 0:$.subscription_type}),eE=!["page"].includes(null==S?void 0:S.type),eR=eE&&_&&ei&&!eN&&(null==eo?void 0:eo.continue_support_cta_in_newsletter_emails),eD=e6(S)||er||S.voiceoverUpload,eB=(null==S?void 0:S.type)==="adhoc_email",eL=eE&&_&&!eB&&!eu,ej=(0,eZ.HD)({pub:T})&&(!!S.postTheme||["video","podcast"].includes(S.type)&&Q);r=S.post_url_override?S.post_url_override:_&&eu?w.W.POST_TITLE_APP_MODE_URL:_?w.W.POST_TITLE_URL:"".concat((0,eP.uRy)(T,S)).concat(W?"?utm_source=".concat(W):"");let eM="".concat(T.base_url+(eb.section?(0,eP.Ucy)(T,{section:eb.section}):""),"/?utm_source=").concat(ek.b3.substack,"&utm_medium=").concat(ek.lP.menu);return ej?(0,a.tZ)(q.I,{post:S,postTheme:S.postTheme,title:ew,subtitle:eI,pub:T,inThreadHead:!!Q,autoPlayVoiceOver:eg}):(0,a.BX)("div",{className:u()("post-header",h),role:"region","aria-label":ev("Post header"),children:[(0,eZ.kb)({pub:T})&&(null!==(o=null===(t=S.postTags)||void 0===t?void 0:t.length)&&void 0!==o?o:0)>0&&(0,a.tZ)(ep.X2,{alignItems:"center",gap:4,paddingBottom:8,children:null===(i=S.postTags)||void 0===i?void 0:i.map((e,t)=>(0,a.BX)(a.HY,{children:[0!==t&&(0,a.tZ)(em.xv.Meta,{children:"—"}),(0,a.tZ)(em.xv.Meta,{as:"a",size:14,href:(0,eP.Mk9)(T,e),children:e.name})]}))}),X&&S.section&&(0,a.tZ)(ep.X2,{className:"post-label",children:(0,a.tZ)(em.xv.Meta,{as:"a",size:14,href:eM,children:null===(n=eb.section)||void 0===n?void 0:n.name})}),eR&&(0,a.tZ)(x.v,{post:S,compAlreadyExpired:en}),!v&&(0,a.tZ)("h1",{className:u()("post-title",S.is_published?"published":"restack"!==S.type||eh?"adhoc_email"===S.type?"adhoc":"unpublished":"email-only-cross-post",{"post-title--the-pillar":(0,eZ.kb)({pub:T})}),children:b?eS:(0,a.tZ)("a",{href:r,children:eS})}),U&&eI&&(0,a.tZ)("h3",{className:u()("subtitle",{"subtitle--the-pillar":(0,eZ.kb)({pub:T})}),children:eI}),"page"===S.type?(0,a.tZ)("div",{style:{height:32}}):es&&!_?(0,a.BX)(ep.sg,{paddingBottom:16,"aria-label":ev("Post UFI"),role:"region",children:[(0,a.tZ)(ep.sg,{paddingY:16,children:(0,a.tZ)(M.E,{post:S,pub:T})}),(0,a.tZ)(P.j,{user:$,isMobile:ef,post:S}),ef?J&&(0,a.tZ)(j.mt,{post:S,pub:T,user:$,isStatic:!!_,postReactionToken:k,onChange:C,allowEdit:l,hidePinning:f,showEmailSent:E,allowSendEmail:s,hideComments:!I,onCommentsClick:K,showRestackModal:el}):(0,a.tZ)(j.Mp,{post:S,pub:T,user:$,onChange:C,showRestackModal:el,showTranscriptionButton:ed,onTranscriptionClick:ec,showClipping:"video"===S.type,postReactionToken:k})]}):(0,a.BX)(a.HY,{children:[!eE||_||ee||Q?eE&&!_&&ee?(0,a.tZ)(j._2,{post:S,pub:T,user:$,style:"compressed",labelStyle:"counts-or-none",postReactionToken:k,showEmailSent:E,hideShare:!B||"restack"===S.type,hideComments:"restack"===S.type,hideSavePost:"restack"===S.type,hideReactions:"restack"===S.type,showPreamble:!0,onChange:void 0,allowEdit:l,allowSendEmail:s,editButtonIsLast:!0,preambleConfig:{showAudience:!m,showDate:!g,showDatetime:N,showAuthor:!z},isStatic:_,position:"publisher-post-list"}):Q&&!_?(0,a.tZ)(j._2,{post:S,pub:T,user:$,style:"compressed",labelStyle:"counts-or-none",postReactionToken:k,hideSavePost:!0,showPreamble:!0,allowEdit:l,allowSendEmail:s,editButtonIsLast:!0,onChange:C,preambleConfig:{showAudience:!m,showDate:!g,showDatetime:N,showAuthor:!z},hideShare:!B,position:"publisher-post-list",isStatic:_}):eE?(0,a.tZ)(D.SP,{user:$,pub:T,post:S,showDate:!g,showDatetime:N,showEmailSent:E,showAudience:!m,showReactions:!eL&&R,showComments:!eL&&I,showShare:!eL&&B,showRestack:!eL&&O,reaction_token:k,onChange:C,isStatic:_,isFreePreview:y,sharedShareDialog:!0,base_url:c,allowSendEmail:s,allowEdit:l,showAuthor:!z,showPhoto:H,hidePinning:f,showUpdatedIcons:Y,inThreadHead:Q,fromPostPage:J,onClickCommentButton:K,reactors:G,isAppMode:eu}):(0,a.tZ)("div",{className:"spacer",style:{height:24}}):(0,a.tZ)(L.a,{className:"meta-subheader",pub:T,post:S,user:$,showDate:!g,showDatetime:!!N,isStatic:!!_,postReactionToken:k,onChange:C,allowEdit:l,hidePinning:f,showEmailSent:E,allowSendEmail:s,allowMobileFooter:J,onCommentsClick:K,showRestackModal:el}),eE&&eL&&(0,a.tZ)(j.yT,{customization:{showShare:B,showComments:I,showReactions:R,showListen:!O&&!y&&!!eD,showSave:!O,showRestack:O,showCommentRestack:V,showAppUpsell:A}}),eB&&(0,a.tZ)("div",{className:"email-ufi-2-empty"})]}),p]})},e2=e=>{let{user:t,pub:i,post:n}=e,{iString:o,iTemplate:r}=(0,et.M1)(),l=(0,ex.getBylineUsers)(n).filter(e=>e.is_guest);return 0===l.length?null:(0,a.BX)("div",{className:"post-contributor-footer",children:[(0,a.tZ)("div",{className:"container-border"}),l.map(e=>{let n=(0,ex.guessFirstName)(e.name),l=e.primaryPublicationSubscribeUrl;l&&(null==t?void 0:t.email)&&(l=(0,ew.rhs)(l,{email:t.email,autoSubmit:!0,utm_source:ek.b3.substack,utm_campaign:ek.VX.guestPostBio,utm_medium:ek.lP.web}));let s=(0,ew.rhs)((0,eP.NNq)(e),{utm_campaign:ek.VX.guestPostBio,utm_medium:ek.lP.web}),d=K.ZP.hasCustomProfilePhoto(e);return(0,a.tZ)("div",{className:u()("post-contributor-bio",{"post-contributor-bio-no-text":!e.bio}),"data-user-id":e.id,children:(0,a.tZ)("table",{cellpadding:"0",cellspacing:"0",className:"post-contributor-bio-table",children:(0,a.BX)("tr",{className:"post-contributor-bio-table-row",children:[d&&(0,a.tZ)("td",{className:"post-contributor-bio-userhead-cell post-contributor-bio-userhead-cell-web",children:(0,a.tZ)(A.ProfileHoverCard,{subject:e,utmSource:"byline",children:(0,a.tZ)(K.ZP,{size:52,user:t,pub:i,subject:e})})}),(0,a.tZ)("td",{className:"post-contributor-bio-body-cell post-contributor-bio-body-cell-web",children:(0,a.BX)("div",{className:"post-contributor-bio-body",children:[e.bio&&(0,a.tZ)("div",{className:"post-contributor-bio-preamble",children:o("A guest post by")}),(0,a.tZ)("table",{cellpadding:"0",cellspacing:"0",className:"post-contributor-bio-body-table",children:(0,a.BX)("tr",{className:"post-contributor-bio-body-table-row",children:[(0,a.BX)("td",{className:"post-contributor-bio-copy-cell",children:[!e.bio&&(0,a.tZ)("div",{className:"post-contributor-bio-preamble",children:o("A guest post by")}),(0,a.BX)(ep.X2,{gap:4,alignItems:"center",paddingBottom:4,children:[(0,a.tZ)(A.ProfileHoverCard,{subject:e,utmSource:"byline",children:(0,a.tZ)("a",{className:"post-contributor-bio-title no-margin",href:s,native:!0,children:e.name})}),(0,a.tZ)(ev.UserBadge,{size:"sm",tier:e.bestseller_tier,userId:e.id})]}),e.bio&&(0,a.tZ)("div",{className:"post-contributor-bio-text",children:e.bio})]}),(0,a.tZ)("td",{className:"post-contributor-bio-controls-cell post-contributor-bio-controls-cell-web",children:(0,a.tZ)("div",{className:"post-contributor-bio-controls",children:l&&(0,a.tZ)("a",{className:"post-contributor-bio-subscribe-button button primary",href:l,native:!0,children:(0,a.tZ)("span",{className:"post-contributor-bio-subscribe-button-label",children:r(e$(),n)})})})})]})})]})})]})})})})]})};class e4 extends(/^(4716|5288)$/.test(i.j)?s.Component:null){render(e){let{renderPost:t,posts:i,hideFirstHeading:n,className:o,top:r,children:l}=e;return i=i.slice(0).sort((e,t)=>(0,e_.Z)(t.post_date)-(0,e_.Z)(e.post_date)),(0,a.BX)("div",{className:"calendared-post-list ".concat(o||""),children:[r,h()(g()(this.renderByHeading(i,"year",(e,n)=>[!n.isSameNow("year")&&(0,a.tZ)("h2",{date:n,children:n.year()}),this.renderByHeading(e,"month",(e,o)=>[!(o.isSameNow("year")&&o.isSameNow("month"))&&(0,a.BX)("h3",{date:n,children:[(0,ex.get_month_name)(o)," ",!o.isSameNow("year")&&o.year()]}),e.map(e=>t(e,i.indexOf(e),i))])]))).filter((e,t,i)=>!n||t>=i.findIndex(e=>!e.props||!e.props.date)),l]})}renderByHeading(e,t,i){let n=f()(e,e=>(0,e_.Z)(e.post_date)[t]());return _()(n).sort((e,t)=>Number(t[0])-Number(e[0])).map(e=>{var t;let[,n]=e;return i(n,(0,e_.Z)(null===(t=n[0])||void 0===t?void 0:t.post_date))})}}function e8(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;if("undefined"==typeof window)return!1;let i=document.createElement("div");i.innerHTML=e;let n="",o=!1;for(let e=i.childNodes.length-1;e>=0;e--){let r=i.childNodes[e];if(r){if((0,es.pv)(r,"button-wrapper")||(0,es.pv)(r,"subscription-widget-wrap")||(0,es.pv)(r,"subscribe-widget")){o=!0;break}if((n+=r.textContent).length>t)break}}return!o}function e5(e){let{post:t,user:i,onChange:n}=e,[l,s]=(0,d.eJ)(!1),{getExperimentVariant:c}=(0,Q.jc)(),u="treatment"===c("video_email_watch_later_experiment"),{onSave:p}=(0,j.vk)({post:t,isSaved:!1});return((0,d.d4)(()=>{if("save"===new URL(location).searchParams.get("action")&&(history.replaceState({},"",(0,ew.rhs)({action:null})),i)){let e=p();n({post:(0,r._)((0,o._)({},t),{is_saved:e})}),e&&u&&s(!0)}},[]),l)?(0,a.tZ)(ed.X,{onClose:()=>s(!1)}):null}function e6(e){var t;return!!(null===(t=e.audio_items)||void 0===t?void 0:t.some(e=>"tts"===e.type))}function e3(e){var t;return!!(null===(t=e.audio_items)||void 0===t?void 0:t.some(e=>"tts"===e.type&&"paywalled"===e.status))}let e9=()=>(0,a.tZ)("article",{className:u()("typography post",{"shows-post":!1}),children:(0,a.tZ)("div",{className:"container tw-p-12",children:(0,a.tZ)("p",{align:"center",children:(0,a.tZ)(em.xv,{translated:!0,as:"span",children:"This content has been withheld in your country in response to a legal requirement."})})})})},57952:function(e,t,i){i.d(t,{Rq:()=>U,Xf:()=>M,_F:()=>L,pH:()=>j});var n=i(16584),o=i(6400),r=i(30396),l=i(23279),a=i.n(l);if(/^(4716|5288)$/.test(i.j))var s=i(62686);if(2787!=i.j)var d=i(71375);if(2787!=i.j)var c=i(24840);if(/^(4716|5288)$/.test(i.j))var u=i(53716);if(/^(4716|5288)$/.test(i.j))var p=i(85200);if(/^(4716|5288)$/.test(i.j))var h=i(887);if(/^(4716|5288)$/.test(i.j))var m=i(71212);if(/^(4716|5288)$/.test(i.j))var g=i(27194);if(2787!=i.j)var v=i(84967);if(2787!=i.j)var f=i(49336);var b=i(5772),_=i(95441),y=i(4796),Z=i(68833),C=i(98422),w=i(15771),S=i(61254),P=i(19081),T=i(84747),x=i(73857),k=i(58175),I=i(98905),N=i(98012),E=i(61468),R=i(84864),D=i(22233);let B=(0,o.createContext)({isSearching:!1,items:[],setIsSearching:()=>void 0,setItems:()=>void 0,focusedItemStart:null,setFocusedItemStart:()=>void 0,filteredItems:[],searchTerm:null,setSearchTerm:()=>void 0,hasFiltered:!1}),L=e=>{let{children:t}=e,[i,o]=(0,r.eJ)(!1),[l,a]=(0,r.eJ)([]),[s,d]=(0,r.eJ)(null),[c,u]=(0,r.eJ)(null),{filteredItems:p,setQuery:h,hasFiltered:m}=(0,b.R)({items:l,getKeys:e=>[e.text],sortFunc:(e,t)=>e.start-t.start});return(0,r.d4)(()=>{var e,t;d(null!==(t=null===(e=p[0])||void 0===e?void 0:e.start)&&void 0!==t?t:null)},[p]),(0,n.tZ)(B.Provider,{value:{isSearching:i,setIsSearching:o,items:l,setItems:a,focusedItemStart:s,setFocusedItemStart:d,filteredItems:p,hasFiltered:m,searchTerm:c,setSearchTerm:e=>{u(e),h(e)}},children:t})},j=()=>(0,r.qp)(B),M=e=>{let{isEditing:t,setIsEditing:i,setEdits:o,hasEdits:r,handleSubmitEdits:l,handleRegenerateTranscription:a,handleCancelTranscription:c,isTranscribing:u,transcription:p,postId:h,audioUpload:m,onTranscriptionUploadCancelled:g,onTranscriptionUploadError:v,onTranscriptionUploadStarted:f,onTranscriptionUploaded:b,uploadedFile:_,setUploadedFile:y,isEditingSpeakers:C}=e,{isSearching:S}=j();return(0,n.BX)(P.tu,{gap:16,children:[_&&(0,n.BX)(P.gq,{alignItems:"center",justifyContent:"space-between",padding:16,radius:"sm",border:"detail",gap:16,children:[(0,n.BX)(P.gq,{gap:16,alignItems:"center",children:[(0,n.tZ)(P.hs,{alignItems:"center",padding:8,radius:"sm",color:"primary",bg:"secondary",children:(0,n.tZ)(s.Z,{})}),(0,n.BX)(P.tu,{children:[(0,n.tZ)(k.xv.B3,{weight:"semibold",color:"primary",children:_.name}),(0,n.tZ)(k.xv.B4,{children:(0,R.numberToHumanFileSize)(_.size)})]})]}),(0,n.tZ)(w.hU,{onClick:()=>{(0,Z.j)(Z.FP.TRANSCRIPTION_EDIT_CANCELLED_CLICKED,{post_id:h}),y(null),c()},children:(0,n.tZ)(d.Z,{})})]}),t&&(0,n.tZ)(A,{hasEdits:r,setIsEditing:i,setEdits:o,handleSubmitEdits:l}),!t&&!S&&(0,n.tZ)(F,{isEditingSpeakers:C,setIsEditing:i,transcription:p,isTranscribing:u,handleCancelTranscription:c,handleRegenerateTranscription:a,setUploadedFile:y,postId:h,audioUpload:m,onTranscriptionUploadCancelled:g,onTranscriptionUploadError:v,onTranscriptionUploadStarted:f,onTranscriptionUploaded:b}),S&&(0,n.tZ)(U,{postId:h})]})},F=e=>{var t,i,o;let{transcription:r,isTranscribing:l,handleCancelTranscription:a,handleRegenerateTranscription:s,setUploadedFile:d,postId:v,audioUpload:f,onTranscriptionUploadStarted:b,onTranscriptionUploadCancelled:C,onTranscriptionUploadError:k,onTranscriptionUploaded:I,setIsEditing:R,isEditingSpeakers:B}=e,{iString:L}=(0,_.M1)(),M=(null==r?void 0:r.created_at)&&new Date(r.created_at)<(0,N.Z)().subtract(5,"minutes").toDate(),F=(null==r?void 0:r.status)==="failed",A=(null==r?void 0:r.status)==="transcribed",{setIsSearching:U}=j(),H=null===(t=(null!==(i=null==r?void 0:r.signed_captions)&&void 0!==i?i:[]).find(e=>"True"===e.original))||void 0===t?void 0:t.url,X=async e=>{if(e.cdn_unaligned_url&&e.cdn_url)try{var t,i,n,o;let r=await fetch(e.cdn_unaligned_url,{headers:{Accept:"text/plain"}}),l=await r.text(),a=JSON.parse(l),s=null!==(i=a.segments)&&void 0!==i?i:[];Object.keys(null!==(n=a.speaker_map)&&void 0!==n?n:{}).length>0&&(null==s?void 0:null===(t=s[0])||void 0===t?void 0:t.speaker)||(r=await fetch(e.cdn_url,{headers:{Accept:"text/plain"}}),l=await r.text(),s=JSON.parse(l));let d=(0,E.Vu)(s,null!==(o=e.speaker_map)&&void 0!==o?o:{}),c=new Blob([d],{type:"text/plain"}),u=URL.createObjectURL(c),p=document.createElement("a");p.href=u,p.download="transcript_".concat(new Date().toISOString(),".txt"),document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(u)}catch(e){console.error("Failed to fetch and download transcript:",e)}};return(0,n.BX)(P.gq,{justifyContent:"space-between",gap:8,children:[(0,n.tZ)(w.hU,{onClick:()=>{(0,Z.j)(Z.FP.TRANSCRIPTION_SEARCH_CLICKED,{post_id:v}),U(!0)},disabled:B,children:(0,n.tZ)(c.Z,{})}),(0,n.BX)(P.gq,{gap:8,children:[(0,n.tZ)(w.zx,{onClick:s,disabled:!(A&&!M||!l||F)||B,leading:(0,n.tZ)(u.Z,{}),priority:"secondary",children:L("Regenerate")}),(0,n.tZ)(y.z,{setUploadedFile:d,postId:v,mediaUpload:f,transcription:null!=r?r:null,onTranscriptionUploadStarted:b,onTranscriptionUploadCancelled:C,onTranscriptionUploadError:k,onTranscriptionUploaded:I,disabled:!v||!f||(null==f?void 0:f.state)!=="transcoded"||B}),(0,n.BX)(T.M,{trigger:(0,n.tZ)(w.hU,{priority:"secondary",rounded:!1,children:(0,n.tZ)(p.Z,{className:D.Z.icon})}),children:[(null==r?void 0:r.status)==="transcribed"&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(T.u,{disabled:B,onClick:()=>{(0,Z.j)(Z.FP.TRANSCRIPTION_EDIT_CLICKED,{post_id:v}),R(!0)},leading:(0,n.tZ)(h.Z,{}),children:L("Correct transcript")}),(0,n.tZ)(S.iz,{}),(0,n.BX)(x.L,{leading:(0,n.tZ)(m.Z,{}),content:L("Download"),children:[(0,n.tZ)(T.u,{disabled:B,onClick:()=>{(0,Z.j)(Z.FP.TRANSCRIPTION_DOWNLOAD_CLICKED,{post_id:v,type:"txt"}),X(r)},children:L("Download .txt file")}),(0,n.tZ)(T.u,{disabled:B,href:null!==(o=r.cdn_url)&&void 0!==o?o:void 0,onClick:()=>{(0,Z.j)(Z.FP.TRANSCRIPTION_DOWNLOAD_CLICKED,{post_id:v,type:"json"})},children:L("Download .json file")}),H&&(0,n.tZ)(T.u,{disabled:B,href:H,onClick:()=>{(0,Z.j)(Z.FP.TRANSCRIPTION_DOWNLOAD_CLICKED,{post_id:v,type:"vtt"})},children:L("Download .vtt file")})]}),(0,n.tZ)(S.iz,{})]}),(0,n.tZ)(T.u,{disabled:!r||B,priority:"destructive",leading:(0,n.tZ)(g.Z,{}),onClick:a,children:L("Remove")})]})]})]})},A=e=>{let{setIsEditing:t,setEdits:i,hasEdits:o,handleSubmitEdits:r}=e,{iString:l}=(0,_.M1)();return(0,n.BX)(P.gq,{justifyContent:"end",gap:8,children:[(0,n.tZ)(w.zx,{onClick:()=>{t(!1),i({})},priority:"secondary",children:l("Cancel")}),(0,n.tZ)(w.zx,{priority:"primary",disabled:!o,onClick:r,children:l("Save")})]})},U=e=>{let{postId:t,closeAlwaysVisible:i=!0}=e,{iString:o}=(0,_.M1)(),{isMobile:l}=(0,C.v9)(),s=(0,r.sO)(null),{setSearchTerm:u,setIsSearching:p,hasFiltered:h,filteredItems:m,setFocusedItemStart:g,focusedItemStart:b,searchTerm:y}=j();(0,r.d4)(()=>{!y&&s.current&&(s.current.value="")},[y]);let S=m.findIndex(e=>e.start===b),T=()=>{let e=S+1>=m.length?0:S+1;g(m[e].start)},x=()=>{u(""),p(!1),(0,Z.j)(Z.FP.TRANSCRIPTION_SEARCH_CANCELLED,{post_id:t})};return(0,n.BX)(P.gq,{gap:8,justifyContent:"space-between",alignItems:"center",className:D.Z.searchForm,children:[(0,n.tZ)(I.K,{ref:s,leftIcon:(0,n.tZ)(P.gq,{children:(0,n.tZ)(c.Z,{size:16})}),rightIcon:(0,n.tZ)(P.gq,{cursor:"pointer",onClick:x,children:y||i?(0,n.tZ)(d.Z,{size:16}):null}),placeholder:o("Search"),onChange:a()(e=>{u(e.target.value),(0,Z.j)(Z.FP.TRANSCRIPTION_SEARCHED,{post_id:t})},100),onKeyDown:e=>{"Enter"===e.key&&T(),"Escape"===e.key&&x()}}),h&&(0,n.tZ)(P.gq,{gap:8,paddingRight:8*!!l,children:(0,n.BX)(P.gq,{alignItems:"center",gap:8,children:[(0,n.tZ)(k.xv.B4,{paddingLeft:l?4:16,className:D.Z.resultsValue,color:"primary",weight:"semibold",children:"".concat(S+1," / ").concat(m.length)}),(0,n.BX)(P.gq,{children:[(0,n.tZ)(w.hU,{priority:"tertiary",size:"sm",onClick:()=>{let e=S-1<0?m.length-1:S-1;g(m[e].start)},children:(0,n.tZ)(v.Z,{size:20})}),(0,n.tZ)(w.hU,{priority:"tertiary",size:"sm",onClick:T,children:(0,n.tZ)(f.Z,{size:20})})]})]})})]})}},4796:function(e,t,i){i.d(t,{z:()=>_});var n=i(16584),o=i(30396);if(/^(4716|5288)$/.test(i.j))var r=i(32224);var l=i(98661),a=i(80569),s=i.n(a),d=i(95441),c=i(6400);let u=(e,t)=>{let i=new FileReader;i.onload=e=>{var i;t(null===(i=e.target)||void 0===i?void 0:i.result)},i.readAsText(e)};var p=i(68833),h=i(15771),m=i(61254),g=i(19081),v=i(84747),f=i(61468);let b=/^(4716|5288)$/.test(i.j)?[".txt",".srt",".vtt"]:null,_=e=>{let{postId:t,mediaUpload:i,transcription:a,onTranscriptionUploadStarted:_,onTranscriptionUploadCancelled:y,onTranscriptionUploadError:Z,onTranscriptionUploaded:C,disabled:w,setUploadedFile:S}=e,{iString:P}=(0,d.M1)(),[T,x]=(0,o.eJ)(!1),[k,I]=(0,o.eJ)(""),N=a&&"in_progress"===a.status,[E,R]=(0,o.eJ)(null),D=async e=>{if(R(e),null==_||_(),e.length>0&&e[0]){var n;S&&S(e[0]);let o=null!==(n=e[0].name.split(".").pop())&&void 0!==n?n:"";(0,p.j)(p.FP.TRANSCRIPTION_UPLOAD_FILE_STARTED,{post_id:t,audio_upload_id:null==i?void 0:i.id,type:o}),u(e[0],async t=>{I(t);let n=null,r={};try{if("txt"===o){var l;[n,r]=(0,f.kF)(t,null!==(l=null==i?void 0:i.duration)&&void 0!==l?l:0)}else"vtt"===o?[n,r]=(0,f.$h)(t):"srt"===o&&([n,r]=(0,f.$h)(t));let a=(0,f.ob)(n);if(n&&!a)await B(e[0],o,n,r);else{let e=P("Error validating transcription file"),t="".concat(e,": ").concat(a);console.error(t),null==Z||Z(t)}}catch(t){let e=P("Error parsing transcription file");console.error(e,t),null==Z||Z(e),S&&S(null)}finally{F()}})}},B=async(e,n,o,r)=>{let{body:l}=await s().post("/api/v1/drafts/".concat(t,"/upload_transcription/start")).send({speaker_map:r}),{originalTranscriptionFileKey:a,unalignedTranscriptionFileKey:d,alignedTranscriptionFileKey:c}=l;x(!0);try{var u;await s().put(a).send(e).set("Content-Type",e.type),await s().put(d).send(JSON.stringify(o)).set("Content-Type","application/json"),await s().put(c).send(JSON.stringify(null!==(u=null==o?void 0:o.segments)&&void 0!==u?u:[])).set("Content-Type","application/json"),await s().post("/api/v1/drafts/".concat(t,"/upload_transcription/complete")).send(),await s().post("/api/v1/drafts/".concat(t,"/realign_transcription")).send({edits:{}}).then(e=>{var o;(null===(o=e.body)||void 0===o?void 0:o.data)&&((0,p.j)(p.FP.TRANSCRIPTION_UPLOAD_FILE_COMPLETED,{post_id:t,audio_upload_id:null==i?void 0:i.id,type:n}),x(!1),C(e.body.data),F())})}catch(e){(0,p.j)(p.FP.TRANSCRIPTION_UPLOAD_FILE_FAILED,{post_id:t,audio_upload_id:null==i?void 0:i.id,type:n}),console.error("File upload failed:",e),null==Z||Z(P("Error uploading transcription file"))}};(0,l.useEffect)(()=>{},[k]);let{openFileDialog:L,fileInputRef:j}=function(e){let{onFilesSelected:t}=e,i=(0,c.createRef)(),n=e=>{let i=e.target;i.files&&i.files.length>0&&t(i.files)};return(0,l.useEffect)(()=>{let e=i.current;if(e)return e.addEventListener("change",n),()=>{e.removeEventListener("change",n)}},[i]),{openFileDialog:()=>{var e;null===(e=i.current)||void 0===e||e.click()},fileInputRef:i}}({onFilesSelected:D}),{dropRef:M}=function(e){let{onFilesSelected:t}=e,[i,n]=(0,l.useState)(!1),o=(0,l.useRef)(null),r=e=>{e.preventDefault(),e.stopPropagation()},a=e=>{e.preventDefault(),e.stopPropagation(),n(!1)},s=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&e.dataTransfer.items&&e.dataTransfer.items.length>0&&n(!0)},d=e=>{e.preventDefault(),e.stopPropagation(),n(!1),e.dataTransfer&&e.dataTransfer.files&&e.dataTransfer.files.length>0&&(t(e.dataTransfer.files),e.dataTransfer.clearData())};return(0,l.useEffect)(()=>{let e=o.current;if(e)return e.addEventListener("dragenter",r),e.addEventListener("dragleave",a),e.addEventListener("dragover",s),e.addEventListener("drop",d),()=>{e.removeEventListener("dragenter",r),e.removeEventListener("dragleave",a),e.removeEventListener("dragover",s),e.removeEventListener("drop",d)}},[o]),{dropRef:o,dragging:i}}({onFilesSelected:D}),F=()=>{R(null),j.current&&(j.current.value=""),null==y||y()},A=null==E?void 0:E[0],U=e=>{(0,p.j)(p.FP.TRANSCRIPTION_UPLOAD_FILE_TYPE_CLICKED,{post_id:t,audio_upload_id:null==i?void 0:i.id,type:e}),j.current&&(j.current.accept=e,setTimeout(()=>L(),50))};return N?null:(0,n.BX)(g.tu,{gap:8,children:[!T&&(0,n.BX)(v.M,{ref:M,layerOptions:{placement:"bottom-center"},onOpen:()=>{(0,p.j)(p.FP.TRANSCRIPTION_UPLOAD_FILE_CLICKED,{post_id:t,audio_upload_id:null==i?void 0:i.id})},trigger:(0,n.tZ)(h.zx,{disabled:w,priority:"secondary",leading:(0,n.tZ)(r.Z,{size:18}),children:P("Upload transcript")}),children:[(0,n.tZ)(v.u,{onClick:()=>U(".txt"),children:P("Upload .txt file")}),(0,n.tZ)(m.iz,{}),(0,n.tZ)(v.u,{onClick:()=>U(".vtt"),children:P("Upload .vtt file")}),(0,n.tZ)(m.iz,{}),(0,n.tZ)(v.u,{onClick:()=>U(".srt"),children:P("Upload .srt file")})]}),A&&(0,n.tZ)(g.tu,{gap:8}),(0,n.tZ)("input",{type:"file",ref:j,style:{display:"none"},accept:b.join(",")})]})}},21599:function(e,t,i){i.d(t,{S2:()=>a,pW:()=>c,sK:()=>s});var n=i(48980),o=i(7882),r=i(98914);if(/^(3154|6909)$/.test(i.j))var l=i(26111);function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,l.x)("selection");let{isLoading:i,error:n,result:r}=(0,o.ib)({pathname:"/api/v1/post_selection/".concat(e),auto:!!e,deps:[e]});return{isLoading:i,error:n,postSelection:null!=r?r:null,highlightSelection:()=>{r&&d(r,t)}}}async function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,l.x)("selection");let i=null;try{i=await (0,n.rd)("/api/v1/post_selection/".concat(e))}catch(e){console.error("could not fetch post selection",e)}i&&d(i,t)}function d(e){var t,i;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.ignoreSafari&&(0,r.G6)()||!e.text)return;let o=(null!==(i=null===(t=/^[^.]+\./.exec(e.text))||void 0===t?void 0:t[0])&&void 0!==i?i:e.text).replace(/\.+$/g,"");if(!o)return;let l="#:~:text=".concat(encodeURIComponent(o));history.replaceState({},document.title,l),document.location.replace(l)}async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,l.x)("imgSelection");let i=null;try{i=(await (0,n.rd)("/api/v1/post_selection/image/".concat(e))).selection}catch(t){console.error("Couldn't find post image selection with id ".concat(e),t)}i&&function(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(i.ignoreSafari&&(0,r.G6)())&&e.img_src){for(let i of document.getElementsByTagName("img"))if(i.src===e.img_src){t=i;return}t&&t.scrollIntoView()}}(i,t)}},32129:function(e,t,i){i.r(t),i.d(t,{PostMetaTags:()=>h,getPageTitleAndMeta:()=>m,getPostMetaImage:()=>g,getPostMetaImageForTwitter:()=>v});var n=i(16584),o=i(32351),r=i(49762),l=i(2748);if(/^(3154|6909)$/.test(i.j))var a=i(93903);var s=i(6070),d=i(1835),c=i(60308),u=i(84864),p=i(93370);function h(e){var t,i;let r,l,{publication:a,post:s,clip:d,siteConfigs:u={},twitterCardUrl:h=null,isCommentPage:f=!1,selection:b=null,imgSelection:_=null,selectionStyle:y}=e,Z=(null==s?void 0:s.social_title)||(null==s?void 0:s.title)||a.name,{title:C,description:w}=m(s,a,{isCommentPage:f}),S=null;h?(r=h,l=!0):b&&s?(r=(0,c.BPe)(a,s,"".concat(b),y),l=!0):_&&s?(r=(0,c.cjA)(a,s,_),l=!0):([r,l]=g(a,s),S=v(a,s));let P=f&&s&&"thread"!==s.type&&0===s.comment_count||(null==s?void 0:s.type)==="restack";return(0,n.tZ)(o.Metadata,{title:C,socialTitle:d?"✂️ ".concat((0,p.UB)(null!==(t=d.duration)&&void 0!==t?t:0)," | ").concat(Z):Z,searchDescription:null==s?void 0:s.search_engine_description,description:w,image:d&&null!==(i=(0,c.ow1)(d))&&void 0!==i?i:r,twitterImage:d?void 0:S,isLargeImage:l,imageHeight:b?564:void 0,imageWidth:b?1128:void 0,seoProps:{noindex:P,noarchive:!!(s&&s.post_paywall_content_for_google)},isPodcast:(null==s?void 0:s.type)==="podcast",isVideo:(null==s?void 0:s.type)==="video",slug:null==s?void 0:s.slug,pub:a,post:s,siteConfigs:u})}function m(e,t){var i,n;let o,s,c,{isCommentPage:p=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},h=(null==e?void 0:e.social_title)||(null==e?void 0:e.title)||t.name,m=(s=e?(0,u.getPrintedByline)(t,e):(0,r.default)("publication_author_display_override")||(null===(n=(0,d.Im)(t.contributors))||void 0===n?void 0:n.owner))&&!(null===(i=t.name)||void 0===i?void 0:i.toLowerCase().includes(null==s?void 0:s.toLowerCase()));return(null==e?void 0:e.title)?(o=(null==e?void 0:e.search_engine_title)||h,p&&"thread"!==e.type&&(o="Comments - ".concat(o)),"".concat(o," - by ").concat(s).length<60&&(s&&m&&(o+=" - by ".concat(s)),"".concat(o," - ").concat(t.name).length<60&&(o+=" - ".concat(t.name)))):o=m?"".concat(t.name," | ").concat(s," | Substack"):"".concat(t.name," | Substack"),c=e?(0,u.postSocialDescription)(e,t):(0,l.F)(t),{title:o,description:c=(0,a.Z)(c)}}function g(e,t){let i,n;return(null==t?void 0:t.cover_image)?(i=(0,c.zF4)(t.cover_image,1200,{height:600,smartCrop:!0,format:"jpg"}),n=!0):"numlock"===e.subdomain?(i=(0,c.zF4)("/img/numlock_square.png?v=2",840),n=!1):(i=(0,s.HD)({pub:e})?(0,c.zF4)("/img/thefp/thefp-preview-card.png",1200,{height:600,smartCrop:!0,format:"jpg",quality:"auto:best"}):(0,c.d54)(e),n=!0),[i,n]}function v(e,t){return(null==t?void 0:t.cover_image)?(0,c.h75)(e,t):null}},2207:function(e,t,i){if(i.d(t,{C:()=>p}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var o=i(99282);if(/^(3154|6909)$/.test(i.j))var r=i(98848);var l=i(16584),a=i(56232),s=i(19081),d=i(50312),c=i(81043);if(/^(3154|6909)$/.test(i.j))var u=i(41427);function p(e){var{forwardedRef:t,href:i,onClick:p}=e,h=(0,r._)(e,["forwardedRef","href","onClick"]);let{onRefresh:m}=(0,c.SJ)();return(0,l.tZ)(a.Match,{children:e=>{let{path:r}=e,a=i&&(0,u.M)(r,i);return h.native?(0,l.tZ)(s.hs,(0,o._)((0,n._)({as:"a"},h),{href:!a||h.native?i:void 0,onClick:a&&m?m:p,ref:t})):(0,l.tZ)(d.r,(0,o._)((0,n._)({},h),{role:"button",href:a?void 0:i,onClick:a&&m?m:p,ref:t}))}})}},50167:function(e,t,i){if(i.d(t,{QC:()=>b,_T:()=>f,hC:()=>_}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var o=i(99282);var r=i(16584),l=i(30396);if(/^(3154|6909)$/.test(i.j))var a=i(56687);if(/^(3154|6909)$/.test(i.j))var s=i(68843);var d=i(95441),c=i(7882),u=i(98914),p=i(15771),h=i(36500),m=i(70379),g=i(60308);function v(e,t,i){let{popToast:a}=(0,m.pm)(),[s,d]=(0,l.eJ)(!1),[p,h]=(0,l.eJ)(void 0),{refetch:v,isLoading:f}=(0,c.ib)({pathname:"/api/v1/@".concat(null==e?void 0:e.handle,"/personal-initialize"),method:"post"}),b=!t&&e.isPersonalEligible,_=(null==e?void 0:e.isPersonalEligible)||b?async()=>{let e=await v({query:{action:"post"}});e instanceof Error?(console.error(e),a(e=>(0,r.tZ)(m.FN,(0,o._)((0,n._)({},e),{text:"Something went wrong. Please try again."})))):(d(!0),"undefined"!=typeof window&&(window.location.href=e.redirectUrl))}:async()=>(0,u.uX)((0,g.DeU)(),{local_navigation:!1});return(0,l.d4)(()=>{"undefined"!=typeof window&&(null==t?void 0:t.publication)&&!b&&h((0,g.n1t)("".concat((0,g.SVA)({subdomain:t.publication.subdomain}),"/publish/post"),{back:window.location.href,type:null==i?void 0:i.type}))},[t,b]),{onClick:_,href:p,isLoading:f,willRedirect:s}}function f(e){let{profile:t,publicationUser:i}=e,{iString:n}=(0,d.M1)(),{onClick:o,href:l,isLoading:s,willRedirect:c}=v(t,i);return(0,r.tZ)(h.sN,{leading:(0,r.tZ)(a.Z,{}),disabled:s||c,onClick:o,href:l,children:n("Post")})}function b(e){let{profile:t,publicationUser:i,size:n,flex:o}=e,{iString:l}=(0,d.M1)(),{onClick:a,href:s,isLoading:c,willRedirect:u}=v(t,i);return(0,r.tZ)(p.zx,{priority:"primary",href:s,onClick:a,disabled:c||u,localNavigation:!1,size:n,flex:o,children:l("New post")})}function _(e){let{profile:t,publicationUser:i}=e,{iString:n}=(0,d.M1)(),{onClick:o,href:l,isLoading:a,willRedirect:c}=v(t,i,{type:"podcast"});return(0,r.tZ)(h.sN,{leading:(0,r.tZ)(s.Z,{}),disabled:a||c,onClick:o,href:l,children:n("Video")})}},90370:function(e,t,i){i.r(t),i.d(t,{MiniChatInbox:()=>eP});var n=i(16584),o=i(30396),r=i(56743),l=i(68833),a=i(98914),s=i(80026),d=i(40225),c=i(7409),u=i(99282),p=i(98848),h=i(39693),m=i.n(h),g=i(47976),v=i(51534),f=i(45530),b=i(5772),_=i(95441),y=i(60807),Z=i(80878),C=i(7882),w=i(61254),S=i(38841),P=i(69891),T=i(55533),x=i(94874),k=i(43570),I=i(87989),N=i(94184),E=i.n(N),R=i(71068),D=i(19081),B=i(36889),L=i(44854);function j(e){var{isSelected:t,className:i}=e,o=(0,p._)(e,["isSelected","className"]);return(0,n.tZ)(D.sg,{children:(0,n.tZ)(D.gq,(0,c._)({className:E()(L.Z.chatPublication,i,t&&L.Z.selected),as:"a",alignItems:"center",position:"relative",gap:12,paddingY:12,paddingX:16,href:o.href,target:"_blank",rel:"noopener noreferrer",hover:!0,userSelect:"none"},o))})}let M=(0,R.E7)({display:"flex",direction:"column",flex:"grow",minWidth:0,gap:2,alignSelf:"start",justifyContent:"start"});function F(e){let{unread:t,children:i}=e;return(0,n.tZ)(s.xv.B4,{display:"flex",color:t?"primary":"secondary",children:(0,n.tZ)(s.xv,{as:"span",ellipsis:!0,minWidth:0,children:i})})}function A(e){var t;let{comment:i,outgoing:o,link:r,fallbackText:l}=e;if(i.reported_by_user)return(0,n.tZ)("em",{children:"You reported this thread."});let{media_uploads:a}=i,s=(null==a?void 0:a.length)||0,d=null!==(t=null==i?void 0:i.body)&&void 0!==t?t:void 0,c=o?"You: ":"";return i||(c="New conversation"),r&&(d?c+="\uD83D\uDD17 ".concat(d):r?c+="\uD83D\uDD17 ".concat(r):c+="\uD83D\uDD17 Link"),a&&(d?c+="\uD83D\uDCF8 ".concat(d):s>1?c+="\uD83D\uDCF8 ".concat(s," Images"):c+="\uD83D\uDCF8 Image"),a||r||(d?c+=d:c+=l),(0,n.tZ)(n.HY,{children:c})}function U(){return(0,n.tZ)(D.sg,{padding:12,gap:8,children:Array(8).fill(0).map(()=>(0,n.tZ)(H,{}))})}function H(){return(0,n.BX)(D.X2,{gap:12,padding:8,alignItems:"center",children:[(0,n.tZ)(B.V,{type:"circle",size:48}),(0,n.BX)(D.sg,{gap:8,flex:"grow",children:[(0,n.tZ)(B.V,{type:"bar",maxWidth:"".concat(50*Math.random()+50,"%")}),(0,n.tZ)(B.V,{type:"bar",maxWidth:"".concat(25*Math.random()+25,"%")})]})]})}var X=i(64515);let O=e=>{var{size:t=24,color:i="var(--color-fg-primary)"}=e,o=(0,p._)(e,["size","color"]);return(0,n.tZ)(X.l,(0,u._)((0,c._)({},o),{name:"SkinnyPinIcon",svgParams:{viewBox:"0 0 24 24"},stroke:"none",width:t,height:t,fill:i,children:(0,n.tZ)("path",{d:"M4 14.8571C4 15.7323 4.58687 16.3089 5.51351 16.3089H11.0836V21.117C11.0836 22.6924 11.7426 24 12 24C12.2471 24 12.906 22.6924 12.906 21.117V16.3089H18.4762C19.4028 16.3089 19.9896 15.7323 19.9896 14.8571C19.9896 12.6847 18.2497 10.3887 15.3565 9.33849L15.0167 4.6126C16.5199 3.75804 17.7554 2.79021 18.2908 2.10038C18.5585 1.75032 18.6924 1.40025 18.6924 1.09137C18.6924 0.463323 18.2085 0 17.4878 0H6.51222C5.7812 0 5.30759 0.463323 5.30759 1.09137C5.30759 1.40025 5.43115 1.75032 5.69883 2.10038C6.23423 2.79021 7.46975 3.75804 8.97296 4.6126L8.6332 9.33849C5.74002 10.3887 4 12.6847 4 14.8571Z"})}))};function V(){return(0,n.tZ)(O,{size:12,color:"var(--color-fg-secondary)"})}var z=i(54584),$=i(31541),W=i(98012),Y=i(62515);function q(e){var t,i,o;let{item:r,onSelect:a,isSelected:d,isUnread:c,tab:u}=e,p=(0,z.y)(),h=(0,y.aF)(),m=null===(t=r.messageThread.members.find(e=>e.user_id!==(null==h?void 0:h.id)))||void 0===t?void 0:t.user;if(!m)return console.error("No member for DM conversation ".concat(r.messageThread.id)),null;let{recentMessage:g}=r,v=g&&(null===(i=r.messageThread.members.find(e=>g.comment.user_id===e.user_id))||void 0===i?void 0:i.user);return(0,n.BX)(j,{isSelected:d,onClick:e=>{let t=r.messageThread.id;(0,l.j)(l.FP.CHAT_INBOX_CONVERSATION_CLICKED,{surface:p,tab:u,type:"dm",conversation_id:t}),a(t,e)},href:(0,Y.Rm)(r.messageThread.id),children:[c&&(0,n.tZ)($.in,{className:L.Z.unreadDot}),(0,n.tZ)(x.qE,{user:m,size:56}),(0,n.BX)(M,{children:[(0,n.BX)(s.X2,{alignItems:"center",gap:8,children:[(0,n.BX)(s.X2,{gap:12,flex:"grow",children:[(0,n.tZ)(s.xv.B3,{weight:"medium",ellipsis:!0,children:m.name}),m.bestseller_tier?(0,n.tZ)(I.UserBadge,{inline:!0,tier:m.bestseller_tier,size:"sm",tooltipOnHover:!0,userId:m.id}):null,"requests"===u&&(0,n.tZ)(J,{item:r})]}),(null==g?void 0:g.comment)&&(0,n.tZ)(s.xv.B5,{color:"secondary",children:(0,W.Z)(g.comment.created_at).chatTime()}),r.isPinned&&(0,n.tZ)(V,{})]}),g&&(0,n.tZ)(F,{unread:c,children:(0,n.tZ)(A,{comment:g.comment,link:null===(o=g.link_metadata)||void 0===o?void 0:o.title,outgoing:(null==v?void 0:v.id)===(null==h?void 0:h.id),fallbackText:r.subtitleBody})})]})]})}function J(e){let{item:t}=e,{iString:i}=(0,_.M1)(),{subscriberContext:o}=t,r=null==o?void 0:o.membershipState,l=r&&["free_signup","subscribed"].includes(r);return o&&l?(0,n.tZ)(k.Vp,{theme:"subscribed"===r?"paid":"default",children:i(o.isFounding?"Founding":"subscribed"===r?"Paid":"Free")}):null}var K=i(8828),G=i(78308),Q=i(67358),ee=i(85200),et=i(5281),ei=i(63018),en=i(36500),eo=i(97842),er=i(60308);function el(e){var t;let{onClick:i}=e,o=(0,eo.RN)();return o.inbox.pendingInviteCount?(0,n.tZ)(s.sg,{className:E()(L.Z.invitesRow),children:(0,n.BX)(j,{onClick:i,children:[(null!==(t=o.inbox.pendingInviteUnreadCount)&&void 0!==t?t:0)>0&&(0,n.tZ)($.in,{className:L.Z.unreadDot}),(0,n.tZ)(s.X2,{width:56,justifyContent:"center",alignItems:"center",children:(0,n.tZ)(Q.Z,{size:20})}),(0,n.tZ)(M,{children:(0,n.BX)(s.X2,{justifyContent:"space-between",alignItems:"center",children:[(0,n.tZ)(s.xv.B3,{weight:"semibold",translated:!0,children:"Requests"}),(0,n.tZ)(s.xv.B4,{color:"secondary",flex:"auto"})]})})]})}):null}function ea(){return(0,n.tZ)(en.v2,{trigger:(0,n.tZ)(s.hU,{"aria-label":"View more",priority:"tertiary",children:(0,n.tZ)(ee.Z,{size:20})}),children:(0,n.tZ)(en.sN,{href:(0,er.v3t)({section:"privacy"}),target:"_blank",leading:(0,n.tZ)(et.Z,{}),children:(0,n.tZ)(s.xv.B3,{weight:"semibold",children:"Messaging settings"})})})}function es(e){let{error:t,items:i,isLoading:r,selectedConversationId:a,onSelect:d}=e,c=(0,z.y)(),{refetch:u}=(0,C.ib)({pathname:"/api/v1/messages/inbox/invites/seen",method:"POST",auto:!1});return(0,o.d4)(()=>{r||(u(),(0,l.j)(l.FP.DIRECT_MESSAGE_REQUESTS_VIEWED,{pending_conversation_requests:i.length,surface:c}))},[r]),(0,n.tZ)(n.HY,{children:t?(0,n.tZ)(n.HY,{children:"'Error'"}):r?(0,n.tZ)(U,{}):(0,n.tZ)(s.sg,{paddingY:12,gap:8,flex:"grow",children:i.length?i.map(e=>(0,n.tZ)(q,{item:e,onSelect:(t,i)=>d(e.messageThread.id,i),isUnread:!e.lastViewedAt,isSelected:a===e.messageThread.id,tab:"requests"},e.id)):(0,n.tZ)(ed,{})})})}function ed(e){let{spam:t}=e;return(0,n.tZ)(s.sg,{flex:"grow",justifyContent:"center",alignItems:"center",sizing:"border-box",children:(0,n.tZ)(T.vJ,{title:t?"No spam requests yet":"No requests yet",body:t?"Message requests that may be low-quality or unwanted will appear here.":"Control whose messages arrive as requests in your Settings.",children:!t&&(0,n.tZ)(s.zx,{priority:"primary-mono",href:(0,er.v3t)({section:"privacy"}),newTab:!0,size:"sm",children:"Go to Settings"})})})}var ec=i(46603),eu=i(95770),ep=i(81043);i(70293);var eh=i(64172),em=i(63651),eg=i(84864);function ev(e){return(0,n.tZ)(s.hU,(0,u._)((0,c._)({priority:"tertiary"},e),{children:(0,n.tZ)(g.Z,{size:20})}))}function ef(e){var t;let{filteredItems:i,inboxItems:r,onSelectInvites:a,onSelectPub:d,onSelectConversation:c,activePub:u,activeConversationId:p}=e,h=(0,y.aF)(),m=(0,z.y)(),g=(0,eo.I0)(),v=(0,eo.RN)(),{inbox:{filter:f}}=v,{isLoading:b}=v.inbox.resources[(0,G.A)(f)],{requireLogin:_}=(0,ep.SJ)(),{refetch:Z}=(0,C.ib)({pathname:"/api/v1/messages/inbox/seen",method:"POST",auto:!1}),w=u&&v.publications.get(u);(0,o.d4)(()=>{b||((0,l.j)(l.FP.THREADS_INBOX_SCREEN_VIEWED,{unread_count:r.filter(e=>ey(e)).length,thread_count:r.length,tab:f,surface:m}),Z())},[b,f]);let S=!r.find(e=>"chat"===e.type?e.publication.id===u:e.messageThreadId===p)&&w?(0,n.tZ)(e_,{item:{id:"chat-".concat(w.id),type:"chat",publication:w,lastViewedAt:null,communityPostId:null,timestamp:null,communityPost:null,user:null,isOwned:!1,isCurrentUserAuthor:!1,title:w.name,paywallStatus:{is_allowed_access:!1,paywall_error:"UNAUTHORIZED"}},onSelect:()=>{},isSelected:!0,isUnread:!1}):null;return(0,n.tZ)(n.HY,{children:h&&b?(0,n.tZ)(U,{}):i.length>0||v.inbox.pendingInviteUnreadCount?(0,n.BX)(eC,{children:[(0,n.tZ)(el,{onClick:a}),S,i.map(e=>"chat"===e.type?(0,n.tZ)(e_,{item:e,onSelect:d,isSelected:u===e.publication.id,isUnread:ey(e)},e.publication.id):(0,n.tZ)(q,{item:e,onSelect:c,isSelected:p===e.messageThread.id,isUnread:ey(e),tab:f},e.messageThread.id))]}):r.length>0?(0,n.tZ)(s.sg,{paddingTop:8,children:(0,n.tZ)(s.sg,{justifyContent:"center",alignItems:"center",flex:"fill",padding:32,children:(0,n.tZ)(T.ld,{title:"No chats found",body:"Please try again with a different search term."})})}):S?(0,n.tZ)(eC,{children:S}):(0,n.tZ)(s.sg,{justifyContent:"center",alignItems:"center",flex:"grow",paddingX:32,children:"chat"===f?(0,n.tZ)(T.vJ,{title:"You don’t have any threads",body:"When one of your subscriptions starts a new thread, it will appear here."}):"direct-message"===f?(0,n.tZ)(T.vJ,{title:"You don’t have any direct messages",body:"When someone sends you one, it will appear here."}):"unread"===f?(0,n.tZ)(T.vJ,{title:"You don’t have any unread messages",body:"When someone sends you one, it will appear here.",children:(0,n.tZ)(s.zx,{priority:"primary-mono",size:"sm",onClick:()=>g({type:"inbox-set_filter",payload:"all"}),children:"Clear filter"})}):(0,n.tZ)(T.vJ,{title:"No messages yet",body:"Send a message to get started.",children:(0,n.tZ)(s.zx,{priority:"primary-mono",size:"sm",href:"/chat/new",onClick:null!==(t=(0,eu.C)(_))&&void 0!==t?t:void 0,children:"Send message"})})})})}function eb(e){var{inboxItems:t}=e,i=(0,p._)(e,["inboxItems"]);let{iString:o}=(0,_.M1)(),r=(0,eo.I0)(),{inbox:{filter:l}}=(0,eo.RN)(),a=m()([{value:"all",label:o("All")},{value:"direct-message",label:o("Direct"),isUnread:t.filter(e=>"direct-message"===e.type&&ey(e)).length>0},{value:"unread",label:o("Unread")}]);return(0,n.tZ)(s.sg,{flex:"auto",style:{position:"sticky",top:0},bg:"primary",zIndex:1,children:(0,n.tZ)(P.n,(0,c._)({value:l,tabs:a.map(e=>{let{value:t,label:i,isUnread:o}=e;return{value:t,label:i,trailingIcon:o?(0,n.tZ)($.in,{className:L.Z.unreadTabDot}):null}}),onChange:e=>{(0,Z._)("/chat"),r((0,K.dd)(e))},ariaLabel:o("Select filter")},i))})}function e_(e){var t,i,o;let{item:r,onSelect:a,isSelected:d,isUnread:c}=e,u=(0,z.y)(),p=(0,y.aF)(),h=(null==r?void 0:null===(t=r.user)||void 0===t?void 0:t.id)===(null==p?void 0:p.id)?"You":null==r?void 0:null===(i=r.user)||void 0===i?void 0:i.name,{filter:m}=(0,eo.RN)().inbox,g="free"!==r.publication.paywall_chat,b=null===(o=r.paywallStatus)||void 0===o?void 0:o.is_allowed_access;return(0,n.BX)(n.HY,{children:[(0,n.BX)(j,{isSelected:d,onClick:e=>{(0,l.j)(l.FP.CHAT_INBOX_CONVERSATION_CLICKED,{type:"publication",publication_id:r.publication.id,tab:m,surface:u}),a(r.publication.id,e)},href:(0,em.xC8)({pubId:r.publication.id}),children:[c&&(0,n.tZ)($.in,{className:L.Z.unreadDot}),(0,n.tZ)(S.wk,{pub:r.publication,size:56,radius:"md",bg:"unset"}),(0,n.BX)(M,{children:[(0,n.BX)(s.X2,{justifyContent:"space-between",alignItems:"center",gap:8,children:[(0,n.tZ)(s.xv.B3,{className:L.Z.sidebarRowTitle,weight:"semibold",ellipsis:!0,children:r.title||r.publication.name}),r.communityPost&&(0,n.tZ)(s.xv.B5,{color:"secondary",weight:"regular",children:(0,W.Z)(r.communityPost.created_at).chatTime()}),g&&!b&&(0,n.tZ)(v.Z,{size:12,color:"var(--color-fg-secondary)"}),g&&b&&(0,n.tZ)(f.Z,{size:12,color:"var(--color-fg-secondary)"}),r.isPinned&&(0,n.tZ)(V,{})]}),r.communityPost?(0,n.BX)(F,{unread:c,children:[h&&"".concat((0,eg.guessFirstName)(h),": "),(0,n.tZ)(eZ,{post:r.communityPost})]}):r.paywallStatus&&!r.paywallStatus.is_allowed_access?(0,n.tZ)(ew,{paywallStatus:r.paywallStatus}):(0,n.tZ)(F,{children:(0,n.tZ)(s.xv,{fontStyle:"italic",children:"Click here to start your subscriber chat"})})]})]}),r.isPrimary?(0,n.tZ)(w.iz,{}):null]})}function ey(e){var t;if("chat"===e.type&&(e.paywallStatus&&!e.paywallStatus.is_allowed_access||!e.publication.threads_v2_enabled||!e.communityPost||e.isCurrentUserAuthor))return!1;let{lastViewedAt:i}=e;if(!i)return!0;let n="chat"===e.type?null===(t=e.communityPost)||void 0===t?void 0:t.created_at:e.timestamp;return!!n&&n>i}function eZ(e){var t,i,o,r;let{post:l}=e,{iPlural:a}=(0,_.M1)(),{isPaid:s,isFounding:d,isAuthor:c}=(0,eh.Y0)(l.publication_id);return l.link_url?(0,n.tZ)(n.HY,{children:l.body?"\uD83D\uDD17 ".concat(l.body):(null===(i=l.link_metadata)||void 0===i?void 0:i.title)?"\uD83D\uDD17 ".concat(null===(o=l.link_metadata)||void 0===o?void 0:o.title):"\uD83D\uDD17 ".concat(null===(r=l.link_metadata)||void 0===r?void 0:r.url)}):l.media_assets&&l.media_assets.length>0?(0,n.tZ)(n.HY,{children:l.body?"\uD83D\uDCF8 ".concat(l.body):a("\uD83D\uDCF8 Image","\uD83D\uDCF8 %1 Images",l.media_assets.length)}):(null==l?void 0:null===(t=l.threadMediaUploads)||void 0===t?void 0:t.length)?(0,n.tZ)(n.HY,{children:l.body?"▶ ".concat(l.body):a("▶ Video","▶ %1 Videos",null==l?void 0:l.threadMediaUploads.length)}):l.body?(0,n.tZ)(n.HY,{children:l.body}):d||c||"only_founding"!==l.audience?s||d||c||"only_paid"!==l.audience?(0,n.tZ)(n.HY,{children:l.body}):(0,n.tZ)(n.HY,{children:"\uD83D\uDD12 Paid subscriber thread"}):(0,n.tZ)(n.HY,{children:"\uD83D\uDD12 Founding member thread"})}let eC=(0,s.E7)({display:"flex",direction:"column"});function ew(e){let{paywallStatus:t}=e,{iString:i}=(0,_.M1)(),{paywall_error:o}=t,r=i("FOUNDING_SUBSCRIPTION_REQUIRED"===o?"Founding members only":"PAID_SUBSCRIPTION_REQUIRED"===o?"Paid subscribers only":"Subscribers only");return(0,n.BX)(s.X2,{alignItems:"center",gap:4,children:[(0,n.tZ)(v.Z,{size:12,color:"var(--color-fg-secondary)"}),(0,n.tZ)(F,{children:r})]})}var eS=i(8113);function eP(){let[e,t]=(0,o.eJ)(!1);return(0,n.tZ)(eS.aM,{surface:"dropdown",children:(0,n.tZ)(s.sg,{flex:"grow",width:360,style:{maxHeight:"80dvh"},color:"primary",children:e?(0,n.tZ)(ek,{onBack:()=>t(!1)}):(0,n.tZ)(eT,{onSelectRequests:()=>t(!0)})})})}function eT(e){let{onSelectRequests:t}=e,i=function(){let{selectedConversationId:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,y.aF)(),i=(0,eo.RN)(),n=(0,eh.Th)(),r=e=>{var t;let{publicationUserMap:i}=null!==(t=n.result)&&void 0!==t?t:{publicationUserMap:new Map},o=i.get(e);return!!(o&&["contributor","admin"].includes(o.role))};return(0,o.Ye)(()=>{let{threads:n,threadList:o,filter:l}=i.inbox,a=m()(o.map(e=>n.get(e))),s=["chat","direct-message"].includes(l),d=[];for(let n of a){var p,h,g;if(!s||n.type===l){if("chat"===n.type){let e=r(n.publication.id);if(!n.communityPostId&&e){d.push((0,u._)((0,c._)({},n),{communityPost:null,user:t,isOwned:e,isCurrentUserAuthor:!0}));continue}let o=n.communityPostId?i.communityPosts.get(n.communityPostId):null,l=null!==(p=null==o?void 0:o.communityPost)&&void 0!==p?p:null;d.push((0,u._)((0,c._)({},n,o),{communityPost:l,user:null!==(h=l&&i.users.get(l.user_id))&&void 0!==h?h:null,isOwned:e,isCurrentUserAuthor:(null==t?void 0:t.id)==(null==l?void 0:l.user_id)}))}else{let o=i.conversations.get(n.messageThreadId),r=null==o?void 0:o.thread,l=null==r?void 0:r.members.find(e=>e.user_id===(null==t?void 0:t.id));if(r&&(null==l?void 0:l.membership_state)==="accepted"){let t=(0,ec._)(i,n);(t||e===r.id)&&d.push((0,u._)((0,c._)({subtitleBody:""},n),{messageThread:r,members:r.members.map(e=>{var t;return null!==(t=i.users.get(e.user_id))&&void 0!==t?t:e.user}),recentMessage:t,timestamp:null!==(g=null==t?void 0:t.comment.created_at)&&void 0!==g?g:n.timestamp}))}}}}if("unread"===l){let e=new Date(0).toISOString();d=d.filter(t=>{var i,n;return(null!==(i=t.timestamp)&&void 0!==i?i:e)>(null!==(n=t.lastViewedAt)&&void 0!==n?n:e)})}return d},[i.inbox.threads,i.inbox.threadList,i.inbox.filter,i.communityPosts,i.conversations,t])}(),{setQuery:r,filteredItems:a}=function(e){let t=(0,z.y)(),i=(0,b.R)({items:e,getKeys:e=>{if("chat"===e.type){var t,i,n;return m()([e.publication.name,...e.publication.contributors.map(e=>e.name),null===(t=e.user)||void 0===t?void 0:t.name,null===(n=e.communityPost)||void 0===n?void 0:null===(i=n.body)||void 0===i?void 0:i.substring(0,80)])}let o=e.messageThread.members;return m()(o.flatMap(e=>{var t;let{user:i}=e;return[i.name,i.handle,null===(t=i.handle)||void 0===t?void 0:t.slice(1)]}))}}),{query:n}=i;return(0,o.d4)(()=>{n&&(0,l.j)(l.FP.CHAT_INBOX_SEARCHED,{surface:t})},[n,t]),i}(i);return(0,n.BX)(n.HY,{children:[(0,n.BX)(s.sg,{gap:8,children:[(0,n.BX)(eI,{children:[(0,n.BX)(eN,{children:[(0,n.tZ)(s.xv.H3,{weight:"heavy",flex:"grow",children:"Chat"}),(0,n.tZ)(ev,{href:(0,Y.gp)(),newTab:!0,onClick:()=>(0,l.j)(l.FP.CHAT_DROPDOWN_NEW_CHAT_CLICKED)})]}),(0,n.tZ)(d.M,{onChange:r,placeholder:"Search chats"})]}),(0,n.tZ)(eb,{inboxItems:i})]}),(0,n.tZ)(eE,{children:(0,n.tZ)(ef,{filteredItems:a,inboxItems:i,onSelectInvites:t,onSelectConversation:e=>{ex((0,Y.Rm)(e))},onSelectPub:e=>{ex((0,Y.aD)(e))}})}),(0,n.tZ)(s.X2,{borderTop:"detail",height:48,flex:"auto",alignItems:"center",justifyContent:"center",children:(0,n.tZ)(s.zx,{priority:"tertiary",href:(0,em.Cnj)(),newTab:!0,onClick:()=>(0,l.j)(l.FP.CHAT_DROPDOWN_SEE_ALL_CLICKED),children:"See all"})})]})}function ex(e){(0,a.uX)(e,{local_navigation:!1,newTab:!0})}function ek(e){let{onBack:t}=e,{data:i,error:o}=(0,ei._I)("/api/v1/messages/dm/invites"),l=function(e){let t=[],i=[...(null==e?void 0:e.threads)||[],...(null==e?void 0:e.spamThreads)||[]];for(let e of null!=i?i:[])if("direct-message"===e.type){var n,o;t.push((0,u._)((0,c._)({},e),{members:e.messageThread.members.map(e=>{let{user:t}=e;return t}),messageThreadId:e.messageThread.id,recentMessageId:null!==(o=null===(n=e.recentMessage)||void 0===n?void 0:n.id)&&void 0!==o?o:null,recentMessage:e.recentMessage?{comment:e.recentMessage,userId:e.recentMessage.user_id}:null}))}return t}(i);return(0,n.BX)(n.HY,{children:[(0,n.tZ)(eI,{children:(0,n.BX)(eN,{children:[(0,n.tZ)(s.hU,{priority:"tertiary",onClick:t,children:(0,n.tZ)(r.Z,{})}),(0,n.tZ)(s.xv.H3,{weight:"heavy",flex:"grow",children:"Requests"}),(0,n.tZ)(ea,{})]})}),(0,n.tZ)(eE,{children:(0,n.tZ)(es,{isLoading:!i,error:o,items:l,onSelect:e=>{ex((0,Y.Rm)(e))}})})]})}let eI=(0,s.E7)({display:"flex",direction:"column",paddingX:16,paddingTop:16,gap:16}),eN=(0,s.E7)({display:"flex",alignItems:"center",height:40,gap:12}),eE=(0,s.E7)({display:"flex",direction:"column",overflowY:"auto",minHeight:0})},95770:function(e,t,i){function n(e){return e?t=>{t.preventDefault(),e()}:null}i.d(t,{C:()=>n}),i(16584),i(98661),i(30396),i(94184),i(43174),i(89734),i(12936),i(42694),i(98585),i(36518),i(85095),i(60807),i(9682),i(98914),i(19081),i(84370),i(58175),i(78118),i(90565),i(71512),i(3573),i(82075),i(22029),i(81043),i(88603),i(7935),i(7779),i(3),i(24641),i(76404),i(57449),i(33740),i(75419),i(30322),i(41233),i(91400),i(64172),i(20521),i(60308),i(33884),i(84864),i(15080)},19434:function(e,t,i){i.d(t,{z:()=>u});var n=i(16584);if(/^(3154|6909)$/.test(i.j))var o=i(32224);if(/^(3154|6909)$/.test(i.j))var r=i(47976);var l=i(40647),a=i(15771),s=i(36500),d=i(50167),c=i(15080);function u(e){let{onNoteClick:t,profile:i,publicationUser:u}=e,p=(0,l.xR)().getConfigFor("show_simple_post_editor");return(0,n.BX)(s.v2,{trigger:(0,n.tZ)(a.hU,{priority:"primary",size:"lg",className:c.Z.cta,"aria-label":"New post",children:(0,n.tZ)(o.Z,{size:24})}),placement:"right",children:[(0,n.tZ)(s.sN,{onClick:()=>t({isPost:!1}),leading:(0,n.tZ)(r.Z,{}),children:"Note"}),p&&(0,n.tZ)(s.sN,{onClick:()=>t({isPost:!0}),leading:(0,n.tZ)(r.Z,{}),children:"Short post"}),i&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(d._T,{profile:i,publicationUser:u}),(0,n.tZ)(d.hC,{profile:i,publicationUser:u})]})]})}},50802:function(e,t,i){i.d(t,{D:()=>x});var n=i(16584);if(/^(3154|6909)$/.test(i.j))var o=i(5281);if(/^(3154|6909)$/.test(i.j))var r=i(72910);if(/^(3154|6909)$/.test(i.j))var l=i(98643);var a=i(20160),s=i(95441),d=i(99259),c=i(60807),u=i(68833),p=i(94874),h=i(15771),m=i(19081),g=i(36500),v=i(84747),f=i(58175),b=i(30396);if(/^(3154|6909)$/.test(i.j))var _=i(25380);var y=i(73857);function Z(){let[e,t]=(0,b.eJ)(localStorage.getItem("colorScheme")),{iString:i}=(0,s.M1)(),o=e=>{document.documentElement.classList.toggle("dark-mode",e)},r=e=>i=>{i.preventDefault(),i.stopPropagation(),localStorage.setItem("colorScheme",e),o("dark"===e),t(e)},l=e=>{e.preventDefault(),e.stopPropagation(),localStorage.removeItem("colorScheme"),o(window.matchMedia("(prefers-color-scheme: dark)").matches),t(null)};return(0,n.BX)(y.L,{content:i("Appearance"),priority:"secondary",children:[(0,n.tZ)(v.u,{trailing:null==e?(0,n.tZ)(_.Z,{}):void 0,onClick:e=>l(e),children:i("Auto")}),(0,n.tZ)(v.u,{trailing:"light"===e?(0,n.tZ)(_.Z,{}):void 0,onClick:e=>r("light")(e),children:i("Light")}),(0,n.tZ)(v.u,{trailing:"dark"===e?(0,n.tZ)(_.Z,{}):void 0,onClick:e=>r("dark")(e),children:i("Dark")})]})}var C=i(65575),w=i(60308),S=i(63651);if(/^(3154|6909)$/.test(i.j))var P=i(47929);var T=i(15080);function x(){var e;let t=(0,c.aF)(),{iString:i}=(0,s.M1)(),b=(0,d.M$)().isOnDestination,_=P.b3.userMenu,y="https://support.substack.com/hc/en-us/?utm_source=".concat(_),x=(null==t?void 0:t.subdomain)&&(null==t?void 0:null===(e=t.dashboard_pubs)||void 0===e?void 0:e.length)!==1;return t?(0,n.BX)(v.M,{trigger:(0,n.tZ)(h.kG,{className:T.Z.navItem,height:56,width:56,tabIndex:0,animate:!0,resetCss:!0,children:(0,n.tZ)(p.qE,{user:t,size:36,"aria-hidden":!0})}),ariaLabel:"Profile and settings",className:T.Z.profileMenu,maxHeight:"none",layerOptions:{placement:"right-end",triggerOffset:16},children:[(0,n.tZ)(a.W,{children:(0,n.tZ)(v.u,{href:t.profile_set_up_at?(0,S.NNq)(t,{noBase:b,utm_source:_,utm_content:b?void 0:P.fZ.islandDesktopNavSidebar}):(0,S.Nhr)({utm_source:"substack",utm_campaign:"left-nav",redirect:document.location.href}),native:!t.profile_set_up_at,children:(0,n.BX)(m.hs,{gap:12,alignItems:"center",children:[(0,n.tZ)(p.qE,{user:t,size:40}),(0,n.BX)(C.tu,{flex:"grow",children:[(0,n.tZ)(f.xv.B4,{weight:"semibold",children:t.name}),(0,n.tZ)(f.xv.B4,{color:"secondary",children:i("View profile")})]})]})})}),(0,n.BX)(g.xw,{children:[x&&(null==t?void 0:t.subdomain)&&(0,n.tZ)(v.u,{leading:(0,n.tZ)(o.Z,{}),href:(0,w.c0Q)(t.subdomain,{params:{utm_source:_}}),native:!0,children:i("Dashboard")}),(0,n.tZ)(v.u,{leading:(0,n.tZ)(r.Z,{}),href:(0,S.ekm)(),children:i("History")}),(0,n.tZ)(v.u,{leading:(0,n.tZ)(l.Z,{}),href:"/archive",children:i("Archive")})]}),(0,n.BX)(g.xw,{children:[b&&(0,n.tZ)(Z,{}),(0,n.tZ)(v.u,{href:(0,w.v3t)({utm_source:_}),onClick:()=>(0,u.j)(u.FP.USER_MENU_ACCOUNT_SETTINGS_CLICKED),priority:"secondary",native:!0,children:i("Settings")}),(0,n.tZ)(v.u,{href:y,priority:"secondary",children:i("Support")}),(0,n.tZ)(v.u,{href:(0,w.ZPN)({utm_source:_}),priority:"secondary",native:!0,children:i("Sign out")})]})]}):null}},3561:function(e,t,i){if(i.d(t,{u:()=>y}),/^(3154|6909)$/.test(i.j))var n=i(7409);if(/^(3154|6909)$/.test(i.j))var o=i(99282);if(/^(3154|6909)$/.test(i.j))var r=i(98848);var l=i(16584),a=i(56232),s=i(87077),d=i(94184),c=i.n(d),u=i(78327),p=i(19081),h=i(45985);function m(e){let{className:t}=e;return(0,l.tZ)(p.hs,{alignItems:"center",justifyContent:"center",radius:"full",className:c()(h.Z.dotContainer,t),children:(0,l.tZ)("div",{className:h.Z.dot})})}var g=i(2207);if(/^(3154|6909)$/.test(i.j))var v=i(41427);if(/^(3154|6909)$/.test(i.j))var f=i(47929);var b=i(15080);function _(e){let{className:t,href:i,matchSubpaths:n,icon:o,isActive:r,activeIcon:a=o,native:s,badge:d,dot:h,forwardedRef:_,requireLogin:y,onClick:Z,label:C}=e,w="undefined"!=typeof location?location.pathname:"",S=y?e=>{e.preventDefault(),y()}:null,P=void 0!==r?r:i&&(n?(0,v.h)(w,i):(0,v.M)(w,i));return(0,l.BX)(g.C,{className:c()(b.Z.navItem,t),href:y?null:i&&"".concat(i,"?").concat(new URLSearchParams({utm_source:w,utm_medium:f.lP.reader2Nav})),tabIndex:0,matchSubpaths:n,native:!!y||s,onClick:Z||S||void 0,forwardedRef:_,height:56,width:56,showFocus:!0,animate:!0,"aria-current":P?"page":void 0,"aria-label":C,children:[P?(0,l.tZ)(p.hs,{children:a}):(0,l.tZ)(p.hs,{className:b.Z.navIcon,children:o}),d?(0,l.tZ)(u.V,{className:b.Z.badge,count:d}):null,h&&!d&&(0,l.tZ)(m,{className:b.Z.dot})]})}function y(e){var{matchSubpaths:t=!0}=e,i=(0,r._)(e,["matchSubpaths"]);return(0,l.tZ)(a.Match,{children:()=>(0,l.tZ)(s.u,{text:i.label?i.label:"",layerOptions:{placement:"right-center",triggerOffset:8},disabled:!i.label,children:(0,l.tZ)(_,(0,o._)((0,n._)({},i),{matchSubpaths:t}))})})}},13434:function(e,t,i){i.d(t,{P:()=>p});var n=i(16584),o=i(94184),r=i.n(o),l=i(78327),a=i(2207),s=i(95770);if(/^(3154|6909)$/.test(i.j))var d=i(41427);if(/^(3154|6909)$/.test(i.j))var c=i(47929);var u=i(15080);function p(e){let{href:t,children:i,requireLogin:o,badge:p,icon:h,activeIcon:m,native:g,className:v}=e,f="undefined"!=typeof location?location.pathname:"",b=m?t&&((0,d.h)(f,t)?m:h):h,_=(0,s.C)(o);return(0,n.BX)(a.C,{className:r()("reader2-mobile-nav-icon",v),href:o?null:"".concat(t,"?").concat(new URLSearchParams({utm_source:f,utm_medium:c.lP.reader2Nav})),native:g,onClick:null!=_?_:void 0,onPointerDown:()=>{},children:[b,i,p?(0,n.tZ)(l.V,{count:p,className:u.Z.badge}):null]})}},72260:function(e,t,i){i.d(t,{L:()=>a});var n=i(27484),o=i.n(n),r=i(99259),l=i(97842);function a(e){var t,i,n,a,s;let{chatLastClicked:d}=e,c=(0,l.RN)(),u=(0,r.M$)().isOnDestination,p=(0,l.WG)({},{focusThrottleInterval:3e5});if(!u)return{chatUnreadCount:null!==(n=null===(i=p.data)||void 0===i?void 0:i.unreadCount)&&void 0!==n?n:0,useChatBadge:!1};let h=null!==(a=c.inbox.directMessagesUnreadCount)&&void 0!==a?a:0,m=null!==(s=null==c?void 0:null===(t=c.inbox)||void 0===t?void 0:t.pubChatUnreadCount)&&void 0!==s?s:0,g=0===h&&m>0&&c.inbox.mostRecentChatTimestamp&&(!d||d.isBefore(o()(c.inbox.mostRecentChatTimestamp)));return{chatUnreadCount:h,useChatBadge:g}}},4953:function(e,t,i){i.d(t,{w:()=>n});function*n(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;for(let n=e;nh,Ap:()=>c,Vu:()=>g,kF:()=>u,ob:()=>m});var n=i(7409),o=i(99282);i(56303);var r=i(14293),l=i.n(r),a=i(84864);let s=/^(4716|5288)$/.test(i.j)?[{regex:/\((\d{2}):(\d{2}):(\d{2})\):/,parse:e=>3600*parseInt(e[1])+60*parseInt(e[2])+parseInt(e[3])},{regex:/\((\d{2}):(\d{2})\):/,parse:e=>60*parseInt(e[1])+parseInt(e[2])},{regex:/\((\d{2}:\d{2}\.\d{1,3})\)/,parse:e=>{let[t,i]=e[1]?e[1].split(":").map(parseFloat):[0,0];return 60*t+i}}]:null,d=/^(4716|5288)$/.test(i.j)?[{regex:/^(.*?[\w\s’‘,.'-]*)\s\(\d{2}:\d{2}:\d{2}\):/,parse:e=>e[1]},{regex:/^(.*?[\w\s’‘,.'-]*)\s\(\d{2}:\d{2}\):/,parse:e=>e[1]},{regex:/^(.*?[\w\s’‘,.'-]*)\s*\(\d{2}:\d{2}\.\d{1,3}\)$/,parse:e=>e[1]}]:null,c=e=>{let{rows:t,maxWordsPerRow:i=60}=e;if(l()(t[0]))return[];let r=[],a=(0,o._)((0,n._)({},t[0]),{words:t[0].words.map(e=>(0,o._)((0,n._)({},e),{originalIndex:0}))});for(let e=1;e(0,o._)((0,n._)({},t),{originalIndex:e}))});a.speaker===s.speaker&&a.words.length+s.words.length<=i?a={start:a.start,end:s.end,text:"".concat(a.text," ").concat(s.text),words:a.words.concat(...s.words),speaker:a.speaker}:(r.push(a),a=s)}return r.push(a),r},u=(e,t)=>{let i=e.split("\n"),r=[],l="",a="",c=0,u=0,p=new Set,h={},m=0;return i.forEach((e,n)=>{var o,g;let v=null!==(o=s.find(t=>!!e.match(t.regex)))&&void 0!==o?o:null,f=null!==(g=d.find(t=>!!e.match(t.regex)))&&void 0!==g?g:null,b=e.trim();if(v){let t=e.match(v.regex);t&&(u=v.parse(t),a&&(r.push({speaker:h[l],start:c,end:u,text:a.trim(),words:[]}),a=""),c=u,b=b.replace(v.regex,""))}if(f){let t=e.match(f.regex);t&&(l=f.parse(t),p.has(l)||(p.add(l),h[l]="SPEAKER_".concat(m++)),a+="".concat(b.substring(l.length)," "))}else""!==b.trim()&&(a+="".concat(b," "));n===i.length-1&&a&&r.push({speaker:h[l],start:c,end:t,text:a.trim(),words:[]})}),[{segments:r},Object.entries(h).reduce((e,t)=>(0,o._)((0,n._)({},e),{[t[1]]:t[0]}),{})]};function p(e){let[t,i,n]=e.split(":").map(parseFloat);return 3600*t+60*i+n}let h=e=>{let t=e.split("\n").map(e=>e.trim()),i=[],r=new Set,a={},s=0;for(let e=0;ee.trim()),d=p(n[0]),c=p(n[1]);e++;let u=[],h="";for(;e]+)>/);if(e&&e[1]){h=e[1].trim(),r.has(h)||(r.add(h),a[h]="SPEAKER_".concat(s++));let t=i.indexOf(">")+1;t(0,o._)((0,n._)({},e),{[t[1]]:t[0]}),{})]},m=e=>e?e.segments.some(e=>!e.text)?"Segment text is missing":e.segments.some(e=>l()(e.end)||l()(e.start))?"Segment start or end time is missing":null:"Transcription is missing",g=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[];return e.forEach(e=>{var n;let o=t[null!==(n=e.speaker)&&void 0!==n?n:""],r="(".concat((0,a.secondsToHHMMSS)(e.start,{strict:!0}),"):\n").concat(e.text.trim(),"\n");o?i.push("".concat(o," ").concat(r)):i.push(r)}),i.join("\n")}}}]);