(function(e){e.tabbedPane=function(g,l){var a=this,f=e(g),k={paneContext:f,paneSelectedClassName:"b-tabbed-pane__pane--selected",paneSelector:".b-tabbed-pane__pane",tabSelectedClassName:"b-tabbed-pane__tab--selected",tabSelector:".b-tabbed-pane__tab"},b;a.init=function(){a.settings=b=e.extend({},k,l);f.data("tabbedPane",{});b.tabSelectedClass="."+b.tabSelectedClassName;b.paneSelectedClass="."+b.paneSelectedClassName;a.getTabs();a.bindTabClicks()};a.getTabs=function(){var c;a.tabs=f.find(b.tabSelector);
a.panes=e();a.tabs.each(function(){var d=e(this),h=d.children("a");d.data("tabbedPane",{});targetId=h.attr("href");targetId=targetId.match(/#([^\?]+)/)[0].substr(1);c=b.paneContext.find("#"+targetId);c.length?(a.panes=a.panes.add(c),d.data("tabbedPane").pane=c):a.tabs=a.tabs.not(d)})};a.bindTabClicks=function(){a.tabs.children("a").on("click.tabbedPane",function(c,d){c.preventDefault();if(!1===f.triggerHandler("selectTab",[this]))return!1;a.selectTab(e(this),d||b.callback)})};a.selectTab=function(c,
d){window.location.hash.match(/^[^\?]*/);var h=c.parent().data("tabbedPane").pane;c.hasClass(b.tabActiveClass)&&h.hasClass(b.paneActiveClass)||(a.tabs.filter(b.tabSelectedClass).removeClass(b.tabSelectedClassName).children().removeClass(b.tabSelectedClassName),c.parent().addClass(b.tabSelectedClassName).children().addClass(b.tabSelectedClassName),a.panes.filter(b.paneSelectedClass).removeClass(b.paneSelectedClassName),h.addClass(b.paneSelectedClassName),"function"===typeof d&&d.apply(f,[c,h]))};a.publicMethods=
{getSelectedTab:function(){return a.tabs.filter(b.tabSelectedClass)},getSelectedPane:function(){return a.panes.filter(b.paneSelectedClass)},selectTab:function(c,d){c.trigger("click",[d]).trigger("focus")},findTabAnchorByHash:function(c){return a.tabs.children("a").filter('a[href*="'+c+'"]')}};a.init()};e.fn.tabbedPane=function(g){var l=arguments,a,f=this.each(function(){var k=e(this),b=k.data("tabbedPane");void 0===b&&(b=new e.tabbedPane(this,g),k.data("tabbedPane",b));if(b.publicMethods[g])return a=
b.publicMethods[g].apply(b,Array.prototype.slice.call(l,1)),!1});return"undefined"!==typeof a?a:f}})(jQuery);
