/*! For license information please see 2498.dd2ac591.js.LICENSE.txt */ (self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["2498"],{31190:function(e,t,i){"use strict";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"}},52478:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=2787!=i.j?{dragArea:"dragArea-sMT00C",dragActive:"dragActive-g1aWbC",text:"text-ehFyYa",file:"file-P3qftv"}:null},78691:function(e,t,i){"use strict";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},56029:function(e,t,i){var n=i(33448);e.exports=function(e,t,i){for(var r=-1,o=e.length;++rt}},89179:function(e,t,i){var n=i(55639),r=i(40554),o=i(14841),a=i(79833),l=n.isFinite,s=Math.min;e.exports=function(e){var t=Math[e];return function(e,i){if(e=o(e),(i=null==i?0:s(r(i),292))&&l(e)){var n=(a(e)+"e").split("e");return+((n=(a(t(n[0]+"e"+(+n[1]+i)))+"e").split("e"))[0]+"e"+(+n[1]-i))}return t(e)}}},8400:function(e,t,i){var n=i(14259),r=i(16612),o=i(40554),a=Math.ceil,l=Math.max;e.exports=function(e,t,i){t=(i?r(e,t,i):void 0===t)?1:l(o(t),0);var s=null==e?0:e.length;if(!s||t<1)return[];for(var d=0,c=0,u=Array(a(s/t));dn});let n=(0,i(36150).Z)("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]])},52990:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=(0,i(36150).Z)("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]])},47655:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=(0,i(36150).Z)("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]])},84967:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=(0,i(36150).Z)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},11043:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=(0,i(36150).Z)("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]])},38464:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=(0,i(36150).Z)("Headphones",[["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",key:"1xhozi"}]])},20817:function(e,t,i){"use strict";i.d(t,{Z:()=>n});let n=(0,i(36150).Z)("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]])},8131:function(e,t,i){"use strict";if(i.d(t,{Z:()=>P}),4716==i.j)var n=i(58865);var r=i(16584),o=i(98661),a=i(30396),l=i(94184),s=i.n(l),d=i(8400),c=i.n(d),u=i(23279),p=i.n(u),h=i(23493),m=i.n(h),g=i(80569),v=i.n(g),f=i(93666),b=i(95441),w=i(15771),y=i(19081),_=i(98248),Z=i(58175),C=i(60308);let x=4716==i.j?{search:"search-GFq41a",presetRow:"presetRow-qZS76T",presetRowContainer:"presetRowContainer-XmnGot",fade:"fade-Z_mZfF",preset:"preset-ikTtJa",selected:"selected-L0vQ3m",presetImage:"presetImage-fEP9jz",unselected:"unselected-TRcwOG",presetName:"presetName-apjTm3",modalBody:"modalBody-h6TeXI"}:null;function S(){let e=(0,n._)(["No results for “","”"]);return S=function(){return e},e}let k=e=>e.toLowerCase().trim()||"random",N=()=>{let{iString:e}=(0,b.M1)();return[{id:"B&W",name:e("B&W"),imageUrl:"/img/generate-presets/bw-portrait.jpg",prompt:()=>"B&W close up portrait, ambient light, Nikon 15mm f/1.8G, by Lee Jeffries, Alessio Albi, Adrian Kuipers"},{id:"Photo",name:e("Photo"),imageUrl:"/img/generate-presets/photo.jpg",prompt:()=>"Professional photography, bokeh, natural lighting, canon lens, shot on dslr 64 megapixels sharp focus"},{id:"Comic",name:e("Comic"),imageUrl:"/img/generate-presets/comic.jpg",prompt:()=>"Mark Brooks and Dan Mumford, comic book art, perfect, smooth cell shading"},{id:"Logo",name:e("Logo"),imageUrl:"/img/generate-presets/logo.jpg",prompt:()=>"2d, flat, vector illustration, football team emblem, logo, centered, sharp, clean linework, head-on"},{id:"Anime",name:e("Anime"),imageUrl:"/img/generate-presets/anime.jpg",prompt:()=>"Studio Ghibli, Anime Key Visual, by Makoto Shinkai, Deep Color, Intricate, 8k resolution concept art, Natural Lighting, Beautiful Composition"},{id:"Pixel",name:e("Pixel"),imageUrl:"/img/generate-presets/pixel.jpg",prompt:()=>"as a logo, 16-bit, Pixel, SNES Style, Susan Kare, Highly detailed, Modern, Simple Background"},{id:"Paint",name:e("Paint"),imageUrl:"/img/generate-presets/vangough.jpg",prompt:()=>{let e=["Van Gogh","John Sargent","Josephine Wall","Claude Monet","Edward Hopper","Edvard Munch","Gustav Klimt","Henry Asencio","Paul Cezanne","J M W Turner","Pablo Picasso"],t=e[Math.floor(Math.random()*e.length)];return"by ".concat(t,", oil painting, canvas, expressive, colorful")}},{id:"Blur",name:e("Blur"),imageUrl:"/img/generate-presets/richter.jpg",prompt:()=>"gerhard richter, photorealistic painting, motion blur"},{id:"Epic",name:e("Epic"),imageUrl:"/img/generate-presets/epic.jpg",prompt:()=>"Epic cinematic brilliant stunning intricate meticulously detailed dramatic atmospheric maximalist digital matte painting"},{id:"Toon",name:e("Toon"),imageUrl:"/img/generate-presets/cartoon.jpg",prompt:()=>"Pixar, Disney, concept art, 3d digital art, Maya 3D, ZBrush Central 3D shading, bright colored background, radial gradient background, cinematic, Reimagined by industrial light and magic, 4k resolution post processing"},{id:"Neon",name:e("Neon"),imageUrl:"/img/generate-presets/neon.jpg",prompt:()=>"synthwave, bladerunner, neon lights, midnight 80s vibe"},{id:"Etching",name:e("Etching"),imageUrl:"/img/generate-presets/lithograph.jpg",prompt:()=>"Lithography, letterpress intaglio mezzotint linocut"}]},P=4716==i.j?e=>{var t;let{open:i,onAfterClose:n,onImageSelected:l,onUrlSelected:d,insertionPointSelector:u,className:h=""}=e,{iString:g,iTemplate:P}=(0,b.M1)(),T=N();l&&d&&console.error("onImageSelected and onUrlSelected are mutually exclusive");let[E,I]=(0,a.eJ)(""),[B,D]=(0,a.eJ)(""),[R,L]=(0,a.eJ)(null),[M,U]=(0,a.eJ)(!1),[X,j]=(0,a.eJ)(!1),A=(0,a.sO)(null),O=(0,a.sO)(null),F=(0,a.sO)(null),[H,z]=(0,a.eJ)(!1),[V,q]=(0,a.eJ)(null);(0,a.d4)(()=>(i&&(A.current.open(),setTimeout(()=>{O.current.focus()},50)),()=>{L(null),I(""),D(""),q(null)}),[i]),(0,a.d4)(()=>{let e=m()(()=>{},200,{leading:!1}),t=F.current;return i&&(null==t||t.addEventListener("scroll",e)),()=>{null==t||t.removeEventListener("scroll",e)}},[i]);let J=(0,a.I4)(async e=>{let{prompt:t,style:i}=e,n=k(t);try{U(!1),z(!0);let e=await v().post("/api/v1/generate_image/generate_art").send({prompt:n,style:i,num_images:4});D(E),z(!1),U(!1),L(i=>e.body.map(e=>({prompt:t,uri:e})).concat(null!=i?i:[])),F.current.scrollTop=0}catch(e){console.error("error searching images:",e),(null==e?void 0:e.status)===429?(alert("Image generation is limited to 6 requests per minute. Please try again in a minute."),z(!1)):(L(null),z(!1),U(!0))}},[E]),Y=(0,a.I4)(p()(J,400),[J]),W=async e=>{var t;I(e);let i=T.find(e=>V===e.id);await Y({prompt:e,style:null!==(t=null==i?void 0:i.prompt())&&void 0!==t?t:""})},K=null!==(t=document.querySelector(u))&&void 0!==t?t:document.body,G=async e=>{j(!0);try{if(d)await d({url:e.uri,prompt:e.prompt});else if(l){z(!0);let t=await v().post("/api/v1/generate_image/get_img_as_blob").send({url:e.uri}).responseType("blob");z(!1),U(!1),await l(t.body)}else console.error("no onSelected callback set")}catch(e){U(!0),z(!1)}j(!1),A.current.close()},$=!!(H&&!(null==R?void 0:R.length)),Q=!!(H&&(null==R?void 0:R.length));return(0,o.createPortal)((0,r.tZ)("div",{onMouseDown:e=>{e.stopPropagation()},children:(0,r.BX)(f.p,{ref:A,closePill:!0,className:s()("insert-media-modal","insert-image-modal","insert-generated-image-modal","force-light-theme",h),onClose:n,children:[(0,r.tZ)("h3",{className:"insert-media-modal-header",children:g("Generate image")}),(0,r.BX)(y.tu,{gap:12,flex:"grow",children:[(0,r.tZ)("div",{className:"form new-form",children:(0,r.tZ)("form",{onSubmit:e=>{e.preventDefault(),W(E)},children:(0,r.BX)(y.tu,{gap:8,children:[(0,r.BX)(y.gq,{gap:8,children:[(0,r.tZ)("input",{className:"insert-image-modal-search",ref:O,type:"text","aria-label":g("Prompt"),placeholder:g("Describe what you want to create..."),value:E,onChange:e=>{I(e.target.value)}}),(0,r.tZ)(w.zx,{type:"submit",onClick:()=>{W(E)},disabled:H,children:g("Generate")})]}),(0,r.BX)(y.tu,{gap:8,children:[(0,r.tZ)(Z.xv.Meta,{translated:!0,children:"Select a style (Optional)"}),(0,r.BX)(y.gq,{className:x.presetRowContainer,children:[(0,r.tZ)("div",{className:x.fade}),(0,r.tZ)(y.gq,{className:x.presetRow,gap:8,justifyContent:"start",alignItems:"start",paddingRight:32,paddingBottom:8,children:T.map(e=>(0,r.BX)(y.tu,{gap:4,justifyContent:"center",className:s()(x.preset,{[x.selected]:V===e.id,[x.unselected]:V&&V!==e.id}),onClick:()=>{V===e.id?q(null):q(e.id)},children:[(0,r.tZ)("img",{className:x.presetImage,src:(0,C.zF4)(e.imageUrl,144),alt:e.name}),(0,r.tZ)(Z.xv.Meta,{className:x.presetName,children:e.name})]}))})]})]})]})})}),(0,r.BX)("div",{className:s()("insert-image-modal-body",x.modalBody),ref:F,children:[M&&(0,r.tZ)("div",{className:"insert-image-modal-empty",children:g("Something went wrong. Please try again later.")}),$||X?R&&0===R.length?(0,r.tZ)("div",{className:"insert-image-modal-empty",children:P(S(),B)}):(0,r.tZ)("div",{className:"insert-image-modal-empty",children:$||X?(0,r.BX)(y.tu,{gap:8,alignItems:"center",justifyContent:"center",children:[(0,r.tZ)(_.$j,{}),(0,r.tZ)(Z.xv,{font:"text",translated:!0,children:"Generating images…"})]}):(0,r.tZ)(Z.xv,{font:"text",translated:!0,children:"Enter a prompt above to generate an image"})}):(0,r.BX)(y.tu,{gap:12,className:"insert-image-modal-images",children:[Q&&(0,r.BX)(y.gq,{gap:8,alignItems:"center",justifyContent:"center",children:[(0,r.tZ)(_.$j,{}),(0,r.tZ)(Z.xv,{font:"text",translated:!0,children:"Generating images…"})]}),c()(R,2).map(e=>(0,r.tZ)(y.gq,{gap:12,children:e.map((e,t)=>(0,r.BX)("div",{className:"insert-image-modal-item",onClick:()=>{G(e)},children:[(0,r.tZ)("img",{src:e.uri}),(0,r.tZ)("div",{className:"insert-image-modal-item-footer",children:(0,r.tZ)(w.zx,{priority:"secondary",disabled:X,children:g("Insert")})})]},t))}))]})]})]})]})}),K)}:null},91925:function(e,t,i){"use strict";i.d(t,{s:()=>o});var n=i(16584),r=i(4615);function o(e){let{children:t}=e;return(0,n.tZ)(r.f6,{theme:"coverTheme-PJLqY5",children:t})}},16564:function(e,t,i){"use strict";i.d(t,{KH:()=>I,MR:()=>C,PN:()=>x,YX:()=>B,_g:()=>S,cM:()=>T,ko:()=>k,nO:()=>E});var n,r,o,a=i(7409),l=i(99282),s=i(58865),d=i(16584),c=i(94184),u=i.n(c),p=i(1852),h=i(86657);i(36081),i(36813);var m=i(99987),g=i(1055),v=i(72708),f=i(95441);i(68833);var b=i(15771),w=i(6490),y=i(84864),_=i(72925);function Z(){let e=(0,s._)(["Playback rate ",""]);return Z=function(){return e},e}var C=((n={}).Embed="Embed audio",n.Voiceover="Add voiceover",n.Podcast="Audio",n.PodcastPreview="Podcast free version",n.VideoPodcast="Video",n.ShareQuote="Share quote",n),x=4716==i.j?((r={}).Embed="Upload or record an audio file embedded into the text.",r.Voiceover="Upload or record a new voiceover: an audio version of your post.",r.Podcast="Create a new audio post by uploading or recording an audio file.",r.PodcastPreview="Upload a file that will appear to free users on the website and in their feeds.",r.VideoPodcast="Create a new video post by uploading or recording a video file. The audio from your video will be delivered to podcast players if selected in the publish settings.",r.ShareQuote="Upload or record an audio file that will be used as a share quote.",r):null,S=((o={})[o.PubAccent=0]="PubAccent",o[o.PubFull=1]="PubFull",o[o.Substack=2]="Substack",o);let k=e=>{let{containerRef:t,currentTime:i,remainingTime:n,progress:r,onMouseDown:o,shouldCollapseOnMobile:a=!1,theme:l=1}=e;return(0,d.BX)("div",{className:"tw-flex tw-grow tw-items-center tw-gap-3 tw-font-meta tw-text-sm tw-text-substack-primary sm:tw-gap-3","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":100*r,children:[(0,d.tZ)("div",{className:u()("tw-min-w-[40px] tw-text-right",{"tw-hidden sm:tw-block":a}),children:i}),(0,d.BX)("div",{ref:t,className:u()("tw-relative tw-h-5 tw-grow ",{"tw-ml-2 sm:tw-ml-0":a}),onMouseDown:o,children:[(0,d.tZ)("div",{className:u()("audio-progress-bar tw-absolute tw-top-2 tw-right-0 tw-left-0 tw-h-1 tw-rounded",{"tw-bg-pub-detail":1===l,"tw-bg-substack-detail":1!==l})}),(0,d.tZ)("div",{className:u()("tw-absolute tw-top-2 tw-left-0 tw-h-1 tw-rounded-l-full",{"tw-bg-pub-accent":2!==l,"tw-bg-substack-accent":2===l}),style:{width:"".concat(100*r,"%")}}),(0,d.tZ)("div",{className:u()("audio-playhead tw-absolute tw-ml-[-10px] tw-h-4 tw-w-4 tw-rounded-full tw-border-2 tw-border-solid ",{"tw-border-pub-background":1===l,"tw-border-substack-bg":1!==l,"tw-bg-substack-accent":2===l,"tw-bg-pub-accent":2!==l}),style:{left:"".concat(100*r,"%")}})]}),(0,d.tZ)("div",{className:"tw-min-w-[40px]",children:n})]})},N=[{value:1,display:"1"},{value:1.25,display:"1.25"},{value:1.5,display:"1.5"},{value:1.75,display:"1.75"},{value:2,display:"2"}],P=e=>{var t;let{onSetPlaybackRate:i,playbackRate:n,className:r}=e,o=N.findIndex(e=>{let{value:t}=e;return t===n}),{iTemplate:a}=(0,f.M1)(),l=(null==N?void 0:null===(t=N[o])||void 0===t?void 0:t.display)?"".concat(null==N?void 0:N[o].display,"x"):"";return(0,d.BX)("div",{onClick:()=>{let e=(o+1)%N.length;i(N[e].value)},className:r,"aria-label":a(Z(),l),children:[N[o].display,"\xd7"]})},T=e=>{let{iString:t}=(0,f.M1)();return(0,d.tZ)(h.Z,(0,l._)((0,a._)({},e),{metricsPost:e.post,feature:"Embed audio",render:i=>{let{currentTime:n,isPlaying:r,progress:o,progressBarRef:a,progressBarOnMouseDown:l,remainingTime:s,playbackRate:c,setPlaybackRate:u,togglePlayback:p}=i;return(0,d.BX)("div",{"data-component-name":"AudioEmbedPlayer","data-drag-handle":"",className:"audio-embed tw-my-4 tw-box-border tw-flex tw-w-full tw-select-none tw-items-center tw-gap-4 tw-space-y-0 tw-rounded-full tw-bg-pub-wash tw-p-4 tw-font-sans sm:tw-gap-5",role:"region","aria-label":t("Audio embed player"),children:[(0,d.tZ)(P,{onSetPlaybackRate:u,playbackRate:c,className:"audio-button tw-w-12 tw-cursor-pointer tw-rounded-full tw-border tw-border-solid tw-border-pub-detail-light tw-py-1 tw-text-center tw-font-meta tw-text-sm tw-font-semibold tw-leading-none tw-text-pub-secondary-text hover:tw-border-pub-detail"}),(0,d.BX)("div",{className:"tw-flex tw-w-full tw-flex-wrap",children:[e.label&&(0,d.tZ)("div",{className:"tw-basis-full tw-pb-2 tw-text-ssm tw-font-semibold tw-text-pub-primary-text",children:e.label}),(0,d.tZ)("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-gap-2 sm:tw-gap-4",children:(0,d.tZ)(k,{currentTime:n,remainingTime:s,containerRef:a,progress:o,onMouseDown:l})})]}),(0,d.tZ)("div",{className:"audio-embed-play-button tw-relative tw-flex tw-h-12 tw-w-12 tw-shrink-0 tw-cursor-pointer tw-items-center tw-justify-center tw-rounded-full tw-border-2 tw-border-solid tw-border-pub-detail tw-bg-pub-background tw-transition-transform hover:tw-scale-105",onClick:p,role:"button","aria-label":t("Play/pause"),children:r?(0,d.BX)("div",{className:"tw-flex tw-h-5 tw-w-4 tw-justify-between",children:[(0,d.tZ)("div",{className:"pause-icon tw-h-full tw-w-1/3 tw-rounded-sm tw-bg-pub-accent"}),(0,d.tZ)("div",{className:"pause-icon tw-h-full tw-w-1/3 tw-rounded-sm tw-bg-pub-accent"})]}):(0,d.tZ)(g.Z,{className:"tw-relative tw-left-[.1rem] tw-fill-pub-accent",stroke:"none",height:18})})]})}}))},E=e=>{var t;let{pub:i,post:n,duration:r,label:o}=e,{iString:a}=(0,f.M1)();return(0,d.tZ)("table",{"data-component-name":"AudioEmbedPlayerStatic",className:"tw-w-full tw-rounded-full tw-bg-substack-wash",children:(0,d.tZ)("tr",{children:(0,d.tZ)("td",{className:"tw-text-center tw-font-meta tw-text-ssm tw-uppercase tw-text-substack-primary",children:(0,d.BX)("a",{href:null==n?void 0:n.canonical_url,className:u()("tw-block tw-w-full tw-p-4 tw-text-substack-primary",_.Z.noUnderline),children:[(0,d.tZ)(m.Z,{className:"tw-w-max-4 tw-mr-2 tw-inline-block tw-w-4 tw-align-middle",stroke:null===(t=i.theme)||void 0===t?void 0:t.background_pop_color,isStatic:!0}),(0,d.BX)("span",{className:"tw-align-middle",children:[(0,y.truncateText)(o,10)||a("Listen now")," \xb7 ",(0,y.secondsToHHMMSS)(r||0)]})]})})})})},I=e=>{let t=(0,p.useMediaQuery)({maxWidth:631}),i="/api/v1/audio/upload/".concat(e.mediaUploadId,"/src"),{iString:n}=(0,f.M1)();return(0,d.tZ)(h.Z,(0,l._)((0,a._)({},e),{src:i,feature:"Add voiceover",metricsPost:e.post,render:e=>{let{isPaywalled:i,currentTime:r,isPlaying:o,progress:a,progressBarRef:l,progressBarOnMouseDown:s,remainingTime:c,playbackRate:u,setPlaybackRate:p,togglePlayback:h}=e;return(0,d.BX)("div",{className:"tw-mb-6 tw-flex sm:tw-gap-1",children:[(0,d.tZ)("div",{className:"tw-hidden tw-h-20 tw-shrink-0 tw-basis-20 tw-items-center tw-justify-center tw-rounded-md tw-bg-pub-wash tw-fill-pub-primary-text tw-text-pub-primary-text sm:tw-flex",children:(0,d.tZ)(v.Z,{className:"tw-stroke-pub-secondary-text"})}),(0,d.BX)("div",{className:"tw-box-border tw-flex tw-h-20 tw-w-full tw-select-none tw-items-center tw-gap-3 tw-space-y-0 tw-rounded-l-md tw-rounded-r-[64px] tw-bg-pub-wash tw-p-4 tw-font-sans",children:[i?(0,d.tZ)("div",{className:"tw-flex tw-w-full tw-flex-wrap tw-justify-center tw-text-ssm tw-text-pub-secondary-text sm:tw-text-sm",children:n("Upgrade to paid to play voiceover")}):(0,d.BX)("div",{className:"tw-flex tw-w-full tw-flex-wrap",children:[(0,d.tZ)("div",{className:"tw-basis-full tw-pb-2 tw-text-ssm tw-font-semibold tw-uppercase tw-text-pub-secondary-text",children:n("Article voiceover")}),(0,d.BX)("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-gap-2 ",children:[(0,d.tZ)(P,{onSetPlaybackRate:p,playbackRate:u,className:"tw-w-12 tw-cursor-pointer tw-rounded-full tw-border tw-border-solid tw-border-pub-detail-light tw-py-1 tw-text-center tw-font-meta tw-text-sm tw-font-semibold tw-leading-none tw-text-pub-secondary-text hover:tw-border-pub-detail"}),(0,d.tZ)(k,{currentTime:r,remainingTime:c,containerRef:l,progress:a,onMouseDown:s,shouldCollapseOnMobile:!0})]})]}),i?(0,d.tZ)("div",{className:"tw-relative tw-flex tw-h-14 tw-w-14 tw-shrink-0 tw-cursor-not-allowed tw-items-center tw-justify-center tw-rounded-full tw-border-2 tw-border-solid tw-border-pub-detail tw-bg-pub-background tw-transition-transform",children:(0,d.tZ)(g.Z,{className:"tw-relative tw-left-[.15rem] tw-fill-pub-detail",stroke:"none",height:t?20:24})}):(0,d.tZ)("div",{className:"tw-relative tw-flex tw-h-14 tw-w-14 tw-shrink-0 tw-cursor-pointer tw-items-center tw-justify-center tw-rounded-full tw-border-2 tw-border-solid tw-border-pub-detail tw-bg-pub-background tw-transition-transform hover:tw-scale-105",onClick:h,role:"button",children:o?(0,d.BX)("div",{className:"tw-flex tw-h-5 tw-w-5 tw-justify-between",children:[(0,d.tZ)("div",{className:"tw-h-full tw-w-1/3 tw-rounded-sm tw-bg-pub-accent"}),(0,d.tZ)("div",{className:"tw-h-full tw-w-1/3 tw-rounded-sm tw-bg-pub-accent"})]}):(0,d.tZ)(g.Z,{className:"tw-relative tw-left-[.15rem] tw-fill-pub-accent",stroke:"none",height:20})})]})]})}}))},B=e=>{let{isOpen:t,onDismiss:i}=e,{iString:n}=(0,f.M1)();return(0,d.BX)(w.u_,{isOpen:t,onClose:i,children:[(0,d.tZ)(w.xB,{showClose:!1,title:n("Something went wrong...")}),(0,d.tZ)(w.fe,{children:n("Unfortunately, there was a problem with your audio file upload. We'll investigate, but in the meantime, please try again, and we apologize for the inconvenience.")}),(0,d.tZ)(w.mz,{showDivider:!1,direction:"row",primaryButton:(0,d.tZ)(b.zx,{onClick:i,priority:"primary",children:n("Got it")})})]})}},26582:function(e,t,i){"use strict";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 o=i(98848);var a=i(16584),l=i(64515);let s=/^(3154|6909)$/.test(i.j)?e=>{var{size:t=20,fill:i="var(--color-fg-primary)"}=e,s=(0,o._)(e,["size","fill"]);return(0,a.tZ)(l.l,(0,r._)((0,n._)({},s),{name:"PlayIconLockFilled",svgParams:{viewBox:"0 0 20 20"},width:t,height:t,fill:i,children:(0,a.tZ)("path",{stroke:"none","fill-rule":"evenodd","clip-rule":"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){"use strict";i.d(t,{Z:()=>l});var n=i(7409),r=i(99282),o=i(16584),a=i(64515);let l=e=>(0,o.tZ)(a.l,(0,r._)((0,n._)({},e),{name:"RightArrowIcon",svgParams:{height:20,width:20},children:(0,o.tZ)("path",{d:"M7.5 15L12.5 10L7.5 5","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}))},74679:function(e,t,i){"use strict";i.d(t,{p:()=>s});var n=i(16584),r=i(30396);if(4716==i.j)var o=i(98961);var a=i(66067),l=i(15771);let s=e=>{let{editor:t,pub:i,postId:s,setPostId:d}=e,{isVideoEmbedDrawerOpen:c,setIsVideoEmbedDrawerOpen:u}=(0,a.B)(),[p,h]=(0,r.eJ)(null),[m,g]=(0,r.eJ)(!1),v=e=>{e.preventDefault(),g(!0)};return(0,r.d4)(()=>{if(m){let{mediaUploadId:e}=t.view.state.selection.node.attrs;h(e),u({isOpen:!0})}},[m,t.view.state.selection.node]),(0,r.d4)(()=>(document.addEventListener("editSelectedVideoEmbed",v),()=>{document.removeEventListener("editSelectedVideoEmbed",v)}),[]),(0,n.BX)(n.HY,{children:[(0,n.tZ)(l.hU,{priority:"tertiary",size:"sm",onClick:()=>u({isOpen:!c}),children:(0,n.tZ)(o.Z,{size:20})}),(0,n.tZ)(a.t,{id:"videoEmbed",editorDroppedFile:null,mediaUploadId:p,open:c,pub:i,postId:s,onClose:()=>{u({isOpen:!1,clearPreventChange:!0}),g(!1),h(null)},onSave:e=>{let{mediaUploadId:i,duration:n}=e;t.chain().focus().insertVideo({mediaUploadId:i,duration:n}).run()},setPostId:d})]})}},81924:function(e,t,i){"use strict";i.d(t,{i:()=>C,w:()=>x});var n=i(16584),r=i(30396),o=i(55679),a=i(70109),l=i(94184),s=i.n(l),d=i(23279),c=i.n(d),u=i(47976),p=i(95441),h=i(22747),m=i(68833),g=i(98914),v=i(15771),f=i(19081),b=i(38023),w=i(6490),y=i(58175),_=i(81355),Z=i(60520);let C=e=>{let{isOpen:t,onClose:i,persistentExpression:o,node:l}=e,[s,d]=(0,r.eJ)(o),{iString:u}=(0,p.M1)(),[g]=(0,r.eJ)(()=>c()(d,1e3));return(0,r.d4)(()=>{d(o)},[o]),(0,n.tZ)(_.e,{children:(0,n.BX)(w.u_,{isOpen:t,onClose:i,"data-test-id":"latex-modal",children:[(0,n.tZ)(w.fe,{children:(0,n.BX)(f.tu,{paddingTop:8,gap:24,children:[(0,n.BX)(f.tu,{gap:24,children:[(0,n.tZ)(f.gq,{justifyContent:"space-between",alignItems:"center",children:(0,n.tZ)(y.xv.Meta,{translated:!0,children:"LaTeX Editor"})}),(0,n.tZ)(b.g,{"data-test-id":"latex-input",rows:4,maxLength:1e3,value:s,name:"expression",onChange:e=>{g(e.target.value)}})]}),s?(0,n.tZ)(f.tu,{height:160,children:(0,n.tZ)(a.Z,{typesettingOptions:{fn:"tex2chtml",options:void 0},text:"".concat(s),renderMode:"pre",inline:!1,dynamic:!0})}):(0,n.tZ)(f.tu,{children:(0,n.tZ)(f.tu,{radius:"md",paddingX:12,paddingY:20,alignItems:"center",children:(0,n.tZ)(y.xv.B4,{fontStyle:"italic",translated:!0,color:"secondary",align:"center",children:"Write LaTeX expressions in the above editor and they'll appear here"})})})]})}),(0,n.tZ)(w.mz,{showDivider:!1,direction:"row",primaryButton:(0,n.tZ)(v.zx,{"data-test-id":"latex-save",priority:"primary",onClick:()=>{(0,m.j)(m.FP.LATEX_BLOCK_ADDED,{expression:s}),(0,h.oj)().dispatchEvent(new CustomEvent("close",{detail:{persistentExpression:s,node:l}})),i()},children:u("Save")}),secondaryButton:(0,n.tZ)(v.zx,{"data-test-id":"latex-cancel",priority:"secondary",onClick:()=>{(0,h.oj)().dispatchEvent(new CustomEvent("close",{detail:{persistentExpression:o,node:l}})),s!==o&&d(o),i()},children:u("Cancel")})})]})})},x=e=>{let{node:t,id:i}=e,[l,d]=(0,r.eJ)(t.attrs.persistentExpression);return(0,r.d4)(()=>{d(t.attrs.persistentExpression)},[t]),(0,r.d4)(()=>{let e=e=>{let{detail:i}=e;i.node.attrs.id===t.attrs.id&&d(i.persistentExpression)};return(0,h.oj)().addEventListener("close",e),()=>{(0,h.oj)().removeEventListener("close",e)}},[]),(0,n.tZ)(o.T5,{"data-drag-handle":"",children:(0,n.tZ)(_.e,{children:(0,n.tZ)("div",{className:"latex-block",id:i,children:(0,n.tZ)(f.tu,{className:s()(Z.Z.latexWrapper,t.attrs.persistentExpression||(0,g.K1)()?Z.Z.emptyStateWrapper:null),radius:"md","data-attrs":JSON.stringify({persistentExpression:l,id:t.attrs.id}),onClick:()=>{l!==t.attrs.persistentExpression&&d(t.attrs.persistentExpression),(0,h.oj)().dispatchEvent(new CustomEvent("open",{detail:{persistentExpression:t.attrs.persistentExpression,node:t}}))},children:(0,n.BX)(f.gq,{paddingY:8,paddingX:16,flex:"grow",justifyContent:"center",alignItems:"center",children:[l||t.attrs.persistentExpression?(0,n.tZ)(f.tu,{alignItems:"center",justifyContent:"center",children:(0,n.tZ)(a.Z,{typesettingOptions:{fn:"tex2chtml",options:void 0},text:"".concat(l||t.attrs.persistentExpression),renderMode:"pre",inline:!1,dynamic:!0})}):(0,n.tZ)(f.tu,{alignSelf:"center",children:(0,n.tZ)(y.xv.Meta,{fontStyle:"italic",translated:!0,color:"secondary",children:"Edit & enter LaTeX expressions here"})}),(0,n.tZ)(f.tu,{children:(0,n.tZ)("button",{className:Z.Z.latexEdit,children:(0,n.tZ)(u.Z,{width:20,height:20})})})]})})})})})}},21312:function(e,t,i){"use strict";i.d(t,{Z:()=>o});var n=i(16584),r=i(30396);function o(e){let{text:t,maxLines:i,ellipsesText:o="..."}=e,a=(0,r.sO)(null),[l,s]=(0,r.eJ)(t);return(0,r.d4)(()=>{(()=>{if(!a.current)return;a.current.innerText="-";let e=(a.current.clientHeight+1)*i+1,n=0,r=0,l=t.length;for(;n<=l;){if(r=Math.floor((n+l)/2),a.current.innerText=t.slice(0,r),r===t.length&&a.current.clientHeight<=e){a.current.innerText="",s(t);return}a.current.clientHeight<=e?n=r+1:l=r-1}let d=t.slice(0,r-o.length-2);a.current.innerText="",s(d+o)})()},[a,t,i,o]),(0,n.BX)("div",{style:{position:"relative"},children:[(0,n.tZ)("div",{children:l}),(0,n.tZ)("div",{ref:a,style:{visibility:"hidden",position:"absolute",width:"100%"}})]})}},56219:function(e,t,i){"use strict";i.d(t,{Ao:()=>e4,Rs:()=>e2,SO:()=>eK,_q:()=>eQ,a7:()=>e6,eu:()=>eJ,lO:()=>eq,mV:()=>e0,nM:()=>e$,sY:()=>e5,xw:()=>eY});var n=i(27412),r=i(7409),o=i(99282),a=i(58865),l=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),w=i.n(b),y=i(59543),_=i(80569),Z=i.n(_),C=i(60826),x=i(7464),S=i(84844),k=i(16564),N=i(9573),P=i(89074),T=i(59708),E=i(92828),I=i(75021),B=i(18787),D=i(90311),R=i(17350),L=i(16944),M=i(94442),U=i(3862),X=i(21316),j=i(85685),A=i(11712),O=i(94594),F=i(51014),H=i(33665),z=i(90156),V=i(72392),q=i(16506),J=i(89276),Y=i(25956),W=i(79160),K=i(70522),G=i(58319),$=i(57391),Q=i(37168),ee=i(95441),et=i(30372),ei=i(56629),en=i(68833),er=i(48980),eo=i(49762),ea=i(27036),el=i(98914),es=i(29927),ed=i(15771),ec=i(61254),eu=i(19081),ep=i(1844),eh=i(58175),em=i(70379),eg=i(71460),ev=i(23776),ef=i(57641),eb=i(98012),ew=i(24791),ey=i(6070),e_=i(67914),eZ=i(60308),eC=i(26111),ex=i(63651),eS=i(81821),ek=i(84864),eN=i(47929),eP=i(59961);function eT(){let e=(0,a._)(["The full video is for subscribers in the "," plan"]);return eT=function(){return e},e}function eE(){let e=(0,a._)(["The full video is for subscribers in the Founding Member plan"]);return eE=function(){return e},e}function eI(){let e=(0,a._)(["The full video is for paid subscribers"]);return eI=function(){return e},e}function eB(){let e=(0,a._)(["This email is for subscribers in the "," plan"]);return eB=function(){return e},e}function eD(){let e=(0,a._)(["This email is for subscribers in the Founding Member plan"]);return eD=function(){return e},e}function eR(){let e=(0,a._)(["This email is for paid subscribers"]);return eR=function(){return e},e}function eL(){let e=(0,a._)(["Continue reading this post for free, courtesy of ","."]);return eL=function(){return e},e}function eM(){let e=(0,a._)(["This post is for subscribers in the "," plan"]);return eM=function(){return e},e}function eU(){let e=(0,a._)(["This post is for subscribers in the Founding Member plan"]);return eU=function(){return e},e}function eX(){let e=(0,a._)(["This post is for paid subscribers"]);return eX=function(){return e},e}function ej(){let e=(0,a._)(["Subscribe to "," to continue reading"]);return ej=function(){return e},e}function eA(){let e=(0,a._)(["Visit the author’s Substack to subscribe and read more."]);return eA=function(){return e},e}function eO(){let e=(0,a._)(["Visit ",""]);return eO=function(){return e},e}function eF(){let e=(0,a._)(["Support ",""]);return eF=function(){return e},e}function eH(){let e=(0,a._)(["Subscribe to ",""]);return eH=function(){return e},e}function ez(){let e=(0,a._)(["By ",""]);return ez=function(){return e},e}function eV(){let e=(0,a._)(["Subscribe to ",""]);return eV=function(){return e},e}let eq="focus-comment-input",eJ=(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),eY=(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 eW extends s.Component{async loadReactors(){let e=await Z().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,en.j)(en.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,en.K8)({post:this.props.post});let t=(0,eC.x)("subscribe_prompt");t&&("paid"===t?this.props.popToast(e=>(0,l.tZ)(em.FN,(0,o._)((0,r._)({},e),{text:"Subscription purchased for ".concat(this.props.pub.name)}))):this.props.popToast(e=>(0,l.tZ)(em.FN,(0,o._)((0,r._)({},e),{text:"Subscribed to ".concat(this.props.pub.name)})))),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:r,referringUser:o,user:a}=this.props;return i("paywall_unlock_tokens")&&"only_paid"===n.audience&&n.teaser_post_eligible&&(!a||!a.is_subscribed)&&(0,eS.tq)({checkFirst4:!0})&&(null==o?void 0:null===(t=o.subscriptions)||void 0===t?void 0:null===(e=t.find(e=>e.publication_id===r.id))||void 0===e?void 0:e.membership_state)==="subscribed"}async setPostPromptState(){var e;let{post:t,disableSubscribePrompt:i,readerIsSearchCrawler:n,pub:r,user:o,readerInstalledAt:a,referringUser:l,forceFollowPrompt:s}=this.props,d="newsletter"===t.type&&!0===this.props.getSettingFor("enable_post_page_conversion")&&!i&&!(0,el.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(!ek.PUB_IDS_TO_NOT_SHOW_FOLLOW_PROMPT_ON.includes(r.id)&&!p&&d&&l&&l.name&&l.id!==(null==o?void 0:o.id)&&r.author_id!==l.id&&r.contributors.every(e=>e.user_id!==l.id)){let e=[];if(o)try{e=await (0,er.rd)("/api/v1/feed/following")}catch(e){console.warn("Failed to fetch following state",e)}h=!e.includes(l.id)}let m=d&&!u&&!h&&!this.props.paywall&&!this.props.freeSignup&&!o,g=!u&&!["video","podcast"].includes(t.type)&&!n&&(0,eS.tq)({checkFirst4:!0})&&!a&&!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,en.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:r}=this.state;return!!e&&!!r&&eY(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||ek.DEFAULT_PREVIEW_LIMIT,n="",r=!1;for(let t=e.childNodes.length-1;t>=0;t--){let o=e.childNodes[t];if(o&&(n+=o.textContent).length>i){r=!0;break}}return r}render(e,t){var i,n,a,s,d,c,p;let h,{user:m,pub:g,post:v,freeSignup:f,freeSignupEmail:b,isServingFreePodcastUrl:w,isShowsPost:_,isTheFreePressTheme:Z,reaction_token:C,invisible:S,paywall:N,onChange:L,hideTitle:U,noTitleLink:X,showComments:j,fromPostPage:H,freeTrialCoupon:Y,showRestackModal:K,stripe_publishable_key:$,crossPostInfo:Q,iString:ee,iTemplate:et,themeVariables:ei,referringUser:er,renderComments:ea,renderContent:el,getSettingFor:es,startInterval:ec,forceFollowPrompt:ep}=e,{showTranscription:eh,truncated:eg,autoPlayVoiceOver:ef,reactors:eb,restackers:e_,shouldShowFollowPrompt:eZ,shouldShowSubscribePrompt:eC,shouldShowGiftPostPrompt:ek,appUpsellEligible:eN,mountAppUpsellFooter:eP}=t;if(v.is_geoblocked)return(0,l.tZ)(e7,{});let ej=!!this.context.getConfigFor("like_posts_enabled"),eA=(0,T.N1)(null!==(s=eg||v.body_html)&&void 0!==s?s:""),eO=!N||N&&this.shouldTrackPaywallPostSeen();ec&&eO&&ec({postId:this.props.post.id,containerElementRef:this.containerRef,elementIsStatic:!0});let eF="video"===v.type&&!N&&(null===(i=v.videoUpload)||void 0===i?void 0:i.transcription),eH=this.shouldShowUFI()&&!(0,ey.HD)({pub:g}),ez=e6(v),eV=!!eb&&eb.length>0,eq=!!(es("paywall_unlock_tokens")&&"only_paid"===v.audience&&v.teaser_post_eligible),eJ=eq&&!(null==m?void 0:m.is_subscribed)&&((null==m?void 0:m.is_free_subscribed)||f)&&!(null==m?void 0:m.has_redeemed_post_unlock_token),eY=(0,eS.tq)({checkFirst4:!0});eq&&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"))&&(eJ=!0,h=this.context.getExperimentVariant("gift_post_unlocks_recipient_2")));let eW="";eW="video"===v.type?"founding"===v.audience&&(0,ew.H$)(g)?et(eT(),null!==(d=(0,ew.H$)(g))&&void 0!==d?d:""):et("founding"===v.audience?eE():eI()):"adhoc_email"===v.type?"founding"===v.audience&&(0,ew.H$)(g)?et(eB(),null!==(c=(0,ew.H$)(g))&&void 0!==c?c:""):et("founding"===v.audience?eD():eR()):eJ?eY?ee("Continue reading this post for free in the Substack app"):et(eL(),g.author_name||g.name):"founding"===v.audience&&(0,ew.H$)(g)?et(eM(),null!==(p=(0,ew.H$)(g))&&void 0!==p?p:""):et("founding"===v.audience?eU():eX());let eK=(0,l.BX)(J.j,{disabled:!Z,post:v,isShowsPost:_,children:[(0,l.tZ)("div",{className:"available-content",children:eh?(0,l.tZ)("div",{className:"container tw-py-12",children:(0,l.tZ)(ev.Z,{post:v,pub:g,user:m,playerRef:this.videoPlayer})}):(0,l.tZ)(A.Z,{html:eg||v.body_html||null,pub:g,trackSelection:!0,post:v,themeVariables:ei,canRestackImage:this.context.getConfigFor("restack_with_image"),user:m,freeSignup:f,freeSignupEmail:b,paywall:N,showing_behind_paywall:!!v.post_paywall_content_for_google})}),v.post_paywall_content_for_google&&(0,l.tZ)("div",{className:"paywall-content",children:(0,l.tZ)(A.Z,{html:v.post_paywall_content_for_google,pub:g,trackSelection:!1,post:v,user:m,freeSignup:f,freeSignupEmail:b,paywall:N})}),!S&&eO&&(0,l.tZ)(G.Z,{onVisible:()=>this.onBottomReached(!!N)})]}),eQ=(0,ey.HD)({pub:g}),e4=(0,ey.kb)({pub:g}),e2=eQ?(0,l.tZ)(q.Z,{post:v,user:m,pub:g,freeSignupEmail:b}):(0,l.tZ)(B.f1,(0,r._)({user:m,freeSignupEmail:b,freeSignup:f,publication:g,post:v,coupon:!0===this.props.paywall&&this.props.pub.paywall_free_trial_enabled?Y:null,showPostUnlockPrompt:!!eJ,magicToken:C,giftingUser:er,treatmentVariantForGiftPostPaywall:h,onPostUnlockError:()=>this.props.popToast(e=>(0,l.tZ)(em.FN,(0,o._)((0,r._)({},e),{text:ee("Teaser posts are not currently available for this content")})))},Object.assign({title:eW,reauthenticationTitle:ee("To read this, please re-authenticate.")},N)));return(0,l.BX)("article",{className:u()("typography ".concat(v.type,"-post post"),{"tw-p-0":"podcast"===v.type,"shows-post":_,"full-width-image-header":(null===(n=v.postTheme)||void 0===n?void 0:n.header_variant)==="full-width-image"}),ref:this.containerRef,children:[(null==m?void 0:m.is_contributor)&&(null==v?void 0:v.id)&&(null==v?void 0:v.type)==="page"&&(0,l.tZ)(ed.zx,{priority:"secondary",href:(0,ex.ANx)(g,v.id,{params:{back:document.location.href}}),localNavigation:!1,leading:(0,l.tZ)(y.Z,{size:20}),children:ee("Edit")}),(0,l.tZ)(e8,{post:v,user:m,onChange:L}),(0,l.tZ)(F.ZP,{ref:this.shareDialogRef,user:m,pub:g,post:v,reaction_token:C,source:"email-share"}),ek&&(0,l.tZ)(I.f,{user:m,post:v,pub:g,referringUser:er,freeSignupEmail:b,variant:this.context.getExperimentVariant("gift_post_unlocks_recipient_2")}),eZ&&(0,l.tZ)(E.yi,{pub:g,post:v,referringUser:er,freeSignupEmail:b,forceFollowPrompt:ep,surface:"post-follow-referrer-prompt"}),eC&&(0,l.tZ)(z.H,{pub:g,post:v,stripe_publishable_key:$,sharer:er,appUpsellEligible:!!eN}),eP&&(0,l.tZ)(x.m,{pub:g,slug:v.slug}),el?(0,l.BX)(l.HY,{children:[!S&&(0,l.tZ)(G.Z,{onVisible:()=>{this.onTopReached(!!N)}}),el({comments:ea?ea():null,crossPostInfo:Q,postContent:(0,l.BX)(l.HY,{children:[eK,!!(N&&!v.post_paywall_content_for_google&&!w)&&e2]})})]}):(0,l.BX)(l.HY,{children:[(0,l.tZ)(e0,{user:null!=m?m:null,pub:g,post:v,isOnPostPage:!0,reaction_token:C,allowEdit:!0,showShare:!0,showSubtitle:!0,showPhoto:!0,showCommentRestack:!g.hide_post_restacks,hideTitle:!!U,noTitleLink:!!X,onChange:L,hideDate:"page"===v.type,hideAudience:"page"===v.type,showReactions:ej,showComments:!!j,showLabel:!0,showUpdatedIcons:!0,fromPostPage:!!H,onClickCommentButton:this.onCommentButtonClicked,reactors:eb,showRestackModal:!!K,showTranscriptionButton:!!eF,onTranscriptionClick:this.onTranscriptionClick,autoPlayVoiceOver:ef}),!S&&eO&&(0,l.tZ)(G.Z,{onVisible:()=>this.onTopReached(!!N)}),(v.has_voiceover||!!v.voiceoverUpload)&&!Z&&(0,l.tZ)(k.KH,{pub:g,post:v,mediaUploadId:v.voiceover_upload_id,duration:null===(a=v.voiceoverUpload)||void 0===a?void 0:a.duration,autoPlay:ef,href:v.canonical_url,isPaywalled:!v.voiceover_upload_id}),!v.voiceoverUpload&&ef&&ez&&(0,l.tZ)(W.r,{postId:v.id,onClose:()=>{(0,en.j)(en.FP.LISTEN_TO_THIS_POST_MODAL_DISMISSED,{post_id:v.id}),this.setState({autoPlayVoiceOver:!1})}}),Q?(0,l.tZ)(P.F,{postType:v.type,crossPostInfo:Q}):null,(0,l.BX)("div",{children:[eA&&(0,l.tZ)(V.o,{toc:eA,position:"fixed"}),eK,N&&!v.post_paywall_content_for_google?(0,l.BX)(l.HY,{children:[e2,(0,l.tZ)(R.i,{post:v})]}):eg?(0,l.tZ)("p",{children:(0,l.BX)(ed.zx,{className:"expander",onClick:()=>this.setState({truncated:null}),children:["+ ",ee("show full post")]})}):!["page"].includes(null==v?void 0:v.type)&&(0,l.BX)(l.HY,{children:[eH&&(0,l.tZ)(e$,{pub:g,post:v,user:m,freeSignup:!!f,freeSignupEmail:b}),!eH&&this.shouldShowRecommendCta&&(0,l.tZ)(O.o,{pub:g}),Q&&("only_paid"===v.audience||"founding"===v.audience)&&(0,l.tZ)(eG,{pub:g}),(0,eo.default)("like_posts_enabled")&&g.community_enabled&&eV&&!Z&&(0,l.tZ)(eu.X2,{borderTop:"detail-themed",paddingY:16,children:(0,l.tZ)(D.fB,{post:v,pub:g,user:m,reactors:eb,secondaryFaces:e_})}),!Z&&(0,l.tZ)("div",{className:"post-footer",children:(0,l.tZ)(M.Mp,{post:v,pub:g,user:m,onChange:L,postReactionToken:C})}),(0,l.tZ)(R.i,{post:v})]}),v.show_guest_bios&&"podcast"!==v.type&&!eQ&&!e4&&(0,l.tZ)(e1,{user:m,pub:g,post:v})]})]})]})}constructor(e,t){var i,r;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,en.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(eq)))});let o={showTranscription:!1,autoPlay:!1,autoPlayVoiceOver:!1,commentSort:null!==(r=e.post.default_comment_sort)&&void 0!==r?r:"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||(o.canShowSubscribeFooterAfterPost=e2(e.post.body_html),o.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,eC.x)("autoPlay")&&(window.history.replaceState({},document.title,(0,eZ.rhs)({autoPlay:null})),o.autoPlay=!0),"true"===(0,eC.x)("play_audio")&&(window.history.replaceState({},document.title,(0,eZ.rhs)({play_audio:null})),o.autoPlayVoiceOver=!0)),this.state=o,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=eJ(e.pub,e.user)}}(0,n._)(eW,"contextType",Q.WH),(0,n._)(eW,"displayName","Post");let eK=(0,em.dd)((0,$.f9)((0,ei.us)((0,ee.fz)((0,et.aG)(eW))))),eG=e=>{let{pub:t}=e,{iTemplate:i}=(0,ee.M1)();return(0,l.BX)(l.HY,{children:[(0,l.tZ)(ec.iz,{paddingTop:16}),(0,l.BX)(eu.sg,{gap:16,paddingY:32,alignItems:"center",children:[(0,l.BX)(eu.sg,{gap:8,paddingBottom:8,children:[(0,l.tZ)(eh.xv.H4,{flex:"grow",align:"center",children:i(ej(),t.name)}),(0,l.tZ)(eh.xv.B3,{flex:"grow",align:"center",color:"secondary",children:i(eA())})]}),(0,l.tZ)(ed.zx,{priority:"primary",onClick:()=>{(0,en.j)(en.FP.POST_END_CTA_CLICKED,{type:"cross-post"}),(0,el.uX)((0,ex.W1P)(t,{params:{utm_source:eN.b3.postEndCta,addBase:!0}}),{local_navigation:!1})},children:i(eO(),t.name)})]})]})},e$=e=>{let{pub:t,post:i,user:n,freeSignup:r,freeSignupEmail:o,overridePledgesEnabled:a}=e,{iString:s,iTemplate:c}=(0,ee.M1)(),{getSettingFor:u}=(0,ei.So)(),[p,h]=(0,d.eJ)(null),m=(0,eC.x)("just_subscribed"),g="disabled"===t.payments_state&&!t.invite_only&&(u("payment_pledges_enabled")||a),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,en.j)(en.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,ek.getByLine)(t);return(0,l.BX)(l.HY,{children:[(0,l.tZ)(ec.iz,{paddingTop:16}),(0,l.tZ)(G.Z,{onVisible:()=>{(0,en.j)(en.FP.POST_END_CTA_SEEN,{pub_id:t.id,post_id:i.id,type:v})}}),(0,l.BX)(eu.sg,{gap:16,paddingY:32,children:[(0,l.BX)(eu.sg,{gap:8,paddingBottom:8,children:[(0,l.tZ)(eh.xv.H4,{flex:"grow",align:"center",children:c(g&&(null==n?void 0:n.is_free_subscribed)?eF():eH(),t.name)}),(0,l.BX)(eh.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,l.tZ)(eh.xv.B3,{color:"primary",flex:"grow",align:"center",children:t.hero_text})]}),(0,l.tZ)(eu.sg,{alignItems:"center",gap:16,children:f?(0,l.tZ)(ed.zx,{priority:"primary",onClick:()=>{(0,en.j)(en.FP.POST_END_CTA_CLICKED,{type:"pledge"}),(0,el.uX)((0,ex.W1P)(t,{params:{utm_source:eN.b3.postEndCta}}),{local_navigation:!1})},children:s("Pledge your support")}):(0,l.BX)(l.HY,{children:[(0,l.tZ)(H.Z,{pub:t,post:i,user:n,freeSignup:r,freeSignupEmail:o,isStatic:!1,onPrepareData:()=>{h(null)},source:"post-end-cta",className:eP.Z.subscribeWidget}),p&&(0,l.tZ)(ep.y,{align:"center",children:p}),!(null==n?void 0:n.is_free_subscribed)&&!m&&(0,l.tZ)(eu.sg,{maxWidth:400,children:(0,l.tZ)(ef.O,{includeCheckbox:!1,addSubscribePreamble:!0,color:"secondary",textAlign:"center"})})]})})]})]})},eQ=e=>{let{pub:t}=e;return(0,l.BX)("div",{className:"post-silhouette",children:[(0,l.tZ)("div",{className:"post-silhouette-title"}),(0,l.tZ)("div",{className:"post-silhouette-meta ".concat(t&&t.bylines_enabled&&t.byline_images_enabled?"with-byline-image":"")}),(0,l.tZ)("div",{className:"post-silhouette-body"})]})},e0=e=>{var t,i,n,r;let o,{allowEdit:a,allowSendEmail:s,allowTruncate:d,base_url:c,children:p,className:h,hideAudience:m,hideDate:g,hideTitle:v,hidePinning:f,noTitleLink:b,isStatic:w,isFreePreview:y,is_draft:_,onChange:Z,post:x,pub:k,reaction_token:P,showComments:T,showDatetime:E,showEmailSent:I,showReactions:B,showShare:R,showAppUpsell:j,showSubtitle:A,showPhoto:O,showLabel:F,showRestack:H,showCommentRestack:z,hideAuthor:V,user:q,utm_source:J,showUpdatedIcons:W,fromPostPage:K,onClickCommentButton:G,reactors:$,inThreadHead:Q,publishedPost:et,compEndsSoon:ei,compEndedRecently:en,siteConfigValues:er={},eligibleForTTS:eo,showRestackModal:ea,showIcon:el,isOnPostPage:es,showTranscriptionButton:ed,onTranscriptionClick:ec,isAppMode:ep=!1,republishingPost:em,autoPlayVoiceOver:eg=!1}=e,{iString:ev}=(0,ee.M1)(),ef=(0,eS.tq)({checkFirst4:!0}),eb=em||x,ew="number"==typeof d?d:45,eZ=x.title&&x.title.length>ew,eC=_?x.draft_title:x.title,eP=[(el||"thread"===x.type)&&(0,l.tZ)(X.m,{postType:x.type,isStatic:w,height:15,className:x.type}),eZ&&d?(0,ek.truncateWords)(eC,ew):eC],eT=_?x.draft_subtitle:x.subtitle;x.section_id&&k.sections&&k.sections.length&&(x.section=k.sections.find(e=>e.id===x.section_id));let eE=(0,e_.B9)({pub:k,subscriptionType:null==q?void 0:q.subscription_type}),eI=!["page"].includes(null==x?void 0:x.type),eB=eI&&w&&ei&&!eE&&(null==er?void 0:er.continue_support_cta_in_newsletter_emails),eD=e6(x)||eo||x.voiceoverUpload,eR=(null==x?void 0:x.type)==="adhoc_email",eL=eI&&w&&!eR&&!ep,eM=(0,ey.HD)({pub:k})&&(!!x.postTheme||["video","podcast"].includes(x.type)&&Q);o=x.post_url_override?x.post_url_override:w&&ep?C.W.POST_TITLE_APP_MODE_URL:w?C.W.POST_TITLE_URL:"".concat((0,ex.uRy)(k,x)).concat(J?"?utm_source=".concat(J):"");let eU="".concat(k.base_url+(eb.section?(0,ex.Ucy)(k,{section:eb.section}):""),"/?utm_source=").concat(eN.b3.substack,"&utm_medium=").concat(eN.lP.menu);return eM?(0,l.tZ)(Y.I,{post:x,postTheme:x.postTheme,title:eC,subtitle:eT,pub:k,inThreadHead:!!Q,autoPlayVoiceOver:eg}):(0,l.BX)("div",{className:u()("post-header",h),role:"region","aria-label":ev("Post header"),children:[(0,ey.kb)({pub:k})&&(null!==(r=null===(t=x.postTags)||void 0===t?void 0:t.length)&&void 0!==r?r:0)>0&&(0,l.tZ)(eu.X2,{alignItems:"center",gap:4,paddingBottom:8,children:null===(i=x.postTags)||void 0===i?void 0:i.map((e,t)=>(0,l.BX)(l.HY,{children:[0!==t&&(0,l.tZ)(eh.xv.Meta,{children:"—"}),(0,l.tZ)(eh.xv.Meta,{as:"a",size:14,href:(0,ex.Mk9)(k,e),children:e.name})]}))}),F&&x.section&&(0,l.tZ)(eu.X2,{className:"post-label",children:(0,l.tZ)(eh.xv.Meta,{as:"a",size:14,href:eU,children:null===(n=eb.section)||void 0===n?void 0:n.name})}),eB&&(0,l.tZ)(N.v,{post:x,compAlreadyExpired:en}),!v&&(0,l.tZ)("h1",{className:u()("post-title",x.is_published?"published":"restack"!==x.type||em?"adhoc_email"===x.type?"adhoc":"unpublished":"email-only-cross-post",{"post-title--the-pillar":(0,ey.kb)({pub:k})}),children:b?eP:(0,l.tZ)("a",{href:o,children:eP})}),A&&eT&&(0,l.tZ)("h3",{className:u()("subtitle",{"subtitle--the-pillar":(0,ey.kb)({pub:k})}),children:eT}),"page"===x.type?(0,l.tZ)("div",{style:{height:32}}):es&&!w?(0,l.BX)(eu.sg,{paddingBottom:16,"aria-label":ev("Post UFI"),role:"region",children:[(0,l.tZ)(eu.sg,{paddingY:16,children:(0,l.tZ)(U.E,{post:x,pub:k})}),(0,l.tZ)(S.j,{user:q,isMobile:ef,post:x}),ef?K&&(0,l.tZ)(M.mt,{post:x,pub:k,user:q,isStatic:!!w,postReactionToken:P,onChange:Z,allowEdit:a,hidePinning:f,showEmailSent:I,allowSendEmail:s,hideComments:!T,onCommentsClick:G,showRestackModal:ea}):(0,l.tZ)(M.Mp,{post:x,pub:k,user:q,onChange:Z,showRestackModal:ea,showTranscriptionButton:ed,onTranscriptionClick:ec,showClipping:"video"===x.type,postReactionToken:P})]}):(0,l.BX)(l.HY,{children:[!eI||w||et||Q?eI&&!w&&et?(0,l.tZ)(M._2,{post:x,pub:k,user:q,style:"compressed",labelStyle:"counts-or-none",postReactionToken:P,showEmailSent:I,hideShare:!R||"restack"===x.type,hideComments:"restack"===x.type,hideSavePost:"restack"===x.type,hideReactions:"restack"===x.type,showPreamble:!0,onChange:void 0,allowEdit:a,allowSendEmail:s,editButtonIsLast:!0,preambleConfig:{showAudience:!m,showDate:!g,showDatetime:E,showAuthor:!V},isStatic:w,position:"publisher-post-list"}):Q&&!w?(0,l.tZ)(M._2,{post:x,pub:k,user:q,style:"compressed",labelStyle:"counts-or-none",postReactionToken:P,hideSavePost:!0,showPreamble:!0,allowEdit:a,allowSendEmail:s,editButtonIsLast:!0,onChange:Z,preambleConfig:{showAudience:!m,showDate:!g,showDatetime:E,showAuthor:!V},hideShare:!R,position:"publisher-post-list",isStatic:w}):eI?(0,l.tZ)(D.SP,{user:q,pub:k,post:x,showDate:!g,showDatetime:E,showEmailSent:I,showAudience:!m,showReactions:!eL&&B,showComments:!eL&&T,showShare:!eL&&R,showRestack:!eL&&H,reaction_token:P,onChange:Z,isStatic:w,isFreePreview:y,sharedShareDialog:!0,base_url:c,allowSendEmail:s,allowEdit:a,showAuthor:!V,showPhoto:O,hidePinning:f,showUpdatedIcons:W,inThreadHead:Q,fromPostPage:K,onClickCommentButton:G,reactors:$,isAppMode:ep}):(0,l.tZ)("div",{className:"spacer",style:{height:24}}):(0,l.tZ)(L.a,{className:"meta-subheader",pub:k,post:x,user:q,showDate:!g,showDatetime:!!E,isStatic:!!w,postReactionToken:P,onChange:Z,allowEdit:a,hidePinning:f,showEmailSent:I,allowSendEmail:s,allowMobileFooter:K,onCommentsClick:G,showRestackModal:ea}),eI&&eL&&(0,l.tZ)(M.yT,{customization:{showShare:R,showComments:T,showReactions:B,showListen:!H&&!y&&!!eD,showSave:!H,showRestack:H,showCommentRestack:z,showAppUpsell:j}}),eR&&(0,l.tZ)("div",{className:"email-ufi-2-empty"})]}),p]})},e1=e=>{let{user:t,pub:i,post:n}=e,{iString:r,iTemplate:o}=(0,ee.M1)(),a=(0,ek.getBylineUsers)(n).filter(e=>e.is_guest);return 0===a.length?null:(0,l.BX)("div",{className:"post-contributor-footer",children:[(0,l.tZ)("div",{className:"container-border"}),a.map(e=>{let n=(0,ek.guessFirstName)(e.name),a=e.primaryPublicationSubscribeUrl;a&&(null==t?void 0:t.email)&&(a=(0,eZ.rhs)(a,{email:t.email,autoSubmit:!0,utm_source:eN.b3.substack,utm_campaign:eN.VX.guestPostBio,utm_medium:eN.lP.web}));let s=(0,eZ.rhs)((0,ex.NNq)(e),{utm_campaign:eN.VX.guestPostBio,utm_medium:eN.lP.web}),d=K.ZP.hasCustomProfilePhoto(e);return(0,l.tZ)("div",{className:u()("post-contributor-bio",{"post-contributor-bio-no-text":!e.bio}),"data-user-id":e.id,children:(0,l.tZ)("table",{cellpadding:"0",cellspacing:"0",className:"post-contributor-bio-table",children:(0,l.BX)("tr",{className:"post-contributor-bio-table-row",children:[d&&(0,l.tZ)("td",{className:"post-contributor-bio-userhead-cell post-contributor-bio-userhead-cell-web",children:(0,l.tZ)(j.ProfileHoverCard,{subject:e,utmSource:"byline",children:(0,l.tZ)(K.ZP,{size:52,user:t,pub:i,subject:e})})}),(0,l.tZ)("td",{className:"post-contributor-bio-body-cell post-contributor-bio-body-cell-web",children:(0,l.BX)("div",{className:"post-contributor-bio-body",children:[e.bio&&(0,l.tZ)("div",{className:"post-contributor-bio-preamble",children:r("A guest post by")}),(0,l.tZ)("table",{cellpadding:"0",cellspacing:"0",className:"post-contributor-bio-body-table",children:(0,l.BX)("tr",{className:"post-contributor-bio-body-table-row",children:[(0,l.BX)("td",{className:"post-contributor-bio-copy-cell",children:[!e.bio&&(0,l.tZ)("div",{className:"post-contributor-bio-preamble",children:r("A guest post by")}),(0,l.BX)(eu.X2,{gap:4,alignItems:"center",paddingBottom:4,children:[(0,l.tZ)(j.ProfileHoverCard,{subject:e,utmSource:"byline",children:(0,l.tZ)("a",{className:"post-contributor-bio-title no-margin",href:s,native:!0,children:e.name})}),(0,l.tZ)(eg.UserBadge,{size:"sm",tier:e.bestseller_tier,userId:e.id})]}),e.bio&&(0,l.tZ)("div",{className:"post-contributor-bio-text",children:e.bio})]}),(0,l.tZ)("td",{className:"post-contributor-bio-controls-cell post-contributor-bio-controls-cell-web",children:(0,l.tZ)("div",{className:"post-contributor-bio-controls",children:a&&(0,l.tZ)("a",{className:"post-contributor-bio-subscribe-button button primary",href:a,native:!0,children:(0,l.tZ)("span",{className:"post-contributor-bio-subscribe-button-label",children:o(eV(),n)})})})})]})})]})})]})})})})]})};class e4 extends(4716==i.j?s.Component:null){render(e){let{renderPost:t,posts:i,hideFirstHeading:n,className:r,top:o,children:a}=e;return i=i.slice(0).sort((e,t)=>(0,eb.Z)(t.post_date)-(0,eb.Z)(e.post_date)),(0,l.BX)("div",{className:"calendared-post-list ".concat(r||""),children:[o,h()(g()(this.renderByHeading(i,"year",(e,n)=>[!n.isSameNow("year")&&(0,l.tZ)("h2",{date:n,children:n.year()}),this.renderByHeading(e,"month",(e,r)=>[!(r.isSameNow("year")&&r.isSameNow("month"))&&(0,l.BX)("h3",{date:n,children:[(0,ek.get_month_name)(r)," ",!r.isSameNow("year")&&r.year()]}),e.map(e=>t(e,i.indexOf(e),i))])]))).filter((e,t,i)=>!n||t>=i.findIndex(e=>!e.props||!e.props.date)),a]})}renderByHeading(e,t,i){let n=f()(e,e=>(0,eb.Z)(e.post_date)[t]());return w()(n).sort((e,t)=>Number(t[0])-Number(e[0])).map(e=>{var t;let[,n]=e;return i(n,(0,eb.Z)(null===(t=n[0])||void 0===t?void 0:t.post_date))})}}function e2(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="",r=!1;for(let e=i.childNodes.length-1;e>=0;e--){let o=i.childNodes[e];if(o){if((0,el.pv)(o,"button-wrapper")||(0,el.pv)(o,"subscription-widget-wrap")||(0,el.pv)(o,"subscribe-widget")){r=!0;break}if((n+=o.textContent).length>t)break}}return!r}function e8(e){let{post:t,user:i,onChange:n}=e,[a,s]=(0,d.eJ)(!1),{getExperimentVariant:c}=(0,$.jc)(),u="treatment"===c("video_email_watch_later_experiment"),{onSave:p}=(0,M.vk)({post:t,isSaved:!1});return((0,d.d4)(()=>{if("save"===new URL(location).searchParams.get("action")&&(history.replaceState({},"",(0,eZ.rhs)({action:null})),i)){let e=p();n({post:(0,o._)((0,r._)({},t),{is_saved:e})}),e&&u&&s(!0)}},[]),a)?(0,l.tZ)(es.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 e5(e){var t;return!!(null===(t=e.audio_items)||void 0===t?void 0:t.some(e=>"tts"===e.type&&"paywalled"===e.status))}let e7=()=>(0,l.tZ)("article",{className:u()("typography post",{"shows-post":!1}),children:(0,l.tZ)("div",{className:"container tw-p-12",children:(0,l.tZ)("p",{align:"center",children:(0,l.tZ)(eh.xv,{translated:!0,as:"span",children:"This content has been withheld in your country in response to a legal requirement."})})})})},67560:function(e,t,i){"use strict";if(i.d(t,{b:()=>b}),4716==i.j)var n=i(58865);var r=i(16584),o=i(30396),a=i(33804),l=i(95441),s=i(7882),d=i(15771),c=i(19081),u=i(68709),p=i(6490),h=i(17688),m=i(51776),g=i(63651);function v(){let e=(0,n._)(["Reader Survey ",""]);return v=function(){return e},e}function f(){let e=(0,n._)(["Reader Survey"]);return f=function(){return e},e}let b=e=>{var t,i;let{isOpen:n,onInsert:b,onClose:w,pub:y}=e,{iString:_,iTemplate:Z}=(0,l.M1)(),[C,x]=(0,o.eJ)(null),[S,k]=(0,o.eJ)(_("Start Survey")),{isLoading:N,result:P,refetch:T}=(0,s.ib)({pathname:"/api/v1/survey",auto:!1}),{isLoading:E,result:I,refetch:B}=(0,s.ib)({pathname:"/api/v1/survey",auto:!1,method:"POST",json:{title:(null==P?void 0:null===(t=P.surveys)||void 0===t?void 0:t.length)?Z(v(),(null==P?void 0:null===(i=P.surveys)||void 0===i?void 0:i.length)+1):Z(f())}});return(0,o.d4)(()=>{let e=e=>{"surveySavedInPopup"===e.data&&T()};return n&&!E&&I&&(window.open((0,g.bzh)(y,I.id,{popup:!0}),"_blank"),window.addEventListener("message",e)),()=>{window.removeEventListener("message",e)}},[n,E,I]),(0,o.d4)(()=>{!n||P||N||T()},[n,P,T,N]),(0,r.tZ)(p.u_,{isOpen:n,children:(0,r.BX)(a.w,{children:[(0,r.tZ)(p.xB,{title:_("Insert a Survey"),showClose:!1,showDivider:!0}),(0,r.tZ)(p.fe,{children:(0,r.tZ)(c.tu,{gap:20,children:!N&&P&&(0,r.BX)(r.HY,{children:[(0,r.BX)(m.fv,{children:[(0,r.tZ)(u.__,{children:_("Survey to insert")}),(0,r.BX)(h.i,{value:C||"",onChange:e=>{let t=e.currentTarget.value;if("new"===t){B();return}x(Number(t))},children:[(0,r.tZ)(h.d,{children:_("Select a reader survey")}),P.surveys.map(e=>(0,r.tZ)("option",{value:e.id,children:e.title},e.id)),(0,r.tZ)("option",{value:"new",children:_("Create new survey")})]})]}),(0,r.BX)(m.fv,{children:[(0,r.tZ)(u.__,{children:_("Button text")}),(0,r.tZ)(m.oi,{value:S,onChange:e=>{k(e.currentTarget.value)}})]})]})})}),(0,r.tZ)(p.mz,{showDivider:!0,primaryButton:(0,r.tZ)(d.zx,{priority:"primary",disabled:!C,loading:E,onClick:()=>{b(null==P?void 0:P.surveys.find(e=>e.id===C),S)},children:_("Insert")}),secondaryButton:(0,r.tZ)(d.zx,{priority:"secondary",onClick:w,children:_("Cancel")})})]})})}},42684:function(e,t,i){"use strict";i.d(t,{Z:()=>m});var n=i(27412),r=i(7409),o=i(99282),a=i(16584),l=i(16564),s=i(86657),d=i(64819),c=i(24763),u=i(21903),p=i(24791),h=i(60308);class m extends u.ZP{isPodcast(){return[l.MR.Podcast,l.MR.PodcastPreview].includes(this.props.feature)}render(e,t){var i,n;let{feature:u,pub:m,initialFile:g,postId:v,setPostId:f,onRecorderStopped:b,onError:w,onRecorderStarted:y,onUploadStarted:_,legacyPodcastUrl:Z,onUploadCanceled:C,skipToRecordStep:x,hideRecorder:S,hideReset:k,components:N}=e,{mediaUpload:P,timeLeft:T,dismissedAudioErrorModal:E}=t,I=null!==(i=null==N?void 0:N.AuditionPlayer)&&void 0!==i?i:c.Z,B=null!==(n=null==N?void 0:N.AudioUploader)&&void 0!==n?n:d.n,D=(0,p.Os)(P);return Z?(0,a.tZ)(s.Z,{feature:u,pub:m,src:Z,render:e=>(0,a.tZ)(I,(0,o._)((0,r._)({},e),{onRemove:this.removeAudio})),mediaUpload:null!=P?P:void 0,trackingProps:{contentType:"post",surface:"editor",entityType:"post",entityKey:null!=v?v:"unknown"}}):(0,a.BX)(a.HY,{children:[(!P||"transcoded"!==P.state||D)&&(0,a.tZ)(B,{feature:u,initialFile:g,mediaType:"audio",postId:v,onUpload:e=>this.onMediaUpload({mediaUpload:e}),setPostId:f,onRecorderStarted:y,onRecorderStopped:b,onError:w,mediaUpload:P,removeUpload:this.removeUpload,onUploadCanceled:C,onUploadStarted:_,transcodeTimeLeft:T,skipToRecordStep:x,language:this.props.language,hideRecorder:S,hideReset:k,onResetToDefault:this.props.onResetToDefault,maxVideoDurationSeconds:null,onVideoTooLong:null}),(null==P?void 0:P.state)==="transcoded"&&(0,a.tZ)(s.Z,{feature:u,pub:m,src:P?(0,h.rhs)("/api/v1/audio/upload/".concat(P.id,"/src")):Z,render:e=>(0,a.tZ)(I,(0,o._)((0,r._)({},e),{onRemove:this.removeAudio})),duration:null==P?void 0:P.duration,playbackRate:1,mediaUpload:null!=P?P:void 0,trackingProps:{surface:"editor",contentType:"post",entityKey:null!=v?v:"unknown",entityType:"post"}}),D&&(0,a.tZ)(l.YX,{isOpen:!E,onDismiss:()=>{this.setState({dismissedAudioErrorModal:!0})}})]})}constructor(e,t){super(e,t),(0,n._)(this,"removeAudio",()=>{var e,t;this.props.legacyPodcastUrl?null===(e=(t=this.props).onRemoveLegacyUrl)||void 0===e||e.call(t):this.removeUpload()}),this.state={mediaUploadId:e.mediaUploadId,mediaUpload:e.mediaUpload||null,estimatedTimeLeftAt:null,timeLeft:0,percentComplete:1,dismissedAudioErrorModal:!1}}}},78592:function(e,t,i){"use strict";let n,r;i.d(t,{G:()=>m});var o=i(16584),a=i(30396),l=i(80569),s=i.n(l),d=i(80026),c=i(6490);function u(){document.getElementById("technical-analysis-chart-demo")&&"TradingView"in window&&(r=new window.TradingView.widget({container_id:"technical-analysis-chart-demo",width:"100%",height:"600",symbol:"AAPL",interval:"D",timezone:"exchange",theme:"light",style:"1",toolbar_bg:"#f1f3f6",withdateranges:!0,hide_side_toolbar:!1,allow_symbol_change:!0,save_image:!1,show_popup_button:!0,popup_width:"1000",popup_height:"650",locale:"en"}))}async function p(e){try{let t=await new Promise((t,i)=>{let n=new Image;n.onload=()=>t(n),n.onerror=e=>i(e),n.src=e});return{height:t.height,width:t.width}}catch(e){return console.error("Error loading image:",e),{height:null,width:null}}}let h=()=>{let e=(0,a.sO)(null);return(0,a.d4)(()=>(e.current=u,n||(n=new Promise(e=>{let t=document.createElement("script");t.id="tradingview-widget-loading-script",t.src="https://s3.tradingview.com/tv.js",t.type="text/javascript",t.onload=e,document.head.appendChild(t)})),n.then(()=>e.current&&e.current()),()=>e.current=null),[]),(0,o.tZ)("div",{className:"tradingview-widget-container",children:(0,o.tZ)("div",{id:"technical-analysis-chart-demo"})})},m=e=>{let{isOpen:t,onClose:i,onInsert:n}=e,[l,u]=(0,a.eJ)(!1);return(0,o.BX)(c.u_,{isOpen:t,onClose:i,width:900,children:[(0,o.tZ)(c.xB,{showClose:!1,title:"Financial Chart"}),(0,o.tZ)(c.fe,{children:(0,o.tZ)(h,{})}),(0,o.tZ)(c.mz,{primaryButton:(0,o.tZ)(d.zx,{priority:"primary",disabled:l,onClick:()=>{u(!0),r.image(async e=>{let t=g(e),r=await s().post("/api/v1/image").send({image:t}),{height:o,width:a}=await p(r.body.url);n({url:r.body.url,height:o,width:a}),u(!1),i()})},children:"Insert"}),secondaryButton:(0,o.tZ)(d.zx,{priority:"secondary",onClick:i,children:"Cancel"})})]})},g=e=>{let t=e.match(/^https:\/\/\w*\.tradingview\.com\/x\/([^\/]+)/);if(!t||!t[1])throw Error("Invalid URL format");return"https://s3.tradingview.com/snapshots/".concat(t[1].substring(0,1).toLowerCase(),"/").concat(t[1],".png")}},39769:function(e,t,i){"use strict";if(i.d(t,{F:()=>F}),4716==i.j)var n=i(7409);if(4716==i.j)var r=i(99282);var o=i(16584),a=i(30396),l=i(94184),s=i.n(l),d=i(39693),c=i.n(d),u=i(24350),p=i.n(u),h=i(57557),m=i.n(h);if(4716==i.j)var g=i(71375);var v=i(80569),f=i.n(v),b=i(71171),w=i.n(b),y=i(95441),_=i(98914),Z=i(15771),C=i(55014),x=i(19081),S=i(8594),k=i(68709),N=i(6490);if(4716==i.j)var P=i(19425);if(4716==i.j)var T=i(12048);var E=i(98661),I=i(88e3);let B=4716==i.j?{modalFixed:"modalFixed-vsWZGw"}:null,D=e=>{let{isOpen:t,children:i,className:n,onClose:r=()=>void 0}=e;return(0,o.tZ)(P.u,{show:t,as:E.Fragment,children:(0,o.tZ)(T.V,{as:"div",onClose:r,open:t,className:s()(B.modalFixed,n),children:(0,o.tZ)(I.Q,{children:(0,o.tZ)(I.l,{className:s()(n,B.modalFixedPanel),width:400,children:i})})})})};var R=i(98248),L=i(58175),M=i(51776),U=i(70379),X=i(63651);let j=4716==i.j?{fileUpload:"fileUpload-MAekNl",compact:"compact-ibnlwO",images:"images-DdFDkM",image:"image-gnZKZk",remove:"remove-ZNF8bv",size1:"size1-dUX40Z",size2:"size2-sshVv9",size4:"size4-V7EJBU"}:null,A="image/heic",O=e=>{let{image:t,onRemove:i,listeners:a}=e;return(0,o.BX)(x.hs,(0,r._)((0,n._)({position:"relative",cursor:"grab",flex:"auto",radius:"xs",overflow:"hidden",className:j.image},a),{children:[(0,o.tZ)(Z.GI,{priority:"secondary",size:"sm",className:j.remove,onClick:i,children:(0,o.tZ)(g.Z,{size:16})}),(0,o.tZ)("img",{src:t.src})]}))},F=e=>{let{isOpen:t,onClose:i,onInsertGallery:l,onUpdateGallery:d,editor:u,editingCurrentSelection:h,postId:g}=e,[v,b]=(0,a.eJ)([]),[P,T]=(0,a.eJ)({}),[E,I]=(0,a.eJ)(new Set),[B,F]=(0,a.eJ)([]),[H,z]=(0,a.eJ)([]),[V,q]=(0,a.eJ)(""),[J,Y]=(0,a.eJ)(""),[W,K]=(0,a.eJ)(!1),[G,$]=(0,a.eJ)(!1),[Q,ee]=(0,a.eJ)({}),[et,ei]=(0,a.eJ)(new Set),{iString:en}=(0,y.M1)(),er=(0,U.pm)();(0,a.d4)(()=>{if(h){let{gallery:e}=u.view.state.selection.node.attrs,t=e.images.map(e=>(0,r._)((0,n._)({},e),{id:w()()}));b(t.map(e=>e.type===A?(0,r._)((0,n._)({},e),{src:(0,X.zF4)(e.src,200)}):e)),I(new Set(t.map(e=>e.id))),T(p()(t,"id")),q(e.caption),Y(e.alt)}},[h]);let eo=()=>{es(),i()},ea=async e=>{if(e.length+v.length>9){er.popToast(e=>(0,o.tZ)(U.FN,(0,r._)((0,n._)({},e),{text:en("Image gallery is limited to 9 images")})));return}let t=[],i=[];for(let n of Array.from(e)){if(n.type===A){i.push(n);continue}let e=await (0,_.Zk)(n);t.push({file:n,src:e,id:w()()})}if(i.length){$(!0);let e=[];for(let t of i){let i=await (0,_.Zk)(t);e.push(f().post("/api/v1/image").send({image:i,postId:g}))}F(e);let o=(await Promise.all(e)).map((e,t)=>({type:e.body.contentType,src:e.body.url,id:w()(),file:i[t]}));ei(new Set(o.map(e=>e.id))),ee(p()(o,"id")),t.push(...o.map(e=>(0,r._)((0,n._)({},e),{src:(0,X.zF4)(e.src,200)}))),$(!1)}b(e=>[...e,...t])},el=e=>{if(v.length<=1)b([]);else{let t=v[e];E.has(t.id)&&T(e=>m()(e,[t.id])),b(t=>[...t.slice(0,e),...t.slice(e+1)])}},es=()=>{z([]),b([]),I(new Set),T({}),ei(new Set),ee({}),q(""),Y("")},ed=(0,a.I4)(async()=>{K(!0);try{let e=[];for(let t of v)if(E.has(t.id)){let{type:i,src:n}=P[t.id];e.push(Promise.resolve({body:{contentType:i,url:n}}))}else if(et.has(t.id)){let{type:i,src:n}=Q[t.id];e.push(Promise.resolve({body:{contentType:i,url:n}}))}else{let i=f().post("/api/v1/image").send({image:t.src,postId:g});z(e=>[...e,i]),e.push(i)}let t={images:(await Promise.all(e)).map(e=>({type:e.body.contentType,src:e.body.url})),caption:V,alt:J};if(1===v.length)t.staticGalleryImage=t.images[0];else{z([]);let e=f().post("/api/v1/image-gallery").send({gallery:t});z([e]);let{body:i}=await e;t.staticGalleryImage={type:i.contentType,src:i.url}}h?d(t):l(t),K(!1),eo()}catch(e){"ABORTED"!==e.code&&(K(!1),er.popToast(e=>(0,o.tZ)(U.FN,(0,r._)((0,n._)({},e),{text:en("Failed to upload gallery images")}))),console.error(e))}},[v,V,J]),ec=new Map(v.map(e=>[e.id,e]));return(0,o.BX)(D,{isOpen:t,onClose:eo,children:[(0,o.tZ)(N.xB,{title:en("Image gallery"),description:en("Add up to 9 images"),showClose:!0,onClose:eo,showDivider:!0}),(0,o.tZ)(N.fe,{children:(0,o.BX)(x.sg,{gap:20,children:[G&&(0,o.BX)(x.sg,{minHeight:220,alignItems:"center",justifyContent:"center",children:[(0,o.tZ)(R.$j,{}),(0,o.tZ)(L.xv.B4,{color:"secondary",children:en("Processing images...")})]}),v.length>0&&!G&&(0,o.tZ)(S.A,{items:v.map(e=>e.id),onReorder:e=>{b(c()(e.map(e=>ec.get(e))))},children:(0,o.tZ)(x.hs,{className:s()(j.images,j["size".concat(v.length)]),wrap:"wrap",gap:4,children:v.map((e,t)=>(0,o.tZ)(S.L,{item:e.id,index:t,children:i=>{let{listeners:n}=i;return(0,o.tZ)(O,{image:e,onRemove:()=>el(t),listeners:n})}},e.id))})}),v.length<9&&!G&&(0,o.tZ)(C.G,{multiple:!0,onFileSelected:ea,dropCTA:en("Drop image files here"),className:s()(j.fileUpload,!!v.length&&j.compact),addMode:v.length>0}),!!v.length&&(0,o.BX)(o.HY,{children:[(0,o.BX)(M.fv,{children:[(0,o.tZ)(k.__,{children:en("Caption")}),(0,o.tZ)(M.oi,{placeholder:en("Add a caption"),value:V,onChange:e=>q(e.currentTarget.value)})]}),(0,o.BX)(M.fv,{children:[(0,o.tZ)(k.__,{children:en("Alt text")}),(0,o.tZ)(M.oi,{placeholder:en("Add a description"),value:J,onChange:e=>Y(e.currentTarget.value)})]})]})]})}),(0,o.tZ)(N.mz,{showDivider:!0,primaryButton:(0,o.tZ)(Z.zx,{priority:"primary",onClick:ed,disabled:!v.length||v.length>9,loading:W,children:h?en("Update gallery"):en("Add gallery")}),secondaryButton:(0,o.tZ)(Z.zx,{priority:"secondary",onClick:()=>{H.forEach(e=>e.abort()),B.forEach(e=>e.abort()),F([]),z([]),K(!1),$(!1),eo()},children:en("Cancel")})})]})}},60310:function(e,t,i){"use strict";if(i.d(t,{Z:()=>x}),4716==i.j)var n=i(7409);if(4716==i.j)var r=i(99282);if(4716==i.j)var o=i(58865);var a=i(16584),l=i(98661),s=i(30396),d=i(23279),c=i.n(d),u=i(23493),p=i.n(u),h=i(80569),m=i.n(h),g=i(64515);let v=4716==i.j?e=>(0,a.tZ)(g.l,(0,r._)((0,n._)({},e),{className:"filled-icon",name:"UnsplashIcon",svgParams:{height:24,width:24,fill:"#1C110B"},children:(0,a.tZ)("path",{d:"M15.3364 10.9703H21V21H3V10.9703H8.66362V15.9748H15.3158V10.9703H15.3364ZM15.3364 3H8.66362V8.02517H15.3158V3H15.3364Z",strokeWidth:0})})):null;var f=i(93666),b=i(95441),w=i(7882),y=i(15771);function _(){let e=(0,o._)(["No results for ",""]);return _=function(){return e},e}let Z="random",C=e=>e&&e.toLowerCase().trim()||Z,x=4716==i.j?e=>{let{open:t,onAfterClose:o,onSelectStockImage:d}=e,[u,h]=(0,s.eJ)(""),[g,x]=(0,s.eJ)(null),[S,k]=(0,s.eJ)({}),[N,P]=(0,s.eJ)(!1),[T,E]=(0,s.eJ)(!1),[I,B]=(0,s.eJ)(null),D=(0,s.sO)(null),R=(0,s.sO)(null),L=(0,s.sO)(null),M=(0,s.sO)(null),U=(0,s.sO)(!1),X=I&&I.screen<=540?2:3,j=I?Math.floor((I.content-4*(X-1))/X):0,{result:A}=(0,w.Wf)(()=>i.e("7381").then(i.t.bind(i,58751,23)),[],{auto:!0}),O=null==A?void 0:A.default,{iString:F,iTemplate:H}=(0,b.M1)();(0,s.d4)(()=>{let e=()=>{B({content:parseInt(window.getComputedStyle(R.current).getPropertyValue("width"),10),screen:window.innerWidth})};return t&&(D.current.open(),window.addEventListener("resize",e),setTimeout(()=>{e(),R.current.focus()},50)),()=>{x(null),h(""),window.removeEventListener("resize",e)}},[t]);let z=(0,s.I4)(async()=>{if(!g||!g.hasMore||U.current)return;U.current=!0;let e=C(u),t=await m().get("/api/v1/stock-photos").query({search:e,offset:g.results.length,limit:15}),i=(0,r._)((0,n._)({},g),{results:[...g.results,...t.body.results],hasMore:t.body.hasMore});x(i),k(t=>(0,r._)((0,n._)({},t),{[e]:i})),U.current=!1},[g,u]);(0,s.d4)(()=>{let e=p()(e=>{let{scrollTop:t,clientHeight:i,scrollHeight:n}=e.target;t>n-i-380&&z()},200,{leading:!1}),i=L.current;return t&&(null==i||i.addEventListener("scroll",e)),()=>{null==i||i.removeEventListener("scroll",e)}},[t,z]),(0,s.d4)(()=>{if(O&&g&&j){if(0===g.results.length||N||!t){var e;null===(e=M.current)||void 0===e||e.destroy(),M.current=null}else M.current?(M.current.reloadItems(),M.current.layout()):setTimeout(()=>{M.current=new O(".insert-image-modal-images",{itemSelector:".insert-image-modal-item",transitionDuration:0,gutter:4})},50)}},[g,N,j,t]);let V=(0,s.I4)(async e=>{let t=C(e);if(S[t]){P(!1),x(S[t]),L.current.scrollTop=0;return}try{let i=await m().get("/api/v1/stock-photos").query({search:t,offset:0,limit:15}),o={results:i.body.results,hasMore:i.body.hasMore,term:e};P(!1),x(o),k(e=>(0,r._)((0,n._)({},e),{[t]:o})),L.current.scrollTop=0}catch(e){P(!0)}},[S]),q=(0,s.I4)(c()(V,400),[V]);(0,s.d4)(()=>{t&&!g&&V(Z)},[V,t,g]);let J=async e=>{h(e),await q(e)},Y=async e=>{E(!0),await m().post("/api/v1/stock-photos").send({downloadLocation:e.links.download_location}),d({url:e.urls.regular,width:e.width,height:e.height,description:e.alt_description,userName:e.user.name,userHref:!!e.user.links.html}),E(!1),D.current.close()},W=document.querySelector(".editor");return W?(0,l.createPortal)((0,a.tZ)("div",{onMouseDown:e=>{e.stopPropagation()},children:(0,a.BX)(f.p,{ref:D,closePill:!0,className:"insert-media-modal insert-image-modal force-light-theme",onClose:o,children:[(0,a.tZ)("h3",{className:"insert-media-modal-header",children:F("Search images")}),(0,a.tZ)("div",{className:"form new-form",children:(0,a.tZ)("input",{className:"insert-image-modal-search",ref:R,type:"text","aria-label":F("Search"),placeholder:F("Search..."),value:u,onChange:e=>{J(e.target.value)}})}),(0,a.BX)("div",{className:"insert-image-modal-byline",children:[(0,a.tZ)(v,{height:14})," ",F("Powered by Unsplash")]}),(0,a.tZ)("div",{className:"insert-image-modal-body",ref:L,children:N?(0,a.tZ)("div",{className:"insert-image-modal-empty",children:F("There was an error searching photos. Please try again later.")}):g&&g.results.length>0?(0,a.tZ)("div",{className:"insert-image-modal-images",children:g.results.map(e=>(0,a.BX)("div",{className:"insert-image-modal-item",children:[(0,a.tZ)("img",{src:e.urls.small,alt:e.alt_description,width:j,height:e.height/e.width*j}),(0,a.BX)("div",{className:"insert-image-modal-item-footer",children:[(0,a.BX)("div",{className:"insert-image-modal-item-text",children:[(0,a.tZ)("div",{className:"insert-image-modal-item-title",children:e.description}),(0,a.tZ)("div",{className:"insert-image-modal-item-name",children:e.user.name})]}),(0,a.tZ)(y.zx,{size:"sm",priority:"secondary",disabled:T,onClick:()=>{Y(e)},children:F("Insert")})]})]},e.id))}):g&&0===g.results.length?(0,a.tZ)("div",{className:"insert-image-modal-empty",children:H(_(),"“".concat(g.term,"”"))}):null})]})}),W):null}:null},20479:function(e,t,i){"use strict";i.d(t,{x:()=>h});var n=i(16584),r=i(30396),o=i(347),a=i(95441),l=i(7882),s=i(15771),d=i(19081),c=i(6490),u=i(17688),p=i(58175);let h=e=>{let{isOpen:t,setOpen:i,onInsert:h}=e,{iString:m}=(0,a.M1)(),[g,v]=(0,r.eJ)(null),{result:f,isLoading:b,refetch:w}=(0,l.ib)({method:"GET",pathname:"/api/v1/sponsorship-campaigns"}),y=(0,r.I4)(()=>{w()},[]);return(0,r.d4)(()=>{t&&y()},[t,y]),(0,n.BX)(c.u_,{isOpen:t,onClose:()=>i(!1),children:[(0,n.tZ)(c.xB,{title:m("Insert a sponsorship campaign"),description:(0,n.tZ)(n.HY,{children:(0,n.tZ)(p.xv.B4,{translated:!0,children:"Sponsorship campaigns are blocks that display text and images provided by a sponsor. They will appear in newsletter emails and on the web. Select an existing campaign from the list below or create a new one"})}),showClose:!0,onClose:()=>i(!1)}),(0,n.tZ)(c.fe,{children:(null==f?void 0:f.length)?(0,n.BX)(d.tu,{gap:4,textAlign:"right",children:[(0,n.BX)(u.i,{value:null==g?void 0:g.id,onChange:e=>v(f.find(t=>t.id===e.currentTarget.value)||null),children:[(0,n.tZ)(u.d,{children:m("Select a campaign")}),f.map(e=>(0,n.tZ)("option",{value:e.id,children:e.title}))]}),(0,n.tZ)(p.xv.B4,{translated:!0,as:"a",href:"/publish/sponsorship-campaigns",children:"Manage Campaigns"})]}):b?(0,n.tZ)(p.xv.B4,{translated:!0,children:"Loading campaigns..."}):(0,n.BX)(p.xv.B4,{translated:!0,children:["No campaigns found. ",(0,n.tZ)("a",{href:"/publish/sponsorship-campaigns",children:"Manage Campaigns"})]})}),(0,n.tZ)(o.h,{children:(0,n.tZ)(c.mz,{primaryButton:(0,n.tZ)(s.zx,{disabled:!g,priority:"primary",onClick:()=>{g&&(h(g),i(!1))},children:m("Insert Campaign")}),secondaryButton:(0,n.tZ)(s.zx,{priority:"secondary",onClick:()=>i(!1),children:m("Cancel")})})})]})}},44369:function(e,t,i){"use strict";i.d(t,{$4:()=>s,Sm:()=>m,cS:()=>v,mg:()=>h,nv:()=>p,om:()=>b,pA:()=>f,vM:()=>g});var n=i(27412),r=i(42249),o=i(68833),a=i(98914),l=i(60308);class s extends r.sN{static fromMenuItem(e,t){let{spec:i}=e;return new s(i,t)}constructor(e,t){super(e);let i=this.spec.run;this.spec.run=(e,n,r,a)=>((0,o.j)(o.FP.EDITOR_MENU_ICON_CLICKED,{button:t||this.spec.label||this.spec.title}),i.call(this,e,n,r,a))}}let d="ProseMirror-prompt",c="".concat(d,"-visible");class u{read(e){return e.value}validate(e){return(e=this.clean(e))||!this.options.required?this.options.validate&&this.options.validate(e):"Required field"}clean(e){return this.options.clean?this.options.clean(e):e}constructor(e){(0,n._)(this,"options",void 0),this.options=e}}class p extends u{render(){let e=document.createElement("input");return e.type="text",e.placeholder=this.options.label,e.value=this.options.value||"",e.className=this.options.className||"",e.autocomplete="off",e}}class h extends(4716==i.j?u:null){render(){let e=document.createElement("select");e.value=this.options.value||"";let t=document.createElement("option");return t.textContent=this.options.label,t.value="",e.appendChild(t),this.options.options.forEach((t,i)=>{let n=document.createElement("option");n.textContent=t.label,n.value=String(i),e.appendChild(n)}),this.options.onChange&&e.addEventListener("change",()=>{let t=this.read(e);this.options.onChange(t)},!1),e}read(e){let t=this.options.options[e.value];return t&&t.value}}class m extends p{constructor(e,t,i="en"){let{iString:n}=I18N.i(i);super({label:n("Enter URL..."),className:"url-input",value:t||e&&e.mark.attrs.href||"",required:!0,clean:e=>{let t;return e?(t=e.trim()).startsWith("http")||t.startsWith("mailto")||/^%%.*%%$/.test(t)?t:"http://".concat(t):""},validate:e=>{if(!/^%%.*%%$/.test(e)){if(e.startsWith("".concat((0,l.SVA)(),"/publish/post/"))&&alert(n("This is a link to a post draft. Readers will not be able to access this page.")),e.length>1900)return n("Link is too long");try{let t=new URL(e);if(["http:","https:","mailto:"].includes(t.protocol))return}catch(e){console.error("Failed to parse URL:",e)}return e.startsWith("http")?n("Invalid URL"):n("Invalid URL. Try using http://")}}})}}function g(e,t){let{from:i,$from:n,to:r,empty:o}=e.selection;return o?!!t.isInSet(e.storedMarks||n.marks()):e.doc.rangeHasMark(i,r,t)}function v(e){if(f(e))return;let{iString:t}=I18N.i(e.language||"en"),i="".concat(d,"-").concat(e.parentClass),n=e.root||document.body,r=e.scrollParent&&document.querySelector&&document.querySelector(e.scrollParent)||function e(t){return null==t?null:t.scrollHeight>t.clientHeight?t:e(t.parentElement)}(n)||window,o=n.appendChild(document.createElement("div"));o.classList.add(d),e.className&&o.classList.add(e.className),o.id=i,(0,a.cn)(document.body,c);let l=e=>{o.contains(e.target)||p()},s=()=>{if(e.position)e.position(o,h);else{var t,i;let n=e.parentClass&&(null===(t=(i=document).querySelector)||void 0===t?void 0:t.call(i,".".concat(e.parentClass)));if(n){let t=n.getBoundingClientRect();o.style.top="".concat(t.bottom+(e.offsetTop||0),"px"),o.style.left="".concat(t.left+(e.offsetLeft||0),"px")}else{let t=o.getBoundingClientRect();o.style.top="".concat((window.innerHeight-t.height)/2+(e.offsetTop||0),"px"),o.style.left="".concat((window.innerWidth-t.width)/2+(e.offsetLeft||0),"px")}}},u=t=>{var i;t&&t.preventDefault();let n=function(e,t){let i={},n=0;for(let r in e){let o=e[r],a=t[n++],l=o.read(a),s=o.validate(l);if(s)return function(e,t){let i=e.parentNode;if(!i)return;let n=i.appendChild(document.createElement("div"));n.style.left="".concat(e.offsetLeft+e.offsetWidth+2,"px"),n.style.top="".concat(e.offsetTop-5,"px"),n.className="ProseMirror-invalid",n.textContent=t,setTimeout(()=>i.removeChild(n),1500)}(a,s),null;i[r]=o.clean(l)}return i}(null!==(i=e.fields)&&void 0!==i?i:{},m);n&&p(n)},p=t=>{(0,a.IV)(document.body,c),window.removeEventListener("mousedown",l),window.removeEventListener("resize",s,!1),r.removeEventListener("scroll",s,!1),o.parentNode&&o.parentNode.removeChild(o),t?(e.onSubmit&&e.onSubmit(t),e.callback&&e.callback(t)):e.onCancel&&e.onCancel(),e.onClose&&e.onClose()};setTimeout(()=>window.addEventListener("mousedown",l),50),window.addEventListener("resize",s,!1),r.addEventListener("scroll",s,!1);let h=o.appendChild(document.createElement("span"));h.className="head";let m=[],g=0;for(let t in e.fields){g++;let i=e.fields[t].render();i.tabIndex=g,m.push(i)}let v=o.appendChild(document.createElement("form"));if(e.title&&(v.appendChild(document.createElement("h5")).textContent=e.title),m.forEach(e=>{v.appendChild(document.createElement("div")).appendChild(e)}),!e.no_buttons){let i=document.createElement("button");i.type="submit",i.className="".concat(d,"-submit"),i.textContent=e.submitText||"OK",i.addEventListener("click",u);let n=document.createElement("button");n.type="button",n.className="".concat(d,"-cancel"),n.textContent=t("Cancel"),n.addEventListener("click",()=>p());let r=v.appendChild(document.createElement("div"));r.className="".concat(d,"-buttons"),r.appendChild(i),r.appendChild(document.createTextNode(" ")),r.appendChild(n)}if(e.footer&&v.appendChild(e.footer),e.openseaEmbedFooter&&v.appendChild(e.openseaEmbedFooter),s(),v.addEventListener("submit",u),e.onInput&&v.addEventListener("input",t=>{var i;null===(i=e.onInput)||void 0===i||i.call(e,t,o)}),v.addEventListener("keydown",e=>{if(27==e.keyCode)e.preventDefault(),p();else if(13!=e.keyCode||e.ctrlKey||e.metaKey||e.shiftKey){if(9==e.keyCode&&(window.setTimeout(()=>{o.contains(document.activeElement)||p()},500),m.length>1)){for(let t=0;t0){let e=v.elements[0];for(let t of Array.from(v.elements))if(!t.value&&["INPUT","TEXTAREA"].includes(t.nodeName)){e=t;break}e.focus()}}function f(e){let t="".concat(d,"-").concat(e.parentClass),i=document.getElementById(t);if(i){let e;if(i.querySelector&&(e=i.querySelector(".".concat(d,"-cancel"))),e)e.click();else{var n;null===(n=i.parentNode)||void 0===n||n.removeChild(i),(0,a.IV)(document.body,c)}return!0}}function b(e,t){let i=e.selection.$from;for(let e=i.depth;e>=0;e--){let n=i.index(e);if(i.node(e).canReplaceWith(n,n,t))return!0}return!1}},66586:function(e,t,i){"use strict";i.d(t,{k:()=>f});var n=i(16584),r=i(30396),o=i(23493),a=i.n(o),l=i(16564),s=i(95441),d=i(42684),c=i(47921),u=i(68833),p=i(15771),h=i(19081),m=i(58175),g=i(87077);let v=a()((e,t)=>{e({mediaUploadId:null==t?void 0:t.id,duration:null==t?void 0:t.duration,mediaUpload:t})},1e3,{trailing:!1}),f=e=>{let{id:t,droppedFile:i,open:o,pub:a,postId:f,onSave:b,onClose:w,setPostId:y}=e,[_,Z]=(0,r.eJ)(null!=i?i:null),[C,x]=(0,r.eJ)(null),[S,k]=(0,r.eJ)(!1),{iString:N,language:P}=(0,s.M1)();(0,r.d4)(()=>{Z(i)},[i]);let T=()=>{(!S||confirm(N("Your audio will be discarded, are you sure?")))&&((0,u.j)(u.FP.AUDIO_MODAL_CANCEL_CLICKED,{has_media_upload:!!C}),E())},E=()=>{x(null),Z(null),w()},I=(null==C?void 0:C.state)!=="transcoded";return(0,n.BX)(c.n,{wrapperId:t,title:N(l.MR.Embed),isOpen:o,onClose:T,primaryButton:(0,n.tZ)(g.u,{disabled:!I,text:N("Audio needed"),children:(0,n.tZ)(p.zx,{priority:"primary",onClick:()=>{(0,u.j)(u.FP.AUDIO_MODAL_INSERT_CLICKED),v(b,C),E()},disabled:I,children:N("Insert")})}),secondaryButton:(0,n.tZ)(p.zx,{priority:"secondary-outline",onClick:T,children:N("Cancel")}),children:[(0,n.tZ)(m.xv.B4,{paddingBottom:24,children:N(l.PN.Embed)}),(0,n.BX)(h.tu,{padding:16,radius:"md",border:"detail",children:[(0,n.tZ)(m.xv.B2,{weight:"semibold",translated:!0,paddingBottom:16,children:"Create audio"}),(0,n.tZ)(d.Z,{initialFile:_,feature:l.MR.Embed,mediaType:"audio",pub:a,postId:f,setPostId:y,onChange:e=>{let{mediaUpload:t}=e;k(!1),x(t),Z(null)},onUploadStarted:()=>{k(!0)},onUploadCanceled:()=>{k(!1)},mediaUpload:C,mediaUploadId:null==C?void 0:C.id,onRemoveLegacyUrl:null,language:P})]})]})}},57952:function(e,t,i){"use strict";i.d(t,{Rq:()=>j,Xf:()=>M,_F:()=>R,pH:()=>L});var n=i(16584),r=i(6400),o=i(30396),a=i(23279),l=i.n(a);if(4716==i.j)var s=i(62686);if(2787!=i.j)var d=i(71375);if(2787!=i.j)var c=i(24840);if(4716==i.j)var u=i(53716);if(4716==i.j)var p=i(85200);if(4716==i.j)var h=i(887);if(4716==i.j)var m=i(71212);if(4716==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),w=i(95441),y=i(4796),_=i(68833),Z=i(98422),C=i(15771),x=i(61254),S=i(19081),k=i(44424),N=i(58175),P=i(98905),T=i(98012),E=i(61468),I=i(84864),B=i(22233);let D=(0,r.createContext)({isSearching:!1,items:[],setIsSearching:()=>void 0,setItems:()=>void 0,focusedItemStart:null,setFocusedItemStart:()=>void 0,filteredItems:[],searchTerm:null,setSearchTerm:()=>void 0,hasFiltered:!1}),R=e=>{let{children:t}=e,[i,r]=(0,o.eJ)(!1),[a,l]=(0,o.eJ)([]),[s,d]=(0,o.eJ)(null),[c,u]=(0,o.eJ)(null),{filteredItems:p,setQuery:h,hasFiltered:m}=(0,b.R)({items:a,getKeys:e=>[e.text],sortFunc:(e,t)=>e.start-t.start});return(0,o.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)(D.Provider,{value:{isSearching:i,setIsSearching:r,items:a,setItems:l,focusedItemStart:s,setFocusedItemStart:d,filteredItems:p,hasFiltered:m,searchTerm:c,setSearchTerm:e=>{u(e),h(e)}},children:t})},L=()=>(0,o.qp)(D),M=e=>{let{isEditing:t,setIsEditing:i,setEdits:r,hasEdits:o,handleSubmitEdits:a,handleRegenerateTranscription:l,handleCancelTranscription:c,isTranscribing:u,transcription:p,postId:h,audioUpload:m,onTranscriptionUploadCancelled:g,onTranscriptionUploadError:v,onTranscriptionUploadStarted:f,onTranscriptionUploaded:b,uploadedFile:w,setUploadedFile:y,isEditingSpeakers:Z}=e,{isSearching:x}=L();return(0,n.BX)(S.tu,{gap:16,children:[w&&(0,n.BX)(S.gq,{alignItems:"center",justifyContent:"space-between",padding:16,radius:"sm",border:"detail",gap:16,children:[(0,n.BX)(S.gq,{gap:16,alignItems:"center",children:[(0,n.tZ)(S.hs,{alignItems:"center",padding:8,radius:"sm",color:"primary",bg:"secondary",children:(0,n.tZ)(s.Z,{})}),(0,n.BX)(S.tu,{children:[(0,n.tZ)(N.xv.B3,{weight:"semibold",color:"primary",children:w.name}),(0,n.tZ)(N.xv.B4,{children:(0,I.numberToHumanFileSize)(w.size)})]})]}),(0,n.tZ)(C.hU,{onClick:()=>{(0,_.j)(_.FP.TRANSCRIPTION_EDIT_CANCELLED_CLICKED,{post_id:h}),y(null),c()},children:(0,n.tZ)(d.Z,{})})]}),t&&(0,n.tZ)(X,{hasEdits:o,setIsEditing:i,setEdits:r,handleSubmitEdits:a}),!t&&!x&&(0,n.tZ)(U,{isEditingSpeakers:Z,setIsEditing:i,transcription:p,isTranscribing:u,handleCancelTranscription:c,handleRegenerateTranscription:l,setUploadedFile:y,postId:h,audioUpload:m,onTranscriptionUploadCancelled:g,onTranscriptionUploadError:v,onTranscriptionUploadStarted:f,onTranscriptionUploaded:b}),x&&(0,n.tZ)(j,{postId:h})]})},U=e=>{var t,i,r;let{transcription:o,isTranscribing:a,handleCancelTranscription:l,handleRegenerateTranscription:s,setUploadedFile:d,postId:v,audioUpload:f,onTranscriptionUploadStarted:b,onTranscriptionUploadCancelled:Z,onTranscriptionUploadError:N,onTranscriptionUploaded:P,setIsEditing:I,isEditingSpeakers:D}=e,{iString:R}=(0,w.M1)(),M=(null==o?void 0:o.created_at)&&new Date(o.created_at)<(0,T.Z)().subtract(5,"minutes").toDate(),U=(null==o?void 0:o.status)==="failed",X=(null==o?void 0:o.status)==="transcribed",{setIsSearching:j}=L(),A=null===(t=(null!==(i=null==o?void 0:o.signed_captions)&&void 0!==i?i:[]).find(e=>"True"===e.original))||void 0===t?void 0:t.url,O=async e=>{if(e.cdn_unaligned_url&&e.cdn_url)try{var t,i,n,r;let o=await fetch(e.cdn_unaligned_url,{headers:{Accept:"text/plain"}}),a=await o.text(),l=JSON.parse(a),s=null!==(i=l.segments)&&void 0!==i?i:[];Object.keys(null!==(n=l.speaker_map)&&void 0!==n?n:{}).length>0&&(null==s?void 0:null===(t=s[0])||void 0===t?void 0:t.speaker)||(o=await fetch(e.cdn_url,{headers:{Accept:"text/plain"}}),a=await o.text(),s=JSON.parse(a));let d=(0,E.Vu)(s,null!==(r=e.speaker_map)&&void 0!==r?r:{}),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)(S.gq,{justifyContent:"space-between",gap:8,children:[(0,n.tZ)(C.hU,{onClick:()=>{(0,_.j)(_.FP.TRANSCRIPTION_SEARCH_CLICKED,{post_id:v}),j(!0)},disabled:D,children:(0,n.tZ)(c.Z,{})}),(0,n.BX)(S.gq,{gap:8,children:[(0,n.tZ)(C.zx,{onClick:s,disabled:!(X&&!M||!a||U)||D,leading:(0,n.tZ)(u.Z,{}),priority:"secondary",children:R("Regenerate")}),(0,n.tZ)(y.z,{setUploadedFile:d,postId:v,mediaUpload:f,transcription:null!=o?o:null,onTranscriptionUploadStarted:b,onTranscriptionUploadCancelled:Z,onTranscriptionUploadError:N,onTranscriptionUploaded:P,disabled:!v||!f||(null==f?void 0:f.state)!=="transcoded"||D}),(0,n.BX)(k.v2,{trigger:(0,n.tZ)(C.hU,{priority:"secondary",rounded:!1,children:(0,n.tZ)(p.Z,{className:B.Z.icon})}),children:[(null==o?void 0:o.status)==="transcribed"&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(k.sN,{disabled:D,onClick:()=>{(0,_.j)(_.FP.TRANSCRIPTION_EDIT_CLICKED,{post_id:v}),I(!0)},leading:(0,n.tZ)(h.Z,{}),children:R("Correct transcript")}),(0,n.tZ)(x.iz,{}),(0,n.BX)(k.LY,{leading:(0,n.tZ)(m.Z,{}),content:R("Download"),children:[(0,n.tZ)(k.sN,{disabled:D,onClick:()=>{(0,_.j)(_.FP.TRANSCRIPTION_DOWNLOAD_CLICKED,{post_id:v,type:"txt"}),O(o)},children:R("Download .txt file")}),(0,n.tZ)(k.sN,{disabled:D,href:null!==(r=o.cdn_url)&&void 0!==r?r:void 0,onClick:()=>{(0,_.j)(_.FP.TRANSCRIPTION_DOWNLOAD_CLICKED,{post_id:v,type:"json"})},children:R("Download .json file")}),A&&(0,n.tZ)(k.sN,{disabled:D,href:A,onClick:()=>{(0,_.j)(_.FP.TRANSCRIPTION_DOWNLOAD_CLICKED,{post_id:v,type:"vtt"})},children:R("Download .vtt file")})]}),(0,n.tZ)(x.iz,{})]}),(0,n.tZ)(k.sN,{disabled:!o||D,priority:"destructive",leading:(0,n.tZ)(g.Z,{}),onClick:l,children:R("Remove")})]})]})]})},X=e=>{let{setIsEditing:t,setEdits:i,hasEdits:r,handleSubmitEdits:o}=e,{iString:a}=(0,w.M1)();return(0,n.BX)(S.gq,{justifyContent:"end",gap:8,children:[(0,n.tZ)(C.zx,{onClick:()=>{t(!1),i({})},priority:"secondary",children:a("Cancel")}),(0,n.tZ)(C.zx,{priority:"primary",disabled:!r,onClick:o,children:a("Save")})]})},j=e=>{let{postId:t,closeAlwaysVisible:i=!0}=e,{iString:r}=(0,w.M1)(),{isMobile:a}=(0,Z.v9)(),s=(0,o.sO)(null),{setSearchTerm:u,setIsSearching:p,hasFiltered:h,filteredItems:m,setFocusedItemStart:g,focusedItemStart:b,searchTerm:y}=L();(0,o.d4)(()=>{!y&&s.current&&(s.current.value="")},[y]);let x=m.findIndex(e=>e.start===b),k=()=>{let e=x+1>=m.length?0:x+1;g(m[e].start)},T=()=>{u(""),p(!1),(0,_.j)(_.FP.TRANSCRIPTION_SEARCH_CANCELLED,{post_id:t})};return(0,n.BX)(S.gq,{gap:8,justifyContent:"space-between",alignItems:"center",className:B.Z.searchForm,children:[(0,n.tZ)(P.K,{ref:s,leftIcon:(0,n.tZ)(S.gq,{children:(0,n.tZ)(c.Z,{size:16})}),rightIcon:(0,n.tZ)(S.gq,{cursor:"pointer",onClick:T,children:y||i?(0,n.tZ)(d.Z,{size:16}):null}),placeholder:r("Search"),onChange:l()(e=>{u(e.target.value),(0,_.j)(_.FP.TRANSCRIPTION_SEARCHED,{post_id:t})},100),onKeyDown:e=>{"Enter"===e.key&&k(),"Escape"===e.key&&T()}}),h&&(0,n.tZ)(S.gq,{gap:8,paddingRight:8*!!a,children:(0,n.BX)(S.gq,{alignItems:"center",gap:8,children:[(0,n.tZ)(N.xv.B4,{paddingLeft:a?4:16,className:B.Z.resultsValue,color:"primary",weight:"semibold",children:"".concat(x+1," / ").concat(m.length)}),(0,n.BX)(S.gq,{children:[(0,n.tZ)(C.hU,{priority:"tertiary",size:"sm",onClick:()=>{let e=x-1<0?m.length-1:x-1;g(m[e].start)},children:(0,n.tZ)(v.Z,{size:20})}),(0,n.tZ)(C.hU,{priority:"tertiary",size:"sm",onClick:k,children:(0,n.tZ)(f.Z,{size:20})})]})]})})]})}},47921:function(e,t,i){"use strict";i.d(t,{n:()=>Z});var n=i(16584);if(4716==i.j)var r=i(71375);var o=i(33804),a=i(71068),l=i(15771),s=i(6400),d=i(98661),c=i(30396);if(4716==i.j)var u=i(19425);var p=i(94184),h=i.n(p),m=i(19081);let g=4716==i.j?{animation:"animation-BHdm9o",offscreen:"offscreen-g4eykY",onscreen:"onscreen-FmAcAO",container:"container-c7lblE",drawer:"drawer-hBg1Rc"}:null;function v(e){let{children:t,wrapperId:i}=e,n=document.getElementById(i);return(null===n&&((n=document.createElement("div")).setAttribute("id",i),document.body.appendChild(n)),n)?(0,d.createPortal)(t,n):null}let f=e=>{let{isOpen:t,wrapperId:i="drawer-portal",children:r,includeTransition:o=!0,className:l,width:d=400}=e,u=(0,c.sO)(null);(0,c.d4)(()=>{t&&u.current&&u.current.focus()},[u,t]);let p=o?b:s.Fragment;return(0,n.tZ)(v,{wrapperId:i,children:(0,n.tZ)(p,{isOpen:t,children:(0,n.tZ)(a.xu,{width:d,ref:u,borderLeft:"detail",shadow:"xl",className:h()(g.drawer,l),children:(0,n.tZ)(m.tu,{className:h()("drawer-scroll",g.container),bg:"primary",overflowY:"auto",shadow:"xl",children:r})})})})},b=e=>{let{children:t,isOpen:i}=e;return(0,n.tZ)(u.u.Root,{show:i,children:(0,n.tZ)(u.u.Child,{as:s.Fragment,enter:g.animation,enterFrom:g.offscreen,enterTo:g.onscreen,leave:g.animation,leaveFrom:g.onscreen,leaveTo:g.offscreen,children:t})})};var w=i(58175);let y=4716==i.j?{container:"container-H2Tu59"}:null,_=e=>{let{title:t,onClose:i}=e;return t||i?(0,n.tZ)(a.xu,{paddingX:{mobile:16,desktop:24},paddingTop:24,children:(0,n.BX)(m.gq,{alignItems:"center",justifyContent:"space-between",children:[t&&(0,n.tZ)(w.xv.H3,{weight:"bold",children:t}),i&&(0,n.tZ)(m.gq,{paddingLeft:12,alignItems:"center",children:(0,n.tZ)(l.hU,{size:"sm","aria-label":"Close",priority:"tertiary",onClick:i,children:(0,n.tZ)(r.Z,{"aria-hidden":"true"})})})]})}):null},Z=e=>{let{width:t=400,isOpen:i,children:r,title:l,onClose:s,primaryButton:d,secondaryButton:c,wrapperId:u,variant:p="overlay",className:h,drawerClassName:g}=e;return(0,n.tZ)(f,{className:g,includeTransition:"overlay"===p,width:t,isOpen:i,wrapperId:u,children:(0,n.BX)(o.w,{children:[(0,n.BX)(m.tu,{className:h,flex:"fill",overflowY:"auto",children:[(0,n.tZ)(_,{title:l,onClose:s}),(0,n.tZ)(a.xu,{className:y.container,paddingX:{desktop:24,mobile:16},paddingTop:l||s?24:0,children:r})]}),d&&(0,n.BX)(m.gq,{gap:8,padding:16,justifyContent:"end",borderY:"detail",children:[d,c]})]})})}},4796:function(e,t,i){"use strict";i.d(t,{z:()=>w});var n=i(16584),r=i(30396);if(4716==i.j)var o=i(32224);var a=i(98661),l=i(80569),s=i.n(l),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(44424),f=i(61468);let b=4716==i.j?[".txt",".srt",".vtt"]:null,w=e=>{let{postId:t,mediaUpload:i,transcription:l,onTranscriptionUploadStarted:w,onTranscriptionUploadCancelled:y,onTranscriptionUploadError:_,onTranscriptionUploaded:Z,disabled:C,setUploadedFile:x}=e,{iString:S}=(0,d.M1)(),[k,N]=(0,r.eJ)(!1),[P,T]=(0,r.eJ)(""),E=l&&"in_progress"===l.status,[I,B]=(0,r.eJ)(null),D=async e=>{if(B(e),null==w||w(),e.length>0&&e[0]){var n;x&&x(e[0]);let r=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:r}),u(e[0],async t=>{T(t);let n=null,o={};try{if("txt"===r){var a;[n,o]=(0,f.kF)(t,null!==(a=null==i?void 0:i.duration)&&void 0!==a?a:0)}else"vtt"===r?[n,o]=(0,f.$h)(t):"srt"===r&&([n,o]=(0,f.$h)(t));let l=(0,f.ob)(n);if(n&&!l)await R(e[0],r,n,o);else{let e=S("Error validating transcription file"),t="".concat(e,": ").concat(l);console.error(t),null==_||_(t)}}catch(t){let e=S("Error parsing transcription file");console.error(e,t),null==_||_(e),x&&x(null)}finally{X()}})}},R=async(e,n,r,o)=>{let{body:a}=await s().post("/api/v1/drafts/".concat(t,"/upload_transcription/start")).send({speaker_map:o}),{originalTranscriptionFileKey:l,unalignedTranscriptionFileKey:d,alignedTranscriptionFileKey:c}=a;N(!0);try{var u;await s().put(l).send(e).set("Content-Type",e.type),await s().put(d).send(JSON.stringify(r)).set("Content-Type","application/json"),await s().put(c).send(JSON.stringify(null!==(u=null==r?void 0:r.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 r;(null===(r=e.body)||void 0===r?void 0:r.data)&&((0,p.j)(p.FP.TRANSCRIPTION_UPLOAD_FILE_COMPLETED,{post_id:t,audio_upload_id:null==i?void 0:i.id,type:n}),N(!1),Z(e.body.data),X())})}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==_||_(S("Error uploading transcription file"))}};(0,a.useEffect)(()=>{},[P]);let{openFileDialog:L,fileInputRef:M}=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,a.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:U}=function(e){let{onFilesSelected:t}=e,[i,n]=(0,a.useState)(!1),r=(0,a.useRef)(null),o=e=>{e.preventDefault(),e.stopPropagation()},l=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,a.useEffect)(()=>{let e=r.current;if(e)return e.addEventListener("dragenter",o),e.addEventListener("dragleave",l),e.addEventListener("dragover",s),e.addEventListener("drop",d),()=>{e.removeEventListener("dragenter",o),e.removeEventListener("dragleave",l),e.removeEventListener("dragover",s),e.removeEventListener("drop",d)}},[r]),{dropRef:r,dragging:i}}({onFilesSelected:D}),X=()=>{B(null),M.current&&(M.current.value=""),null==y||y()},j=null==I?void 0:I[0],A=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}),M.current&&(M.current.accept=e,setTimeout(()=>L(),50))};return E?null:(0,n.BX)(g.tu,{gap:8,children:[!k&&(0,n.BX)(v.v2,{ref:U,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:C,priority:"secondary",leading:(0,n.tZ)(o.Z,{size:18}),children:S("Upload transcript")}),children:[(0,n.tZ)(v.sN,{onClick:()=>A(".txt"),children:S("Upload .txt file")}),(0,n.tZ)(m.iz,{}),(0,n.tZ)(v.sN,{onClick:()=>A(".vtt"),children:S("Upload .vtt file")}),(0,n.tZ)(m.iz,{}),(0,n.tZ)(v.sN,{onClick:()=>A(".srt"),children:S("Upload .srt file")})]}),j&&(0,n.tZ)(g.tu,{gap:8}),(0,n.tZ)("input",{type:"file",ref:M,style:{display:"none"},accept:b.join(",")})]})}},66067:function(e,t,i){"use strict";if(i.d(t,{B:()=>y,t:()=>_}),4716==i.j)var n=i(7409);if(4716==i.j)var r=i(99282);var o=i(16584),a=i(30396),l=i(23493),s=i.n(l),d=i(95441),c=i(28771),u=i(47921),p=i(82061),h=i(68833),m=i(93687),g=i(15771),v=i(19081),f=i(58175),b=i(87077);let w=s()((e,t)=>{e({mediaUploadId:null==t?void 0:t.id,duration:null==t?void 0:t.duration,mediaUpload:t})},1e3,{trailing:!1}),y=()=>{let{isDrawerOpen:e,setIsDrawerOpen:t,setPreventChange:i}=(0,c.M$)();return{isVideoEmbedDrawerOpen:e("videoEmbed"),setIsVideoEmbedDrawerOpen:e=>t((0,r._)((0,n._)({},e),{drawerId:"videoEmbed",variant:"overlay"})),setPreventChange:e=>i({preventChange:e,preventChangeMessage:"Please wait until the video is uploaded before closing the drawer."})}},_=e=>{let{id:t,editorDroppedFile:i,mediaUploadId:n,open:r,pub:l,postId:s,onSave:c,onClose:_,setPostId:Z}=e,[C,x]=(0,a.eJ)(null!=i?i:null),[S,k]=(0,a.eJ)(null),[N,P]=(0,a.eJ)(!1),{iString:T,language:E}=(0,d.M1)(),{setPreventChange:I}=y(),{mediaUpload:B,loading:D,error:R}=(0,m.z)({mediaUploadId:n});n&&!S&&B&&k(B),(0,a.d4)(()=>{x(i)},[i]);let L=()=>{(!N&&(null==S?void 0:S.state)!=="uploaded"&&(null==S?void 0:S.state)!=="transcoded"||confirm(T("Your video will be discarded, are you sure?")))&&((0,h.j)(h.FP.VIDEO_MODAL_CANCEL_CLICKED,{has_media_upload:!!S}),M())},M=()=>{k(null),x(null),_()},U=(null==S?void 0:S.state)!=="transcoded";return(0,o.BX)(u.n,{wrapperId:t,title:T("Embed video"),isOpen:r,onClose:L,primaryButton:(0,o.tZ)(b.u,{disabled:!U,text:T("Video needed"),children:(0,o.tZ)(g.zx,{priority:"primary",onClick:()=>{(0,h.j)(h.FP.VIDEO_MODAL_INSERT_CLICKED),w(c,S),M()},disabled:U,children:T("Insert")})}),secondaryButton:(0,o.tZ)(g.zx,{priority:"secondary-outline",onClick:L,children:T("Cancel")}),children:[R&&(0,o.tZ)(f.xv,{color:"error",children:R}),D?(0,o.tZ)("div",{children:T("Loading...")}):(0,o.BX)(o.HY,{children:[(0,o.tZ)(f.xv.B4,{paddingBottom:24,translated:!0,children:"Upload or record a video file embedded into the text."}),(0,o.BX)(v.tu,{padding:16,radius:"md",border:"detail",children:[(0,o.tZ)(f.xv.B2,{weight:"semibold",translated:!0,paddingBottom:16,children:"Create video"}),(0,o.tZ)(p.ZP,{language:E,initialFile:C,mediaType:"video",pub:l,videoFeature:"embed",postId:s,setPostId:Z,onChange:e=>{let{mediaUpload:t}=e;P(!1),k(t),x(null),I(!1)},onUploadStarted:()=>{I(!0),P(!0)},onUploadCanceled:()=>{P(!1),I(!1)},mediaUpload:S,mediaUploadId:null==S?void 0:S.id})]})]})]})}},21599:function(e,t,i){"use strict";i.d(t,{S2:()=>l,pW:()=>c,sK:()=>s});var n=i(48980),r=i(7882),o=i(98914);if(/^(3154|6909)$/.test(i.j))var a=i(26111);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,a.x)("selection");let{isLoading:i,error:n,result:o}=(0,r.ib)({pathname:"/api/v1/post_selection/".concat(e),auto:!!e,deps:[e]});return{isLoading:i,error:n,postSelection:null!=o?o:null,highlightSelection:()=>{o&&d(o,t)}}}async function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,a.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,o.G6)()||!e.text)return;let r=(null!==(i=null===(t=/^[^.]+\./.exec(e.text))||void 0===t?void 0:t[0])&&void 0!==i?i:e.text).replace(/\.+$/g,"");if(!r)return;let a="#:~:text=".concat(encodeURIComponent(r));history.replaceState({},document.title,a),document.location.replace(a)}async function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=e||(0,a.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,o.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){"use strict";i.r(t),i.d(t,{PostMetaTags:()=>h,getPageTitleAndMeta:()=>m,getPostMetaImage:()=>g,getPostMetaImageForTwitter:()=>v});var n=i(16584),r=i(32351),o=i(49762),a=i(2748);if(/^(3154|6909)$/.test(i.j))var l=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 o,a,{publication:l,post:s,clip:d,siteConfigs:u={},twitterCardUrl:h=null,isCommentPage:f=!1,selection:b=null,imgSelection:w=null}=e,y=(null==s?void 0:s.social_title)||(null==s?void 0:s.title)||l.name,{title:_,description:Z}=m(s,l,{isCommentPage:f}),C=null;h?(o=h,a=!0):b&&s?(o=(0,c.LLm)(l,s,b),a=!0):w&&s?(o=(0,c.cjA)(l,s,w),a=!0):([o,a]=g(l,s),C=v(l,s));let x=f&&s&&"thread"!==s.type&&0===s.comment_count||(null==s?void 0:s.type)==="restack";return(0,n.tZ)(r.Metadata,{title:_,socialTitle:d?"✂️ ".concat((0,p.UB)(null!==(t=d.duration)&&void 0!==t?t:0)," | ").concat(y):y,searchDescription:null==s?void 0:s.search_engine_description,description:Z,image:d&&null!==(i=(0,c.ow1)(d))&&void 0!==i?i:o,twitterImage:d?void 0:C,isLargeImage:a,imageHeight:b?564:void 0,imageWidth:b?1128:void 0,seoProps:{noindex:x,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:l,post:s,siteConfigs:u})}function m(e,t){var i,n;let r,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,o.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)?(r=(null==e?void 0:e.search_engine_title)||h,p&&"thread"!==e.type&&(r="Comments - ".concat(r)),"".concat(r," - by ").concat(s).length<60&&(s&&m&&(r+=" - by ".concat(s)),"".concat(r," - ").concat(t.name).length<60&&(r+=" - ".concat(t.name)))):r=m?"".concat(t.name," | ").concat(s," | Substack"):"".concat(t.name," | Substack"),c=e?(0,u.postSocialDescription)(e,t):(0,a.F)(t),{title:r,description:c=(0,l.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}},87078:function(e,t,i){"use strict";i.r(t),i.d(t,{MiniChatInbox:()=>ex});var n=i(16584),r=i(30396),o=i(56743),a=i(68833),l=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),w=i(95441),y=i(60807),_=i(80878),Z=i(7882),C=i(61254),x=i(10510),S=i(69891),k=i(55533),N=i(94874),P=i(43570),T=i(71460),E=i(94184),I=i.n(E),B=i(71068),D=i(19081),R=i(36889),L=i(44854);function M(e){var{isSelected:t,className:i}=e,r=(0,p._)(e,["isSelected","className"]);return(0,n.tZ)(D.sg,{children:(0,n.tZ)(D.gq,(0,c._)({className:I()(L.Z.chatPublication,i,t&&L.Z.selected),as:"a",alignItems:"center",position:"relative",gap:12,paddingY:12,paddingX:16,href:r.href,target:"_blank",rel:"noopener noreferrer",hover:!0,userSelect:"none"},r))})}let U=(0,B.E7)({display:"flex",direction:"column",flex:"grow",minWidth:0,gap:2,alignSelf:"start",justifyContent:"start"});function X(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 j(e){var t;let{comment:i,outgoing:r,link:o,fallbackText:a}=e;if(i.reported_by_user)return(0,n.tZ)("em",{children:"You reported this thread."});let{media_uploads:l}=i,s=(null==l?void 0:l.length)||0,d=null!==(t=null==i?void 0:i.body)&&void 0!==t?t:void 0,c=r?"You: ":"";return i||(c="New conversation"),o&&(d?c+="\uD83D\uDD17 ".concat(d):o?c+="\uD83D\uDD17 ".concat(o):c+="\uD83D\uDD17 Link"),l&&(d?c+="\uD83D\uDCF8 ".concat(d):s>1?c+="\uD83D\uDCF8 ".concat(s," Images"):c+="\uD83D\uDCF8 Image"),l||o||(d?c+=d:c+=a),(0,n.tZ)(n.HY,{children:c})}function A(){return(0,n.tZ)(D.sg,{padding:12,gap:8,children:Array(8).fill(0).map(()=>(0,n.tZ)(O,{}))})}function O(){return(0,n.BX)(D.X2,{gap:12,padding:8,alignItems:"center",children:[(0,n.tZ)(R.V,{type:"circle",size:48}),(0,n.BX)(D.sg,{gap:8,flex:"grow",children:[(0,n.tZ)(R.V,{type:"bar",maxWidth:"".concat(50*Math.random()+50,"%")}),(0,n.tZ)(R.V,{type:"bar",maxWidth:"".concat(25*Math.random()+25,"%")})]})]})}var F=i(64515);let H=e=>{var{size:t=24,color:i="var(--color-fg-primary)"}=e,r=(0,p._)(e,["size","color"]);return(0,n.tZ)(F.l,(0,u._)((0,c._)({},r),{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 z(){return(0,n.tZ)(H,{size:12,color:"var(--color-fg-secondary)"})}var V=i(54584),q=i(31541),J=i(98012),Y=i(62515);function W(e){var t,i,r;let{item:o,onSelect:l,isSelected:d,isUnread:c,tab:u}=e,p=(0,V.y)(),h=(0,y.aF)(),m=null===(t=o.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(o.messageThread.id)),null;let{recentMessage:g}=o,v=g&&(null===(i=o.messageThread.members.find(e=>g.comment.user_id===e.user_id))||void 0===i?void 0:i.user);return(0,n.BX)(M,{isSelected:d,onClick:e=>{let t=o.messageThread.id;(0,a.j)(a.FP.CHAT_INBOX_CONVERSATION_CLICKED,{surface:p,tab:u,type:"dm",conversation_id:t}),l(t,e)},href:(0,Y.Rm)(o.messageThread.id),children:[c&&(0,n.tZ)(q.in,{className:L.Z.unreadDot}),(0,n.tZ)(N.qE,{user:m,size:56}),(0,n.BX)(U,{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)(T.UserBadge,{inline:!0,tier:m.bestseller_tier,size:"sm",tooltipOnHover:!0,userId:m.id}):null,"requests"===u&&(0,n.tZ)(K,{item:o})]}),(null==g?void 0:g.comment)&&(0,n.tZ)(s.xv.B5,{color:"secondary",children:(0,J.Z)(g.comment.created_at).chatTime()}),o.isPinned&&(0,n.tZ)(z,{})]}),g&&(0,n.tZ)(X,{unread:c,children:(0,n.tZ)(j,{comment:g.comment,link:null===(r=g.link_metadata)||void 0===r?void 0:r.title,outgoing:(null==v?void 0:v.id)===(null==h?void 0:h.id),fallbackText:o.subtitleBody})})]})]})}function K(e){let{item:t}=e,{iString:i}=(0,w.M1)(),{subscriberContext:r}=t,o=null==r?void 0:r.membershipState,a=o&&["free_signup","subscribed"].includes(o);return r&&a?(0,n.tZ)(P.Vp,{theme:"subscribed"===o?"paid":"default",children:i(r.isFounding?"Founding":"subscribed"===o?"Paid":"Free")}):null}var G=i(8828),$=i(78308),Q=i(67358),ee=i(85200),et=i(5281),ei=i(63018),en=i(44424),er=i(97842),eo=i(60308);function ea(e){var t;let{onClick:i}=e,r=(0,er.RN)();return r.inbox.pendingInviteCount?(0,n.tZ)(s.sg,{className:I()(L.Z.invitesRow),children:(0,n.BX)(M,{onClick:i,children:[(null!==(t=r.inbox.pendingInviteUnreadCount)&&void 0!==t?t:0)>0&&(0,n.tZ)(q.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)(U,{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 el(){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,eo.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:o,selectedConversationId:l,onSelect:d}=e,c=(0,V.y)(),{refetch:u}=(0,Z.ib)({pathname:"/api/v1/messages/inbox/invites/seen",method:"POST",auto:!1});return(0,r.d4)(()=>{o||(u(),(0,a.j)(a.FP.DIRECT_MESSAGE_REQUESTS_VIEWED,{pending_conversation_requests:i.length,surface:c}))},[o]),(0,n.tZ)(n.HY,{children:t?(0,n.tZ)(n.HY,{children:"'Error'"}):o?(0,n.tZ)(A,{}):(0,n.tZ)(s.sg,{paddingY:12,gap:8,flex:"grow",children:i.length?i.map(e=>(0,n.tZ)(W,{item:e,onSelect:(t,i)=>d(e.messageThread.id,i),isUnread:!e.lastViewedAt,isSelected:l===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)(k.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,eo.v3t)({section:"privacy"}),newTab:!0,size:"sm",children:"Go to Settings"})})})}var ec=i(46603);i(98661),i(27484),i(43174),i(89734),i(56232),i(83034),i(12936),i(42694),i(20160),i(83320),i(87698),i(89320),i(9997),i(28161),i(78327),i(45985),i(12757),i(98585),i(36518),i(85095),i(40647),i(49762),i(9682),i(15771),i(84370),i(91246),i(78096),i(58175),i(70379),i(87077),i(78118),i(74949),i(83010),i(50312),i(78718),i(91400);var eu=i(88817);i(75419),i(50167),i(65575),i(86657),i(56219),i(14293),i(2689),i(9970),i(20888),i(63474),i(2009),i(5623);var ep=i(63651),eh=i(84864);(0,B.zo)({display:"flex",direction:"row",flex:"grow",alignItems:"center",justifyContent:"space-between",paddingX:8,gap:16}),i(44312),i(41233);var em=i(64172);function eg(e){return(0,n.tZ)(s.hU,(0,u._)((0,c._)({priority:"tertiary"},e),{children:(0,n.tZ)(g.Z,{size:20})}))}function ev(e){var t;let{filteredItems:i,inboxItems:o,onSelectInvites:l,onSelectPub:d,onSelectConversation:c,activePub:u,activeConversationId:p}=e,h=(0,y.aF)(),m=(0,V.y)(),g=(0,er.I0)(),v=(0,er.RN)(),{inbox:{filter:f}}=v,{isLoading:b}=v.inbox.resources[(0,$.A)(f)],{requireLogin:w}=(0,eu.SJ)(),{refetch:_}=(0,Z.ib)({pathname:"/api/v1/messages/inbox/seen",method:"POST",auto:!1}),C=u&&v.publications.get(u);(0,r.d4)(()=>{b||((0,a.j)(a.FP.THREADS_INBOX_SCREEN_VIEWED,{unread_count:o.filter(e=>ew(e)).length,thread_count:o.length,tab:f,surface:m}),_())},[b,f]);let x=!o.find(e=>"chat"===e.type?e.publication.id===u:e.messageThreadId===p)&&C?(0,n.tZ)(eb,{item:{id:"chat-".concat(C.id),type:"chat",publication:C,lastViewedAt:null,communityPostId:null,timestamp:null,communityPost:null,user:null,isOwned:!1,isCurrentUserAuthor:!1,title:C.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)(A,{}):i.length>0||v.inbox.pendingInviteUnreadCount?(0,n.BX)(e_,{children:[(0,n.tZ)(ea,{onClick:l}),x,i.map(e=>"chat"===e.type?(0,n.tZ)(eb,{item:e,onSelect:d,isSelected:u===e.publication.id,isUnread:ew(e)},e.publication.id):(0,n.tZ)(W,{item:e,onSelect:c,isSelected:p===e.messageThread.id,isUnread:ew(e),tab:f},e.messageThread.id))]}):o.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)(k.ld,{title:"No chats found",body:"Please try again with a different search term."})})}):x?(0,n.tZ)(e_,{children:x}):(0,n.tZ)(s.sg,{justifyContent:"center",alignItems:"center",flex:"grow",paddingX:32,children:"chat"===f?(0,n.tZ)(k.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)(k.vJ,{title:"You don’t have any direct messages",body:"When someone sends you one, it will appear here."}):"unread"===f?(0,n.tZ)(k.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)(k.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=w?e=>{e.preventDefault(),w()}:null)&&void 0!==t?t:void 0,children:"Send message"})})})})}function ef(e){var{inboxItems:t}=e,i=(0,p._)(e,["inboxItems"]);let{iString:r}=(0,w.M1)(),o=(0,er.I0)(),{inbox:{filter:a}}=(0,er.RN)(),l=m()([{value:"all",label:r("All")},{value:"direct-message",label:r("Direct"),isUnread:t.filter(e=>"direct-message"===e.type&&ew(e)).length>0},{value:"unread",label:r("Unread")}]);return(0,n.tZ)(s.sg,{flex:"auto",style:{position:"sticky",top:0},bg:"primary",zIndex:1,children:(0,n.tZ)(S.n,(0,c._)({value:a,tabs:l.map(e=>{let{value:t,label:i,isUnread:r}=e;return{value:t,label:i,trailingIcon:r?(0,n.tZ)(q.in,{className:L.Z.unreadTabDot}):null}}),onChange:e=>{(0,_._)("/chat"),o((0,G.dd)(e))},ariaLabel:r("Select filter")},i))})}function eb(e){var t,i,r;let{item:o,onSelect:l,isSelected:d,isUnread:c}=e,u=(0,V.y)(),p=(0,y.aF)(),h=(null==o?void 0:null===(t=o.user)||void 0===t?void 0:t.id)===(null==p?void 0:p.id)?"You":null==o?void 0:null===(i=o.user)||void 0===i?void 0:i.name,{filter:m}=(0,er.RN)().inbox,g="free"!==o.publication.paywall_chat,b=null===(r=o.paywallStatus)||void 0===r?void 0:r.is_allowed_access;return(0,n.BX)(n.HY,{children:[(0,n.BX)(M,{isSelected:d,onClick:e=>{(0,a.j)(a.FP.CHAT_INBOX_CONVERSATION_CLICKED,{type:"publication",publication_id:o.publication.id,tab:m,surface:u}),l(o.publication.id,e)},href:(0,ep.xC8)({pubId:o.publication.id}),children:[c&&(0,n.tZ)(q.in,{className:L.Z.unreadDot}),(0,n.tZ)(x.wk,{pub:o.publication,size:56,radius:"md",bg:"unset"}),(0,n.BX)(U,{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:o.title||o.publication.name}),o.communityPost&&(0,n.tZ)(s.xv.B5,{color:"secondary",weight:"regular",children:(0,J.Z)(o.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)"}),o.isPinned&&(0,n.tZ)(z,{})]}),o.communityPost?(0,n.BX)(X,{unread:c,children:[h&&"".concat((0,eh.guessFirstName)(h),": "),(0,n.tZ)(ey,{post:o.communityPost})]}):o.paywallStatus&&!o.paywallStatus.is_allowed_access?(0,n.tZ)(eZ,{paywallStatus:o.paywallStatus}):(0,n.tZ)(X,{children:(0,n.tZ)(s.xv,{fontStyle:"italic",children:"Click here to start your subscriber chat"})})]})]}),o.isPrimary?(0,n.tZ)(C.iz,{}):null]})}function ew(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 ey(e){var t,i,r,o;let{post:a}=e,{iPlural:l}=(0,w.M1)(),{isPaid:s,isFounding:d,isAuthor:c}=(0,em.Y0)(a.publication_id);return a.link_url?(0,n.tZ)(n.HY,{children:a.body?"\uD83D\uDD17 ".concat(a.body):(null===(i=a.link_metadata)||void 0===i?void 0:i.title)?"\uD83D\uDD17 ".concat(null===(r=a.link_metadata)||void 0===r?void 0:r.title):"\uD83D\uDD17 ".concat(null===(o=a.link_metadata)||void 0===o?void 0:o.url)}):a.media_assets&&a.media_assets.length>0?(0,n.tZ)(n.HY,{children:a.body?"\uD83D\uDCF8 ".concat(a.body):l("\uD83D\uDCF8 Image","\uD83D\uDCF8 %1 Images",a.media_assets.length)}):(null==a?void 0:null===(t=a.threadMediaUploads)||void 0===t?void 0:t.length)?(0,n.tZ)(n.HY,{children:a.body?"▶ ".concat(a.body):l("▶ Video","▶ %1 Videos",null==a?void 0:a.threadMediaUploads.length)}):a.body?(0,n.tZ)(n.HY,{children:a.body}):d||c||"only_founding"!==a.audience?s||d||c||"only_paid"!==a.audience?(0,n.tZ)(n.HY,{children:a.body}):(0,n.tZ)(n.HY,{children:"\uD83D\uDD12 Paid subscriber thread"}):(0,n.tZ)(n.HY,{children:"\uD83D\uDD12 Founding member thread"})}i(20521),i(33884),i(70293);let e_=(0,s.E7)({display:"flex",direction:"column"});function eZ(e){let{paywallStatus:t}=e,{iString:i}=(0,w.M1)(),{paywall_error:r}=t,o=i("FOUNDING_SUBSCRIPTION_REQUIRED"===r?"Founding members only":"PAID_SUBSCRIPTION_REQUIRED"===r?"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)(X,{children:o})]})}var eC=i(8113);function ex(){let[e,t]=(0,r.eJ)(!1);return(0,n.tZ)(eC.aM,{surface:"dropdown",children:(0,n.tZ)(s.sg,{flex:"grow",width:360,style:{maxHeight:"80dvh"},color:"primary",children:e?(0,n.tZ)(eN,{onBack:()=>t(!1)}):(0,n.tZ)(eS,{onSelectRequests:()=>t(!0)})})})}function eS(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,er.RN)(),n=(0,em.Th)(),o=e=>{var t;let{publicationUserMap:i}=null!==(t=n.result)&&void 0!==t?t:{publicationUserMap:new Map},r=i.get(e);return!!(r&&["contributor","admin"].includes(r.role))};return(0,r.Ye)(()=>{let{threads:n,threadList:r,filter:a}=i.inbox,l=m()(r.map(e=>n.get(e))),s=["chat","direct-message"].includes(a),d=[];for(let n of l){var p,h,g;if(!s||n.type===a){if("chat"===n.type){let e=o(n.publication.id);if(!n.communityPostId&&e){d.push((0,u._)((0,c._)({},n),{communityPost:null,user:t,isOwned:e,isCurrentUserAuthor:!0}));continue}let r=n.communityPostId?i.communityPosts.get(n.communityPostId):null,a=null!==(p=null==r?void 0:r.communityPost)&&void 0!==p?p:null;d.push((0,u._)((0,c._)({},n,r),{communityPost:a,user:null!==(h=a&&i.users.get(a.user_id))&&void 0!==h?h:null,isOwned:e,isCurrentUserAuthor:(null==t?void 0:t.id)==(null==a?void 0:a.user_id)}))}else{let r=i.conversations.get(n.messageThreadId),o=null==r?void 0:r.thread,a=null==o?void 0:o.members.find(e=>e.user_id===(null==t?void 0:t.id));if(o&&(null==a?void 0:a.membership_state)==="accepted"){let t=(0,ec._)(i,n);(t||e===o.id)&&d.push((0,u._)((0,c._)({subtitleBody:""},n),{messageThread:o,members:o.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"===a){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:o,filteredItems:l}=function(e){let t=(0,V.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 r=e.messageThread.members;return m()(r.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,r.d4)(()=>{n&&(0,a.j)(a.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)(eP,{children:[(0,n.BX)(eT,{children:[(0,n.tZ)(s.xv.H3,{weight:"heavy",flex:"grow",children:"Chat"}),(0,n.tZ)(eg,{href:(0,Y.gp)(),newTab:!0,onClick:()=>(0,a.j)(a.FP.CHAT_DROPDOWN_NEW_CHAT_CLICKED)})]}),(0,n.tZ)(d.M,{onChange:o,placeholder:"Search chats"})]}),(0,n.tZ)(ef,{inboxItems:i})]}),(0,n.tZ)(eE,{children:(0,n.tZ)(ev,{filteredItems:l,inboxItems:i,onSelectInvites:t,onSelectConversation:e=>{ek((0,Y.Rm)(e))},onSelectPub:e=>{ek((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,ep.Cnj)(),newTab:!0,onClick:()=>(0,a.j)(a.FP.CHAT_DROPDOWN_SEE_ALL_CLICKED),children:"See all"})})]})}function ek(e){(0,l.uX)(e,{local_navigation:!1,newTab:!0})}function eN(e){let{onBack:t}=e,{data:i,error:r}=(0,ei._I)("/api/v1/messages/dm/invites"),a=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,r;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!==(r=null===(n=e.recentMessage)||void 0===n?void 0:n.id)&&void 0!==r?r: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)(eP,{children:(0,n.BX)(eT,{children:[(0,n.tZ)(s.hU,{priority:"tertiary",onClick:t,children:(0,n.tZ)(o.Z,{})}),(0,n.tZ)(s.xv.H3,{weight:"heavy",flex:"grow",children:"Requests"}),(0,n.tZ)(el,{})]})}),(0,n.tZ)(eE,{children:(0,n.tZ)(es,{isLoading:!i,error:r,items:a,onSelect:e=>{ek((0,Y.Rm)(e))}})})]})}let eP=(0,s.E7)({display:"flex",direction:"column",paddingX:16,paddingTop:16,gap:16}),eT=(0,s.E7)({display:"flex",alignItems:"center",height:40,gap:12}),eE=(0,s.E7)({display:"flex",direction:"column",overflowY:"auto",minHeight:0})},61468:function(e,t,i){"use strict";i.d(t,{$h:()=>h,Ap:()=>c,Vu:()=>g,kF:()=>u,ob:()=>m});var n=i(7409),r=i(99282);i(56303);var o=i(14293),a=i.n(o),l=i(84864);let s=4716==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==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(a()(t[0]))return[];let o=[],l=(0,r._)((0,n._)({},t[0]),{words:t[0].words.map(e=>(0,r._)((0,n._)({},e),{originalIndex:0}))});for(let e=1;e(0,r._)((0,n._)({},t),{originalIndex:e}))});l.speaker===s.speaker&&l.words.length+s.words.length<=i?l={start:l.start,end:s.end,text:"".concat(l.text," ").concat(s.text),words:l.words.concat(...s.words),speaker:l.speaker}:(o.push(l),l=s)}return o.push(l),o},u=(e,t)=>{let i=e.split("\n"),o=[],a="",l="",c=0,u=0,p=new Set,h={},m=0;return i.forEach((e,n)=>{var r,g;let v=null!==(r=s.find(t=>!!e.match(t.regex)))&&void 0!==r?r: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),l&&(o.push({speaker:h[a],start:c,end:u,text:l.trim(),words:[]}),l=""),c=u,b=b.replace(v.regex,""))}if(f){let t=e.match(f.regex);t&&(a=f.parse(t),p.has(a)||(p.add(a),h[a]="SPEAKER_".concat(m++)),l+="".concat(b.substring(a.length)," "))}else""!==b.trim()&&(l+="".concat(b," "));n===i.length-1&&l&&o.push({speaker:h[a],start:c,end:t,text:l.trim(),words:[]})}),[{segments:o},Object.entries(h).reduce((e,t)=>(0,r._)((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=[],o=new Set,l={},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(),o.has(h)||(o.add(h),l[h]="SPEAKER_".concat(s++));let t=i.indexOf(">")+1;t(0,r._)((0,n._)({},e),{[t[1]]:t[0]}),{})]},m=e=>e?e.segments.some(e=>!e.text)?"Segment text is missing":e.segments.some(e=>a()(e.end)||a()(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 r=t[null!==(n=e.speaker)&&void 0!==n?n:""],o="(".concat((0,l.secondsToHHMMSS)(e.start,{strict:!0}),"):\n").concat(e.text.trim(),"\n");r?i.push("".concat(r," ").concat(o)):i.push(o)}),i.join("\n")}},99961:function(e,t,i){"use strict";i.d(t,{U:()=>r,Z:()=>r});var n=i(88897);let r=n.NB.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",(0,n.P1)(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:i,editor:n})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:r}=i;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:a}=n.extensionManager,l=r||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&l&&o){let t=l.filter(e=>a.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}})}}]);