define("discourse/plugins/discourse-group-enroll/discourse/controllers/admin-plugins-discourse-group-enroll",["exports","discourse/lib/ajax","discourse/lib/ajax-error","@ember/object/computed"],(function(e,r,s,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=["external_ids","usernames"],l=Ember.Controller.extend({targetUsersEmpty:(0,n.empty)("target_users"),group_name:"",groupNameEmpty:(0,n.empty)("group_name"),submitDisabled:(0,n.or)("targetUsersEmpty","groupNameEmpty","loading"),error_count:0,error_text:"",init:function(){this._super.apply(this,arguments);var e=t[0],r=t.map((function(e){return{name:I18n.t("discourse_group_enroll.user_modes.".concat(e)),value:e}}));this.setProperties({currentUserListMode:e,userListModes:r,group_name:""})},actions:{enroll:function(){var e=this;this.set("loading",!0),this.set("success",!1),this.set("hasErrors",!1),this.set("error_text",""),this.set("error_count",0);var n={group:this.get("group_name")};n[this.get("currentUserListMode")]=this.get("target_users").split("\n"),(0,r.ajax)("/admin/plugins/discourse-group-enroll.json",{data:n,method:"PUT"}).then((function(r){e.set("count",r.count),e.set("error_text",r.errors.join("\n")),e.set("error_count",r.errors.length),e.set("hasErrors",r.errors.length>0),e.set("success",0==r.errors.length)})).catch(s.popupAjaxError).finally((function(){e.set("loading",!1)}))}}});e.default=l})),define("discourse/plugins/discourse-group-enroll/discourse/discourse-group-enroll-route-map",["exports"],(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;e.default={resource:"admin.adminPlugins",path:"/plugins",map:function(){this.route("discourse-group-enroll")}}})),Ember.TEMPLATES["javascripts/admin/plugins-discourse-group-enroll"]=Ember.HTMLBars.template({id:null,block:'{"symbols":[],"statements":[[7,"div",true],[10,"class","control-group discourse-group-enroll"],[8],[0,"\\n\\n  "],[7,"h3",true],[8],[1,[28,"i18n",["discourse_group_enroll.users.title"],null],false],[9],[0,"\\n\\n  "],[7,"div",true],[10,"class","controls"],[8],[0,"\\n    "],[7,"label",true],[10,"for","group-enroll-user-mode"],[8],[1,[28,"i18n",["discourse_group_enroll.users.mode"],null],false],[9],[0,"\\n    "],[1,[28,"combo-box",null,[["valueProperty","content","value","id","onChange"],["value",[24,["userListModes"]],[24,["currentUserListMode"]],"group-enroll-user-mode",[28,"action",[[23,0,[]],[28,"mut",[[24,["currentUserListMode"]]],null]],null]]]],false],[0,"\\n  "],[9],[0,"\\n\\n  "],[7,"br",true],[8],[9],[0,"\\n\\n  "],[7,"div",true],[10,"class","controls"],[8],[0,"\\n    "],[7,"label",true],[8],[1,[28,"i18n",["discourse_group_enroll.users.input"],null],false],[9],[0,"\\n    "],[1,[28,"textarea",null,[["value"],[[24,["target_users"]]]]],false],[0,"\\n  "],[9],[0,"\\n\\n  "],[7,"br",true],[8],[9],[0,"\\n\\n  "],[7,"h3",true],[8],[1,[28,"i18n",["discourse_group_enroll.group.title"],null],false],[9],[0,"\\n\\n  "],[7,"div",true],[10,"class","controls"],[8],[0,"\\n    "],[7,"label",true],[8],[1,[28,"i18n",["discourse_group_enroll.group.label"],null],false],[9],[0,"\\n    "],[1,[28,"input",null,[["value","class"],[[24,["group_name"]],"input-small"]]],false],[0,"\\n  "],[9],[0,"\\n\\n  "],[7,"br",true],[8],[9],[7,"br",true],[8],[9],[0,"\\n\\n  "],[7,"div",true],[10,"class","controls"],[8],[0,"\\n    "],[1,[28,"d-button",null,[["class","action","disabled","label"],["btn-default",[28,"action",[[23,0,[]],"enroll"],null],[24,["submitDisabled"]],"discourse_group_enroll.enroll"]]],false],[0,"\\n  "],[9],[0,"\\n\\n  "],[1,[28,"conditional-loading-spinner",null,[["condition"],[[24,["loading"]]]]],false],[0,"\\n\\n  "],[7,"br",true],[8],[9],[0,"\\n\\n"],[4,"if",[[24,["success"]]],null,{"statements":[[0,"    "],[7,"div",true],[10,"class","alert alert-success"],[8],[0,"\\n      "],[7,"p",true],[8],[0,"\\n        "],[1,[28,"discourse-linked-text",null,[["text","textParams"],["discourse_group_enroll.complete.success",[28,"hash",null,[["count"],[[24,["count"]]]]]]]],false],[0,"\\n      "],[9],[0,"\\n    "],[9],[0,"\\n"]],"parameters":[]},null],[0,"\\n"],[4,"if",[[24,["hasErrors"]]],null,{"statements":[[0,"    "],[7,"div",true],[10,"class","alert alert-warning"],[8],[0,"\\n      "],[7,"p",true],[8],[0,"\\n        "],[1,[28,"discourse-linked-text",null,[["class","text","textParams"],["result-text","discourse_group_enroll.complete.errors",[28,"hash",null,[["count","error_count","error_text"],[[24,["count"]],[24,["error_count"]],[24,["error_text"]]]]]]]],false],[0,"\\n      "],[9],[0,"\\n    "],[9],[0,"\\n"]],"parameters":[]},null],[0,"\\n"],[9],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"javascripts/discourse/templates/admin/plugins-discourse-group-enroll"}});
//# sourceMappingURL=https://doy2mn9upadnk.cloudfront.net/assets/plugins/discourse-group-enroll-4832d3bae301b3a3bca4e7e294d54c7b313f0bbb1f41a81043d49547dd6a5c0b.js.map