PageSourceSearch

https://www.kvs.de/js/glightbox.js

js kvs.de collected 2026-10-02 17:33:47 UTC 81,642 bytes, 2,682 lines download raw bytes

1(function (global, factory) {
2  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3  typeof define === 'function' && define.amd ? define(factory) :
4  (global = global || self, global.GLightbox = factory());
5}(this, (function () { 'use strict';
6
7  function _typeof(obj) {
8    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
9      _typeof = function (obj) {
10        return typeof obj;
11      };
12    } else {
13      _typeof = function (obj) {
14        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15      };
16    }
17
18    return _typeof(obj);
19  }
20
21  function _classCallCheck(instance, Constructor) {
22    if (!(instance instanceof Constructor)) {
23      throw new TypeError("Cannot call a class as a function");
24    }
25  }
26
27  function _defineProperties(target, props) {
28    for (var i = 0; i < props.length; i++) {
29      var descriptor = props[i];
30      descriptor.enumerable = descriptor.enumerable || false;
31      descriptor.configurable = true;
32      if ("value" in descriptor) descriptor.writable = true;
33      Object.defineProperty(target, descriptor.key, descriptor);
34    }
35  }
36
37  function _createClass(Constructor, protoProps, staticProps) {
38    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
39    if (staticProps) _defineProperties(Constructor, staticProps);
40    return Constructor;
41  }
42
43  function _toConsumableArray(arr) {
44    return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
45  }
46
47  function _arrayWithoutHoles(arr) {
48    if (Array.isArray(arr)) {
49      for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
50
51      return arr2;
52    }
53  }
54
55  function _iterableToArray(iter) {
56    if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
57  }
58
59  function _nonIterableSpread() {
60    throw new TypeError("Invalid attempt to spread non-iterable instance");
61  }
62
63  function getLen(v) {
64    return Math.sqrt(v.x * v.x + v.y * v.y);
65  }
66
67  function dot(v1, v2) {
68    return v1.x * v2.x + v1.y * v2.y;
69  }
70
71  function getAngle(v1, v2) {
72    var mr = getLen(v1) * getLen(v2);
73    if (mr === 0) return 0;
74    var r = dot(v1, v2) / mr;
75    if (r > 1) r = 1;
76    return Math.acos(r);
77  }
78
79  function cross(v1, v2) {
80    return v1.x * v2.y - v2.x * v1.y;
81  }
82
83  function getRotateAngle(v1, v2) {
84    var angle = getAngle(v1, v2);
85
86    if (cross(v1, v2) > 0) {
87      angle *= -1;
88    }
89
90    return angle * 180 / Math.PI;
91  }
92
93  var EventsHandlerAdmin = function () {
94    function EventsHandlerAdmin(el) {
95      _classCallCheck(this, EventsHandlerAdmin);
96
97      this.handlers = [];
98      this.el = el;
99    }
100
101    _createClass(EventsHandlerAdmin, [{
102      key: "add",
103      value: function add(handler) {
104        this.handlers.push(handler);
105      }
106    }, {
107      key: "del",
108      value: function del(handler) {
109        if (!handler) this.handlers = [];
110
111        for (var i = this.handlers.length; i >= 0; i--) {
112          if (this.handlers[i] === handler) {
113            this.handlers.splice(i, 1);
114          }
115        }
116      }
117    }, {
118      key: "dispatch",
119      value: function dispatch() {
120        for (var i = 0, len = this.handlers.length; i < len; i++) {
121          var handler = this.handlers[i];
122          if (typeof handler === 'function') handler.apply(this.el, arguments);
123        }
124      }
125    }]);
126
127    return EventsHandlerAdmin;
128  }();
129
130  function wrapFunc(el, handler) {
131    var EventshandlerAdmin = new EventsHandlerAdmin(el);
132    EventshandlerAdmin.add(handler);
133    return EventshandlerAdmin;
134  }
135
136  var TouchEvents = function () {
137    function TouchEvents(el, option) {
138      _classCallCheck(this, TouchEvents);
139
140      this.element = typeof el == 'string' ? document.querySelector(el) : el;
141      this.start = this.start.bind(this);
142      this.move = this.move.bind(this);
143      this.end = this.end.bind(this);
144      this.cancel = this.cancel.bind(this);
145      this.element.addEventListener("touchstart", this.start, false);
146      this.element.addEventListener("touchmove", this.move, false);
147      this.element.addEventListener("touchend", this.end, false);
148      this.element.addEventListener("touchcancel", this.cancel, false);
149      this.preV = {
150        x: null,
151        y: null
152      };
153      this.pinchStartLen = null;
154      this.zoom = 1;
155      this.isDoubleTap = false;
vendor: 5,054 bytes, lines 156-303
156
157      var noop = function noop() {};
158
159      this.rotate = wrapFunc(this.element, option.rotate || noop);
160      this.touchStart = wrapFunc(this.element, option.touchStart || noop);
161      this.multipointStart = wrapFunc(this.element, option.multipointStart || noop);
162      this.multipointEnd = wrapFunc(this.element, option.multipointEnd || noop);
163      this.pinch = wrapFunc(this.element, option.pinch || noop);
164      this.swipe = wrapFunc(this.element, option.swipe || noop);
165      this.tap = wrapFunc(this.element, option.tap || noop);
166      this.doubleTap = wrapFunc(this.element, option.doubleTap || noop);
167      this.longTap = wrapFunc(this.element, option.longTap || noop);
168      this.singleTap = wrapFunc(this.element, option.singleTap || noop);
169      this.pressMove = wrapFunc(this.element, option.pressMove || noop);
170      this.twoFingerPressMove = wrapFunc(this.element, option.twoFingerPressMove || noop);
171      this.touchMove = wrapFunc(this.element, option.touchMove || noop);
172      this.touchEnd = wrapFunc(this.element, option.touchEnd || noop);
173      this.touchCancel = wrapFunc(this.element, option.touchCancel || noop);
174      this._cancelAllHandler = this.cancelAll.bind(this);
175      window.addEventListener('scroll', this._cancelAllHandler);
176      this.delta = null;
177      this.last = null;
178      this.now = null;
179      this.tapTimeout = null;
180      this.singleTapTimeout = null;
181      this.longTapTimeout = null;
182      this.swipeTimeout = null;
183      this.x1 = this.x2 = this.y1 = this.y2 = null;
184      this.preTapPosition = {
185        x: null,
186        y: null
187      };
188    }
189
190    _createClass(TouchEvents, [{
191      key: "start",
192      value: function start(evt) {
193        if (!evt.touches) return;
194        this.now = Date.now();
195        this.x1 = evt.touches[0].pageX;
196        this.y1 = evt.touches[0].pageY;
197        this.delta = this.now - (this.last || this.now);
198        this.touchStart.dispatch(evt, this.element);
199
200        if (this.preTapPosition.x !== null) {
201          this.isDoubleTap = this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30;
202          if (this.isDoubleTap) clearTimeout(this.singleTapTimeout);
203        }
204
205        this.preTapPosition.x = this.x1;
206        this.preTapPosition.y = this.y1;
207        this.last = this.now;
208        var preV = this.preV,
209            len = evt.touches.length;
210
211        if (len > 1) {
212          this._cancelLongTap();
213
214          this._cancelSingleTap();
215
216          var v = {
217            x: evt.touches[1].pageX - this.x1,
218            y: evt.touches[1].pageY - this.y1
219          };
220          preV.x = v.x;
221          preV.y = v.y;
222          this.pinchStartLen = getLen(preV);
223          this.multipointStart.dispatch(evt, this.element);
224        }
225
226        this._preventTap = false;
227        this.longTapTimeout = setTimeout(function () {
228          this.longTap.dispatch(evt, this.element);
229          this._preventTap = true;
230        }.bind(this), 750);
231      }
232    }, {
233      key: "move",
234      value: function move(evt) {
235        if (!evt.touches) return;
236        var preV = this.preV,
237            len = evt.touches.length,
238            currentX = evt.touches[0].pageX,
239            currentY = evt.touches[0].pageY;
240        this.isDoubleTap = false;
241
242        if (len > 1) {
243          var sCurrentX = evt.touches[1].pageX,
244              sCurrentY = evt.touches[1].pageY;
245          var v = {
246            x: evt.touches[1].pageX - currentX,
247            y: evt.touches[1].pageY - currentY
248          };
249
250          if (preV.x !== null) {
251            if (this.pinchStartLen > 0) {
252              evt.zoom = getLen(v) / this.pinchStartLen;
253              this.pinch.dispatch(evt, this.element);
254            }
255
256            evt.angle = getRotateAngle(v, preV);
257            this.rotate.dispatch(evt, this.element);
258          }
259
260          preV.x = v.x;
261          preV.y = v.y;
262
263          if (this.x2 !== null && this.sx2 !== null) {
264            evt.deltaX = (currentX - this.x2 + sCurrentX - this.sx2) / 2;
265            evt.deltaY = (currentY - this.y2 + sCurrentY - this.sy2) / 2;
266          } else {
267            evt.deltaX = 0;
268            evt.deltaY = 0;
269          }
270
271          this.twoFingerPressMove.dispatch(evt, this.element);
272          this.sx2 = sCurrentX;
273          this.sy2 = sCurrentY;
274        } else {
275          if (this.x2 !== null) {
276            evt.deltaX = currentX - this.x2;
277            evt.deltaY = currentY - this.y2;
278            var movedX = Math.abs(this.x1 - this.x2),
279                movedY = Math.abs(this.y1 - this.y2);
280
281            if (movedX > 10 || movedY > 10) {
282              this._preventTap = true;
283            }
284          } else {
285            evt.deltaX = 0;
286            evt.deltaY = 0;
287          }
288
289          this.pressMove.dispatch(evt, this.element);
290        }
291
292        this.touchMove.dispatch(evt, this.element);
293
294        this._cancelLongTap();
295
296        this.x2 = currentX;
297        this.y2 = currentY;
298
299        if (len > 1) {
300          evt.preventDefault();
301        }
302      }
303    }, {
304      key: "end",
305      value: function end(evt) {
306        if (!evt.changedTouches) return;
307
308        this._cancelLongTap();
309
310        var self = this;
311
312        if (evt.touches.length < 2) {
313          this.multipointEnd.dispatch(evt, this.element);
314          this.sx2 = this.sy2 = null;
315        }
316
317        if (this.x2 && Math.abs(this.x1 - this.x2) > 30 || this.y2 && Math.abs(this.y1 - this.y2) > 30) {
318          evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2);
319          this.swipeTimeout = setTimeout(function () {
320            self.swipe.dispatch(evt, self.element);
321          }, 0);
322        } else {
323          this.tapTimeout = setTimeout(function () {
324            if (!self._preventTap) {
325              self.tap.dispatch(evt, self.element);
326            }
327
328            if (self.isDoubleTap) {
329              self.doubleTap.dispatch(evt, self.element);
330              self.isDoubleTap = false;
331            }
332          }, 0);
333
334          if (!self.isDoubleTap) {
335            self.singleTapTimeout = setTimeout(function () {
336              self.singleTap.dispatch(evt, self.element);
337            }, 250);
338          }
339        }
340
341        this.touchEnd.dispatch(evt, this.element);
342        this.preV.x = 0;
343        this.preV.y = 0;
344        this.zoom = 1;
345        this.pinchStartLen = null;
346        this.x1 = this.x2 = this.y1 = this.y2 = null;
347      }
348    }, {
349      key: "cancelAll",
350      value: function cancelAll() {
351        this._preventTap = true;
352        clearTimeout(this.singleTapTimeout);
353        clearTimeout(this.tapTimeout);
354        clearTimeout(this.longTapTimeout);
355        clearTimeout(this.swipeTimeout);
356      }
357    }, {
358      key: "cancel",
359      value: function cancel(evt) {
360        this.cancelAll();
361        this.touchCancel.dispatch(evt, this.element);
362      }
363    }, {
364      key: "_cancelLongTap",
365      value: function _cancelLongTap() {
366        clearTimeout(this.longTapTimeout);
367      }
368    }, {
369      key: "_cancelSingleTap",
370      value: function _cancelSingleTap() {
371        clearTimeout(this.singleTapTimeout);
372      }
373    }, {
374      key: "_swipeDirection",
375      value: function _swipeDirection(x1, x2, y1, y2) {
376        return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? x1 - x2 > 0 ? 'Left' : 'Right' : y1 - y2 > 0 ? 'Up' : 'Down';
377      }
378    }, {
379      key: "on",
380      value: function on(evt, handler) {
381        if (this[evt]) {
382          this[evt].add(handler);
383        }
384      }
385    }, {
386      key: "off",
387      value: function off(evt, handler) {
388        if (this[evt]) {
389          this[evt].del(handler);
390        }
391      }
392    }, {
393      key: "destroy",
394      value: function destroy() {
395        if (this.singleTapTimeout) clearTimeout(this.singleTapTimeout);
396        if (this.tapTimeout) clearTimeout(this.tapTimeout);
397        if (this.longTapTimeout) clearTimeout(this.longTapTimeout);
398        if (this.swipeTimeout) clearTimeout(this.swipeTimeout);
399        this.element.removeEventListener("touchstart", this.start);
400        this.element.removeEventListener("touchmove", this.move);
401        this.element.removeEventListener("touchend", this.end);
402        this.element.removeEventListener("touchcancel", this.cancel);
403        this.rotate.del();
404        this.touchStart.del();
405        this.multipointStart.del();
406        this.multipointEnd.del();
407        this.pinch.del();
408        this.swipe.del();
409        this.tap.del();
410        this.doubleTap.del();
411        this.longTap.del();
412        this.singleTap.del();
413        this.pressMove.del();
414        this.twoFingerPressMove.del();
415        this.touchMove.del();
416        this.touchEnd.del();
417        this.touchCancel.del();
418        this.preV = this.pinchStartLen = this.zoom = this.isDoubleTap = this.delta = this.last = this.now = this.tapTimeout = this.singleTapTimeout = this.longTapTimeout = this.swipeTimeout = this.x1 = this.x2 = this.y1 = this.y2 = this.preTapPosition = this.rotate = this.touchStart = this.multipointStart = this.multipointEnd = this.pinch = this.swipe = this.tap = this.doubleTap = this.longTap = this.singleTap = this.pressMove = this.touchMove = this.touchEnd = this.touchCancel = this.twoFingerPressMove = null;
419        window.removeEventListener('scroll', this._cancelAllHandler);
420        return null;
421      }
422    }]);
423
424    return TouchEvents;
425  }();
426
427  var ZoomImages = function () {
428    function ZoomImages(el, slide) {
429      var _this = this;
430
431      var onclose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
432
433      _classCallCheck(this, ZoomImages);
434
435      this.img = el;
436      this.slide = slide;
437      this.onclose = onclose;
438
439      if (this.img.setZoomEvents) {
440        return false;
vendor: 4,106 bytes, lines 441-584
441      }
442
443      this.active = false;
444      this.zoomedIn = false;
445      this.dragging = false;
446      this.currentX = null;
447      this.currentY = null;
448      this.initialX = null;
449      this.initialY = null;
450      this.xOffset = 0;
451      this.yOffset = 0;
452      this.img.addEventListener('mousedown', function (e) {
453        return _this.dragStart(e);
454      }, false);
455      this.img.addEventListener('mouseup', function (e) {
456        return _this.dragEnd(e);
457      }, false);
458      this.img.addEventListener('mousemove', function (e) {
459        return _this.drag(e);
460      }, false);
461      this.img.addEventListener('click', function (e) {
462        if (!_this.zoomedIn) {
463          return _this.zoomIn();
464        }
465
466        if (_this.zoomedIn && !_this.dragging) {
467          _this.zoomOut();
468        }
469      }, false);
470      this.img.setZoomEvents = true;
471    }
472
473    _createClass(ZoomImages, [{
474      key: "zoomIn",
475      value: function zoomIn() {
476        var winWidth = this.widowWidth();
477
478        if (this.zoomedIn || winWidth <= 768) {
479          return;
480        }
481
482        var img = this.img;
483        img.setAttribute('data-style', img.getAttribute('style'));
484        img.style.maxWidth = img.naturalWidth + 'px';
485        img.style.maxHeight = img.naturalHeight + 'px';
486
487        if (img.naturalWidth > winWidth) {
488          var centerX = winWidth / 2 - img.naturalWidth / 2;
489          this.setTranslate(this.img.parentNode, centerX, 0);
490        }
491
492        this.slide.classList.add('zoomed');
493        this.zoomedIn = true;
494      }
495    }, {
496      key: "zoomOut",
497      value: function zoomOut() {
498        this.img.parentNode.setAttribute('style', '');
499        this.img.setAttribute('style', this.img.getAttribute('data-style'));
500        this.slide.classList.remove('zoomed');
501        this.zoomedIn = false;
502        this.currentX = null;
503        this.currentY = null;
504        this.initialX = null;
505        this.initialY = null;
506        this.xOffset = 0;
507        this.yOffset = 0;
508
509        if (this.onclose && typeof this.onclose == 'function') {
510          this.onclose();
511        }
512      }
513    }, {
514      key: "dragStart",
515      value: function dragStart(e) {
516        e.preventDefault();
517
518        if (!this.zoomedIn) {
519          this.active = false;
520          return;
521        }
522
523        if (e.type === "touchstart") {
524          this.initialX = e.touches[0].clientX - this.xOffset;
525          this.initialY = e.touches[0].clientY - this.yOffset;
526        } else {
527          this.initialX = e.clientX - this.xOffset;
528          this.initialY = e.clientY - this.yOffset;
529        }
530
531        if (e.target === this.img) {
532          this.active = true;
533          this.img.classList.add('dragging');
534        }
535      }
536    }, {
537      key: "dragEnd",
538      value: function dragEnd(e) {
539        var _this2 = this;
540
541        e.preventDefault();
542        this.initialX = this.currentX;
543        this.initialY = this.currentY;
544        this.active = false;
545        setTimeout(function () {
546          _this2.dragging = false;
547          _this2.img.isDragging = false;
548
549          _this2.img.classList.remove('dragging');
550        }, 100);
551      }
552    }, {
553      key: "drag",
554      value: function drag(e) {
555        if (this.active) {
556          e.preventDefault();
557
558          if (e.type === 'touchmove') {
559            this.currentX = e.touches[0].clientX - this.initialX;
560            this.currentY = e.touches[0].clientY - this.initialY;
561          } else {
562            this.currentX = e.clientX - this.initialX;
563            this.currentY = e.clientY - this.initialY;
564          }
565
566          this.xOffset = this.currentX;
567          this.yOffset = this.currentY;
568          this.img.isDragging = true;
569          this.dragging = true;
570          this.setTranslate(this.img, this.currentX, this.currentY);
571        }
572      }
573    }, {
574      key: "onMove",
575      value: function onMove(e) {
576        if (!this.zoomedIn) {
577          return;
578        }
579
580        var xOffset = e.clientX - this.img.naturalWidth / 2;
581        var yOffset = e.clientY - this.img.naturalHeight / 2;
582        this.setTranslate(this.img, xOffset, yOffset);
583      }
584    }, {
585      key: "setTranslate",
586      value: function setTranslate(node, xPos, yPos) {
587        node.style.transform = "translate3d(" + xPos + "px, " + yPos + "px, 0)";
588      }
589    }, {
590      key: "widowWidth",
591      value: function widowWidth() {
592        return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
593      }
594    }]);
595
596    return ZoomImages;
597  }();
598
599  var isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i);
600  var isTouch = isMobile !== null || document.createTouch !== undefined || 'ontouchstart' in window || 'onmsgesturechange' in window || navigator.msMaxTouchPoints;
601  var html = document.getElementsByTagName('html')[0];
602  var transitionEnd = whichTransitionEvent();
603  var animationEnd = whichAnimationEvent();
604  var uid = Date.now();
605  var videoPlayers = {};
606  var defaults = {
607    selector: '.glightbox',
608    elements: null,
609    skin: 'clean',
610    closeButton: true,
611    startAt: null,
612    autoplayVideos: false,
613    descPosition: 'bottom',
614    width: '80%',
615    height: '600px',
616    videosWidth: '960px',
617    beforeSlideChange: null,
618    afterSlideChange: null,
619    beforeSlideLoad: null,
620    afterSlideLoad: null,
621    onOpen: null,
622    onClose: null,
623    loop: false,
624    touchNavigation: true,
625    touchFollowAxis: true,
626    keyboardNavigation: true,
627    closeOnOutsideClick: true,
628    plyr: {
629      css: '../css/plyr.css',
630      js: '../js/plyr.js',
631      config: {
632        ratio: '16:9',
633	    width: '80%',
634		height: '600px',
635        youtube: {
636          noCookie: true,
637          rel: 0,
638          showinfo: 0,
639          iv_load_policy: 3
640        },
641        vimeo: {
642          byline: false,
643          portrait: false,
644          title: false,
645          title: false,
646          transparent: false
647        }
648      }
649    },
650    openEffect: 'zoomIn',
651    closeEffect: 'zoomOut',
652    slideEffect: 'slide',
653    moreText: 'See more',
654    moreLength: 60,
655    lightboxHtml: '',
656    cssEfects: {
657      fade: {
658        "in": 'fadeIn',
659        out: 'fadeOut'
660      },
661      zoom: {
662        "in": 'zoomIn',
663        out: 'zoomOut'
664      },
665      slide: {
666        "in": 'slideInRight',
667        out: 'slideOutLeft'
668      },
669      slide_back: {
670        "in": 'slideInLeft',
671        out: 'slideOutRight'
672      }
673    },
674    svg: {
675      close: '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"/></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/></g></g></svg>',
676      next: '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"> <g><path d="M360.731,229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1,0s-5.3,13.8,0,19.1l215.5,215.5l-215.5,215.5c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4c3.4,0,6.9-1.3,9.5-4l225.1-225.1C365.931,242.875,365.931,234.275,360.731,229.075z"/></g></svg>',
677      prev: '<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"><g><path d="M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z"/></g></svg>'
678    }
679  };
680  var lightboxSlideHtml = "<div class=\"gslide\">\n    <div class=\"gslide-inner-content\">\n        <div class=\"ginner-container\">\n            <div class=\"gslide-media\">\n            </div>\n            <div class=\"gslide-description\">\n                <div class=\"gdesc-inner\">\n                    <h4 class=\"gslide-title\"></h4>\n                    <div class=\"gslide-desc\"></div>\n                </div>\n            </div>\n        </div>\n    </div>\n</div>";
681  defaults.slideHtml = lightboxSlideHtml;
682  var lightboxHtml = "<div id=\"glightbox-body\" class=\"glightbox-container\">\n    <div class=\"gloader visible\"></div>\n    <div class=\"goverlay\"></div>\n    <div class=\"gcontainer\">\n    <div id=\"glightbox-slider\" class=\"gslider\"></div>\n    <button class=\"gnext gbtn\" tabindex=\"0\">{nextSVG}</button>\n    <button class=\"gprev gbtn\" tabindex=\"1\">{prevSVG}</button>\n    <button class=\"gclose gbtn\" tabindex=\"2\">{closeSVG}</button>\n</div>\n</div>";
683  defaults.lightboxHtml = lightboxHtml;
684
685  function extend() {
686    var extended = {};
687    var deep = true;
688    var i = 0;
689    var length = arguments.length;
690
691    if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {
692      deep = arguments[0];
693      i++;
694    }
695
696    var merge = function merge(obj) {
697      for (var prop in obj) {
698        if (Object.prototype.hasOwnProperty.call(obj, prop)) {
699          if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {
700            extended[prop] = extend(true, extended[prop], obj[prop]);
701          } else {
702            extended[prop] = obj[prop];
703          }
704        }
705      }
706    };
707
708    for (; i < length; i++) {
709      var obj = arguments[i];
710      merge(obj);
711    }
712
713    return extended;
714  }
715
716  var utils = {
717    isFunction: function isFunction(f) {
718      return typeof f === 'function';
719    },
720    isString: function isString(s) {
721      return typeof s === 'string';
722    },
723    isNode: function isNode(el) {
724      return !!(el && el.nodeType && el.nodeType == 1);
725    },
726    isArray: function isArray(ar) {
727      return Array.isArray(ar);
728    },
729    isArrayLike: function isArrayLike(ar) {
730      return ar && ar.length && isFinite(ar.length);
731    },
732    isObject: function isObject(o) {
733      var type = _typeof(o);
734
735      return type === 'object' && o != null && !utils.isFunction(o) && !utils.isArray(o);
736    },
737    isNil: function isNil(o) {
738      return o == null;
739    },
740    has: function has(obj, key) {
741      return obj !== null && hasOwnProperty.call(obj, key);
742    },
743    size: function size(o) {
744      if (utils.isObject(o)) {
745        if (o.keys) {
746          return o.keys().length;
747        }
748
749        var l = 0;
750
751        for (var k in o) {
752          if (utils.has(o, k)) {
753            l++;
754          }
755        }
756
757        return l;
758      } else {
759        return o.length;
760      }
761    },
762    isNumber: function isNumber(n) {
763      return !isNaN(parseFloat(n)) && isFinite(n);
764    }
765  };
766
767  function each(collection, callback) {
768    if (utils.isNode(collection) || collection === window || collection === document) {
769      collection = [collection];
770    }
771
772    if (!utils.isArrayLike(collection) && !utils.isObject(collection)) {
773      collection = [collection];
774    }
775
776    if (utils.size(collection) == 0) {
777      return;
778    }
779
780    if (utils.isArrayLike(collection) && !utils.isObject(collection)) {
781      var l = collection.length,
782          i = 0;
783
784      for (; i < l; i++) {
785        if (callback.call(collection[i], collection[i], i, collection) === false) {
786          break;
787        }
788      }
789    } else if (utils.isObject(collection)) {
790      for (var key in collection) {
791        if (utils.has(collection, key)) {
792          if (callback.call(collection[key], collection[key], key, collection) === false) {
793            break;
794          }
795        }
796      }
797    }
798  }
799
800  function getNodeEvents(node) {
801    var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
802    var fn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
803    var cache = node[uid] = node[uid] || [];
804    var data = {
805      all: cache,
806      evt: null,
807      found: null
808    };
809
810    if (name && fn && utils.size(cache) > 0) {
811      each(cache, function (cl, i) {
812        if (cl.eventName == name && cl.fn.toString() == fn.toString()) {
813          data.found = true;
814          data.evt = i;
815          return false;
816        }
817      });
818    }
819
820    return data;
821  }
822
823  function addEvent(eventName) {
824    var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
825        onElement = _ref.onElement,
826        withCallback = _ref.withCallback,
827        _ref$avoidDuplicate = _ref.avoidDuplicate,
828        avoidDuplicate = _ref$avoidDuplicate === void 0 ? true : _ref$avoidDuplicate,
829        _ref$once = _ref.once,
830        once = _ref$once === void 0 ? false : _ref$once,
831        _ref$useCapture = _ref.useCapture,
832        useCapture = _ref$useCapture === void 0 ? false : _ref$useCapture;
833
834    var thisArg = arguments.length > 2 ? arguments[2] : undefined;
835    var element = onElement || [];
836
837    if (utils.isString(element)) {
838      element = document.querySelectorAll(element);
839    }
840
841    function handler(event) {
842      if (utils.isFunction(withCallback)) {
843        withCallback.call(thisArg, event, this);
844      }
845
846      if (once) {
847        handler.destroy();
848      }
849    }
850
851    handler.destroy = function () {
852      each(element, function (el) {
853        var events = getNodeEvents(el, eventName, handler);
854
855        if (events.found) {
856          events.all.splice(events.evt, 1);
857        }
858
859        if (el.removeEventListener) el.removeEventListener(eventName, handler, useCapture);
860      });
861    };
862
863    each(element, function (el) {
864      var events = getNodeEvents(el, eventName, handler);
865
866      if (el.addEventListener && avoidDuplicate && !events.found || !avoidDuplicate) {
867        el.addEventListener(eventName, handler, useCapture);
868        events.all.push({
869          eventName: eventName,
870          fn: handler
871        });
872      }
873    });
874    return handler;
875  }
876
877  function addClass(node, name) {
878    each(name.split(' '), function (cl) {
879      return node.classList.add(cl);
880    });
881  }
882
883  function removeClass(node, name) {
884    each(name.split(' '), function (cl) {
885      return node.classList.remove(cl);
886    });
887  }
888
889  function hasClass(node, name) {
890    return node.classList.contains(name);
891  }
892
893  function whichAnimationEvent() {
894    var t,
895        el = document.createElement("fakeelement");
896    var animations = {
897      animation: "animationend",
898      OAnimation: "oAnimationEnd",
899      MozAnimation: "animationend",
900      WebkitAnimation: "webkitAnimationEnd"
901    };
902
903    for (t in animations) {
904      if (el.style[t] !== undefined) {
905        return animations[t];
906      }
907    }
908  }
909
910  function whichTransitionEvent() {
911    var t,
912        el = document.createElement("fakeelement");
913    var transitions = {
914      transition: "transitionend",
915      OTransition: "oTransitionEnd",
916      MozTransition: "transitionend",
917      WebkitTransition: "webkitTransitionEnd"
918    };
919
920    for (t in transitions) {
921      if (el.style[t] !== undefined) {
922        return transitions[t];
923      }
924    }
925  }
926
927  function animateElement(element) {
928    var animation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
929    var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
930
931    if (!element || animation === '') {
932      return false;
933    }
934
935    if (animation == 'none') {
936      if (utils.isFunction(callback)) callback();
937      return false;
938    }
939
940    var animationNames = animation.split(' ');
941    each(animationNames, function (name) {
942      addClass(element, 'g' + name);
943    });
944    addEvent(animationEnd, {
945      onElement: element,
946      avoidDuplicate: false,
947      once: true,
948      withCallback: function withCallback(event, target) {
949        each(animationNames, function (name) {
950          removeClass(target, 'g' + name);
951        });
952        if (utils.isFunction(callback)) callback();
953      }
954    });
955  }
956
957  function createHTML(htmlStr) {
958    var frag = document.createDocumentFragment(),
959        temp = document.createElement('div');
960    temp.innerHTML = htmlStr;
961
962    while (temp.firstChild) {
963      frag.appendChild(temp.firstChild);
964    }
965
966    return frag;
967  }
968
969  function getClosest(elem, selector) {
970    while (elem !== document.body) {
971      elem = elem.parentElement;
972      var matches = typeof elem.matches == 'function' ? elem.matches(selector) : elem.msMatchesSelector(selector);
973      if (matches) return elem;
974    }
975  }
976
977  function show(element) {
978    element.style.display = 'block';
979  }
980
981  function hide(element) {
982    element.style.display = 'none';
983  }
984
985  function windowSize() {
986    return {
987      width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
988      height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
989    };
990  }
991
992  function handleMediaFullScreen(event) {
993    if (!hasClass(event.target, 'plyr--html5')) {
994      return;
995    }
996
997    var media = getClosest(event.target, '.gslide-media');
998
999    if (event.type == 'enterfullscreen') {
1000      addClass(media, 'fullscreen');
1001    }
1002
1003    if (event.type == 'exitfullscreen') {
1004      removeClass(media, 'fullscreen');
1005    }
1006  }
1007
1008  function checkSize(size) {
1009    return utils.isNumber(size) ? "".concat(size, "px") : size;
1010  }
1011
1012  function setSize(data, settings) {
1013    var defaultWith = data.type == 'video' ? checkSize(settings.videosWidth) : checkSize(settings.width);
1014    var defaultHeight = checkSize(settings.height);
1015    data.width = utils.has(data, 'width') && data.width !== '' ? checkSize(data.width) : defaultWith;
1016    data.height = utils.has(data, 'height') && data.height !== '' ? checkSize(data.height) : defaultHeight;
1017    return data;
1018  }
1019
1020  var getSlideData = function getSlideData() {
1021    var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1022    var settings = arguments.length > 1 ? arguments[1] : undefined;
1023    var data = {
1024      href: '',
1025      title: '',
1026      type: '',
1027      description: '',
1028      descPosition: settings.descPosition,
1029      effect: '',
1030      width: '',
1031      height: '',
1032      node: element,
1033      content: false
1034    };
1035
1036    if (utils.isObject(element) && !utils.isNode(element)) {
1037      if (!utils.has(element, 'type')) {
1038        if (utils.has(element, 'content') && element.content) {
1039          element.type = 'inline';
1040        } else if (utils.has(element, 'href')) {
1041          element.type = getSourceType(element.href);
1042        }
1043      }
1044
1045      var objectData = extend(data, element);
1046      setSize(objectData, settings);
1047      return objectData;
1048    }
1049
1050    var url = '';
1051    var config = element.getAttribute('data-glightbox');
1052    var nodeType = element.nodeName.toLowerCase();
1053    if (nodeType === 'a') url = element.href;
1054    if (nodeType === 'img') url = element.src;
1055    data.href = url;
1056    each(data, function (val, key) {
1057      if (utils.has(settings, key) && key !== 'width') {
1058        data[key] = settings[key];
1059      }
1060
1061      var nodeData = element.dataset[key];
1062
1063      if (!utils.isNil(nodeData)) {
1064        data[key] = nodeData;
1065      }
1066    });
1067
1068    if (data.content) {
1069      data.type = 'inline';
1070    }
1071
1072    if (!data.type && url) {
1073      data.type = getSourceType(url);
1074    }
1075
1076    if (!utils.isNil(config)) {
1077      var cleanKeys = [];
1078      each(data, function (v, k) {
1079        cleanKeys.push(';\\s?' + k);
1080      });
1081      cleanKeys = cleanKeys.join('\\s?:|');
1082
1083      if (config.trim() !== '') {
1084        each(data, function (val, key) {
1085          var str = config;
1086          var match = '\s?' + key + '\s?:\s?(.*?)(' + cleanKeys + '\s?:|$)';
1087          var regex = new RegExp(match);
1088          var matches = str.match(regex);
1089
1090          if (matches && matches.length && matches[1]) {
1091            var value = matches[1].trim().replace(/;\s*$/, '');
1092            data[key] = value;
1093          }
1094        });
1095      }
1096    } else {
1097      if (nodeType == 'a') {
1098        var title = element.title;
1099        if (!utils.isNil(title) && title !== '') data.title = title;
1100      }
1101
1102      if (nodeType == 'img') {
1103        var alt = element.alt;
1104        if (!utils.isNil(alt) && alt !== '') data.title = alt;
1105      }
1106
1107      var desc = element.getAttribute('data-description');
1108      if (!utils.isNil(desc) && desc !== '') data.description = desc;
1109    }
1110
1111    if (data.description && data.description.substring(0, 1) == '.' && document.querySelector(data.description)) {
1112      data.description = document.querySelector(data.description).innerHTML;
1113    } else {
1114      var nodeDesc = element.querySelector('.glightbox-desc');
1115
1116      if (nodeDesc) {
1117        data.description = nodeDesc.innerHTML;
1118      }
1119    }
1120
1121    setSize(data, settings);
1122    return data;
1123  };
1124
1125  var setSlideContent = function setSlideContent() {
1126    var _this = this;
1127
1128    var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1129    var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1130    var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1131
1132    if (hasClass(slide, 'loaded')) {
1133      return false;
1134    }
1135
1136    if (utils.isFunction(this.settings.beforeSlideLoad)) {
1137      this.settings.beforeSlideLoad(slide, data);
1138    }
1139
1140    var type = data.type;
1141    var position = data.descPosition;
1142    var slideMedia = slide.querySelector('.gslide-media');
1143    var slideTitle = slide.querySelector('.gslide-title');
1144    var slideText = slide.querySelector('.gslide-desc');
1145    var slideDesc = slide.querySelector('.gdesc-inner');
1146    var finalCallback = callback;
1147
1148    if (utils.isFunction(this.settings.afterSlideLoad)) {
1149      finalCallback = function finalCallback() {
1150        if (utils.isFunction(callback)) {
1151          callback();
1152        }
1153
1154        _this.settings.afterSlideLoad(slide, data);
1155      };
1156    }
1157
1158    if (data.title == '' && data.description == '') {
1159      if (slideDesc) {
1160        slideDesc.parentNode.parentNode.removeChild(slideDesc.parentNode);
1161      }
1162    } else {
1163      if (slideTitle && data.title !== '') {
1164        slideTitle.innerHTML = data.title;
1165      } else {
1166        slideTitle.parentNode.removeChild(slideTitle);
1167      }
1168
1169      if (slideText && data.description !== '') {
1170        if (isMobile && this.settings.moreLength > 0) {
1171          data.smallDescription = slideShortDesc(data.description, this.settings.moreLength, this.settings.moreText);
1172          slideText.innerHTML = data.smallDescription;
1173          slideDescriptionEvents.apply(this, [slideText, data]);
1174        } else {
1175          slideText.innerHTML = data.description;
1176        }
1177      } else {
1178        slideText.parentNode.removeChild(slideText);
1179      }
1180
1181      addClass(slideMedia.parentNode, "desc-".concat(position));
1182      addClass(slideDesc.parentNode, "description-".concat(position));
1183    }
1184
1185    addClass(slideMedia, "gslide-".concat(type));
1186    addClass(slide, 'loaded');
1187
1188    if (type === 'video') {
1189      addClass(slideMedia.parentNode, "gvideo-container");
1190      slideMedia.insertBefore(createHTML('<div class="gvideo-wrapper"></div>'), slideMedia.firstChild);
1191      setSlideVideo.apply(this, [slide, data, finalCallback]);
1192      return;
1193    }
1194
1195    if (type === 'external') {
1196      var iframe = createIframe({
1197        url: data.href,
1198        callback: finalCallback
1199      });
1200      slideMedia.parentNode.style.maxWidth = data.width;
1201      slideMedia.parentNode.style.height = data.height;
1202      slideMedia.appendChild(iframe);
1203      return;
1204    }
1205
1206    if (type === 'inline') {
1207      setInlineContent.apply(this, [slide, data, finalCallback]);
1208      return;
1209    }
1210
1211    if (type === 'image') {
1212      var img = new Image();
1213      img.addEventListener('load', function () {
1214        if (!isMobile && img.naturalWidth > img.offsetWidth) {
1215          addClass(img, 'zoomable');
1216          new ZoomImages(img, slide, function () {
1217            _this.resize(slide);
1218          });
1219        }
1220
1221        if (utils.isFunction(finalCallback)) {
1222          finalCallback();
1223        }
1224      }, false);
1225      img.src = data.href;
1226      slideMedia.insertBefore(img, slideMedia.firstChild);
1227      return;
1228    }
1229
1230    if (utils.isFunction(finalCallback)) finalCallback();
1231  };
1232
1233  function setSlideVideo(slide, data, callback) {
1234    var _this2 = this;
1235
1236    var videoID = 'gvideo' + data.index;
1237    var slideMedia = slide.querySelector('.gvideo-wrapper');
1238    injectVideoApi(this.settings.plyr.css);
1239    var url = data.href;
1240    var protocol = location.protocol.replace(':', '');
1241    var videoSource = '';
1242    var embedID = '';
1243    var customPlaceholder = false;
1244
1245    if (protocol == 'file') {
1246      protocol = 'http';
1247    }
1248
1249    slideMedia.parentNode.style.maxWidth = data.width;
1250    injectVideoApi(this.settings.plyr.js, 'Plyr', function () {
1251      if (url.match(/vimeo\.com\/([0-9]*)/)) {
1252        var vimeoID = /vimeo.*\/(\d+)/i.exec(url);
1253        videoSource = 'vimeo';
1254        embedID = vimeoID[1];
1255      }
1256
1257      if (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)) {
1258        var youtubeID = getYoutubeID(url);
1259        videoSource = 'youtube';
1260        embedID = youtubeID;
1261      }
1262
1263      if (url.match(/\.(mp4|ogg|webm|mov)$/) !== null) {
1264        videoSource = 'local';
1265
1266        var _html = '<video id="' + videoID + '" ';
1267
1268        _html += "style=\"background:#000; max-width: ".concat(data.width, ";\" ");
1269        _html += 'preload="metadata" ';
1270        _html += 'x-webkit-airplay="allow" ';
1271        _html += 'webkit-playsinline="" ';
1272        _html += 'controls ';
1273        _html += 'class="gvideo-local">';
1274        var format = url.toLowerCase().split('.').pop();
1275        var sources = {
1276          'mp4': '',
1277          'ogg': '',
1278          'webm': ''
1279        };
1280        format = format == 'mov' ? 'mp4' : format;
1281        sources[format] = url;
1282
1283        for (var key in sources) {
1284          if (sources.hasOwnProperty(key)) {
1285            var videoFile = sources[key];
1286
1287            if (data.hasOwnProperty(key)) {
1288              videoFile = data[key];
1289            }
1290
1291            if (videoFile !== '') {
1292              _html += "<source src=\"".concat(videoFile, "\" type=\"video/").concat(key, "\">");
1293            }
1294          }
1295        }
1296
1297        _html += '</video>';
1298        customPlaceholder = createHTML(_html);
1299      }
1300
1301      var placeholder = customPlaceholder ? customPlaceholder : createHTML("<div id=\"".concat(videoI
1301D, "\" data-plyr-provider=\"").concat(videoSource, "\" data-plyr-embed-id=\"").concat(embedID, "\"></div>"));
1302      addClass(slideMedia, "".concat(videoSource, "-video gvideo"));
1303      slideMedia.appendChild(placeholder);
1304      slideMedia.setAttribute('data-id', videoID);
1305      var playerConfig = utils.has(_this2.settings.plyr, 'config') ? _this2.settings.plyr.config : {};
1306      var player = new Plyr('#' + videoID, playerConfig);
1307      player.on('ready', function (event) {
1308        var instance = event.detail.plyr;
1309        videoPlayers[videoID] = instance;
1310
1311        if (utils.isFunction(callback)) {
1312          callback();
1313        }
1314      });
1315      player.on('enterfullscreen', handleMediaFullScreen);
1316      player.on('exitfullscreen', handleMediaFullScreen);
1317    });
1318  }
1319
1320  function createIframe(config) {
1321    var url = config.url,
1322        allow = config.allow,
1323        callback = config.callback,
1324        appendTo = config.appendTo;
1325    var iframe = document.createElement('iframe');
1326    iframe.className = 'vimeo-video gvideo';
1327    iframe.src = url;
1328    iframe.style.width = '100%';
1329    iframe.style.height = '100%';
1330
1331    if (allow) {
1332      iframe.setAttribute('allow', allow);
1333    }
1334
1335    iframe.onload = function () {
1336      addClass(iframe, 'node-ready');
1337
1338      if (utils.isFunction(callback)) {
1339        callback();
1340      }
1341    };
1342
1343    if (appendTo) {
1344      appendTo.appendChild(iframe);
1345    }
1346
1347    return iframe;
1348  }
1349
1350  function getYoutubeID(url) {
1351    var videoID = '';
1352    url = url.replace(/(>|<)/gi, '').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
1353
1354    if (url[2] !== undefined) {
1355      videoID = url[2].split(/[^0-9a-z_\-]/i);
1356      videoID = videoID[0];
1357    } else {
1358      videoID = url;
1359    }
1360
1361    return videoID;
1362  }
1363
1364  function injectVideoApi(url, waitFor, callback) {
1365    if (utils.isNil(url)) {
1366      console.error('Inject videos api error');
1367      return;
1368    }
1369
1370    if (utils.isFunction(waitFor)) {
1371      callback = waitFor;
1372      waitFor = false;
1373    }
1374
1375    var found;
1376
1377    if (url.indexOf('.css') !== -1) {
1378      found = document.querySelectorAll('link[href="' + url + '"]');
1379
1380      if (found && found.length > 0) {
1381        if (utils.isFunction(callback)) callback();
1382        return;
1383      }
1384
1385      var head = document.getElementsByTagName("head")[0];
1386      var headStyles = head.querySelectorAll('link[rel="stylesheet"]');
1387      var link = document.createElement('link');
1388      link.rel = 'stylesheet';
1389      link.type = 'text/css';
1390      link.href = url;
1391      link.media = 'all';
1392
1393      if (headStyles) {
1394        head.insertBefore(link, headStyles[0]);
1395      } else {
1396        head.appendChild(link);
1397      }
1398
1399      if (utils.isFunction(callback)) callback();
1400      return;
1401    }
1402
1403    found = document.querySelectorAll('script[src="' + url + '"]');
1404
1405    if (found && found.length > 0) {
1406      if (utils.isFunction(callback)) {
1407        if (utils.isString(waitFor)) {
1408          waitUntil(function () {
1409            return typeof window[waitFor] !== 'undefined';
1410          }, function () {
1411            callback();
1412          });
1413          return false;
1414        }
1415
1416        callback();
1417      }
1418
1419      return;
1420    }
1421
1422    var script = document.createElement('script');
1423    script.type = 'text/javascript';
1424    script.src = url;
1425
1426    script.onload = function () {
1427      if (utils.isFunction(callback)) {
1428        if (utils.isString(waitFor)) {
1429          waitUntil(function () {
1430            return typeof window[waitFor] !== 'undefined';
1431          }, function () {
1432            callback();
1433          });
1434          return false;
1435        }
1436
1437        callback();
1438      }
1439    };
1440
1441    document.body.appendChild(script);
1442    return;
1443  }
1444
1445  function waitUntil(check, onComplete, delay, timeout) {
1446    if (check()) {
1447      onComplete();
1448      return;
1449    }
1450
1451    if (!delay) delay = 100;
1452    var timeoutPointer;
1453    var intervalPointer = setInterval(function () {
1454      if (!check()) return;
1455      clearInterval(intervalPointer);
1456      if (timeoutPointer) clearTimeout(timeoutPointer);
1457      onComplete();
1458    }, delay);
1459    if (timeout) timeoutPointer = setTimeout(function () {
1460      clearInterval(intervalPointer);
1461    }, timeout);
1462  }
1463
1464  function setInlineContent(slide, data, callback) {
1465    var _this3 = this;
1466
1467    var slideMedia = slide.querySelector('.gslide-media');
1468    var hash = utils.has(data, 'href') && data.href ? data.href.split('#').pop().trim() : false;
1469    var content = utils.has(data, 'content') && data.content ? data.content : false;
1470    var innerContent;
1471
1472    if (content) {
1473      if (utils.isString(content)) {
1474        innerContent = createHTML("<div class=\"ginlined-content\">".concat(content, "</div>"));
1475      }
1476
1477      if (utils.isNode(content)) {
1478        if (content.style.display == 'none') {
1479          content.style.display = 'block';
1480        }
1481
1482        var container = document.createElement('div');
1483        container.className = 'ginlined-content';
1484        container.appendChild(content);
1485        innerContent = container;
1486      }
1487    }
1488
1489    if (hash) {
1490      var div = document.getElementById(hash);
1491
1492      if (!div) {
1493        return false;
1494      }
1495
1496      var cloned = div.cloneNode(true);
1497      cloned.style.height = data.height;
1498      cloned.style.maxWidth = data.width;
1499      addClass(cloned, 'ginlined-content');
1500      innerContent = cloned;
1501    }
1502
1503    if (!innerContent) {
1504      console.error('Unable to append inline slide content', data);
1505      return false;
1506    }
1507
1508    slideMedia.style.height = data.height;
1509    slideMedia.style.width = data.width;
1510    slideMedia.appendChild(innerContent);
1511    this.events['inlineclose' + hash] = addEvent('click', {
1512      onElement: slideMedia.querySelectorAll('.gtrigger-close'),
1513      withCallback: function withCallback(e) {
1514        e.preventDefault();
1515
1516        _this3.close();
1517      }
1518    });
1519
1520    if (utils.isFunction(callback)) {
1521      callback();
1522    }
1523
1524    return;
1525  }
1526
1527  var getSourceType = function getSourceType(url) {
1528    var origin = url;
1529    url = url.toLowerCase();
1530
1531    if (url.match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|svg)$/) !== null) {
1532      return 'image';
1533    }
1534
1535    if (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)) {
1536      return 'video';
1537    }
1538
1539    if (url.match(/vimeo\.com\/([0-9]*)/)) {
1540      return 'video';
1541    }
1542
1543    if (url.match(/\.(mp4|ogg|webm|mov)$/) !== null) {
1544      return 'video';
1545    }
1546
1547    if (url.indexOf("#") > -1) {
1548      var hash = origin.split('#').pop();
1549
1550      if (hash.trim() !== '') {
1551        return 'inline';
1552      }
1553    }
1554
1555    if (url.includes("gajax=true")) {
1556      return 'ajax';
1557    }
1558
1559    return 'external';
1560  };
1561
1562  function keyboardNavigation() {
1563    var _this4 = this;
1564
1565    if (this.events.hasOwnProperty('keyboard')) {
1566      return false;
1567    }
1568
1569    this.events['keyboard'] = addEvent('keydown', {
1570      onElement: window,
1571      withCallback: function withCallback(event, target) {
1572        event = event || window.event;
1573        var key = event.keyCode;
1574
1575        if (key == 9) {
1576          var activeElement = document.activeElement && document.activeElement.nodeName ? document.activeElement.nodeName.toLocaleLowerCase() : false;
1577
1578          if (activeElement == 'input' || activeElement == 'textarea' || activeElement == 'button') {
1579            return;
1580          }
1581
1582          event.preventDefault();
1583          var btns = document.querySelectorAll('.gbtn');
1584
1585          if (!btns || btns.length <= 0) {
1586            return;
1587          }
1588
1589          var focused = _toConsumableArray(btns).filter(function (item) {
1590            return hasClass(item, 'focused');
1591          });
1592
1593          if (!focused.length) {
1594            var first = document.querySelector('.gbtn[tabindex="0"]');
1595
1596            if (first) {
1597              first.focus();
1598              addClass(first, 'focused');
1599            }
1600
1601            return;
1602          }
1603
1604          btns.forEach(function (element) {
1605            return removeClass(element, 'focused');
1606          });
1607          var tabindex = focused[0].getAttribute('tabindex');
1608          tabindex = tabindex ? tabindex : '0';
1609          var newIndex = parseInt(tabindex) + 1;
1610
1611          if (newIndex > btns.length - 1) {
1612            newIndex = '0';
1613          }
1614
1615          var next = document.querySelector(".gbtn[tabindex=\"".concat(newIndex, "\"]"));
1616
1617          if (next) {
1618            next.focus();
1619            addClass(next, 'focused');
1620          }
1621        }
1622
1623        if (key == 39) _this4.nextSlide();
1624        if (key == 37) _this4.prevSlide();
1625        if (key == 27) _this4.close();
1626      }
1627    });
1628  }
1629
1630  function touchNavigation() {
1631    var _this5 = this;
1632
1633    if (this.events.hasOwnProperty('touch')) {
1634      return false;
1635    }
1636
1637    var winSize = windowSize();
1638    var winWidth = winSize.width;
1639    var winHeight = winSize.height;
1640    var process = false;
1641    var currentSlide = null;
1642    var media = null;
1643    var mediaImage = null;
1644    var doingMove = false;
1645    var initScale = 1;
1646    var maxScale = 4.5;
1647    var currentScale = 1;
1648    var doingZoom = false;
1649    var imageZoomed = false;
1650    var zoomedPosX = null;
1651    var zoomedPosY = null;
1652    var lastZoomedPosX = null;
1653    var lastZoomedPosY = null;
1654    var hDistance;
1655    var vDistance;
1656    var hDistancePercent = 0;
1657    var vDistancePercent = 0;
1658    var vSwipe = false;
1659    var hSwipe = false;
1660    var startCoords = {};
1661    var endCoords = {};
1662    var xDown = 0;
1663    var yDown = 0;
1664    var isInlined;
1665    var instance = this;
1666    var sliderWrapper = document.getElementById('glightbox-slider');
1667    var overlay = document.querySelector('.goverlay');
1668    var loop = this.loop();
1669    var touchInstance = new TouchEvents(sliderWrapper, {
1670      touchStart: function touchStart(e) {
1671        if (hasClass(e.targetTouches[0].target, 'ginner-container') || getClosest(e.targetTouches[0].target, '.gslide-desc')) {
1672          process = false;
1673          return false;
1674        }
1675
1676        process = true;
1677        endCoords = e.targetTouches[0];
1678        startCoords.pageX = e.targetTouches[0].pageX;
1679        startCoords.pageY = e.targetTouches[0].pageY;
1680        xDown = e.targetTouches[0].clientX;
1681        yDown = e.targetTouches[0].clientY;
1682        currentSlide = instance.activeSlide;
1683        media = currentSlide.querySelector('.gslide-media');
1684        isInlined = currentSlide.querySelector('.gslide-inline');
1685        mediaImage = null;
1686
1687        if (hasClass(media, 'gslide-image')) {
1688          mediaImage = media.querySelector('img');
1689        }
1690
1691        removeClass(overlay, 'greset');
1692      },
1693      touchMove: function touchMove(e) {
1694        if (!process) {
1695          return;
1696        }
1697
1698        endCoords = e.targetTouches[0];
1699
1700        if (doingZoom || imageZoomed) {
1701          return;
1702        }
1703
1704        if (isInlined && isInlined.offsetHeight > winHeight) {
vendor: 3,278 bytes, lines 1705-1823
1705          var moved = startCoords.pageX - endCoords.pageX;
1706
1707          if (Math.abs(moved) <= 13) {
1708            return false;
1709          }
1710        }
1711
1712        doingMove = true;
1713        var xUp = e.targetTouches[0].clientX;
1714        var yUp = e.targetTouches[0].clientY;
1715        var xDiff = xDown - xUp;
1716        var yDiff = yDown - yUp;
1717
1718        if (Math.abs(xDiff) > Math.abs(yDiff)) {
1719          vSwipe = false;
1720          hSwipe = true;
1721        } else {
1722          hSwipe = false;
1723          vSwipe = true;
1724        }
1725
1726        hDistance = endCoords.pageX - startCoords.pageX;
1727        hDistancePercent = hDistance * 100 / winWidth;
1728        vDistance = endCoords.pageY - startCoords.pageY;
1729        vDistancePercent = vDistance * 100 / winHeight;
1730        var opacity;
1731
1732        if (vSwipe && mediaImage) {
1733          opacity = 1 - Math.abs(vDistance) / winHeight;
1734          overlay.style.opacity = opacity;
1735
1736          if (_this5.settings.touchFollowAxis) {
1737            hDistancePercent = 0;
1738          }
1739        }
1740
1741        if (hSwipe) {
1742          opacity = 1 - Math.abs(hDistance) / winWidth;
1743          media.style.opacity = opacity;
1744
1745          if (_this5.settings.touchFollowAxis) {
1746            vDistancePercent = 0;
1747          }
1748        }
1749
1750        if (!mediaImage) {
1751          return slideCSSTransform(media, "translate3d(".concat(hDistancePercent, "%, 0, 0)"));
1752        }
1753
1754        slideCSSTransform(media, "translate3d(".concat(hDistancePercent, "%, ").concat(vDistancePercent, "%, 0)"));
1755      },
1756      touchEnd: function touchEnd() {
1757        if (!process) {
1758          return;
1759        }
1760
1761        doingMove = false;
1762
1763        if (imageZoomed || doingZoom) {
1764          lastZoomedPosX = zoomedPosX;
1765          lastZoomedPosY = zoomedPosY;
1766          return;
1767        }
1768
1769        var v = Math.abs(parseInt(vDistancePercent));
1770        var h = Math.abs(parseInt(hDistancePercent));
1771
1772        if (v > 29 && mediaImage) {
1773          _this5.close();
1774
1775          return;
1776        }
1777
1778        if (v < 29 && h < 25) {
1779          addClass(overlay, 'greset');
1780          overlay.style.opacity = 1;
1781          return resetSlideMove(media);
1782        }
1783      },
1784      multipointEnd: function multipointEnd() {
1785        setTimeout(function () {
1786          doingZoom = false;
1787        }, 50);
1788      },
1789      multipointStart: function multipointStart() {
1790        doingZoom = true;
1791        initScale = currentScale ? currentScale : 1;
1792      },
1793      pinch: function pinch(evt) {
1794        if (!mediaImage || doingMove) {
1795          return false;
1796        }
1797
1798        doingZoom = true;
1799        mediaImage.scaleX = mediaImage.scaleY = initScale * evt.zoom;
1800        var scale = initScale * evt.zoom;
1801        imageZoomed = true;
1802
1803        if (scale <= 1) {
1804          imageZoomed = false;
1805          scale = 1;
1806          lastZoomedPosY = null;
1807          lastZoomedPosX = null;
1808          zoomedPosX = null;
1809          zoomedPosY = null;
1810          mediaImage.setAttribute('style', '');
1811          return;
1812        }
1813
1814        if (scale > maxScale) {
1815          scale = maxScale;
1816        }
1817
1818        mediaImage.style.transform = "scale3d(".concat(scale, ", ").concat(scale, ", 1)");
1819        currentScale = scale;
1820      },
1821      pressMove: function pressMove(e) {
1822        if (imageZoomed && !doingZoom) {
1823          var mhDistance = endCoords.pageX 
1823- startCoords.pageX;
1824          var mvDistance = endCoords.pageY - startCoords.pageY;
1825
1826          if (lastZoomedPosX) {
1827            mhDistance = mhDistance + lastZoomedPosX;
1828          }
1829
1830          if (lastZoomedPosY) {
1831            mvDistance = mvDistance + lastZoomedPosY;
1832          }
1833
1834          zoomedPosX = mhDistance;
1835          zoomedPosY = mvDistance;
1836          var style = "translate3d(".concat(mhDistance, "px, ").concat(mvDistance, "px, 0)");
1837
1838          if (currentScale) {
1839            style += " scale3d(".concat(currentScale, ", ").concat(currentScale, ", 1)");
1840          }
1841
1842          slideCSSTransform(mediaImage, style);
1843        }
1844      },
1845      swipe: function swipe(evt) {
1846        if (imageZoomed) {
1847          return;
1848        }
1849
1850        if (doingZoom) {
1851          doingZoom = false;
1852          return;
1853        }
1854
1855        if (evt.direction == 'Left') {
1856          if (_this5.index == _this5.elements.length - 1) {
1857            return resetSlideMove(media);
1858          }
1859
1860          _this5.nextSlide();
1861        }
1862
1863        if (evt.direction == 'Right') {
1864          if (_this5.index == 0) {
1865            return resetSlideMove(media);
1866          }
1867
1868          _this5.prevSlide();
1869        }
1870      }
1871    });
1872    this.events['touch'] = touchInstance;
1873  }
1874
1875  function slideCSSTransform(slide) {
1876    var translate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1877
1878    if (translate == '') {
1879      slide.style.webkitTransform = '';
1880      slide.style.MozTransform = '';
1881      slide.style.msTransform = '';
1882      slide.style.OTransform = '';
1883      slide.style.transform = '';
1884      return false;
1885    }
1886
1887    slide.style.webkitTransform = translate;
1888    slide.style.MozTransform = translate;
1889    slide.style.msTransform = translate;
1890    slide.style.OTransform = translate;
1891    slide.style.transform = translate;
1892  }
1893
1894  function resetSlideMove(slide) {
1895    var media = hasClass(slide, 'gslide-media') ? slide : slide.querySelector('.gslide-media');
1896    var desc = slide.querySelector('.gslide-description');
1897    addClass(media, 'greset');
1898    slideCSSTransform(media, "translate3d(0, 0, 0)");
1899    var animation = addEvent(transitionEnd, {
1900      onElement: media,
1901      once: true,
1902      withCallback: function withCallback(event, target) {
1903        removeClass(media, 'greset');
1904      }
1905    });
1906    media.style.opacity = '';
1907
1908    if (desc) {
1909      desc.style.opacity = '';
1910    }
1911  }
1912
1913  function slideShortDesc(string) {
1914    var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
1915    var wordBoundary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1916    var useWordBoundary = wordBoundary;
1917    string = string.trim();
1918
1919    if (string.length <= n) {
1920      return string;
1921    }
1922
1923    var subString = string.substr(0, n - 1);
1924
1925    if (!useWordBoundary) {
1926      return subString;
1927    }
1928
1929    return subString + '... <a href="#" class="desc-more">' + wordBoundary + '</a>';
1930  }
1931
1932  function slideDescriptionEvents(desc, data) {
1933    var moreLink = desc.querySelector('.desc-more');
1934
1935    if (!moreLink) {
1936      return false;
1937    }
1938
1939    addEvent('click', {
1940      onElement: moreLink,
1941      withCallback: function withCallback(event, target) {
1942        event.preventDefault();
1943        var body = document.body;
1944        var desc = getClosest(target, '.gslide-desc');
1945
1946        if (!desc) {
1947          return false;
1948        }
1949
1950        desc.innerHTML = data.description;
1951        addClass(body, 'gdesc-open');
1952        var shortEvent = addEvent('click', {
1953          onElement: [body, getClosest(desc, '.gslide-description')],
1954          withCallback: function withCallback(event, target) {
1955            if (event.target.nodeName.toLowerCase() !== 'a') {
1956              removeClass(body, 'gdesc-open');
1957              addClass(body, 'gdesc-closed');
1958              desc.innerHTML = data.smallDescription;
1959              slideDescriptionEvents(desc, data);
1960              setTimeout(function () {
1961                removeClass(body, 'gdesc-closed');
1962              }, 400);
1963              shortEvent.destroy();
1964            }
1965          }
1966        });
1967      }
1968    });
1969  }
1970
1971  var GlightboxInit = function () {
1972    function GlightboxInit() {
1973      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1974
1975      _classCallCheck(this, GlightboxInit);
1976
1977      this.settings = extend(defaults, options);
1978      this.effectsClasses = this.getAnimationClasses();
1979      this.slidesData = {};
1980    }
1981
1982    _createClass(GlightboxInit, [{
1983      key: "init",
1984      value: function init() {
1985        var _this6 = this;
1986
1987        this.baseEvents = addEvent('click', {
1988          onElement: this.getSelector(),
1989          withCallback: function withCallback(e, target) {
1990            e.preventDefault();
1991
1992            _this6.open(target);
1993          }
1994        });
1995      }
1996    }, {
1997      key: "open",
1998      value: function open() {
1999        var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2000        var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2001        this.elements = this.getElements(element);
2002        if (this.elements.length == 0) return false;
2003        this.activeSlide = null;
2004        this.prevActiveSlideIndex = null;
2005        this.prevActiveSlide = null;
2006        var index = startAt ? startAt : this.settings.startAt;
2007
2008        if (element && utils.isNil(index)) {
2009          index = this.elements.indexOf(element);
2010
2011          if (index < 0) {
2012            index = 0;
2013          }
2014        }
2015
2016        if (utils.isNil(index)) {
2017          index = 0;
2018        }
2019
2020        this.build();
2021        animateElement(this.overlay, this.settings.openEffect == 'none' ? 'none' : this.settings.cssEfects.fade["in"]);
2022        var body = document.body;
2023        var scrollBar = window.innerWidth - document.documentElement.clientWidth;
2024
2025        if (scrollBar > 0) {
2026          var styleSheet = document.createElement("style");
2027          styleSheet.type = 'text/css';
2028          styleSheet.className = 'gcss-styles';
2029          styleSheet.innerText = ".gscrollbar-fixer {margin-right: ".concat(scrollBar, "px}");
2030          document.head.appendChild(styleSheet);
2031          addClass(body, 'gscrollbar-fixer');
2032        }
2033
2034        addClass(body, 'glightbox-open');
2035        addClass(html, 'glightbox-open');
2036
2037        if (isMobile) {
2038          addClass(document.body, 'glightbox-mobile');
2039          this.settings.slideEffect = 'slide';
2040        }
2041
2042        this.showSlide(index, true);
2043
2044        if (this.elements.length == 1) {
2045          hide(this.prevButton);
2046          hide(this.nextButton);
2047        } else {
2048          show(this.prevButton);
2049          show(this.nextButton);
2050        }
2051
2052        this.lightboxOpen = true;
2053
2054        if (utils.isFunction(this.settings.onOpen)) {
2055          this.settings.onOpen();
2056        }
2057
2058        if (isMobile && isTouch && this.settings.touchNavigation) {
2059          touchNavigation.apply(this);
2060          return false;
2061        }
2062
2063        if (this.settings.keyboardNavigation) {
2064          keyboardNavigation.apply(this);
2065        }
2066      }
2067    }, {
2068      key: "openAt",
2069      value: function openAt() {
2070        var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2071        this.open(null, index);
2072      }
2073    }, {
2074      key: "showSlide",
2075      value: function showSlide() {
2076        var _this7 = this;
2077
2078        var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2079        var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2080        show(this.loader);
2081        this.index = parseInt(index);
2082        var current = this.slidesContainer.querySelector('.current');
2083
2084        if (current) {
2085          removeClass(current, 'current');
2086        }
2087
2088        this.slideAnimateOut();
2089        var slide = this.slidesContainer.querySelectorAll('.gslide')[index];
2090
2091        if (hasClass(slide, 'loaded')) {
2092          this.slideAnimateIn(slide, first);
2093          hide(this.loader);
2094        } else {
2095          show(this.loader);
2096          var slideData = getSlideData(this.elements[index], this.settings);
2097          slideData.index = index;
2098          this.slidesData[index] = slideData;
2099          setSlideContent.apply(this, [slide, slideData, function () {
2100            hide(_this7.loader);
2101
2102            _this7.resize();
2103
2104            _this7.slideAnimateIn(slide, first);
2105          }]);
2106        }
2107
2108        this.slideDescription = slide.querySelector('.gslide-description');
2109        this.slideDescriptionContained = this.slideDescription && hasClass(this.slideDescription.parentNode, 'gslide-media');
2110        this.preloadSlide(index + 1);
2111        this.preloadSlide(index - 1);
2112        var loop = this.loop();
2113        removeClass(this.nextButton, 'disabled');
2114        removeClass(this.prevButton, 'disabled');
2115
2116        if (index === 0 && !loop) {
2117          addClass(this.prevButton, 'disabled');
2118        } else if (index === this.elements.length - 1 && !loop) {
2119          addClass(this.nextButton, 'disabled');
2120        }
2121
2122        this.activeSlide = slide;
2123      }
2124    }, {
2125      key: "preloadSlide",
2126      value: function preloadSlide(index) {
2127        var _this8 = this;
2128
2129        if (index < 0 || index > this.elements.length) return false;
2130        if (utils.isNil(this.elements[index])) return false;
2131        var slide = this.slidesContainer.querySelectorAll('.gslide')[index];
2132
2133        if (hasClass(slide, 'loaded')) {
2134          return false;
2135        }
2136
2137        var slideData = getSlideData(this.elements[index], this.settings);
2138        slideData.index = index;
2139        this.slidesData[index] = slideData;
2140        var type = slideData.sourcetype;
2141
2142        if (type == 'video' || type == 'external') {
2143          setTimeout(function () {
2144            setSlideContent.apply(_this8, [slide, slideData]);
2145          }, 200);
2146        } else {
2147          setSlideContent.apply(this, [slide, slideData]);
2148        }
2149      }
2150    }, {
2151      key: "prevSlide",
2152      value: function prevSlide() {
2153        this.goToSlide(this.index - 1);
2154      }
2155    }, {
2156      key: "nextSlide",
2157      value: function nextSlide() {
2158        this.goToSlide(this.index + 1);
2159      }
2160    }, {
2161      key: "goToSlide",
2162      value: function goToSlide() {
2163        var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2164        this.prevActiveSlide = this.activeSlide;
2165        this.prevActiveSlideIndex = this.index;
2166        var loop = this.loop();
2167
2168        if (!loop && (index < 0 || index > this.elements.length - 1)) {
2169          return false;
2170        }
2171
2172        if (index < 0) {
2173          index = this.elements.length - 1;
2174        } else if (index >= this.elements.length) {
2175          index = 0;
2176        }
2177
2178        this.showSlide(index);
2179      }
2180    }, {
2181      key: "insertSlide",
2182      value: function insertSlide() {
2183        var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2184        var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
2185
2186        if (!this.tmpAddSlides) {
2187          this.tmpAddSlides = [];
2188        }
2189
2190        data.atPosition = index;
2191        this.tmpAddSlides.push(data);
2192      }
2193    }, {
2194      key: "slideAnimateIn",
2195      value: function slideAnimateIn(slide, first) {
2196        var _this9 = this;
2197
2198        var slideMedia = slide.querySelector('.gslide-media');
2199        var slideDesc = slide.querySelector('.gslide-description');
2200        var prevData = {
2201          index: this.prevActiveSlideIndex,
2202          slide: this.prevActiveSlide
2203        };
2204        var nextData = {
2205          index: this.index,
2206          slide: this.activeSlide
2207        };
2208
2209        if (slideMedia.offsetWidth > 0 && slideDesc) {
2210          hide(slideDesc);
2211          slideDesc.style.display = '';
2212        }
2213
2214        removeClass(slide, this.effectsClasses);
2215
2216        if (first) {
2217          animateElement(slide, this.settings.openEffect, function () {
2218            if (!isMobile && _this9.settings.autoplayVideos) {
2219              _this9.playSlideVideo(slide);
2220            }
2221
2222            if (utils.isFunction(_this9.settings.afterSlideChange)) {
2223              _this9.settings.afterSlideChange.apply(_this9, [prevData, nextData]);
2224            }
2225          });
2226        } else {
2227          var effect_name = this.settings.slideEffect;
2228          var animIn = effect_name !== 'none' ? this.settings.cssEfects[effect_name]["in"] : effect_name;
2229
2230          if (this.prevActiveSlideIndex > this.index) {
2231            if (this.settings.slideEffect == 'slide') {
2232              animIn = this.settings.cssEfects.slide_back["in"];
2233            }
2234          }
2235
2236          animateElement(slide, animIn, function () {
2237            if (!isMobile && _this9.settings.autoplayVideos) {
2238              _this9.playSlideVideo(slide);
2239            }
2240
2241            if (utils.isFunction(_this9.settings.afterSlideChange)) {
2242              _this9.settings.afterSlideChange.apply(_this9, [prevData, nextData]);
2243            }
2244          });
2245        }
2246
2247        setTimeout(function () {
2248          _this9.resize(slide);
2249        }, 100);
2250        addClass(slide, 'current');
2251      }
2252    }, {
2253      key: "slideAnimateOut",
2254      value: function slideAnimateOut() {
2255        if (!this.prevActiveSlide) {
2256          return false;
2257        }
2258
2259        var prevSlide = this.prevActiveSlide;
2260        removeClass(prevSlide, this.effectsClasses);
2261        addClass(prevSlide, 'prev');
2262        var animation = this.settings.slideEffect;
2263        var animOut = animation !== 'none' ? this.settings.cssEfects[animation].out : animation;
2264        this.stopSlideVideo(prevSlide);
2265
2266        if (utils.isFunction(this.settings.beforeSlideChange)) {
2267          this.settings.beforeSlideChange.apply(this, [{
2268            index: this.prevActiveSlideIndex,
2269            slide: this.prevActiveSlide
2270          }, {
2271            index: this.index,
2272            slide: this.activeSlide
2273          }]);
2274        }
2275
2276        if (this.prevActiveSlideIndex > this.index && this.settings.slideEffect == 'slide') {
2277          animOut = this.settings.cssEfects.slide_back.out;
2278        }
2279
2280        animateElement(prevSlide, animOut, function () {
2281          var media = prevSlide.querySelector('.gslide-media');
2282          var desc = prevSlide.querySelector('.gslide-description');
2283          media.style.transform = '';
2284          removeClass(media, 'greset');
2285          media.style.opacity = '';
2286
2287          if (desc) {
2288            desc.style.opacity = '';
2289          }
2290
2291          removeClass(prevSlide, 'prev');
2292        });
2293      }
2294    }, {
2295      key: "stopSlideVideo",
2296      value: function stopSlideVideo(slide) {
2297        if (utils.isNumber(slide)) {
2298          slide = this.slidesContainer.querySelectorAll('.gslide')[slide];
2299        }
2300
2301        var slideVideo = slide ? slide.querySelector('.gvideo') : null;
2302
2303        if (!slideVideo) {
2304          return false;
2305        }
2306
2307        var videoID = slideVideo.getAttribute('data-id');
2308
2309        if (videoPlayers && utils.has(videoPlayers, videoID)) {
2310          var api = videoPlayers[videoID];
2311
2312          if (api && api.play) {
2313            api.pause();
2314          }
2315        }
2316      }
2317    }, {
2318      key: "playSlideVideo",
2319      value: function playSlideVideo(slide) {
2320        if (utils.isNumber(slide)) {
2321          slide = this.slidesContainer.querySelectorAll('.gslide')[slide];
2322        }
2323
2324        var slideVideo = slide.querySelector('.gvideo');
2325
2326        if (!slideVideo) {
2327          return false;
2328        }
2329
2330        var videoID = slideVideo.getAttribute('data-id');
2331
2332        if (videoPlayers && utils.has(videoPlayers, videoID)) {
2333          var api = videoPlayers[videoID];
2334
2335          if (api && api.play) {
2336            api.play();
2337          }
2338        }
2339      }
2340    }, {
2341      key: "setElements",
2342      value: function setElements(elements) {
2343        this.settings.elements = elements;
2344      }
2345    }, {
2346      key: "getElements",
2347      value: function getElements() {
2348        var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2349        var list = [];
2350        this.elements = this.elements ? this.elements : [];
2351
2352        if (!utils.isNil(this.settings.elements) && utils.isArray(this.settings.elements)) {
2353          list = this.settings.elements;
2354        }
2355
2356        var nodes = false;
2357        var selector = this.getSelector();
2358
2359        if (element !== null) {
2360          var gallery = element.getAttribute('data-gallery');
2361
2362          if (gallery && gallery !== '') {
2363            nodes = document.querySelectorAll("[data-gallery=\"".concat(gallery, "\"]"));
2364          }
2365        }
2366
2367        if (nodes == false && selector) {
2368          nodes = document.querySelectorAll(this.getSelector());
2369        }
2370
2371        nodes = Array.prototype.slice.call(nodes);
2372        list = list.concat(nodes);
2373
2374        if (this.tmpAddSlides && this.tmpAddSlides.length) {
2375          each(this.tmpAddSlides, function (tmp) {
2376            var pos = tmp.atPosition < 0 ? list.length + 1 : tmp.atPosition;
2377            list.splice(pos, 0, extend({}, tmp));
2378          });
2379          this.tmpAddSlides.length = 0;
2380        }
2381
2382        return list;
2383      }
2384    }, {
2385      key: "getSelector",
2386      value: function getSelector() {
2387        if (this.settings.selector.substring(0, 5) == 'data-') {
2388          return "*[".concat(this.settings.selector, "]");
2389        }
2390
2391        return this.settings.selector;
2392      }
2393    }, {
2394      key: "getActiveSlide",
2395      value: function getActiveSlide() {
2396        return this.slidesContainer.querySelectorAll('.gslide')[this.index];
2397      }
2398    }, {
2399      key: "getActiveSlideIndex",
2400      value: function getActiveSlideIndex() {
2401        return this.index;
2402      }
2403    }, {
2404      key: "getAnimationClasses",
2405      value: function getAnimationClasses() {
2406        var effects = [];
2407
2408        for (var key in this.settings.cssEfects) {
2409          if (this.settings.cssEfects.hasOwnProperty(key)) {
2410            var effect = this.settings.cssEfects[key];
2411            effects.push("g".concat(effect["in"]));
2412            effects.push("g".concat(effect.out));
2413          }
2414        }
2415
2416        return effects.join(' ');
2417      }
2418    }, {
2419      key: "build",
2420      value: function build() {
2421        var _this10 = this;
2422
2423        if (this.built) {
2424          return false;
2425        }
2426
2427        var nextSVG = utils.has(this.settings.svg, 'next') ? this.settings.svg.next : '';
2428        var prevSVG = utils.has(this.settings.svg, 'prev') ? this.settings.svg.prev : '';
2429        var closeSVG = utils.has(this.settings.svg, 'close') ? this.settings.svg.close : '';
2430        var lightboxHTML = this.settings.lightboxHtml;
2431        lightboxHTML = lightboxHTML.replace(/{nextSVG}/g, nextSVG);
2432        lightboxHTML = lightboxHTML.replace(/{prevSVG}/g, prevSVG);
2433        lightboxHTML = lightboxHTML.replace(/{closeSVG}/g, closeSVG);
2434        lightboxHTML = createHTML(lightboxHTML);
2435        document.body.appendChild(lightboxHTML);
2436        var modal = document.getElementById('glightbox-body');
2437        this.modal = modal;
2438        var closeButton = modal.querySelector('.gclose');
2439        this.prevButton = modal.querySelector('.gprev');
2440        this.nextButton = modal.querySelector('.gnext');
2441        this.overlay = modal.querySelector('.goverlay');
2442        this.loader = modal.querySelector('.gloader');
2443        this.slidesContainer = document.getElementById('glightbox-slider');
2444        this.events = {};
2445        addClass(this.modal, 'glightbox-' + this.settings.skin);
2446
2447        if (this.settings.closeButton && closeButton) {
2448          this.events['close'] = addEvent('click', {
2449            onElement: closeButton,
2450            withCallback: function withCallback(e, target) {
2451              e.preventDefault();
2452
2453              _this10.close();
2454            }
2455          });
2456        }
2457
2458        if (closeButton && !this.settings.closeButton) {
2459          closeButton.parentNode.removeChild(closeButton);
2460        }
2461
2462        if (this.nextButton) {
2463          this.events['next'] = addEvent('click', {
2464            onElement: this.nextButton,
2465            withCallback: function withCallback(e, target) {
2466              e.preventDefault();
2467
2468              _this10.nextSlide();
2469            }
2470          });
2471        }
2472
2473        if (this.prevButton) {
2474          this.events['prev'] = addEvent('click', {
2475            onElement: this.prevButton,
2476            withCallback: function withCallback(e, target) {
2477              e.preventDefault();
2478
2479              _this10.prevSlide();
2480            }
2481          });
2482        }
2483
2484        if (this.settings.closeOnOutsideClick) {
2485          this.events['outClose'] = addEvent('click', {
2486            onElement: modal,
2487            withCallback: function withCallback(e, target) {
2488              if (!hasClass(document.body, 'glightbox-mobile') && !getClosest(e.target, '.ginner-container')) {
2489                if (!getClosest(e.target, '.gbtn') && !hasClass(e.target, 'gnext') && !hasClass(e.target, 'gprev')) {
2490                  _this10.close();
2491                }
2492              }
2493            }
2494          });
2495        }
2496
2497        each(this.elements, function () {
2498          var slide = createHTML(_this10.settings.slideHtml);
2499
2500          _this10.slidesContainer.appendChild(slide);
2501        });
2502
2503        if (isTouch) {
2504          addClass(document.body, 'glightbox-touch');
2505        }
2506
2507        this.events['resize'] = addEvent('resize', {
2508          onElement: window,
2509          withCallback: function withCallback() {
2510            _this10.resize();
2511          }
2512        });
2513        this.built = true;
2514      }
2515    }, {
2516      key: "resize",
2517      value: function resize() {
2518        var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2519        slide = !slide ? this.activeSlide : slide;
2520
2521        if (!slide || hasClass(slide, 'zoomed')) {
2522          return;
2523        }
2524
2525        var winSize = windowSize();
2526        var video = slide.querySelector('.gvideo-wrapper');
2527        var image = slide.querySelector('.gslide-image');
2528        var description = this.slideDescription;
2529        var winWidth = winSize.width;
2530        var winHeight = winSize.height;
2531
2532        if (winWidth <= 768) {
2533          addClass(document.body, 'glightbox-mobile');
2534        } else {
2535          removeClass(document.body, 'glightbox-mobile');
2536        }
2537
2538        if (!video && !image) {
2539          return;
2540        }
2541
2542        var descriptionResize = false;
2543
2544        if (description && (hasClass(description, 'description-bottom') || hasClass(description, 'description-top')) && !hasClass(description, 'gabsolute')) {
2545          descriptionResize = true;
2546        }
2547
2548        if (image) {
2549          if (winWidth <= 768) {
2550            var imgNode = image.querySelector('img');
2551            imgNode.setAttribute('style', '');
2552          } else if (descriptionResize) {
2553            var descHeight = description.offsetHeight;
2554            var maxWidth = this.slidesData[this.index].width;
2555            maxWidth = maxWidth <= winWidth ? maxWidth + 'px' : '100%';
2556
2557            var _imgNode = image.querySelector('img');
2558
2559            _imgNode.setAttribute('style', "max-height: calc(100vh - ".concat(descHeight, "px)"));
2560
2561            description.setAttribute('style', "max-width: ".concat(_imgNode.offsetWidth, "px;"));
2562          }
2563        }
2564
2565        if (video) {
2566          var ratio = utils.has(this.settings.plyr.config, 'ratio') ? this.settings.plyr.config.ratio : '16:9';
2567          var videoRatio = ratio.split(':');
2568          var _maxWidth = this.slidesData[this.index].width;
2569
2570          var maxHeight = _maxWidth / (parseInt(videoRatio[0]) / parseInt(videoRatio[1]));
2571
2572          maxHeight = Math.floor(maxHeight);
2573
2574          if (descriptionResize) {
2575            winHeight = winHeight - description.offsetHeight;
2576          }
2577
2578          if (winHeight < maxHeight && winWidth > _maxWidth) {
2579            var vwidth = video.offsetWidth;
2580            var vheight = video.offsetHeight;
2581
2582            var _ratio = winHeight / vheight;
2583
2584            var vsize = {
2585              width: vwidth * _ratio,
2586              height: vheight * _ratio
2587            };
2588            video.parentNode.setAttribute('style', "max-width: ".concat(vsize.width, "px"));
2589
2590            if (descriptionResize) {
2591              description.setAttribute('style', "max-width: ".concat(vsize.width, "px;"));
2592            }
2593          } else {
2594            video.parentNode.style.maxWidth = "".concat(_maxWidth, "px");
2595
2596            if (descriptionResize) {
2597              description.setAttribute('style', "max-width: ".concat(_maxWidth, "px;"));
2598            }
2599          }
2600        }
2601      }
2602    }, {
2603      key: "reload",
2604      value: function reload() {
2605        this.init();
2606      }
2607    }, {
2608      key: "loop",
2609      value: function loop() {
2610        var loop = utils.has(this.settings, 'loopAtEnd') ? this.settings.loopAtEnd : null;
2611        loop = utils.has(this.settings, 'loop') ? this.settings.loop : loop;
2612        return loop;
2613      }
2614    }, {
2615      key: "close",
2616      value: function close() {
2617        var _this11 = this;
2618
2619        if (this.closing) {
2620          return false;
2621        }
2622
2623        this.closing = true;
2624        this.stopSlideVideo(this.activeSlide);
2625        addClass(this.modal, 'glightbox-closing');
2626        animateElement(this.overlay, this.settings.openEffect == 'none' ? 'none' : this.settings.cssEfects.fade.out);
2627        animateElement(this.activeSlide, this.settings.closeEffect, function () {
2628          _this11.activeSlide = null;
2629          _this11.prevActiveSlideIndex = null;
2630          _this11.prevActiveSlide = null;
2631          _this11.built = false;
2632
2633          if (_this11.events) {
2634            for (var key in _this11.events) {
2635              if (_this11.events.hasOwnProperty(key)) {
2636                _this11.events[key].destroy();
2637              }
2638            }
2639
2640            _this11.events = null;
2641          }
2642
2643          var body = document.body;
2644          removeClass(html, 'glightbox-open');
2645          removeClass(body, 'glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer');
2646
2647          _this11.modal.parentNode.removeChild(_this11.modal);
2648
2649          if (utils.isFunction(_this11.settings.onClose)) {
2650            _this11.settings.onClose();
2651          }
2652
2653          var styles = document.querySelector('.gcss-styles');
2654
2655          if (styles) {
2656            styles.parentNode.removeChild(styles);
2657          }
2658
2659          _this11.closing = null;
2660        });
2661      }
2662    }, {
2663      key: "destroy",
2664      value: function destroy() {
2665        this.close();
2666        this.baseEvents.destroy();
2667      }
2668    }]);
2669
2670    return GlightboxInit;
2671  }();
2672
2673  function glightbox () {
2674    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2675    var instance = new GlightboxInit(options);
2676    instance.init();
2677    return instance;
2678  }
2679
2680  return glightbox;
2681
2682})));

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.