PageSourceSearch

https://conorsfund.org/js/GalleryLib.js?ts=20230620142212

js conorsfund.org collected 2026-10-04 02:11:38 UTC 81,208 bytes, 1,803 lines download raw bytes

1var __assign = (this && this.__assign) || function () {
2    __assign = Object.assign || function(t) {
3        for (var s, i = 1, n = arguments.length; i < n; i++) {
4            s = arguments[i];
5            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6                t[p] = s[p];
7        }
8        return t;
9    };
10    return __assign.apply(this, arguments);
11};
12var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14        if (ar || !(i in from)) {
15            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16            ar[i] = from[i];
17        }
18    }
19    return to.concat(ar || Array.prototype.slice.call(from));
20};
21var __importDefault = (this && this.__importDefault) || function (mod) {
22    return (mod && mod.__esModule) ? mod : { "default": mod };
23};
24(function (factory) {
25    if (typeof module === "object" && typeof module.exports === "object") {
26        var v = factory(require, exports);
27        if (v !== undefined) module.exports = v;
28    }
29    else if (typeof define === "function" && define.amd) {
30        define(["require", "exports", "jquery"], factory);
31    }
32})(function (require, exports) {
33    "use strict";
34    Object.defineProperty(exports, "__esModule", { value: true });
35    exports.GalleryLib = void 0;
36    var jquery_1 = __importDefault(require("jquery"));
37    function buildAnimName(val) {
38        return 'wb-anim-' + val.effect
39            + (val.direction ? ('-' + val.direction) : '');
40    }
41    function buildAnimCss(val) {
42        if (!val)
43            return { animation: 'none' };
44        return {
45            animation: buildAnimName(val)
46                + ' ' + val.duration + 's'
47                + ' ' + val.timing
48                + ' ' + val.delay + 's',
49            'animation-iteration-count': val.loop ? 'infinite' : 1,
50        };
51    }
52    var config = {
53        thumbWidth: 290,
54        thumbHeight: 290,
55        minWidth: 320,
56        minHeight: 240
57    };
58    var win = window;
59    var GoogleMapsApi = (function () {
60        function GoogleMapsApi() {
61        }
62        GoogleMapsApi.configure = function (apiKey, locale) {
63            GoogleMapsApi.apiKey = apiKey;
64            GoogleMapsApi.locale = locale;
65        };
66        GoogleMapsApi.addListener = function (callback) {
67            if (win['GoogleMapsApi_ScriptReady']) {
68                callback();
69            }
70            else {
71                if (!win['GoogleMapsApi_Listeners'])
72                    win['GoogleMapsApi_Listeners'] = [];
73                win['GoogleMapsApi_Listeners'].push(callback);
74            }
75            if (!win['GoogleMapsApi_ScriptLoaded']) {
76                win['GoogleMapsApi_ScriptLoaded'] = true;
77                win['GoogleMapsApi_clb_fn'] = function () { return win['GoogleMapsApi_ScriptReady'] = true; };
78                var region = (GoogleMapsApi.locale.indexOf('_') >= 0) ? GoogleMapsApi.locale.split('_')[1].toUpperCase() : null;
79                jquery_1.default.getScript("//maps.googleapis.com/maps/api/js?v=3.exp&key=" + GoogleMapsApi.apiKey + "&sensor=false" +
80                    (region ? ("&region=" + region + "&language=" + GoogleMapsApi.locale) : '') +
81                    "&callback=GoogleMapsApi_clb_fn&libraries=places");
82                var compleFunc_1 = function () {
83                    if (!win['GoogleMapsApi_ScriptReady']) {
84                        setTimeout(compleFunc_1, 100);
85                    }
86                    else if (win['GoogleMapsApi_Listeners']) {
87                        for (var _i = 0, _a = win['GoogleMapsApi_Listeners']; _i < _a.length; _i++) {
88                            var callback_1 = _a[_i];
89                            callback_1();
90                        }
91                    }
92                };
93                compleFunc_1();
94            }
95        };
96        GoogleMapsApi.apiKey = '';
97        GoogleMapsApi.locale = 'en_US';
98        return GoogleMapsApi;
99    }());
100    var GalleryLib = (function () {
101        function GalleryLib(data) {
102            var _this = this;
103            this.type = "thumbs";
104            this.slideshowInterval = 5;
105            this.slideshowSpeed = 400;
106            this.images = [];
107            this.imageIndex = 0;
108            this.slideshowTimer = 0;
109            this.displayedImage = null;
110            this.loadingImage = null;
111            this.listImgCont = null;
112            this.thumbImgCont = null;
113            this.fullThumbWidth = 0;
114            this.fullThumbHeight = 0;
115            this.bgColor = "";
116            this.padding = 0;
117            this.imageCover = false;
118            this.disablePopup = false;
119            this.hideArrows = false;
120            this.slideOpacity = 100;
121            this.thumbWidth = config.thumbWidth;
122            this.thumbHeight = config.thumbHeight;
123            this.thumbAlign = "left";
124            this.thumbPadding = 6;
125            this.thumbAnim = null;
126            this.thumbShadow = null;
127            this.showPictureCaption = "always";
128            this.imageElems = {};
129            this.lightBox = null;
130            this.initialRender = false;
131            this.lightBoxDisplayed = false;
132            this.invalid = false;
133            this.resizeEventHandler = null;
134            this.transitionendEventHandler = null;
135            this.map = null;
136            this.mapMarkers = [];
137            this.mapInfowindows = [];
138            this.mapDiv = null;
139            this.delayedUpdateTimeout = 0;
140            this.metaUpdateTimeout = 0;
141            GalleryLib.galleryLibList.push(this);
142            this.elem = (0, jquery_1.default)('<div>').addClass('wb_gallery');
143            this.id = data.id ? data.id : 'wb-gallery-id';
144            this.height = data.height ? data.height : '';
145            this.border = data.border ? data.border : { border: '5px none #FFFFFF' };
146            this.thumbWidth = (typeof data.thumbWidth === 'number' && data.thumbWidth > 0)
147                ? data.thumbWidth
148                : config.thumbWidth;
149            this.thumbHeight = (typeof data.thumbHeight === 'number' && data.thumbHeight > 0)
150                ? data.thumbHeight
151                : config.thumbHeight;
152            this.thumbAlign = data.thumbAlign ? data.thumbAlign : this.thumbAlign;
153            this.thumbPadding = (data.thumbPadding || data.thumbPadding === 0) ? data.thumbPadding : this.thumbPadding;
154            if (data.thumbAnim)
155                this.thumbAnim = data.thumbAnim;
156            if (data.thumbShadow)
157                this.thumbShadow = data.thumbShadow;
158            this.padding = (data.padding || data.padding === 0) ? data.padding : 0;
159            this.type = data.type ? data.type : this.type;
160            this.slideshowInterval = (typeof data.interval === 'number') ? data.interval : 10;
161            this.imageCover = (typeof data.imageCover === 'boolean') ? data.imageCover : this.imageCover;
162            this.disablePopup = (typeof data.disablePopup === 'boolean') ? data.disablePopup : this.disablePopup;
163            this.hideArrows = (typeof data.hideArrows === 'boolean') ? data.hideArrows : this.hideArrows;
164            this.slideOpacity = (typeof data.slideOpacity === 'number') ? data.slideOpacity : this.slideOpacity;
165            this.slideshowSpeed = (typeof data.speed === 'number') ? data.speed : 400;
166            this.setBgColor(data.bgColor ? data.bgColor : 'transparent');
167            this.showPictureCaption = (typeof data.showPictureCaption === 'string') ? data.showPictureCaption : this.showPictureCaption;
168            if (data.captionBackground)
169                this.setCaptionBackground(data.captionBackground);
170            if (data.captionTitleStyle)
171                this.setCaptionTitleStyle(data.captionTitleStyle);
172            if (data.captionDescriptionStyle)
173                this.setCaptionDescriptionStyle(data.captionDescriptionStyle);
174            this.mapTypeId = data.mapTypeId || null;
175            this.markerIconTypeId = data.markerIconTypeId || null;
176            this.zoom = data.zoom || 16;
177            this.mapCenter = data.mapCenter || null;
178            this.key = data.key || null;
179            this.theme = data.theme || 'default';
180            this.color = data.color || '#eeeeee';
181            this.showSatellite = data.showSatellite || false;
182            this.showZoom = data.showZoom || false;
183            this.showStreetView = data.showStreetView || false;
184            this.showFullscreen = data.showFullscreen || false;
185            this.allowDragging = data.allowDragging || false;
186            this.showRoads = data.showRoads || false;
187            this.showLandmarks = data.showLandmarks || false;
188            this.showLabels = data.showLabels || false;
189            this.locale = data.locale || 'en_US';
190            if (this.key)
191                GoogleMapsApi.configure(this.key, this.locale);
192            if (!('wb_builder' in window)) {
193                this.initialRender = true;
194            }
195            this.setImages((data.images && data.images.length) ? data.images : []);
196            if (data.trackResize) {
197                this.resizeEventHandler = function () { return _this.handleResize(); };
198                (0, jquery_1.default)(window).on('resize', this.resizeEventHandler);
199            }
200            this.transitionendEventHandler = function (e) {
201                if ((0, jquery_1.default)(e.target).is(".wb-viewport-block"))
202                    _this.handleResize();
203            };
204            (0, jquery_1.default)(window).on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', this.transitionendEventHandler);
205        }
206        GalleryLib.getGalleryLibList = function () { return GalleryLib.galleryLibList; };
207        GalleryLib.prototype.setVisible = function (visible) {
208            this.elem.css('display', visible ? 'block' : 'none');
209        };
210        GalleryLib.prototype.appendTo = function (container) {
211            (0, jquery_1.default)(container).append(this.elem);
212            this.handleResize();
213        };
214        GalleryLib.prototype.destroy = function () {
215            var _a;
216            if (this.slideshowTimer)
217                clearInterval(this.slideshowTimer);
218            if (this.type === "masonry" && this.listImgCont)
219                this.listImgCont.masonry("destroy");
220            (_a = this.lightBox) === null || _a === void 0 ? void 0 : _a.destroy();
221            if (this.resizeEventHandler)
222                (0, jquery_1.default)(window).off('resize', this.resizeEventHandler);
223            if (this.transitionendEventHandler)
224                (0, jquery_1.default)(window).off('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', this.transitionendEventHandler);
225            this.elem.remove();
226        };
227        GalleryLib.prototype.reset = function (callback) {
228            var _this = this;
229            if (this.slideshowTimer)
230                clearInterval(this.slideshowTimer);
231            if (this.slideshowInterval && this.images.length > 1) {
232                this.slideshowTimer = setInterval(function () { return _this.slideshowNext(callback); }, this.slideshowInterval * 1000);
233            }
234            else
235                this.slideshowTimer = 0;
236        };
237        GalleryLib.prototype.invalidate = function () {
238            var _this = this;
239            if (!this.invalid) {
240                this.invalid = true;
241                if ("requestAnimationFrame" in window)
242                    requestAnimationFrame(function () { return _this.revalidate(); });
243                else
244                    setTimeout(function () { return _this.revalidate(); }, 0);
245            }
246            return this;
247        };
248        GalleryLib.prototype.revalidate = function () {
249            this.invalid = false;
250            this.render();
251            return this;
252        };
253        GalleryLib.prototype.applyAnimation = function (img, i, layoutReady) {
254            img.css(buildAnimCss());
255            if (this.thumbAnim && this.thumbAnim.normal) {
256                var anim_1 = this.thumbAnim.normal;
257                img.addClass('wb-anim-entry')
258                    .removeClass('wb-anim-entry-on');
259                var func = function () { return setTimeout(function () {
260                    img.css(buildAnimCss(__assign(__assign({}, anim_1), { delay: 0 })));
261                    setTimeout(function () { return img.addClass('wb-anim-entry-on')
262                        .removeClass('wb-anim-entry'); }, 40);
263                }, (anim_1.delay * 1000 * i)); };
264                if (layoutReady)
265                    layoutReady.done(func);
266                else
267                    func();
268            }
269            if (this.thumbAnim && this.thumbAnim.hover) {
270                var anim = this.thumbAnim.hover;
271                var hoverOff_1 = buildAnimCss();
272                var hoverOn_1 = buildAnimCss(anim);
273                img.addClass(buildAnimName(anim))
274                    .off('mouseover')
275                    .on('mouseover', function () { return img.css(hoverOn_1); })
276                    .off('mouseout')
277                    .on('mouseout', function () { return img.css(hoverOff_1); });
278                if (anim.loop)
279                    img.addClass('loop');
280            }
281        };
282        GalleryLib.prototype.render = function () {
283            if (this.slideshowTimer)
284                clearInterval(this.slideshowTimer);
285            this.slideshowTimer = 0;
286            this.listImgCont = null;
287            this.displayedImage = null;
288            this.loadingImage = null;
289            this.elem.empty();
290            if (this.images.length == 0)
291                return;
292            if (!this._initialHeight)
293                this._initialHeight = this.elem.parent().get(0).style.height;
294            this.elem.parent().css('height', this._initialHeight);
295            switch (this.type) {
296                case "slideshow":
297                    this.renderSlideshow();
298                    break;
299                case "list":
300                    this.renderList();
301                    break;
302                case "masonry":
303                    this.renderMasonry();
304                    break;
305                case "map":
306                    this.renderMap();
307                    break;
308                default:
309                    this.renderThumbs();
310                    break;
311            }
312        };
313        GalleryLib.prototype.renderMap = function () {
314            var _this = this;
315            this.elem.html('<div class="wb-gallery-map" style="width: 100%; height: 100%; overflow: auto; position: absolute;"></div>');
316            this.elem.css("text-align", this.thumbAlign);
317            var elem = this.elem.children().first();
318            this.map = null;
319            this.mapDiv = null;
320            if (this.key) {
321                GoogleMapsApi.addListener(function () {
322                    var mapTypeId = _this.mapTypeId || google.maps.MapTypeId.ROADMAP;
323                    var thisClass = _this;
324                    if (!_this.map) {
325                        if (!_this.mapDiv) {
326                            _this.mapDiv = (0, jquery_1.default)('<div>').css({ width: '100%', height: '100%' }).appendTo(elem);
327                        }
328                        _this.mapDiv.css("display", "block");
329                        setTimeout(function () {
330                            if (thisClass.mapDiv) {
331                                thisClass.map = new google.maps.Map(thisClass.mapDiv.get(0), {
332                                    zoom: thisClass.zoom,
333                                    center: thisClass.mapCenter && thisClass.mapCenter.latLng ? thisClass.mapCenter.latLng : new google.maps.LatLng(0, 0),
334                                    mapTypeId: mapTypeId,
335                                    mapTypeControl: thisClass.showSatellite,
336                                    zoomControl: thisClass.showZoom,
337                                    streetViewControl: thisClass.showStreetView,
338                                    fullscreenControl: thisClass.show
338Fullscreen,
339                                    draggable: thisClass.allowDragging,
340                                    styles: thisClass.getStyles()
341                                });
342                            }
343                        }, 50);
344                    }
345                    var init = function () {
346                        if (!thisClass.map) {
347                            setTimeout(init, 10);
348                            return;
349                        }
350                        thisClass.map.setZoom(thisClass.zoom);
351                        thisClass.map.setCenter(new google.maps.LatLng(0, 0));
352                        thisClass.map.setMapTypeId(mapTypeId);
353                        thisClass.map.setOptions({
354                            mapTypeControl: thisClass.showSatellite,
355                            zoomControl: thisClass.showZoom,
356                            streetViewControl: thisClass.showStreetView,
357                            fullscreenControl: thisClass.showFullscreen,
358                            draggable: thisClass.allowDragging,
359                            styles: thisClass.getStyles()
360                        });
361                        thisClass.map.addListener("click", function () {
362                            thisClass.mapInfowindows.map(function (item) {
363                                item.close();
364                            });
365                        });
366                        thisClass.mapMarkers.map(function (item) { return item.setMap(null); });
367                        thisClass.mapMarkers = [];
368                        thisClass.mapInfowindows = [];
369                        var latlngbounds = new google.maps.LatLngBounds();
370                        var _loop_1 = function (i, c) {
371                            var image = thisClass.images[i];
372                            if (image.address && image.address.latLng) {
373                                var content = (0, jquery_1.default)('<div class="gallery-map-image" style="position: relative">' +
374                                    "<img src=\"".concat(thisClass.urlEncode(image.src || image.thumb || ''), "\" alt=\"").concat(image.title, "\" style=\"max-width: 100%; max-height: 100%\"/>") +
375                                    "</div>");
376                                if ((image.title || image.description) && thisClass.showPictureCaption !== 'none') {
377                                    caption = (0, jquery_1.default)('<div class="wb-picture-caption"/>');
378                                    if (thisClass.captionBackground)
379                                        caption.css("background-color", thisClass.captionBackground);
380                                    thisClass.fillCaptionContainer(caption, image, true);
381                                    content.append(caption);
382                                }
383                                var infowindow_1 = new google.maps.InfoWindow({
384                                    content: content.get(0),
385                                });
386                                infowindow_1.addListener('domready', function () {
387                                    var parent = (0, jquery_1.default)(this.getContent()).parent();
388                                    var height = parent.parent().innerHeight() - parent.height();
389                                    (0, jquery_1.default)(this.getContent()).children('img').css('max-height', parent.height() - height);
390                                });
391                                var position = new google.maps.LatLng(image.address.latLng);
392                                latlngbounds.extend(position);
393                                var icon = undefined;
394                                if (thisClass.markerIconTypeId === 'thumbs') {
395                                    icon = {
396                                        url: image.thumb || image.src,
397                                        size: new google.maps.Size(35, 35),
398                                        scaledSize: new google.maps.Size(35, 35)
399                                    };
400                                }
401                                else if (thisClass.markerIconTypeId === 'camera') {
402                                    icon = {
403                                        path: 'M960 864q119 0 203.5 -84.5t84.5 -203.5t-84.5 -203.5t-203.5 -84.5t-203.5 84.5t-84.5 203.5t84.5 203.5t203.5 84.5zM1664 1280q106 0 181 -75t75 -181v-896q0 -106 -75 -181t-181 -75h-1408q-106 0 -181 75t-75 181v896q0 106 75 181t181 75h224l51 136 q19 49 69.5 84.5t103.5 35.5h512q53 0 103.5 -35.5t69.5 -84.5l51 -136h224zM960 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z',
404                                        anchor: new google.maps.Point(15, 30),
405                                        scale: 0.01,
406                                        rotation: 180,
407                                        fillColor: "#cecece",
408                                        fillOpacity: 0.5,
409                                        strokeWeight: 1,
410                                    };
411                                }
412                                var marker_1 = new google.maps.Marker({
413                                    position: position,
414                                    map: thisClass.map,
415                                    title: image.title,
416                                    icon: icon
417                                });
418                                marker_1.addListener("click", function () {
419                                    thisClass.mapInfowindows.map(function (item) { return item.close(); });
420                                    var map = marker_1.getMap();
421                                    if (map) {
422                                        infowindow_1.open(map, marker_1);
423                                    }
424                                });
425                                thisClass.mapMarkers.push(marker_1);
426                                thisClass.mapInfowindows.push(infowindow_1);
427                            }
428                        };
429                        var caption;
430                        for (var i = 0, c = thisClass.images.length; i < c; i++) {
431                            _loop_1(i, c);
432                        }
433                        if (thisClass.mapCenter && thisClass.mapCenter.latLng && thisClass.mapCenter.latLng.lat !== 0 && thisClass.mapCenter.latLng.lng !== 0) {
434                            thisClass.map.setCenter(thisClass.mapCenter.latLng);
435                            thisClass.map.setZoom(thisClass.zoom);
436                        }
437                        else if (thisClass.mapMarkers.length === 1) {
438                            thisClass.map.setCenter(new google.maps.LatLng(0, 0));
439                            thisClass.map.setZoom(thisClass.zoom);
440                        }
441                        else {
442                            thisClass.map.fitBounds(latlngbounds);
443                        }
444                    };
445                    setTimeout(init, 50);
446                });
447            }
448        };
449        GalleryLib.prototype.getThemeDefaultStyle = function () {
450            return [];
451        };
452        ;
453        GalleryLib.prototype.getThemeLightStyle = function (color) {
454            return [
455                {
456                    "featureType": "administrative",
457                    "elementType": "labels.text.fill",
458                    "stylers": [
459                        {
460                            "color": "#444444"
461                        }
462                    ]
463                },
464                {
465                    "featureType": "landscape",
466                    "elementType": "all",
467                    "stylers": [
468                        {
469                            "color": "#f2f2f2"
470                        }
471                    ]
472                },
473                {
474                    "featureType": "poi",
475                    "elementType": "all",
476                    "stylers": [
477                        {
478                            "visibility": "off"
479                        }
480                    ]
481                },
482                {
483                    "featureType": "road",
484                    "elementType": "all",
485                    "stylers": [
486                        {
487                            "saturation": -100
488                        },
489                        {
490                            "lightness": 45
491                        }
492                    ]
493                },
494                {
495                    "featureType": "road.highway",
496                    "elementType": "all",
497                    "stylers": [
498                        {
499                            "visibility": "simplified"
500                        }
501                    ]
502                },
503                {
504                    "featureType": "road.arterial",
505                    "elementType": "labels.icon",
506                    "stylers": [
507                        {
508                            "visibility": "off"
509                        }
510                    ]
511                },
512                {
513                    "featureType": "transit",
514                    "elementType": "all",
515                    "stylers": [
516                        {
517                            "visibility": "off"
518                        }
519                    ]
520                },
521                {
522                    "featureType": "water",
523                    "elementType": "all",
524                    "stylers": [
525                        {
526                            "color": (color ? color : '#cccccc')
527                        },
528                        {
529                            "visibility": "on"
530                        }
531                    ]
532                }
533            ];
534        };
535        ;
536        GalleryLib.prototype.getThemeDarkStyle = function (color) {
537            return [
538                {
539                    "featureType": "all",
540                    "elementType": "labels.text.fill",
541                    "stylers": [
542                        {
543                            "saturation": 36
544                        },
545                        {
546                            "color": "#000000"
547                        },
548                        {
549                            "lightness": 40
550                        }
551                    ]
552                },
553                {
554                    "featureType": "all",
555                    "elementType": "labels.text.stroke",
556                    "stylers": [
557                        {
558                            "visibility": "on"
559                        },
560                        {
561                            "color": "#000000"
562                        },
563                        {
564                            "lightness": 16
565                        }
566                    ]
567                },
568                {
569                    "featureType": "all",
570                    "elementType": "labels.icon",
571                    "stylers": [
572                        {
573                            "visibility": "off"
574                        }
575                    ]
576                },
577                {
578                    "featureType": "administrative",
579                    "elementType": "geometry.fill",
580                    "stylers": [
581                        {
582                            "color": "#000000"
583                        },
584                        {
585                            "lightness": 20
586                        }
587                    ]
588                },
589                {
590                    "featureType": "administrative",
591                    "elementType": "geometry.stroke",
592                    "stylers": [
593                        {
594                            "color": "#000000"
595                        },
596                        {
597                            "lightness": 17
598                        },
599                        {
600                            "weight": 1.2
601                        }
602                    ]
603                },
604                {
605                    "featureType": "landscape",
606                    "elementType": "geometry",
607                    "stylers": [
608                        {
609                            "color": "#000000"
610                        },
611                        {
612                            "lightness": 20
613                        }
614                    ]
615                },
616                {
617                    "featureType": "poi",
618                    "elementType": "geometry",
619                    "stylers": [
620                        {
621                            "color": "#000000"
622                        },
623                        {
624                            "lightness": 21
625                        }
626                    ]
627                },
628                {
629                    "featureType": "road.highway",
630                    "elementType": "geometry.fill",
631                    "stylers": [
632                        {
633                            "color": "#000000"
634                        },
635                        {
636                            "lightness": 17
637                        }
638                    ]
639                },
640                {
641                    "featureType": "road.highway",
642                    "elementType": "geometry.stroke",
643                    "stylers": [
644                        {
645                            "color": "#000000"
646                        },
647                        {
648                            "lightness": 29
649                        },
650                        {
651                            "weight": 0.2
652                        }
653                    ]
654                },
655                {
656                    "featureType": "road.arterial",
657                    "elementType": "geometry",
658                    "stylers": [
659                        {
660                            "color": "#000000"
661                        },
662                        {
663                            "lightness": 18
664                        }
665                    ]
666                },
667                {
668                    "featureType": "road.local",
669                    "elementType": "geometry",
670                    "stylers": [
671                        {
672                            "color": "#000000"
673                        },
674                        {
675                            "lightness": 16
676                        }
677                    ]
678                },
679                {
680                    "featureType": "transit",
681                    "elementType": "geometry",
682                    "stylers": [
683                        {
684                            "color": "#000000"
685                        },
686                        {
687                            "lightness": 19
688                        }
689                    ]
690                },
691                {
692                    "featureType": "water",
693                    "elementType": "geometry",
694                    "stylers": [
695                        {
696                            "color": (color ? color : '#333333')
697                        },
698                        {
699                            "lightness": 17
700                        }
701                    ]
702                }
703            ];
704        };
705        ;
706        GalleryLib.prototype.getThemeMonochromeStyle = function (color) {
707            return [
708                {
709                    "featureType": "all",
710                    "elementType": "geometry",
711                    "stylers": [
712                        {
713                            "color": (color ? color : '#3e44b5')
714                        }
715                    ]
716                },
717                {
718                    "featureType": "all",
719                    "elementType": "labels.text.fill",
720                    "stylers": [
721                        {
722                            "gamma": 0.01
723                        },
724                        {
725                            "lightness": 20
726                        }
727                    ]
728                },
729                {
730                    "featureType": "all",
731                    "elementType": "labels.text.stroke",
732                    "stylers": [
733                        {
734                            "saturation": -31
735                        },
736                        {
737                            "lightness": -33
738                        },
739                        {
740                            "weight": 2
741                        },
742                        {
743                            "gamma": 0.8
744                        }
745                    ]
746                },
747                {
748                    "featureType": "all",
749                    "elementType": "labels.icon",
750                    "stylers": [
751                        {
752                            "visibility": "off"
753                        }
754                    ]
755                },
756                {
757                    "featureType": "landscape",
758                    "elementType": "geometry",
759                    "stylers": [
760                        {
761                            "lightness": 30
762                        },
763                        {
764                            "saturation": 30
765                        }
766                    ]
767                },
768                {
769                    "featureType": "poi",
770                    "elementType": "geometry",
771                    "stylers": [
772                        {
773                            "saturation": 20
774                        }
775                    ]
776                },
777                {
778                    "featureType": "poi.park",
779                    "elementType": "geometry",
780                    "stylers": [
781                        {
782                            "lightness": 20
783                        },
784                        {
785                            "saturation": -20
786                        }
787                    ]
788                },
789                {
790                    "featureType": "road",
791                    "elementType": "geometry",
792                    "stylers": [
793                        {
794                            "lightness": 10
795                        },
796                        {
797                            "saturation": -30
798                        }
799                    ]
800                },
801                {
802                    "featureType": "road",
803                    "elementType": "geometry.stroke",
804                    "stylers": [
805                        {
806                            "saturation": 25
807                        },
808                        {
809                            "lightness": 25
810                        }
811                    ]
812                },
813                {
814                    "featureType": "water",
815                    "elementType": "all",
816                    "stylers": [
817                        {
818                            "lightness": -20
819                        }
820                    ]
821                }
822            ];
823        };
824        ;
825        GalleryLib.prototype.getThemeStyle = function (theme, color) {
826            if (theme === 'light') {
827                return this.getThemeLightStyle(color);
828            }
829            else if (theme === 'dark') {
830                return this.getThemeDarkStyle(color);
831            }
832            else if (theme === 'monochrome') {
833                return this.getThemeMonochromeStyle(color);
834            }
835            return this.getThemeDefaultStyle();
836        };
837        ;
838        GalleryLib.prototype.getStyles = function () {
839            var styles = this.getThemeStyle(this.theme, this.color);
840            var extraStyles = [
841                {
842                    featureType: 'road',
843                    stylers: [
844                        { visibility: (this.showRoads ? 'on' : 'off') }
845                    ]
846                },
847                {
848                    featureType: 'poi',
849                    stylers: [
850                        { visibility: (this.showLandmarks ? 'on' : 'off') }
851                    ]
852                },
853                {
854                    elementType: 'labels',
855                    stylers: [
856                        { visibility: (this.showLabels ? 'on' : 'off') }
857                    ]
858                }
859            ];
860            return styles.concat(extraStyles);
861        };
862        ;
863        GalleryLib.prototype.renderThumbs = function () {
864            this.elem.html('<div class="wb-thumbs-only" style="width: 100%; height: 100%; overflow: auto;"></div>');
865            this.elem.css("text-align", this.thumbAlign);
866            var elem = this.elem.children().first();
867            for (var i = 0, c = this.images.length; i < c; i++) {
868                var img = this.addImage(elem, this.images[i], i).wrp;
869                this.applyAnimation(img, i);
870            }
871            elem.children('.wb_thumb').css('padding', (this.thumbPadding / 2) + 'px');
872            if (this.thumbShadow && this.height === 'auto') {
873                this.elem.css('overflow', 'visible');
874                this.elem.children('.wb-thumbs-only').css('overflow', 'visible');
875                this.elem.parent('.wb_gallery').css('overflow', 'visible');
876            }
877            else {
878                this.elem.css('overflow', '');
879                this.elem.parent('.wb_gallery').css('overflow', '');
880            }
881        };
882        GalleryLib.prototype.renderSlideshow = function () {
883            var _this = this;
884            var rootElem = this.elem.parent();
885            if ('wb_builder' in window) {
886                rootElem = rootElem.parent();
887            }
888            if (rootElem.length) {
889                var minH = rootElem.css('min-height');
890    
890            if (minH && /^\d+px$/.test(minH) && parseInt(minH) > 0)
891                    this.elem.parent().css('height', minH);
892            }
893            this.elem.html('<div class="gallery-slideshow">' +
894                '<div class="gallery-slide-image" style="overflow: hidden;"></div>' +
895                '<div class="gallery-slide-left"><i class="fa fa-chevron-left"></i></div>' +
896                '<div class="gallery-slide-right"><i class="fa fa-chevron-right"></i></div>' +
897                '</div>');
898            var cont = this.elem.children().first();
899            var larr = cont.children(".gallery-slide-left");
900            var rarr = cont.children(".gallery-slide-right");
901            if (this.hideArrows) {
902                larr.css('display', 'none');
903                rarr.css('display', 'none');
904            }
905            this.listImgCont = cont.children(".gallery-slide-image");
906            this.listImgCont.css('opacity', this.slideOpacity / 100);
907            larr.click(function () { return _this.slideshowPrev(); });
908            rarr.click(function () { return _this.slideshowNext(); });
909            this.reset();
910            this.imageIndex = -1;
911            this.slideshowNext();
912        };
913        GalleryLib.prototype.renderList = function () {
914            var _this = this;
915            var h = this.elem.height();
916            if (!h)
917                h = this.elem.parent().height();
918            var tw = this.getThumbWidth();
919            var th = this.getThumbHeight();
920            var thumbcont = (0, jquery_1.default)("<div></div>");
921            var callback = function () {
922                var img = _this.imageElems[_this.imageIndex];
923                if (!img.parentNode || !img.parentNode.parentNode || !img.parentNode.parentNode.parentNode)
924                    return;
925                (0, jquery_1.default)(img.parentNode.parentNode.parentNode).children(".tmb-selected").removeClass("tmb-selected");
926                (0, jquery_1.default)(img.parentNode.parentNode).addClass("tmb-selected");
927            };
928            this.imageElems = {};
929            var _loop_2 = function (i) {
930                var image = this_1.images[i];
931                var img = this_1.addImage(thumbcont, image, i, true).img;
932                img.css({ cursor: "pointer" });
933                this_1.imageElems[i] = img.get(0);
934                img.click(function () {
935                    if (!_this.listImgCont)
936                        return;
937                    _this.imageIndex = _this.images.indexOf(image);
938                    _this.displayImage(_this.listImgCont, callback);
939                });
940                var par = img.parent().parent();
941                if (i === this_1.imageIndex) {
942                    par.addClass("tmb-selected");
943                    tw = this_1.getThumbWidth() + 8;
944                    th = this_1.getThumbHeight() + 8;
945                }
946            };
947            var this_1 = this;
948            for (var i = 0; i < this.images.length; i++) {
949                _loop_2(i);
950            }
951            var thumbs = thumbcont.children('.wb_thumb');
952            thumbs.css('margin', '0 ' + (this.getThumbPadding() / 2) + 'px');
953            (0, jquery_1.default)(thumbs.get(0)).css('margin', '0 ' + (this.getThumbPadding() / 2) + 'px 0 0');
954            (0, jquery_1.default)(thumbs.get(thumbs.length - 1)).css('margin', '0 0 0 ' + (this.getThumbPadding() / 2) + 'px');
955            this.fullThumbWidth = tw;
956            this.fullThumbHeight = th;
957            var thumbsWidth = tw * this.images.length + this.getThumbPadding() * (this.images.length - 1);
958            thumbcont.css({ position: "absolute", left: "0", top: "5px", width: thumbsWidth + "px", height: th + "px" });
959            var galcont = document.createElement("DIV");
960            (0, jquery_1.default)(galcont).css({ position: "relative", height: h + "px" });
961            galcont.className = "gallery-list";
962            var imgcont = document.createElement("DIV");
963            (0, jquery_1.default)(imgcont).css({ position: "relative", height: (h - th - 10) + "px", overflow: "hidden" });
964            imgcont.className = "gallery-list-image";
965            var icon;
966            var thumbdiv_in1 = document.createElement("DIV");
967            (0, jquery_1.default)(thumbdiv_in1).css({ position: "relative", "float": "left", width: "16px", height: (th + 10) + "px", cursor: "pointer" });
968            thumbdiv_in1.className = "gallery-list-left";
969            (0, jquery_1.default)(thumbdiv_in1).click(function () { return _this.slideBy(-_this.fullThumbWidth * 3); });
970            icon = document.createElement("I");
971            icon.setAttribute("class", "fa fa-chevron-left");
972            thumbdiv_in1.appendChild(icon);
973            var thumbdiv_in2 = document.createElement("DIV");
974            (0, jquery_1.default)(thumbdiv_in2).css({
975                position: "relative",
976                "float": "none",
977                margin: "0 auto",
978                maxWidth: thumbsWidth + "px",
979                height: (th + 10) + "px",
980                overflow: "hidden",
981            });
982            thumbdiv_in2.className = "gallery-list-thumbs";
983            var thumbdiv_in3 = document.createElement("DIV");
984            (0, jquery_1.default)(thumbdiv_in3).css({ position: "relative", "float": "right", width: "16px", height: (th + 10) + "px", cursor: "pointer" });
985            thumbdiv_in3.className = "gallery-list-right";
986            (0, jquery_1.default)(thumbdiv_in3).click(function () { return _this.slideBy(_this.fullThumbWidth * 3); });
987            icon = document.createElement("I");
988            icon.setAttribute("class", "fa fa-chevron-right");
989            thumbdiv_in3.appendChild(icon);
990            var thumbdiv = document.createElement("DIV");
991            (0, jquery_1.default)(thumbdiv).css({ position: "relative", height: (th + 10) + "px", overflow: "hidden" });
992            (0, jquery_1.default)(thumbdiv_in2).append(thumbcont);
993            thumbdiv.appendChild(thumbdiv_in1);
994            thumbdiv.appendChild(thumbdiv_in3);
995            thumbdiv.appendChild(thumbdiv_in2);
996            galcont.appendChild(imgcont);
997            galcont.appendChild(thumbdiv);
998            this.listImgCont = (0, jquery_1.default)(imgcont);
999            this.thumbImgCont = (0, jquery_1.default)(thumbdiv_in2);
1000            this.elem.append(galcont);
1001            this.reset(callback);
1002            this.imageIndex = -1;
1003            this.slideshowNext(callback);
1004        };
1005        GalleryLib.prototype.renderMasonry = function () {
1006            var elem = (0, jquery_1.default)('<div class="wb-masonry-items"/>');
1007            var cont = (0, jquery_1.default)('<div class="wb-masonry" style="width: 100%; height: 100%; overflow: auto;"/>');
1008            cont.append(elem);
1009            this.elem.append(cont);
1010            if (this.thumbAlign === "left")
1011                elem.css("float", "left");
1012            else if (this.thumbAlign === "right")
1013                elem.css("float", "right");
1014            else
1015                elem.css("margin", "0 auto");
1016            var layoutReady = jquery_1.default.Deferred();
1017            for (var i = 0, c = this.images.length; i < c; i++) {
1018                var img = this.addImage(elem, this.images[i], i).wrp;
1019                this.applyAnimation(img, i, layoutReady.promise());
1020            }
1021            elem.children('.wb_thumb').css('padding', (this.thumbPadding / 2) + 'px');
1022            var brd = this.getBorder();
1023            elem.masonry({
1024                itemSelector: ".wb_thumb",
1025                columnWidth: this.getThumbWidth() + (brd ? this.getBorderWidth(brd, 1) + this.getBorderWidth(brd, 3) : 0) + this.thumbPadding,
1026                fitWidth: true,
1027                transitionDuration: 0
1028            }).masonry('once', 'layoutComplete', function () { return layoutReady.resolve(); });
1029            this.listImgCont = elem;
1030            if (this.thumbShadow && this.height === 'auto') {
1031                this.elem.css('overflow', 'visible');
1032                this.elem.children('.wb-masonry').get(0).style.setProperty("overflow", "visible", "important");
1033                this.elem.parent('.wb_gallery').css('overflow', 'visible');
1034            }
1035            else {
1036                this.elem.css('overflow', '');
1037                this.elem.parent('.wb_gallery').css('overflow', '');
1038            }
1039        };
1040        GalleryLib.prototype.onImageLoad = function () {
1041            var _this = this;
1042            if (this.type === "masonry") {
1043                this.elem.find(".wb-masonry-items").masonry();
1044                this.elem.trigger("elementviewchange");
1045            }
1046            if (this.delayedUpdateTimeout)
1047                clearTimeout(this.delayedUpdateTimeout);
1048            this.delayedUpdateTimeout = setTimeout(function () {
1049                _this.delayedUpdateTimeout = 0;
1050                if (_this.type === "masonry") {
1051                    _this.elem.find(".wb-masonry-items").masonry();
1052                    _this.elem.trigger("elementviewchange");
1053                }
1054            }, 1000);
1055        };
1056        GalleryLib.prototype.getBorderWidth = function (css, side) {
1057            if (side === void 0) { side = 0; }
1058            var border = '';
1059            if (side == 1 && typeof css.borderLeft === 'string')
1060                border = css.borderLeft;
1061            if (side == 1 && typeof css['border-left'] === 'string')
1062                border = css['border-left'];
1063            if (side == 3 && typeof css.borderRight === 'string')
1064                border = css.borderRight;
1065            if (side == 3 && typeof css['border-right'] === 'string')
1066                border = css['border-right'];
1067            if (!border && typeof css.border === 'string')
1068                border = css.border;
1069            var res = border.match(/^([0-9]+)px(?:| .+)$/);
1070            if (res)
1071                return parseFloat(res[1]);
1072            return 0;
1073        };
1074        GalleryLib.prototype.slideBy = function (delta, instant) {
1075            if (instant === void 0) { instant = false; }
1076            if (!this.thumbImgCont)
1077                return;
1078            var cont = this.thumbImgCont;
1079            var div = cont.children().first();
1080            var pos = div.position();
1081            var x = pos.left;
1082            x -= delta;
1083            var minx = -(div.width() - cont.width());
1084            if (x < minx)
1085                x = minx;
1086            if (x > 0)
1087                x = 0;
1088            var css = { left: x + "px" };
1089            if (instant)
1090                div.stop(true, false).css(css);
1091            else
1092                div.animate(css);
1093        };
1094        GalleryLib.prototype.handleContinuousResize = function () {
1095            if (!this.listImgCont)
1096                return;
1097            if (this.type === "masonry") {
1098                this.listImgCont.masonry();
1099            }
1100        };
1101        GalleryLib.prototype.handleResize = function () {
1102            if (!this.listImgCont)
1103                return;
1104            if (this.type === "list") {
1105                var h = this.elem.height();
1106                var th = this.fullThumbHeight;
1107                this.listImgCont.css({ height: (h - th - 10) + "px" });
1108                this.slideBy(0, true);
1109            }
1110            else if (this.type === "masonry") {
1111                this.listImgCont.css('width', '');
1112                this.listImgCont.masonry();
1113            }
1114            if (this.displayedImage)
1115                this.updateImageSize(this.displayedImage);
1116            if (this.loadingImage)
1117                this.updateImageSize(this.loadingImage);
1118        };
1119        GalleryLib.prototype.updateImageSize = function (imageCont) {
1120            if (!this.listImgCont)
1121                return;
1122            var size = imageCont.data("_wb_size_");
1123            var stl = this.calcImageStyles(this.listImgCont, size);
1124            imageCont.css({
1125                left: stl.x + "px",
1126                top: stl.y + "px"
1127            });
1128            var img = imageCont.children('img').first();
1129            if (img && img.length) {
1130                img.css({
1131                    width: stl.width + "px",
1132                    height: stl.height + "px"
1133                });
1134                var imgRaw = img.get(0);
1135                imgRaw.width = stl.width;
1136                imgRaw.height = stl.height;
1137            }
1138        };
1139        GalleryLib.prototype.calcImageStyles = function (displayCont, image) {
1140            if (!image)
1141                return { x: 0, y: 0, width: 0, height: 0 };
1142            var cover = this.imageCover;
1143            var pad = cover ? 0 : this.padding;
1144            var maxWidth = displayCont.innerWidth() - pad * 2;
1145            var maxHeight = displayCont.innerHeight() - pad * 2;
1146            var w = image.width;
1147            var h = image.height;
1148            if (cover || w > maxWidth || h > maxHeight) {
1149                var ratio1 = w / maxWidth;
1150                var ratio2 = h / maxHeight;
1151                var ratio = cover ? Math.min(ratio1, ratio2) : Math.max(ratio1, ratio2);
1152                w = Math.floor(w / ratio);
1153                h = Math.floor(h / ratio);
1154            }
1155            return {
1156                x: Math.floor((maxWidth - w) / 2 + pad),
1157                y: Math.floor((maxHeight - h) / 2 + pad),
1158                width: w,
1159                height: h
1160            };
1161        };
1162        GalleryLib.prototype.parseHash = function () {
1163            var hash = window.location.hash.substring(1), params = { gid: '', pid: '' };
1164            if (hash.length < 5) {
1165                return params;
1166            }
1167            var vars = hash.split('&');
1168            for (var i = 0; i < vars.length; i++) {
1169                if (!vars[i]) {
1170                    continue;
1171                }
1172                var pair = vars[i].split('=');
1173                if (pair.length < 2) {
1174                    continue;
1175                }
1176                if (i == 1 && pair) {
1177                    params.gid = pair[1];
1178                }
1179                if (i == 2 && pair) {
1180                    params.pid = pair[1];
1181                }
1182            }
1183            return params;
1184        };
1185        GalleryLib.prototype.displayImage = function (displayCont, callback) {
1186            var _this = this;
1187            if (typeof callback === 'function')
1188                callback();
1189            var image = this.images[this.imageIndex];
1190            if (!image)
1191                return;
1192            var link = (this.type !== "thumbs" && this.type !== "masonry" && image.link) ? image.link : undefined;
1193            var cont = (link ? (0, jquery_1.default)('<a>') : (0, jquery_1.default)('<div>')).addClass("gallery-image");
1194            if (link) {
1195                cont.attr('href', link.url);
1196                if (link.target)
1197                    cont.attr('target', link.target);
1198            }
1199            if (image.title)
1200                cont.attr('title', image.title);
1201            cont.data("image", image);
1202            cont.css({ display: "none", position: "absolute" });
1203            if (this.thumbShadow && this.thumbShadow.css && ['thumbs', 'masonry'].indexOf(this.type) >= 0) {
1204                cont.css(this.thumbShadow.css);
1205            }
1206            var img = new Image(), imgJq = (0, jquery_1.default)(img);
1207            img.alt = "";
1208            if (image.title)
1209                img.alt = image.title;
1210            img.onload = function () {
1211                if (_this.displayedImage) {
1212                    var caption_1 = _this.displayedImage.data("caption");
1213                    _this.displayedImage.fadeOut(_this.getTransitionSpeed(), function () {
1214                        if (_this.displayedImage)
1215                            _this.displayedImage.remove();
1216                    });
1217                    if (caption_1) {
1218                        caption_1.fadeOut(_this.getTransitionSpeed(), function () { return caption_1.remove(); });
1219                    }
1220                }
1221                var size = { width: img.width, height: img.height };
1222                cont.data("_wb_size_", size);
1223                cont.append(img);
1224                var stl = _this.calcImageStyles(displayCont, size);
1225                cont.css({ left: stl.x + "px", top: stl.y + "px" });
1226                imgJq.css({ width: stl.width + "px", height: stl.height + "px" });
1227                img.width = stl.width;
1228                img.height = stl.height;
1229                cont.fadeIn(_this.getTransitionSpeed(), function () {
1230                    if (_this.displayedImage)
1231                        _this.displayedImage.remove();
1232                    var parent = cont.parent();
1233                    _this.displayedImage = (parent && parent.length) ? cont : null;
1234                    _this.loadingImage = null;
1235                });
1236            };
1237            imgJq.css((this.imageCover || !this.border) ? { "border": "none" } : this.border);
1238            displayCont.append(cont);
1239            this.loadingImage = cont;
1240            var caption = (0, jquery_1.default)('<div class="wb-picture-caption" style="display: none;"/>');
1241            if (this.captionBackground)
1242                caption.css("background-color", this.captionBackground);
1243            if (this.fillCaptionContainer(caption, image, true)) {
1244                if (this.showPictureCaption === 'always') {
1245                    caption.fadeIn(this.getTransitionSpeed());
1246                    displayCont.append(caption);
1247                    cont.data("caption", caption);
1248                }
1249                else if (this.showPictureCaption === 'hover') {
1250                    displayCont.append(caption);
1251                    cont.data("caption", caption);
1252                    caption.css({
1253                        display: 'block',
1254                        opacity: 0,
1255                    });
1256                    displayCont.hover(function () {
1257                        caption.css('opacity', '1');
1258                    }, function () {
1259                        caption.css('opacity', '0');
1260                    });
1261                }
1262            }
1263            else { }
1264            img.src = this.urlEncode(image.src, true, true);
1265            if (!link)
1266                this.initImageLightBox(imgJq, this.imageIndex);
1267            if (typeof this.onImageDisplayed === 'function')
1268                this.onImageDisplayed(img.src);
1269        };
1270        GalleryLib.prototype.slideshowNext = function (callback) {
1271            if (this.images.length === 0 || !this.listImgCont || this.lightBoxDisplayed)
1272                return;
1273            this.imageIndex++;
1274            if (this.imageIndex >= this.images.length)
1275                this.imageIndex = 0;
1276            this.displayImage(this.listImgCont, callback);
1277        };
1278        GalleryLib.prototype.slideshowPrev = function () {
1279            if (this.images.length === 0 || !this.listImgCont)
1280                return;
1281            this.imageIndex--;
1282            if (this.imageIndex < 0)
1283                this.imageIndex = this.images.length - 1;
1284            this.displayImage(this.listImgCont);
1285        };
1286        GalleryLib.prototype.addImage = function (cont, image, idx, noLightbox) {
1287            var _this = this;
1288            if (noLightbox === void 0) { noLightbox = false; }
1289            var isThumbsOnlyMode = (this.type === "thumbs" || this.type === "masonry");
1290            var link = (isThumbsOnlyMode && image.link) ? image.link : undefined;
1291            var div = (link ? (0, jquery_1.default)('<a>') : (0, jquery_1.default)('<div>')).addClass("wb_thumb");
1292            if (link) {
1293                div.attr('href', link.url);
1294                if (link.target)
1295                    div.attr('target', link.target);
1296            }
1297            if (image.title)
1298                div.attr('title', image.title);
1299            var tw = this.getThumbWidth();
1300            var th = this.getThumbHeight();
1301            var wrp = (0, jquery_1.default)("<div/>");
1302            wrp.css({
1303                width: tw + "px",
1304                overflow: "hidden",
1305                boxSizing: "content-box",
1306                position: 'relative'
1307            });
1308            if (this.thumbShadow && this.thumbShadow.css && ['thumbs', 'masonry'].indexOf(this.type) >= 0) {
1309                wrp.css(this.thumbShadow.css);
1310            }
1311            if (this.type !== 'masonry')
1312                wrp.css('height', th + "px");
1313            var brd = this.getBorder();
1314            if (isThumbsOnlyMode && brd)
1315                wrp.css(brd);
1316            div.append(wrp);
1317            div.data("image", image);
1318            var img = (0, jquery_1.default)('<img src="" alt="" />');
1319            if (image.title)
1320                img.attr('alt', image.title);
1321            wrp.css({ opacity: 0 });
1322            var imgRaw = img.get(0);
1323            var thisCont = cont;
1324            imgRaw.onload = function () {
1325                var w = imgRaw.width;
1326                var h = imgRaw.height;
1327                var k;
1328                if (_this.type === 'masonry') {
1329                    k = w / tw;
1330                }
1331                else {
1332                    var k1 = w / tw;
1333                    var k2 = h / th;
1334                    k = Math.min(k1, k2);
1335                }
1336                w = w / k;
1337                h = h / k;
1338                var x = Math.round((tw - w) / 2);
1339                var y = (_this.type === 'masonry') ? 0 : Math.round((th - h) / 2);
1340                img.css({ left: x + "px", top: y + "px", width: w + "px", height: h + "px" });
1341                try {
1342                    var anim = wrp.get(0).animate([{ opacity: 0 }, { opacity: 1 }], 150);
1343                    anim.onfinish = function () {
1344                        wrp.css({ opacity: '' });
1345                    };
1346                    anim.play();
1347                }
1348                catch (e) {
1349                    wrp.css({ opacity: '' });
1350                }
1351                setTimeout(function () { return _this.onImageLoad(); }, 100);
1352            };
1353            imgRaw.src = this.urlEncode(image.thumb || image.src, true, true);
1354            img.css({
1355                display: "block",
1356                maxWidth: "auto",
1357                position: "relative"
1358            });
1359            wrp.append(img);
1360            if (isThumbsOnlyMode && this.getThumbWidth() >= 100 && this.showPictureCaption !== 'none') {
1361                var descDiv_1 = (0, jquery_1.default)('<div class="wb-picture-caption"/>');
1362                if (this.captionBackground)
1363                    descDiv_1.css("background-color", this.captionBackground);
1364                if (this.fillCaptionContainer(descDiv_1, image, false)) {
1365                    wrp.append(descDiv_1);
1366                    if (this.showPictureCaption === 'hover') {
1367                        descDiv_1.css({
1368                            opacity: 0,
1369                            transition: "opacity " + (this.slideshowSpeed / 1000).toFixed(3) + "s linear"
1370                        });
1371                        div.hover(function () {
1372                            descDiv_1.css('opacity', '1');
1373                        }, function () {
1374                            descDiv_1.css('opacity', '0');
1375                        });
1376                    }
1377                }
1378            }
1379            cont.append(div);
1380            if (!noLightbox && !link)
1381                this.initImageLightBox(img, idx);
1382            return { img: img, wrp: wrp };
1383        };
1384        GalleryLib.prototype.fillCaptionContainer = function (cont, meta, createDescription, createLink) {
1385            if (createLink === void 0) { createLink = false; }
1386            var hasAny = false;
1387            if (meta.title !== "") {
1388                hasAny = true;
1389                var title = (0, jquery_1.default)('<h3 class="wb-lightbox-title">').append((createLink && meta.link)
1390                    ? (0, jquery_1.default)('<a>').attr({ href: meta.link.url, target: meta.link.target ? meta.link.target : null }).text(meta.title)
1391                    : document.createTextNode(meta.title));
1392                if (this.captionTitleStyle)
1393                    title.css(this.captionTitleStyle);
1394                cont.append(title);
1395            }
1396            if (createDescription && meta.description !== "") {
1397                hasAny = true;
1398                var desc = (0, jquery_1.default)('<div class="wb-lightbox-description">').text(meta.description);
1399                if (this.captionDescriptionStyle)
1400                    desc.css(this.captionDescriptionStyle);
1401                cont.append(desc);
1402            }
1403            return hasAny;
1404        };
1405        GalleryLib.prototype.updateImageMeta = function (updateImage) {
1406            for (var _i = 0, _a = this.images; _i < _a.length; _i++) {
1407                var image = _a[_i];
1408                if (image.src === updateImage.src) {
1409                    jquery_1.default.extend(true, image, updateImage);
1410                    this.onMetaChange();
1411                    break;
1412                }
1413            }
1414        };
1415        GalleryLib.prototype.renderMeta = function (image, createDescription, $container, $caption) {
1416            var isNew;
1417            if ($caption && $caption.length) {
1418                $caption.empty();
1419                isNew = false;
1420            }
1421            else {
1422                $caption = (0, jquery_1.default)('<div class="wb-picture-caption"/>');
1423                isNew = true;
1424            }
1425            if (this.captionBackground)
1426                $caption.css("background-color", this.captionBackground);
1427            if (this.fillCaptionContainer($caption, image, createDescription)) {
1428                if (isNew) {
1429                    $caption.css("opacity", 0);
1430                    $container.append($caption);
1431                    $caption.css("opacity", 1);
1432                }
1433                return $caption;
1434            }
1435            else if (!isNew) {
1436                $caption.detach();
1437            }
1438            return null;
1439        };
1440        GalleryLib.prototype.onMetaChange = function () {
1441            var _this = this;
1442            if (this.metaUpdateTimeout)
1443                return;
1444            this.metaUpdateTimeout = requestAnimationFrame(function () {
1445                _this.metaUpdateTimeout = 0;
1446                if (_this.type === 'map') {
1447                    _this.renderMap();
1448                }
1449                else if (_this.type === "thumbs" || _this.type === "masonry") {
1450                    if (_this.getThumbWidth() >= 100 && _this.showPictureCaption !== 'none') {
1451                        var thisClass_1 = _this;
1452                        _this.elem.find(".wb_thumb").each(function () {
1453                            var $thumb = (0, jquery_1.default)(this);
1454                            var image = $thumb.data("image");
1455                            if (!image)
1456                                return;
1457                            $thumb.attr('title', image.title || "");
1458                            thisClass_1.renderMeta(image, false, $thumb.children().first(), (0, jquery_1.default)(".wb-picture-caption", $thumb));
1459                        });
1460                    }
1461                }
1462                else {
1463                    var renderListImageMeta = function ($cont, fadeIn) {
1464                        var $parent = $cont.parent();
1465                        if (!$parent || !$parent.length)
1466                            return;
1467                        var image = $cont.data("image");
1468                        if (!image)
1469                            return;
1470                        $cont.attr('title', image.title || "");
1471                        var $prevCaption = $cont.data("caption");
1472                        var $caption = null;
1473                        if (_this.showPictureCaption !== 'none') {
1474                            $caption = _this.renderMeta(image, true, $parent, $prevCaption);
1475                        }
1476                        $cont.data("caption", $caption);
1477                        if ($caption && !$prevCaption) {
1478                            $caption.addClass("wb-no-transition");
1479                            var opacity = parseFloat(getComputedStyle($cont[0]).opacity);
1480                            if (opacity < 1) {
1481                                $caption.css("opacity", opacity);
1482                                if (fadeIn)
1483                                    $caption.fadeTo(Math.floor((1 - opacity) * _this.getTransitionSpeed()), 1);
1484                                else
1485                                    $caption.fadeOut(Math.floor(opacity * _this.getTransitionSpeed()), function () { return $caption === null || $caption === void 0 ? void 0 : $caption.remove(); });
1486                            }
1487                        }
1488                    };
1489                    if (_this.displayedImage)
1490                        renderListImageMeta(_this.displayedImage, false);
1491                    if (_this.loadingImage)
1492                        renderListImageMeta(_this.loadingImage, true);
1493                    if (_this.type === "list") {
1494                        (0, jquery_1.default)(".wb_thumb", _this.elem).each(function () {
1495                            var $thumb = (0, jquery_1.default)(this);
1496                            var image = $thumb.data("image");
1497                            $thumb.attr('title', image.title || "");
1498                        });
1499                    }
1500                }
1501            });
1502        };
1503        GalleryLib.prototype.constructImagesArray = function () {
1504            var images = [];
1505            for (var _i = 0, _a = this.images; _i < _a.length; _i++) {
1506                var image = _a[_i];
1507                images.push({
1508                    src: image.src,
1509                    w: image.width,
1510                    h: image.height,
1511                    msrc: null,
1512                    title: (typeof image.title === 'string' && image.title.length > 0) ? image.title : " ",
1513                    link: image.link ? image.link : undefined,
1514                    description: image.description ? image.description : ''
1515                });
1516            }
1517            return images;
1518        };
1519        GalleryLib.prototype.initImageLightBox = function (img, imageIndex) {
1520            var _this = this;
1521            var lightBoxInited = GalleryLib.lightBoxInited;
1522            GalleryLib.lightBoxInited = true;
1523            var params;
1524            if (this.initialRender) {
1525                params = this.parseHash();
1526                imageIndex = params.pid ? parseInt(params.pid) : imageIndex;
1527            }
1528            if ((this.type === 'slideshow' || this.type === 'list') && this.disablePopup)
1529                return;
1530            var lightBoxElem = (0, jquery_1.default)('body > .pswp');
1531            if (!lightBoxInited && this.initialRender && params && params.pid) {
1532                this.lightBoxDisplayed = true;
1533                var images = [];
1534                images = this.constructImagesArray();
1535                this.lightBox = (new PhotoSwipe(lightBoxElem.get(0), PhotoSwipeUI_Default, images, {
1536                    index: imageIndex,
1537                    addCaptionHTMLFn: function (item, captionElement) {
1538                        var cont = (0, jquery_1.default)(captionElement.children[0]);
1539                        cont.empty();
1540                        return _this.fillCaptionContainer(cont, item, true, true);
1541                    },
1542                    history: true
1543                }));
1544                this.lightBox.init();
1545                this.lightBox.listen('destroy', function () {
1546                    _this.lightBoxDisplayed = false;
1547                });
1548                this.initialRender = false;
1549            }
1550            img.css({ cursor: "pointer" })
1551                .on("click touchstart touchend touchmove", function (e) {
1552                var img = (0, jquery_1.default)(e.currentTarget);
1553                if (e.type === 'touchstart') {
1554                    img.data('pswpDisabled', false);
1555                }
1556                else if (e.type === 'touchmove') {
1557                    img.data('pswpDisabled', true);
1558                }
1559                if ((e.type === 'click' || e.type === 'touchend') && !img.data('pswpDisabled')) {
1560                    _this.lightBoxDisplayed = true;
1561                    var images = [];
1562                    images = _this.constructImagesArray();
1563                    _this.lightBox = (new PhotoSwipe(lightBoxElem.get(0), PhotoSwipeUI_Default, images, {
1564                        index: imageIndex,
1565                        addCaptionHTMLFn: function (item, captionElement) {
1566                            var cont = (0, jquery_1.default)(captionElement.children[0]);
1567                            cont.empty();
1568                            return _this.fillCaptionContainer(cont, item, true, true);
1569                        },
1570                        history: true
1571                    }));
1572                    _this.lightBox.init();
1573                    _this.lightBox.listen('destroy', function () {
1574                        _this.lightBoxDisplayed = false;
1575                    });
1576                    lightBoxElem.attr('id', _this.id + '_pswp');
1577                }
1578            });
1579        };
1580        GalleryLib.prototype.urlEncode = function (url, quotes, hash) {
1581            if (quotes === void 0) { quotes = false; }
1582            if (hash === void 0) { hash = false; }
1583            var url_ = encodeURI(url).replace(/\(/g, "%28").replace(/\)/g, "%29");
1584            if (quotes) {
1585                url_ = url_.replace(/\'/g, "%27");
1586            }
1587            if (hash) {
1588                url_ = url_.replace(/#/g, "%23");
1589            }
1590            return url_;
1591        };
1592        GalleryLib.prototype.getImages = function () {
1593            return __spreadArray([], this.images, true);
1594        };
1595        GalleryLib.prototype.setImages = function (images) {
1596            this.images = __spreadArray([], images, true);
1597            this.invalidate();
1598        };
1599        GalleryLib.prototype.setHeight = function (height) {
1600            this.height = height;
1601            this.invalidate();
1602        };
1603        GalleryLib.prototype.getType = function () {
1604            return this.type;
1605        };
1606        GalleryLib.prototype.setType = function (type) {
1607            this.type = type;
1608            this.invalidate();
1609        };
1610        GalleryLib.prototype.getSlideshowInterval = function () {
1611            return this.slideshowInterval;
1612        };
1613        GalleryLib.prototype.getSlideshowSpeed = function () {
1614            return this.slideshowSpeed;
1615        };
1616        GalleryLib.prototype.setSlideshowSpeed = function (speed) {
1617            this.slideshowSpeed = speed;
1618        };
1619        GalleryLib.prototype.getTransitionSpeed = function () {
1620            return (this.slideshowInterval > 0) ? Math.min(Math.max(0, this.slideshowInterval * 1000 - 100), this.slideshowSpeed) : 0;
1621        };
1622        GalleryLib.prototype.getBgColor = function () {
1623            return this.bgColor;
1624        };
1625        GalleryLib.prototype.setBgColor = function (color) {
1626            this.bgColor = color;
1627            this.elem.css("background-color", this.bgColor);
1628        };
1629        GalleryLib.prototype.getCaptionBackground = function () {
1630            return this.captionBackground;
1631        };
1632        GalleryLib.prototype.setCaptionBackground = function (color) {
1633            this.captionBackground = color;
1634            if (this.captionBackground)
1635                this.elem.find(".wb-picture-caption").css("background-color", color);
1636        };
1637        GalleryLib.prototype.getCaptionTitleStyle = function () {
1638            return this.captionTitleStyle;
1639        };
1640        GalleryLib.prototype.setCaptionTitleStyle = function (css) {
1641            this.captionTitleStyle = css;
1642            this.elem.find(".wb-lightbox-title").css(css);
1643        };
1644        GalleryLib.prototype.getCaptionDescriptionStyle = function () {
1645            return this.captionDescriptionStyle;
1646        };
1647        GalleryLib.prototype.setCaptionDescriptionStyle = function (css) {
1648            this.captionDescriptionStyle = css;
1649            this.elem.find(".wb-lightbox-description").css(css);
1650        };
1651        GalleryLib.prototype.setFrequency = function (frequency) {
1652            if (frequency >= 0 && frequency <= 10) {
1653                this.slideshowInterval = frequency;
1654                this.reset();
1655            }
1656        };
1657        GalleryLib.prototype.getFrequency = function () {
1658            return this.slideshowInterval;
1659        };
1660        GalleryLib.prototype.getBorder = function () {
1661            return this.border;
1662        };
1663        GalleryLib.prototype.setBorder = function (border) {
1664            this.border = border;
1665            this.elem.find('.gallery-image').css((this.imageCover || !this.border) ? { "border": "none" } : this.border);
1666            this.invalidate();
1667        };
1668        GalleryLib.prototype.getPadding = function () {
1669            return this.padding;
1670        };
1671        GalleryLib.prototype.getThumbWidth = function () {
1672            return this.thumbWidth ? this.thumbWidth : config.thumbWidth;
1673        };
1674        GalleryLib.prototype.getThumbHeight = function () {
1675            return this.thumbHeight ? this.thumbHeight : config.thumbHeight;
1676        };
1677        GalleryLib.prototype.getThumbAlign = function () {
1678            return this.thumbAlign;
1679        };
1680        GalleryLib.prototype.getThumbPadding = function () {
1681            return this.thumbPadding;
1682        };
1683        GalleryLib.prototype.setPadding = function (padding) {
1684            this.padding = padding;
1685            this.invalidate();
1686        };
1687        GalleryLib.prototype.setThumbWidth = function (width) {
1688            this.thumbWidth = width;
1689            this.invalidate();
1690        };
1691        GalleryLib.prototype.setThumbHeight = function (height) {
1692            this.thumbHeight = height;
1693            this.invalidate();
1694        };
1695        GalleryLib.prototype.setThumbAlign = function (align) {
1696            this.thumbAlign = align;
1697            this.invalidate();
1698        };
1699        GalleryLib.prototype.setThumbPadding = function (padding) {
1700            this.thumbPadding = padding;
1701            this.invalidate();
1702        };
1703        GalleryLib.prototype.getThumbAnim = function () {
1704            return this.thumbAnim;
1705        };
1706        GalleryLib.prototype.setThumbAnim = function (value) {
1707            if (value && ('_preview' in value) && value._preview) {
1708                delete value._preview;
1709            }
1710            this.thumbAnim = value;
1711            this.invalidate();
1712        };
1713        GalleryLib.prototype.getThumbShadow = function () {
1714            return this.thumbShadow;
1715        };
1716        GalleryLib.prototype.setThumbShadow = function (value) {
1717            this.thumbShadow = value;
1718            this.invalidate();
1719        };
1720        GalleryLib.prototype.setImageCover = function (value) {
1721            this.imageCover = value;
1722            this.invalidate();
1723        };
1724        GalleryLib.prototype.setDisablePopup = function (value) {
1725            this.disablePopup = value;
1726            this.invalidate();
1727        };
1728        GalleryLib.prototype.setHideArrows = function (hide) {
1729            this.hideArrows = hide;
1730            if (this.type === "slideshow") {
1731                var larr = this.elem.find(".gallery-slide-left");
1732                var rarr = this.elem.find(".gallery-slide-right");
1733                if (hide) {
1734                    larr.css('display', 'none');
1735                    rarr.css('display', 'none');
1736                }
1737                else {
1738                    larr.css('display', '');
1739                    rarr.css('display', '');
1740                }
1741            }
1742        };
1743        GalleryLib.prototype.setSlideOpacity = function (value) {
1744            this.slideOpacity = value;
1745            if (this.type === "slideshow" && this.listImgCont) {
1746                this.listImgCont.css('opacity', this.slideOpacity / 100);
1747            }
1748        };
1749        GalleryLib.prototype.getImageCover = function () {
1750            return this.imageCover;
1751        };
1752        GalleryLib.prototype.getDisablePopup = function () {
1753            return this.disablePopup;
1754        };
1755        GalleryLib.prototype.getHideArrows = function () {
1756            return this.hideArrows;
1757        };
1758        GalleryLib.prototype.getSlideOpacity = function () {
1759            return this.slideOpacity;
1760        };
1761        GalleryLib.prototype.setShowPictureCaption = function (value) {
1762            this.showPictureCaption = value;
1763            this.invalidate();
1764        };
1765        GalleryLib.prototype.getShowPictureCaption = function () {
1766            return this.showPictureCaption;
1767        };
1768        GalleryLib.prototype.getMapTypeId = function () { return this.mapTypeId; };
1769        GalleryLib.prototype.setMapTypeId = function (value) { this.mapTypeId = value; this.invalidate(); };
1770        GalleryLib.prototype.getMarkerIconTypeId = function () { return this.markerIconTypeId; };
1771        GalleryLib.prototype.setMarkerIconTypeId = function (value) { this.markerIconTypeId = value; this.invalidate(); };
1772        GalleryLib.prototype.getZoom = function () { return this.zoom; };
1773        GalleryLib.prototype.setZoom = function (value) { this.zoom = value; this.invalidate(); };
1774        GalleryLib.prototype.getMapCenter = function () { return this.mapCenter; };
1775        GalleryLib.prototype.setMapCenter = function (value) { this.mapCenter = value; this.invalidate(); };
1776        GalleryLib.prototype.getKey = function () { return this.key; };
1777        GalleryLib.prototype.setKey = function (value) { this.key = value; this.invalidate(); };
1778        GalleryLib.prototype.getTheme = function () { return this.theme; };
1779        GalleryLib.prototype.setTheme = function (value) { this.theme = value; this.invalidate(); };
1780        GalleryLib.prototype.getColor = function () { return this.color; };
1781        GalleryLib.prototype.setColor = function (value) { this.color = value; this.invalidate(); };
1782        GalleryLib.prototype.getShowSatellite = function () { return this.showSatellite; };
1783        GalleryLib.prototype.setShowSatellite = function (value) { this.showSatellite = value; this.invalidate(); };
1784        GalleryLib.prototype.getShowZoom = function () { return this.showZoom; };
1785        GalleryLib.prototype.setShowZoom = function (value) { this.showZoom = value; this.invalidate(); };
1786        GalleryLib.prototype.getShowStreetView = function () { return this.showStreetView; };
1787        GalleryLib.prototype.setShowStreetView = function (value) { this.showStreetView = value; this.invalidate(); };
1788        GalleryLib.prototype.getShowFullscreen = function () { return this.showFullscreen; };
1789        GalleryLib.prototype.setShowFullscreen = function (value) { this.showFullscreen = value; this.invalidate(); };
1790        GalleryLib.prototype.getAllowDragging = function () { return this.allowDragging; };
1791        GalleryLib.prototype.setAllowDragging = function (value) { this.allowDragging = value; this.invalidate(); };
1792        GalleryLib.prototype.getShowRoads = function () { return this.showRoads; };
1793        GalleryLib.prototype.setShowRoads = function (value) { this.showRoads = value; this.invalidate(); };
1794        GalleryLib.prototype.getShowLandmarks = function () { return this.showLandmarks; };
1795        GalleryLib.prototype.setShowLandmarks = function (value) { this.showLandmarks = value; this.invalidate(); };
1796        GalleryLib.prototype.getShowLabels = function () { return this.showLabels; };
1797        GalleryLib.prototype.setShowLabels = function (value) { this.showLabels = value; this.invalidate(); };
1798        GalleryLib.lightBoxInited = false;
1799        GalleryLib.galleryLibList = [];
1800        return GalleryLib;
1801    }());
1802    exports.GalleryLib = GalleryLib;
1803});

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.