PageSourceSearch

https://www.24hourfitness.com/etc/designs/24-hour-fitness/clientlib-components.min.js

js 24hourfitness.com collected 2026-10-02 04:55:39 UTC 198,059 bytes, 3,881 lines download raw bytes

1
2(function () {
3
4	if($("#club-header-24").length === 0){
5		return;
6	}
7
8	var $header = $("#club-header-24");
9	var $controls = $header.find(".controls");
10	var $pauseBtn = $header.find(".pause-btn");
11	var $playBtn = $header.find(".play-btn");
12	var videoHeader = document.getElementById("videoHeader");
13	
14	var $videoCont = $header.find('#video-cont');
15	var mobile = $videoCont.data('video-mobile'); 
16	var desktop = $videoCont.data('video-desktop'); 
17	var desktopHd = $videoCont.data('video-desktop-hd'); 
18	var videoCont = $videoCont.find('video');
19	var posterMobile = $videoCont.data('poster-mobile');
20	var posterDesktop = $videoCont.data('poster-desktop');
21	//var initialLoad = true;
22
23    var mqls = [
24		window.matchMedia("(min-width: 641px)"), 
25		window.matchMedia("(min-width: 1200px)")
26	];
27
28	function mediaqueryresponse(){
29
30		if (mqls[0].matches == false && mqls[1].matches == false) {
31			if( videoCont.attr('src') != mobile ){
32				videoCont.attr('poster', posterMobile);
33				videoCont.attr('src', mobile);
34			}
35		}
36		if (mqls[0].matches && mqls[1].matches == false) { 			
37			if( videoCont.attr('src') != desktop  ){
38				videoCont.attr('poster', posterDesktop);
39				videoCont.attr('src', desktop);					
40			}
41		}
42
43		if (mqls[1].matches){ 			
44			if( videoCont.attr('src') != desktopHd  ) {
45				videoCont.attr('poster', posterDesktop);
46				videoCont.attr('src', desktopHd);
47			}				
48		}
49	} 
50
51	mediaqueryresponse();
52
53	for (var i=0; i<mqls.length; i++){
54		mqls[i].addEventListener("change", mediaqueryresponse);
55	}	
56	
57	function playVideo(){
58		videoHeader.play();		
59		$controls.attr("aria-label", "Pause Video");
60		$playBtn.hide();
61		$pauseBtn.show();
62	}
63	function pauseVideo(){
64		videoHeader.pause();		
65		$controls.attr("aria-label", "Play Video");
66		$playBtn.show();
67		$pauseBtn.hide();
68	}
69
70	function muteVideo(){	
71		videoHeader.muted = true;
72	}
73
74	function isPlaying(){
75		return $pauseBtn.css("display") !== "none";
76	}
77
78	$controls.on("click", function(){
79		if(isPlaying()){
80			pauseVideo();
81		}else{
82			playVideo();
83		}
84		
85	});
86
87	if(videoHeader !== null && videoHeader.getAttribute("autoplay") === 'autoplay'){
88		videoHeader.addEventListener("canplay", function() {
89			playVideo();
90			muteVideo();
91		});
92	}
93
94
95	$("#modal-link").on("click", function(){
96		pauseVideo();
97
98		setTimeout(function(){
99			var targetNode = document.getElementsByClassName('modal fade in')[0];
100			var observer = new MutationObserver(function(){
101				if(targetNode.style.display !== 'block'){						
102					playVideo();
103					observer.disconnect();
104				}
105			});
106			observer.observe(targetNode, { attributes: true, childList: true });
107		},300);
108	});
109
110
111
112	function videoPlay() {
113		videoHeader.play();
114	}
115
116
117	
118	
119})();
120/*******************************************************************************
121 * Copyright 2020 Adobe
122 *
123 * Licensed under the Apache License, Version 2.0 (the "License");
124 * you may not use this file except in compliance with the License.
125 * You may obtain a copy of the License at
126 *
127 *     http://www.apache.org/licenses/LICENSE-2.0
128 *
129 * Unless required by applicable law or agreed to in writing, software
130 * distributed under the License is distributed on an "AS IS" BASIS,
131 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132 * See the License for the specific language governing permissions and
133 * limitations under the License.
134 ******************************************************************************/
135(function() {
136    "use strict";
137
138    window.CQ = window.CQ || {};
139    window.CQ.CoreComponents = window.CQ.CoreComponents || {};
140    window.CQ.CoreComponents.container = window.CQ.CoreComponents.container || {};
141    window.CQ.CoreComponents.container.utils = {};
142
143    /**
144     * Utilities for Container Components (accordion, tabs)
145     *
146     * @namespace
147     * @alias CQ.CoreComponents.container.utils
148     * @type {{}}
149     */
150    window.CQ.CoreComponents.container.utils = {
151
152        /**
153         * Removes the hash from the URL.
154         */
155        removeUrlHash: function() {
156            history.replaceState(undefined, undefined, " ");
157        },
158
159        /**
160         * Updates the URL hash with the panel ID without scrolling to it.
161         *
162         * @param {Object} component The container component (e.g. Accordion, Carousel, Tabs).
163         * @param {String} itemType The type of the item as defined in the component.
164         * @param {Number} index The index of the container item
165         */
166        updateUrlHash: function(component, itemType, index) {
167            if (component && component._elements && component._elements[itemType] &&
168                component._elements[itemType][index] && component._elements[itemType][index].id) {
169                var ID = component._elements[itemType][index].id;
170                history.replaceState(undefined, undefined, "#" + ID);
171            }
172        },
173
174        /**
175         * Returns the index of the component item (accordion, carousel, tabs) that:
176         * - either corresponds to the deep link in the URL fragment
177         * - or contains the element that corresponds to the deep link in the URL fragment
178         *
179         * @param {Object} component The container component (Accordion, Carousel or Tabs).
180         * @param {String} itemType The type of the item as defined in the component.
181         * @param {String} itemContentType The type of the item content as defined in the component.
182         * @returns {Number} the index within the items array if the item exists, -1 otherwise.
183         */
184        getDeepLinkItemIdx: function(component, itemType, itemContentType) {
185            if (window.location.hash) {
186                var deepLinkId = window.location.hash.substring(1);
187                if (deepLinkId && document.getElementById(deepLinkId) &&
188                    component && component._config && component._config.element &&
189                    component._elements[itemType] &&
190                    component._config.element.querySelector("[id='" + deepLinkId + "']")) {
191                    for (var i = 0; i < component._elements[itemType].length; i++) {
192                        var item = component._elements[itemType][i];
193                        var itemContentContainsId = false;
194                        if (component._elements[itemContentType]) {
195                            var itemContent = component._elements[itemContentType][i];
196                            itemContentContainsId = itemContent && itemContent.querySelector("[id='" + deepLinkId + "']");
197                        }
198                        if (item.id === deepLinkId || itemContentContainsId) {
199                            return i;
200                        }
201                    }
202                }
203                return -1;
204            }
205            return -1;
206        },
207
208        /**
209         * Returns the item of the container component (accordion, carousel, tabs) that:
210         * - either corresponds to the deep link in the URL fragment
211         * - or contains the element that corresponds to the deep link in the URL fragment
212         *
213         * @param {Object} component The Accordion or Tabs component.
214         * @param {String} itemType The type of the item as defined in the component.
215         * @param {String} itemContentType The type of the item content as defined in the component.
216         * @returns {Object} the item if it exists, undefined otherwise.
217         */
218        getDeepLinkItem: function(component, itemType, itemContentType) {
219            var idx = window.CQ.CoreComponents.container.utils.getDeepLinkItemIdx(component, itemType, itemContentType);
220            if (component && component._elements && component._elements[itemType]) {
221                return component._elements[itemType][idx];
222            }
223        },
224
225        /**
226         * Scrolls the browser on page reload (if URI contains URI fragment) to the item of the container component (accordion, tabs)
227           that corresponds to the deep link in the URI fragment.
228         * This method fixes the issue existent with Chrome and related browsers, which are not scrolling on page reload (if URI contains URI fragment)
229           to the element that corresponds to the deep link in the URI fragment.
230         * Small setTimeout is needed, otherwise the scrolling will not work on Chrome.
231         */
232        scrollToAnchor: function() {
233            setTimeout(function() {
234                if (window.location.hash) {
235                    var id = decodeURIComponent(window.location.hash.substring(1));
236                    var anchorElement = document.getElementById(id);
237                    if (anchorElement && anchorElement.offsetTop) {
238                        anchorElement.scrollIntoView();
239                    }
240                }
241            }, 100);
242        }
243    };
244}());
245
246/*******************************************************************************
247 * Copyright 2019 Adobe
248 *
249 * Licensed under the Apache License, Version 2.0 (the "License");
250 * you may not use this file except in compliance with the License.
251 * You may obtain a copy of the License at
252 *
253 *     http://www.apache.org/licenses/LICENSE2.0
254 *
255 * Unless required by applicable law or agreed to in writing, software
256 * distributed under the License is distributed on an "AS IS" BASIS,
257 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
258 * See the License for the specific language governing permissions and
259 * limitations under the License.
260 ******************************************************************************/
261
262/**
263 * Element.matches()
264 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill
265 */
266if (!Element.prototype.matches) {
267    Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
268}
269
270// eslint-disable-next-line valid-jsdoc
271/**
272 * Element.closest()
273 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill
274 */
275if (!Element.prototype.closest) {
276    Element.prototype.closest = function(s) {
277        "use strict";
278        var el = this;
279        if (!document.documentElement.contains(el)) {
280            return null;
281        }
282        do {
283            if (el.matches(s)) {
284                return el;
285            }
286            el = el.parentElement || el.parentNode;
287        } while (el !== null && el.nodeType === 1);
288        return null;
289    };
290}
291
292/*******************************************************************************
293 * Copyright 2019 Adobe
294 *
295 * Licensed under the Apache License, Version 2.0 (the "License");
296 * you may not use this file except in compliance with the License.
297 * You may obtain a copy of the License at
298 *
299 *     http://www.apache.org/licenses/LICENSE-2.0
300 *
301 * Unless required by applicable law or agreed to in writing, software
302 * distributed under the License is distributed on an "AS IS" BASIS,
303 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
304 * See the License for the specific language governing permissions and
305 * limitations under the License.
306 ******************************************************************************/
307(function() {
308    "use strict";
309
310    var containerUtils = window.CQ && window.CQ.CoreComponents && window.CQ.CoreComponents.container && window.CQ.CoreComponents.container.utils ? window.CQ.CoreComponents.container.utils : undefined;
311    if (!containerUtils) {
312        // eslint-disable-next-line no-console
313        console.warn("Accordion: container utilities at window.CQ.CoreComponents.container.utils are not available. This can lead to missing features. Ensure the core.wcm.components.commons.site.container client library is included on the page.");
314    }
315    var dataLayerEnabled;
316    var dataLayer;
317    var dataLayerName;
318    var delay = 100;
319
320    var NS = "cmp";
321    var IS = "accordion";
322
323    var keyCodes = {
324        ENTER: 13,
325        SPACE: 32,
326        END: 35,
327        HOME: 36,
328        ARROW_LEFT: 37,
329        ARROW_UP: 38,
330        ARROW_RIGHT: 39,
331        ARROW_DOWN: 40
332    };
333
334    var selectors = {
335        self: "[data-" + NS + '-is="' + IS + '"]'
336    };
337
338    var cssClasses = {
339        button: {
340            disabled: "cmp-accordion__button--disabled",
341            expanded: "cmp-accordion__button--expanded"
342        },
343        panel: {
344            hidden: "cmp-accordion__panel--hidden",
345            expanded: "cmp-accordion__panel--expanded"
346        }
347    };
348
349    var dataAttributes = {
350        item: {
351            expanded: "data-cmp-expanded"
352        }
353    };
354
355    var properties = {
356        /**
357         * Determines whether a single accordion item is forced to be expanded at a time.
358         * Expanding one item will collapse all others.
359         *
360         * @memberof Accordion
361         * @type {Boolean}
362         * @default false
363         */
364        "singleExpansion": {
365            "default": false,
366            "transform": function(value) {
367                return !(value === null || typeof value === "undefined");
368            }
369        }
370    };
371
372    /**
373     * Accordion Configuration.
374     *
375     * @typedef {Object} AccordionConfig Represents an Accordion configuration
376     * @property {HTMLElement} element The HTMLElement representing the Accordion
377     * @property {Object} options The Accordion options
378     */
379
380    /**
381     * Accordion.
382     *
383     * @class Accordion
384     * @classdesc An interactive Accordion component for toggling panels of related content
385     * @param {AccordionConfig} config The Accordion configuration
386     */
387    function Accordion(config) {
388        var that = this;
389
390        if (config && config.element) {
391            init(config);
392        }
393
394        /**
395         * Initializes the Accordion.
396         *
397         * @private
398         * @param {AccordionConfig} config The Accordion configuration
399         */
400        function init(config) {
401            that._config = config;
402
403            // prevents multiple initialization
404            config.element.removeAttribute("data-" + NS + "-is");
405
406            setupProperties(config.options);
407            cacheElements(config.element);
408
409            if (that._elements["item"]) {
410                // ensures multiple element types are arrays.
411                that._elements["item"] = Array.isArray(that._elements["item"]) ? that._elements["item"] : [that._elements["item"]];
412                that._elements["button"] = Array.isArray(that._elements["button"]) ? that._elements["button"] : [that._elements["button"]];
413                that._elements["panel"] = Array.isArray(that._elements["panel"]) ? that._elements["panel"] : [that._elements["panel"]];
414
415                if (that._properties.singleExpansion) {
416                    var expandedItems = getExpandedItems();
417                    // multiple expanded items annotated, display the last item open.
418                    if (expandedItems.length > 1) {
419                        toggle(expandedItems.length - 1);
420                    }
421                }
422
423                refreshItems();
424                bindEvents();
425                scrollToDeepLinkIdInAccordion();
426            }
427            if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) {
428                /*
429                 * Editor message handling:
430                 * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame
431                 * - check that the message data panel container type is correct and that the id (path) matches this specific Accordion component
432                 * - if so, route the "navigate" operation to enact a navigation of the Accordion based on index data
433                 */
434                window.CQ.CoreComponents.MESSAGE_CHANNEL = window.CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window);
435                window.CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) {
436                    if (message.data && message.data.type === "cmp-accordion" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) {
437                        if (message.data.operation === "navigate") {
438                            // switch to single expansion mode when navigating in edit mode.
439                            var singleExpansion = that._properties.singleExpansion;
440                            that._properties.singleExpansion = true;
441                            toggle(message.data.index);
442
443                            // revert to the configured state.
444                            that._properties.singleExpansion = singleExpansion;
445                        }
446                    }
447                });
448            }
449        }
450
451        /**
452         * Displays the panel containing the element that corresponds to the deep link in the URI fragment
453         * and scrolls the browser to this element.
454         */
455        function scrollToDeepLinkIdInAccordion() {
456            if (containerUtils) {
457                var deepLinkItemIdx = containerUtils.getDeepLinkItemIdx(that, "item", "item");
458                if (deepLinkItemIdx > -1) {
459                    var deepLinkItem = that._elements["item"][deepLinkItemIdx];
460                    if (deepLinkItem && !deepLinkItem.hasAttribute(dataAttributes.item.expanded)) {
461                        // if single expansion: close all accordion items
462                        if (that._properties.singleExpansion) {
463                            for (var j = 0; j < that._elements["item"].length; j++) {
464                                if (that._elements["item"][j].hasAttribute(dataAttributes.item.expanded)) {
465                                    setItemExpanded(that._elements["item"][j], false, true);
466                                }
467                            }
468                        }
469                        // expand the accordion item containing the deep link
470                        setItemExpanded(deepLinkItem, true, true);
471                    }
472                    var hashId = window.location.hash.substring(1);
473                    if (hashId) {
474                        var hashItem = document.querySelector("[id='" + hashId + "']");
475                        if (hashItem) {
476                            hashItem.scrollIntoView();
477                        }
478                    }
479                }
480            }
481        }
482
483        /**
484         * Caches the Accordion elements as defined via the {@code data-accordion-hook="ELEMENT_NAME"} markup API.
485         *
486         * @private
487         * @param {HTMLElement} wrapper The Accordion wrapper element
488         */
489        function cacheElements(wrapper) {
490            that._elements = {};
491            that._elements.self = wrapper;
492            var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]");
493
494            for (var i = 0; i < hooks.length; i++) {
495                var hook = hooks[i];
496                if (hook.closest("." + NS + "-" + IS) === that._elements.self) { // only process own accordion elements
497                    var capitalized = IS;
498                    capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1);
499                    var key = hook.dataset[NS + "Hook" + capitalized];
500                    if (that._elements[key]) {
501                        if (!Array.isArray(that._elements[key])) {
502                            var tmp = that._elements[key];
503                            that._elements[key] = [tmp];
504                        }
505                        that._elements[key].push(hook);
506                    } else {
507                        that._elements[key] = hook;
508                    }
509                }
510            }
511        }
512
513        /**
514         * Sets up properties for the Accordion based on the passed options.
515         *
516         * @private
517         * @param {Object} options The Accordion options
518         */
519        function setupProperties(options) {
520            that._properties = {};
521
522            for (var key in properties) {
523                if (Object.prototype.hasOwnProperty.call(properties, key)) {
524                    var property = properties[key];
525                    var value = null;
526
527                    if (options && options[key] != null) {
528                        value = options[key];
529
530                        // transform the provided option
531                        if (property && typeof property.transform === "function") {
532                            value = property.transform(value);
533                        }
534                    }
535
536                    if (value === null) {
537                        // value still null, take the property default
538                        value = properties[key]["default"];
539                    }
540
541                    that._properties[key] = value;
542                }
543            }
544        }
545
546        /**
547         * Binds Accordion event handling.
548         *
549         * @private
550         */
551        function bindEvents() {
552            window.addEventListener("hashchange", scrollToDeepLinkIdInAccordion, false);
553            var buttons = that._elements["button"];
554            if (buttons) {
555                for (var i = 0; i < buttons.length; i++) {
556                    (function(index) {
557                        buttons[i].addEventListener("click", function(event) {
558                            toggle(index);
559                            focusButton(index);
560                        });
561                        buttons[i].addEventListener("keydown", function(event) {
562                            onButtonKeyDown(event, index);
563                        });
564                    })(i);
565                }
566            }
567        }
568
569        /**
570         * Handles button keydown events.
571         *
572         * @private
573         * @param {Object} event The keydown event
574         * @param {Number} index The index of the button triggering the event
575         */
576        function onButtonKeyDown(event, index) {
577            var lastIndex = that._elements["button"].length - 1;
578
579            switch (event.keyCode) {
580                case keyCodes.ARROW_LEFT:
581                case keyCodes.ARROW_UP:
582                    event.preventDefault();
583                    if (index > 0) {
584                        focusButton(index - 1);
585                    }
586                    break;
587                case keyCodes.ARROW_RIGHT:
588                case keyCodes.ARROW_DOWN:
589                    event.preventDefault();
590                    if (index < lastIndex) {
591                        focusButton(index + 1);
592                    }
593                    break;
594                case keyCodes.HOME:
595                    event.preventDefault();
596                    focusButton(0);
597                    break;
598                case keyCodes.END:
599                    event.preventDefault();
600                    focusButton(lastIndex);
601                    break;
602                case keyCodes.ENTER:
603                case keyCodes.SPACE:
604                    event.preventDefault();
605                    toggle(index);
606                    focusButton(index);
607                    break;
608                default:
609                    return;
610            }
611        }
612
613        /**
614         * General handler for toggle of an item.
615         *
616         * @private
617         * @param {Number} index The index of the item to toggle
618         */
619        function toggle(index) {
620            var item = that._elements["item"][index];
621            if (item) {
622                if (that._properties.singleExpansion) {
623                    // ensure only a single item is expanded if single expansion is enabled.
624                    for (var i = 0; i < that._elements["item"].length; i++) {
625                        if (that._elements["item"][i] !== item) {
626                            var expanded = getItemExpanded(that._elements["item"][i]);
627                            if (expanded) {
628                                setItemExpanded(that._elements["item"][i], false);
629                            }
630                        }
631                    }
632                }
633                setItemExpanded(item, !getItemExpanded(item));
634
635                if (dataLayerEnabled) {
636                    var accordionId = that._elements.self.id;
637                    var expandedItems = getExpandedItems()
638                        .map(function(item) {
639                            return getDataLayerId(item);
640                        });
641
642                    var uploadPayload = { component: {} };
643                    uploadPayload.component[accordionId] = { shownItems: expandedItems };
644
645                    var removePayload = { component: {} };
646                    removePayload.component[accordionId] = { shownItems: undefined };
647
648                    dataLayer.push(removePayload);
649                    dataLayer.push(uploadPayload);
650                }
651            }
652        }
653
654        /**
655         * Sets an item's expanded state based on the provided flag and refreshes its internals.
656         *
657         * @private
658         * @param {HTMLElement} item The item to mark as expanded, or not expanded
659         * @param {Boolean} expanded true to mark the item expanded, false otherwise
660         * @param {Boolean} keepHash true to keep the hash in the URL, false to update it
661         */
662        function setItemExpanded(item, expanded, keepHash) {
663            if (expanded) {
664                item.setAttribute(dataAttributes.item.expanded, "");
665                var index = that._elements["item"].indexOf(item);
666                if (!keepHash && containerUtils) {
667                    containerUtils.updateUrlHash(that, "item", index);
668                }
669                if (dataLayerEnabled) {
670                    dataLayer.push({
671                        event: "cmp:show",
672                        eventInfo: {
673                            path: "component." + getDataLayerId(item)
674                        }
675                    });
676                }
677
678            } else {
679                item.removeAttribute(dataAttributes.item.expanded);
680                if (!keepHash && containerUtils) {
681                    containerUtils.removeUrlHash();
682                }
683                if (dataLayerEnabled) {
684                    dataLayer.push({
685                        event: "cmp:hide",
686                        eventInfo: {
687                            path: "component." + getDataLayerId(item)
688                        }
689                    });
690                }
691            }
692            refreshItem(item);
693        }
694
695        /**
696         * Gets an item's expanded state.
697         *
698         * @private
699         * @param {HTMLElement} item The item for checking its expanded state
700         * @returns {Boolean} true if the item is expanded, false otherwise
701         */
702        function getItemExpanded(item) {
703            return item && item.dataset && item.dataset["cmpExpanded"] !== undefined;
704        }
705
706        /**
707         * Refreshes an item based on its expanded state.
708         *
709         * @private
710         * @param {HTMLElement} item The item to refresh
711         */
712        function refreshItem(item) {
713            var expanded = getItemExpanded(item);
714            if (expanded) {
715                expandItem(item);
716            } else {
717                collapseItem(item);
718            }
719        }
720
721        /**
722         * Refreshes all items based on their expanded state.
723         *
724         * @private
725         */
726        function refreshItems() {
727            for (var i = 0; i < that._elements["item"].length; i++) {
728                refreshItem(that._elements["item"][i]);
729            }
730        }
731
732        /**
733         * Returns all expanded items.
734         *
735         * @private
736         * @returns {HTMLElement[]} The expanded items
737         */
738        function getExpandedItems() {
739            var expandedItems = [];
740
741            for (var i = 0; i < that._elements["item"].length; i++) {
742                var item = that._elements["item"][i];
743                var expanded = getItemExpanded(item);
744                if (expanded) {
745                    expandedItems.push(item);
746                }
747            }
748
749            return expandedItems;
750        }
751
752        /**
753         * Annotates the item and its internals with
754         * the necessary style and accessibility attributes to indicate it is expanded.
755         *
756         * @private
757         * @param {HTMLElement} item The item to annotate as expanded
758         */
759        function expandItem(item) {
760            var index = that._elements["item"].indexOf(item);
761            if (index > -1) {
762                var button = that._elements["button"][index];
763                var panel = that._elements["panel"][index];
764                button.classList.add(cssClasses.button.expanded);
765                // used to fix some known screen readers issues in reading the correct state of the 'aria-expanded' attribute
766                // e.g. https://bugs.webkit.org/show_bug.cgi?id=210934
767                setTimeout(function() {
768                    button.setAttribute("aria-expanded", true);
769                }, delay);
770                panel.classList.add(cssClasses.panel.expanded);
771                panel.classList.remove(cssClasses.panel.hidden);
772                panel.setAttribute("aria-hidden", false);
773            }
774        }
775
776        /**
777         * Annotates the item and its internals with
778         * the necessary style and accessibility attributes to indicate it is not expanded.
779         *
780         * @private
781         * @param {HTMLElement} item The item to annotate as not expanded
782         */
783        function collapseItem(item) {
784            var index = that._elements["item"].indexOf(item);
785            if (index > -1) {
786                var button = that._elements["button"][index];
787                var panel = that._elements["panel"][index];
788                button.classList.remove(cssClasses.button.expanded);
789                // used to fix some known screen readers issues in reading the correct state of the 'aria-expanded' attribute
790                // e.g. https://bugs.webkit.org/show_bug.cgi?id=210934
791                setTimeout(function() {
792                    button.setAttribute("aria-expanded", false);
793                }, delay);
794                panel.classList.add(cssClasses.panel.hidden);
795                panel.classList.remove(cssClasses.panel.expanded);
796                panel.setAttribute("aria-hidden", true);
797            }
798        }
799
800        /**
801         * Focuses the button at the provided index.
802         *
803         * @private
804         * @param {Number} index The index of the button to focus
805         */
806        function focusButton(index) {
807            var button = that._elements["button"][index];
808            button.focus();
809        }
810    }
811
812    /**
813     * Reads options data from the Accordion wrapper element, defined via {@code data-cmp-*} data attributes.
814     *
815     * @private
816     * @param {HTMLElement} element The Accordion element to read options data from
817     * @returns {Object} The options read from the component data attributes
818     */
819    function readData(element) {
820        var data = element.dataset;
821        var options = [];
822        var capitalized = IS;
823        capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1);
824        var reserved = ["is", "hook" + capitalized];
825
826        for (var key in data) {
827            if (Object.prototype.hasOwnProperty.call(data, key)) {
828                var value = data[key];
829
830                if (key.indexOf(NS) === 0) {
831                    key = key.slice(NS.length);
832                    key = key.charAt(0).toLowerCase() + key.substring(1);
833
834                    if (reserved.indexOf(key) === -1) {
835                        options[key] = value;
836                    }
837                }
838            }
839        }
840
841        return options;
842    }
843
844    /**
845     * Parses the dataLayer string and returns the ID
846     *
847     * @private
848     * @param {HTMLElement} item the accordion item
849     * @returns {String} dataLayerId or undefined
850     */
851    function getDataLayerId(item) {
852        if (item) {
853            if (item.dataset.cmpDataLayer) {
854                return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0];
855            } else {
856                return item.id;
857            }
858        }
859        return null;
860    }
861
862    /**
863     * Document ready handler and DOM mutation observers. Initializes Accordion components as necessary.
864     *
865     * @private
866     */
867    function onDocumentReady() {
868        dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled");
869        if (dataLayerEnabled) {
870            dataLayerName = document.body.getAttribute("data-cmp-data-layer-name") || "adobeDataLayer";
871            dataLayer = window[dataLayerName] = window[dataLayerName] || [];
872        }
873
874        var elements = document.querySelectorAll(selectors.self);
875        for (var i = 0; i < elements.length; i++) {
876            new Accordion({ element: elements[i], options: readData(elements[i]) });
877        }
878
879        var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
880        var body = document.querySelector("body");
881        var observer = new MutationObserver(function(mutations) {
882            mutations.forEach(function(mutation) {
883                // needed for IE
884                var nodesArray = [].slice.call(mutation.addedNodes);
885                if (nodesArray.length > 0) {
886                    nodesArray.forEach(function(addedNode) {
887                        if (addedNode.querySelectorAll) {
888                            var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self));
889                            elementsArray.forEach(function(element) {
890                                new Accordion({ element: element, options: readData(element) });
891                            });
892                        }
893                    });
894                }
895            });
896        });
897
898        observer.observe(body, {
899            subtree: true,
900            childList: true,
901            characterData: true
902        });
903    }
904
905    if (document.readyState !== "loading") {
906        onDocumentReady();
907    } else {
908        document.addEventListener("DOMContentLoaded", onDocumentReady);
909    }
910
911    if (containerUtils) {
912        window.addEventListener("load", containerUtils.scrollToAnchor, false);
913    }
914
915}());
916
917/*******************************************************************************
918 * Copyright 2019 Adobe
919 *
920 * Licensed under the Apache License, Version 2.0 (the "License");
921 * you may not use this file except in compliance with the License.
922 * You may obtain a copy of the License at
923 *
924 *     http://www.apache.org/licenses/LICENSE2.0
925 *
926 * Unless required by applicable law or agreed to in writing, software
927 * distributed under the License is distributed on an "AS IS" BASIS,
928 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
929 * See the License for the specific language governing permissions and
930 * limitations under the License.
931 ******************************************************************************/
932
933/**
934 * Element.matches()
935 * https://developer.mozilla.org/enUS/docs/Web/API/Element/matches#Polyfill
936 */
937if (!Element.prototype.matches) {
938    Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
939}
940
941// eslint-disable-next-line valid-jsdoc
942/**
943 * Element.closest()
944 * https://developer.mozilla.org/enUS/docs/Web/API/Element/closest#Polyfill
945 */
946if (!Element.prototype.closest) {
947    Element.prototype.closest = function(s) {
948        "use strict";
949        var el = this;
950        if (!document.documentElement.contains(el)) {
951            return null;
952        }
953        do {
954            if (el.matches(s)) {
955                return el;
956            }
957            el = el.parentElement || el.parentNode;
958        } while (el !== null && el.nodeType === 1);
959        return null;
960    };
961}
962
963/*******************************************************************************
964 * Copyright 2019 Adobe
965 *
966 * Licensed under the Apache License, Version 2.0 (the "License");
967 * you may not use this file except in compliance with the License.
968 * You may obtain a copy of the License at
969 *
970 *     http://www.apache.org/licenses/LICENSE-2.0
971 *
972 * Unless required by applicable law or agreed to in writing, software
973 * distributed under the License is distributed on an "AS IS" BASIS,
974 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
975 * See the License for the specific language governing permissions and
976 * limitations under the License.
977 ******************************************************************************/
978(function() {
979    "use strict";
980
981    var dataLayerEnabled;
982    var dataLayer;
983    var delay = 100;
984
985    var NS = "cmp";
986    var IS = "accordion";
987
988    var keyCodes = {
989        ENTER: 13,
990        SPACE: 32,
991        END: 35,
992        HOME: 36,
993        ARROW_LEFT: 37,
994        ARROW_UP: 38,
995        ARROW_RIGHT: 39,
996        ARROW_DOWN: 40
997    };
998
999    var selectors = {
1000        self: "[data-" + NS + '-is="' + IS + '"]'
1001    };
1002
1003    var cssClasses = {
1004        button: {
1005            disabled: "cmp-accordion__button--disabled",
1006            expanded: "cmp-accordion__button--expanded"
1007        },
1008        panel: {
1009            hidden: "cmp-accordion__panel--hidden",
1010            expanded: "cmp-accordion__panel--expanded"
1011        }
1012    };
1013
1014    var dataAttributes = {
1015        item: {
1016            expanded: "data-cmp-expanded"
1017        }
1018    };
1019
1020    var properties = {
1021        /**
1022         * Determines whether a single accordion item is forced to be expanded at a time.
1023         * Expanding one item will collapse all others.
1024         *
1025         * @memberof Accordion
1026         * @type {Boolean}
1027         * @default false
1028         */
1029        "singleExpansion": {
1030            "default": false,
1031            "transform": function(value) {
1032                return !(value === null || typeof value === "undefined");
1033            }
1034        }
1035    };
1036
1037    /**
1038     * Accordion Configuration.
1039     *
1040     * @typedef {Object} AccordionConfig Represents an Accordion configuration
1041     * @property {HTMLElement} element The HTMLElement representing the Accordion
1042     * @property {Object} options The Accordion options
1043     */
1044
1045    /**
1046     * Accordion.
1047     *
1048     * @class Accordion
1049     * @classdesc An interactive Accordion component for toggling panels of related content
1050     * @param {AccordionConfig} config The Accordion configuration
1051     */
1052    function Accordion(config) {
1053        var that = this;
1054
1055        if (config && config.element) {
1056            init(config);
1057        }
1058
1059        /**
1060         * Initializes the Accordion.
1061         *
1062         * @private
1063         * @param {AccordionConfig} config The Accordion configuration
1064         */
1065        function init(config) {
1066            that._config = config;
1067
1068            // prevents multiple initialization
1069            config.element.removeAttribute("data-" + NS + "-is");
1070
1071            setupProperties(config.options);
1072            cacheElements(config.element);
1073
1074            if (that._elements["item"]) {
1075                // ensures multiple element types are arrays.
1076                that._elements["item"] = Array.isArray(that._elements["item"]) ? that._elements["item"] : [that._elements["item"]];
1077                that._elements["button"] = Array.isArray(that._elements["button"]) ? that._elements["button"] : [that._elements["button"]];
1078                that._elements["panel"] = Array.isArray(that._elements["panel"]) ? that._elements["panel"] : [that._elements["panel"]];
1079
1080                // Expand the item based on deep-link-id if it matches with any existing accordion item id
1081                var deepLinkItem = window.CQ.CoreComponents.container.utils.getDeepLinkItem(that, "item");
1082                if (deepLinkItem && !deepLinkItem.hasAttribute(dataAttributes.item.expanded)) {
1083                    setItemExpanded(deepLinkItem, true);
1084                }
1085
1086                if (that._properties.singleExpansion) {
1087                    // No deep linking
1088                    if (!deepLinkItem) {
1089                        var expandedItems = getExpandedItems();
1090                        // no expanded item annotated, force the first item to display.
1091                        if (expandedItems.length === 0) {
1092                            //toggle(0);
1093                        }
1094                        // multiple expanded items annotated, display the last item open.
1095                        if (expandedItems.length > 1) {
1096                            toggle(expandedItems.length - 1);
1097                        }
1098                    } else {
1099                        // Deep link case
1100                        // Collapse the items other than which is deep linked
1101                        for (var j = 0; j < that._elements["item"].length; j++) {
1102                            if (that._elements["item"][j].id !== deepLinkItem.id &&
1103                                that._elements["item"][j].hasAttribute(dataAttributes.item.expanded)) {
1104                                setItemExpanded(that._elements["item"][j], false);
1105                            }
1106                        }
1107                    }
1108                }
1109
1110                refreshItems();
1111                bindEvents();
1112
1113                if (window.Granite && window.Granite.author && window.Granite.author.MessageChannel) {
1114                    /*
1115                     * Editor message handling:
1116                     * - subscribe to "cmp.panelcontainer" message requests sent by the editor frame
1117                     * - check that the message data panel container type is correct and that the id (path) matches this specific Accordion component
1118                     * - if so, route the "navigate" operation to enact a navigation of the Accordion based on index data
1119                     */
1120                    window.CQ.CoreComponents.MESSAGE_CHANNEL = window.CQ.CoreComponents.MESSAGE_CHANNEL || new window.Granite.author.MessageChannel("cqauthor", window);
1121                    window.CQ.CoreComponents.MESSAGE_CHANNEL.subscribeRequestMessage("cmp.panelcontainer", function(message) {
1122                        if (message.data && message.data.type === "cmp-accordion" && message.data.id === that._elements.self.dataset["cmpPanelcontainerId"]) {
1123                            if (message.data.operation === "navigate") {
1124                                // switch to single expansion mode when navigating in edit mode.
1125                                var singleExpansion = that._properties.singleExpansion;
1126                                that._properties.singleExpansion = true;
1127                                toggle(message.data.index);
1128
1129                                // revert to the configured state.
1130                                that._properties.singleExpansion = singleExpansion;
1131                            }
1132                        }
1133                    });
1134                }
1135            }
1136        }
1137
1138        /**
1139         * Caches the Accordion elements as defined via the {@code data-accordion-hook="ELEMENT_NAME"} markup API.
1140         *
1141         * @private
1142         * @param {HTMLElement} wrapper The Accordion wrapper element
1143         */
1144        function cacheElements(wrapper) {
1145            that._elements = {};
1146            that._elements.self = wrapper;
1147            var hooks = that._elements.self.querySelectorAll("[data-" + NS + "-hook-" + IS + "]");
1148
1149            for (var i = 0; i < hooks.length; i++) {
1150                var hook = hooks[i];
1151                if (hook.closest("." + NS + "-" + IS) === that._elements.self) { // only process own accordion elements
1152                    var capitalized = IS;
1153                    capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1);
1154                    var key = hook.dataset[NS + "Hook" + capitalized];
1155                    if (that._elements[key]) {
1156                        if (!Array.isArray(that._elements[key])) {
1157                            var tmp = that._elements[key];
1158                            that._elements[key] = [tmp];
1159                        }
1160                        that._elements[key].push(hook);
1161                    } else {
1162                        that._elements[key] = hook;
1163                    }
1164                }
1165            }
1166        }
1167
1168        /**
1169         * Sets up properties for the Accordion based on the passed options.
1170         *
1171         * @private
1172         * @param {Object} options The Accordion options
1173         */
1174        function setupProperties(options) {
1175            that._properties = {};
1176
1177            for (var key in properties) {
1178                if (properties.hasOwnProperty(key)) {
1179                    var property = properties[key];
1180                    var value = null;
1181
1182                    if (options && options[key] != null) {
1183                        value = options[key];
1184
1185                        // transform the provided option
1186                        if (property && typeof property.transform === "function") {
1187                            value = property.transform(value);
1188                        }
1189                    }
1190
1191                    if (value === null) {
1192                        // value still null, take the property default
1193                        value = properties[key]["default"];
1194                    }
1195
1196                    that._properties[key] = value;
1197                }
1198            }
1199        }
1200
1201        /**
1202         * Binds Accordion event handling.
1203         *
1204         * @private
1205         */
1206        function bindEvents() {
1207            var buttons = that._elements["button"];
1208            if (buttons) {
1209                for (var i = 0; i < buttons.length; i++) {
1210                    (function(index) {
1211                        buttons[i].addEventListener("click", function(event) {
1212                            toggle(index);
1213                            focusButton(index);
1214                        });
1215                        buttons[i].addEventListener("keydown", function(event) {
1216                            onButtonKeyDown(event, index);
1217                        });
1218                    })(i);
1219                }
1220            }
1221        }
1222
1223        /**
1224         * Handles button keydown events.
1225         *
1226         * @private
1227         * @param {Object} event The keydown event
1228         * @param {Number} index The index of the button triggering the event
1229         */
1230        function onButtonKeyDown(event, index) {
1231            var lastIndex = that._elements["button"].length - 1;
1232
1233            switch (event.keyCode) {
1234                case keyCodes.ARROW_LEFT:
1235                case keyCodes.ARROW_UP:
1236                    event.preventDefault();
1237                    if (index > 0) {
1238                        focusButton(index - 1);
1239                    }
1240                    break;
1241                case keyCodes.ARROW_RIGHT:
1242                case keyCodes.ARROW_DOWN:
1243                    event.preventDefault();
1244                    if (index < lastIndex) {
1245                        focusButton(index + 1);
1246                    }
1247                    break;
1248                case keyCodes.HOME:
1249                    event.preventDefault();
1250                    focusButton(0);
1251                    break;
1252                case keyCodes.END:
1253                    event.preventDefault();
1254                    focusButton(lastIndex);
1255                    break;
1256                case keyCodes.ENTER:
1257                case keyCodes.SPACE:
1258                    event.preventDefault();
1259                    toggle(index);
1260                    focusButton(index);
1261                    break;
1262                default:
1263                    return;
1264            }
1265        }
1266
1267        /**
1268         * General handler for toggle of an item.
1269         *
1270         * @private
1271         * @param {Number} index The index of the item to toggle
1272         */
1273        function toggle(index) {
1274            var item = that._elements["item"][index];
1275            if (item) {
1276                if (that._properties.singleExpansion) {
1277                    // ensure only a single item is expanded if single expansion is enabled.
1278                    for (var i = 0; i < that._elements["item"].length; i++) {
1279                        if (that._elements["item"][i] !== item) {
1280                            var expanded = getItemExpanded(that._elements["item"][i]);
1281                            if (expanded) {
1282                                setItemExpanded(that._elements["item"][i], false);
1283                            }
1284                        }
1285                    }
1286                    setItemExpanded(item, true);
1287                } else {
1288                    setItemExpanded(item, !getItemExpanded(item));
1289                }
1290
1291                if (dataLayerEnabled) {
1292                    var accordionId = that._elements.self.id;
1293                    var expandedItems = getExpandedItems()
1294                        .map(function(item) {
1295                            return getDataLayerId(item);
1296                        });
1297
1298                    var uploadPayload = { component: {} };
1299                    uploadPayload.component[accordionId] = { shownItems: expandedItems };
1300
1301                    var removePayload = { component: {} };
1302                    removePayload.component[accordionId] = { shownItems: undefined };
1303
1304                    dataLayer.push(removePayload);
1305                    dataLayer.push(uploadPayload);
1306                }
1307            }
1308        }
1309
1310        /**
1311         * Sets an item's expanded state based on the provided flag and refreshes its internals.
1312         *
1313         * @private
1314         * @param {HTMLElement} item The item to mark as expanded, or not expanded
1315         * @param {Boolean} expanded true to mark the item expanded, false otherwise
1316         */
1317        function setItemExpanded(item, expanded) {
1318            if (expanded) {
1319                item.setAttribute(dataAttributes.item.expanded, "");
1320                if (dataLayerEnabled) {
1321                    dataLayer.push({
1322                        event: "cmp:show",
1323                        eventInfo: {
1324                            path: "component." + getDataLayerId(item)
1325                        }
1326                    });
1327                }
1328
1329            } else {
1330                item.removeAttribute(dataAttributes.item.expanded);
1331                if (dataLayerEnabled) {
1332                    dataLayer.push({
1333                        event: "cmp:hide",
1334                        eventInfo: {
1335                            path: "component." + getDataLayerId(item)
1336                        }
1337                    });
1338                }
1339            }
1340            refreshItem(item);
1341        }
1342
1343        /**
1344         * Gets an item's expanded state.
1345         *
1346         * @private
1347         * @param {HTMLElement} item The item for checking its expanded state
1348         * @returns {Boolean} true if the item is expanded, false otherwise
1349         */
1350        function getItemExpanded(item) {
1351            return item && item.dataset && item.dataset["cmpExpanded"] !== undefined;
1352        }
1353
1354        /**
1355         * Refreshes an item based on its expanded state.
1356         *
1357         * @private
1358         * @param {HTMLElement} item The item to refresh
1359         */
1360        function refreshItem(item) {
1361            var expanded = getItemExpanded(item);
1362            if (expanded) {
1363                expandItem(item);
1364            } else {
1365                collapseItem(item);
1366            }
1367        }
1368
1369        /**
1370         * Refreshes all items based on their expanded state.
1371         *
1372         * @private
1373         */
1374        function refreshItems() {
1375            for (var i = 0; i < that._elements["item"].length; i++) {
1376                refreshItem(that._elements["item"][i]);
1377            }
1378        }
1379
1380        /**
1381         * Returns all expanded items.
1382         *
1383         * @private
1384         * @returns {HTMLElement[]} The expanded items
1385         */
1386        function getExpandedItems() {
1387            var expandedItems = [];
1388
1389            for (var i = 0; i < that._elements["item"].length; i++) {
1390                var item = that._elements["item"][i];
1391                var expanded = getItemExpanded(item);
1392                if (expanded) {
1393                    expandedItems.push(item);
1394                }
1395            }
1396
1397            return expandedItems;
1398        }
1399
1400        /**
1401         * Annotates the item and its internals with
1402         * the necessary style and accessibility attributes to indicate it is expanded.
1403         *
1404         * @private
1405         * @param {HTMLElement} item The item to annotate as expanded
1406         */
1407        function expandItem(item) {
1408            var index = that._elements["item"].indexOf(item);
1409            if (index > -1) {
1410                var button = that._elements["button"][index];
1411                var panel = that._elements["panel"][index];
1412                button.classList.add(cssClasses.button.expanded);
1413                // used to fix some known screen readers issues in reading the correct state of the 'aria-expanded' attribute
1414                // e.g. https://bugs.webkit.org/show_bug.cgi?id=210934
1415                setTimeout(function() {
1416                    button.setAttribute("aria-expanded", true);
1417                }, delay);
1418                panel.classList.add(cssClasses.panel.expanded);
1419                panel.classList.remove(cssClasses.panel.hidden);
1420                panel.setAttribute("aria-hidden", false);
1421
1422                if (that._properties.singleExpansion) {
1423                    button.classList.add(cssClasses.button.disabled);
1424                    button.setAttribute("aria-disabled", true);
1425                }
1426            }
1427        }
1428
1429        /**
1430         * Annotates the item and its internals with
1431         * the necessary style and accessibility attributes to indicate it is not expanded.
1432         *
1433         * @private
1434         * @param {HTMLElement} item The item to annotate as not expanded
1435         */
1436        function collapseItem(item) {
1437            var index = that._elements["item"].indexOf(item);
1438            if (index > -1) {
1439                var button = that._elements["button"][index];
1440                var panel = that._elements["panel"][index];
1441                button.classList.remove(cssClasses.button.disabled);
1442                button.classList.remove(cssClasses.button.expanded);
1443                button.removeAttribute("aria-disabled");
1444                // used to fix some known screen readers issues in reading the correct state of the 'aria-expanded' attribute
1445                // e.g. https://bugs.webkit.org/show_bug.cgi?id=210934
1446                setTimeout(function() {
1447                    button.setAttribute("aria-expanded", false);
1448                }, delay);
1449                panel.classList.add(cssClasses.panel.hidden);
1450                panel.classList.remove(cssClasses.panel.expanded);
1451                panel.setAttribute("aria-hidden", true);
1452            }
1453        }
1454
1455        /**
1456         * Focuses the button at the provided index.
1457         *
1458         * @private
1459         * @param {Number} index The index of the button to focus
1460         */
1461        function focusButton(index) {
1462            var button = that._elements["button"][index];
1463            button.focus();
1464        }
1465    }
1466
1467    /**
1468     * Scrolls the browser when the URI fragment is changed to the item of the container Accordion component that corresponds to the deep link in the URL fragment,
1469       and displays its content.
1470     */
1471    function onHashChange() {
1472        if (location.hash && location.hash !== "#") {
1473            var anchorLocation = decodeURIComponent(location.hash);
1474            var anchorElement = document.querySelector(anchorLocation);
1475            if (anchorElement && anchorElement.classList.contains("cmp-accordion__item") && !anchorElement.hasAttribute("data-cmp-expanded")) {
1476                var anchorElementButton = document.querySelector(anchorLocation + "-button");
1477                if (anchorElementButton) {
1478                    anchorElementButton.click();
1479                }
1480            }
1481        }
1482    }
1483
1484    /**
1485     * Reads options data from the Accordion wrapper element, defined via {@code data-cmp-*} data attributes.
1486     *
1487     * @private
1488     * @param {HTMLElement} element The Accordion element to read options data from
1489     * @returns {Object} The options read from the component data attributes
1490     */
1491    function readData(element) {
1492        var data = element.dataset;
1493        var options = [];
1494        var capitalized = IS;
1495        capitalized = capitalized.charAt(0).toUpperCase() + capitalized.slice(1);
1496        var reserved = ["is", "hook" + capitalized];
1497
1498        for (var key in data) {
1499            if (data.hasOwnProperty(key)) {
1500                var value = data[key];
1501
1502                if (key.indexOf(NS) === 0) {
1503                    key = key.slice(NS.length);
1504                    key = key.charAt(0).toLowerCase() + key.substring(1);
1505
1506                    if (reserved.indexOf(key) === -1) {
1507                        options[key] = value;
1508                    }
1509                }
1510            }
1511        }
1512
1513        return options;
1514    }
1515
1516    /**
1517     * Parses the dataLayer string and returns the ID
1518     *
1519     * @private
1520     * @param {HTMLElement} item the accordion item
1521     * @returns {String} dataLayerId or undefined
1522     */
1523    function getDataLayerId(item) {
1524        if (item && item.dataset.cmpDataLayer) {
1525            return Object.keys(JSON.parse(item.dataset.cmpDataLayer))[0];
1526        } else {
1527            return item.id;
1528        }
1529    }
1530
1531    /**
1532     * Document ready handler and DOM mutation observers. Initializes Accordion components as necessary.
1533     *
1534     * @private
1535     */
1536    function onDocumentReady() {
1537        dataLayerEnabled = document.body.hasAttribute("data-cmp-data-layer-enabled");
1538        dataLayer = (dataLayerEnabled) ? window.adobeDataLayer = window.adobeDataLayer || [] : undefined;
1539
1540        var elements = document.querySelectorAll(selectors.self);
1541        for (var i = 0; i < elements.length; i++) {
1542            new Accordion({ element: elements[i], options: readData(elements[i]) });
1543        }
1544
1545        var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
1546        var body = document.querySelector("body");
1547        var observer = new MutationObserver(function(mutations) {
1548            mutations.forEach(function(mutation) {
1549                // needed for IE
1550                var nodesArray = [].slice.call(mutation.addedNodes);
1551                if (nodesArray.length > 0) {
1552                    nodesArray.forEach(function(addedNode) {
1553                        if (addedNode.querySelectorAll) {
1554                            var elementsArray = [].slice.call(addedNode.querySelectorAll(selectors.self));
1555                            elementsArray.forEach(function(element) {
1556                                new Accordion({ element: element, options: readData(element) });
1557                            });
1558                        }
1559                    });
1560                }
1561            });
1562        });
1563
1564        observer.observe(body, {
1565            subtree: true,
1566            childList: true,
1567            characterData: true
1568        });
1569    }
1570
1571    if (document.readyState !== "loading") {
1572        onDocumentReady();
1573    } else {
1574        document.addEventListener("DOMContentLoaded", onDocumentReady);
1575    }
1576
vendor: 7,293 bytes, lines 1577-1623
1577    window.addEventListener("load", window.CQ.CoreComponents.container.utils.scrollToAnchor, false);
1578    window.addEventListener("hashchange", onHashChange, false);
1579
1580}());
1581
1582
1583/*eslint-disable */
1584$(document).ready(function() {
1585    var $countEl = $('[data-feature=countDown]');
1586    var getOffsetHours = new Date().getTimezoneOffset() / 60;
1587    $countEl.each(function(index, el) {
1588        var $el =  $(el);
1589        var eventDate =  $el.attr('data-event-date');
1590        var now = new Date(eventDate);
1591        now.setHours(now.getHours() + getOffsetHours);
1592        countdown(new Date(now), function(ts) {
1593            var time = ts.toString()
1594            .replace(/(day+?)(s\b|\b)/g, 'd')
1595            .replace(/(hour+?)(s\b|\b)/g, 'h')
1596            .replace(/(minute+?)(s\b|\b)/g, 'm')
1597            .replace(/(second+?)(s\b|\b)/g, 's')
1598            .replace('and', ',')
1599            .replace(/ /g, '')
1600            .replace(/,/g, ' : ');
1601            $el.text(time);
1602        });
1603    });
1604});/*eslint-enable */
1605/*
1606 countdown.js v2.6.0 http://countdownjs.org
1607 Copyright (c)2006-2014 Stephen M. McKamey.
1608 Licensed under The MIT License.
1609*/
1610/*eslint-disable */
1611var module,countdown=function(v){function A(a,b){var c=a.getTime();a.setMonth(a.getMonth()+b);return Math.round((a.getTime()-c)/864E5)}function w(a){var b=a.getTime(),c=new Date(b);c.setMonth(a.getMonth()+1);return Math.round((c.getTime()-b)/864E5)}function x(a,b){b=b instanceof Date||null!==b&&isFinite(b)?new Date(+b):new Date;if(!a)return b;var c=+a.value||0;if(c)return b.setTime(b.getTime()+c),b;(c=+a.milliseconds||0)&&b.setMilliseconds(b.getMilliseconds()+c);(c=+a.seconds||0)&&b.setSeconds(b.getSeconds()+
1612c);(c=+a.minutes||0)&&b.setMinutes(b.getMinutes()+c);(c=+a.hours||0)&&b.setHours(b.getHours()+c);(c=+a.weeks||0)&&(c*=7);(c+=+a.days||0)&&b.setDate(b.getDate()+c);(c=+a.months||0)&&b.setMonth(b.getMonth()+c);(c=+a.millennia||0)&&(c*=10);(c+=+a.centuries||0)&&(c*=10);(c+=+a.decades||0)&&(c*=10);(c+=+a.years||0)&&b.setFullYear(b.getFullYear()+c);return b}function D(a,b){return y(a)+(1===a?p[b]:q[b])}function n(){}function k(a,b,c,e,l,d){0<=a[c]&&(b+=a[c],delete a[c]);b/=l;if(1>=b+1)return 0;if(0<=a[e]){a[e]=
1613+(a[e]+b).toFixed(d);switch(e){case "seconds":if(60!==a.seconds||isNaN(a.minutes))break;a.minutes++;a.seconds=0;case "minutes":if(60!==a.minutes||isNaN(a.hours))break;a.hours++;a.minutes=0;case "hours":if(24!==a.hours||isNaN(a.days))break;a.days++;a.hours=0;case "days":if(7!==a.days||isNaN(a.weeks))break;a.weeks++;a.days=0;case "weeks":if(a.weeks!==w(a.refMonth)/7||isNaN(a.months))break;a.months++;a.weeks=0;case "months":if(12!==a.months||isNaN(a.years))break;a.years++;a.months=0;case "years":if(10!==
1614a.years||isNaN(a.decades))break;a.decades++;a.years=0;case "decades":if(10!==a.decades||isNaN(a.centuries))break;a.centuries++;a.decades=0;case "centuries":if(10!==a.centuries||isNaN(a.millennia))break;a.millennia++;a.centuries=0}return 0}return b}function B(a,b,c,e,l,d){var f=new Date;a.start=b=b||f;a.end=c=c||f;a.units=e;a.value=c.getTime()-b.getTime();0>a.value&&(f=c,c=b,b=f);a.refMonth=new Date(b.getFullYear(),b.getMonth(),15,12,0,0);try{a.millennia=0;a.centuries=0;a.decades=0;a.years=c.getFullYear()-
1615b.getFullYear();a.months=c.getMonth()-b.getMonth();a.weeks=0;a.days=c.getDate()-b.getDate();a.hours=c.getHours()-b.getHours();a.minutes=c.getMinutes()-b.getMinutes();a.seconds=c.getSeconds()-b.getSeconds();a.milliseconds=c.getMilliseconds()-b.getMilliseconds();var g;0>a.milliseconds?(g=s(-a.milliseconds/1E3),a.seconds-=g,a.milliseconds+=1E3*g):1E3<=a.milliseconds&&(a.seconds+=m(a.milliseconds/1E3),a.milliseconds%=1E3);0>a.seconds?(g=s(-a.seconds/60),a.minutes-=g,a.seconds+=60*g):60<=a.seconds&&(a.minutes+=
1616m(a.seconds/60),a.seconds%=60);0>a.minutes?(g=s(-a.minutes/60),a.hours-=g,a.minutes+=60*g):60<=a.minutes&&(a.hours+=m(a.minutes/60),a.minutes%=60);0>a.hours?(g=s(-a.hours/24),a.days-=g,a.hours+=24*g):24<=a.hours&&(a.days+=m(a.hours/24),a.hours%=24);for(;0>a.days;)a.months--,a.days+=A(a.refMonth,1);7<=a.days&&(a.weeks+=m(a.days/7),a.days%=7);0>a.months?(g=s(-a.months/12),a.years-=g,a.months+=12*g):12<=a.months&&(a.years+=m(a.months/12),a.months%=12);10<=a.years&&(a.decades+=m(a.years/10),a.years%=
161710,10<=a.decades&&(a.centuries+=m(a.decades/10),a.decades%=10,10<=a.centuries&&(a.millennia+=m(a.centuries/10),a.centuries%=10)));b=0;!(e&1024)||b>=l?(a.centuries+=10*a.millennia,delete a.millennia):a.millennia&&b++;!(e&512)||b>=l?(a.decades+=10*a.centuries,delete a.centuries):a.centuries&&b++;!(e&256)||b>=l?(a.years+=10*a.decades,delete a.decades):a.decades&&b++;!(e&128)||b>=l?(a.months+=12*a.years,delete a.years):a.years&&b++;!(e&64)||b>=l?(a.months&&(a.days+=A(a.refMonth,a.months)),delete a.months,
16187<=a.days&&(a.weeks+=m(a.days/7),a.days%=7)):a.months&&b++;!(e&32)||b>=l?(a.days+=7*a.weeks,delete a.weeks):a.weeks&&b++;!(e&16)||b>=l?(a.hours+=24*a.days,delete a.days):a.days&&b++;!(e&8)||b>=l?(a.minutes+=60*a.hours,delete a.hours):a.hours&&b++;!(e&4)||b>=l?(a.seconds+=60*a.minutes,delete a.minutes):a.minutes&&b++;!(e&2)||b>=l?(a.milliseconds+=1E3*a.seconds,delete a.seconds):a.seconds&&b++;if(!(e&1)||b>=l){var h=k(a,0,"milliseconds","seconds",1E3,d);if(h&&(h=k(a,h,"seconds","minutes",60,d))&&(h=
1619k(a,h,"minutes","hours",60,d))&&(h=k(a,h,"hours","days",24,d))&&(h=k(a,h,"days","weeks",7,d))&&(h=k(a,h,"weeks","months",w(a.refMonth)/7,d))){e=h;var n,p=a.refMonth,q=p.getTime(),r=new Date(q);r.setFullYear(p.getFullYear()+1);n=Math.round((r.getTime()-q)/864E5);if(h=k(a,e,"months","years",n/w(a.refMonth),d))if(h=k(a,h,"years","decades",10,d))if(h=k(a,h,"decades","centuries",10,d))if(h=k(a,h,"centuries","millennia",10,d))throw Error("Fractional unit overflow");}}}finally{delete a.refMonth}return a}
1620function d(a,b,c,e,d){var f;c=+c||222;e=0<e?e:NaN;d=0<d?20>d?Math.round(d):20:0;var k=null;"function"===typeof a?(f=a,a=null):a instanceof Date||(null!==a&&isFinite(a)?a=new Date(+a):("object"===typeof k&&(k=a),a=null));var g=null;"function"===typeof b?(f=b,b=null):b instanceof Date||(null!==b&&isFinite(b)?b=new Date(+b):("object"===typeof b&&(g=b),b=null));k&&(a=x(k,b));g&&(b=x(g,a));if(!a&&!b)return new n;if(!f)return B(new n,a,b,c,e,d);var k=c&1?1E3/30:c&2?1E3:c&4?6E4:c&8?36E5:c&16?864E5:6048E5,
1621h,g=function(){f(B(new n,a,b,c,e,d),h)};g();return h=setInterval(g,k)}var s=Math.ceil,m=Math.floor,p,q,r,t,u,f,y,z;n.prototype.toString=function(a){var b=z(this),c=b.length;if(!c)return a?""+a:u;if(1===c)return b[0];a=r+b.pop();return b.join(t)+a};n.prototype.toHTML=function(a,b){a=a||"span";var c=z(this),e=c.length;if(!e)return(b=b||u)?"\x3c"+a+"\x3e"+b+"\x3c/"+a+"\x3e":b;for(var d=0;d<e;d++)c[d]="\x3c"+a+"\x3e"+c[d]+"\x3c/"+a+"\x3e";if(1===e)return c[0];e=r+c.pop();return c.join(t)+e};n.prototype.addTo=
1622function(a){return x(this,a)};z=function(a){var b=[],c=a.millennia;c&&b.push(f(c,10));(c=a.centuries)&&b.push(f(c,9));(c=a.decades)&&b.push(f(c,8));(c=a.years)&&b.push(f(c,7));(c=a.months)&&b.push(f(c,6));(c=a.weeks)&&b.push(f(c,5));(c=a.days)&&b.push(f(c,4));(c=a.hours)&&b.push(f(c,3));(c=a.minutes)&&b.push(f(c,2));(c=a.seconds)&&b.push(f(c,1));(c=a.milliseconds)&&b.push(f(c,0));return b};d.MILLISECONDS=1;d.SECONDS=2;d.MINUTES=4;d.HOURS=8;d.DAYS=16;d.WEEKS=32;d.MONTHS=64;d.YEARS=128;d.DECADES=256;
1623d.CENTURIES=512;d.MILLENNIA=1024;d.DEFAULTS=222;d.ALL=2047;
1623var E=d.setFormat=function(a){if(a){if("singular"in a||"plural"in a){var b=a.singular||[];b.split&&(b=b.split("|"));var c=a.plural||[];c.split&&(c=c.split("|"));for(var d=0;10>=d;d++)p[d]=b[d]||p[d],q[d]=c[d]||q[d]}"string"===typeof a.last&&(r=a.last);"string"===typeof a.delim&&(t=a.delim);"string"===typeof a.empty&&(u=a.empty);"function"===typeof a.formatNumber&&(y=a.formatNumber);"function"===typeof a.formatter&&(f=a.formatter)}},C=d.resetFormat=
1624function(){p=" millisecond; second; minute; hour; day; week; month; year; decade; century; millennium".split(";");q=" milliseconds; seconds; minutes; hours; days; weeks; months; years; decades; centuries; millennia".split(";");r=" and ";t=", ";u="";y=function(a){return a};f=D};d.setLabels=function(a,b,c,d,f,k,m){E({singular:a,plural:b,last:c,delim:d,empty:f,formatNumber:k,formatter:m})};d.resetLabels=C;C();v&&v.exports?v.exports=d:"function"===typeof window.define&&"undefined"!==typeof window.define.amd&&
1625window.define("countdown",[],function(){return d});return d}(module);/*eslint-enable */
1626//initiallize carousel plugin for ads
1627$(document).ready(function() {
1628  //Handle ads grid
1629  const AdsGrid = (function() {
1630    var publicAPI,
1631      ads,
1632      clubId,
1633      $grid,
1634      baseUrl = "https://www.24hourfitness.com",
1635      proxyFile = "ba-simple-proxy.php",
1636      adsImgUrl = "https://adretriever.clubcom.com/Image.aspx?c=",
1637      adsImgDefaults = "&w=315&h415=&t=0";
1638
1639    //Make ajax call to fetch clubcom advertisement array
1640    //taken the id defined under window.clubcom.id
1641    function loadAds() {
1642      $.ajax({
1643        url: baseUrl + "/utility/" + proxyFile,
1644        cache: false,
1645        data: {
1646          url:
1647            "https://api.clubcom.com/WSGroupX.svc/GetVenueLocalAds?customerkey=" +
1648            clubId
1649        },
1650        dataType: "json",
1651        success: successCallback,
1652        error: errorHandler
1653      });
1654    }
1655
1656    //function to be executed afetr a success full call to clubcom api
1657    function successCallback(data) {
1658      if (
1659        typeof data === "object" &&
1660        typeof data.contents === "string" &&
1661        data.contents !== ""
1662      ) {
1663        try {
1664          var dataContents = data.contents;
1665          //Object Clean to use JSON.parse
1666          var cleanContents = dataContents.replace(/\\"/, /\\\\/);
1667          ads = JSON.parse(cleanContents);
1668          if (ads.length) {
1669            renderAds();
1670          } else {
1671            errorHandler();
1672          }
1673        } catch (error) {
1674          errorHandler();
1675        }
1676      } else {
1677        errorHandler();
1678      }
1679    }
1680
1681    //append the proper html element to the parent container for each ad we receive from clubcom
1682    function renderAds() {
1683      var i, link;
1684      $grid = $("#clubcom-ads-container");
1685
1686      for (i = 0; i < ads.length; i += 1) {
1687        if (
1688          typeof ads[i].AdvertiserWebAddress === "string" &&
1689          ads[i].AdvertiserWebAddress.trim() !== ""
1690        ) {
1691          link =
1692            '<div class="clubcom-info-link"><a href="//' +
1693            ads[i].AdvertiserWebAddress +
1694            '" target="_blank">' +
1695            ads[i].AdvertiserWebAddress +
1696            "</a></div>";
1697        } else {
1698          link = "";
1699        }
1700        $grid.append(
1701          '<div class="clubcom-item">' +
1702            '<div class="clubcom-img-container" style="background-image:url(' +
1703            adsImgUrl.replace("http:", "") +
1704            ads[i].ContentID +
1705            adsImgDefaults +
1706            ')">' +
1707            "</div>" +
1708            //'<img  class="clubcom-img" src=' + adsImgUrl.replace('http:', '') + ads[i].ContentID + adsImgDefaults + '>' +
1709            '<div class="clubcom-info"><span class="clubcom-info-name">' +
1710            ads[i].AdvertiserName +
1711            "</span>" +
1712            link +
1713            '<div class="clubcom-info-phone mobile">' +
1714            '<a href="tel:' +
1715            ads[i].PhoneNumber +
1716            '">' +
1717            ads[i].PhoneNumber +
1718            "</a>" +
1719            "</div>" +
1720            "</div>" +
1721            "</div>"
1722        );
1723      }
1724
1725      //initiallize carousel plugin for ads
1726      $grid.owlCarousel({
1727        nav: true,
1728        autoHeight: true,
1729        responsive: {
1730          0: {
1731            items: 1
1732          },
1733          400: {
1734            items: 2
1735          },
1736          900: {
1737            items: 3
1738          },
1739          1600: {
1740            items: 4
1741          },
1742          2000: {
1743            items: 5
1744          }
1745        }
1746      });
1747    }
1748
1749    //initiallize carousel plugin for what's new
1750    $(".spotlight-container").owlCarousel({
1751      responsive: {
1752        0: {
1753          items: 1
1754        },
1755        800: {
1756          items: 2
1757        }
1758      }
1759    });
1760
1761    //if there was any kind of error, or we have an unsuccessfull response from clubcom
1762    //proceed to remove all the html elements related to clubcom ads
1763    function errorHandler() {
1764      $("#club-ads-tab, #clubcom-container").remove();
1765    }
1766
1767    publicAPI = {
1768      init() {
1769        if (typeof window.clubInfo === "object") {
1770          //use global value of clubId
1771          clubId = window.clubInfo.clubId;
1772          loadAds();
1773        }
1774      }
1775    };
1776
1777    return publicAPI;
1778  })();
1779
1780  //intitialize clubcom ads grid
1781  AdsGrid.init();
1782});
1783
1784(function() {
1785
1786    var $el = $('.continue-component');
1787    if ($el.length !== 1) {
1788        return;
1789    }
1790
1791    function formatDate(date) {
1792        var d = new Date(date),
1793            month = '' + (d.getMonth() + 1),
1794            day = '' + d.getDate(),
1795            year = d.getFullYear();
1796
1797        if (month.length < 2)
1798            month = '0' + month;
1799        if (day.length < 2)
1800            day = '0' + day;
1801
1802        return [year, month, day].join('-');
1803    }
1804
1805    $('document').ready(function() {        
1806        var $form = $el.find('#form-24-continue');
1807        var $sucess = $el.find('#success-view');
1808        var $error = $el.find('#error-view');
1809		var $mainCol = $el.find('.main-column');
1810		var $loading = $el.find('#loader-24');
1811
1812        const LOGGED_IN_USERNAME = "loggedInUserName",
1813            IS_ZUORA_MEMBER = "isZuoraMember",
1814            SECURITY_TOKEN = "securityToken";
1815
1816
1817        function postContinue(member, dob) {
1818
1819            var url = globalData.apiEndpoint + '/account/members/manage';
1820
1821            $.ajax({
1822                type: 'POST',
1823                url: url,
1824                contentType: 'application/json',
1825                dataType: 'json',
1826                data: JSON.str
1826ingify({
1827                    action: 'TDR',
1828                    dateOfBirth: dob,
1829                    memberOrCheckin: member
1830                }),
1831                success: function() {
1832                    $sucess.show();
1833					$mainCol.hide();
1834					loading();
1835                },
1836                error: function() {
1837					$error.show();
1838					loading();
1839                }
1840            });
1841        }
1842
1843
1844        var secTokenCookie = $.cookie(SECURITY_TOKEN);
1845        var isZuoraMmbrCookie = $.cookie(IS_ZUORA_MEMBER);
1846        var logedInUsrCookie = $.cookie(LOGGED_IN_USERNAME);
1847
1848        $el.find('#submit-btn').click(function(e) {
1849            e.preventDefault();
1850            $error.hide();
1851
1852            $('#checkInNumber, #dob').on('focus', function() {
1853                $(this).siblings().hide();
1854            });
1855
1856            var arry = [];
1857
1858            $form.find('input').each(function(index, element) {
1859                if ($(element).val() === '') {
1860                    $(element).siblings().show();
1861                } 
1862            });
1863                                         
1864            let membershipNumber = $el.find("#checkInNumber").val();
1865            var dateOfBirth = new Date($el.find("#dob").val()); 
1866            dateOfBirth = formatDate(dateOfBirth);
1867
1868            postContinue(membershipNumber, dateOfBirth);
1869            loading();
1870
1871		});
1872		
1873		function loading(){
1874			$loading.toggle();
1875			$form.toggle();
1876		}
1877
1878        if (secTokenCookie != null && isZuoraMmbrCookie != null && logedInUsrCookie != null && ($el.length > 0)) {
1879            loading();
1880            $el.find(".processing").toggle().siblings().toggle();
1881
1882            $.ajax({
1883                    headers: {
1884                        "securityToken": secTokenCookie
1885                    },
1886                    url: globalData.apiEndpoint + '/account/users/' + logedInUsrCookie,
1887                    type: 'GET',
1888                    data: '',
1889                    datatype: 'json'
1890                })
1891                .done(function(data) {
1892                    var membershipNumber = data.memberships[0].number;
1893                    postContinue(membershipNumber, data.birthDate);
1894                })
1895                .fail(function(error) {
1896                    console.log(error);
1897                });
1898        }
1899    });
1900})();
1901/* eslint-disable */
1902$().ready(function() {
1903	var $corporateCodeForm = $("#corporateLandingPageForm");
1904	var $corporateCode = $("#corporateCode");
1905    var $submitBtn = $corporateCodeForm.find(".link-button-24");
1906    
1907    $corporateCodeForm.validate({
1908    	rules: {
1909    		corporateCode: {
1910    			required: true,
1911    			maxlength: 16
1912    		}
1913    	},
1914    	messages: {
1915    		corporateCode: {
1916    			required: "Enter a Corporate Code",
1917    			maxlength: "Corporate code must be 16 characters. Please try again."
1918    		}
1919    	}
1920    });	
1921    
1922    $corporateCode.on('blur keyup', function() {
1923        if ($corporateCodeForm.valid()) {
1924        	$submitBtn.prop('disabled', false);  
1925        } else {
1926        	$submitBtn.prop('disabled', 'disabled');
1927        }
1928    });
1929	 
1930	 
1931	$corporateCodeForm.on("submit", function(event) {
1932		event.preventDefault();
1933		var corporateCode = $.trim($corporateCode.val());
1934		
1935		var ordersPath = '/sales/orders';
1936		var customersPath = '/sales/orders/customers';
1937		var promoPath = '/sales/orders/promo';
1938		var productsPath = '/sales/orders/products';
1939		
1940		//Ajax call
1941		$('#errorMessage').hide();
1942		$('#wait').show();
1943		corporateCode = corporateCode.toUpperCase();
1944		console.log("corporateCode: "+corporateCode);
1945		if(corporateCode.indexOf("CORP") == -1) {
1946			corporateCode = corporateCode.concat("CORP");
1947			console.log("corporateCode plus CORP: "+corporateCode);
1948		}
1949		$.ajax({
1950			headers: { 
1951		        "Content-Type": "application/json"
1952		    },
1953		    url: globalData.apiEndpoint+'/sales/v3/corporate/'+corporateCode+'/validate',
1954		    type: 'GET',
1955		    data: "",
1956		    datatype: 'json'
1957		})
1958    	.done(function(data) {
1959    		var corporateId = data.corporateId;
1960    		$.ajax({
1961    			headers: { 
1962    		        "Content-Type": "application/json"
1963    		    },
1964    		    url: globalData.apiEndpoint+'/sales/v3/corporate-exclusion/'+corporateId+'/validate',
1965    		    type: 'GET',
1966    		    data: "",
1967    		    datatype: 'json'
1968    		})
1969        	.done(function(data) {
1970        		var corporateId = data.corporateId;
1971    			$('#wait').hide();
1972        		window.location.href = "/health_clubs/find-a-gym/?type=sales&flow=POS&corporateId="+corporateCode
1973        	})
1974        	.fail(function(errorMessage) {
1975        		$('#wait').hide();
1976        		$('#errorMessage').html("<p>Please visit the club to redeem this corporate ID.</p>")
1977        		$('#errorMessage').show();
1978        		
1979        	});
1980    	})
1981    	.fail(function(errorMessage) {
1982    		$('#wait').hide();
1983    		$('#errorMessage').html("<p>Corporate ID does not exist.</p>")
1984    		$('#errorMessage').show();
1985    	});
1986    });
1987});
1988
1989/* eslint-disable */
1990$().ready(function() {
1991	var $costcoCodeForm = $("#costcoLandingPageForm");
1992	var $costcoCode = $("#costcoCode");
1993
1994	var section = location.href.split('/').pop();
1995	var genericErrorMessage = 'The entered Promo Code is not valid. Please try again. If you continue to experience an issue, please visit your club and they will assist you.'	
1996
1997	$costcoCodeForm.on("submit", function(event) {
1998		event.preventDefault();
1999		var costcoCode = $.trim($costcoCode.val());		
2000
2001		if (section !== 'costco') {
2002			$('#errorMessage').html(genericErrorMessage)
2003		}
2004		
2005		//Ajax call
2006		$('#errorMessage').hide();
2007		$('#wait').show();
2008		$.ajax({
2009			headers: { 
2010				"Content-Type": "application/json"
2011			},
2012			url: globalData.apiEndpoint + "/sales/v3/promo/"+encodeURIComponent(costcoCode)+"/validate",
2013			type: 'GET'			
2014		}).done(function(data) {
2015				var errorObject = data.error;
2016				if(errorObject == null) {
2017					$('#wait').hide()
2018					window.location.href = "/health_clubs/find-a-gym/?type=sales&flow=POS&certificateId=" + encodeURIComponent(costcoCode)
2019				} else {
2020					$('#wait').hide();
2021					$('#errorMessage').show();
2022				}
2023			})
2024			.fail(function(errorMessage) {
2025				$('#wait').hide();
2026				$('#errorMessage').show();
2027			});
2028		});
2029});
2030
2031(function(){
2032
2033    if($(".card-content .class-schedule-search").length > 0 ){ 
2034        $(".class-search-button").on("click",function(t){
2035            t.preventDefault()
2036        }),
2037        $(".class-schedule-search .class-search-button").on("click",function(){
2038            $(".class-schedule-search .form-search").hide(), 
2039            $(".class-schedule-search .class-search-button").show(), 
2040            $(this).siblings(".form-search").fadeIn(), 
2041            $(this).closest(".class-search-button").hide()
2042        }) 
2043    }    
2044})();
2045
2046window.onload = (event) => {
2047
2048    $("#leaderships .link-button-24.text-cta-24").click(function(e) {
2049        if($(this).hasClass("less")){
2050            $(this).removeClass("less");
2051            $(this).find('a').text('READ MORE');
2052        } else {
2053            $(this).addClass("less");
2054            $(this).find('a').text('READ LESS');
2055        }
2056        
2057        e.preventDefault();
2058        $(this).closest(".card-content").find(".text-24 .toggle-text").fadeToggle();
2059    });
2060};
2061/* eslint-disable */
2062$().ready(function() {
2063    
2064    const LOGGED_IN_USERNAME = "loggedInUserName",
2065        IS_ZUORA_MEMBER    =  "isZuoraMember",
2066        PATH_NAME = "pathname",
2067        SECURITY_TOKEN = "securityToken",
2068        MEMBERSHIP_NUMBER = "membershipNumber",
2069        TRUE = "true",
2070        FALSE = "false",
2071        CLICK = "click";  
2072
2073
2074	var $loginForm = $("#loginLandingPageForm");
2075    var $userText = $("#user");
2076    var $userLabel = $('#user-label');
2077    var $passwordText = $("#password");
2078    var $passwordLabel = $('#password-label');
2079    var $loginBtn = $("#loginButton");    
2080    var $flowParam = $("#flowParam");
2081    var $redirectPath = $("#redirect");
2082    var birthdayErrors = $("#birthday-errors");
2083    var $loginComponent = $("#login-component");
2084    var secTokenCookie = $.cookie(SECURITY_TOKEN);
2085    var isZuoraMmbrCookie = $.cookie(IS_ZUORA_MEMBER);
2086    var mmbNumberCookie = $.cookie(MEMBERSHIP_NUMBER);
2087    var logedInUsrCookie = $.cookie(LOGGED_IN_USERNAME);
2088    
2089    if($loginComponent.length < 1){
2090        return;
2091    }
2092
2093    $loginComponent.find('.toggle-password').on('click', function() {
2094        $(this).toggleClass("fa-eye fa-eye-slash");
2095        var input = $loginComponent.find("#password");
2096        if (input.attr("type") === "password") {
2097          input.attr("type", "text");
2098        } else {
2099          input.attr("type", "password");
2100        }
2101
2102    });
2103    
2104    function redirectTo(membershipNumber){
2105        if(membershipNumber == "" ){
2106            return;
2107        }
2108        let regex = new RegExp(/membership/g);
2109
2110        if( regex.test(window.location.href) ||  $.trim($flowParam.val()) == "" ){
2111            window.location.href = $.trim($redirectPath.val());
2112        }else{
2113            window.location.href = $.trim($redirectPath.val()) + "&flow="+$.trim($flowParam.val()) + "&memberId="+membershipNumber;
2114        }        
2115    }
2116        
2117    if(secTokenCookie != null && isZuoraMmbrCookie != null && $loginComponent.length > 0) {
2118        if(mmbNumberCookie != null ){
2119            redirectTo(mmbNumberCookie);            
2120        }else if(logedInUsrCookie != null){
2121            $.ajax({
2122                    headers: { 
2123                        "securityToken": secTokenCookie
2124                    },
2125                    url: globalData.apiEndpoint+'/account/users/'+ logedInUsrCookie,
2126                    type: 'GET',
2127                    data: '',
2128                    datatype: 'json'
2129                })
2130                .done(function(data) {
2131                    var membershipNumber = data.memberships[0].number;                    
2132                    redirectTo(membershipNumber);
2133                })
2134                .fail(function(error) {
2135                    console.log(error);
2136                });
2137            }
2138    }
2139
2140
2141     /* code and birthday changes */
2142     var $codeText = $("#code");
2143     var $codeLabel = $("#code-label");
2144     var $birthdayBtn = $("#birthdayButton");
2145     var changeForm = $('#change-form'),
2146     backForm = $('#back-form'),
2147     birthdayForm = $('#birthday-form');
2148    
2149     $codeText.on('focus', function(){
2150		$codeLabel.addClass('focus-label');
2151	});
2152
2153	$codeText.on('focusout', function(){
2154		if($codeText.val() !== "") {
2155		} else {
2156			$codeLabel.removeClass('focus-label');
2157		}
2158		
2159	});
2160	
2161	$codeText.on('blur keyup', function() {
2162        if (birthdayForm.valid()) {
2163        	$birthdayBtn.prop('disabled', false);  
2164        } else {
2165        	$birthdayBtn.prop('disabled', 'disabled');
2166        }
2167    });
2168	
2169	changeForm.on(CLICK, function(e){
2170	    e.preventDefault();
2171	    birthdayForm.hide();
2172	    $('#birthdayErrorMessage').hide();
2173        $('#birthdayNetworkMessage').hide();
2174        $('#birthdayMonthError').hide();
2175        $('#birthdayDayError').hide();
2176        $('#birthdayYearError').hide();
2177        $('#birthdayAgeError').hide();
2178	    $loginForm.fadeToggle();
2179	});
2180	
2181	backForm.on(CLICK, function(e){
2182	    e.preventDefault();
2183	    $loginForm.hide();
2184	    birthdayForm.fadeToggle();
2185	});
2186	
2187	birthdayForm.validate({
2188    	rules: {
2189    		code: {
2190    			required: true
2191    		},
2192    		birthday: {
2193    			required: true
2194    		}
2195    	},
2196    	messages: {
2197    		code: {
2198    			required: "Enter a Code"
2199    		},
2200    		birthday: {
2201    			required: "Enter a birthday"
2202    		}
2203    	}
2204    });
2205	
2206	
2207	birthdayForm.on("submit", function(event) {
2208		event.preventDefault();
2209        var month = $('#month-drop select').val(); 
2210        var day = $('#day-drop select').val();
2211        var year = $('#year-drop select').val();
2212
2213        var setDate = new Date(year, month - 1, day); 
2214        var currentDate = new Date(); 
2215
2216        var age = Math.floor((currentDate-setDate) / (365.25 * 24 * 60 * 60 * 1000));
2217
2218		var codeText = $.trim($codeText.val());
2219		if(day<10) {
2220			day='0'+day;
2221	    } 
2222	    if(month<10) {
2223	        month='0'+month;
2224	    }
2225		var birthdayText = $.trim(year + '-' + month + '-' + day);
2226		
2227
2228        birthdayErrors.find($('.error')).hide();
2229
2230        if(month=='Month'){
2231            birthdayErrors.find($('#birthdayMonthError')).show();
2232        }else if(day=='Day'){
2233            birthdayErrors.find($('#birthdayDayError')).show();
2234        }else if(year=='Year'){
2235            birthdayErrors.find($('#birthdayYearError')).show();
2236        } else {
2237            if(age >= 12) {
2238                birthdayErrors.find($('.error')).hide();
2239
2240                $('#birthdayErrorMessage').hide();
2241                $('#birthdayNetworkMessage').hide();
2242                $('#wait').show();
2243                $.ajax({
2244                    headers: { 
2245                        "Content-Type": "application/json"
2246                    },
2247                    url: globalData.apiEndpoint+'/account/users/login',
2248                    type: 'POST',
2249                    data: '{"memberIdentifier":"'+ codeText+'","birthDate": "'+birthdayText+'"}',
2250                    datatype: 'json'
2251                })
2252                .done(function(data, textStatus, jqXHR) {
2253                    //Preparing 20 minutes expiration for cookie
2254                    var date = new Date();
2255                    var minutes = 20;
2256                    date.setTime(date.getTime() + (minutes * 60 * 1000));
2257                    //Getting username from data and security token and is zoura member from header
2258                    
2259                    var username = data.username;
2260                    var securityToken = jqXHR.getResponseHeader('security-token');
2261                    var isZouraMember = jqXHR.getResponseHeader(IS_ZUORA_MEMBER);
2262                    var membershipNumber = "";
2263                    
2264                    if(username == "") {
2265                        
2266                        $.ajax({
2267                            headers: { 
2268                                "Content-Type": "application/json",
2269                                "securityToken": securityToken
2270                            },
2271                            url: globalData.apiEndpoint+'/account/members/validate',
2272                            type: 'POST',
2273                            data: '{"memberIdentifier":"'+ codeText+'","birthday": "'+birthdayText+'"}',
2274                            datatype: 'json'
2275                        })
2276                        .done(function(data, textStatus, jqXHR) {
2277                            membershipNumber = data.memberships[data.memberships.length - 1].number;
2278                            
2279                            //Set cookies
2280                            $.cookie(SECURITY_TOKEN, securityToken, { expires: date , path: '/' });
2281                            if(isZouraMember != null && isZouraMember == TRUE) {
2282                                $.cookie(IS_ZUORA_MEMBER, TRUE, { expires: date, path: '/' });
2283                            } else {
2284                                $.cookie(IS_ZUORA_MEMBER, FALSE, { expires: date, path: '/' });
2285                            }
2286                            $.cookie(MEMBERSHIP_NUMBER, membershipNumber, { expires: date, path: '/' }); 
2287                            $('#wait').hide();
2288                            location.reload();
2289                        }).fail(function(error) {
2290                            $('#wait').hide();
2291                            $('#birthdayNetworkMessage').show();
2292                        });
2293                    } else {
2294                  
2295                        $.ajax({
2296                            headers: { 
2297                                "securityToken": securityToken
2298                            },
2299                            url: globalData.apiEndpoint+'/account/users/'+username,
2300                            type: 'GET',
2301                            data: '',
2302                            datatype: 'json'
2303                        })
2304                        .done(function(data, textStatus, jqXHR) {
2305                            membershipNumber = data.memberships[data.memberships.length - 1].number;
2306                            
2307                            //Set cookies
2308                            $.cookie(SECURITY_TOKEN, securityToken, { expires: date , path: '/' });
2309                            if(isZouraMember != null && isZouraMember == TRUE) {
2310                                $.cookie(IS_ZUORA_MEMBER, TRUE, { expires: date, path: '/' });
2311                            } else {
2312                                $.cookie(IS_ZUORA_MEMBER, FALSE, { expires: date, path: '/' });
2313                            }
2314                            $.cookie(MEMBERSHIP_NUMBER, membershipNumber, { expires: date, path: '/' }); 
2315                            $('#wait').hide();
2316                            location.reload();
2317                        }).fail(function(error) {
2318                            $('#wait').hide();
2319                            $('#birthdayNetworkMessage').show();
2320                        });
2321                    }
2322                })
2323                .fail(function(error) {
2324                    $('#wait').hide();
2325                    birthdayErrors.find($('.error')).hide();
2326                    $('#birthdayErrorMessage').show();
2327                });
2328                
2329            } else {
2330                birthdayErrors.find($('.error')).hide();
2331                birthdayErrors.find($('#birthdayAgeError')).show();
2332            }
2333        }
2334
2335		//Ajax call
2336
2337		
2338    });
2339
2340	/* code and birthday changes */
2341
2342    
2343    $("#createNewAccount").on(CLICK, function() {
2344    	$.cookie("my_account_redirect", $(location).attr(PATH_NAME), { path: '/' });
2345    });
2346
2347	$userText.on('focus', function(){
2348		$userLabel.addClass('focus-label');
2349	});
2350
2351	$userText.on('focusout', function(){
2352		if($userText.val()!="") {
2353		} else {
2354			$userLabel.removeClass('focus-label');
2355		}
2356		
2357	});
2358
2359	$passwordText.on('focus', function(){
2360		$passwordLabel.addClass('focus-label');
2361	});
2362
2363	$passwordText.on('focusout', function(){
2364		if($passwordText.val()!="") {
2365		} else {
2366			$passwordLabel.removeClass('focus-label');
2367		}
2368		
2369	});
2370	
2371	//Fill user name if remember me option is checked
2372    if(logedInUsrCookie !== null) {
2373    	$userLabel.addClass('focus-label');
2374    	$userText.val(logedInUsrCookie);
2375    } else {
2376    	$userLabel.removeClass('focus-label');
2377    }
2378	
2379	$loginForm.validate({
2380    	rules: {
2381    		user: {
2382    			required: true
2383    		},
2384    		password: {
2385    			required: true
2386    		}
2387    	},
2388    	messages: {
2389    		user: {
2390    			required: "Enter a Username"
2391    		},
2392    		password: {
2393    			required: "Enter a Password"
2394    		}
2395    	}
2396    });
2397	
2398	$userText.on('blur keyup', function() {
2399        if ($loginForm.valid()) {
2400        	$loginBtn.prop('disabled', false);  
2401        } else {
2402        	$loginBtn.prop('disabled', 'disabled');
2403        }
2404    });
2405	
2406	$passwordText.on('blur keyup', function() {
2407        if ($loginForm.valid()) {
2408        	$loginBtn.prop('disabled', false);  
2409        } else {
2410        	$loginBtn.prop('disabled', 'disabled');
2411        }
2412    });
2413	
2414	$loginForm.on("submit", function(event) {
2415		event.preventDefault();
2416		var userText = $.trim($userText.val());
2417        var passwordText = $.trim($passwordText.val());
2418        		
2419		//Ajax call
2420		$('#errorMessageLogin').hide();
2421		$('#wait').show();
2422		$.ajax({
2423			headers: { 
2424		        "Content-Type": "application/json"
2425		    },
2426		    url: globalData.apiEndpoint+'/account/users/login',
2427		    type: 'POST',
2428		    data: '{"username":"'+ userText+'","password": "'+passwordText+'"}',
2429		    datatype: 'json'
2430		})
2431    	.done(function(data, textStatus, jqXHR) {            
2432    		//Preparing 20 minutes expiration for cookie
2433    		var date = new Date();
2434    		var minutes = 20;
2435    		date.setTime(date.getTime() + (minutes * 60 * 1000));
2436    		//Getting username from data and security token and is zoura member from header
2437    		var username = data.username;
2438    		var securityToken = jqXHR.getResponseHeader('security-token');
2439    		var isZouraMember = jqXHR.getResponseHeader(IS_ZUORA_MEMBER);
2440    		//Set cookies
2441    		$.cookie(SECURITY_TOKEN, securityToken, { expires: date , path: '/' });
2442    		if(isZouraMember != null && isZouraMember == TRUE) {
2443    			$.cookie(IS_ZUORA_MEMBER, TRUE, { expires: date, path: '/' });
2444    		} else {
2445    			$.cookie(IS_ZUORA_MEMBER, FALSE, { expires: date, path: '/' });
2446    		}
2447    		if($("input[type=checkbox][name=rememberme]:checked").val() != null && $("input[type=checkbox][name=rememberme]:checked").val() == TRUE) {
2448    			$.cookie(LOGGED_IN_USERNAME, username, { expires: 30, path: '/' });  //Cookie for 30 days if remember me is checked
2449    		} else {
2450    			$.cookie(LOGGED_IN_USERNAME, username, { expires: date, path: '/' }); 
2451    		}
2452    		        
2453
2454            $.ajax({
2455                headers: { 
2456                    "securityToken": $.cookie(SECURITY_TOKEN)
2457                },
2458                url: globalData.apiEndpoint+'/account/users/'+ $.cookie(LOGGED_IN_USERNAME),
2459                type: 'GET',
2460                data: '',
2461                datatype: 'json'
2462            })
2463            .done(function(data) {                
2464                var membershipNumber = data.memberships[0].number;
2465                //Preparing 20 minutes expiration for cookie
2466                var date = new Date();
2467                var minutes = 20;
2468                date.setTime(date.getTime() + (minutes * 60 * 1000));
2469                //Getting username from data and security token and is zoura member from header
2470                $.cookie(MEMBERSHIP_NUMBER, membershipNumber, { expires: date, path: '/' }); 
2471                redirectTo(membershipNumber);
2472            })
2473            .fail(function(error) {
2474                console.log(error);
2475            });
2476    		
2477            $('#wait').hide();
2478            
2479    	})
2480    	.fail(function(error) {
2481    		$('#wait').hide();
2482    		$('#errorMessageLogin').show();
2483    	});
2484    });
2485
2486    var minOffset = 12, maxOffset = 110; // Change to whatever you want 
2487    var thisYear = (new Date()).getFullYear(); 
2488    var select = $('<select  data-placeholder="Year"><option value="">Year</option>');
2489 
2490     for (var i = minOffset; i <= maxOffset; i++) {
2491        var year = thisYear - i; 
2492        $('<option>', {value: year, text: year}).appendTo(select); 
2493     } 
2494
2495     select.appendTo('#year-drop');
2496
2497
2498     $userText.on('focus', function(){
2499        $userLabel.addClass('focus-label');
2500    });
2501
2502    $userText.on('focusout', function(){        
2503        if($userText.val()!="") {
2504            $userLabel.addClass('focus-label');
2505        } else {
2506            $userLabel.removeClass('focus-label');
2507        }        
2508    });
2509
2510    $passwordText.on('focus', function(){
2511        $passwordLabel.addClass('focus-label');
2512    });
2513
2514    $passwordText.on('focusout', function(){
2515        
2516        if($passwordText.val()!="") {
2517            $passwordLabel.addClass('focus-label');
2518        } else {
2519            $passwordLabel.removeClass('focus-label');
2520        }
2521        
2522    });
2523
2524    var changeForm = $('#change-form'), 
2525        birthdayForm = $('#birthday-form'),
2526        loginForm = $('#login-form');
2527
2528    changeForm.on(CLICK, function(e){
2529        e.preventDefault();
2530        birthdayForm.hide();
2531        loginForm.fadeToggle();
2532    });
2533
2534    $(function() {
2535        $.widget("custom.combobox", {
2536            _create: function() {
2537                this.wrapper = $("<span>")
2538                    .addClass("custom-combobox")
2539                    .insertAfter(this.element);
2540                this.element.hide();
2541                this._createAutocomplete();
2542                this._createShowAllButton();
2543            },
2544
2545            _createAutocomplete: function() {
2546                var selected = this.element.children(":selected"),
2547                    value = selected.val() ? selected.text() : "";
2548                var ps = this.element.data('placeholder');
2549                this.input = $("<input>")
2550                    .appendTo(this.wrapper)
2551                    .val(value)
2552                    .attr("placeholder", ps)
2553                    .attr("title", "")
2554                    .addClass("custom-combobox-input")
2555                    .autocomplete({
2556                        delay: 0,
2557                        minLength: 0,
2558                        source: $.proxy(this, "_source")
2559                    })
2560                    .tooltip({
2561                        classes: {
2562                            "ui-tooltip": "ui-state-highlight"
2563                        }
2564                    });
2565
2566                this._on(this.input, {
2567                    autocompleteselect: function(event, ui) {
2568                        ui.item.option.selected = true;
2569                        this._trigger("select", event, {
2570                            item: ui.item.option
2571                        });
2572                    },
2573
2574                    autocompletechange: "_removeIfInvalid"
2575                });
2576            },
2577
2578            _createShowAllButton: function() {
2579                var input = this.input,
2580                    wasOpen = false;
2581
2582                $("<a>")
2583                    .attr("tabIndex", -1)
2584                    .attr("title", "Show All Items")
2585                    .appendTo(this.wrapper)
2586                    .button({
2587                        icons: {
2588                            primary: "ui-icon-triangle-1-s"
2589                        },
2590                        text: false
2591                    })
2592                    .removeClass("ui-corner-all")
2593                    .addClass("custom-combobox-toggle ui-corner-right")
2594                    .on("mousedown", function() {
2595                        wasOpen = input.autocomplete("widget").is(":visible");
2596                    })
2597                    .on(CLICK, function() {
2598                        input.trigger("focus");
2599
2600                        // Close if already visible 
2601                        if (wasOpen) {
2602                            return;
2603                        }
2604
2605                        // Pass empty string as value to search for, displaying all results 
2606                        input.autocomplete("search", "");
2607                    });
2608            },
2609
2610            _source: function(request, response) {
2611                var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
2612                response(this.element.children("option").map(function() {
2613                    var text = $(this).text();
2614                    if (this.value && (!request.term || matcher.test(text)))
2615                        return {
2616                            label: text,
2617                            value: text,
2618                            option: this
2619                        };
2620                }));
2621            },
2622
2623            _removeIfInvalid: function(event, ui) {
2624
2625                // Selected an item, nothing to do 
2626                if (ui.item) {
2627                    return;
2628                }
2629
2630                // Search for a match (case-insensitive) 
2631                var value = this.input.val(),
2632                    valueLowerCase = value.toLowerCase(),
2633                    valid = false;
2634                this.element.children("option").each(function() {
2635                    if ($(this).text().toLowerCase() === valueLowerCase) {
2636                        this.selected = valid = true;
2637                        return false;
2638                    }
2639                });
2640
2641                // Found a match, nothing to do 
2642                if (valid) {
2643                    return;
2644                }
2645
2646                // Remove invalid value 
2647                this.input
2648                    .val("")
2649                    .attr("title", value + " didn't match any item")
2650                    .tooltip("open");
2651                this.element.val("");
2652                this._delay(function() {
2653                    this.input.tooltip("close").attr("title", "");
2654                }, 2500);
2655                this.input.autocomplete("instance").term = "";
2656            },
2657
2658            _destroy: function() {
2659                this.wrapper.remove();
2660                this.element.show();
2661            }
2662        });
2663
2664        $("#month-drop select").combobox();
2665        $("#day-drop select").combobox();
2666        $("#year-drop select").combobox();
2667    });
2668	
2669	
2670});
2671
2672(function () {
2673
2674    const CARD_24 = '.card-24'
2675
2676    $('.special-offers .toggleClass').on('click', function(){
2677        $(this).parents(CARD_24).find('.card-text-container').hide().parents(CARD_24).find('.legal-details').fadeToggle()
2678    });
2679
2680    $('.special-offers .closeToggle').on('click', function(){
2681        $(this).parents(CARD_24).find('.card-text-container').fadeToggle().parents(CARD_24).find('.legal-details').hide()
2682    });
2683
2684})();
2685(function () {
2686
2687  $(document).ready(function() {
2688    if($("#rating-component").length > 0){
2689      $('#rating-component').find('.owl-carousel').owlCarousel({
2690        loop:true,
2691        margin:10,
2692        nav: true,
2693        autoplay:true,
2694        items:1,
2695        autoplayTimeout:7500,
2696        onInitialized: function() {
2697          $('.owl-carousel').find('.owl-item').attr('aria-selected', 'false'); 
2698          $('.owl-carousel').find('.owl-item.active').attr('aria-selected', 'true'); 
2699          $('.owl-carousel').find('.owl-prev').attr('role', 'button').attr('aria-label', 'Previous'); 
2700          $('.owl-carousel').find('.owl-next').attr('role', 'button').attr('aria-label', 'Next'); 
2701          $(".owl-dots button").each(function(index){
2702            $(this).attr('aria-label', 'slide '+(index+1)); 
2703          }) 
2704        }, 
2705        onChange: function() {
2706          $('.owl-carousel').find('.owl-item').attr('aria-selected', 'false'); 
2707          setTimeout(function() {
2708            $('.owl-carousel').find('.owl-item.active').attr('aria-selected', 'true'); 
2709          }, 100) 
2710        } 
2711      });
2712
2713      var $element = $('.owl-carousel'); 
2714
2715      $('#play').on('click', function() {
2716        $element.trigger('play.owl.autoplay', [4000]); 
2717        $('#pause').show(); 
2718        $('#play').hide(); 
2719      }); 
2720      $('#pause').on('click', function() {
2721        $element.trigger('stop.owl.autoplay'); 
2722        $('#play').show(); 
2723        $('#pause').hide(); 
2724      }); 
2725      $('.owl-nav').on('click', function() {
2726        $element.trigger('play.owl.autoplay', [4000]); 
2727        $('#play').hide(); 
2728        $('#pause').show(); 
2729      });
2730    }
2731  });
2732
2733})();
2734
2735$(document).on("click", ".show-disclaimer",  function(e) {
2736    e.preventDefault();
2737    $(".container-disclaimer").slideDown( "slow" );
2738    $(".disclaimer").hide();
2739});
2740
2741
2742$(document).on("click", ".disclaimer-close", function(e) {
2743    e.preventDefault();
2744    $(".container-disclaimer").hide();
2745    $(".disclaimer").slideDown("slow");
2746});
2747
2748(function () {
2749    const SLIDER = '.slider-component',
2750          LEGAL_DETAILS = '.legal-details',
2751          SLIDER_CONTAINER = '.slide-container',
2752          OWL_CAROUSEL = '.owl-carousel',
2753          CONTROLLS = '.controlls';
2754          
2755        var $slideshow = $(".slider-component .slide-show");
2756        var $controls = $slideshow.find(".controls");
2757        var $pauseBtn = $slideshow.find(".pause-btn");
2758        var $playBtn = $slideshow.find(".play-btn");
2759
2760          var $slider = $(SLIDER);
2761          var $owlCarousel = $slider.find(OWL_CAROUSEL);
2762
2763    if($slider.length === 0){
2764        return;
2765    }
2766
2767    function playSlider(){
2768        $owlCarousel.trigger('play.owl.autoplay');        
2769        $controls.attr("aria-label", "Stop Slider");
2770        $playBtn.hide();
2771        $pauseBtn.show();
2772    }
2773
2774    function stopSlider(){
2775        $owlCarousel.trigger('stop.owl.autoplay');
2776        $controls.attr("aria-label", "Play Slider");
2777        $playBtn.show();
2778        $pauseBtn.hide();	
2779    }
2780
2781
2782    function handleOpenDetails(){
2783        $slider.find('.toggleClass').on('click', function(e){
2784            e.stopImmediatePropagation();
2785            $slider.find('.slide-element').hide();
2786            $slider.find(LEGAL_DETAILS).fadeIn();
2787            
2788            stopSlider();
2789            $slider.find(CONTROLLS).fadeOut();
2790        });
2791    }
2792
2793    function handleCloseDetails(){
2794        $slider.find('.closeToggle').on('click', function(e){
2795            e.stopImmediatePropagation();
2796            $slider.find('.slide-element').fadeIn();
2797            $slider.find(LEGAL_DETAILS).hide();
2798            $slider.find(CONTROLLS).fadeIn();
2799            
2800            playSlider();
2801            
2802        });
2803    }
2804
2805    function handlerDragg () {
2806        if( $slider.find(LEGAL_DETAILS).css('display') !== 'none'){
2807            $slider.find('.slide-element').fadeIn();
2808            $slider.find(LEGAL_DETAILS).hide();
2809            $slider.find(CONTROLLS).fadeIn();
2810        }
2811        playSlider();
2812    }
2813
2814    function handlerResize () {
2815        
2816        $slider.find(LEGAL_DETAILS).css('display') === 'none' ? playSlider() : stopSlider();
2817
2818        handleOpenDetails();
2819        handleCloseDetails();
2820    }
2821
2822
2823    function callback() {
2824
2825        if($slider.find(SLIDER_CONTAINER).height() !== undefined ){
2826            $slider.find(LEGAL_DETAILS).css('min-height', $slider.find(SLIDER_CONTAINER).height());
2827        } 
2828
2829        $controls.on("click", function(){
2830			if($playBtn.css("display") == 'none'){
2831				stopSlider();
2832			}else{
2833                playSlider();
2834			}
2835			
2836		});
2837
2838        handleOpenDetails();
2839        handleCloseDetails();
2840    }
2841
2842
2843    var speed = 500;
2844    var auto = $owlCarousel.data("autoplay") === true;
2845
2846    if(typeof ($owlCarousel.data("speed")) !== "undefined"){
2847        speed =  parseInt($owlCarousel.data("speed").trim()) * 1000;
2848    }
2849
2850    if($slider.length !== 0){
2851        $(document.documentElement).keyup(function (event) {                  
2852                if (event.keyCode == 37) {                    
2853                    $owlCarousel.trigger('next.owl.carousel');
2854                    handlerDragg();
2855                } else if (event.keyCode == 39) {
2856                    $owlCarousel.trigger('prev.owl.carousel');
2857                    handlerDragg();
2858                }
2859        });
2860    }
2861
2862    function ariaDots() {
2863        $owlCarousel.find(".owl-dot").each(function() {
2864            if($(this).hasClass("active")){
2865                $(this).attr("aria-label","current slide");                
2866            }else{
2867                $(this).attr("aria-label","next slide");
2868            }
2869        });
2870    }
2871
2872    if($(".slider-component .slide").length <= 1 ){
2873        $owlCarousel.owlCarousel({
2874            loop:false,
2875            margin: 0,
2876            nav: false,
2877            autoplay: false,
2878            onInitialized: callback,
2879            items:1,
2880            mouseDrag: false,
2881            touchDrag: false,
2882            pullDrag: false,
2883            autoplayTimeout: speed
2884        });
2885    }else{
2886        $owlCarousel.owlCarousel({
2887            loop:true,
2888            margin: 0,
2889            nav: false,
2890            autoplay: auto,
2891            items:1,
2892            autoplayTimeout: speed,
2893            onInitialized: callback,
2894            onDragged: handlerDragg,
2895            onResized: handlerResize,
2896            onChanged: ariaDots
2897        });
2898    }
2899
2900    
2901    
2902    
2903
2904})();
2905
2906(function () {
2907  
2908
2909  var $sccss_cmpnt = $('#succes-stories-24');
2910  var $dotsNav =  $('.ow24-navigation-success');
2911  if($sccss_cmpnt.length < 1 )  {
2912      return;
2913  }
2914
2915  $('#play').on('click', function() {
2916      $sccss_cmpnt.trigger('play.owl.autoplay', [4000]);
2917      $('#pause').show();
2918      $('#play').hide();
2919  });
2920  $('#pause').on('click', function() {
2921      $sccss_cmpnt.trigger('stop.owl.autoplay');
2922      $('#play').show();
2923      $('#pause').hide();
2924  });
2925  $('.owl-nav').on('click', function() {
2926      $sccss_cmpnt.trigger('play.owl.autoplay', [4000]);
2927      $('#play').hide();
2928      $('#pause').show();
2929  });
2930  
2931  $sccss_cmpnt.owlCarousel({
2932      loop: true,
2933      margin: 0,
2934      nav: false,
2935      autoplay: true,
2936      responsive: {
2937          0: {
2938              items: 1,
2939              stagePadding: 20,
2940          },
2941          600: {
2942              items: 3
2943          }
2944      },
2945      autoplayTimeout: 5000,
2946      onInitialized: function() {
2947          $sccss_cmpnt.find('.owl-item').attr('aria-selected', 'false');
2948          $sccss_cmpnt.find('.owl-item.active').attr('aria-selected', 'true');
2949          $sccss_cmpnt.find('.owl-prev').attr('role', 'button').attr('aria-label', 'Previous');
2950          $sccss_cmpnt.find('.owl-next').attr('role', 'button').attr('aria-label', 'Next');
2951          $sccss_cmpnt.find(".owl-dots button").each(function(index) {
2952              $(this).attr('aria-label', 'slide ' + (index + 1));
2953          })
2954      },
2955      onChange: function() {
2956          $sccss_cmpnt.find('.owl-item').attr('aria-selected', 'false');
2957          setTimeout(function() {
2958              $sccss_cmpnt.find('.owl-item.active').attr('aria-selected', 'true');
2959          }, 100)
2960      }
2961  });
2962
2963  var newDots = $sccss_cmpnt.find('.owl-dots').detach();
2964  $dotsNav.append(newDots);
2965
2966})();
2967
2968(function () {
2969
2970	var $unsubscribeComponent = $('.unsubscribe-component');
2971	if($unsubscribeComponent.length === 0){
2972		return;
2973	}
2974
2975	var oneTrustIntegration = {
2976		settings: {
2977			devSettings: {
2978				appId: "74c4ba90-7cdf-4fa6-bc9d-69ad2ed646e1",
2979				collectionID: "a29d2ef8-28b9-4552-9b05-08eb5662f9b2",
2980				urlToken: "https://privacyportal-uat-cdn.onetrust.com/consentmanager-sett
2980ings",
2981				urlPost: "https://privacyportaluat.onetrust.com/request/v1/consentreceipts",
2982				purposesId: "c780778a-daa7-4e38-8094-8b69f3852a83"
2983			},
2984			uatSettings: {
2985				appId: "3a7dde79-bf17-45e1-a8ef-a9b992ccde96",
2986				collectionID: "b7f2a0bd-3d34-4b8f-98c4-3c76bb883d2e",
2987				urlToken: "https://privacyportal-uat-cdn.onetrust.com/consentmanager-settings",
2988				urlPost: "https://privacyportaluat.onetrust.com/request/v1/consentreceipts",
2989				purposesId: "5adcf0eb-5418-4b6e-968e-ee77ab6813c6"
2990			},
2991			prodSettings: {
2992				appId: "b0e36f88-166e-411c-b449-f0217583581d",
2993				collectionID: "f5b8d931-0a45-48d1-ab2d-6c276ad530d7",
2994				urlToken: "https://privacyportal-cdn.onetrust.com/consentmanager-settings",
2995				urlPost: "https://privacyportal.onetrust.com/request/v1/consentreceipts",
2996				purposesId: "e9aabba3-97db-45dd-b1bd-066e079cdf07"
2997			}
2998		},
2999		init: function(email){
3000			this.getToken(email);
3001		},
3002		getToken: function(email){
3003			var currentEnv = globalData.envSettings; // "devSettings", "uatSettings" o "prodSettings"
3004			var env = this.settings[currentEnv];
3005
3006			$.get(`${env.urlToken}/${env.appId}/${env.collectionID}-draft.json`, function(response){
3007				if (response) {
3008					oneTrustIntegration.postOneTrust(email, response.token);
3009				} else {
3010					unsubscribeFail("Connection error, please try again.");
3011				}
3012			}).fail(function() {
3013				unsubscribeFail("Connection error, please try again.");
3014			});
3015		},
3016		postOneTrust: function (email, token) {
3017			var currentEnv = globalData.envSettings;
3018			var env = this.settings[currentEnv];
3019
3020			var body = {
3021				identifier: email,
3022				identifierType: "24HF Email Address",
3023				requestInformation: token,
3024				purposes: [
3025					{
3026						Id: env.purposesId,
3027						transactionType: "WITHDRAWN"
3028					}
3029				]
3030			};
3031
3032			$.ajax({
3033				type: "POST",
3034				url: env.urlPost,
3035				data: JSON.stringify(body),
3036				contentType: false,
3037				success: function (data) {
3038					replaceEmail(email);
3039					unsubscribeSuccess( email);
3040				},
3041				error: function (err) {
3042					console.log("OneTrust error:", err);
3043					var errorMessage = "Connection error, please try again.";
3044					unsubscribeFail(errorMessage);
3045				}
3046			});
3047		}
3048	}
3049
3050	$('#unsubscribe-form').submit(function(e){
3051		e.preventDefault();
3052
3053		$('.unsubscribe').fadeOut(function(){
3054			$('.loading-unsubscribe').fadeIn();
3055			setTimeout(validateForm, 500);
3056		});
3057	});
3058	
3059	function replaceEmail(mailAddress) {
3060		$(".elmt").each(function() {
3061		  var $this = $(this);
3062		  var htmlContent = $this.html();
3063		  
3064		  if (htmlContent.includes("{{email}}")) {
3065			var newHtml = htmlContent.replace(/\{\{email\}\}/g, mailAddress);
3066			$this.html(newHtml);
3067		  }
3068		});
3069	  }
3070	
3071	function validateForm () {
3072		var errors = [];
3073		var $email = $unsubscribeComponent.find('#email').val();
3074
3075		var checkErrMsg = $unsubscribeComponent.find('#errors').data('checkerror');
3076		var emailErrMsg = $unsubscribeComponent.find('#errors').data('emailerror');
3077				
3078		var $unsubscribeDirectMailRequest = $unsubscribeComponent.find("#unsubscribeDirectMailRequest");
3079		var unsubscribeMail =  $unsubscribeDirectMailRequest.length > 0 
3080			? $unsubscribeDirectMailRequest.is(':checked') 
3081			: true;		
3082
3083		var reg = /^[\w._+-]+\@([\w_-]+\.)+[\w_]+$/;		
3084		
3085		if (!reg.test($email)) {
3086			errors.push({selector: $('#email'), message : emailErrMsg});
3087		}
3088	
3089		if (!unsubscribeMail) {
3090			errors.push({selector: $unsubscribeComponent.find('.unsubscribe table'), message : checkErrMsg});
3091		}
3092	
3093		if (errors.length) {
3094			displayErrors(errors);
3095		} else {
3096			oneTrustIntegration.init($email);
3097		}
3098	}
3099	
3100	function displayErrors (errors) {
3101		$unsubscribeComponent.find('.loading-unsubscribe').fadeOut(function(){
3102			$unsubscribeComponent.find('.unsubscribe').fadeIn();
3103		});
3104	
3105		$unsubscribeComponent.find('#errors').empty();
3106		$unsubscribeComponent.find('.error').removeClass('error');
3107
3108		$.each(errors, function(i, error){
3109			error.selector.addClass('error');
3110			$unsubscribeComponent.find('#errors').append("<div>"+error.message+"</div>");
3111		});
3112	}
3113
3114	function unsubscribeFail (errorMessage) {
3115		var errors = [];
3116		errors.push({selector: $unsubscribeComponent.find('#email'), message : errorMessage });
3117		displayErrors(errors);
3118	}
3119
3120	function unsubscribeSuccess (email) {
3121		$unsubscribeComponent.find('.unsubscribe-form').fadeOut(function(){
3122			$unsubscribeComponent.find('.emailAddress').html(email);
3123			$unsubscribeComponent.find('.success-msgs').fadeIn();
3124		});
3125	}
3126
3127})();
3128
3129document.addEventListener('DOMContentLoaded', function () {
3130    if (document.getElementsByClassName('main-column cancel-cont').length){generateLocalStorage()}
3131}, false);
3132
3133function generateLocalStorage(){
3134    localStorage.setItem('offerPageDisplayed', true)
3135}
3136
3137const $input = $('#autocomplete-input');
3138const $results = $('#autocomplete-results');
3139
3140function throttle(func, delay) {
3141  let lastCall = 0;
3142  return function (...args) {
3143    const now = new Date().getTime();
3144    if (now - lastCall >= delay) {
3145      lastCall = now;
3146      func.apply(this, args);
3147    }
3148  };
3149}
3150
3151function customSortBy(collection, prop) {
3152    return collection.sort((a, b) => {
3153      if (a[prop] < b[prop]) {
3154        return -1;
3155      }
3156      if (a[prop] > b[prop]) {
3157        return 1;
3158      }
3159      return 0;
3160    });
3161  }
3162
3163function renderResults(results) {
3164    $results.empty();
3165    let autocompleteLocations = [];
3166    let searchType = '';
3167
3168    if (results && results.length) {
3169      results.forEach((location) => {
3170
3171        if (location.recordType) {
3172          searchType = location.recordType;
3173        }
3174
3175        let itemID = '';
3176
3177        if (location.place.properties.countryCode === "US") {
3178          if (searchType === "city" && location.place.properties.county && location.place.properties.county.length > 0) {
3179            itemID = location.place.properties.city.replace(/\s/g, "-") + '-' + (location.place.properties.stateCode || location.place.properties.countryCode);
3180            autocompleteLocations.push(
3181              {
3182                location:
3183                  location.place.properties.city +
3184                  ", " +
3185                  (location.place.properties.stateCode ||
3186                    location.place.properties.countryCode),
3187                locationDetail: location.place.properties.county,
3188                recordType: searchType,
3189                itemID: itemID,
3190                stateCode: location.place.properties.stateCode,
3191                queryString: location.place.properties.city + ', ' + location.place.properties.county + ', ' + location.place.properties.stateCode,
3192              }
3193            );
3194          } else if (searchType === "postalCode") {
3195            if (location.place.properties.countryCode === 'US') {
3196              itemID = location.place.properties.postalCode + '-' + location.place.properties.city.replace(/\s/g, "-") + '-' + location.place.properties.stateCode;
3197              autocompleteLocations.push(
3198                {
3199                  location:
3200                    location.place.properties.postalCode +
3201                    " - " +
3202                    location.place.properties.city +
3203                    ", " +
3204                    location.place.properties.stateCode,
3205                  recordType: searchType,
3206                  zipcode: location.place.properties.postalCode,
3207                  itemID: itemID,
3208                  stateCode: location.place.properties.stateCode
3209                }
3210              );
3211            } else {
3212              // throw error?
3213            }
3214          }
3215        }
3216      });
3217    }
3218    let locationResults = customSortBy(autocompleteLocations, 'stateCode').slice(0,4);
3219    if (locationResults.length === 0) {
3220      $results.removeClass('hidden').append('<li>No results found</li>');
3221      return;
3222    } else {
3223      $results.removeClass('hidden');
3224      locationResults.forEach((item) => {
3225        $results.append(
3226          `<li recordType="${item.recordType}" queryString="${item.queryString}" location="${item.location}" zipcode="${item.zipcode}">
3227            ${item.location}
3228            ${item.locationDetail ? `<span class="location-detail">${item.locationDetail}</span>` : ''}
3229          </li>`
3230        );
3231      });
3232    }
3233  }
3234
3235function fetchResults(query) {
3236  $.getJSON('https://www.mapquestapi.com/search/v3/prediction', {
3237    key: MP_KEY,
3238    limit: 10,
3239    collection: "adminArea",
3240    q: query,
3241    full_headers: 1,
3242    full_status: 1,
3243    countryCode: "US",
3244    }, function (data) {
3245    renderResults(data.results);
3246  });
3247}
3248
3249const MP_KEY = "Gmjtd%7Clu6zn1ua2d%2C7s%3Do5-9rag9";
3250const throttledFetch = throttle(fetchResults, 1000);
3251
3252$(document).ready(function () {
3253  let debounce;
3254
3255  function updateSearchLink(value) {
3256    const $searchLink = $('#location-search-link');
3257    if (value) {
3258      $searchLink.attr('href', `/gyms/find-a-gym/?location=${value}&type=join`);
3259      $searchLink.removeClass('disabled');
3260    } else {
3261      $searchLink.attr('href', '#');
3262      $searchLink.addClass('disabled');
3263    }
3264  }
3265
3266  $input.on('input', function () {
3267    let rawValue = $(this).val();
3268    let cleanedValue = rawValue.replace(/[^a-z0-9\s]/gi, '').replace(/\s+/g, ' ');
3269
3270    if (rawValue !== cleanedValue) {
3271      $(this).val(cleanedValue);
3272    }
3273
3274    const query = cleanedValue.trim();
3275    clearTimeout(debounce);
3276
3277    if (query.length >= 3) {
3278      debounce = setTimeout(function () {
3279        throttledFetch(query);
3280      }, 300);
3281    } else {
3282      $results.empty();
3283    }
3284  });
3285
3286  $results.on('click', 'li', function () {
3287    const recordType = $(this).attr('recordType');
3288
3289    let urlValue = '';
3290    if (recordType === 'postalCode') {
3291      urlValue =  $(this).attr('zipcode');
3292      $input.val($(this).attr('location'));
3293
3294    } else {
3295      urlValue = $(this).attr('queryString');
3296      $input.val(urlValue);
3297    }
3298
3299    updateSearchLink(urlValue);
3300    $results.empty().addClass('hidden');
3301
3302  });
3303
3304  $('#clear-input').on('click', function () {
3305    $input.val('');
3306    $results.empty().addClass('hidden');
3307    updateSearchLink('', '');
3308  });
3309});
3310$(document).ready(function() {
3311
3312async function validateImageUrls($carousel) {
3313        const imgs = $carousel.find(".cmp-carousel__item .cmp-image__image");
3314        const checks = [];
3315
3316        imgs.each(function() {
3317            const src = $(this).attr('src');
3318            if (src) {
3319                checks.push(
3320                    fetch(src, { method: 'HEAD' })
3321                    .then(res => res.ok)
3322                    .catch(() => false)
3323                );
3324            }
3325        });
3326        const results = await Promise.all(checks);
3327        const validCount = results.filter(Boolean).length;
3328        return validCount > 0;
3329}
3330
3331$(".main-carousel").each(async function() {
3332        var $sync1 = $(this);
3333        var autoplay = $sync1.data("autoplay") === true || $sync1.data("autoplay") === "true";
3334        var $container = $sync1.closest('.container-24');
3335        var $sync2 = $container.find('.thumbnails-carousel');
3336        var slidesPerPage = 7;
3337
3338        const hasValidImages = await validateImageUrls($sync1);                
3339        if (!hasValidImages) {
3340            console.warn("No carousel images.");
3341            return;
3342        }
3343
3344        $sync1.owlCarousel({
3345            items: 1,
3346            slideSpeed: 2000,
3347            nav: true,
3348            autoplay: autoplay,
3349            dots: autoplay,
3350            loop: true,
3351            autoplaySpeed: 400,
3352            responsiveRefreshRate: 200,
3353            navText: ['<span>‹</span>', '<span>›</span>'],
3354        }).on('changed.owl.carousel', function(event) {
3355            if ($sync2.length > 0) {
3356                syncPosition(event, $sync2);
3357            }
3358        });
3359
3360        if ($sync2.length > 0 ) {
3361            $sync2.on('initialized.owl.carousel', function() {
3362                $sync2.find(".owl-item").eq(0).addClass("current");
3363            })
3364            .owlCarousel({
3365                responsive: {
3366                    0: {
3367                        items: 3,
3368                        nav: true,
3369                        loop: false
3370                    },
3371                    600: {
3372                        items: slidesPerPage,
3373                        nav: true,
3374                        loop: false
3375                    },
3376                    1000: {
3377                        items: slidesPerPage,
3378                        nav: true,
3379                        loop: false
3380                    }
3381                },
3382                dots: autoplay,
3383                nav: true,
3384                smartSpeed: 200,
3385                slideSpeed: 500,
3386                slideBy: slidesPerPage,
3387                responsiveRefreshRate: 100,
3388            })
3389
3390        
3391        }
3392
3393        if (autoplay) {
3394            var $pauseButton = $sync1.closest('.cmp-carousel').find('.cmp-carousel__action--pause');
3395            var $playButton = $sync1.closest('.cmp-carousel').find('.cmp-carousel__action--play');
3396
3397            $pauseButton.on('click', function() {
3398                $sync1.trigger('stop.owl.autoplay');
3399                $pauseButton.addClass('cmp-carousel__action--disabled');
3400                $playButton.removeClass('cmp-carousel__action--disabled');
3401            });
3402
3403            $playButton.on('click', function() {
3404                $sync1.trigger('play.owl.autoplay', [1000]);
3405                $playButton.addClass('cmp-carousel__action--disabled');
3406                $pauseButton.removeClass('cmp-carousel__action--disabled');
3407            });
3408        }
3409
3410
3411        function syncPosition(el) {            
3412            var count = el.item.count - 1;
3413            var current = Math.round(el.item.index - (el.item.count / 2) - .5);            
3414            
3415            if (current < 0) {
3416                current = count;
3417            }
3418            if (current > count) {
3419                current -= 1;
3420            }
3421                        
3422            $sync2
3423                .find(".owl-item")
3424                .removeClass("current")
3425                .eq(current)
3426                .addClass("current");
3427            var onscreen = $sync2.find('.owl-item.active').length - 1;
3428            var start = $sync2.find('.owl-item.active').first().index();
3429            var end = $sync2.find('.owl-item.active').last().index();
3430    
3431            if (current > end) {
3432                $sync2.data('owl.carousel').to(current, 100, true);
3433            }
3434            if (current < start) {
3435                $sync2.data('owl.carousel').to(current - onscreen, 100, true);
3436            }
3437        }    
3438
3439        $(document).on("click", ".thumbnails-carousel .owl-item", function(e) {
3440            e.preventDefault();
3441            var $thisCarousel = $(this).closest('.thumbnails-carousel');
3442            var index = $(this).index();
3443            var $mainCarousel = $thisCarousel.closest('.container-24').find('.main-carousel');
3444            console.log("Thumbnail clicked index: ", index);
3445            $mainCarousel.data('owl.carousel').to(index, 300, true);
3446        });
3447        
3448
3449    });
3450
3451    
3452    
3453});
3454
3455(function ($) {
3456  const MP_KEY = "Gmjtd%7Clu6zn1ua2d%2C7s%3Do5-9rag9";
3457  const typePass = 'CLUBPASS';
3458
3459  const $input = $('#szf-autocomplete');
3460  const $inputWrapper = $input.closest('.szf-input');
3461  const $clearBtn = $('#szf-clear-input');
3462  const $results = $('.szf-resuls');
3463  const $locationBtn = $('#szf-location');
3464  const $noLocation = $('.szf .no-location');
3465
3466  let suppressBlurClear = false;
3467  let noLocationTimeout = null;
3468
3469  function buildSubmitUrl(value) {
3470    const locationParam = encodeURIComponent(value);
3471    return `/membership/free-guest-gym-pass?pass=${typePass}&location=${locationParam}`;
3472  }
3473
3474  function buildGeoSubmitUrl(lat, lng) {
3475    const latParam = encodeURIComponent(lat);
3476    const lngParam = encodeURIComponent(lng);
3477    return `/membership/free-guest-gym-pass?pass=${typePass}&lat=${latParam}&long=${lngParam}`;
3478  }
3479
3480  function throttle(func, delay) {
3481    let lastCall = 0;
3482    return function (...args) {
3483      const now = Date.now();
3484      if (now - lastCall >= delay) {
3485        lastCall = now;
3486        func.apply(this, args);
3487      }
3488    };
3489  }
3490
3491  function customSortBy(collection, prop) {
3492    return collection.sort((a, b) => {
3493      if (a[prop] < b[prop]) return -1;
3494      if (a[prop] > b[prop]) return 1;
3495      return 0;
3496    });
3497  }
3498
3499  function hideResults() {
3500    $results.empty().addClass('hidden');
3501  }
3502
3503  function showResults() {
3504    $results.removeClass('hidden');
3505  }
3506
3507  function clearInputFully() {
3508    $input.val('');
3509    hideResults();
3510    $inputWrapper.removeClass('active');
3511  }  
3512
3513  function showOverlay() {
3514    $('#szf-overlay').removeClass('hidden');
3515  }
3516
3517  function hideOverlay() {
3518    $('#szf-overlay').addClass('hidden');
3519  }
3520
3521  function showNoLocation() {
3522    if (!$noLocation.length) return;
3523
3524    $noLocation.removeClass('hidden');
3525
3526    if (noLocationTimeout) clearTimeout(noLocationTimeout);
3527    noLocationTimeout = setTimeout(() => {
3528      $noLocation.addClass('hidden');
3529    }, 5000);
3530  }
3531
3532  function renderResults(results) {
3533    $results.empty();
3534    let autocompleteLocations = [];
3535    let searchType = '';
3536
3537    if (results && results.length) {
3538      results.forEach((location) => {
3539        if (location.recordType) {
3540          searchType = location.recordType;
3541        }
3542
3543        const props = location?.place?.properties;
3544        if (!props || props.countryCode !== "US") return;
3545
3546        if (searchType === "city" && props.county && props.county.length > 0) {
3547          autocompleteLocations.push({
3548            displayText: `${props.city}, ${props.stateCode || props.countryCode}`,
3549            detailText: props.county,
3550            recordType: searchType,
3551            stateCode: props.stateCode || '',
3552            submitValue: `${props.city}, ${props.county}, ${props.stateCode}`,
3553          });
3554        } else if (searchType === "postalCode") {
3555          if (props.postalCode && props.city && props.stateCode) {
3556            autocompleteLocations.push({
3557              displayText: `${props.postalCode} - ${props.city}, ${props.stateCode}`,
3558              recordType: searchType,
3559              stateCode: props.stateCode,
3560              submitValue: props.postalCode,
3561            });
3562          }
3563        }
3564      });
3565    }
3566
3567    const locationResults = customSortBy(autocompleteLocations, 'stateCode').slice(0, 6);
3568
3569    if (!locationResults.length) {
3570      showResults();
3571      $results.append('<li class="szf-no-results"><a href="#" tabindex="-1">No location found</a></li>');
3572      return;
3573    }
3574
3575    showResults();
3576    locationResults.forEach((item) => {
3577      const detail = item.detailText ? `<span class="location-detail">${item.detailText}</span>` : '';
3578
3579      $results.append(`
3580        <li>
3581          <a href="#"
3582             data-record-type="${item.recordType}"
3583             data-submit-value="${String(item.submitValue).replace(/"/g, '&quot;')}">
3584            ${String(item.submitValue).replace(/"/g, '&quot;')}
3585          </a>
3586        </li>
3587      `);
3588    });
3589  }
3590
3591  function fetchResults(query) {
3592    $.getJSON('https://www.mapquestapi.com/search/v3/prediction', {
3593      key: MP_KEY,
3594      limit: 10,
3595      collection: "adminArea",
3596      q: query,
3597      full_headers: 1,
3598      full_status: 1,
3599      countryCode: "US",
3600    }, function (data) {
3601      renderResults(data?.results || []);
3602    });
3603  }
3604
3605  const throttledFetch = throttle(fetchResults, 1000);
3606
3607  $(document).ready(function () {
3608    let debounce;
3609
3610    $results.on('mousedown touchstart', function () {
3611      suppressBlurClear = true;
3612    });
3613    $locationBtn.on('mousedown touchstart', function () {
3614      suppressBlurClear = true;
3615    });
3616
3617    
3618    $input.on('focus click input', function () {
3619      $inputWrapper.addClass('active');
3620    });
3621
3622    
3623    $input.on('blur', function () {
3624      if (suppressBlurClear) {
3625        suppressBlurClear = false;
3626        return;
3627      }
3628      clearInputFully();
3629    });
3630
3631    // Autocomplete
3632    $input.on('input', function () {
3633      const rawValue = $(this).val();
3634      const cleanedValue = String(rawValue)
3635        .replace(/[^a-z0-9\s]/gi, '')
3636        .replace(/\s+/g, ' ');
3637
3638      if (rawValue !== cleanedValue) {
3639        $(this).val(cleanedValue);
3640      }
3641
3642      const query = cleanedValue.trim();
3643      clearTimeout(debounce);
3644
3645      if (query.length >= 3) {
3646        debounce = setTimeout(function () {
3647          throttledFetch(query);
3648        }, 300);
3649      } else {
3650        hideResults();
3651      }
3652    });
3653
3654    $results.on('click', 'a[data-submit-value]', function (e) {
3655      e.preventDefault();
3656
3657      const submitValue = $(this).data('submit-value');
3658
3659      $input.val($(this).text().trim());
3660
3661      hideResults();
3662      window.location.href = buildSubmitUrl(submitValue);
3663    });
3664
3665    // Clear
3666    $clearBtn.on('click', function () {
3667      clearInputFully();
3668      $input.trigger('focus');
3669    });
3670
3671    $(document).on('click', function (e) {
3672      const $target = $(e.target);
3673      if (!$target.closest('.szf-input').length) {
3674        hideResults();
3675        $inputWrapper.removeClass('active');
3676      }
3677    });
3678
3679
3680    $input.on('keydown', function (e) {
3681      if (e.key === 'Escape') {
3682        clearInputFully();
3683        $input.blur();
3684      }
3685    });
3686
3687    $locationBtn.on('click', function (e) {
3688      e.preventDefault();
3689
3690      hideResults();
3691      $inputWrapper.addClass('active');
3692
3693      if (!navigator.geolocation) {
3694        showNoLocation();
3695        return;
3696      }
3697
3698      showOverlay();
3699
3700      navigator.geolocation.getCurrentPosition(
3701        function (pos) {
3702          const lat = Number(pos.coords.latitude.toFixed(2));
3703          const lng = Number(pos.coords.longitude.toFixed(2));
3704
3705          hideOverlay();
3706          window.location.href = buildGeoSubmitUrl(lat, lng);
3707        },
3708        function () {
3709          hideOverlay();
3710          showNoLocation();
3711        },
3712        {
vendor: 15,352 bytes, lines 3713-3746
3713          enableHighAccuracy: false,
3714          timeout: 10000,
3715          maximumAge: 600000
3716        }
3717      );
3718    });
3719  });
3720
3721})(jQuery);
3722
3723var skipCookie = getCookie("SKIPHOMEPAGECOOKIE");
3724if (skipCookie && skipCookie === "MEMBERCOOKIE") {
3725  $(".member-only").show();
3726} else {
3727  $(".nonmember-only").show();
3728}
3729
3730function getCookie(name) {
3731  if (document.cookie.length > 0) {
3732    var start = document.cookie.indexOf(name + "=");
3733    if (start != -1) {
3734      start = start + name.length + 1;
3735      var end = document.cookie.indexOf(";", start);
3736      if (end == -1) end = document.cookie.length;
3737      return unescape(document.cookie.substring(start, end))
3738    }
3739  }
3740  return ""
3741}
3742
3743/*! jQuery Validation Plugin - v1.19.5 - 7/1/2022
3744 * https://jqueryvalidation.org/
3745 * Copyright (c) 2022 Jörn Zaefferer; Licensed MIT */
3746!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0],k="undefined"!=typeof this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=j&&(!j.form&&k&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}});var b=function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};a.extend(a.expr.pseudos||a.expr[":"],{blank:function(c){return!b(""+a(c).val())},filled:function(c){var d=a(c).val();return null!==d&&!!b(""+d)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");if(!this.form&&c&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var e=a.data(this.form,"validator"),f="on"+b.type.replace(/^validate/,""),g=e.settings;g[f]&&!a(this).is(g.ignore)&&g[f].call(e,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name"),e="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),e&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type,g="undefined"!=typeof e.attr("contenteditable")&&"false"!==e.attr("contenteditable");return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=g?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=".  Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.n
3746ame],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return void 0===a?"":a.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);
vendor: 4,097 bytes, line 3746
3746return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()&&0===this.pendingRequest?(a(this.currentForm).trigger("submit"),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a["date"===b?"dateISO":c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(a,d){b[a]="function"==typeof d&&"normalizer"!==a?d(c):d}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var a;b[this]&&(Array.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(a=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(a[0]),Number(a[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.val
3746idator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c},maxlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d<=c},rangelength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c[0]&&d<=c[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var c,d={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,c){var e=a.port;"abort"===a.mode&&(d[e]&&d[e].abort(),d[e]=c)}):(c=a.ajax,a.ajax=function(b){var e=("mode"in b?b:a.ajaxSettings).mode,f=("port"in b?b:a.ajaxSettings).port;return"abort"===e?(d[f]&&d[f].abort(),d[f]=c.apply(this,arguments),d[f]):c.apply(this,arguments)}),a});
3747/*! jquery.cookie v1.4.1 | MIT */
3748!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});
3749/**
3750 * jQuery plugin to convert a given $.ajax response xml object to json.
3751 *
3752 * @example var json = $.xml2json(response);
3753 */
3754(function() {
3755
3756	// default options based on https://github.com/Leonidas-from-XIV/node-xml2js
3757	var defaultOptions = {
3758		attrkey: '$',
3759		charkey: '_',
3760		normalize: false
3761	};
3762
3763	// extracted from jquery
3764	function parseXML(data) {
3765		var xml, tmp;
3766		if (!data || typeof data !== "string") {
3767			return null;
3768		}
3769		try {
3770			if (window.DOMParser) { // Standard
3771				tmp = new DOMParser();
3772				xml = tmp.parseFromString(data, "text/xml");
3773			} else { // IE
3774				xml = new ActiveXObject("Microsoft.XMLDOM");
3775				xml.async = "false";
3776				xml.loadXML(data);
3777			}
3778		} catch (e) {
3779			xml = undefined;
3780		}
3781		if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) {
3782			throw new Error("Invalid XML: " + data);
3783		}
3784		return xml;
3785	}
3786
3787	function normalize(value, options){
3788		if (!!options.normalize){
3789			return (value || '').trim();
3790		}
3791		return value;
3792	}
3793
3794	function xml2jsonImpl(xml, options) {
3795
3796		var i, result = {}, attrs = {}, node, child, name;
3797		result[options.attrkey] = attrs;
3798
3799		if (xml.attributes && xml.attributes.length > 0) {
3800			for (i = 0; i < xml.attributes.length; i++){
3801				var item = xml.attributes.item(i);
3802				attrs[item.nodeName] = item.value;
3803			}
3804		}
3805
3806		// element content
3807		if (xml.childElementCount === 0) {
3808			result[options.charkey] = normalize(xml.textContent, options);
3809		}
3810
3811		for (i = 0; i < xml.childNodes.length; i++) {
3812			node = xml.childNodes[i];
3813			if (node.nodeType === 1) {
3814
3815				if (node.attributes.length === 0 && node.childElementCount === 0){
3816					child = normalize(node.textContent, options);
3817				} else {
3818					child = xml2jsonImpl(node, options);
3819				}
3820
3821				name = node.nodeName;
3822				if (result.hasOwnProperty(name)) {
3823					// For repeating elements, cast/promote the node to array
3824					var val = result[name];
3825					if (!Array.isArray(val)) {
3826						val = [val];
3827						result[name] = val;
3828					}
3829					val.push(child);
3830				} else {
3831					result[name] = child;
3832				}
3833			}
3834		}
3835
3836		return result;
3837	}
3838
3839	/**w
3840	 * Converts an xml document or string to a JSON object.
3841	 *
3842	 * @param xml
3843	 */
3844	function xml2json(xml, options) {
3845		if (!xml) {
3846			return xml;
3847		}
3848
3849		options = options || defaultOptions;
3850
3851		if (typeof xml === 'string') {
3852			xml = parseXML(xml).documentElement;
3853		}
3854
3855		var root = {};		
3856		if ( (typeof xml.attributes === 'undefined') || (xml.attributes === null) ) {
3857			root[xml.nodeName] = xml2jsonImpl(xml, options);
3858		} else if (xml.attributes.length === 0 && xml.childElementCount === 0){
3859			root[xml.nodeName] = normalize(xml.textContent, options);
3860		} else {
3861			root[xml.nodeName] = xml2jsonImpl(xml, options);
3862		}
3863
3864		return root;
3865	}
3866
3867	if (typeof jQuery !== 'undefined') {
3868		jQuery.extend({xml2json: xml2json});
3869	} else if (typeof module !== 'undefined') {
3870		module.exports = xml2json;
3871	} else if (typeof window !== 'undefined') {
3872		window.xml2json = xml2json;
3873	}
3874})();
vendor: 32,159 bytes, lines 3875-3880
3875/*!
3876 * Bootstrap v3.3.7 (http://getbootstrap.com)
3877 * Copyright 2011-2016 Twitter, Inc.
3878 * Licensed under the MIT license
3879 */
3880if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){document===a.target||this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);if(this.$element.trigger(g),!g.isDefaultPrevented())return f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=window.SVGElement&&c instanceof window.SVGElement,g=d?{top:0,left:0}:f?null:b.offset(),h={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},i=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,h,i,g)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){
vendor: 2,604 bytes, line 3881
3881  this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.7",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;
vendor: 2,285 bytes, line 3881
3881e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e<c&&"top";if("bottom"==this.affixed)return null!=c?!(e+this.unpin<=f.top)&&"bottom":!(e+g<=a-d)&&"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&e<=c?"top":null!=d&&i+j>=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.