YUI.add("app-base",function(s,e){var r=s.Lang,n=s.Object,i=s.PjaxBase,a=s.Router,o=s.View,t=s.ClassNameManager.getClassName,c=s.config.win,h=s.Base.create("app",s.Base,[o,a,i],{views:{},initializer:function(e){e=e||{};var i={};function t(e,t){i[t]=s.merge(i[t],e)}n.each(this.views,t),n.each(e.views,t),this.views=i,this._viewInfoMap={},this.after("activeViewChange",s.bind("_afterActiveViewChange",this)),this.get("serverRouting")||this._pjaxBindUI()},createView:function(e,t){var e=this.getViewInfo(e),i=e&&e.type||o,i=new(r.isString(i)?n.getValue(s,i.split(".")):i)(t);return this._viewInfoMap[s.stamp(i,!0)]=e,i},getViewInfo:function(e){return r.isString(e)?this.views[e]:e&&this._viewInfoMap[s.stamp(e,!0)]},render:function(){var e=s.App.CLASS_NAMES,t=this.get("container"),i=this.get("viewContainer"),n=this.get("activeView"),a=n&&n.get("container"),r=t.compareTo(i);return t.addClass(e.app),i.addClass(e.views),n&&!i.contains(a)&&i.appendChild(a),t.contains(i)||r||t.appendChild(i),this},showView:function(e,t,i,n){var a;return i=i||{},n?i=s.merge(i,{callback:n}):r.isFunction(i)&&(i={callback:i}),r.isString(e)&&((n=this.getViewInfo(e))&&n.preserve&&n.instance?(e=n.instance,this._viewInfoMap[s.stamp(e,!0)]=n):(e=this.createView(e,t),a=!0)),i.update&&!a&&e.setAttrs(t),"render"in i?i.render&&e.render():a&&e.render(),this._set("activeView",e,{options:i})},_attachView:function(e,t){var i,n;e&&(i=this.getViewInfo(e),n=this.get("viewContainer"),e.addTarget(this),i&&(i.instance=e),n[t?"prepend":"append"](e.get("container")))},_destroyContainer:function(){var e=s.App.CLASS_NAMES,t=this.get("container"),i=this.get("viewContainer"),n=t.compareTo(i);s.one("body").compareTo(t)?(this.detachEvents(),t.removeClass(e.app),n?t.removeClass(e.views):i.remove(!0)):(i.remove(!0),n||t.remove(!0))},_detachView:function(e){var t;e&&((t=this.getViewInfo(e)||{}).preserve?e.remove():(e.destroy({remove:!0}),delete this._viewInfoMap[s.stamp(e,!0)],e===t.instance&&delete t.instance),e.removeTarget(this))},_getRequest:function(){var e=a.prototype._getRequest.apply(this,arguments);return e.app=this,e},_getViewContainer:function(e){return e||this._viewContainer||(e=this._viewContainer=this.create(),this._set("viewContainer",e)),e},_initHtml5:function(){return!1!==this.get("serverRouting")&&a.html5},_isChildView:function(e,t){e=this.getViewInfo(e),t=this.getViewInfo(t);return!(!e||!t)&&this.getViewInfo(e.parent)===t},_isParentView:function(e,t){e=this.getViewInfo(e),t=this.getViewInfo(t);return!(!e||!t)&&this.getViewInfo(t.parent)===e},_navigate:function(e,t){return this.get("serverRouting")||(t=s.merge({force:!0},t)),i.prototype._navigate.call(this,e,t)},_save:function(e,t){var i;return this.get("serverRouting")&&!this.get("html5")?(this._hasSameOrigin(e)?c&&(i=this._joinURL(e||""),t?c.location.replace(i):c.location=i):s.error("Security error: The new URL must be of the same origin as the current URL."),this):a.prototype._save.apply(this,arguments)},_uiSetActiveView:function(e,t,i){var n=(i=i||{}).callback,a=!this._isChildView(e,t)&&this._isParentView(e,t),i=!!i.prepend||a;if(e===t)return n&&n.call(this,e);this._attachView(e,i),this._detachView(t),n&&n.call(this,e)},_afterActiveViewChange:function(e){this._uiSetActiveView(e.newVal,e.prevVal,e.options)}},{ATTRS:{activeView:{value:null,readOnly:!0},container:{valueFn:function(){return s.one("body")}},html5:{valueFn:"_initHtml5"},linkSelector:{value:"a"},serverRouting:{valueFn:function(){return s.App.serverRouting},writeOnce:"initOnly"},viewContainer:{getter:"_getViewContainer",setter:s.one,writeOnce:!0}},_NON_ATTRS_CFG:["views"]});s.namespace("App").Base=h,s.App=s.mix(s.Base.create("app",h,[]),s.App,!0),s.App.CLASS_NAMES={app:t("app"),views:t("app","views")}},"patched-v3.18.7",{requires:["classnamemanager","pjax-base","router","view"]});