(self.webpackChunklite=self.webpackChunklite||[]).push([[4711],{71230:(e,n,i)=>{"use strict";i.d(n,{f:()=>r});var t=i(67294),a=i(18733),d=i(31889),o=i(98096),l=i(3207),r=function(e){var n=e.children,i=(0,d.F)(),r=(0,a.Uo)().baseTheme,s=(0,l.q3)(i,r);return t.createElement(o.f,{theme:s},n)}},98863:(e,n,i)=>{"use strict";i.d(n,{w:()=>a,f:()=>d});var t=i(67294),a=t.createContext({isWorkingPreview:!1}),d=function(){return t.useContext(a)}},61095:(e,n,i)=>{"use strict";i.d(n,{Yi:()=>u,I0:()=>r,Pd:()=>s});var t=i(82492),a=i.n(t),d=i(64718),o=i(87329),l={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"UserViewerEdge"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"userId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"user"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"userId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:"User"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"viewerEdge"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"User_viewerEdge"}}]}}]}}]}}]}}].concat((0,o.Z)([{kind:"FragmentDefinition",name:{kind:"Name",value:"User_viewerEdge"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"UserViewerEdge"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"hasCompletedProfile"}},{kind:"Field",name:{kind:"Name",value:"isAllowEdsEnabled"}},{kind:"Field",name:{kind:"Name",value:"isBlocking"}},{kind:"Field",name:{kind:"Name",value:"isFollowing"}},{kind:"Field",name:{kind:"Name",value:"isMuting"}},{kind:"Field",name:{kind:"Name",value:"isFacebookFollowing"}},{kind:"Field",name:{kind:"Name",value:"isMediumFollowing"}},{kind:"Field",name:{kind:"Name",value:"isSuperFollowing"}},{kind:"Field",name:{kind:"Name",value:"isTwitterFollowing"}},{kind:"Field",name:{kind:"Name",value:"isUser"}},{kind:"Field",name:{kind:"Name",value:"lastPostCreatedAt"}},{kind:"Field",name:{kind:"Name",value:"readPostsCount"}}]}}]))};function r(e,n,i){var t=e.readQuery({query:l,variables:{userId:n}}),d=a()({},t,{user:{viewerEdge:i}});e.writeQuery({query:l,variables:{userId:n||""},data:d})}var s=function(e){var n,i,t=(0,d.a)(l,{variables:{userId:null!==(n=null==e?void 0:e.id)&&void 0!==n?n:""},ssr:!1,skip:!(null!=e&&e.id)}),a=t.loading,o=t.error,r=t.data;return a?{loading:a}:o?{error:o}:{viewerEdge:null==r||null===(i=r.user)||void 0===i?void 0:i.viewerEdge}},u=function(e,n){var i=n.userId,t=n.viewerId;return e.identify({__typename:"UserViewerEdge",id:"userId:".concat(i,"-viewerId:").concat(t)})}},78693:(e,n,i)=>{"use strict";i.d(n,{S:()=>r,s:()=>l});var t=i(87329),a=i(98007),d={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"UserFollowButtonSignedOut_user"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"User"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"FragmentSpread",name:{kind:"Name",value:"SusiClickable_user"}}]}}].concat((0,t.Z)(a.Vm.definitions))},o={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"UserFollowButtonSignedOut_post"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Post"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"SusiClickable_post"}}]}}].concat((0,t.Z)(a.qU.definitions))},l={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"UserFollowButton_user"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"User"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"UserFollowButtonSignedIn_user"}},{kind:"FragmentSpread",name:{kind:"Name",value:"UserFollowButtonSignedOut_user"}}]}}].concat((0,t.Z)([{kind:"FragmentDefinition",name:{kind:"Name",value:"UserFollowButtonSignedIn_user"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"User"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}}]),(0,t.Z)(d.definitions))},r={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"UserFollowButton_post"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Post"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"collection"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}},{kind:"FragmentSpread",name:{kind:"Name",value:"UserFollowButtonSignedOut_post"}}]}}].concat((0,t.Z)(o.definitions))}},32317:(e,n,i)=>{"use strict";i.d(n,{B:()=>C});var t=i(67294),a=i(71230),d=i(98863),o=i(6443),l=i(34699),r=i(21919),s=i(69507),u=i(25550),m=i(61095),k=i(93310),c=i(47230),v=i(18627),S=i(66411),F=i(50563),w=function(e){var n,i=e.user,a=e.buttonSize,d=void 0===a?"REGULAR":a,o=e.buttonStyleFn,w=void 0===o?function(e){return e?"OBVIOUS":"STRONG"}:o,f=e.isLinkStyle,g=void 0!==f&&f,p=e.width,N=e.onClick,y=e.preventParentClick,U=(0,u.r)().viewerId,E=(0,m.Pd)(i),C=E.viewerEdge,b=E.loading,I=i.id,D=null!==(n=i.name)&&void 0!==n?n:"",_=(0,r.D)(s.L,{variables:{targetUserId:I},optimisticResponse:{followUser:{__typename:"User",id:I,name:D,viewerEdge:{__typename:"UserViewerEdge",id:"userId:".concat(I,"-viewerId:").concat(U),isFollowing:!0}}},update:function(e){e.modify({id:"User:".concat(U),fields:{missionControl:(0,F.im)("followedAuthors",!0),followingUserConnection:(0,F.cn)(I),socialStats:(0,F.w6)("followingCount",1)}}),e.modify({id:"User:".concat(I),fields:{socialStats:(0,F.w6)("followerCount",1)}})}}),h=(0,l.Z)(_,1)[0],B=(0,r.D)(s.g,{variables:{targetUserId:I},optimisticResponse:{unfollowUser:{__typename:"User",id:I,name:D,viewerEdge:{__typename:"UserViewerEdge",id:"userId:".concat(I,"-viewerId:").concat(U),isFollowing:!1}}},update:function(e){e.modify({id:"User:".concat(U),fields:{missionControl:(0,F.im)("followedAuthors",!1),socialStats:(0,F.w6)("followingCount",-1)}}),e.modify({id:"User:".concat(I),fields:{socialStats:(0,F.w6)("followerCount",-1)}})}}),A=(0,l.Z)(B,1)[0],O=(0,v.A)(),T=(0,S.Qi)(),V=!(null==C||!C.isFollowing),P=w(!!V),R=t.useCallback((function(e){return y&&e.preventDefault(),N&&N(),O.event("user.followed",{targetUserId:I,followSource:T}),h()}),[I,T,h,y]),L=t.useCallback((function(e){return y&&e.preventDefault(),O.event("user.unfollowed",{targetUserId:I,followSource:T}),A()}),[I,T,A,y]);return g?t.createElement(k.r,{onClick:V?L:R,linkStyle:V?"SUBTLE":"OBVIOUS",disabled:b},V?"Following":"Follow"):t.createElement(c.zx,{onClick:V?L:R,buttonStyle:P,size:d,loading:b,width:p},V?"Following":"Follow")},f=i(51615),g=i(77520),p=i(26350),N=i(92661),y=i(43487),U=i(50458),E=function(e){var n,i=e.buttonSize,a=void 0===i?"REGULAR":i,d=e.user,o=e.post,l=e.isLinkStyle,r=void 0!==l&&l,s=e.susiEntry,u=e.width,m=e.buttonStyle,k=void 0===m?"STRONG":m,c=(0,y.v9)((function(e){return e.config.authDomain})),v=(0,f.TH)(),F=(0,N.$B)(v.pathname),w=null==F||null===(n=F.route)||void 0===n?void 0:n.name;return t.createElement(S.cW,{source:{userId:d.id},extendSource:!0},t.createElement(p.R,{buttonSize:a,buttonStyle:k,buttonWidth:u,linkStyle:"OBVIOUS",isButton:!r,operation:"register",post:o,user:d,actionUrl:o?(0,U.L4)(c,d.id,o.id):(0,U.CU)(c,d.id),susiEntry:s,pageSource:(0,g.x)(w,"register")},"Follow"))},C=function(e){var n=e.user,i=e.post,l=e.buttonSize,r=void 0===l?"REGULAR":l,s=e.buttonStyleFn,u=void 0===s?function(e){return e?"OBVIOUS":"STRONG"}:s,m=e.isLinkStyle,k=void 0!==m&&m,c=e.susiEntry,v=e.width,S=e.onClick,F=e.preventParentClick,f=(0,o.H)().value,g=(0,d.f)().isWorkingPreview;return f&&f.id===n.id&&!g?null:t.createElement(a.f,null,f?t.createElement(w,{user:n,buttonSize:r,buttonStyleFn:u,isLinkStyle:k,width:v,onClick:S,preventParentClick:F}):t.createElement(E,{post:i,user:n,buttonSize:r,isLinkStyle:k,susiEntry:c,width:v,buttonStyle:u(!1)}))}},86911:(e,n,i)=>{"use strict";i.d(n,{qi:()=>t,WV:()=>a,M6:()=>d,Eb:()=>o,j8:()=>l,SA:()=>r,Ep:()=>s,sf:()=>u,hS:()=>m,bI:()=>k});var t="#437AFF",a="#C4E2FF",d="#F24D2E",o="#34AA45",l="#B5E5A4",r="#9E39FF",s="#E6C0FF",u="#F55189",m="#FFC017",k="#FAEDAF"}}]); //# sourceMappingURL=https://stats.medium.build/lite/sourcemaps/4711.043615ac.chunk.js.map