';$body.appendChild($modal);$modalInner = $modal.querySelector('.inner');$modalImage = $modal.querySelector('img');$modalImage.addEventListener('load', function() {$modalImage.style.setProperty('--natural-width', $modalImage.naturalWidth + 'px');$modalImage.style.setProperty('--natural-height', $modalImage.naturalHeight + 'px');$modal.classList.add('done');setTimeout(function() {if (!$modal.classList.contains('visible'))return;$modal.classList.add('loaded');setTimeout(function() {$modal.classList.remove('switching', 'from-left', 'from-right', 'done');}, _this.delay);}, ($modal.classList.contains('switching') ? 0 : _this.delay));});$modalImage.addEventListener('contextmenu', function() {if (_this.protect)event.preventDefault();}, true);$modalImage.addEventListener('dragstart', function() {if (_this.protect)event.preventDefault();}, true);$modalCaption = $modal.querySelector('.caption');$modalNext = $modal.querySelector('.next');$modalPrevious = $modal.querySelector('.previous');switch (client.browser) {case 'safari':case 'firefox':$modalInner.style.boxShadow = 'none';break;default:break;}$modal.show = function(index, offset, direction) {var item,i, j, found;if (_this.locked)return;if (typeof index != 'number')index = _this.current;if (typeof offset == 'number') {found = false;j = 0;for (j = 0; j < _this.$links.length; j++) {index += offset;if (index < 0)index = _this.$links.length - 1; else if (index >= _this.$links.length)index = 0;if (index == _this.current)break;item = _this.$links.item(index);if (!item)break;if (item.dataset.lightboxIgnore != '1') {found = true;break;}}if (!found)return;} else {if (index < 0)index = _this.$links.length - 1; else if (index >= _this.$links.length)index = 0;if (index == _this.current)return;item = _this.$links.item(index);if (!item)return;if (item.dataset.lightboxIgnore == '1')return;}if (client.mobile)_this.zoomIntervalId = setInterval(function() {_this.zoomHandler();}, 250);_this.locked = true;if (_this.current !== null) {$modal.classList.remove('loaded');$modal.classList.add('switching');switch (direction) {case -1:$modal.classList.add('from-left');break;case 1:$modal.classList.add('from-right');break;default:break;}setTimeout(function() {_this.current = index;$modalImage.src = item.href;if (_this.captions)$modalCaption.innerHTML = item.querySelector('[data-caption]').dataset.caption;setTimeout(function() {$modal.focus();_this.locked = false;}, _this.delay);}, _this.delay);} else {_this.current = index;$modalImage.src = item.href;if (_this.captions)$modalCaption.innerHTML = item.querySelector('[data-caption]').dataset.caption;$modal.classList.add('visible');setTimeout(function() {$modal.focus();_this.locked = false;}, _this.delay);}};$modal.hide = function() {if (_this.locked)return;if (!$modal.classList.contains('visible'))return;_this.locked = true;$modal.classList.remove('visible');$modal.classList.remove('loaded');$modal.classList.remove('switching', 'from-left', 'from-right', 'done');clearInterval(_this.zoomIntervalId);setTimeout(function() {$modalImage.src = '';_this.locked = false;$body.focus();_this.current = null;}, _this.delay);};$modal.next = function(direction) {$modal.show(null, 1, direction);};$modal.previous = function(direction) {$modal.show(null, -1, direction);};$modal.first = function() {$modal.show(0);};$modal.last = function() {$modal.show(_this.$links.length - 1);};$modalInner.addEventListener('touchstart', function(event) {if (!_this.navigation)return;if (event.touches.length > 1)return;dragStart = {x: event.touches[0].clientX,y: event.touches[0].clientY};});$modalInner.addEventListener('touchmove', function(event) {var dx, dy;if (!_this.navigation)return;if (!dragStart|| event.touches.length > 1)return;dragEnd = {x: event.touches[0].clientX,y: event.touches[0].clientY};dx = dragStart.x - dragEnd.x;dy = dragStart.y - dragEnd.y;if (Math.abs(dx) < 50)return;event.preventDefault();if (dx > 0)$modal.next(-1); else if (dx < 0)$modal.previous(1);});$modalInner.addEventListener('touchend', function(event) {if (!_this.navigation)return;dragStart = null;dragEnd = null;});$modal.addEventListener('click', function(event) {if (event.target&& (event.target.tagName == 'A' || event.target.tagName == 'SPOILER-TEXT'))return;$modal.hide();});$modal.addEventListener('keydown', function(event) {if (!$modal.classList.contains('visible'))return;switch (event.keyCode) {case 39:case 32:if (!_this.navigation)break;event.preventDefault();event.stopPropagation();$modal.next();break;case 37:if (!_this.navigation)break;event.preventDefault();event.stopPropagation();$modal.previous();break;case 36:if (!_this.navigation)break;event.preventDefault();event.stopPropagation();$modal.first();break;case 35:if (!_this.navigation)break;event.preventDefault();event.stopPropagation();$modal.last();break;case 27:event.preventDefault();event.stopPropagation();$modal.hide();break;}});$modalNext.addEventListener('click', function(event) {$modal.next();});$modalPrevious.addEventListener('click', function(event) {$modal.previous();});this.$modal = $modal;this.$modalImage = $modalImage;this.$modalCaption = $modalCaption;this.$modalNext = $modalNext;this.$modalPrevious = $modalPrevious;};lightboxGallery.prototype.show = function(href, config) {this.$links = config.$links;this.navigation = config.navigation;this.captions = config.captions;this.mobile = config.mobile;this.mobileNavigation = config.mobileNavigation;this.scheme = config.scheme;this.protect = config.protect;this.$modal.classList.remove('light', 'dark');switch (this.scheme) {case 'light':this.$modal.classList.add('light');break;case 'dark':this.$modal.classList.add('dark');break;case 'auto':if (window.matchMedia('(prefers-color-scheme: light)').matches)this.$modal.classList.add('light'); else this.$modal.classList.add('dark');break;}if (this.navigation) {this.$modalNext.style.display = '';this.$modalPrevious.style.display = '';if (client.mobile&& !this.mobileNavigation) {this.$modalNext.style.display = 'none';this.$modalPrevious.style.display = 'none';}} else {this.$modalNext.style.display = 'none';this.$modalPrevious.style.display = 'none';}if (this.captions)this.$modalCaption.style.display = ''; else this.$modalCaption.style.display = 'none';if (this.protect) {this.$modalImage.style.WebkitTouchCallout = 'none';this.$modalImage.style.userSelect = 'none';} else {this.$modalImage.style.WebkitTouchCallout = '';this.$modalImage.style.userSelect = '';}if (client.mobile && !this.mobile)return;this.$modal.show(href);};lightboxGallery.prototype.zoomHandler = function() {var threshold = window.matchMedia('(orientation: portrait)').matches ? 50 : 100;if (window.outerWidth > window.innerWidth + threshold)this.$modal.classList.add('zooming'); else this.$modal.classList.remove('zooming');};var _lightboxGallery = new lightboxGallery;_lightboxGallery.init({id: 'gallery01',navigation: true,captions: false,mobile: true,mobileNavigation: true,scheme: 'dark',});_lightboxGallery.init({id: 'gallery04',navigation: true,captions: false,mobile: true,mobileNavigation: true,scheme: 'dark',});_lightboxGallery.init({id: 'gallery02',navigation: true,captions: false,mobile: true,mobileNavigation: true,scheme: 'dark',});_lightboxGallery.init({id: 'gallery03',navigation: true,captions: false,mobile: true,mobileNavigation: true,scheme: 'dark',});})();