AUI.add("liferay-staging",function(b){Liferay.StagingBar={init:function(a){var c=a.namespace;this.markAsReadyForPublicationURL=a.markAsReadyForPublicationURL;this._namespace=c;this._stagingBar=b.oneNS(c,"#stagingBar");this.viewHistoryURL=a.viewHistoryURL;Liferay.publish({fireOnce:!0});Liferay.after("initStagingBar",function(d){b.getBody().addClass("staging-ready")});Liferay.fire("initStagingBar",a)}}},"",{requires:["aui-io-plugin-deprecated","aui-modal","liferay-node"]}); AUI.add("liferay-staging-branch",function(b){var d=b.Lang;b.mix(Liferay.StagingBar,{addBranch:function(a){var c=this._getBranchDialog();d.isValue(a)&&c.set("title",a);c.show()},_getBranchDialog:function(){var a=this._branchDialog;a||(this._branchDialog=a=Liferay.Util.Window.getWindow({dialog:{bodyContent:b.one("#"+this._namespace+"addBranch").show()},title:"Branch"}));return a}})},"",{requires:["liferay-staging"]}); AUI.add("liferay-staging-version",function(d){var f=Liferay.StagingBar,k={redo:"redo_layout_revision",undo:"undo_layout_revision"},l={redo:"Are you sure you want to redo your last changes?",undo:"Are you sure you want to undo your last changes?"};d.mix(f,{destructor:function(){this._cleanup()},_cleanup:function(){this._eventHandles&&d.Array.invoke(this._eventHandles,"detach")},_getNotification:function(){var b=this._notification;b||(this._notification=b=new Liferay.Notice({closeText:!1,content:"There was an unexpected error. Please refresh the current page.", noticeClass:"hide",timeout:1E4,toggleText:!1,type:"warning",useAnimation:!0}));return b},_onInit:function(b){var a=this;a._cleanup();b=a._namespace;var c=[Liferay.on(b+"redo",a._onRevisionChange,a,"redo"),Liferay.on(b+"submit",a._onSubmit,a),Liferay.on(b+"undo",a._onRevisionChange,a,"undo"),Liferay.on(b+"viewHistory",a._onViewHistory,a)],e=d.byIdNS(b,"layoutRevisionDetails");e&&c.push(Liferay.onceAfter("updatedLayout",function(m){d.io.request(a.markAsReadyForPublicationURL,{on:{failure:function(g, h,n){e.setContent("There was an unexpected error. Please refresh the current page.")},success:function(g,h,n){g=this.get("responseData");e.plug(d.Plugin.ParseContent);e.setContent(g)}}})}));a._eventHandles=c},_onRevisionChange:function(b,a){var c=k[a];confirm(l[a])&&this._updateRevision(c,b.layoutRevisionId,b.layoutSetBranchId)},_onSubmit:function(b){var a=this._namespace,c=d.byIdNS(a,"layoutRevisionDetails"),e=c.one(".layout-revision-info");e&&e.addClass("loading");(a=d.byIdNS(a,"submitLink"))&& a.html("Loading...");d.io.request(b.publishURL,{after:{failure:function(){c.addClass("alert alert-danger");c.setContent("There was an unexpected error. Please refresh the current page.")},success:function(){b.incomplete?location.href=b.currentURL:Liferay.fire("updatedLayout")}}})},_onViewHistory:function(b){Liferay.Util.openWindow({dialog:{destroyOnHide:!0},title:"History",uri:f.viewHistoryURL})},_updateRevision:function(b,a,c){var e=this;d.io.request(themeDisplay.getPathMain()+"/portal/update_layout", {data:{cmd:b,doAsUserId:themeDisplay.getDoAsUserIdEncoded(),layoutRevisionId:a,layoutSetBranchId:c,p_auth:Liferay.authToken,p_l_id:themeDisplay.getPlid(),p_v_l_s_g_id:themeDisplay.getSiteGroupId()},on:{failure:function(){e._getNotification().show()},success:function(m,g,h){window.location.reload()}}})}});Liferay.on("initStagingBar",f._onInit,f)},"",{requires:["aui-button","liferay-staging"]});