!function(e,t){"use strict";var i="#SHOW_ALL",a=t.getMessage("APEX.TABS.PREVIOUS"),s=t.getMessage("APEX.TABS.NEXT"),n=e.ui.keyCode;e.widget("apex.aTabs",{options:{mode:"standard",classPrefix:"a-Tabs",showHints:!1,useSlider:!0,useLocationHash:!1,useSessionStorage:!0,addMoveNextPrevious:!1,hidePreviousTab:!0,onRegionChange:function(e,t){var i=this.tabs$.data("onRegionChange");i&&i(e,t)},showAllScrollOffset:function(){return 0},tabsContainer$:!1,optionalSelectedClass:"",allowSwipe:!1},activeTab:null,firstVisibleTab:null,lastVisibleTab:null,getTabs:function(){return this.tabs},getTab:function(e){return this.tabs[e]||null},getActive:function(){return this.activeTab},movePrevious:function(e,t){this._moveToRegion(e,"getPreviousVisible","getNextVisible",t)},moveNext:function(e,t){this._moveToRegion(e,"getNextVisible","getPreviousVisible",t)},moveNextActive:function(e){this.moveNext(this.activeTab,e)},movePreviousActive:function(e){this.movePrevious(this.activeTab,e)},tabShouldBeHidden:function(){return"jump"!==this.options.mode&&this.options.hidePreviousTab},getNextActiveTabFromSiblings:function(e){var t=this._getScrollOffset(),i=e.getNextVisible(this.rtlMode);if(null!==i&&i.getTop()<t)return i;var a=e.getPreviousVisible(this.rtlMode);return null!==a&&t<e.getTop()?a:null},getFirstVisibleTab:function(e,t){if(!e)return null;if(!e.hidden)return e;for(;e[t];)if(!(e=e[t]).hidden)return e;return null},_onClick:function(e,t){e.makeActive(!0),void 0!==t&&t.doNotFocus||e.link$.focus()},_moveToRegion:function(e,t,i,a){var s=e[t]();if(null!==s)this._onClick(s,a);else{for(var n=e,o=n[i]();null!==o;)n=o,o=o[i]();this._onClick(n,a),this.firstVisibleTab.panel$.addClass("apex-rds-swap"),this.lastVisibleTab.panel$.addClass("apex-rds-swap")}},_showTabInList:function(e){e.hidden=!1,null===e.getNextVisible()&&(this.lastVisibleTab=e),null===e.getPreviousVisible()&&(this.lastVisibleTab=e),e.tab$.show(),this.activeTab.href!==i&&this.tabShouldBeHidden()&&e!==this.activeTab?e.panel$.hide():this.options.hidePreviousTab||e.panel$.css("display","")},_hideTabInList:function(e){this.activeTab===e&&(e.previous?e.previous.makeActive(!0):e.next&&e.next.makeActive(!0)),e.hidden=!0,e===this.firstVisibleTab&&(this.firstVisibleTab=e.getNextVisible()),e===this.lastVisibleTab&&(this.lastVisibleTab=e.getPreviousVisible()),e.tab$.hide()},_getScrollOffset:function(){return this.tabs$.offset().top+this.tabs$.outerHeight()+60},_iterateThroughAndClear:function(e,t,i){for(;null!==e;)e.link$.parent().removeClass(this.selectedClass),e.panel$.removeClass(this.ELEMENT_SELECTED_CLASS),this.jumpMode?e.panel$.attr("aria-hidden","false"):i?e.hidden||(e.panel$.attr("aria-hidden","false"),e.panel$.show()):(this.options.hidePreviousTab&&e.panel$.hide(),e.panel$.attr("aria-hidden","true")),e.tab$.removeClass(this.HINT_CLASS),e.link$.attr("aria-selected",!1).attr("tabIndex","-1"),t?(e.panel$.removeClass(this.AFTER_CLASS).addClass(this.BEFORE_CLASS),e.link$.parent().removeClass(this.AFTER_CLASS).addClass(this.BEFORE_CLASS),e=e.previous):(e.panel$.addClass(this.AFTER_CLASS).removeClass(this.BEFORE_CLASS),e.link$.parent().addClass(this.AFTER_CLASS).removeClass(this.BEFORE_CLASS),e=e.next)},_create:function(){var t=this.tabs={},o=this.tabs$=this.element,l=this,r=null,c=null,u=!1,d=!1,v=o.closest(".apex-tabs-region").attr("id"),h=this.options.classPrefix,b=apex.storage.getScopedSessionStorage({usePageId:!0,useAppId:!0,regionId:this.tabs$.id});v&&apex.region.create(v,{focus:function(){var e=l.activeTab.link$;return e.focus(),e},widget:function(){return l.tabs$}}),this.HINT_CLASS=h+"-item--hint",this.BEFORE_CLASS=h+"-before",this.AFTER_CLASS=h+"-after",this.DEFAULT_SELECTED_CLASS=h+"-selected",this.ELEMENT_SELECTED_CLASS=h+"-element-selected",this.FILL_CLASS=h+"--fill";var f=this.options,p=this.jumpMode="jump"===f.mode,T=f.useSlider,g=f.useLocationHash,S=f.useSessionStorage,C=f.onRegionChange;this.selectedClass=this.DEFAULT_SELECTED_CLASS+" "+f.optionalSelectedClass;var m=function(){return o.hasClass(l.FILL_CLASS)},x=function(){return"table"===o.css("display")},w=function(){if(!m()&&!x()&&T&&null===c){var t=e('<div class="apex-rds-hover left"><a> <span class="a-Icon icon-left-chevron"></span> </a></div>'),i=e('<div class="apex-rds-hover right" ><a> <span class="a-Icon icon-right-chevron"></span> </a></div>');(c=e("<div class='apex-rds-slider'>")).append(t).append(i),o.parent().prepend(c);var a,s=function(e,t){var i=function(){var e=t?"+=20px":"-=20px";o.stop().animate({scrollLeft:e},100,"linear",i),a()};e.click((function(){var e=t?"+=200px":"-=200px";o.stop(!1,!1).animate({scrollLeft:e},100)}));var a=function(){var i,a=parseInt(o.css("paddingRight"),10)+parseInt(o.css("paddingLeft"),10),s=o[0].scrollWidth-a-o.width(),n=o.scrollLeft();return(i=t?n>=s:0===n)?(e.hide(),!1):(i||e.show(),!0)};return e.hover(i,(function(){o.stop()})),{checkState:a}},n=s(i,!0),l=s(t,!1),r=function(){l.checkState(),n.checkState()};o.scroll((function(){clearTimeout(a),a=setTimeout(r,200)})),e(window).on("apexwindowresized",r),r()}},A=function(){var h=0,A=0;if(o.attr("role","tablist").addClass("a-Tabs"),"rtl"===o.css("direction")&&(o.addClass("u-RTL"),d=l.rtlMode=!0),f.addMoveNextPrevious){var $=e('<button type="button" class="'+l.options.classPrefix+"-previous-region "+l.options.classPrefix+'-button" title="'+a+'" aria-label="'+a+'"><span class="a-Icon icon-left-chevron" aria-hidden="true"></span></button>'),L=e('<button type="button" class="'+l.options.classPrefix+"-next-region "+l.options.classPrefix+'-button" title="'+s+'" aria-label="'+s+'"><span class="a-Icon icon-right-chevron" aria-hidden="true"></span></button>');o.parent().prepend($).append(L),$.click((function(){l.movePreviousActive()})),L.click((function(){l.moveNextActive()}))}p&&o.addClass("apex-rds-container--jumpNav"),o.css({"white-space":"nowrap","overflow-x":"hidden"});var _,E=e("a",o),V=null;if(E.length<=2&&E.eq(0).attr("href")===i)o.remove();else{if(d&&(E=e(E.get().reverse())),E.each((function(){var a=e(this),s=a.attr("href"),r=e(s);if(r.attr("role","tabpanel").addClass("a-Tabs-panel"),f.tabsContainer$){var c=r.outerHeight();c>A&&(A=c)}if(s===i&&p)a.parent().css("display","none");else{a.attr("role","tab");var d=function(n){var c,d,h;if(!this.hidden&&(h="."+l.selectedClass.trim().split(/\s+/).join("."),d=t[o.find(h).find("a").attr("href")],l._iterateThroughAndClear.call(l,this.previous,!0,s===i),l._iterateThroughAndClear.call(l,this.next,!1,s===i),l.firstVisibleTab.panel$.removeClass("apex-rds-swap"),l.lastVisibleTab.panel$.removeClass("apex-rds-swap"),void 0!==_&&clearTimeout(_),g&&(_=setTimeout((function(){if("history"in window&&window.history&&window.history.pushState)history.pushState(null,null,s);else{var t=e(window).scrollTop();location.hash=s,e(window).scrollTop(t)}}),10)),l.tabShouldBeHidden()&&r.show(),l.activeTab=this,this.panel$.attr("aria-hidden",!1).addClass(l.ELEMENT_SELECTED_CLASS),this.link$.attr("aria-selected",!0).removeAttr("tabindex"),function(e){if(!m()&&T&&!x()){for(var t=-o.width()/2,i=e.getLeft()/2,a=e;null!==a.previous;)i+=(a=a.previous).tab$.outerWidth();o.stop(!0,!0).animate({scrollLeft:i+t},(function(){}))}}(this),a.parent().removeClass(l.HINT_CLASS).addClass(l.selectedClass),S&&b.setItem(v+".activeTab",s),"standard"===f.mode&&e.apex.stickyWidget&&l.activeTab.panel$.find(".js-stickyWidget-toggle").stickyWidget("refresh"),c={mode:f.mode,active:l.activeTab,previous:d,showing:"standard"===f.mode&&d&&l.activeTab!==d&&d.href!==i},l._trigger("activate",{},c),o.trigger("tabsregionchange",[l.activeTab,f.mode]),C.call(l,f.mode,l.activeTab),n)){var A=0;if(p){var $=w.getTop();A=apex.theme.defaultStickyTop(),u=!0,e("html,body").stop(!0,!0).animate({scrollTop:$-A},{duration:"slow",step:function(e,t){var i=w.getTop()-A;i!==t.end&&(t.end=i)},complete:function(){u=!1,g&&(location.hash=s)}})}else!function(){var e=null;f.showAllScrollOffset&&(e=f.showAllScrollOffset()),o.data("showAllScrollOffset")&&(e=o.data("showAllScrollOffset")()),e&&window.scrollTo(0,e)}()}},w=t[s]={href:s,tabSet$:o,panel$:r,el$:r,link$:a,tab$:a.parent(),forceActive:d,makeActive:function(e){l.activeTab!==this&&d.call(this,e)},show:function(){l._showTabInList(w)},hide:function(){l._hideTabInList(w)},moveNext:function(e){l.moveNext(w,e)},movePrevious:function(e){l.movePrevious(w,e)},getNextVisible:function(e){return e?w.getPreviousVisible():l.getFirstVisibleTab(w.next,"next")},getPreviousVisible:function(e){return e?w.getNextVisible():l.getFirstVisibleTab(w.previous,"previous")},getTop:function(){return r.offset().top},getLeft:function(){return this.tab$.offset().left},showHint:function(){for(var e=this.previous,t=this.next;null!==e;)e.tab$.removeClass(l.HINT_CLASS),e=e.previous;for(;null!==t;)t.tab$.removeClass(l.HINT_CLASS),t=t.next;this.tab$.addClass(l.HINT_CLASS)},previous:V,next:null};w.tab$.attr("role","presentation"),s!==i&&w.link$.attr("aria-controls",s.substring(1));var $=w.tab$.attr("id");$||($=w.href.substring(1)+"_tab",w.tab$.attr("id",$)),r.attr("aria-labelledby",$),location.hash===s&&g&&(l.activeTab=w),null===l.firstVisibleTab&&(l.firstVisibleTab=w),null!==V&&(V.next=w),V=w,a.click((function(e){return l._onClick(w,e),!1})),a.on("keydown",(function(e){var t=e.which;if(t===n.UP)l.movePrevious(w);else if(t===n.DOWN)l.moveNext(w);else if(t===n.RIGHT)l.moveNext(w);else if(t===n.LEFT)l.movePrevious(w);else if(t===n.HOME)l.firstVisibleTab.link$.click();else if(t===n.END)l.lastVisibleTab.link$.click();else{if(t!==n.SPACE)return;w.link$.click()}e.preventDefault()})),w.panel$.on("apexaftershow",(function(e){e.target===w.panel$[0]&&w.show()})).on("apexafterhide",(function(e){e.target===w.panel$[0]&&w.hide()})),h++}})),f.tabsContainer$){var k=parseInt(f.tabsContainer$.css("min-height").replace(/[^-\d\.]/g,""),10);A<=0&&(A=k),f.tabsContainer$.css("min-height",A)}var P=function(){(null===r&&(r=m()),r&&T)&&(o.width()/h<100?null===c&&(o.removeClass(l.FILL_CLASS),w()):null!==c&&(o.addClass(l.FILL_CLASS),c.hide()))};if(w(),P(),l.lastVisibleTab=V,d){var N=l.lastVisibleTab;l.lastVisibleTab=l.firstVisibleTab,l.firstVisibleTab=N}if(null===l.activeTab){if(S){var y=b.getItem(v+".activeTab");for(var I in t)if(t.hasOwnProperty(I)&&t[I].href===y){l.activeTab=t[I],g&&(location.hash=y);break}}null===l.activeTab&&(l.activeTab=l.firstVisibleTab)}o.click((function(){l.firstVisibleTab.link$.focus()})),e(window).on("apexwindowresized",P),p&&l.lastVisibleTab.panel$.wrap("<div class='apex-rds-last-item-spacer'></div>")}};p?function(){if(A(),l.activeTab){l.activeTab.forceActive(!0);e(window).height();var t=function(){if(!u){var e=l.getNextActiveTabFromSiblings(l.activeTab);null!==e&&e.makeActive()}};e(window).on("scroll",t).on("apexwindowresized",(function(){e(window).height()/3,t()}))}}():function(){if(A(),l.activeTab&&l.activeTab.href!==i){var t=l.activeTab;setTimeout((function(){t.forceActive(!0)}),250)}var a=null;e(window).on("scroll",(function(){if(l.activeTab&&l.activeTab.href===i){var e=l._getScrollOffset();if(null===a)for(var t=l.firstVisibleTab;t;)!t.hidden&&t.href!==i&&t.getTop()<e&&(a=t).showHint(),t=t.next;else{var s=l.getNextActiveTabFromSiblings(a);null!==s&&(a=s,s.showHint())}}}))}(),f.allowSwipe&&f.tabsContainer$ instanceof e&&f.tabsContainer$.on("apexswipe",(function(e,t){switch(t.direction){case 2:l.moveNextActive();break;case 4:l.movePreviousActive()}}))}}),e.apex.aTabs.findClosestTab=function(t){var i,a,s=null;return(i=e(t).closest(".a-Tabs-panel")).length&&(a="#"+i[0].id,s=e("#"+i.attr("aria-labelledby")).closest(".a-Tabs").aTabs("getTab",a)),s},apex.message&&apex.message.addVisibilityCheck((function t(a){var s,n,o=e("#"+a);e.apex.aTabs&&(s=e.apex.aTabs.findClosestTab(o))&&(((n=s.tabSet$.aTabs("getActive"))!==s&&n.href!==i||!o.is(":visible"))&&s.makeActive(),t(s.tabSet$[0].id))})),apex.widget.util.visibilityChange&&e(document.body).on("atabsactivate",(function(t,a){var s,n,o,l;if(a.previous&&(s=a.previous.panel$[0]),n=a.active.panel$[0],a.active.href===i)for(l in o=e(t.target).aTabs("getTabs"))o.hasOwnProperty(l)&&a.previous&&l!==a.previous.href&&l!==i&&apex.widget.util.visibilityChange(o[l].panel$[0],!0);else if(a.previous&&a.previous.href===i)for(l in o=e(t.target).aTabs("getTabs"))o.hasOwnProperty(l)&&l!==a.active.href&&l!==i&&apex.widget.util.visibilityChange(o[l].panel$[0],!1);else s&&apex.widget.util.visibilityChange(s,!1),apex.widget.util.visibilityChange(n,!0)})),apex.widget.regionDisplaySelector=function(t,i){var a=e("#"+t+"_RDS");return a.aTabs(e.extend({},{classPrefix:"apex-rds"},i)),{tabs:a.aTabs("getTabs"),moveNext:function(e,t){a.aTabs("moveNext",e,t)},movePrevious:function(e,t){a.aTabs("movePrevious",e,t)},getActiveTab:function(){return a.aTabs("getActive")}}}}(apex.jQuery,apex.lang);