(function(){"use strict";var t=['<div class="u8-filtersetpopup u8-padding-l">','<div class="editor" id="${id}_editor"></div>','<div id="${id}_buttons" class="u8-buttons">','{{Button({ textId: "TXT_button_text_11", isDefault:true, command: "Ok" })}}','{{Button({ textId: "TXT_button_text_10", isCancel:true, command: "Cancel" })}}',"</div>","</div>"].join("");u8.Crm.Widgets.FilterSetPopup=function(t,i){$.extend(this,u8.Crm.Widgets.FilterSetPopup.defaults,i);this.WidgetContainer();$assert(this.filterSets,"Property 'filterSets' must not be null.");this.element=t;this.$=$w(t).$;this.id=u8.Base.Dom.uniqueId();this._popup=null;this._editor=null;if(this.parent&&this.parent.children){this.parent.children.add(this)}this.commandBindings={Ok:this._onOk.bind(this),Cancel:this._onCancel.bind(this)};this.bind()};u8.Crm.Widgets.FilterSetPopup.defaults={popup:{title:"TXT_net_filterset_texts_10",sizing:"fit",allowResize:false,position:"left-middle",showArrow:true}};u8.Crm.Widgets.FilterSetPopup.makeClass({name:"FilterSetPopup",deriveFrom:u8.Base.Widgets.WidgetContainer,events:["Close"]});$.extend(u8.Crm.Widgets.FilterSetPopup.prototype,{open:function(){u8.using({texts:["button_text","net_filterset_texts"]},function(){var t=$.extend(this.popup,{alignTo:this.alignTo,position:this.position,autoShow:false,parent:this,onCreate:this._onPopupCreate.bind(this),onClose:this._onPopupClose.bind(this)});this._popup=new u8.Base.Widgets.Popup("<div></div>",t);this._popup.open()}.bind(this))},dispose:function(){if(this._isDisposed){return}this.unbind();if(this._popup){this._popup.dispose()}if(this._editor){this._editor.dispose()}this.WidgetContainer_dispose();if(this.parent&&this.parent.children){this.parent.children.remove(this.id)}},setValue:function(t){this.filterSet=t||null},getValue:function(){return this.filterSet},_createEditor:function(){var t=this._popup.getWindow().$el(this.id+"_editor");if(!t){return}var i=this.$.extend({filterSets:this.filterSets,filterSet:this.filterSet,parent:this._popup},this.editor);u8.tools.addEventHandler(i,"Create",this._onEditorCreate.bind(this));this._editor=new u8.Crm.Widgets.FilterSetEditor(t,i)},_onPopupCreate:function(){this._popup.getContent().utml({template:t,itemOptions:{parent:this._popup},data:this});this._createEditor()},_onPopupClose:function(){this.dispose()},_onEditorCreate:function(){this._popup.autoSizeAndPosition().show()},_onOk:function(){if(!this._editor.verify()){return}var t=this._editor.getValue();this.setValue(t);this.raise("Close",{ok:true});this._popup.close()},_onCancel:function(){this.raise("Close",{ok:false,cancel:true});if(this._isDisposed){return}this._popup.close()}})})();