function module(e,n,t){var o,r,a,i,c,u,s,m,l,f,d,v,h,p,_,g,R;t.link("@babel/runtime/regenerator",{default:function(e){o=e}},0),t.link("meteor/meteor",{Meteor:function(e){r=e}},0),t.link("meteor/reactive-var",{ReactiveVar:function(e){a=e}},1),t.link("meteor/session",{Session:function(e){i=e}},2),t.link("meteor/templating",{Template:function(e){c=e}},3),t.link("meteor/rocketchat:tap-i18n",{TAPi18n:function(e){u=e}},4),t.link("toastr",{default:function(e){s=e}},5),t.link("underscore.string",{default:function(e){m=e}},6),t.link("../../../utils",{t:function(e){l=e},handleError:function(e){f=e}},7),t.link("../../../ui-utils",{call:function(e){d=e},modal:function(e){v=e}},8),t.link("../../../authorization",{hasAllPermission:function(e){h=e},hasAtLeastOnePermission:function(e){p=e}},9),t.link("../../../channel-settings",{ChannelSettings:function(e){_=e}},10),t.link("../../../settings",{settings:function(e){g=e}},11),t.link("../../../callbacks",{callbacks:function(e){R=e}},12),c.adminRoomInfo.helpers({selectedRoom:function(){return i.get("adminRoomsSelected")},canEdit:function(){return h("edit-room",this.rid)},editing:function(e){return c.instance().editing.get()===e},notDirect:function(){var e=c.instance().room.get();return e&&"d"!==e.t},roomType:function(){var e=c.instance().room.get();return e&&e.t},channelSettings:function(){return _.getOptions(void 0,"admin-room")},roomTypeDescription:function(){var e=c.instance().room.get(),n=e&&e.t;return"c"===n?l("Channel"):"p"===n?l("Private_Group"):void 0},roomName:function(){var e=c.instance().room.get();return e&&e.name},roomOwner:function(){var e=c.instance().roomOwner.get();return e&&(e.name||e.username)},roomTopic:function(){var e=c.instance().room.get();return e&&e.topic},archivationState:function(){var e=c.instance().room.get();return e&&e.archived},archivationStateDescription:function(){var e=c.instance().room.get(),n=e&&e.archived;return l(!0===n?"Room_archivation_state_true":"Room_archivation_state_false")},canDeleteRoom:function(){var e=c.instance().room.get(),n=e&&e.t;return null!=n&&p("delete-"+n)},readOnly:function(){var e=c.instance().room.get();return e&&e.ro},readOnlyDescription:function(){var e=c.instance().room.get(),n=e&&e.ro;return l(!0===n?"True":"False")}}),c.adminRoomInfo.events({"click .delete":function(e,n){var t=this;v.open({title:l("Are_you_sure"),text:l("Delete_Room_Warning"),type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:l("Yes_delete_it"),cancelButtonText:l("Cancel"),closeOnConfirm:!1,html:!1},(function(){r.call("eraseRoom",t.rid,(function(e){e?f(e):(v.open({title:l("Deleted"),text:l("Room_has_been_deleted"),type:"success",timer:2e3,showConfirmButton:!1}),n.onSuccess(),n.data.tabBar.close())}))}))},"keydown input[type=text]":function(e,n){13===e.keyCode&&(e.preventDefault(),n.saveSetting(this.rid))},"click [data-edit]":function(e,n){return e.preventDefault(),n.editing.set($(e.currentTarget).data("edit")),setTimeout((function(){n.$("input.editing").focus().select()}),100)},"click .cancel":function(e,n){e.preventDefault(),n.editing.set()},"click .save":function(e,n){e.preventDefault(),n.saveSetting(this.rid)}}),c.adminRoomInfo.onCreated((function(){var e=this,n=this,t=c.currentData();this.editing=new a,this.room=new a,this.roomOwner=new a,this.onSuccess=c.currentData().onSuccess,this.autorun((function(){var n,t=c.currentData().room;e.room.set(t)})),this.validateRoomType=function(){var n=e.$("input[name=roomType]:checked").val();return"c"!==n&&"p"!==n&&s.error(l("error-invalid-room-type",{type:n})),!0},this.validateRoomName=function(e){var n=t.room,o;if(!h("edit-room",e)||"c"!==n.t&&"p"!==n.t)return s.error(l("error-not-allowed")),!1;name=$("input[name=roomName]").val();try{o=new RegExp("^"+g.get("UTF8_Names_Validation")+"$")}catch(r){o=new RegExp("^[0-9a-zA-Z-_.]+$")}return!!o.test(name)||(s.error(l("error-invalid-room-name",{room_name:m.escapeHTML(name)})),!1)},this.validateRoomTopic=function(){return!0},this.saveSetting=function(o){switch(e.editing.get()){case"roomName":e.validateRoomName(o)&&(R.run("roomNameChanged",t.room),r.call("saveRoomSettings",o,"roomName",e.$("input[name=roomName]").val(),(function(e){if(e)return f(e);s.success(u.__("Room_name_changed_successfully")),n.onSuccess(),n.data.tabBar.close()})));break;case"roomTopic":e.validateRoomTopic(o)&&r.call("saveRoomSettings",o,"roomTopic",e.$("input[name=roomTopic]").val(),(function(e){if(e)return f(e);s.success(u.__("Room_topic_changed_successfully")),R.run("roomTopicChanged",t.room),n.onSuccess(),n.data.tabBar.close()}));break;case"roomAnnouncement":e.validateRoomTopic(o)&&r.call("saveRoomSettings",o,"roomAnnouncement",e.$("input[name=roomAnnouncement]").val(),(function(e){if(e)return f(e);s.success(u.__("Room_announcement_changed_successfully")),R.run("roomAnnouncementChanged",t.room),n.onSuccess(),n.data.tabBar.close()}));break;case"roomType":var a=e.$("input[name=roomType]:checked").val();if(e.validateRoomType(o)){R.run("roomTypeChanged",t.room);var i=function(){r.call("saveRoomSettings",o,"roomType",a,(function(e){if(e)return f(e);s.success(u.__("Room_type_changed_successfully")),n.onSuccess(),n.data.tabBar.close()}))};if(!t.room.default)return i();v.open({title:l("Room_default_change_to_private_will_be_default_no_more"),type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:l("Yes"),cancelButtonText:l("Cancel"),closeOnConfirm:!0,html:!1},(function(e){return!e||i()}))}break;case"archivationState":var c=t.room;"true"===e.$("input[name=archivationState]:checked").val()?c&&!0!==c.archived&&r.call("archiveRoom",o,(function(e){if(e)return f(e);s.success(u.__("Room_archived")),R.run("archiveRoom",t.room),n.onSuccess(),n.data.tabBar.close()})):!0===(c&&c.archived)&&r.call("unarchiveRoom",o,(function(e){if(e)return f(e);s.success(u.__("Room_unarchived")),R.run("unarchiveRoom",t.room),n.onSuccess(),n.data.tabBar.close()}));break;case"readOnly":r.call("saveRoomSettings",o,"readOnly","true"===e.$("input[name=readOnly]:checked").val(),(function(e){if(e)return f(e);s.success(u.__("Read_only_changed_successfully")),n.onSuccess(),n.data.tabBar.close()}))}e.editing.set()},this.autorun(function(){function n(){var n,t,r,a,c,u,s;return o.async(function(){function m(m){for(;;)switch(m.prev=m.next){case 0:return e.roomOwner.set(null),m.next=3,o.awrap(d("getRoomRoles",i.get("adminRoomsSelected").rid));case 3:n=m.sent,t=Array.isArray(n),r=0,n=t?n:n[Symbol.iterator]();case 7:if(!t){m.next=13;break}if(!(r>=n.length)){m.next=10;break}return m.abrupt("break",23);case 10:a=n[r++],m.next=17;break;case 13:if(!(r=n.next()).done){m.next=16;break}return m.abrupt("break",23);case 16:a=r.value;case 17:u=(c=a).roles,s=c.u,u.includes("owner")&&e.roomOwner.set(s);case 21:m.next=7;break;case 23:case"end":return m.stop()}}return m}())}return n}())}))}

