(()=>{var e,t;tribe.tickets=tribe.tickets||{},tribe.tickets.commerce=tribe.tickets.commerce||{},tribe.tickets.commerce.gateway=tribe.tickets.commerce.gateway||{},tribe.tickets.commerce.gateway.toggler=tribe.tickets.commerce.gateway.toggler||{},e=jQuery,(t=tribe.tickets.commerce.gateway.toggler).text=tecTicketsCommerceCheckoutToggleText,t.gateways=[],t.toggles={},t.selectors={gatewayDiv:".tribe-tickets__commerce-checkout-gateway",toggleButton:".tribe-tickets__commerce-checkout-gateway-toggle-button",toggle:".tribe-tickets__commerce-checkout-gateway-toggle",toggleOpen:".tribe-tickets__commerce-checkout-gateway-toggle--open",toggleHidden:".tribe-common-a11y-hidden"},t.init=()=>{t.gateways=e(t.selectors.gatewayDiv),t.gateways.length<2?t.gateways.show():(t.addToggles(),t.showDefault())},t.showGateway=a=>{e(a).show().attr("aria-expanded","true").removeClass(t.selectors.toggleHidden.className())},t.hideGateway=a=>{e(a).hide().attr("aria-expanded","false").addClass(t.selectors.toggleHidden.className())},t.showDefault=()=>{t.showGateway(t.gateways[0]),t.gateways.each(((e,a)=>{0!==e&&t.hideGateway(a)})),t.toggles.default.addClass(t.selectors.toggleOpen.className()).hide().attr("aria-hidden","true"),t.toggles.additional.removeClass(t.selectors.toggleOpen.className()).attr("aria-selected","false")},t.showAdditional=()=>{t.toggles.additional.hasClass(t.selectors.toggleOpen.className())?t.showDefault():(t.hideGateway(t.gateways[0]),t.gateways.each(((e,a)=>{0!==e&&t.showGateway(a)})),t.toggles.additional.addClass(t.selectors.toggleOpen.className()).attr("aria-selected","true"),t.toggles.default.removeClass(t.selectors.toggleOpen.className()).show().attr("aria-hidden","false"))},t.addToggles=()=>{t.toggles.default=e(t.getDefaultToggleHTML()),t.toggles.additional=e(t.getAdditionalToggleHTML()),t.toggles.default.insertBefore(t.gateways[0]),t.toggles.additional.insertBefore(t.gateways[1]),t.toggleEvents()},t.getDefaultToggleHTML=()=>`<div class="${t.selectors.toggle.className()}"><button class="${t.selectors.toggleButton.className()}">${t.text.default}</button></div>`,t.getAdditionalToggleHTML=()=>`<div class="${t.selectors.toggle.className()}"><button class="${t.selectors.toggleButton.className()}">${t.text.additional}</button></div>`,t.toggleEvents=()=>{t.toggles.default.find("button").on("click",t.showDefault),t.toggles.additional.find("button").on("click",t.showAdditional)},t.init(),window.tec=window.tec||{},window.tec.tickets=window.tec.tickets||{},window.tec.tickets.commerce=window.tec.tickets.commerce||{},window.tec.tickets.commerce.gateway=window.tec.tickets.commerce.gateway||{},window.tec.tickets.commerce.gateway.toggler={}})();