(function(){"use strict";var e=["<div class='u8-pageheader-root'>","{{if left}}<div class='u8-pageheader-left'>{{widget(left)}}</div>{{/if}}","{{if center}}","<div class='${centerCssClass}'>{{widget(center)}}</div>","{{/if}}","{{if right}}","<div class='u8-pageheader-right'><ul>","{{each right.items}}<li>{{widget($value)}}</li>{{/each}}","</ul></div>","{{/if}}","{{if canExpand}}<button type='button' class='u8-pageheader-expand'></button>{{/if}}","</div>"].join("");u8.Base.Widgets.PageHeader=function(e,t){$.extend(true,this,u8.Base.Widgets.PageHeader.defaults,t);this.Widget(e,t);this._isCreated=false;this._load(this._create.bind(this))};u8.Base.Widgets.PageHeader.defaults={isExpanded:true};u8.Base.Widgets.PageHeader.makeClass({name:"PageHeader",deriveFrom:u8.Base.Widgets.Widget,events:["Created","IsExpandedChange"]});$.extend(u8.Base.Widgets.PageHeader.prototype,{dispose:function(){if(this._isDisposed){return}this.Widget_dispose()},expand:function(e){if(typeof e=="undefined"){e=true}else if(e=="toggle"){e=!(this._$root.children(".u8-pageheader-center").is(":visible")||this._$root.children(".u8-pageheader-right").is(":visible"))}this.isExpanded=e;this._$root.children(".u8-pageheader-separator,.u8-pageheader-center,.u8-pageheader-right").toggle(this.isExpanded);if(this.isExpanded){this._$root.removeAttr("data-collapsed")}else{this._$root.attr("data-collapsed",true)}this.layout();if(this._isCreated){this.raise("IsExpandedChange")}},collapse:function(){this.expand(false)},getWidget:function(e){switch(e){case"left":case"right":case"center":return this.children.get(this.id+"_"+e);default:break}},_load:function(e){u8.using({texts:["common_text"]},e)},_create:function(){if(this._isDisposed){return}this._createModel();this._createView();u8.tools.createdWhenReady(this)},_createModel:function(){this._model={canExpand:!!(this.center||this.right)};if(this.left){this._model.left=$.extend({},this.left,{parent:this,id:this.id+"_left"})}if(this.center){this._model.center=$.extend({},this.center,{parent:this,id:this.id+"_center"})}if(this.right){var e=this.right.items;if(e){for(var t=0;t<e.length;t++){$.extend(e[t],{parent:this})}}this._model.right=$.extend({},this.right,{id:this.id+"_right"})}if(!this.left&&!this.right){this._model.centerCssClass="u8-pageheader-center-full"}else{this._model.centerCssClass="u8-pageheader-center"}},_createView:function(){this.empty();this.$(this.element).addClass("u8-pageheader").utml({name:"pageheader-template",template:e,data:this._model,itemOptions:{parent:this,isDefault:this.isDefault}});this._$root=this.$(this.element).children(".u8-pageheader-root");this._$root.children(".u8-pageheader-expand").attr("title",$t("TXT_common_text_0")).on("click",this._onExpandClick.bind(this));if(typeof this.isExpanded!="undefined"){this.expand(this.isExpanded)}},_onExpandClick:function(e){this.expand("toggle")}})})();