System.register(["./p-c4df9d4b.system.js","./p-a0c1f16a.system.js","./p-77e9a1cf.system.js","./p-0bbf3c73.system.js","./p-da593370.system.js","./p-dbc597c0.system.js","./p-ff50522c.system.js","./p-8293eefa.system.js","./p-5ccc23db.system.js","./p-58f2f536.system.js","./p-8fde6e09.system.js","./p-e2e7329f.system.js","./p-637a7d5a.system.js","./p-ac291838.system.js","./p-1f1c7f78.system.js","./p-a333270e.system.js","./p-a9ea84b4.system.js","./p-b70120a8.system.js","./p-23628d1c.system.js","./p-d1d51081.system.js","./p-1e8d4d2d.system.js","./p-3bb22ffb.system.js","./p-90b7d919.system.js","./p-2db4f08c.system.js","./p-92b2dcc8.system.js","./p-c67a319b.system.js","./p-c0811bf8.system.js","./p-fe1f76a3.system.js","./p-66d9c61b.system.js"],(function(s){"use strict";var t,n,e,i,o,c,r,f,a;return{setters:[function(s){t=s.r;n=s.c;e=s.h;i=s.H},function(s){o=s.I},function(){},function(){},function(){},function(s){c=s.c},function(s){r=s.g},function(s){f=s.m},function(s){a=s.g},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){var u=s("mentornity_follow_button",function(){function s(s){var e=this;t(this,s);this.action=n(this,"action",7);this.invalidation=n(this,"invalidation",7);this.isProgressing=false;this.toggleFollowStatus=function(){var s=e.item.subscription;var t=(s===null||s===void 0?void 0:s.isFollowing)||false;e.isProgressing=true;if(s){c(f,a().headers).followUnfollowSubscription(s._id,t?"unfollow":"follow").then((function(){e.invalidation.emit(new o("mentornity-follow-button","mentornity-user-detail-page"))})).finally((function(){return e.isProgressing=false}))}else{var n=e.data.mentornityCookieContext,i=n.groupId,r=n.userId;var u=!!i;var l=e.item.mentorship;var d=l.organisation;c(f,a().headers).createSubscription({organisation:{_type:"reference",_class:"organisations",_id:d._id},subscribed:{_type:"reference",_class:"users",_id:r},subscriber:{_type:"reference",_class:u?"groups":"users",_id:u?i:r},createdBy:{_type:"reference",_class:"users",_id:r},mentorship:{_type:"reference",_class:"mentorships",_id:l._id},status:"active",isFollowing:true}).then((function(){e.invalidation.emit(new o("mentornity-follow-button","mentornity-user-detail-page"))})).finally((function(){return e.isProgressing=false}))}}}s.prototype.render=function(){var s,t;var n=((s=this.item.subscription)===null||s===void 0?void 0:s.isFollowing)||false;var o=((t=this.data)===null||t===void 0?void 0:t.language)||"en";return e(i,{class:"d-flex"},e("dvn-button",{disabled:this.isProgressing,onClick:this.toggleFollowStatus,tint:"primary",view:"flat"},r(o,n?"unfollow":"follow")))};return s}())}}}));