!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 n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f7c8e9b1-93de-420a-9d61-01eb2d89ddde",e._sentryDebugIdIdentifier="sentry-dbid-f7c8e9b1-93de-420a-9d61-01eb2d89ddde")}catch(e){}}();"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["36725"],{55376:function(e,n,t){t.d(n,{wI:()=>P});var r=t(79785),i=t(4006),l=t(418),o=t(16079),a=t(17402),c=t(15734),u=t.n(c),s=t(84605),d=t(92538),m=t(5646),h=t(12387),p=t(24078),f=t(89490),b=t(35369),y=t(76977),v=t(20500),g=t(28911),w=t(84843),Y=t(57820),_=t(94996),k=t(81929),D=t(63136),x=t(16291);function E(){let e=(0,r._)(["Ban or suspend ",""]);return E=function(){return e},e}function F(){let e=(0,r._)(["Prevent this person from commenting on your publication in the future."]);return F=function(){return e},e}function C(){let e=(0,r._)(["Ban ",""]);return C=function(){return e},e}function I(){let e=(0,r._)(["Previously banned "," time(s), last on ",""]);return I=function(){return e},e}function S(){let e=(0,r._)([""," is permanently banned."]);return S=function(){return e},e}function A(){let e=(0,r._)([""," is banned until ","."]);return A=function(){return e},e}let P=e=>{var n,t,r,l;let{comment:o,onReply:c,onBan:u,onClose:s}=e,{sub:m,loading:h,bans:p,bansHistory:f,error:b,submitBan:y}=U(o,u),v=(0,d.n)(),w=null==(n=v[1])?void 0:n[0],[Y,_]=(0,a.useState)(w),[k,D]=(0,a.useState)("visible"),E=!!o||h,F=null!=(l=null==(r=v.find(e=>{let[n]=e;return n===Y}))||null==(t=r[1])?void 0:t.toLowerCase())?l:"",C=p.filter(e=>(0,x.A)(e.expiry).isAfter((0,x.A)()));return(0,i.FD)(g.aF,{isOpen:E,onClose:s,children:[0===C.length&&(0,i.Y)(B,{comment:o,sub:m,bans:p,bansHistory:f,loading:h,error:b,selectedExpiry:Y,setSelectedExpiry:_,selectedCommentVisibility:k,setSelectedCommentVisibility:D,expiryText:F,onClose:s,submitBan:y}),C.length>0&&(0,i.Y)(R,{comment:o,bans:p,onClose:s,onReply:()=>{c&&o&&(c(o.id),s())}})]})},B=e=>{var n,t;let{comment:r,sub:l,bans:o,bansHistory:a,loading:c,error:u,selectedExpiry:h,setSelectedExpiry:f,selectedCommentVisibility:w,setSelectedCommentVisibility:x,expiryText:I,onClose:S,submitBan:A}=e,{iString:P,iTemplate:B}=(0,s.GO)(),R=(0,d.n)(),U=(0,m.T)();return(0,i.FD)(i.FK,{children:[(0,i.Y)(g.rQ,{onClose:S,title:B(E(),null!=(n=null==r?void 0:r.name)?n:"user"),showDivider:!0,alignItems:"center",icon:(0,i.Y)(p.eu,{photoUrl:null!=(t=null==r?void 0:r.photo_url)?t:void 0,size:56}),description:(0,i.FD)(y.VP,{alignItems:"center",gap:8,children:[(null==l?void 0:l.is_subscribed)&&(0,i.Y)(k.vw,{priority:"secondary",children:P("Paid subscriber")}),(0,i.Y)(D.EY,{children:B(F())})]})}),(0,i.Y)(g.cw,{children:(0,i.FD)(y.VP,{gap:20,children:[(0,i.Y)($,{bans:o,bansHistory:a}),u&&(0,i.Y)(v.yn,{children:P("An error occurred. Please try again.")}),c&&(0,i.Y)(Y.y$,{padding:32,alignItems:"center",justifyContent:"center"}),!c&&(0,i.FD)(i.FK,{children:[(0,i.FD)(T,{children:[(0,i.Y)(D.EY.B3,{weight:"semibold",children:P("Ban duration")}),(0,i.FD)(_.I,{name:"expiry",value:h,onChange:e=>{f(e.target.value)},children:[(0,i.Y)(_.K,{children:P("Select a duration")}),R.map(e=>{let[n,t]=e;return(0,i.Y)("option",{value:n,children:null==t?void 0:t.replace(/^For /,"")})})]})]}),(0,i.FD)(T,{children:[(0,i.Y)(D.EY.B3,{weight:"semibold",children:P("Delete comments")}),(0,i.FD)(_.I,{name:"comment_visibility",value:w,onChange:e=>{x(e.target.value)},children:[(0,i.Y)(_.K,{children:P("Select whether to delete comments")}),U.map(e=>{let[n,t]=e;return(0,i.Y)("option",{value:n,children:t})})]})]})]})]})}),(0,i.Y)(g.jl,{direction:"column",showDivider:!0,primaryButton:(0,i.Y)(b.$n,{priority:"destructive",onClick:()=>A(h,w),children:B(C(),I)})})]})},T=(0,f.I4)({display:"flex",justifyContent:"space-between",alignItems:"center"}),$=e=>{let{bans:n,bansHistory:t}=e,{iTemplate:r}=(0,s.GO)();if(!n[0])return null;let o=t.length?t.length:n.filter(e=>e.user_id).length;return(0,i.Y)(h.F,{title:r(I(),o,(0,x.A)(n[0].start).standardDatetimeWithYear()),Icon:l.A})},R=e=>{var n,t;let{comment:r,bans:l,onClose:a,onReply:c}=e,{iString:u,iTemplate:d}=(0,s.GO)(),m=l.find(e=>e.user_id),h=m&&(0,x.A)(m.expiry).isAfter((0,x.A)().add(100,"years"))?d(S(),null!=(n=null==r?void 0:r.name)?n:"This user"):d(A(),null!=(t=null==r?void 0:r.name)?t:"This user",(0,x.A)(null==m?void 0:m.expiry).standardDatetimeWithYear());return m?(0,i.FD)(i.FK,{children:[(0,i.Y)(g.rQ,{title:h,alignItems:"center",icon:(0,i.Y)(w.qx,{icon:(0,i.Y)(o.A,{})}),onClose:a,description:u("We recommend leaving a reply to tell them why they are banned, and to let other readers know what kinds of comments are not acceptable.")}),(0,i.Y)(g.q1,{}),(0,i.Y)(g.jl,{direction:"column",primaryButton:(0,i.Y)(b.$n,{priority:"primary-mono",onClick:c,children:u("Leave a reply")})})]}):null},U=(e,n)=>{let[t,r]=(0,a.useState)(null),[i,l]=(0,a.useState)(!1),[o,c]=(0,a.useState)([]),[s,d]=(0,a.useState)([]),[m,h]=(0,a.useState)(null),p=async(t,r)=>{l(!0);try{var i;if(!e)throw Error("comment undefined, cannot submitBan");let a=await u().post("/api/v1/comment_ban/".concat(e.id)).send({user_id:e.user_id,expiry:t,commentVisibility:r});"visible"!==r&&document.location.reload(),(i=a.body.bans).forEach(e=>{-1==i.findIndex(n=>n.id===e.id)&&i.push(e)}),c(i),l(!1),n&&n(e,o)}catch(e){console.error("Failed to submit ban",e),h(!0)}l(!1)};return(0,a.useEffect)(()=>{(async()=>{if(e){l(!0),c([]),d([]),h(null),r(null);try{var n;let[t,i]=await Promise.all([u().get("/api/v1/user/".concat(e.user_id,"/bans")),u().get("/api/v1/moderation/publications/".concat(e.publication_id,"/users/").concat(e.user_id,"/bans")).query({type:"comment",limit:20})]),l=t.body;c(l.bans),r(l.sub),d(null!=(n=i.body.data)?n:[])}catch(e){console.error("Failed to get bans:",e),h(!0)}l(!1)}})()},[e]),{sub:t,loading:i,bans:o,bansHistory:s,error:m,submitBan:p,setLoading:l,setError:h}}},90554:function(e,n,t){t.d(n,{y:()=>i});var r=t(17402);function i(e){let{name:n,action:t}=e;(0,r.useEffect)(()=>{if("undefined"==typeof window)return;let e=new URL(window.location.href);if(e.searchParams.get("action")===n){t();let n=e.searchParams;n.delete("action"),window.history.replaceState({},"","".concat(e.origin).concat(e.pathname,"?").concat(n))}},[])}},46754:function(e,n,t){t.d(n,{QE:()=>a,RP:()=>c});var r=t(39318);let i=/^.*(https?:\/\/(?:www\.)?polymarket\.com\/event\/([^/\s?]+)(?:\/([^/\s?]+))?).*$/,l=/^.*(https?:\/\/(?:www\.)?polymarket\.com\/sports\/(?:[^/\s?]+\/)*([^/\s?]+)).*$/,o=/^.*(https?:\/\/(?:www\.)?polymarket\.com\/@([^/\s?]+)).*$/,a=e=>{var n,t,r;let a=i.exec(e);if(a)return null!=(n=a[1])?n:null;let c=l.exec(e);if(c)return null!=(t=c[1])?t:null;let u=o.exec(e);return u&&null!=(r=u[1])?r:null},c=e=>{if(!e)return null;let n="true"===new URL(e,"https://polymarket.com").searchParams.get("graphMode"),t=i.exec(e);if(t&&t[2]){let e=t[2],r=t[3]||void 0;return{eventSlug:e,marketSlug:r,isGraphMode:n,fullEmbedUrl:u(e,r,n)}}let r=l.exec(e);if(r&&r[2]){let e=r[2];return{eventSlug:e,marketSlug:void 0,isGraphMode:n,fullEmbedUrl:u(e,void 0,n)}}let a=o.exec(e);if(a&&a[2]){let e=a[2];return{profileName:e,isGraphMode:!1,fullEmbedUrl:s(e)}}return null},u=(e,n,t)=>{let i="".concat((0,r.$_T)(),"/embed/polymarket/").concat(e).concat(n?"/".concat(n):"");return t?"".concat(i,"?graphMode=true"):i},s=e=>"".concat((0,r.$_T)(),"/embed/polymarket/profile/").concat(e)}}]);