{"version":3,"file":"theme.js.map","sources":["../../../../js/mrare/background-images.js","../../../../js/mrare/aos.js","../../../../js/mrare/flatpickr.js","../../../../js/mrare/jarallax.js","../../../../js/mrare/prism.js","../../../../js/mrare/smooth-scroll.js","../../../../js/mrare/util.js","../../../../js/mrare/sticky.js","../../../../js/mrare/video.js","../../../../js/mrare/wizard.js","../../../../js/mrare/index.js"],"sourcesContent":["//\n//\n// background-images.js\n//\n// a javascript fallback for CSS 'object-fit' property for browsers that don't support it\n\nimport jQuery from 'jquery';\n\n(($) => {\n if ('objectFit' in document.documentElement.style === false) {\n $('.bg-image').each(function attachBg() {\n const img = $(this);\n const src = img.attr('src');\n const classes = img.get(0).classList;\n // Replaces the default element with a \n // to attach background using legacy friendly CSS rules\n img.before($(`
`));\n // Removes original as it is no longer required\n img.remove();\n });\n }\n})(jQuery);\n","\n//\n//\n// aos.js\n//\n// Initialises the animate on scroll plugin\n\nimport AOS from 'aos';\n\nAOS.init({ once: true });\n","//\n//\n// flatpickr.js\n//\n// an initializer for the flatpickr date/time picker plugin\n// https://flatpickr.js.org/\n//\n\nimport jQuery from 'jquery';\nimport flatpickr from 'flatpickr';\n\nconst mrFlatpickr = (($) => {\n /**\n * Check for flatpickr dependency\n */\n if (typeof flatpickr === 'undefined') {\n throw new Error('mrFlatpickr requires flatpickr.js (https://github.com/flatpickr/flatpickr)');\n }\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'mrFlatpickr';\n const VERSION = '1.0.0';\n const DATA_KEY = 'mr.flatpickr';\n const EVENT_KEY = `.${DATA_KEY}`;\n const DATA_API_KEY = '.data-api';\n const JQUERY_NO_CONFLICT = $.fn[NAME];\n\n const Event = {\n LOAD_DATA_API: `load${EVENT_KEY}${DATA_API_KEY}`,\n };\n\n const Selector = {\n FLATPICKR: '[data-flatpickr]',\n };\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Flatpickr {\n constructor(element) {\n // The current flatpickr element\n this.element = element;\n // const $element = $(element);\n\n this.initflatpickr();\n }\n\n // getters\n static get VERSION() {\n return VERSION;\n }\n\n initflatpickr() {\n const options = $(this.element).data();\n this.instance = flatpickr(this.element, options);\n }\n\n static jQueryInterface() {\n return this.each(function jqEachFlatpickr() {\n const $element = $(this);\n let data = $element.data(DATA_KEY);\n if (!data) {\n data = new Flatpickr(this);\n $element.data(DATA_KEY, data);\n }\n });\n }\n }\n // END Class definition\n\n /**\n * ------------------------------------------------------------------------\n * Initialise by data attribute\n * ------------------------------------------------------------------------\n */\n\n $(window).on(Event.LOAD_DATA_API, () => {\n const pickers = $.makeArray($(Selector.FLATPICKR));\n\n /* eslint-disable no-plusplus */\n for (let i = pickers.length; i--;) {\n const $flatpickr = $(pickers[i]);\n Flatpickr.jQueryInterface.call($flatpickr, $flatpickr.data());\n }\n });\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n /* eslint-disable no-param-reassign */\n $.fn[NAME] = Flatpickr.jQueryInterface;\n $.fn[NAME].Constructor = Flatpickr;\n $.fn[NAME].noConflict = function flatpickrNoConflict() {\n $.fn[NAME] = JQUERY_NO_CONFLICT;\n return Flatpickr.jQueryInterface;\n };\n /* eslint-enable no-param-reassign */\n\n return Flatpickr;\n})(jQuery);\n\nexport default mrFlatpickr;\n","//\n// jarallax.js\n//\n\n// Closing an alert changes height of document, so readjust position of parallax elements\n\nimport jQuery from 'jquery';\nimport jarallax from 'jarallax';\n\n(($) => {\n if (typeof jarallax === 'function') {\n $('.alert-dismissible').on('closed.bs.alert', () => {\n jarallax(document.querySelectorAll('[data-jarallax]'), 'onScroll');\n });\n\n $(document).on('resized.mr.overlayNav', () => {\n jarallax(document.querySelectorAll('[data-jarallax]'), 'onResize');\n });\n\n jarallax(document.querySelectorAll('[data-jarallax]'), {\n disableParallax: /iPad|iPhone|iPod|Android/,\n disableVideo: /iPad|iPhone|iPod|Android/,\n });\n }\n})(jQuery);\n","//\n//\n// prism.js\n//\n// Initialises the prism code highlighting plugin\n\nimport Prism from 'prismjs';\n\nPrism.highlightAll();\n","//\n//\n// smooth-scroll.js\n//\n// Initialises the prism code highlighting plugin\n\nimport $ from 'jquery';\nimport SmoothScroll from 'smooth-scroll';\n\nconst mrSmoothScroll = new SmoothScroll('a[data-smooth-scroll]', {\n offset: $('body').attr('data-smooth-scroll-offset') || 0,\n});\n\nexport default mrSmoothScroll;\n","//\n//\n// Util\n//\n// Medium Rare utility functions\n// v1.0.0\n\nimport jQuery from 'jquery';\n\nconst mrUtil = (($) => {\n // Activate tooltips\n $('[data-toggle=\"tooltip\"]').tooltip();\n\n // Activate toasts\n $('.toast').toast();\n\n const Util = {\n\n activateIframeSrc(iframe) {\n const $iframe = $(iframe);\n if ($iframe.attr('data-src')) {\n $iframe.attr('src', $iframe.attr('data-src'));\n }\n },\n\n idleIframeSrc(iframe) {\n const $iframe = $(iframe);\n $iframe.attr('data-src', $iframe.attr('src')).attr('src', '');\n },\n };\n\n return Util;\n})(jQuery);\n\nexport default mrUtil;\n","//\n//\n// sticky.js\n//\n// Initialises the srollMonitor plugin and provides interface to watcher objects\n// for sticking elements to the top of viewport while scrolling\n\nimport jQuery from 'jquery';\nimport scrollMonitor from 'scrollmonitor';\n\nconst mrSticky = (($) => {\n /**\n * Check for scrollMonitor dependency\n * scrollMonitor - https://github.com/stutrek/scrollMonitor\n */\n if (typeof scrollMonitor === 'undefined') {\n throw new Error('mrSticky requires scrollMonitor.js (https://github.com/stutrek/scrollMonitor)');\n }\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'mrSticky';\n const VERSION = '1.2.0';\n const DATA_KEY = 'mr.sticky';\n const EVENT_KEY = `.${DATA_KEY}`;\n const DATA_API_KEY = '.data-api';\n const JQUERY_NO_CONFLICT = $.fn[NAME];\n const NO_OFFSET = 0;\n\n const ClassName = {\n FIXED_TOP: 'position-fixed',\n ABSOLUTE_BOTTOM: 'sticky-bottom',\n FIXED_BOTTOM: 'sticky-viewport-bottom',\n SCROLLED: 'scrolled',\n };\n\n const Css = {\n HEIGHT: 'min-height',\n WIDTH: 'max-width',\n SPACE_TOP: 'top',\n SPACE_BOTTOM: 'bottom',\n };\n\n const Event = {\n LOAD_DATA_API: `load${EVENT_KEY}${DATA_API_KEY}`,\n WINDOW_RESIZE: 'resize',\n ALERT_CLOSED: 'closed.bs.alert',\n };\n\n const Options = {\n BELOW_NAV: 'below-nav',\n TOP: 'top',\n BOTTOM: 'bottom',\n };\n\n const Selector = {\n DATA_ATTR: 'sticky',\n DATA_STICKY: '[data-sticky]',\n NAV_STICKY: 'body > div.navbar-container [data-sticky=\"top\"]',\n ALERT: '.alert-dismissible',\n };\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Sticky {\n constructor(element) {\n const $element = $(element);\n const stickyData = $element.data(Selector.DATA_ATTR);\n const stickyUntil = $element.closest('section') || null;\n this.element = element;\n this.stickBelowNav = stickyData === Options.BELOW_NAV;\n this.stickBottom = stickyData === Options.BOTTOM;\n this.stickyUntil = stickyUntil;\n this.updateNavProperties();\n this.isNavElement = $element.is(this.navElement);\n this.initWatcher($element);\n this.updateCss();\n this.setResizeEvent();\n // Run a calculation immediately to show sticky elements if page starts\n // at a half-scrolled position\n this.onWatcherChange($element);\n this.ticking = false; // for debouncing resize event with RequestAnimationFrame\n }\n\n // getters\n\n static get VERSION() {\n return VERSION;\n }\n\n initWatcher(element) {\n const $element = $(element);\n const notNavElement = !this.isNavElement;\n\n let offset = this.stickBelowNav\n && this.navIsSticky\n && notNavElement\n ? { top: this.navHeight } : NO_OFFSET;\n\n offset = this.stickBottom\n && notNavElement\n ? { bottom: -$element.outerHeight } : offset;\n\n const watcher = scrollMonitor.create(element, offset);\n // ensure that we're always watching the place the element originally was\n watcher.lock();\n\n const untilWatcher = this.stickyUntil !== null ? scrollMonitor.create(\n this.stickyUntil,\n { bottom: -(watcher.height + offset.top) },\n ) : null;\n\n\n this.watcher = watcher;\n this.untilWatcher = untilWatcher;\n this.navHeight = this.navHeight;\n\n // For navs that start at top, stick them immediately to avoid a jump\n if (this.isNavElement && watcher.top === 0 && !this.navIsAbsolute) {\n $element.addClass(ClassName.FIXED_TOP);\n }\n\n watcher.stateChange(() => { this.onWatcherChange($element); });\n\n if (untilWatcher !== null) {\n untilWatcher.exitViewport(() => {\n // If the element is in a section, it will scroll up with the section\n $element.addClass(ClassName.ABSOLUTE_BOTTOM);\n });\n\n untilWatcher.enterViewport(() => {\n $element.removeClass(ClassName.ABSOLUTE_BOTTOM);\n });\n }\n }\n\n onWatcherChange($element) {\n // Add fixed when element leaves via top of viewport or if nav is sitting at top\n $element.toggleClass(\n ClassName.FIXED_TOP,\n this.watcher.isAboveViewport\n || (!this.navIsAbsolute && !this.stickBottom\n && (this.isNavElement && this.watcher.top === 0)),\n );\n\n // Used to apply styles to the nav based on \"scrolled\" class\n // independedly of position-fixed because that class is used for more practical reasons\n // such as avoiding a jump on first scroll etc.\n $element.toggleClass(\n ClassName.SCROLLED,\n this.watcher.isAboveViewport\n && this.isNavElement\n && !this.stickBottom,\n );\n\n // Fix to bottom when element enters via bottom of viewport and has data-sticky=\"bottom\"\n $element.toggleClass(\n ClassName.FIXED_BOTTOM,\n (this.watcher.isFullyInViewport || this.watcher.isAboveViewport) && this.stickBottom,\n );\n\n if (!this.stickBottom) {\n $element.css(\n Css.SPACE_TOP,\n this.watcher.isAboveViewport\n && this.navIsSticky\n && this.stickBelowNav\n ? this.navHeight : NO_OFFSET,\n );\n }\n }\n\n setResizeEvent() {\n // Closing any alerts above the nav will mean we need to recalculate position.\n $(Selector.ALERT).on(Event.ALERT_CLOSED, () => {\n this.onResize();\n });\n\n $(window).on(Event.WINDOW_RESIZE, () => {\n this.onResize();\n });\n }\n\n onResize() {\n if (!this.ticking) {\n window.requestAnimationFrame(() => {\n this.updateCss();\n if (this.isNavElement) {\n this.watcher.unlock();\n this.watcher.recalculateLocation();\n this.watcher.lock();\n }\n this.ticking = false;\n });\n this.ticking = true;\n }\n }\n\n updateCss() {\n const $element = $(this.element);\n\n // Fix width by getting parent's width to avoid element spilling out when pos-fixed\n $element.css(Css.WIDTH, $element.parent().width());\n\n this.updateNavProperties();\n\n const elemHeight = $element.outerHeight();\n const notNavElement = !this.isNavElement;\n\n // Set a min-height to prevent \"jumping\" when sticking to top\n // but not applied to the nav element itself unless it is overlay (absolute) nav\n if ((!this.navIsAbsolute && this.isNavElement) || notNavElement) {\n $element.parent().css(Css.HEIGHT, elemHeight);\n }\n\n if (this.navIsSticky && notNavElement) {\n $element.css(Css.HEIGHT, elemHeight);\n }\n }\n\n updateNavProperties() {\n const $navElement = this.navElement || $(Selector.NAV_STICKY).first();\n this.navElement = $navElement;\n this.navHeight = $navElement.outerHeight();\n this.navIsAbsolute = $navElement.css('position') === 'absolute';\n this.navIsSticky = $navElement.length > 0;\n }\n\n static jQueryInterface() {\n return this.each(function jqEachSticky() {\n const $element = $(this);\n let data = $element.data(DATA_KEY);\n if (!data) {\n data = new Sticky(this);\n $element.data(DATA_KEY, data);\n }\n });\n }\n }\n\n /**\n * ------------------------------------------------------------------------\n * Initialise by data attribute\n * ------------------------------------------------------------------------\n */\n\n $(window).on(Event.LOAD_DATA_API, () => {\n const stickyElements = $.makeArray($(Selector.DATA_STICKY));\n\n /* eslint-disable no-plusplus */\n for (let i = stickyElements.length; i--;) {\n const $sticky = $(stickyElements[i]);\n Sticky.jQueryInterface.call($sticky, $sticky.data());\n }\n });\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n /* eslint-disable no-param-reassign */\n $.fn[NAME] = Sticky.jQueryInterface;\n $.fn[NAME].Constructor = Sticky;\n $.fn[NAME].noConflict = function StickyNoConflict() {\n $.fn[NAME] = JQUERY_NO_CONFLICT;\n return Sticky.jQueryInterface;\n };\n /* eslint-enable no-param-reassign */\n\n return Sticky;\n})(jQuery);\n\nexport default mrSticky;\n","//\n//\n// video.js\n//\n// Initializes iframe videos\n\nimport $ from 'jquery';\nimport mrUtil from './util';\n\n$(document).ready(() => {\n $('.video-cover .video-play-icon').on('click touchstart', function clickedPlay() {\n const $iframe = $(this).closest('.video-cover').find('iframe');\n mrUtil.activateIframeSrc($iframe);\n $(this).parent('.video-cover').addClass('video-cover-playing');\n });\n\n // Disable video cover behaviour on mobile devices to avoid user having to press twice\n const isTouchDevice = 'ontouchstart' in document.documentElement;\n if (isTouchDevice === true) {\n $('.video-cover').each(function activeateMobileIframes() {\n $(this).addClass('video-cover-touch');\n const $iframe = $(this).closest('.video-cover').find('iframe');\n mrUtil.activateIframeSrc($iframe);\n });\n }\n\n //