formstone
Version:
Library of modular front end components.
170 lines (126 loc) • 120 kB
JavaScript
/*! formstone v2.1.3 [formstone.jquery.js] 2025-06-12 | GPL-3.0 License | formstone.it */
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Formstone"] = factory();
else
root["Formstone"] = factory();
})(window, function() {
return /******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/jquery/adaptor.js":
/*!*******************************!*\
!*** ./src/jquery/adaptor.js ***!
\*******************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"utility\": function() { return /* binding */ utility; },\n/* harmony export */ \"widget\": function() { return /* binding */ widget; }\n/* harmony export */ });\n/* harmony import */ var _js_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/utils.js */ \"./src/js/utils.js\");\n\n\nfunction widget(Plugin, Namespace) {\n if (typeof jQuery !== 'undefined') {\n jQuery.fn[Namespace.toLowerCase()] = function(options, ...args) {\n return jQuery(this).each((index, el) => {\n if (!options || (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_0__.isObj)(options)) {\n new Plugin(el, options);\n } else if (el[Namespace] && (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_0__.isFn)(el[Namespace][options])) {\n el[Namespace][options](...args);\n }\n });\n };\n }\n}\n\nfunction utility(Plugin, Namespace) {\n if (typeof jQuery !== 'undefined') {\n jQuery[Namespace.toLowerCase()] = function(method, ...args) {\n if ((0,_js_utils_js__WEBPACK_IMPORTED_MODULE_0__.isFn)(Plugin[method])) {\n return Plugin[method](...args);\n }\n };\n }\n}\n\n//# sourceURL=webpack://Formstone/./src/jquery/adaptor.js?");
/***/ }),
/***/ "./src/jquery/background.js":
/*!**********************************!*\
!*** ./src/jquery/background.js ***!
\**********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_background_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/background.js */ \"./src/js/background.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.widget)(_js_background_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Background');\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_background_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Background');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_background_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/background.js?");
/***/ }),
/***/ "./src/jquery/checkpoint.js":
/*!**********************************!*\
!*** ./src/jquery/checkpoint.js ***!
\**********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_checkpoint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/checkpoint.js */ \"./src/js/checkpoint.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.widget)(_js_checkpoint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'CheckPoint');\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_checkpoint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'CheckPoint');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_checkpoint_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/checkpoint.js?");
/***/ }),
/***/ "./src/jquery/cookie.js":
/*!******************************!*\
!*** ./src/jquery/cookie.js ***!
\******************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_cookie_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/cookie.js */ \"./src/js/cookie.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_cookie_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Cookie');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_cookie_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/cookie.js?");
/***/ }),
/***/ "./src/jquery/index.js":
/*!*****************************!*\
!*** ./src/jquery/index.js ***!
\*****************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Background\": function() { return /* reexport safe */ _background_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]; },\n/* harmony export */ \"CheckPoint\": function() { return /* reexport safe */ _checkpoint_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]; },\n/* harmony export */ \"Cookie\": function() { return /* reexport safe */ _cookie_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]; },\n/* harmony export */ \"Lightbox\": function() { return /* reexport safe */ _lightbox_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; },\n/* harmony export */ \"MediaQuery\": function() { return /* reexport safe */ _mediaquery_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]; },\n/* harmony export */ \"Modal\": function() { return /* reexport safe */ _modal_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"]; },\n/* harmony export */ \"Navigation\": function() { return /* reexport safe */ _navigation_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]; },\n/* harmony export */ \"Swap\": function() { return /* reexport safe */ _swap_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]; },\n/* harmony export */ \"Tabs\": function() { return /* reexport safe */ _tabs_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]; },\n/* harmony export */ \"Utils\": function() { return /* reexport module object */ _js_utils_js__WEBPACK_IMPORTED_MODULE_9__; }\n/* harmony export */ });\n/* harmony import */ var _background_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./background.js */ \"./src/jquery/background.js\");\n/* harmony import */ var _checkpoint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./checkpoint.js */ \"./src/jquery/checkpoint.js\");\n/* harmony import */ var _cookie_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cookie.js */ \"./src/jquery/cookie.js\");\n/* harmony import */ var _lightbox_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lightbox.js */ \"./src/jquery/lightbox.js\");\n/* harmony import */ var _mediaquery_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./mediaquery.js */ \"./src/jquery/mediaquery.js\");\n/* harmony import */ var _modal_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modal.js */ \"./src/jquery/modal.js\");\n/* harmony import */ var _navigation_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./navigation.js */ \"./src/jquery/navigation.js\");\n/* harmony import */ var _swap_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./swap.js */ \"./src/jquery/swap.js\");\n/* harmony import */ var _tabs_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./tabs.js */ \"./src/jquery/tabs.js\");\n/* harmony import */ var _js_utils_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../js/utils.js */ \"./src/js/utils.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://Formstone/./src/jquery/index.js?");
/***/ }),
/***/ "./src/jquery/lightbox.js":
/*!********************************!*\
!*** ./src/jquery/lightbox.js ***!
\********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_lightbox_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/lightbox.js */ \"./src/js/lightbox.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.widget)(_js_lightbox_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Lightbox');\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_lightbox_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Lightbox');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_lightbox_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/lightbox.js?");
/***/ }),
/***/ "./src/jquery/mediaquery.js":
/*!**********************************!*\
!*** ./src/jquery/mediaquery.js ***!
\**********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_mediaquery_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/mediaquery.js */ \"./src/js/mediaquery.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_mediaquery_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'MediaQuery');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_mediaquery_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/mediaquery.js?");
/***/ }),
/***/ "./src/jquery/modal.js":
/*!*****************************!*\
!*** ./src/jquery/modal.js ***!
\*****************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_modal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/modal.js */ \"./src/js/modal.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.widget)(_js_modal_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Modal');\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_modal_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Modal');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_modal_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/modal.js?");
/***/ }),
/***/ "./src/jquery/navigation.js":
/*!**********************************!*\
!*** ./src/jquery/navigation.js ***!
\**********************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_navigation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/navigation.js */ \"./src/js/navigation.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.widget)(_js_navigation_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Navigation');\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_navigation_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Navigation');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_navigation_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/navigation.js?");
/***/ }),
/***/ "./src/jquery/swap.js":
/*!****************************!*\
!*** ./src/jquery/swap.js ***!
\****************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_swap_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/swap.js */ \"./src/js/swap.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.widget)(_js_swap_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Swap');\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_swap_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Swap');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_swap_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/swap.js?");
/***/ }),
/***/ "./src/jquery/tabs.js":
/*!****************************!*\
!*** ./src/jquery/tabs.js ***!
\****************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _js_tabs_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/tabs.js */ \"./src/js/tabs.js\");\n/* harmony import */ var _adaptor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./adaptor.js */ \"./src/jquery/adaptor.js\");\n\n\n\n\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.widget)(_js_tabs_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Tabs');\n(0,_adaptor_js__WEBPACK_IMPORTED_MODULE_1__.utility)(_js_tabs_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"], 'Tabs');\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (_js_tabs_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://Formstone/./src/jquery/tabs.js?");
/***/ }),
/***/ "./src/js/background.js":
/*!******************************!*\
!*** ./src/js/background.js ***!
\******************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mediaquery_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mediaquery.js */ \"./src/js/mediaquery.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./src/js/utils.js\");\n\n\n\n// Class\n\nclass Background {\n\n static #_guid = 1;\n\n static #_defaults = {\n // alt: '',\n autoPlay: true,\n lazy: false,\n lazyOffset: '100px',\n loop: true,\n mute: true,\n source: null,\n youtubeOptions: {}\n };\n\n //\n\n static defaults(options) {\n this.#_defaults = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.extend)(true, this.#_defaults, options);\n }\n\n static construct(selector, options) {\n let targets = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.select)(selector);\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.iterate)(targets, (el) => {\n if (!el.Background) {\n new Background(el, options);\n }\n });\n\n return targets;\n }\n\n //\n\n constructor(el, options) {\n if (el.Background) {\n console.warn('Background: Instance already exists', el);\n return;\n }\n\n // Parse JSON Options\n\n let optionsData = {};\n let dataset = el.dataset;\n\n try {\n optionsData = JSON.parse(dataset.backgroundOptions || '{}');\n } catch (e) {\n console.warn('Background: Error parsing options JSON', el);\n }\n\n // Internal Data\n\n Object.assign(this, (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.extend)(true, this.constructor.#_defaults, options || {}, optionsData));\n\n this.el = el;\n this.guid = this.constructor.#_guid++;\n this.guidClass = `fs-background-element-${this.guid}`;\n this.layerGuid = 0;\n\n //\n\n this.container = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('div');\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.addClass)(this.container, 'fs-background-container');\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.setAttr)(this.container, {\n 'aria-hidden': 'true',\n 'role': 'presentation',\n 'tabindex': '-1',\n });\n\n el.append(this.container);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.addClass)(el, 'fs-background', this.guidClass);\n\n if (this.lazy) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.addClass)(el, 'fs-background-lazy');\n\n this.observer = new IntersectionObserver((entries, observer) => {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.iterate)(entries, (entry) => {\n this.#observe(entry);\n });\n }, {\n // root: this.parentEl || null,\n root: null,\n threshold: 0,\n rootMargin: `0px 0px ${this.lazyOffset} 0px`\n });\n\n this.observer.observe(el);\n } else {\n this.#initialLoad(this.source);\n }\n\n el.Background = this;\n }\n\n //\n\n destroy() {\n this.container.remove();\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.removeClass)(this.el, 'fs-background', this.guidClass);\n\n this.el.Background = null;\n\n delete this.el.Background;\n }\n\n //\n\n #observe(entry) {\n if (entry.isIntersecting) {\n this.observer.unobserve(this.el);\n this.observer = null;\n this.#initialLoad(this.source);\n }\n }\n\n #initialLoad() {\n let source = this.source;\n this.source = '';\n this.load(source);\n }\n\n //\n\n load(source) {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.addClass)(this.el, 'fs-background-loaded');\n\n if (source !== this.source) {\n this.source = source;\n this.sources = null;\n this.responsive = false;\n\n this.player = null;\n this.playerReady = true;\n this.playing = false;\n\n this.isVideo = ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isObj)(source) && !!(source.mp4 || source.ogg || source.webm));\n this.isYouTube = (!this.isVideo && (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isObj)(source) && !!source.youtube);\n this.isImage = (!this.isVideo && !this.isYouTube);\n\n // Load Image\n\n if (this.isImage) {\n let newSource = source;\n\n // Responsive image handling\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isObj)(source)) {\n let sources = [];\n let keys = [];\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.iterate)(Object.keys(source), (key) => {\n keys.push(key);\n });\n\n keys.sort((a, b) => {\n return parseInt(a, 10) - parseInt(b, 10);\n });\n\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n let width = parseInt(key, 10);\n let mq = `(min-width: ${width}px)`;\n\n if (i + 1 < keys.length) {\n let maxWidth = parseInt(keys[i + 1], 10) - 1;\n\n mq = `(min-width: ${width}px) and (max-width: ${maxWidth}px)`;\n }\n\n sources.push({\n width: width,\n url: source[key],\n // mq: window.matchMedia(`(min-width: ${mq}px)`)\n mediaquery: _mediaquery_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].bind(`background-${this.guid}-${mq}`, mq, {\n enter: () => {\n this.#loadImage(source[key]);\n }\n })\n });\n }\n\n this.sources = sources; // TODO do we need to track this way?\n } else {\n // Single image\n this.#loadImage(newSource);\n }\n }\n\n // Load Video\n\n if (this.isVideo) {\n this.#loadVideo(source);\n }\n\n // Load YouTube\n\n if (this.isYouTube) {\n this.#loadYouTube(source);\n }\n } else {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.trigger)(this.el, 'background:loaded');\n }\n }\n\n //\n\n #loadImage(source) {\n this.layerGuid++;\n\n let media = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('div');\n\n media.ariaHidden = true;\n media.className = `fs-background-media fs-background-image`; // fs-background-layer-${this.layerGuid}`;\n media.style.opacity = 0;\n media.style.backgroundImage = `url(${source})`;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.setAttr)(media, 'data-background-layer', this.layerGuid);\n\n this.container.append(media);\n\n let image = new Image();\n\n //\n\n image.onload = () => {\n this.#onLoad(media);\n };\n\n image.src = source;\n\n this.source = source;\n }\n\n //\n\n #loadVideo(source) {\n if (source.poster) {\n this.#loadImage(source.poster);\n }\n\n this.layerGuid++;\n\n let media = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('div');\n let video = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('video');\n\n media.ariaHidden = true;\n media.className = 'fs-background-media fs-background-video';\n media.style.opacity = 0;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.setAttr)(media, 'data-background-layer', this.layerGuid);\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.setAttr)(video, {\n 'playsinline': '',\n 'playsinline': 'true',\n 'preload': 'auto',\n 'role': 'presentation',\n 'tabindex': '-1',\n });\n\n if (this.loop) {\n video.loop = true;\n }\n if (this.mute) {\n video.muted = true;\n }\n if (this.autoPlay) {\n video.autoplay = true;\n }\n\n if (source.webm) {\n let src = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('source');\n src.type = 'video/webm';\n src.src = source.webm;\n\n video.append(src);\n }\n if (source.mp4) {\n let src = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('source');\n src.type = 'video/mp4';\n src.src = source.mp4;\n\n video.append(src);\n }\n if (source.ogg) {\n let src = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('source');\n src.type = 'video/ogg';\n src.src = source.ogg;\n\n video.append(src);\n }\n\n //\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.once)(video, 'loadeddata', (e) => {\n this.#onLoad(media);\n\n if (this.autoPlay) {\n this.play();\n }\n });\n\n media.append(video);\n this.container.append(media);\n\n this.source = source;\n }\n\n //\n\n #loadYouTube(source) {\n // let parts = source.youtube.match(/(?:youtube\\.com\\/(?:[^\\/]+\\/.+\\/|(?:v|e(?:mbed)?)\\/|.*[?&]v=)|youtu\\.be\\/)([^\"&?\\/ ]{11})/i);\n let parts = source.youtube.match(/(?:(?:youtube\\.com|youtube-nocookie\\.com)\\/(?:[^\\/]+\\/.+\\/|(?:v|e(?:mbed)?)\\/|.*[?&]v=)|youtu\\.be\\/)([^\"&?\\/ ]{11})/i);\n\n this.youTubeId = parts[1];\n\n let ytURL = 'youtube.com';\n\n if (!source.poster) {\n // source.poster = '//img.youtube.com/vi/' + this.youTubeId + '/0.jpg';\n source.poster = `//img.${ytURL}/vi/${this.youTubeId}/maxresdefault.jpg`;\n }\n\n this.#loadImage(source.poster);\n\n this.layerGuid++;\n\n if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.select)(`script[src*=\"${ytURL}/iframe_api\"]`).length) {\n let script = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('script');\n script.src = `//www.${ytURL}/iframe_api`;\n document.head.append(script);\n }\n\n if (!YouTubeReady) {\n YouTubeQueue.push({\n el: this,\n source: source\n });\n } else {\n let guid = `fs-background-${this.guid}-${this.layerGuid}`;\n let media = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('div');\n let video = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.element)('div');\n\n video.id = guid;\n\n media.ariaHidden = true;\n media.className = 'fs-background-media fs-background-embed';\n media.style.opacity = 0;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.setAttr)(media, 'data-background-layer', this.layerGuid);\n\n media.append(video);\n this.container.append(media);\n\n let options = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.extend)(true, {}, {\n controls: 0,\n rel: 0,\n showinfo: 0,\n wmode: 'transparent',\n enablejsapi: 1,\n version: 3,\n playerapiid: guid,\n loop: (this.loop) ? 1 : 0,\n // autoplay: 1,\n mute: 1,\n origin: `${window.location.protocol}//${window.location.host}`\n }, this.youtubeOptions, {\n autoplay: 1 // Must be enabled for initial API callbacks to fire\n });\n\n this.player = new window.YT.Player(guid, {\n host: `https://www.${ytURL.replace('.com', '-nocookie.com')}`,\n videoId: this.youTubeId,\n playerVars: options,\n events: {\n onReady: (e) => {\n // console.log('onReady', e);\n\n let iframe = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.select)('iframe', this.container);\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.setAttr)(iframe, {\n 'role': 'presentation',\n 'tabindex': '-1',\n });\n\n this.playerReady = true;\n // data.player.setPlaybackQuality('highres');\n\n\n\n if (this.mute) {\n this.player.mute();\n }\n\n if (this.autoPlay) {\n this.player.playVideo();\n } else {\n this.player.pauseVideo();\n }\n\n // TODO trigger ready event?\n },\n onStateChange: (e) => {\n // console.log('onStateChange', e);\n\n // -1 = unstarted\n // 0 = ended\n // 1 = playing\n // 2 = paused\n // 3 = buffering\n // 4 =\n // 5 = cued\n\n if (!this.playing && e.data === window.YT.PlayerState.PLAYING) {\n this.playing = true;\n\n this.#onLoad(media);\n } else if (this.loop && this.playing && e.data === window.YT.PlayerState.ENDED) {\n // fix looping option\n this.player.playVideo();\n }\n\n // Fix for Safari's overly secure security settings\n // this.el.find(Classes.embed)\n // .addClass(RawClasses.ready);\n },\n onPlaybackQualityChange: (e) => {\n // console.log('onPlaybackQualityChange', e);\n },\n onPlaybackRateChange: (e) => {\n // console.log('onPlaybackRateChange', e);\n },\n onError: (e) => {\n // console.log('onError', e);\n },\n onApiChange: (e) => {\n // console.log('onApiChange', e);\n }\n }\n });\n }\n }\n\n //\n\n play() {\n if (this.isYouTube) {\n if (this.playerReady) {\n this.player.playVideo();\n } else {\n this.autoPlay = true;\n }\n } else if (this.isVideo) {\n let video = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.select)('video', this.container);\n\n if (video.length) {\n video[0].play();\n }\n }\n\n // TODO trigger play event?\n\n this.playing = true;\n }\n\n pause() {\n if (this.isYouTube) {\n if (this.playerReady) {\n this.player.pauseVideo();\n } else {\n this.autoPlay = false;\n }\n } else if (this.video) {\n let video = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.select)('video', this.container);\n\n if (video.length) {\n video[0].pause();\n }\n }\n\n // TODO trigger pause event?\n\n this.playing = false;\n }\n\n mute() {\n if (this.isYouTube && this.playerReady) {\n this.player.mute();\n // this.player.setVolume(0);\n } else if (this.video) {\n let video = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.select)('video', this.container);\n\n if (video.length) {\n video[0].muted = true;\n }\n }\n\n // TODO trigger mute event?\n\n this.mute = true;\n }\n\n // Mute / Unmute is now blocked unless the user interacts with the video\n\n unmute() {\n if (this.isYouTube && this.playerReady) {\n this.player.unMute();\n // this.player.setVolume(100);\n\n if (this.playing) {\n this.player.playVideo();\n }\n } else if (this.video) {\n let video = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.select)('video', this.container);\n\n if (video.length) {\n video[0].muted = false;\n }\n }\n\n // TODO trigger unmute event?\n\n this.mute = false;\n }\n\n // TODO unload method and event?\n\n // TODO set background video volume and event?\n\n //\n\n #onLoad(media) {\n let layer = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.getAttr)(media, 'data-background-layer');\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.once)(media, 'transitionend', (e) => {\n if (this.onLoadTimer) {\n clearTimeout(this.onLoadTimer);\n this.onLoadTimer = null;\n }\n\n this.onLoadTimer = setTimeout(() => {\n let extra = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.select)(`div:not([data-background-layer=\"${layer}\"]):not([data-background-layer=\"${this.layerGuid}\"])`, this.container);\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.iterate)(extra, (node) => {\n node.remove();\n });\n }, 500);\n });\n\n media.style.opacity = 1;\n\n // TODO handle errors and trigger events?\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.trigger)(this.el, 'background:loaded');\n }\n\n};\n\n// YouTube Helper\n\nlet YouTubeReady = false;\nlet YouTubeQueue = [];\n\nfunction onYouTubeReady() {\n YouTubeReady = true;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.iterate)(YouTubeQueue, (item) => {\n item.el.load(item.source);\n });\n\n YouTubeQueue = [];\n}\n\nlet originalYouTubeCallback = ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isFn)(window.onYouTubeIframeAPIReady)) ? window.onYouTubeIframeAPIReady : null;\n\nwindow.onYouTubeIframeAPIReady = () => {\n if (originalYouTubeCallback) {\n originalYouTubeCallback.call();\n }\n\n onYouTubeReady();\n};\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Background);\n\n//# sourceURL=webpack://Formstone/./src/js/background.js?");
/***/ }),
/***/ "./src/js/checkpoint.js":
/*!******************************!*\
!*** ./src/js/checkpoint.js ***!
\******************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./src/js/utils.js\");\n\n\n// Class\n\nclass CheckPoint {\n\n static #_guid = 1;\n\n static #_defaults = {\n // intersect: 'bottom',\n offset: '0px',\n reverse: false\n };\n\n static defaults(options) {\n this.#_defaults = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.extend)(true, this.#_defaults, options);\n }\n\n static construct(selector, options) {\n let targets = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)(selector);\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.iterate)(targets, (el) => {\n if (!el.CheckPoint) {\n new CheckPoint(el, options);\n }\n });\n\n return targets;\n }\n\n //\n\n constructor(el, options) {\n if (el.CheckPoint) {\n console.warn('Checkpoint: Instance already exists', el);\n return;\n }\n\n // Parse JSON Options\n\n let optionsData = {};\n let dataset = el.dataset;\n\n try {\n optionsData = JSON.parse(dataset.checkpointOptions || '{}');\n } catch (e) {\n console.warn('Checkpoint: Error parsing options JSON', el);\n }\n\n // Internal Data\n\n Object.assign(this, (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.extend)(true, this.constructor.#_defaults, options || {}, optionsData));\n\n this.el = el;\n this.guid = this.constructor.#_guid++;\n this.guidClass = `fs-checkpoint-element-${this.guid}`;\n\n this.enabled = false;\n this.active = false;\n this.hasActived = false;\n this.parent = dataset.checkpointParent || null;\n this.parentEl = this.parent ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)(this.parent)[0] : null;\n this.trigger = dataset.checkpointTrigger || dataset.checkpointContainer || null;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.addClass)(this.el, this.guidClass);\n\n this.target = this.trigger || `.${this.guidClass}`;\n this.targetEl = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)(this.target);\n\n // this.intersect = dataset.checkpointIntersect || this.intersect;\n this.offset = dataset.checkpointOffset || this.offset;\n\n this.margin = `0px 0px -${this.offset} 0px`;\n this.edge = parseInt(this.offset, 10);\n this.percent = this.offset.includes('%') ? (this.edge / 100) : null;\n\n this.observer = new IntersectionObserver((entries, observer) => {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.iterate)(entries, (entry) => {\n this.#observe(entry);\n });\n }, {\n root: this.parentEl || document,\n threshold: 0,\n rootMargin: this.margin\n });\n\n this.enable();\n\n el.CheckPoint = this;\n }\n\n destroy() {\n this.disable();\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.removeClass)(this.el, this.guidClass);\n\n this.observer = null;\n\n this.el.CheckPoint = null;\n\n delete this.el.CheckPoint;\n }\n\n //\n\n #observe(entry) {\n let height = this.parentEl ? this.parentEl.innerHeight : window.innerHeight;\n let edge = height - (this.percent ? (height * this.percent) : this.edge);\n\n if (entry.isIntersecting || entry.boundingClientRect.top < edge) {\n this.activate();\n } else {\n this.deactivate();\n }\n }\n\n //\n\n enable() {\n if (this.enabled) {\n return;\n }\n\n this.enabled = true;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.addClass)(this.el, 'fs-checkpoint');\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.iterate)(this.targetEl, (el) => {\n this.observer.observe(el);\n });\n }\n\n disable() {\n if (!this.enabled) {\n return;\n }\n\n this.deactivate();\n\n this.enabled = false;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.removeClass)(this.el, 'fs-checkpoint', 'fs-checkpoint-active');\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.iterate)(this.targetEl, (el) => {\n this.observer.unobserve(el);\n });\n }\n\n //\n\n activate() {\n if (!this.enabled || this.active) {\n return;\n }\n\n this.active = true;\n this.hasActived = true;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.addClass)(this.el, 'fs-checkpoint-active');\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.trigger)(this.el, 'checkpoint:activate', {});\n }\n\n deactivate() {\n if (!this.enabled || !this.active || (!this.reverse && this.hasActived)) {\n return;\n }\n\n this.active = false;\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.removeClass)(this.el, 'fs-checkpoint-active');\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.trigger)(this.el, 'checkpoint:deactivate', {});\n }\n\n};\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (CheckPoint);\n\n//# sourceURL=webpack://Formstone/./src/js/checkpoint.js?");
/***/ }),
/***/ "./src/js/cookie.js":
/*!**************************!*\
!*** ./src/js/cookie.js ***!
\**************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./src/js/utils.js\");\n\n\n// Class\n\nclass Cookie {\n\n static #_defaults = {\n domain: null,\n expires: 604800000, // 7 days\n path: null,\n samesite: 'Lax',\n secure: null\n };\n\n static defaults(options) {\n this.#_defaults = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.extend)(true, this.#_defaults, options);\n }\n\n //\n\n static set(key, value, options) {\n let expiration = false;\n let date = new Date();\n\n options = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.extend)(true, this.#_defaults, options || {});\n\n // Check Expiration Date\n\n if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.type)(options.expires) === 'number') {\n date.setTime(date.getTime() + options.expires);\n expiration = date.toGMTString();\n }\n\n let domain = (options.domain) ? '; domain=' + options.domain : '';\n let expires = (expiration) ? '; expires=' + expiration : '';\n let maxAge = (expiration) ? '; max-age=' + (options.expires / 1000) : ''; // to seconds\n let path = (options.path) ? '; path=' + options.path : '';\n let samesite = (options.samesite) ? '; samesite=' + options.samesite : '';\n let secure = (options.secure) ? '; secure' : '';\n\n // Set Cookie\n\n document.cookie = `${key}=${value}${expires}${maxAge}${domain}${path}${samesite}${secure}`;\n }\n\n static get(key) {\n let keyString = `${key}=`;\n let cookies = document.cookie.split(';');\n\n for (var i = 0; i < cookies.length; i++) {\n let cookie = cookies[i].trim();\n\n if (cookie.indexOf(keyString) === 0) {\n return cookie.substring(keyString.length, cookie.length);\n }\n }\n\n return null;\n }\n\n static delete(key, options) {\n this.set(key, '', (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.extend)({}, options, {\n expires: -604800000 // -7 days\n }));\n }\n};\n\n// Export\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Cookie);\n\n//# sourceURL=webpack://Formstone/./src/js/cookie.js?");
/***/ }),
/***/ "./src/js/lightbox.js":
/*!****************************!*\
!*** ./src/js/lightbox.js ***!
\****************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ \"./src/js/utils.js\");\n// import MediaQuery from './mediaquery.js';\n\n\n// Accessibility based on https://plousia.com/blog/how-create-accessible-mobile-menu\n\n// Formatters\n\nfunction formatYouTube(parts) {\n return '//www.youtube.com/embed/' + parts[2];\n}\n\nfunction formatVimeo(parts) {\n return '//player.vimeo.com/video/' + parts[3];\n}\n\n// Class\n\nclass Lightbox {\n\n static #_guid = 1;\n\n static #_defaults = {\n direction: document.dir,\n customClass: '',\n fileTypes: /\\.(jpg|sjpg|jpeg|png|gif|webp)/i,\n // iframeWidth: '900px',\n // loop: false,\n threshold: 50,\n ordinal: true,\n templates: {\n container: `\n<div class=\"fs-lightbox\" role=\"dialog\" aria-modal=\"true\">\n <div class=\"fs-lightbox-overlay\"></div>\n <div class=\"fs-lightbox-loading\">[loading]</div>\n <button type=\"button\" class=\"fs-lightbox-close\" aria-label=\"Close\">[close]</button>\n <div class=\"fs-lightbox-container\"></div>\n <button type=\"button\" class=\"fs-lightbox-control fs-lightbox-control_previous\" aria-label=\"Previous\">[previous]</button>\n <button type=\"button\" class=\"fs-lightbox-control fs-lightbox-control_next\" aria-label=\"Next\">[next]</button>\n</div>`,\n // zoom: `\n // <button type=\"button\" class=\"fs-lightbox-zoom fs-lightbox-zoom_in\" aria-label=\"Zoom In\">[zoomIn]</button>\n // <button type=\"button\" class=\"fs-lightbox-zoom fs-lightbox-zoom_out\" aria-label=\"Zoom Out\">[zoomOut]</button>`,\n close: `<span class=\"fs-lightbox-sr\">Close</span><svg viewBox=\"-6 -6 24 24\" fill=\"currentColor\"><path d=\"M7.314 5.9l3.535-3.536A1 1 0 1 0 9.435.95L5.899 4.485 2.364.95A1 1 0 1 0 .95 2.364l3.535 3.535L.95 9.435a1 1 0 1 0 1.414 1.414l3.535-3.535 3.536 3.535a1 1 0 1 0 1.414-1.414L7.314 5.899z\"></path></svg>`,\n loading: '<span class=\"fs-lightbox-sr\">Loading</span>',\n previous: `<span class=\"fs-lightbox-sr\">Previous</span><svg viewBox=\"-5 -5 24 24\" fill=\"currentColor\"><path d=\"M3.414 7.657l3.95 3.95A1 1 0 0 1 5.95 13.02L.293 7.364a.997.997 0 0 1 0-1.414L5.95.293a1 1 0 1 1 1.414 1.414l-3.95 3.95H13a1 1 0 0 1 0 2H3.414z\"></path></svg>`,\n next: `<span class=\"fs-lightbox-sr\">Next</span><svg viewBox=\"-5 -5 24 24\" fill=\"currentColor\"><path d=\"M10.586 5.657l-3.95-3.95A1 1 0 0 1 8.05.293l5.657 5.657a.997.997 0 0 1 0 1.414L8.05 13.021a1 1 0 1 1-1.414-1.414l3.95-3.95H1a1 1 0 1 1 0-2h9.586z\"></path></svg>`,\n ordinal: `<span class=\"current\">[current]</span> of <span class=\"total\">[total]</span>`\n // zoomIn: `<span class=\"fs-lightbox-sr\">Zoom In</span><svg viewBox=\"-2.5 -2.5 24 24\" fill=\"currentColor\"><path d=\"M8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12zm6.32-1.094l3.58 3.58a1 1 0 1 1-1.415 1.413l-3.58-3.58a8 8 0 1 1 1.414-1.414zM9 7h2a1 1 0 0 1 0 2H9v2a1 1 0 0 1-2 0V9H5a1 1 0 1 1 0-2h2V5a1 1 0 1 1 2 0v2z\"></path></svg>`,\n // zoomOut: `<span class=\"fs-lightbox-sr\">Zoom Out</span><svg viewBox=\"-2.5 -2.5 24 24\" fill=\"currentColor\"><path d=\"M8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12zm6.32-1.094l3.58 3.58a1 1 0 1 1-1.415 1.413l-3.58-3.58a8 8 0 1 1 1.414-1.414zM5 7h6a1 1 0 0 1 0 2H5a1 1 0 1 1 0-2z\"></path></svg>`\n },\n videoProviders: {\n youtube: {\n pattern: /^(?:(?:https|http):\\/\\/)?(?:www\\.)?(?:youtube\\.com|youtu\\.be|youtube-nocookie\\.com).*?(?:\\/|v\\/|u\\/|embed\\/|shorts\\/|watch\\?v=|(?<username>user\\/))(?<id>[\\w\\-]{11})(?:\\?|&|$)/,\n format: formatYouTube\n },\n vimeo: {\n pattern: /(?:www\\.|player\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|album\\/(\\d+)\\/video\\/|video\\/|)(\\d+)(?:$|\\/|\\?)/,\n format: formatVimeo\n }\n }\n };\n\n static defaults(options) {\n this.#_defaults = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.extend)(true, this.#_defaults, options);\n }\n\n static construct(selector, options) {\n let targets = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)(selector);\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.iterate)(targets, (el) => {\n if (!el.Lightbox) {\n new Lightbox(el, options);\n }\n });\n\n return targets;\n }\n\n //\n\n constructor(el, options) {\n if (el.Lightbox) {\n console.warn('Lightbox: Instance already exists', el);\n return;\n }\n\n // Parse JSON Options\n\n let optionsData = {};\n let dataset = el.dataset;\n\n try {\n optionsData = JSON.parse(dataset.lightboxOptions || '{}');\n } catch (e) {\n console.warn('Lightbox: Error parsing options JSON', el);\n }\n\n // Internal Data\n\n Object.assign(this, (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.extend)(true, this.constructor.#_defaults, options || {}, optionsData));\n\n this.el = el;\n this.guid = this.constructor.#_guid++;\n this.guidClass = `fs-lightbox-element-${this.guid}`;\n this.gallery = dataset.lightboxGallery || null;\n this.isOpen = false;\n this.isTouching = false;\n this.isRTL = this.direction == 'rtl';\n\n //\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.addClass)(this.el, this.guidClass);\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.on)(this.el, 'click', this.#onClick);\n\n el.Lightbox = this;\n }\n\n //\n\n destroy() {\n this.close();\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.removeClass)(this.el, this.guidClass);\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.off)(this.el, 'click', this.#onClick);\n\n this.el.Lightbox = null;\n\n delete this.el.Lightbox;\n }\n\n //\n\n open(index) {\n if (this.isOpen) {\n return;\n }\n\n this.index = index;\n\n this.#buildItems();\n\n this.maxIndex = this.items.length - 1;\n\n this.listeners = {\n 'close': this.#onClose(),\n 'next': this.#onNext(),\n 'previous': this.#onPrevious(),\n 'container': this.#onContainerClick(),\n 'keydown': this.#onKeyDown(),\n 'pointerdown': this.#onPointerDown(),\n 'pointermove': this.#onPointerMove(),\n 'pointerup': this.#onPointerUp(),\n // 'zoomin': this.#onZoomIn(),\n // 'zoomout': this.#onZoomOut(),\n };\n\n this.#draw();\n\n this.#setPositions();\n\n this.#hideSiblings();\n\n setTimeout(() => {\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.addClass)(this.lightboxEl, 'fs-lightbox-open');\n\n this.isOpen = true;\n\n // this.lightboxEl.focus();\n this.closeEl.focus();\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.trigger)(window, 'lightbox:open', {\n el: this.el\n });\n }, 10);\n }\n\n close() {\n if (!this.isOpen) {\n return;\n }\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.removeClass)(this.lightboxEl, 'fs-lightbox-open');\n\n this.#showSiblings();\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.off)(window, 'keydown', this.listeners.keydown);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.off)(window, 'lightbox:previous', this.listeners.previous);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.off)(window, 'lightbox:next', this.listeners.next);\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.off)(window, 'lightbox:close', this.listeners.close);\n\n // off(select('.fs-lightbox-previous', this.el), 'click', this.listeners.previous);\n // off(select('.fs-lightbox-next', this.el), 'click', this.listeners.next);\n\n let cb = (e) => {\n if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.hasClass)(e.target, 'fs-lightbox')) {\n return;\n }\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.iterate)(this.items, (item, index) => {\n if (item.isElement) {\n item.targetEl.append(...item.frameEl.childNodes);\n }\n });\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.off)(this.lightboxEl, 'transitionend', cb);\n\n this.lightboxEl.remove();\n\n this.isOpen = false;\n\n this.el.focus();\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.trigger)(window, 'lightbox:close', {\n el: this.el\n });\n };\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.on)(this.lightboxEl, 'transitionend', cb);\n }\n\n //\n\n next() {\n this.index++;\n this.#checkIndex();\n\n this.#setPositions();\n }\n\n previous() {\n this.index--;\n this.#checkIndex();\n\n this.#setPositions();\n }\n\n jump(index) {\n this.index = index;\n this.#checkIndex();\n\n this.#setPositions();\n }\n\n //\n\n #buildItems() {\n this.selector = this.gallery ? `[data-lightbox-gallery=\"${this.gallery}\"]` : `.${this.guidClass}`;\n\n let targets = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)(this.selector);\n\n this.items = [];\n\n (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.iterate)(targets, (el, i) => {\n if (el.tagName === 'A') {\n let url = window.location.href.replace(window.location.hash, '');\n let hash = el.hash;\n let source = el.href.replace(hash, '');\n let type = el.dataset.lightboxType || '';\n let isImage = (type === 'image') || this.#checkImage(source);\n let isVideo = (type === 'video') || !!this.#checkVideo(source);\n let isElement = (type === 'element') || (!isImage && !isVideo && (source.indexOf(url) > -1 && hash.substr(0, 1) === '#'));\n let isIframe = (type === 'url') || (!isImage && !isVideo && !isElement && source.substr(0, 4) === 'http');\n\n if (!this.index && el == this.el) {\n this.index = i;\n }\n\n this.items.push({\n index: i,\n source: el.href,\n hash: hash,\n // type: type,\n isLoaded: false,\n isImage: isImage,\n isVideo: isVideo,\n isIframe: isIframe,\n isElement: isElement,\n caption: el.dataset.lightboxCaption || (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.getAttr)(el, 'title'),\n // zoomed: false,\n });\n }\n });\n }\n\n //\n\n #draw() {\n let html = this.templates.container\n .replace('[close]', this.templates.close)\n .replace('[loading]', this.templates.loading)\n .replace('[previous]', this.templates.previous)\n .replace('[next]', this.templates.next);\n\n document.body.insertAdjacentHTML('beforeend', html);\n\n this.lightboxEl = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)('.fs-lightbox')[0];\n this.overlayEl = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)('.fs-lightbox-overlay', this.lightboxEl)[0];\n this.closeEl = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)('.fs-lightbox-close', this.lightboxEl)[0];\n this.loadingEl = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)('.fs-lightbox-loading', this.lightboxEl)[0];\n this.containerEl = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.select)('.fs-lightbox-