(function(){"use strict";u8.Crm.ActivityFormatEditModel=function(t){$.extend(this,t);this.resetIsModifiedState()};$.extend(u8.Crm.ActivityFormatEditModel.prototype,{isModified:function(){var t=this.getModelXmlText();return t!==this._initialXmlText||this._initialFormatName!=this.formatName||this._initialPrivate!=this["private"]||this._initialLock!=this.lock},formatNameIsModified:function(){return this._initialFormatName!=this.formatName},updateData:function(t,i){this.xml=t;this.formatName=i;this["private"]=$(t).xpath("//FormatHeader/Private").text()==="true";this.lock=$(t).xpath("//FormatHeader/Lock").text()==="true";this.local=$(t).xpath("//FormatHeader/Local").text();this.formatType=$(t).xpath("/FormatDefinition/FormatHeader").attr("type");var e=this;var a=u8.services.activityExecutionFormat.getChannels();$.each(a,function(t,i){u8.services.activityExecutionFormat.setChannelState(i.formName,e.isActive(i))});this.resetIsModifiedState()},atLeastOneChannelIsActiveAndConfigurable:function(){var t=false;var i=this;var e=u8.services.activityExecutionFormat.getChannels();$.each(e,function(e,a){if(i.isActiveAndConfigurable(a)){t=true}});return t},isActive:function(t){var i=u8.services.activityExecutionFormat.getChannelXmlName(t.formName);return $(this.xml).xpath("/FormatDefinition/Activity/ChannelsVar/Channel[@type='"+i+"']").attr("active")==="true"||$(this.xml).xpath("/FormatDefinition/Activity/ChannelsFix/Channel[@type='"+i+"']").attr("active")==="true"},isActiveAndConfigurable:function(t){if(t.formName==="phone"||t.formName==="inPerson"){return false}return this.isActive(t)},getModelXmlText:function(){var t=this.xml;return u8.Base.Xml.serialize(t)},resetIsModifiedState:function(){this._initialXmlText=this.getModelXmlText();this._initialFormatName=this.formatName;this._initialPrivate=this["private"];this._initialLock=this.lock}})})();