define(["require","exports","tslib","external/react","modules/core/i18n","modules/clean/react_format","modules/clean/react/file_activity_stream/display_name","modules/clean/react/file_activity_stream/utils","modules/clean/react/file_viewer/share_helpers","modules/clean/react/file_activity_stream/file_activity_stream_card","modules/clean/react/file_activity_stream/utils"],function(e,t,r,n,i,a,s,o,l,c,m){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u=i._("Can view",{comment:"used to explain what permissions a user has on a file"}),d=i._("Can comment",{comment:"used to explain what permissions a user has on a file"}),g=i._("Can edit",{comment:"used to explain what permissions a user has on a file"}),h={view_name_only:u,traverse:u,reader_no_comment:u,reader:d,writer:g,owner:g},p=(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onShareSettingsClick=function(){l.share(t.props.file,t.props.viewingUser,null,"PREVIEW_PAGE")},t}return r.__extends(t,e),t.prototype.message=function(e){var t=this.props.activity.user;if(m.isViewingUser(this.props)){if(1===e.length)return a.reactFormat(i._("You shared this file with %(entity)s"),{strong:n.createElement("strong",null),entity:e[0]});if(e.length>1)return a.reactFormat(i.ungettext("You shared this file with %(entity)s and 1 other","You shared this file with %(entity)s and %(count)s others",e.length-1),{strong:n.createElement("strong",null),entity:e[0],count:e.length-1})}else{if(1===e.length)return a.reactFormat(i._("%(name)s shared this file with %(entity)s"),{strong:n.createElement("strong",null),entity:e[0],name:t.display_name});if(e.length>1)return a.reactFormat(i.ungettext("%(name)s shared this file with %(entity)s and 1 other","%(name)s shared this file with %(entity)s and %(count)s others",e.length-1),{strong:n.createElement("strong",null),entity:e[0],count:e.length-1,name:t.display_name})}return null},t.prototype.renderSharedUser=function(e,t){return n.createElement(c.FileActivityStreamCard.Detail,{key:e.id,user:e},n.createElement(c.FileActivityStreamCard.Detail.Entity,{title:n.createElement(s.DisplayName,{user:e}),detail:h[t]}))},t.prototype.renderSharedGroup=function(e,t){return n.createElement(c.FileActivityStreamCard.Detail,{key:e.id,group:e},n.createElement(c.FileActivityStreamCard.Detail.Entity,{title:e.name,detail:h[t]}))},t.prototype.renderSharedEmail=function(e,t){return n.createElement(c.FileActivityStreamCard.Detail,{key:e,email:e},n.createElement(c.FileActivityStreamCard.Detail.Entity,{title:e,detail:h[t]}))},t.prototype.render=function(){var e=this,t=this.props.activity,r=t.shared_users.slice(),a=t.shared_emails.slice(),s=t.shared_groups.slice();r.sort(function(e,t){return o.userDisplayName(e).localeCompare(o.userDisplayName(t))}),a.sort(),s.sort(function(e,t){return e.name.localeCompare(t.name)});var l=r.map(function(e){return o.userDisplayName(e)}).concat(a,s.map(function(e){return e.name})),m=this.message(l);return n.createElement(c.FileActivityStreamCard,{user:t.user,timestamp:t.timestamp,action:{text:i._("Sharing settings"),onClick:this.onShareSettingsClick},message:m},r.map(function(r){return e.renderSharedUser(r,t.access_type)}),a.map(function(r){return e.renderSharedEmail(r,t.access_type)}),s.map(function(r){return e.renderSharedGroup(r,t.access_type)}))},t})(n.Component);t.FileSharedContentInviteActivityCard=p});
//# sourceMappingURL=file_shared_content_invite_activity_card.min.js-vflxTr1IC.map