(function(){"use strict";u8.Crm.RepSet=function(e){$.extend(this,u8.Crm.RepSet.defaults,e);if(!this.items){this.items=[]}if(this.items){this.items.removeDuplicates(u8._.equ("repId"))}};u8.Crm.RepSet.defaults={name:null,items:null,readonly:false};u8.Crm.RepSet.makeClass({name:"RepSet"});$.extend(u8.Crm.RepSet.prototype,{addReps:function(e){if(typeof e=="string"||typeof e=="number"){if(!this.hasRep(e)){this.items.push({repId:e+""})}}else if(u8.tools.isArray(e)){for(var t=0,i=e.length;t<i;t++){if(!this.hasRep(e[t])){this.items.push({repId:e[t]+""})}}}},removeRep:function(e){return!!this.items.removeWhere(u8._.eq("repId",e+""))},hasRep:function(e){return!!this.items.find(u8._.eq("repId",e+""))},clone:function(){var e={};for(var t in this){if(this.hasOwnProperty(t)){e[t]=this[t]}}var i=new u8.Crm.RepSet(e);if(!this.items){i.items=null}else{i.items=[];for(var s=0;s<this.items.length;s++){i.items.push(this.items[s])}}return i},toTransport:function(){return this.items.map(u8._.attr(["repId"]))},equals:function(e){if(!this.items&&!e.items){return true}if(this.items&&!e.items||!this.items&&e.items){return false}if(this.items.length!=e.items.length){return false}for(var t=0;t<this.items.length;t++){if(this.items[t].repId!=e.items[t].repId){return false}}return true}})})();