{"version":3,"sources":["webpack:///./Scripts/tabs.js"],"names":["element","Tab","next","activeTab","activeContent","nextContent","containerHeight","equalContents","nextHeight","self","this","heightData","getAttribute","tabsContentContainer","supportTransitions","tabs","getClosest","triggerEnd","style","height","classList","remove","isAnimating","triggerShow","setTimeout","offsetWidth","emulateTransitionEnd","customEvent","call","triggerHide","float","left","scrollHeight","add","offsetHeight","contains","nextClass","getActiveTab","activeTabs","slice","getElementsByClassName","length","getActiveContent","document","querySelector","show","setAttribute","addEventListener","e","preventDefault","currentTarget","parentNode","Tabs","elements","querySelectorAll","i"],"mappings":"0FAAA,kBAEeA,cAsId,IArIA,IAAIC,EAAM,SAAUD,GACnB,IAGIE,EAAMC,EAAWC,EAAeC,EAAaC,EAAiBC,EAAeC,EAH7EC,EAAOC,KACPC,EAAaX,EAAQY,aAAa,eAGlCC,GAFSC,sBAEc,GACvBC,EAAOC,qBAAWhB,EAAS,SAG3BiB,EAAa,WAChBJ,EAAqBK,MAAMC,OAAS,GACpCN,EAAqBO,UAAUC,OAAO,cACtCN,EAAKO,aAAc,GAGhBC,EAAc,WACbV,EACCN,EACHU,IAEAO,YAAW,WACVX,EAAqBK,MAAMC,OAASX,EAAa,KACjDK,EAAqBY,YACrBC,+BAAqBb,EAAsBI,KACzC,IAGJF,EAAKO,aAAc,EAEpBK,cAAYC,KAAK1B,EAAM,MAAO,QAASC,IAGpC0B,EAAc,WACbhB,IACHT,EAAcc,MAAMY,MAAQC,KAC5B1B,EAAYa,MAAMY,MAAQC,KAC1BzB,EAAkBF,EAAc4B,cAGjC3B,EAAYe,UAAUa,IAAI,UAC1BN,cAAYC,KAAK1B,EAAM,MAAO,OAAQC,GAEtCC,EAAcgB,UAAUC,OAAO,UAC/BM,cAAYC,KAAKzB,EAAW,MAAO,SAAUD,GAEzCW,IACHL,EAAaH,EAAY2B,aACzBzB,EAAgBC,IAAeF,EAE/BO,EAAqBO,UAAUa,IAAI,cACnCpB,EAAqBK,MAAMC,OAASb,EAAkB,KACt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file":"21.39efa28afc70fd16a6d3.js","sourcesContent":["import { getClosest, supportTransitions, emulateTransitionEnd, customEvent } from './utils';\r\n\r\nexport default element => {\r\n\tvar Tab = function (element) {\r\n\t\tvar self = this;\r\n\t\tvar heightData = element.getAttribute('data-height');\r\n\t\tvar height = supportTransitions ? (heightData === 'true') : false;\r\n\t\tvar next, activeTab, activeContent, nextContent, containerHeight, equalContents, nextHeight;\r\n\t\tvar tabsContentContainer = false;\r\n\t\tvar tabs = getClosest(element, '.tabs');\r\n\r\n\t\t// triggers\r\n\t\tvar triggerEnd = function () {\r\n\t\t\ttabsContentContainer.style.height = '';\r\n\t\t\ttabsContentContainer.classList.remove('collapsing');\r\n\t\t\ttabs.isAnimating = false;\r\n\t\t};\r\n\r\n\t\tvar triggerShow = function () {\r\n\t\t\tif (tabsContentContainer) { // height animation\r\n\t\t\t\tif (equalContents) {\r\n\t\t\t\t\ttriggerEnd();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsetTimeout(function () { // enables height animation\r\n\t\t\t\t\t\ttabsContentContainer.style.height = nextHeight + 'px'; // height animation\r\n\t\t\t\t\t\ttabsContentContainer.offsetWidth;\r\n\t\t\t\t\t\temulateTransitionEnd(tabsContentContainer, triggerEnd);\r\n\t\t\t\t\t}, 50);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\ttabs.isAnimating = false;\r\n\t\t\t}\r\n\t\t\tcustomEvent.call(next, 'tab', 'shown', activeTab);\r\n\t\t};\r\n\r\n\t\tvar triggerHide = function () {\r\n\t\t\tif (tabsContentContainer) {\r\n\t\t\t\tactiveContent.style.float = left;\r\n\t\t\t\tnextContent.style.float = left;\r\n\t\t\t\tcontainerHeight = activeContent.scrollHeight;\r\n\t\t\t}\r\n\r\n\t\t\tnextContent.classList.add('active');\r\n\t\t\tcustomEvent.call(next, 'tab', 'show', activeTab);\r\n\r\n\t\t\tactiveContent.classList.remove('active');\r\n\t\t\tcustomEvent.call(activeTab, 'tab', 'hidden', next);\r\n\r\n\t\t\tif (tabsContentContainer) {\r\n\t\t\t\tnextHeight = nextContent.scrollHeight;\r\n\t\t\t\tequalContents = nextHeight === containerHeight;\r\n\r\n\t\t\t\ttabsContentContainer.classList.add('collapsing');\r\n\t\t\t\ttabsContentContainer.style.height = containerHeight + 'px'; // height animation\r\n\t\t\t\ttabsContentContainer.offsetHeight;\r\n\t\t\t\tactiveContent.style.float = '';\r\n\t\t\t\tnextContent.style.float = '';\r\n\t\t\t}\r\n\r\n\t\t\tif (nextContent.classList.contains('fade')) {\r\n\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\tnextClass.classList.add('show');\r\n\t\t\t\t\temulateTransitionEnd(nextContent, triggerShow);\r\n\t\t\t\t}, 20);\r\n\t\t\t} else {\r\n\t\t\t\ttriggerShow();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// invalidate\r\n\t\tif (!tabs) return;\r\n\r\n\t\t// set default animation state\r\n\t\ttabs.isAnimating = false;\r\n\r\n\t\tvar getActiveTab = function () {\r\n\t\t\tvar activeTab;\r\n\t\t\tvar activeTabs = [].slice.call(tabs.getElementsByClassName('active'));\r\n\r\n\t\t\tif (activeTabs.length === 1) {\r\n\t\t\t\tactiveTab = activeTabs[0];\r\n\t\t\t} else if (activeTabs.length > 1) {\r\n\t\t\t\tactiveTab = activeTabs[activeTabs.length - 1];\r\n\t\t\t}\r\n\r\n\t\t\treturn activeTab;\r\n\t\t};\r\n\r\n\t\tvar getActiveContent = function () {\r\n\t\t\treturn document.querySelector(getActiveTab().getAttribute('href'));\r\n\t\t};\r\n\r\n\t\tvar clickHandler = function (e) {\r\n\t\t\te.preventDefault();\r\n\r\n\t\t\tnext = e.currentTarget;\r\n\t\t\t!tabs.isAnimating && !next.classList.contains('active') && self.show();\r\n\t\t};\r\n\r\n\t\t// public method\r\n\t\tthis.show = function () { // the tab we clicked is now the next tab\r\n\t\t\tnext = next || element;\r\n\t\t\tnextContent = document.querySelector(next.getAttribute('href'));\r\n\t\t\tactiveTab = getActiveTab();\r\n\t\t\tactiveContent = getActiveContent();\r\n\r\n\t\t\ttabs.isAnimating = true;\r\n\t\t\tactiveTab.classList.remove('active');\r\n\t\t\tactiveTab.setAttribute('aria-selected', 'false');\r\n\t\t\tnext.classList.add('active');\r\n\t\t\tnext.setAttribute('aria-selected', 'true');\r\n\r\n\t\t\tcustomEvent.call(activeTab, 'tab', 'hide', next);\r\n\r\n\t\t\tif (activeContent.classList.contains('fade')) {\r\n\t\t\t\tactiveContent.classList.remove('show');\r\n\t\t\t\temulateTransitionEnd(activeContent, triggerHide);\r\n\t\t\t} else {\r\n\t\t\t\ttriggerHide();\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// init\r\n\t\tif (!('Tabs' in element)) { // prevent adding event handlers twice\r\n\t\t\telement.addEventListener('click', clickHandler, false);\r\n\t\t}\r\n\r\n\t\tif (self.height) {\r\n\t\t\ttabsContentContainer = getActiveContent().parentNode;\r\n\t\t}\r\n\r\n\t\telement.Tabs = self;\r\n\t};\r\n\r\n\t// Initialize Tab\r\n\tvar elements = element.querySelectorAll('[data-toggle=\"tab\"]');\r\n\tfor (var i = 0; i < elements.length; i++) {\r\n\t\tnew Tab(elements[i]);\r\n\t}\r\n};"],"sourceRoot":""}