!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"substack@538433c"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4aa290f1-3dcf-47c7-b61b-b7ce8f81ff46",e._sentryDebugIdIdentifier="sentry-dbid-4aa290f1-3dcf-47c7-b61b-b7ce8f81ff46")}catch(e){}}();"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["95015"],{50587:function(){},16044:function(e,t,n){n.d(t,{A:()=>o});let o={blockContainer:"blockContainer-sGUymL",blockTitleContainer:"blockTitleContainer-_ayaxc",blockTitle:"blockTitle-p5J1JM",blockSubTitle:"blockSubTitle-b49Pjc",inlineContainer:"inlineContainer-pdOZS_",inlineText:"inlineText-mmZJjI"}},59167:function(e,t,n){n.d(t,{h:()=>c});var o=n(16291);function r(e){var t;let n=[e.is_primary,(null==(t=e.publication)?void 0:t.author_id)===e.user_id,"admin"===e.role,"contributor"===e.role].map(e=>e?"0":"1").join("");return"".concat(n,"-").concat((0,o.A)(e.created_at).valueOf())}function c(e){return e.slice(0).sort((e,t)=>r(e)>r(t)?1:-1)}},10591:function(e,t,n){n.d(t,{N_:()=>L,Si:()=>B,TH:()=>R,U4:()=>N,WK:()=>E,XU:()=>I,ce:()=>w,eH:()=>D,ju:()=>v,mh:()=>k,nd:()=>C,pv:()=>S,yj:()=>U,yt:()=>x});var o=n(79785),r=n(86500),c=n(98111),u=n(4016),a=n(39318),s=n(49807),i=n(82776),l=n(57324),d=n(33333),f=n(4518);function b(){let e=(0,o._)(["Start writing today. Use the button below to create a Substack of your own"]);return b=function(){return e},e}function p(){let e=(0,o._)(["Share ",""]);return p=function(){return e},e}function m(){let e=(0,o._)(["Get ","% off a group subscription"]);return m=function(){return e},e}function h(){let e=(0,o._)(["Get a group subscription"]);return h=function(){return e},e}function _(){let e=(0,o._)(["Give a gift subscription"]);return _=function(){return e},e}function g(){let e=(0,o._)(["","! Subscribe for free to receive new posts and support my work."]);return g=function(){return e},e}function y(){let e=(0,o._)(["",". To receive new posts and support my work, consider becoming a free or paid subscriber."]);return y=function(){return e},e}function T(){let e=(0,o._)(["","! This post is public so feel free to share it."]);return T=function(){return e},e}let S=e=>(t,n)=>{let{iString:o}=I18N.i({pub:e});if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let r={url:"".concat(c.T.CHECKOUT_URL,"&donate=true"),text:o("Donate Subscriptions")};return n&&n((0,d.DL)(t,t.schema.nodes.button.create(r))),!0},C=e=>(t,n)=>{let{iString:o}=I18N.i({pub:e});if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let r={url:"".concat(c.T.LEADERBOARD_URL,"&utm_source=").concat(l.VU.post),text:o("Refer a friend")};return n&&n((0,d.DL)(t,t.schema.nodes.button.create(r))),!0},L=e=>{let{writerReferralCode:t,publication:n,postId:o}=e;return(e,r)=>{let{iString:c,iTemplate:u}=I18N.i({pub:n});if(!e.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!e.schema.nodes.captionedWriterReferralButton)return console.error("captionedWriterReferralButton node type not found in schema"),!1;if(!e.schema.nodes.ctaCaption)return console.error("ctaCaption node type not found in schema"),!1;if(!(0,f.c)(e,e.schema.nodes.button))return!1;let s=u(b()),i={url:"".concat((0,a.gWk)(t||""),"?utm_source=").concat(l.VU.substack,"&utm_context=").concat(l.rw.post,"&utm_content=").concat(o,"&utm_campaign=").concat(l._9.writerReferralButton),text:c("Start a Substack")},p=e.schema.nodes.captionedWriterReferralButton.create(i,e.schema.nodes.ctaCaption.create(null,[e.schema.text(s)]));return r&&r((0,d.DL)(e,p)),!0}},k=e=>(t,n)=>{let{iString:o}=I18N.i({pub:e});if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let r={url:c.T.HALF_MAGIC_COMMENTS_URL,text:o("Leave a comment")};return n&&n((0,d.DL)(t,t.schema.nodes.button.create(r))),!0},w=(e,t,n)=>(o,c)=>{if((0,r.u4)(r.qY.READER_SURVEY_LINKED_IN_POST,{editorVersion:"1",surveyId:t.id}),!o.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(o,o.schema.nodes.button))return!1;let u={url:"".concat((0,s.gAK)(e,t.id)),text:n};return c&&c((0,d.DL)(o,o.schema.nodes.button.create(u))),!0},R=e=>(t,n)=>{let{iString:o}=I18N.i({pub:e});if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let r={url:c.T.SHARE_URL,text:o("Share")};return n&&n((0,d.DL)(t,t.schema.nodes.button.create(r))),!0},U=e=>(t,n)=>{let{iTemplate:o}=I18N.i({pub:e});if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let r={url:c.T.SHARE_PUB_URL,text:o(p(),e.name)};return n&&n((0,d.DL)(t,t.schema.nodes.button.create(r))),!0},I=e=>{let{couponPub:t,scrollParent:n,parentClass:o,get_coupons:r,insert_coupon:c,SelectField:u,openPrompt:s,closePrompt:i,getNetworkErrorMessage:l}=e;return(e,d,b)=>{let{iString:p}=I18N.i({pub:t});if(!e.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(e,e.schema.nodes.button))return!1;let m={parentClass:o,root:n?document.querySelector(".".concat(n)):b.dom.parentNode,scrollParent:n,offsetTop:10},h=Object.assign({title:p("Loading..."),no_buttons:!0,language:t.language},m);return s(h),r().then(n=>{i(h);let o=n.map(e=>{var t;return{label:null!=(t=e.name)?t:"",value:e}}).concat([{label:p("Create new offer"),value:{create_new:!0}}]),r={coupon:new u({label:p("Select offer..."),required:!0,options:o,onChange:e=>{e&&"create_new"in e&&e.create_new&&(i(l),window.open("".concat((0,a.$_T)(t),"/publish/offers"),"_blank"))}})},l=Object.assign({title:p("Special Offer"),fields:r,language:null==t?void 0:t.language,onSubmit:t=>{let{coupon:n}=t;c({coupon:n,state:e,dispatch:b.dispatch,schema:e.schema})},onClose:()=>{b.focus()}},m);s(l)}).catch(e=>{i(h),alert(l(e))}),!1}},v=e=>{let{scrollParent:t,parentClass:n,TextField:o,openPrompt:r,publication:a}=e;return(e,s,i)=>{let{iString:l}=I18N.i({pub:a});if(!e.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(e,e.schema.nodes.button))return!1;let b={parentClass:n,title:l("Create a button"),root:t?document.querySelector(".".concat(t)):i.dom.parentNode,scrollParent:t,offsetTop:10,language:null==a?void 0:a.language,fields:{text:new o({label:l("Enter text..."),required:!0,clean:e=>(e||"").trim(),validate:e=>{if(e.length>40)return l("Too long")}}),href:new o({label:l("Enter URL..."),required:!0,clean:e=>(e||"").trim(),validate:e=>{if(!/^%%.*%%$/.test(e)){try{let t=new URL(e);if(["http:","https:","mailto:"].includes(t.protocol))return}catch(e){}return l("Invalid URL")}}})}};return b.onSubmit=t=>{let n=t.href;if((0,u.lu)({pub:a})){let[e,t]=n.split("#"),o=e.includes("?")?"&":"?",r=["utm_source=custom_button","utm_medium=".concat(c.T.SEND_MEDIUM),"utm_campaign=".concat(c.T.POST_ID)].join("&");n="".concat(e).concat(o).concat(r).concat(t?"#".concat(t):"")}let o={url:n,text:t.text};if(!e.schema.nodes.button)return console.error("Button node type not found in schema"),!1;s&&i.dispatch((0,d.DL)(e,e.schema.nodes.button.create(o)))},b.onClose=()=>{i.focus()},r(b),!0}},x=e=>{let{publication:t}=e;return(e,n)=>{let{iTemplate:o}=I18N.i({pub:t});if(!e.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(e,e.schema.nodes.button))return!1;let r=t.default_group_coupon,u={url:"".concat(c.T.CHECKOUT_URL,"group=true").concat(r?"&coupon=".concat(r):""),text:(0,i.getSubscriptionSentenceWithCustomWords)(t,()=>{var e;return r&&t.default_group_coupon_percent_off?o(m(),null!=(e=t.default_group_coupon_percent_off.split(".")[0])?e:""):o(h())},e=>r&&t.default_group_coupon_percent_off?"Get ".concat(t.default_group_coupon_percent_off.split(".")[0],"% off a group ").concat(e.subscription):"Get a group ".concat(e.subscription))};return n&&n((0,d.DL)(e,e.schema.nodes.button.create(u))),!0}},D=e=>(t,n)=>{let{iTemplate:o}=I18N.i({pub:e});if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let r={url:"".concat(c.T.CHECKOUT_URL,"&gift=true"),text:(0,i.getSubscriptionSentenceWithCustomWords)(e,()=>o(_()),e=>"Give a gift ".concat(e.subscription))};return n&&n((0,d.DL)(t,t.schema.nodes.button.create(r))),!0},B=e=>(t,n)=>{if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let o={url:c.T.CHECKOUT_URL,text:(0,i.getSubscribeText)(e,{now:!0}),language:e.language};return n&&n((0,d.DL)(t,t.schema.nodes.button.create(o))),!0},E=e=>(t,n)=>{let{iTemplate:o}=I18N.i({pub:e});if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!t.schema.nodes.subscribeWidget)return console.error("subscribeWidget node type not found in schema"),!1;if(!t.schema.nodes.ctaCaption)return console.error("ctaCaption node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let r="enabled"!==e.payments_state?o(g(),e.author_name===e.name?"Thanks for reading":"Thanks for reading ".concat(e.name)):o(y(),e.author_name===e.name?"This Substack is reader-supported":"".concat(e.name," is a reader-supported publication")),u={url:c.T.CHECKOUT_URL,text:(0,i.getSubscribeText)(e),language:e.language},a=t.schema.nodes.subscribeWidget.create(u,[t.schema.nodes.ctaCaption.create(null,[t.schema.text(r)])]);return n&&n((0,d.DL)(t,a)),!0},N=e=>(t,n)=>{let{iString:o,iTemplate:r}=I18N.i({pub:e});if(!t.schema.nodes.button)return console.error("Button node type not found in schema"),!1;if(!t.schema.nodes.captionedShareButton)return console.error("captionedShareButton node type not found in schema"),!1;if(!t.schema.nodes.ctaCaption)return console.error("ctaCaption node type not found in schema"),!1;if(!(0,f.c)(t,t.schema.nodes.button))return!1;let u=r(T(),e.author_name===e.name?"Thanks for reading":"Thanks for reading ".concat(e.name)),a={url:c.T.SHARE_URL,text:o("Share")},s=t.schema.nodes.captionedShareButton.create(a,t.schema.nodes.ctaCaption.create(null,[t.schema.text(u)]));return n&&n((0,d.DL)(t,s)),!0}},10933:function(e,t,n){n.d(t,{kI:()=>c});var o=n(33333);let r=e=>!(0,o.cy)(e.doc.toJSON(),e=>"paywall"===e.type),c=e=>(t,n)=>{if(!r(t))return!1;let{schema:o,tr:c}=t,a=o.nodes.paywall.create();return 1===c.selection.anchor?u(e)(t,n):(c.insert(c.selection.anchor,a),n&&(n(c),e()),!0)},u=e=>(t,n)=>{if(!r(t))return!1;let{schema:o,tr:c}=t,u=o.nodes.paywall.create(),a=0,s=0;for(;a<10&&s<3;){let e=t.doc.resolve(a).nodeAfter;if(!e)break;a+=e.nodeSize,s++}return c.insert(a,u),n&&(n(c),e()),!0}}}]);