!function(e){"function"==typeof define&&define.amd?define("userRoles",e):e()}(function(){"use strict";new Vue({el:"#mylisting-roles",data:{config:MyListing_User_Roles_Config,activeField:null,requiredFields:["email","password","username"]},methods:{isFieldActive:function(e){return e===this.activeField},deleteField:function(i,e){this.roles[e].fields=this.roles[e].fields.filter(function(e){return e!==i})},isFieldRequired:function(e){return this.requiredFields.includes(e.slug)},hasField:function(i,e){return void 0!==this.roles[e].fields.find(function(e){return e.slug===i})},addField:function(e,i){this.config.presets[e]&&this.roles[i].fields.push(jQuery.extend(!0,{},this.config.presets[e]))},hasAvailableFields:function(i){var s=this,n=!1;return Object.keys(this.config.presets).forEach(function(e){s.hasField(e,i)||(n=!0)}),n}},computed:{roles:function(){return{primary:this.config.roles.primary,secondary:this.config.roles.secondary}},rolesJson:function(){return JSON.stringify(this.config.roles)},settingsJson:function(){return JSON.stringify(this.config.settings)}}})});
