(self.webpackChunklite=self.webpackChunklite||[]).push([[6481],{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),w=i(50563),f=function(e){var n,i=e.user,a=e.buttonSize,d=void 0===a?"REGULAR":a,o=e.buttonStyleFn,f=void 0===o?function(e){return e?"OBVIOUS":"STRONG"}:o,g=e.isLinkStyle,F=void 0!==g&&g,p=e.width,N=e.onClick,y=e.preventParentClick,U=(0,u.r)().viewerId,b=(0,m.Pd)(i),C=b.viewerEdge,E=b.loading,I=i.id,_=null!==(n=i.name)&&void 0!==n?n:"",D=(0,r.D)(s.L,{variables:{targetUserId:I},optimisticResponse:{followUser:{__typename:"User",id:I,name:_,viewerEdge:{__typename:"UserViewerEdge",id:"userId:".concat(I,"-viewerId:").concat(U),isFollowing:!0}}},update:function(e){e.modify({id:"User:".concat(U),fields:{missionControl:(0,w.im)("followedAuthors",!0),followingUserConnection:(0,w.cn)(I),socialStats:(0,w.w6)("followingCount",1)}}),e.modify({id:"User:".concat(I),fields:{socialStats:(0,w.w6)("followerCount",1)}})}}),h=(0,l.Z)(D,1)[0],B=(0,r.D)(s.g,{variables:{targetUserId:I},optimisticResponse:{unfollowUser:{__typename:"User",id:I,name:_,viewerEdge:{__typename:"UserViewerEdge",id:"userId:".concat(I,"-viewerId:").concat(U),isFollowing:!1}}},update:function(e){e.modify({id:"User:".concat(U),fields:{missionControl:(0,w.im)("followedAuthors",!1),socialStats:(0,w.w6)("followingCount",-1)}}),e.modify({id:"User:".concat(I),fields:{socialStats:(0,w.w6)("followerCount",-1)}})}}),O=(0,l.Z)(B,1)[0],T=(0,v.A)(),V=(0,S.Qi)(),P=!(null==C||!C.isFollowing),R=f(!!P),L=t.useCallback((function(e){return y&&e.preventDefault(),N&&N(),T.event("user.followed",{targetUserId:I,followSource:V}),h()}),[I,V,h,y]),A=t.useCallback((function(e){return y&&e.preventDefault(),T.event("user.unfollowed",{targetUserId:I,followSource:V}),O()}),[I,V,O,y]);return F?t.createElement(k.r,{onClick:P?A:L,linkStyle:P?"SUBTLE":"OBVIOUS",disabled:E},P?"Following":"Follow"):t.createElement(c.zx,{onClick:P?A:L,buttonStyle:R,size:d,loading:E,width:p},P?"Following":"Follow")},g=i(51615),F=i(77520),p=i(26350),N=i(92661),y=i(43487),U=i(50458),b=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,g.TH)(),w=(0,N.$B)(v.pathname),f=null==w||null===(n=w.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,F.x)(f,"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,w=e.preventParentClick,g=(0,o.H)().value,F=(0,d.f)().isWorkingPreview;return g&&g.id===n.id&&!F?null:t.createElement(a.f,null,g?t.createElement(f,{user:n,buttonSize:r,buttonStyleFn:u,isLinkStyle:k,width:v,onClick:S,preventParentClick:w}):t.createElement(b,{post:i,user:n,buttonSize:r,isLinkStyle:k,susiEntry:c,width:v,buttonStyle:u(!1)}))}}}]); //# sourceMappingURL=https://stats.medium.build/lite/sourcemaps/6481.e3e8b67f.chunk.js.map