PageSourceSearch

https://www.flicks.co.nz/main.min.js?v=2084

js flicks.co.nz collected 2026-09-24 09:21:53 UTC 1,277,565 bytes, 35,202 lines download raw bytes

1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2"use strict";
3
4Object.defineProperty(exports, "__esModule", {
5  value: true
6});
7var appConfig = typeof window !== "undefined" && window.__APP_CONFIG || {};
8
9var GOOGLE_MAPS_API_KEY = exports.GOOGLE_MAPS_API_KEY = appConfig.googleMapsApiKey || "";
10var GOOGLE_MAPS_MAP_ID = exports.GOOGLE_MAPS_MAP_ID = appConfig.googleMapsMapId || "";
11
12},{}],2:[function(require,module,exports){
13'use strict';
14
15Object.defineProperty(exports, "__esModule", {
16  value: true
17});
18// ---------------------------------------------
19//  Check movie status on all user lists
20// ---------------------------------------------
21var getListWrapper = document.querySelector('#user-lists-toggle-form');
22var preselectedList = void 0;
23
24var handleStatusTriggerClick = function handleStatusTriggerClick(e) {
25  var btn = e.target.closest(".js-check-lists-status");
26  if (!btn) return;
27
28  preselectedList = btn.dataset.preselected;
29
30  if (getListWrapper) {
31    getListWrapper.classList.add('is-loading');
32  }
33  var movieSlug = btn.dataset.slug;
34  if (movieSlug) {
35    fetchAndCheckWatchlists(movieSlug);
36  }
37};
38
39var addEventDelegation = function addEventDelegation() {
40  document.body.addEventListener("click", handleStatusTriggerClick);
41};
42
43async function fetchAndCheckWatchlists(movieSlug) {
44  var preselected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
45
46  try {
47    var response = await fetch('/watchlist-get-movie-lists/' + movieSlug + '/');
48    if (!response.ok) {
49      throw new Error("Failed to fetch watchlists");
50    }
51
52    var watchlists = await response.json();
53
54    // show remove from all button if movie is on more than 1 list
55    if (watchlists.length > 0) {
56      var removeAllButton = document.querySelector('.js-remove-from-all-lists');
57      if (removeAllButton) {
58        removeAllButton.classList.remove('is-hidden');
59      }
60    }
61
62    var form = document.getElementById("user-lists-toggle-form");
63    if (!form) return;
64
65    var checkboxes = form.querySelectorAll('input[type="checkbox"]');
66    checkboxes.forEach(function (checkbox) {
67      checkbox.checked = false;
68    });
69
70    watchlists.forEach(function (slug) {
71      var checkbox = form.querySelector('#' + slug + '-popup');
72      if (checkbox) {
73        checkbox.checked = true;
74      }
75    });
76
77    if (preselectedList && preselectedList == 'watchlist' && watchlists.length < 1) {
78      var checkbox = form.querySelector('#watchlist-popup');
79      if (checkbox) {
80        checkbox.checked = true;
81      }
82    }
83
84    if (getListWrapper) {
85      getListWrapper.classList.remove('is-loading');
86    }
87  } catch (error) {
88    console.error("Error fetching watchlists:", error);
89  }
90}
91
92var startMovieStatusCheck = function startMovieStatusCheck() {
93  addEventDelegation();
94};
95
96exports.startMovieStatusCheck = startMovieStatusCheck;
97exports.fetchAndCheckWatchlists = fetchAndCheckWatchlists;
98
99},{}],3:[function(require,module,exports){
100'use strict';
101
102Object.defineProperty(exports, "__esModule", {
103  value: true
104});
105exports.handleDotEvent = handleDotEvent;
106exports.modalsHandler = modalsHandler;
107exports.tabsHandler = tabsHandler;
108exports.timesCardsAnimation = timesCardsAnimation;
109exports.notification = notification;
110exports.formerror = formerror;
111
112function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
113
114function handleDotEvent(e, slider, dotCount, dotContainer, dotListItem) {
115  if (e.type === 'before.lory.init') {
116    for (var i = 0, len = dotCount; i < len; i++) {
117      var clone = dotListItem.cloneNode();
118      clone.classList.add('dots__dot');
119      dotContainer.appendChild(clone);
120    }
121    dotContainer.childNodes[0].classList.add('dots__dot--active');
122  }
123  if (e.type === 'after.lory.init') {
124    for (var _i = 0, _len = dotCount; _i < _len; _i++) {
125      dotContainer.childNodes[_i].addEventListener('click', function (e) {
126        slider.slideTo(Array.prototype.indexOf.call(dotContainer.childNodes, e.target));
127      });
128    }
129  }
130  if (e.type === 'after.lory.slide') {
131    for (var _i2 = 0, _len2 = dotContainer.childNodes.length; _i2 < _len2; _i2++) {
132      dotContainer.childNodes[_i2].classList.remove('dots__dot--active');
133    }
134    // dotContainer.childNodes[e.detail.currentSlide - 1].classList.add('dots__dot--active')
135    dotContainer.childNodes[e.detail.currentSlide].classList.add('dots__dot--active');
136  }
137  if (e.type === 'on.lory.resize') {
138    // for (let i = 0, len = dotContainer.childNodes.length; i < len; i++) {
139    //   dotContainer.childNodes[i].classList.remove('dots__dot--active')
140    // }
141    // dotContainer.childNodes[0].classList.add('dots__dot--active')
142
143    return;
144  }
145}
146
147function shouldLockPageScroll(modal) {
148  return !!(modal && modal.matches(".search-nav"));
149}
150
151function modalsHandler(action, nav) {
152  if (action === 'OpenNormal') {
153    //in this mode, user can scroll the page, background is not lock
154    nav.classList.add('modal--displaying');
155  } else if (action === 'open') {
156    if (shouldLockPageScroll(nav)) {
157      document.querySelector('body').classList.add('is-hidden');
158      document.querySelector('html').classList.add('is-hidden');
159    }
160    nav.classList.add('modal--displaying');
161  } else {
162    var video = nav.querySelector("video");
163    if (video) {
164      video.pause();
165    }
166    if (document.querySelector('.member-nav__form--showing')) [].concat(_toConsumableArray(nav.children)).forEach(function (child) {
167      return child.classList.remove('member-nav__form--showing');
168    });
169    nav.classList.remove('modal--displaying');
170
171    if (shouldLockPageScroll(nav) && !document.querySelector('.search-nav.modal--displaying')) {
172      document.querySelector('body').classList.remove('is-hidden');
173      document.querySelector('html').classList.remove('is-hidden');
174    }
175
176    var _formerror = document.querySelector('.formerror');
177    if (_formerror) _formerror.parentNode.removeChild(_formerror);
178  }
179}
180
181function tabsHandler(trigger, tabIndex, triggers, tabs, triggerActiveClass, tabActiveClass, scrollContainer, cb) {
182  [].concat(_toConsumableArray(triggers)).forEach(function (trigger) {
183    return trigger.classList.remove(triggerActiveClass);
184  });
185  [].concat(_toConsumableArray(tabs)).forEach(function (tab) {
186    return tab.classList.remove(tabActiveClass);
187  });
188
189  trigger.classList.add(triggerActiveClass);
190  tabs[tabIndex].classList.add(tabActiveClass);
191
192  if (cb) cb();
193
194  if (scrollContainer) {
195    scrollContainer.scrollLeft = trigger.offsetLeft - scrollContainer.offsetWidth / 2 + trigger.offsetWidth / 2;
196  }
197}
198
199function timesCardsAnimation(tab) {
200  var timesCards = tab.querySelectorAll('.js--timesCard');
201  var delay = 0;
202
203  [].concat(_toConsumableArray(timesCards)).forEach(function (card) {
204    card.style.animationDelay = '0.' + delay + 's';
205    delay++;
206  });
207}
208
209function notification(msg) {
210  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'info';
211
212  // todo - dismissable notifications sliding from top
213  alert(msg);
214}
215
216function formerror(msg) {
217  var before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
218
219  if (!before) before = document.querySelector("button[type='submit']");else before = document.querySelector(before);
220  if (!before) return false;
221
222  var message = document.createElement("p");
223  message.classList.add("formerror");
224  message.innerHTML = msg;
225
226  before.parentNode.insertBefore(message, before);
227}
228
229},{}],4:[function(require,module,exports){
230(function (global){(function (){
231"use strict";
232
233var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
234
235!function (e) {
236  if ("object" == (typeof exports === "undefined" ? "undefined" : _typeof(exports))) module.exports = e();else if ("function" == typeof define && define.amd) define(e);else {
237    var f;"undefined" != typeof window ? f = window : "undefined" != typeof global ? f = global : "undefined" != typeof self && (f = self), f.ShareButton = e();
238  }
239}(function () {
240  var define, module, exports;return function e(t, n, r) {
241    function s(o, u) {
242      if (!n[o]) {
243        if (!t[o]) {
244          var a = typeof require == "function" && require;if (!u && a) return a(o, !0);if (i) return i(o, !0);throw new Error("Cannot find module '" + o + "'");
245        }var f = n[o] = { exports: {} };t[o][0].call(f.exports, function (e) {
246          var n = t[o][1][e];return s(n ? n : e);
247        }, f, f.exports, e, t, n, r);
248      }return n[o].exports;
249    }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
250      s(r[o]);
251    }return s;
252  }({ 1: [function (_dereq_, module, exports) {
253      _dereq_('../../modules/es6.array.iterator');
254      module.exports = _dereq_('../../modules/$.core').Array.values;
255    }, { "../../modules/$.core": 6, "../../modules/es6.array.iterator": 34 }], 2: [function (_dereq_, module, exports) {
256      _dereq_('../../modules/es6.math.trunc');
257      module.exports = _dereq_('../../modules/$.core').Math.trunc;
258    }, { "../../modules/$.core": 6, "../../modules/es6.math.trunc": 35 }], 3: [function (_dereq_, module, exports) {
259      _dereq_('../../modules/es6.symbol');
260      module.exports = _dereq_('../../modules/$.core').Symbol;
261    }, { "../../modules/$.core": 6, "../../modules/es6.symbol": 36 }], 4: [function (_dereq_, module, exports) {
262      var isObject = _dereq_('./$.is-object');
263      module.exports = function (it) {
264        if (!isObject(it)) throw TypeError(it + ' is not an object!');
265        return it;
266      };
267    }, { "./$.is-object": 17 }], 5: [function (_dereq_, module, exports) {
268      var toString = {}.toString;
269
270      module.exports = function (it) {
271        return toString.call(it).slice(8, -1);
272      };
273    }, {}], 6: [function (_dereq_, module, exports) {
274      var core = module.exports = { version: '1.2.3' };
275      if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
276    }, {}], 7: [function (_dereq_, module, exports) {
277      var global = _dereq_('./$.global'),
278          core = _dereq_('./$.core'),
279          hide = _dereq_('./$.hide'),
280          $redef = _dereq_('./$.redef'),
281          PROTOTYPE = 'prototype';
282      var ctx = function ctx(fn, that) {
283        return function () {
284          return fn.apply(that, arguments);
285        };
286      };
287      var $def = function $def(type, name, source) {
288        var key,
289            own,
290            out,
291            exp,
292            isGlobal = type & $def.G,
293            isProto = type & $def.P,
294            target = isGlobal ? global : type & $def.S ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE],
295            exports = isGlobal ? core : core[name] || (core[name] = {});
296        if (isGlobal) source = name;
297        for (key in source) {
298          // contains in native
299          own = !(type & $def.F) && target && key in target;
300          // export native or passed
301          out = (own ? target : source)[key];
302          // bind timers to global for call from export context
303          if (type & $def.B && own) exp = ctx(out, global);else exp = isProto && typeof out == 'function' ? ctx(Function.call, out) : out;
304          // extend global
305          if (target && !own) $redef(target, key, out);
306          // export
307          if (exports[key] != out) hide(exports, key, exp);
308          if (isProto) (exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out;
309        }
310      };
311      global.core = core;
312      // type bitmap
313      $def.F = 1; // forced
314      $def.G = 2; // global
315      $def.S = 4; // static
316      $def.P = 8; // proto
317      $def.B = 16; // bind
318      $def.W = 32; // wrap
319      module.exports = $def;
320    }, { "./$.core": 6, "./$.global": 12, "./$.hide": 14, "./$.redef": 26 }], 8: [function (_dereq_, module, exports) {
321      // 7.2.1 RequireObjectCoercible(argument)
322      module.exports = function (it) {
323        if (it == undefined) throw TypeError("Can't call method on  " + it);
324        return it;
325      };
326    }, {}], 9: [function (_dereq_, module, exports) {
327      // all enumerable object keys, includes symbols
328      var $ = _dereq_('./$');
329      module.exports = function (it) {
330        var keys = $.getKeys(it),
331            getSymbols = $.getSymbols;
332        if (getSymbols) {
333          var symbols = getSymbols(it),
334              isEnum = $.isEnum,
335              i = 0,
336              key;
337          while (symbols.length > i) {
338            if (isEnum.call(it, key = symbols[i++])) keys.push(key);
339          }
340        }
341        return keys;
342      };
343    }, { "./$": 22 }], 10: [function (_dereq_, module, exports) {
344      module.exports = function (exec) {
345        try {
346          return !!exec();
347        } catch (e) {
348          return true;
349        }
350      };
351    }, {}], 11: [function (_dereq_, module, exports) {
352      // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
353      var toString = {}.toString,
354          toIObject = _dereq_('./$.to-iobject'),
355          getNames = _dereq_('./$').getNames;
356
357      var windowNames = (typeof window === "undefined" ? "undefined" : _typeof(window)) == 'object' && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
358
359      var getWindowNames = function getWindowNames(it) {
360        try {
361          return getNames(it);
362        } catch (e) {
363          return windowNames.slice();
364        }
365      };
366
367      module.exports.get = function getOwnPropertyNames(it) {
368        if (windowNames && toString.call(it) == '[object Window]') return getWindowNames(it);
369        return getNames(toIObject(it));
370      };
371    }, { "./$": 22, "./$.to-iobject": 30 }], 12: [function (_dereq_, module, exports) {
372      // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
373      var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
374      if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
375    }, {}], 13: [function (_dereq_, module, exports) {
376      var hasOwnProperty = {}.hasOwnProperty;
377      module.exports = function (it, key) {
378        return hasOwnProperty.call(it, key);
379      };
380    }, {}], 14: [function (_dereq_, module, exports) {
381      var $ = _dereq_('./$'),
382          createDesc = _dereq_('./$.property-desc');
383      module.exports = _dereq_('./$.support-desc') ? function (object, key, value) {
384        return $.setDesc(object, key, createDesc(1, value));
385      } : function (object, key, value) {
386        object[key] = value;
387        return object;
388      };
389    }, { "./$": 22, "./$.property-desc": 25, "./$.support-desc": 28 }], 15: [function (_dereq_, module, exports) {
390      // fallback for non-array-like ES3 and non-enumerable old V8 strings
391      var cof = _dereq_('./$.cof');
392      module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
393        return cof(it) == 'String' ? it.split('') : Object(it);
394      };
395    }, { "./$.cof": 5 }
395], 16: [function (_dereq_, module, exports) {
396      // 7.2.2 IsArray(argument)
397      var cof = _dereq_('./$.cof');
398      module.exports = Array.isArray || function (arg) {
399        return cof(arg) == 'Array';
400      };
401    }, { "./$.cof": 5 }], 17: [function (_dereq_, module, exports) {
402      module.exports = function (it) {
403        return (typeof it === "undefined" ? "undefined" : _typeof(it)) === 'object' ? it !== null : typeof it === 'function';
404      };
405    }, {}], 18: [function (_dereq_, module, exports) {
406      'use strict';
407
408      var $ = _dereq_('./$'),
409          IteratorPrototype = {};
410
411      // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
412      _dereq_('./$.hide')(IteratorPrototype, _dereq_('./$.wks')('iterator'), function () {
413        return this;
414      });
415
416      module.exports = function (Constructor, NAME, next) {
417        Constructor.prototype = $.create(IteratorPrototype, { next: _dereq_('./$.property-desc')(1, next) });
418        _dereq_('./$.tag')(Constructor, NAME + ' Iterator');
419      };
420    }, { "./$": 22, "./$.hide": 14, "./$.property-desc": 25, "./$.tag": 29, "./$.wks": 33 }], 19: [function (_dereq_, module, exports) {
421      'use strict';
422
423      var LIBRARY = _dereq_('./$.library'),
424          $def = _dereq_('./$.def'),
425          $redef = _dereq_('./$.redef'),
426          hide = _dereq_('./$.hide'),
427          has = _dereq_('./$.has'),
428          SYMBOL_ITERATOR = _dereq_('./$.wks')('iterator'),
429          Iterators = _dereq_('./$.iterators'),
430          BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
431      ,
432          FF_ITERATOR = '@@iterator',
433          KEYS = 'keys',
434          VALUES = 'values';
435      var returnThis = function returnThis() {
436        return this;
437      };
438      module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE) {
439        _dereq_('./$.iter-create')(Constructor, NAME, next);
440        var createMethod = function createMethod(kind) {
441          switch (kind) {
442            case KEYS:
443              return function keys() {
444                return new Constructor(this, kind);
445              };
446            case VALUES:
447              return function values() {
448                return new Constructor(this, kind);
449              };
450          }return function entries() {
451            return new Constructor(this, kind);
452          };
453        };
454        var TAG = NAME + ' Iterator',
455            proto = Base.prototype,
456            _native = proto[SYMBOL_ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT],
457            _default = _native || createMethod(DEFAULT),
458            methods,
459            key;
460        // Fix native
461        if (_native) {
462          var IteratorPrototype = _dereq_('./$').getProto(_default.call(new Base()));
463          // Set @@toStringTag to native iterators
464          _dereq_('./$.tag')(IteratorPrototype, TAG, true);
465          // FF fix
466          if (!LIBRARY && has(proto, FF_ITERATOR)) hide(IteratorPrototype, SYMBOL_ITERATOR, returnThis);
467        }
468        // Define iterator
469        if (!LIBRARY || FORCE) hide(proto, SYMBOL_ITERATOR, _default);
470        // Plug for library
471        Iterators[NAME] = _default;
472        Iterators[TAG] = returnThis;
473        if (DEFAULT) {
474          methods = {
475            values: DEFAULT == VALUES ? _default : createMethod(VALUES),
476            keys: IS_SET ? _default : createMethod(KEYS),
477            entries: DEFAULT != VALUES ? _default : createMethod('entries')
478          };
479          if (FORCE) for (key in methods) {
480            if (!(key in proto)) $redef(proto, key, methods[key]);
481          } else $def($def.P + $def.F * BUGGY, NAME, methods);
482        }
483      };
484    }, { "./$": 22, "./$.def": 7, "./$.has": 13, "./$.hide": 14, "./$.iter-create": 18, "./$.iterators": 21, "./$.library": 24, "./$.redef": 26, "./$.tag": 29, "./$.wks": 33 }], 20: [function (_dereq_, module, exports) {
485      module.exports = function (done, value) {
486        return { value: value, done: !!done };
487      };
488    }, {}], 21: [function (_dereq_, module, exports) {
489      module.exports = {};
490    }, {}
490], 22: [function (_dereq_, module, exports) {
491      var $Object = Object;
492      module.exports = {
493        create: $Object.create,
494        getProto: $Object.getPrototypeOf,
495        isEnum: {}.propertyIsEnumerable,
496        getDesc: $Object.getOwnPropertyDescriptor,
497        setDesc: $Object.defineProperty,
498        setDescs: $Object.defineProperties,
499        getKeys: $Object.keys,
500        getNames: $Object.getOwnPropertyNames,
501        getSymbols: $Object.getOwnPropertySymbols,
502        each: [].forEach
503      };
504    }, {}], 23: [function (_dereq_, module, exports) {
505      var $ = _dereq_('./$'),
506          toIObject = _dereq_('./$.to-iobject');
507      module.exports = function (object, el) {
508        var O = toIObject(object),
509            keys = $.getKeys(O),
510            length = keys.length,
511            index = 0,
512            key;
513        while (length > index) {
514          if (O[key = keys[index++]] === el) return key;
515        }
516      };
517    }, { "./$": 22, "./$.to-iobject": 30 }], 24: [function (_dereq_, module, exports) {
518      module.exports = false;
519    }, {}], 25: [function (_dereq_, module, exports) {
520      module.exports = function (bitmap, value) {
521        return {
522          enumerable: !(bitmap & 1),
523          configurable: !(bitmap & 2),
524          writable: !(bitmap & 4),
525          value: value
526        };
527      };
528    }, {}], 26: [function (_dereq_, module, exports) {
529      // add fake Function#toString
530      // for correct work wrapped methods / constructors with methods like LoDash isNative
531      var global = _dereq_('./$.global'),
532          hide = _dereq_('./$.hide'),
533          SRC = _dereq_('./$.uid')('src'),
534          TO_STRING = 'toString',
535          $toString = Function[TO_STRING],
536          TPL = ('' + $toString).split(TO_STRING);
537
538      _dereq_('./$.core').inspectSource = function (it) {
539        return $toString.call(it);
540      };
541
542      (module.exports = function (O, key, val, safe) {
543        if (typeof val == 'function') {
544          val.hasOwnProperty(SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
545          val.hasOwnProperty('name') || hide(val, 'name', key);
546        }
547        if (O === global) {
548          O[key] = val;
549        } else {
550          if (!safe) delete O[key];
551          hide(O, key, val);
552        }
553      })(Function.prototype, TO_STRING, function toString() {
554        return typeof this == 'function' && this[SRC] || $toString.call(this);
555      });
556    }, { "./$.core": 6, "./$.global": 12, "./$.hide": 14, "./$.uid": 31 }], 27: [function (_dereq_, module, exports) {
557      var global = _dereq_('./$.global'),
558          SHARED = '__core-js_shared__',
559          store = global[SHARED] || (global[SHARED] = {});
560      module.exports = function (key) {
561        return store[key] || (store[key] = {});
562      };
563    }, { "./$.global": 12 }], 28: [function (_dereq_, module, exports) {
564      // Thank's IE8 for his funny defineProperty
565      module.exports = !_dereq_('./$.fails')(function () {
566        return Object.defineProperty({}, 'a', { get: function get() {
567            return 7;
568          } }).a != 7;
569      });
570    }, { "./$.fails": 10 }], 29: [function (_dereq_, module, exports) {
571      var def = _dereq_('./$').setDesc,
572          has = _dereq_('./$.has'),
573          TAG = _dereq_('./$.wks')('toStringTag');
574
575      module.exports = function (it, tag, stat) {
576        if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
577      };
578    }, { "./$": 22, "./$.has": 13, "./$.wks": 33 }], 30: [function (_dereq_, module, exports) {
579      // to indexed object, toObject with fallback for non-array-like ES3 strings
580      var IObject = _dereq_('./$.iobject'),
581          defined = _dereq_('./$.defined');
582      module.exports = function (it) {
583        return IObject(defined(it));
584      };
585    }, { "./$.defined": 8, "./$.iobject": 15 }], 31: [function (_dereq_, module, exports) {
586      var id = 0,
587          px = Math.random();
588      module.exports = function (key) {
589        return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
590      };
591    }, {}
591], 32: [function (_dereq_, module, exports) {
592      // 22.1.3.31 Array.prototype[@@unscopables]
593      var UNSCOPABLES = _dereq_('./$.wks')('unscopables');
594      if ([][UNSCOPABLES] == undefined) _dereq_('./$.hide')(Array.prototype, UNSCOPABLES, {});
595      module.exports = function (key) {
596        [][UNSCOPABLES][key] = true;
597      };
598    }, { "./$.hide": 14, "./$.wks": 33 }], 33: [function (_dereq_, module, exports) {
599      var store = _dereq_('./$.shared')('wks'),
600          _Symbol = _dereq_('./$.global').Symbol;
601      module.exports = function (name) {
602        return store[name] || (store[name] = _Symbol && _Symbol[name] || (_Symbol || _dereq_('./$.uid'))('Symbol.' + name));
603      };
604    }, { "./$.global": 12, "./$.shared": 27, "./$.uid": 31 }], 34: [function (_dereq_, module, exports) {
605      'use strict';
606
607      var setUnscope = _dereq_('./$.unscope'),
608          step = _dereq_('./$.iter-step'),
609          Iterators = _dereq_('./$.iterators'),
610          toIObject = _dereq_('./$.to-iobject');
611
612      // 22.1.3.4 Array.prototype.entries()
613      // 22.1.3.13 Array.prototype.keys()
614      // 22.1.3.29 Array.prototype.values()
615      // 22.1.3.30 Array.prototype[@@iterator]()
616      _dereq_('./$.iter-define')(Array, 'Array', function (iterated, kind) {
617        this._t = toIObject(iterated); // target
618        this._i = 0; // next index
619        this._k = kind; // kind
620        // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
621      }, function () {
622        var O = this._t,
623            kind = this._k,
624            index = this._i++;
625        if (!O || index >= O.length) {
626          this._t = undefined;
627          return step(1);
628        }
629        if (kind == 'keys') return step(0, index);
630        if (kind == 'values') return step(0, O[index]);
631        return step(0, [index, O[index]]);
632      }, 'values');
633
634      // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
635      Iterators.Arguments = Iterators.Array;
636
637      setUnscope('keys');
638      setUnscope('values');
639      setUnscope('entries');
640    }, { "./$.iter-define": 19, "./$.iter-step": 20, "./$.iterators": 21, "./$.to-iobject": 30, "./$.unscope": 32 }], 35: [function (_dereq_, module, exports) {
641      // 20.2.2.34 Math.trunc(x)
642      var $def = _dereq_('./$.def');
643
644      $def($def.S, 'Math', {
645        trunc: function trunc(it) {
646          return (it > 0 ? Math.floor : Math.ceil)(it);
647        }
648      });
649    }, { "./$.def": 7 }], 36: [function (_dereq_, module, exports) {
650      'use strict';
651      // ECMAScript 6 symbols shim
652
653      var $ = _dereq_('./$'),
654          global = _dereq_('./$.global'),
655          has = _dereq_('./$.has'),
656          SUPPORT_DESC = _dereq_('./$.support-desc'),
657          $def = _dereq_('./$.def'),
658          $redef = _dereq_('./$.redef'),
659          $fails = _dereq_('./$.fails'),
660          shared = _dereq_('./$.shared'),
661          setTag = _dereq_('./$.tag'),
662          uid = _dereq_('./$.uid'),
663          wks = _dereq_('./$.wks'),
664          keyOf = _dereq_('./$.keyof'),
665          $names = _dereq_('./$.get-names'),
666          enumKeys = _dereq_('./$.enum-keys'),
667          isArray = _dereq_('./$.is-array'),
668          anObject = _dereq_('./$.an-object'),
669          toIObject = _dereq_('./$.to-iobject'),
670          createDesc = _dereq_('./$.property-desc'),
671          getDesc = $.getDesc,
672          setDesc = $.setDesc,
673          _create = $.create,
674          getNames = $names.get,
675          $Symbol = global.Symbol,
676          $JSON = global.JSON,
677          _stringify = $JSON && $JSON.stringify,
678          setter = false,
679          HIDDEN = wks('_hidden'),
680          isEnum = $.isEnum,
681          SymbolRegistry = shared('symbol-registry'),
682          AllSymbols = shared('symbols'),
683          useNative = typeof $Symbol == 'function',
684          ObjectProto = Object.prototype;
685
686      // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
687      var setSymbolDesc = SUPPORT_DESC && $fails(function () {
688        return _create(setDesc({}, 'a', {
689          get: function get() {
690            return setDesc(this, 'a', { value: 7 }).a;
691          }
692        })).a != 7;
693      }) ? function (it, key, D) {
694        var protoDesc = getDesc(ObjectProto, key);
695        if (protoDesc) delete ObjectProto[key];
696        setDesc(it, key, D);
697        if (protoDesc && it !== ObjectProto) setDesc(ObjectProto, key, protoDesc);
698      } : setDesc;
699
700      var wrap = function wrap(tag) {
701        var sym = AllSymbols[tag] = _create($Symbol.prototype);
702        sym._k = tag;
703        SUPPORT_DESC && setter && setSymbolDesc(ObjectProto, tag, {
704          configurable: true,
705          set: function set(value) {
706            if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
707            setSymbolDesc(this, tag, createDesc(1, value));
708          }
709        });
710        return sym;
711      };
712
713      var isSymbol = function isSymbol(it) {
714        return (typeof it === "undefined" ? "undefined" : _typeof(it)) == 'symbol';
715      };
716
717      var $defineProperty = function defineProperty(it, key, D) {
718        if (D && has(AllSymbols, key)) {
719          if (!D.enumerable) {
720            if (!has(it, HIDDEN)) setDesc(it, HIDDEN, createDesc(1, {}));
721            it[HIDDEN][key] = true;
722          } else {
723            if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
724            D = _create(D, { enumerable: createDesc(0, false) });
725          }return setSymbolDesc(it, key, D);
726        }return setDesc(it, key, D);
727      };
728      var $defineProperties = function defineProperties(it, P) {
729        anObject(it);
730        var keys = enumKeys(P = toIObject(P)),
731            i = 0,
732            l = keys.length,
733            key;
734        while (l > i) {
735          $defineProperty(it, key = keys[i++], P[key]);
736        }return it;
737      };
738      var $create = function create(it, P) {
739        return P === undefined ? _create(it) : $defineProperties(_create(it), P);
740      };
741      var $propertyIsEnumerable = function propertyIsEnumerable(key) {
742        var E = isEnum.call(this, key);
743        return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
744      };
745      var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
746        var D = getDesc(it = toIObject(it), key);
747        if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
748        return D;
749      };
750      var $getOwnPropertyNames = function getOwnPropertyNames(it) {
751        var names = getNames(toIObject(it)),
752            result = [],
753            i = 0,
754            key;
755        while (names.length > i) {
756          if (!has(AllSymbols, key = names[i++]) && key != HIDDEN) result.push(key);
757        }return result;
758      };
759      var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
760        var names = getNames(toIObject(it)),
761            result = [],
762            i = 0,
763            key;
764        while (names.length > i) {
765          if (has(AllSymbols, key = names[i++])) result.push(AllSymbols[key]);
766        }return result;
767      };
768      var $stringify = function stringify(it) {
769        var args = [it],
770            i = 1,
771            $$ = arguments,
772            replacer,
773            $replacer;
774        while ($$.length > i) {
775          args.push($$[i++]);
776        }replacer = args[1];
777        if (typeof replacer == 'function') $replacer = replacer;
778        if ($replacer || !isArray(replacer)) replacer = function replacer(key, value) {
779          if ($replacer) value = $replacer.call(this, key, value);
780          if (!isSymbol(value)) return value;
781        };
782        args[1] = replacer;
783        return _stringify.apply($JSON, args);
784      };
785      var buggyJSON = $fails(function () {
786        var S = $Symbol();
787        // MS Edge converts symbol values to JSON as {}
788        // WebKit converts symbol values to JSON as null
789        // V8 throws on boxed symbols
790        return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
791      });
792
793      // 19.4.1.1 Symbol([description])
794      if (!useNative) {
795        $Symbol = function _Symbol2() {
796          if (isSymbol(this)) throw TypeError('Symbol is not a constructor');
797          return wrap(uid(arguments.length > 0 ? arguments[0] : undefined));
798        };
799        $redef($Symbol.prototype, 'toString', function toString() {
800          return this._k;
801        });
802
803        isSymbol = function isSymbol(it) {
804          return it instanceof $Symbol;
805        };
806
807        $.create = $create;
808        $.isEnum = $propertyIsEnumerable;
809        $.getDesc = $getOwnPropertyDescriptor;
810        $.setDesc = $defineProperty;
811        $.setDescs = $defineProperties;
812        $.getNames = $names.get = $getOwnPropertyNames;
813        $.getSymbols = $getOwnPropertySymbols;
814
815        if (SUPPORT_DESC && !_dereq_('./$.library')) {
816          $redef(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
817        }
818      }
819
820      var symbolStatics = {
821        // 19.4.2.1 Symbol.for(key)
822        'for': function _for(key) {
823          return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key);
824        },
825        // 19.4.2.5 Symbol.keyFor(sym)
826        keyFor: function keyFor(key) {
827          return keyOf(SymbolRegistry, key);
828        },
829        useSetter: function useSetter() {
830          setter = true;
831        },
832        useSimple: function useSimple() {
833          setter = false;
834        }
835      };
836      // 19.4.2.2 Symbol.hasInstance
837      // 19.4.2.3 Symbol.isConcatSpreadable
838      // 19.4.2.4 Symbol.iterator
839      // 19.4.2.6 Symbol.match
840      // 19.4.2.8 Symbol.replace
841      // 19.4.2.9 Symbol.search
842      // 19.4.2.10 Symbol.species
843      // 19.4.2.11 Symbol.split
844      // 19.4.2.12 Symbol.toPrimitive
845      // 19.4.2.13 Symbol.toStringTag
846      // 19.4.2.14 Symbol.unscopables
847      $.each.call(('hasInstance,isConcatSpreadable,iterator,match,replace,search,' + 'species,split,toPrimitive,toStringTag,unscopables').split(','), function (it) {
848        var sym = wks(it);
849        symbolStatics[it] = useNative ? sym : wrap(sym);
850      });
851
852      setter = true;
853
854      $def($def.G + $def.W, { Symbol: $Symbol });
855
856      $def($def.S, 'Symbol', symbolStatics);
857
858      $def($def.S + $def.F * !useNative, 'Object', {
859        // 19.1.2.2 Object.create(O [, Properties])
860        create: $create,
861        // 19.1.2.4 Object.defineProperty(O, P, Attributes)
862        defineProperty: $defineProperty,
863        // 19.1.2.3 Object.defineProperties(O, Properties)
864        defineProperties: $defineProperties,
865        // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
866        getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
867        // 19.1.2.7 Object.getOwnPropertyNames(O)
868        getOwnPropertyNames: $getOwnPropertyNames,
869        // 19.1.2.8 Object.getOwnPropertySymbols(O)
870        getOwnPropertySymbols: $getOwnPropertySymbols
871      });
872
873      // 24.3.2 JSON.stringify(value [, replacer [, space]])
874      $JSON && $def($def.S + $def.F * (!useNative || buggyJSON), 'JSON', { stringify: $stringify });
875
876      // 19.4.3.5 Symbol.prototype[@@toStringTag]
877      setTag($Symbol, 'Symbol');
878      // 20.2.1.9 Math[@@toStringTag]
879      setTag(Math, 'Math', true);
880      // 24.3.3 JSON[@@toStringTag]
881      setTag(global.JSON, 'JSON', true);
882    }, { "./$": 22, "./$.an-object": 4, "./$.def": 7, "./$.enum-keys": 9, "./$.fails": 10, "./$.get-names": 11, "./$.global": 12, "./$.has": 13, "./$.is-array": 16, "./$.keyof": 23, "./$.library": 24, "./$.property-desc": 25, "./$.redef": 26, "./$.shared": 27, "./$.support-desc": 28, "./$.tag": 29, "./$.to-iobject": 30, "./$.uid": 31, "./$.wks": 33 }], 37: [function (_dereq_, module, exports) {
883      'use strict';
884
885      var _createClass = function () {
886        function defineProperties(target, props) {
887          for (var i = 0; i < props.length; i++) {
888            var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
889          }
890        }return function (Constructor, protoProps, staticProps) {
891          if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
892        };
893      }();
894
895      var _get = function get(_x, _x2, _x3) {
896        var _again = true;_function: while (_again) {
897          var object = _x,
898              property = _x2,
899              receiver = _x3;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
900            var parent = Object.getPrototypeOf(object);if (parent === null) {
901              return undefined;
902            } else {
903              _x = parent;_x2 = property;_x3 = receiver;_again = true;desc = parent = undefined;continue _function;
904            }
905          } else if ('value' in desc) {
906            return desc.value;
907          } else {
908            var getter = desc.get;if (getter === undefined) {
909              return undefined;
910            }return getter.call(receiver);
911          }
912        }
913      };
914
915      function _interopRequireDefault(obj) {
916        return obj && obj.__esModule ? obj : { 'default': obj };
917      }
918
919      function _classCallCheck(instance, Constructor) {
920        if (!(instance instanceof Constructor)) {
921          throw new TypeError('Cannot call a class as a function');
922        }
923      }
924
925      function _inherits(subClass, superClass) {
926        if (typeof superClass !== 'function' && superClass !== null) {
927          throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === "undefined" ? "undefined" : _typeof(superClass)));
928        }subClass.prototype = Object.create(superClass && superClass.prototype, { c
928onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
929      }
930
931      var _shareUtils = _dereq_('./share-utils');
932
933      var _shareUtils2 = _interopRequireDefault(_shareUtils);
934
935      /**
936       * Sharebutton
937       * @class
938       * @classdesc
939       * @extends ShareUtils
940      
941       * @param {String} element
942       * @param {Object} options
943       */
944      _dereq_('core-js/fn/symbol');
945      _dereq_('core-js/fn/array/iterator');
946      _dereq_('core-js/fn/math/trunc');
947
948      var ShareButton = function (_ShareUtils) {
949        _inherits(ShareButton, _ShareUtils);
950
951        function ShareButton(element, options) {
952          _classCallCheck(this, ShareButton);
953
954          _get(Object.getPrototypeOf(ShareButton.prototype), 'constructor', this).call(this);
955
956          if ((typeof element === "undefined" ? "undefined" : _typeof(element)) === 'object') {
957            this.element = undefined;
958            options = element;
959          } else this.element = element;
960
961          this.el = {
962            head: document.getElementsByTagName('head')[0],
963            body: document.getElementsByTagName('body')[0]
964          };
965
966          this.config = {
967            enabledNetworks: 0,
968            protocol: '//',
969            url: window.location.href,
970            caption: null,
971            title: this._defaultTitle(),
972            image: this._defaultImage(),
973            description: this._defaultDescription(),
974
975            ui: {
976              flyout: 'sb-top sb-center',
977              // buttonText: '<svg><use xlink:href="#share"/></svg> Share',
978              buttonText: '',
979              namespace: 'sb-',
980              networkOrder: [],
981              collision: false
982            },
983
984            networks: {
985              googlePlus: {
986                enabled: true,
987                url: null
988              },
989              twitter: {
990                enabled: true,
991                url: null,
992                description: null
993              },
994              facebook: {
995                enabled: true,
996                loadSdk: true,
997                url: null,
998                appId: null,
999                title: null,
1000                caption: null,
1001                description: null,
1002                image: null
1003              },
1004              pinterest: {
1005                enabled: true,
1006                url: null,
1007                image: null,
1008                description: null
1009              },
1010              reddit: {
1011                enabled: true,
1012                url: null,
1013                title: null
1014              },
1015              linkedin: {
1016                enabled: true,
1017                url: null,
1018                title: null,
1019                description: null
1020              },
1021              whatsapp: {
1022                enabled: true,
1023                description: null,
1024                url: null
1025              },
1026              email: {
1027                enabled: true,
1028                title: null,
1029                description: null
1030              }
1031            }
1032          };
1033
1034          this.listener = null;
1035          this._setup(this.element, options);
1036        }
1037
1038        /**
1039         * @method open
1040         * @description Opens Share Button
1041         */
1042
1043        _createClass(ShareButton, [{
1044          key: 'open',
1045          value: function open() {
1046            this._public('Open');
1047          }
1048
1049          /**
1050           * @method close
1051           * @description Cpens Share Button
1052           */
1053        }, {
1054          key: 'close',
1055          value: function close() {
1056            this._public('Close');
1057          }
1058
1059          /**
1060           * @method toggle
1061           * @description Toggles Share Button
1062           */
1063        }, {
1064          key: 'toggle',
1065          value: function toggle() {
1066            this._public('Toggle');
1067          }
1068
1069          /**
1070           * @method toggleListen
1071           * @description Toggles the Share Button listener, good for updaing share
1072           * button for CSS animations.
1073           */
1074        }, {
1075          key: 'toggleListen',
1076          value: function toggleListen() {
1077            this._public('Listen');
1078          }
1079
1080          /**
1081           * @method _public
1082           * @description Executes action
1083           * @private
1084           *
1085           * @param {String} action
1086           */
1087        }, {
1088          key: '_public',
1089          value: function _public(action) {
1090            var instances = undefined;
1091
1092            if (typeof element === 'undefined') instances = _get(Object.getPrototypeOf(ShareButton.prototype), '_objToArray', this).call(this, document.getElementsByTagName('share-button'));else instances = document.querySelectorAll(element);
1093
1094            var _iteratorNormalCompletion = true;
1095            var _didIteratorError = false;
1096            var _iteratorError = undefined;
1097
1098            try {
1099              for (var _iterator = instances[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1100                var instance = _step.value;
1101
1102                var networks = instance.getElementsByClassName(this.config.ui.namespace + 'social')[0];
1103                this['_event' + action](instance, networks);
1104              }
1105            } catch (err) {
1106              _didIteratorError = true;
1107              _iteratorError = err;
1108            } finally {
1109              try {
1110                if (!_iteratorNormalCompletion && _iterator['return']) {
1111                  _iterator['return']();
1112                }
1113              } finally {
1114                if (_didIteratorError) {
1115                  throw _iteratorError;
1116                }
1117              }
1118            }
1119          }
1120
1121          /**
1122           * @method _setup
1123           * @description Sets up Share Button
1124           * @private
1125           *
1126           * @param {String} element selector
1127           * @param {Object} opts
1128           */
1129        }, {
1130          key: '_setup',
1131          value: function _setup(element, opts) {
1132            var instances = undefined;
1133
1134            if (typeof element === 'undefined') instances = _get(Object.getPrototypeOf(ShareButton.prototype), '_objToArray', this).call(this, document.getElementsByTagName('share-button'));else {
1135              instances = document.querySelectorAll('share-button' + element);
1136              if ((typeof instances === "undefined" ? "undefined" : _typeof(instances)) === 'object') instances = _get(Object.getPrototypeOf(ShareButton.prototype), '_objToArray', this).call(this, instances);
1137            }
1138
1139            // Adding user configs to default configs
1140            this._merge(this.config, opts);
1141
1142            // Disable whatsapp display if not a mobile device
1143            if (this.config.networks.whatsapp.enabled && !this._isMobile()) this.config.networks.whatsapp.enabled = false;
1144
1145            // Default order of networks if no network order entered
1146            if (this.config.ui.networkOrder.length === 0) this.config.ui.networkOrder = ['pinterest', 'twitter', 'facebook', 'whatsapp', 'googlePlus', 'reddit', 'linkedin', 'email'];
1147
1148            var _iteratorNormalCompletion2 = true;
1149            var _didIteratorError2 = false;
1150            var _iteratorError2 = undefined;
1151
1152            try {
1153              for (var _iterator2 = Object.keys(this.config.networks)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
1154                var network = _step2.value;
1155
1156                if (this.config.ui.networkOrder.indexOf(network.toString()) < 0) {
1157                  this.config.networks[network].enabled = false;
1158                  this.config.ui.networkOrder.push(network);
1159                }
1160              }
1161            } catch (err) {
1162              _didIteratorError2 = true;
1163              _iteratorError2 = err;
1164            } finally {
1165              try {
1166                if (!_iteratorNormalCompletion2 && _iterator2['return']) {
1167                  _iterator2['return']();
1168                }
1169              } finally {
1170                if (_didIteratorError2) {
1171                  throw _iteratorError2;
1172                }
1173              }
1174            }
1175
1176            this._fixFlyout();
1177            this._detectNetworks();
1178            this._normalizeNetworkConfiguration();
1179
1180            // Inject Facebook JS SDK (if Facebook is enabled)
1181            if (this.config.networks.facebook.enabled && this.config.networks.facebook.loadSdk) this._injectFacebookSdk();
1182
1183            // Initialize instances
1184            var index = 0;
1185            var _iteratorNormalCompletion3 = true;
1186            var _didIteratorError3 = false;
1187            var _iteratorError3 = undefined;
1188
1189            try {
1190              for (var _iterator3 = instances[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
1191                var instance = _step3.value;
1192
1193                this._setupInstance(instance, index++);
1194              }
1195            } catch (err) {
1196              _didIteratorError3 = true;
1197              _iteratorError3 = err;
1198            } finally {
1199              try {
1200                if (!_iteratorNormalCompletion3 && _iterator3['return']) {
1201                  _iterator3['return']();
1202                }
1203              } finally {
1204                if (_didIteratorError3) {
1205                  throw _iteratorError3;
1206                }
1207              }
1208            }
1209          }
1210
1211          /**
1212           * @method _setupInstance
1213           * @description Sets up each instance with config and styles
1214           * @private
1215           *
1216           * @param {DOMNode} element
1217           * @param {Integer} index
1218           */
1219        }, {
1220          key: '_setupInstance',
1221          value: function _setupInstance(instance, index) {
1222            var _this = this;
1223
1224            this._hide(instance);
1225
1226            // Add necessary classes to instance
1227            // (Note: FF doesn't support adding multiple classes in a single call)
1228            this._addClass(instance, 'sharer-' + index);
1229            this._injectHtml(instance);
1230            this._show(instance);
1231
1232            var networksCon = instance.getElementsByClassName(this.config.ui.namespace + 'social')[0];
1233            var networks = instance.getElementsByTagName('li');
1234
1235            this._addClass(networksCon, 'networks-' + this.config.enabledNetworks);
1236            instance.addEventListener('click', function () {
1237              return _this._eventToggle(instance, networksCon);
1238            });
1239
1240            // Add listener to activate networks and close button
1241
1242            var _loop = function _loop(k) {
1243              var network = networks[k];
1244
1245              if (typeof network !== "undefined") {
1246                (function () {
1247                  var name = network.getAttribute('data-network');
1248                  var a = network.getElementsByTagName('a')[0];
1249
1250                  _this._addClass(network, _this.config.networks[name]['class']);
1251
1252                  if (!network.classList.contains('email')) a.setAttribute('onclick', 'return false');
1253
1254                  a.addEventListener('mousedown', function () {
1255                    _this._hook('before', name, instance);
1256                  });
1257                  a.addEventListener('mouseup', function () {
1258                    _this['_network' + name.capFLetter()](network);
1259                  });
1260                  a.addEventListener('click', function () {
1261                    _this._hook('after', name, instance);
1262                  });
1263                })();
1264              }
1265            };
1266
1267            for (var k in Object.keys(networks)) {
1268              _loop(k);
1269            }
1270          }
1271
1272          /**
1273           * @method _eventToggle
1274           * @description Toggles 'active' class on button
1275           * @private
1276           *
1277           * @param {DOMNode} button
1278           * @param {DOMNode} networks
1279           */
1280        }, {
1281          key: '_eventToggle',
1282          value: function _eventToggle(button, networks) {
1283            if (this._hasClass(networks, 'active')) this._eventClose(networks);else this._eventOpen(button, networks);
1284          }
1285
1286          /**
1287           * @method _eventOpen
1288           * @description Add 'active' class & remove 'load' class on button
1289           * @private
1290           *
1291           * @param {DOMNode} button
1292           * @param {DOMNode} networks
1293           */
1294        }, {
1295          key: '_eventOpen',
1296          value: function _eventOpen(button, networks) {
1297            if (this._hasClass(networks, 'load')) this._removeClass(networks, 'load');
1298            if (this.collision) this._collisionDetection(button, networks);
1299
1300            this._addClass(networks, 'active');
1301          }
1302
1303          /**
1304           * @method _eventClose
1305           * @description Remove 'active' class on button
1306           * @private
1307           *
1308           * @param {DOMNode} button
1309           */
1310        }, {
1311          key: '_eventClose',
1312          value: function _eventClose(button) {
1313            this._removeClass(button, 'active');
1314          }
1315
1316          /**
1317           * @method _eventListen
1318           * @description Toggles weather or not a button's classes are being
1319           * constantly updated regardless of scrolls or window resizes.
1320           * @private
1321           *
1322           * @param {DOMNode} button
1323           * @param {DOMNode} networks
1324           */
1325        }, {
1326          key: '_eventListen',
1327          value: function _eventListen(button, networks) {
1328            var _this2 = this;
1329
1330            var dimensions = this._getDimensions(button, networks);
1331            if (this.listener === null) this.listener = window.setInterval(function () {
1332              return _this2._adjustClasses(button, networks, dimensions);
1333            }, 100);else {
1334              window.clearInterval(this.listener);
1335              this.listener = null;
1336            }
1337          }
1338
1339          /**
1340           * @method _fixFlyout
1341           * @description Fixes the flyout entered by the user to match their provided
1342           * namespace
1343           *@private
1344           */
1345        }, {
1346          key: '_fixFlyout',
1347          value: function _fixFlyout() {
1348            var flyouts = this.config.ui.flyout.split(' ');
1349            if (flyouts[0].substring(0, this.config.ui.namespace.length) !== this.config.ui.namespace) flyouts[0] = '' + this.config.ui.namespace + flyouts[0];
1350            if (flyouts[1].substring(0, this.config.ui.namespace.length) !== this.config.ui.namespace) flyouts[1] = '' + this.config.ui.namespace + flyouts[1];
1351            this.config.ui.flyout = flyouts.join(' ');
1352          }
1353
1354          /**
1355           * @method _collisionDetection
1356           * @description Adds listeners the first time a button is clicked to call
1357           * this._adjustClasses during scrolls and resizes.
1358           * @private
1359           *
1360           * @param {DOMNode} button - share button
1361           * @param {DOMNode} networks - list of social networks
1362           */
1363        }, {
1364          key: '_collisionDetection',
1365          value: function _collisionDetection(button, networks) {
1366            var _this3 = this;
1367
1368            var dimensions = this._getDimensions(button, networks);
1369            this._adjustClasses(button, networks, dimensions);
1370
1371            if (!button.classList.contains('clicked')) {
1372              window.addEventListener('scroll', function () {
1373                return _this3._adjustClasses(button, dimensions);
1374              });
1375              window.addEventListener('resize', function () {
1376                return _this3._adjustClasses(button, dimensions);
1377              });
1378              button.classList.add('clicked');
1379            }
1380          }
1381
1382          /**
1383           * @method _getDimensions
1384           * @description Returns an object with the dimensions of the button and
1385           * label elements of a Share Button.
1386           * @private
1387           *
1388           * @param {DOMNode} button
1389           * @param {DOMNode} networks
1390           * @returns {Object}
1391           */
1392        }, {
1393          key: '_getDimensions',
1394          value: function _getDimensions(button, networks) {
1395            return {
1396              networksWidth: networks.offsetWidth,
1397              buttonHeight: button.offsetHeight,
1398              buttonWidth: button.offsetWidth
1399            };
1400          }
1401
1402          /**
1403           * @method _adjustClasses
1404           * @description Adjusts the positioning of the list of social networks based
1405           * off of where the share button is relative to the window.
1406           *
1407           * @private
1408           * @param {DOMNode} button
1409           * @param {DOMNode} label
1410           * @param {Object} dimensions
1411           */
1412        }, {
1413          key: '_adjustClasses',
1414          value: function _adjustClasses(button, networks, dimensions) {
1415            var windowWidth = window.innerWidth;
1416            var windowHeight = window.innerHeight;
1417            var leftOffset = button.getBoundingClientRect().left + dimensions.buttonWidth / 2;
1418            var rightOffset = windowWidth - leftOffset;
1419            var topOffset = button.getBoundingClientRect().top + dimensions.buttonHeight / 2;
1420            var position = this._findLocation(leftOffset, topOffset, windowWidth, windowHeight);
1421
1422            if (position[1] === "middle" && position[0] !== "center" && (position[0] === "left" && windowWidth <= leftOffset + 220 + dimensions.buttonWidth / 2 || position[0] === "right" && windowWidth <= rightOffset + 220 + dimensions.buttonWidth / 2)) {
1423              networks.classList.add(this.config.ui.namespace + 'top');
1424              networks.classList.remove(this.config.ui.namespace + 'middle');
1425              networks.classList.remove(this.config.ui.namespace + 'bottom');
1426            } else {
1427              switch (position[0]) {
1428                case "left":
1429                  networks.classList.add(this.config.ui.namespace + 'right');
1430                  networks.classList.remove(this.config.ui.namespace + 'center');
1431                  networks.classList.remove(this.config.ui.namespace + 'left');
1432                  break;
1433                case "center":
1434                  if (position[1] !== "top") networks.classList.add(this.config.ui.namespace + 'top');
1435                  networks.classList.add(this.config.ui.namespace + 'center');
1436                  networks.classList.remove(this.config.ui.namespace + 'left');
1437                  networks.classList.remove(this.config.ui.namespace + 'right');
1438                  networks.classList.remove(this.config.ui.namespace + 'middle');
1439                  break;
1440                case "right":
1441                  networks.classList.add(this.config.ui.namespace + 'left');
1442                  networks.classList.remove(this.config.ui.namespace + 'center');
1443                  networks.classList.remove(this.config.ui.namespace + 'right');
1444                  break;
1445              }
1446              switch (position[1]) {
1447                case "top":
1448                  networks.classList.add(this.config.ui.namespace + 'bottom');
1449                  networks.classList.remove(this.config.ui.namespace + 'middle');
1450                  if (position[0] !== "center") networks.classList.remove(this.config.ui.namespace + 'top');
1451                  break;
1452                case "middle":
1453                  if (position[0] !== "center") {
1454                    networks.classList.add(this.config.ui.namespace + 'middle');
1455                    networks.classList.remove(this.config.ui.namespace + 'top');
1456                  }
1457                  networks.classList.remove(this.config.ui.namespace + 'bottom');
1458                  break;
1459                case "bottom":
1460                  networks.classList.add(this.config.ui.namespace + 'top');
1461                  networks.classList.remove(this.config.ui.namespace + 'middle');
1462                  networks.classList.remove(this.config.ui.namespace + 'bottom');
1463                  break;
1464              }
1465            }
1466          }
1467
1468          /**
1469           * @method _findLocation
1470           * @description Finds the location of the label given by its x and y value
1471           * with respect to the window width and window height given.
1472           * @private
1473           *
1474           * @param {number} labelX
1475           * @param {number} labelY
1476           * @param {number} windowWidth
1477           * @param {number} windowHeight
1478           * @returns {Array}
1479           */
1480        }, {
1481          key: '_findLocation',
1482          value: function _findLocation(labelX, labelY, windowWidth, windowHeight) {
1483            var xPosition = ["left", "center", "right"];
1484            var yPosition = ["top", "middle", "bottom"];
1485            var xLocation = Math.trunc(3 * (1 - (windowWidth - labelX) / windowWidth));
1486            var yLocation = Math.trunc(3 * (1 - (windowHeight - labelY) / windowHeight));
1487            if (xLocation >= 3) xLocation = 2;else if (xLocation <= -1) xLocation = 0;
1488            if (yLocation >= 3) yLocation = 2;else if (yLocation <= -1) yLocation = 0;
1489            return [xPosition[xLocation], yPosition[yLocation]];
1490          }
1491
1492          /**
1493           * @method _networkFacebook
1494           * @description Create & display a Facebook window
1495           * @private
1496           */
1497        }, {
1498          key: '_networkFacebook',
1499          value: function _networkFacebook(element) {
1500            if (this.config.networks.facebook.loadSdk) {
1501              if (!window.FB) return console.error('The Facebook JS SDK hasn\'t loaded yet.');
1502              this._updateHref(element, 'https://www.facebook.com/sharer/sharer.php', {
1503                u: this.config.networks.facebook.url
1504              });
1505              return FB.ui({
1506                method: 'feed',
1507                name: this.config.networks.facebook.title,
1508                link: this.config.networks.facebook.url,
1509                picture: this.config.networks.facebook.image,
1510                caption: this.config.networks.facebook.caption,
1511                description: this.config.networks.facebook.description
1512              });
1513            } else return this._updateHref(element, 'https://www.facebook.com/sharer/sharer.php', {
1514              u: this.config.networks.facebook.url
1515            });
1516          }
1517
1518          /**
1519           * @method _networkTwitter
1520           * @description Create & display a Twitter window
1521           * @private
1522           */
1523        }, {
1524          key: '_networkTwitter',
1525          value: function _networkTwitter(element) {
1526            this._updateHref(element, 'https://twitter.com/intent/tweet', {
1527              text: this.config.networks.twitter.description,
1528              url: this.config.networks.twitter.url
1529            });
1530          }
1531
1532          /**
1533           * @method _networkGooglePlus
1534           * @description Create & display a Google Plus window
1535           * @private
1536           */
1537        }, {
1538          key: '_networkGooglePlus',
1539          value: function _networkGooglePlus(element) {
1540            this._updateHref(element, 'https://plus.google.com/share', {
1541              url: this.config.networks.googlePlus.url
1542            });
1543          }
1544
1545          /**
1546           * @method _networkPinterest
1547           * @description Create & display a Pinterest window
1548           * @private
1549           */
1550        }, {
1551          key: '_networkPinterest',
1552          value: function _networkPinterest(element) {
1553            this._updateHref(element, 'https://www.pinterest.com/pin/create/button', {
1554              url: this.config.networks.pinterest.url,
1555              media: this.config.networks.pinterest.image,
1556              description: this.config.networks.pinterest.description
1557            });
1558          }
1559
1560          /**
1561           * @method _networkLinkedIn
1562           * @description Create & display a Linkedin window
1563           * @private
1564           */
1565        }, {
1566          key: '_networkLinkedin',
1567          value: function _networkLinkedin(element) {
1568            this._updateHref(element, 'https://www.linkedin.com/shareArticle', {
1569              mini: 'true',
1570              url: this.config.networks.linkedin.url,
1571              title: this.config.networks.linkedin.title,
1572              summary: this.config.networks.linkedin.description
1573            });
1574          }
1575
1576          /**
1577           * @method _networkEmail
1578           * @description Create & display an Email window
1579           * @private
1580           */
1581        }, {
1582          key: '_networkEmail',
1583          value: function _networkEmail(element) {
1584            this._updateHref(element, 'mailto:', {
1585              subject: this.config.networks.email.title,
1586              body: this.config.networks.email.description
1587            });
1588          }
1589
1590          /**
1591           * @method _networkReddit
1592           * @description Create & display a Reddit window
1593           * @private
1594           */
1595        }, {
1596          key: '_networkReddit',
1597          value: function _networkReddit(element) {
1598            this._updateHref(element, 'http://www.reddit.com/submit', {
1599              url: this.config.networks.reddit.url,
1600              title: this.config.networks.reddit.title
1601            });
1602          }
1603
1604          /**
1605           * @method _networkWhatsapp
1606           * @description Create & display a Whatsapp window
1607           * @private
1608           */
1609        }, {
1610          key: '_networkWhatsapp',
1611          value: function _networkWhatsapp(element) {
1612            this._updateHref(element, 'whatsapp://send', {
1613              text: this.config.networks.whatsapp.description + " " + this.config.networks.whatsapp.url
1614            });
1615          }
1616
1617          /**
1618           * @method _injectStylesheet
1619           * @description Inject link to stylesheet
1620           * @private
1621           *
1622           * @param {String} url
1623           */
1624        }, {
1625          key: '_injectStylesheet',
1626          value: function _injectStylesheet(url) {
1627            if (!this.el.head.querySelector('link[href=\'' + url + '\']')) {
1628              var link = document.createElement("link");
1629              link.setAttribute("rel", "stylesheet");
1630              link.setAttribute("href", url);
1631              this.el.head.appendChild(link);
1632            }
1633          }
1634
1635          /**
1636           * @method _injectHtml
1637           * @description Inject button structure
1638           * @private
1639           *
1640           * @param {DOMNode} instance
1641           */
1642        }, {
1643          key: '_injectHtml',
1644          value: function _injectHtml(instance) {
1645            var networks = this.config.ui.networkOrder;
1646            var networkList = '';
1647
1648            var _iteratorNormalCompletion4 = true;
1649            var _didIteratorError4 = false;
1650            var _iteratorError4 = undefined;
1651
1652            try {
1653              for (var _iterator4 = networks[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
1654                var network = _step4.value;
1655                var blogHeading = document.querySelector('.blog-heading');
1656
1657                var titleText = blogHeading && blogHeading.textContent || '';
1658                var sanitizedTitle = titleText.replace(/[^a-zA-Z0-9\s]/g, '').trim();
1659                if (blogHeading) {
1660                  networkList += "<li class='" + network + "' data-network='" + network + "'><a data-event=\"article_share_click\" data-title=\"" + sanitizedTitle + "\"></a></li>";
1661                } else {
1662                  networkList += '<li class=\'' + network + '\' data-network=\'' + network + '\'><a></a></li>';
1663                }
1664              }
1665            } catch (err) {
1666              _didIteratorError4 = true;
1667              _iteratorError4 = err;
1668            } finally {
1669              try {
1670                if (!_iteratorNormalCompletion4 && _iterator4['return']) {
1671                  _iterator4['return']();
1672                }
1673              } finally {
1674                if (_didIteratorError4) {
1675                  throw _iteratorError4;
1676                }
1677              }
1678            }
1679
1680            instance.innerHTML = this.config.ui.buttonText + '<div class=\'' + this.config.ui.namespace + 'social load ' + this.config.ui.flyout + '\'><ul>' + networkList + '</ul></div>';
1681          }
1682
1683          /**
1684           * @method _injectFacebookSdk
1685           * @description Inject Facebook SDK
1686           * @private
1687           */
1688        }, {
1689          key: '_injectFacebookSdk',
1690          value: function _injectFacebookSdk() {
1691            if (!window.FB && this.config.networks.facebook.appId && !this.el.body.querySelector('#fb-root')) {
1692              var script = document.createElement('script');
1693              script.text = 'window.fbAsyncInit=function(){FB.init({appId:\'' + this.config.networks.facebook.appId + '\',status:true,xfbml:true})};(function(e,t,n){var r,i=e.getElementsByTagName(t)[0];if (e.getElementById(n)){return}r=e.createElement(t);r.id=n;r.src=\'//connect.facebook.net/en_US/all.js\';i.parentNode.insertBefore(r,i)})(document,\'script\',\'facebook-jssdk\');';
1694
1695              var fbRoot = document.createElement('div');
1696              fbRoot.id = 'fb-root';
1697
1698              this.el.body.appendChild(fbRoot);
1699              this.el.body.appendChild(script);
1700            }
1701          }
1702
1703          /**
1704           * @method _hook
1705           * @description Hook helper function
1706           * @private
1707           *
1708           * @param {String}   type
1709           * @param {String}   network
1710           * @param {DOMNode}  instance
1711           */
1712        }, {
1713          key: '_hook',
1714          value: function _hook(type, network, instance) {
1715            var fn = this.config.networks[network][type];
1716
1717            if (typeof fn === 'function') {
1718              var opts = fn.call(this.config.networks[network], instance);
1719
1720              if (opts !== undefined) {
1721                opts = this._normalizeFilterConfigUpdates(opts);
1722                this.extend(this.config.networks[network], opts, true);
1723                this._normalizeNetworkConfiguration();
1724              }
1725            }
1726          }
1727
1728          /**
1729           * @method _defaultTitle
1730           * @description Gets default title
1731           * @private
1732           *
1733           * @returns {String}
1734           */
1735        }, {
1736          key: '_defaultTitle',
1737          value: function _defaultTitle() {
1738            var content = undefined;
1739            if (content = document.querySelector('meta[property="og:title"]') || document.querySelector('meta[name="twitter:title"]')) return content.getAttribute('content');else if (content = document.querySelector('title')) return content.textContent || content.innerText;
1740          }
1741
1742          /**
1743           * @method _defaultImage
1744           * @description Gets default image
1745           * @private
1746           *
1747           * @returns {String}
1748           */
1749        }, {
1750          key: '_defaultImage',
1751          value: function _defaultImage() {
1752            var content = undefined;
1753            if (content = document.querySelector('meta[property="og:image"]') || document.querySelector('meta[name="twitter:image"]')) return content.getAttribute('content');
1754          }
1755
1756          /**
1757           * @method _defaultDescription
1758           * @description Gets default description
1759           * @private
1760           *
1761           * @returns {String}
1762           */
1763        }, {
1764          key: '_defaultDescription',
1765          value: function _defaultDescription() {
1766            var content = undefined;
1767            if (content = document.querySelector('meta[property="og:description"]') || document.querySelector('meta[name="twitter:description"]') || document.querySelector('meta[name="description"]')) return content.getAttribute('content');else return '';
1768          }
1769
1770          /**
1771           * @method _detectNetworks
1772           * @description Detect number of networks in use and display/hide
1773           * @private
1774           */
1775        }, {
1776          key: '_detectNetworks',
1777          value: function _detectNetworks() {
1778            // Update network-specific configuration with global configurations
1779            var _iteratorNormalCompletion5 = true;
1780            var _didIteratorError5 = false;
1781            var _iteratorError5 = undefined;
1782
1783            try {
1784              for (var _iterator5 = Object.keys(this.config.networks)[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
1785                var network = _step5.value;
1786
1787                var display = undefined;
1788                var _iteratorNormalCompletion6 = true;
1789                var _didIteratorError6 = false;
1790                var _iteratorError6 = undefined;
1791
1792                try {
1793                  for (var _iterator6 = Object.keys(this.config.networks[network])[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
1794                    var option = _step6.value;
1795
1796                    if (this.config.networks[network][option] === null) {
1797                      this.config.networks[network][option] = this.config[option];
1798                    }
1799                  }
1800
1801                  // Check for enabled networks and display them
1802                } catch (err) {
1803                  _didIteratorError6 = true;
1804                  _iteratorError6 = err;
1805                } finally {
1806                  try {
1807                    if (!_iteratorNormalCompletion6 && _iterator6['return']) {
1808                      _iterator6['return']();
1809                    }
1810                  } finally {
1811                    if (_didIteratorError6) {
1812                      throw _iteratorError6;
1813                    }
1814                  }
1815                }
1816
1817                if (this.config.networks[network].enabled) {
1818                  this['class'] = 'enabled';
1819                  this.config.enabledNetworks += 1;
1820                } else this['class'] = 'disabled';
1821
1822                this.config.networks[network]['class'] = this['class'];
1823              }
1824            } catch (err) {
1825              _didIteratorError5 = true;
1826              _iteratorError5 = err;
1827            } finally {
1828              try {
1829                if (!_iteratorNormalCompletion5 && _iterator5['return']) {
1830                  _iterator5['return']();
1831                }
1832              } finally {
1833                if (_didIteratorError5) {
1834                  throw _iteratorError5;
1835                }
1836              }
1837            }
1838          }
1839
1840          /**
1841           * @method _normalizeNetworkConfiguration
1842           * @description Normalizes network configuration for Facebook & Twitter
1843           * @private
1844           */
1845        }, {
1846          key: '_normalizeNetworkConfiguration',
1847          value: function _normalizeNetworkConfiguration() {
1848            // Don't load FB SDK if FB appId isn't present
1849            if (!this.config.networks.facebook.appId) this.config.networks.facebook.loadSdk = false;
1850
1851            // Encode Twitter description for URL
1852            if (!!this.config.networks.twitter.description) if (!this._isEncoded(this.config.networks.twitter.description)) this.config.networks.twitter.description = encodeURIComponent(this.config.networks.twitter.description);
1853
1854            // Typecast Facebook appId to a String
1855            if (typeof this.config.networks.facebook.appId === 'number') this.config.networks.facebook.appId = this.config.networks.facebook.appId.toString();
1856          }
1857
1858          /**
1859           * @method _normalizeFilterConfigUpdates
1860           * @description Normalizes Facebook config
1861           * @private
1862           *
1863           * @param {Object} opts
1864           * @returns {Object}
1865           */
1866        }, {
1867          key: '_normalizeFilterConfigUpdates',
1868          value: function _normalizeFilterConfigUpdates(opts) {
1869            if (this.config.networks.facebook.appId !== opts.appId) {
1870              console.warn('You are unable to change the Facebook appId after the button has been initialized. Please update your Facebook filters accordingly.');
1871              delete opts.appId;
1872            }
1873
1874            if (this.config.networks.facebook.loadSdk !== opts.loadSdk) {
1875              console.warn('You are unable to change the Facebook loadSdk option after the button has been initialized. Please update your Facebook filters accordingly.');
1876              delete opts.appId;
1877            }
1878
1879            return opts;
1880          }
1881        }]);
1882
1883        return ShareButton;
1884      }(_shareUtils2['default']);
1885
1886      module.exports = ShareButton;
1887    }, { "./share-utils": 38, "core-js/fn/array/iterator": 1, "core-js/fn/math/trunc": 2, "core-js/fn/symbol": 3 }], 38: [function (_dereq_, module, exports) {
1888      /**
1889       * ShareUtils
1890       * @class
1891       * @classdesc A nice set of utilities.
1892       */
1893      "use strict";
1894
1895      Object.defineProperty(exports, "__esModule", {
1896        value: true
1897      });
1898
1899      var _createClass = function () {
1900        function defineProperties(target, props) {
1901          for (var i = 0; i < props.length; i++) {
1902            var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
1903          }
1904        }return function (Constructor, protoProps, staticProps) {
1905          if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
1906        };
1907      }();
1908
1909      function _classCallCheck(instance, Constructor) {
1910        if (!(instance instanceof Constructor)) {
1911          throw new TypeError("Cannot call a class as a function");
1912        }
1913      }
1914
1915      var ShareUtils = function () {
1916        function ShareUtils() {
1917          _classCallCheck(this, ShareUtils);
1918        }
1919
1920        /**
1921         * @method toRFC3986
1922         * @description Encodes the string in RFC3986
1923         * @memberof String
1924         *
1925         * @return {String}
1926         */
1927
1928        _createClass(ShareUtils, [{
1929          key: "_getStyle",
1930          value: function _getStyle(ele, css) {
1931            var strValue = "";
1932
1933            if (document.defaultView && document.defaultView.getComputedStyle) {
1934              strValue = document.defaultView.getComputedStyle(ele, "").getPropertyValue(css);
1935            } else if (ele.currentStyle) {
1936              css = css.replace(/\-(\w)/g, function (strMatch, p1) {
1937                return p1.toUpperCase();
1938              });
1939              strValue = ele.currentStyle[css];
1940            }
1941
1942            return strValue;
1943          }
1944
1945          /**
1946           * @method _hide
1947           * @description Change element's display to 'none'
1948           * @private
1949           *
1950           * @param {DOMNode} el
1951           */
1952        }, {
1953          key: "_hide",
1954          value: function _hide(el) {
1955            el.style.display = "none";
1956          }
1957
1958          /**
1959           * @method _show
1960           * @description Change element's display to 'block'
1961           * @private
1962           *
1963           * @param {DOMNode} el
1964           */
1965        }, {
1966          key: "_show",
1967          value: function _show(el) {
1968            el.style.display = "initial";
1969          }
1970
1971          /**
1972           * @method _hasClass
1973           * @description Wrapper to see if an element contains a class.
1974           * @private
1975           *
1976           * @param {DOMNode} el
1977           * @param {String}  className
1978           * @returns {Boolean}
1979           */
1980        }, {
1981          key: "_hasClass",
1982          value: function _hasClass(el, className) {
1983            return el.classList.contains(className);
1984          }
1985
1986          /**
1987           * @method addClass
1988           * @description Wrapper to add class to element.
1989           * @private
1990           *
1991           * @param {DOMNode} el
1992           * @param {String}  className
1993           */
1994        }, {
1995          key: "_addClass",
1996          value: function _addClass(el, className) {
1997            el.classList.add(className);
1998          }
1999
2000          /**
2001           * @method removeClass
2002           * @description Wrapper to remove class from element.
2003           * @private
2004           *
2005           * @param {DOMNode} el
2006           * @param {String}  className
2007           */
2008        }, {
2009          key: "_removeClass",
2010          value: function _removeClass(el, className) {
2011            el.classList.remove(className);
2012          }
2013
2014          /**
2015           * @method _isEncoded
2016           * @description Wrapper to check if the string is encoded.
2017           * @private
2018           *
2019           * @param {String}  str
2020           * @param {Boolean}
2021           */
2022        }, {
2023          key: "_isEncoded",
2024          value: function _isEncoded(str) {
2025            str = str.toRFC3986();
2026            return decodeURIComponent(str) !== str;
2027          }
2028
2029          /**
2030           * @method _encode
2031           * @description Wrapper to _encode a string if the string isn't already encoded.
2032           * @private
2033           *
2034           * @param {DOMNode} el
2035           * @param {String}  className
2036           */
2037        }, {
2038          key: "_encode",
2039          value: function _encode(str) {
2040            if (typeof str === 'undefined' || str === null || this._isEncoded(str)) return encodeURIComponent(str);else return str.toRFC3986();
2041          }
2042
2043          /**
2044           * @method _getUrl
2045           * @description Returns the correct share URL based off of the incoming
2046           * URL and parameters given
2047           * @private
2048           *
2049           * @param {String} url
2050           * @param {boolean} encode
2051           * @param {Object} params
2052           */
2053        }, {
2054          key: "_getUrl",
2055          value: function _getUrl(url) {
2056            var _this = this;
2057
2058            var encode = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
2059            var params = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
2060
2061            var qs = function () {
2062              var results = [];
2063              var _iteratorNormalCompletion = true;
2064              var _didIteratorError = false;
2065              var _iteratorError = undefined;
2066
2067              try {
2068                for (var _iterator = Object.keys(params)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2069                  var k = _step.value;
2070
2071                  var v = params[k];
2072                  results.push(k + "=" + _this._encode(v));
2073                }
2074              } catch (err) {
2075                _didIteratorError = true;
2076                _iteratorError = err;
2077              } finally {
2078                try {
2079                  if (!_iteratorNormalCompletion && _iterator["return"]) {
2080                    _iterator["return"]();
2081                  }
2082                } finally {
2083                  if (_didIteratorError) {
2084                    throw _iteratorError;
2085                  }
2086                }
2087              }
2088
2089              return results.join('&');
2090            }();
2091
2092            if (qs) qs = "?" + qs;
2093
2094            return url + qs;
2095          }
2096
2097          /**
2098           * @method _updateHref
2099           * @description Makes the elements a tag have a href of the popup link and
2100           * as pops up the share window for the element
2101           * @private
2102           *
2103           * @param {DOMNode} element
2104           * @param {String} url
2105           * @param {Object} params
2106           */
2107        }, {
2108          key: "_updateHref",
2109          value: function _updateHref(element, url, params) {
2110            var encode = url.indexOf('mailto:') >= 0;
2111            var a = element.getElementsByTagName('a')[0];
2112            a.setAttribute('href', this._getUrl(url, !encode, params));
2113            if (!encode && (!this.config.networks.facebook.loadSdk || element.getAttribute('class') !== 'facebook')) {
2114              var popup = {
2115                width: 500,
2116                height: 350
2117              };
2118
2119              popup.top = screen.height / 2 - popup.height / 2;
2120              popup.left = screen.width / 2 - popup.width / 2;
2121
2122              window.open(a.href, 'targetWindow', "\n          toolbar=no,\n          location=no,\n          status=no,\n          menubar=no,\n          scrollbars=yes,\n          resizable=yes,\n          left=" + popup.left + ",\n          top=" + popup.top + ",\n          width=" + popup.width + ",\n          height=" + popup.height + "\n        ");
2123            }
2124          }
2125
2126          /**
2127           * @method popup
2128           * @description Create a window for specified network
2129           *
2130           * @param {String}  url
2131           * @param {Object}  params
2132           */
2133        }, {
2134          key: "popup",
2135          value: function popup(url) {
2136            var _this2 = this;
2137
2138            var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
2139
2140            var popup = {
2141              width: 500,
2142              height: 350
2143            };
2144
2145            popup.top = screen.height / 2 - popup.height / 2;
2146            popup.left = screen.width / 2 - popup.width / 2;
2147
2148            var qs = function () {
2149              var results = [];
2150              var _iteratorNormalCompletion2 = true;
2151              var _didIteratorError2 = false;
2152              var _iteratorError2 = undefined;
2153
2154              try {
2155                for (var _iterator2 = Object.keys(params)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
2156                  var k = _step2.value;
2157
2158                  var v = params[k];
2159                  results.push(k + "=" + _this2._encode(v));
2160                }
2161              } catch (err) {
2162                _didIteratorError2 = true;
2163                _iteratorError2 = err;
2164              } finally {
2165                try {
2166                  if (!_iteratorNormalCompletion2 && _iterator2["return"]) {
2167                    _iterator2["return"]();
2168                  }
2169                } finally {
2170                  if (_didIteratorError2) {
2171                    throw _iteratorError2;
2172                  }
2173                }
2174              }
2175
2176              return results.join('&');
2177            }();
2178
2179            if (qs) qs = "?" + qs;
2180
2181            // This does work even though it contains \n once converted.
2182            window.open(url + qs, 'targetWindow', "\n        toolbar=no,\n        location=no,\n        status=no,\n        menubar=no,\n        scrollbars=yes,\n        resizable=yes,\n        left=" + popup.left + ",\n        top=" + popup.top + ",\n        width=" + popup.width + ",\n        height=" + popup.height + "\n      ");
2183          }
2184
2185          /**
2186           * @method _merge
2187           * @description Combines two (or more) objects, giving the last one precedence
2188           * @author svlasov-gists
2189           * [Original Gist]{@link https://gist.github.com/svlasov-gists/2383751}
2190           *
2191           * @param {Object}  target
2192           * @param {Object}  source
2193           * @return {Object} target
2194           */
2195        }, {
2196          key: "_merge",
2197          value: function (_merge2) {
2198            function _merge(_x, _x2) {
2199              return _merge2.apply(this, arguments);
2200            }
2201
2202            _merge.toString = function () {
2203              return _merge2.toString();
2204            };
2205
2206            return _merge;
2207          }(function (target, source) {
2208            if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== 'object') target = {};
2209
2210            for (var property in source) {
2211              if (source.hasOwnProperty(property)) {
2212                var sourceProperty = source[property];
2213
2214                if ((typeof sourceProperty === "undefined" ? "undefined" : _typeof(sourceProperty)) === 'object') {
2215                  target[property] = this._merge(target[property], sourceProperty);
2216                  continue;
2217                }
2218
2219                target[property] = sourceProperty;
2220              }
2221            }
2222
2223            for (var a = 2, l = arguments.length; a < l; a++) {
2224              _merge(target, arguments[a]);
2225            }return target;
2226          })
2227
2228          /**
2229           * @method _objectToArray
2230           * @description Takes an Object and converts it into an array of Objects. This is used when converting a list of DOMNodes into an array.
2231           *
2232           * @param {Object} obj
2233           * @returns {Array} arr
2234           */
2235        }, {
2236          key: "_objToArray",
2237          value: function _objToArray(obj) {
2238            var arr = [];
2239
2240            for (var k in obj) {
2241              if (_typeof(obj[k]) === 'object') arr.push(obj[k]);
2242            }return arr;
2243          }
2244
2245          /**
2246           * @method _isMobile
2247           * @description Returns true if current device is mobile (or PhantomJS for
2248           * testing purposes), and false otherwise
2249           * @author kriskbx
2250           * [Original Gist] {@link https://github.com/kriskbx/whatsapp-sharing/blob/master/src/button.js}
2251           * @private
2252           */
2253        }, {
2254          key: "_isMobile",
2255          value: function _isMobile() {
2256            if (navigator.userAgent.match(/Android|iPhone|PhantomJS/i) && !navigator.userAgent.match(/iPod|iPad/i)) return true;
2257            return false;
2258          }
2259        }]);
2260
2261        return ShareUtils;
2262      }();
2263
2264      String.prototype.toRFC3986 = function () {
2265        var tmp = encodeURIComponent(this);
2266        tmp.replace(/[!'()*]/g, function (c) {
2267          return "%" + c.charCodeAt(0).toString(16);
2268        });
2269      };
2270
2271      /**
2272       * @method capFLetter
2273       * @description Does exactly what the method name states
2274       * @memberof String
2275       *
2276       * @return {String}
2277       */
2278      String.prototype.capFLetter = function () {
2279        return this.charAt(0).toUpperCase() + this.slice(1);
2280      };
2281
2282      exports["default"] = ShareUtils;
2283      module.exports = exports["default"];
2284    }, {}] }, {}, [37])(37);
2285});
2286
2287}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2288},{}],5:[function(require,module,exports){
2289'use strict';
2290
2291Object.defineProperty(exports, "__esModule", {
2292    value: true
2293});
2294exports.showFormLoader = showFormLoader;
2295exports.hideFormLoader = hideFormLoader;
2296function showFormLoader(form) {
2297    if (!form) return;
2298
2299    var submitButton = form.querySelector('.form__submit-button');
2300    if (!submitButton) return;
2301
2302    var buttonValue = submitButton.querySelector('.submit-button__value');
2303    var spinner = submitButton.querySelector('.submit-button__spinner');
2304
2305    if (!buttonValue || !spinner) return;
2306
2307    buttonValue.classList.add('is-hidden');
2308    spinner.classList.remove('is-hidden');
2309    submitButton.disabled = true;
2310}
2311
2312function hideFormLoader(form) {
2313    if (!form) return;
2314
2315    var submitButton = form.querySelector('.form__submit-button');
2316    if (!submitButton) return;
2317
2318    var buttonValue = submitButton.querySelector('.submit-button__value');
2319    var spinner = submitButton.querySelector('.submit-button__spinner');
2320
2321    if (!buttonValue || !spinner) return;
2322
2323    buttonValue.classList.remove('is-hidden');
2324    spinner.classList.add('is-hidden');
2325    submitButton.disabled = false;
2326}
2327
2328},{}],6:[function(require,module,exports){
2329"use strict";
2330
2331Object.defineProperty(exports, "__esModule", {
2332  value: true
2333});
2334exports.updateUIafterTogglingLists = updateUIafterTogglingLists;
2335exports.validateFormFields = validateFormFields;
2336
2337var _deepProfanityFilter = require("deep-profanity-filter");
2338
2339var badwords = ["*fuck*", "*cunt*", "*nigger*", "*nigga*", "*nazi*", "ahole", "anus", "ash0le", "ash0les", "asholes", "ass", "Ass Monkey", "Assface", "assh0le", "assh0lez", "asshole", "assholes", "assholz", "asswipe", "azzhole", "bassterds", "bastard", "bastards", "bastardz", "basterds", "basterdz", "Blow Job", "boffing", "butthole", "buttwipe", "c0ck", "c0cks", "c0k", "Carpet Muncher", "cawk", "cawks", "cnts", "cntz", "cockhead", "cock-head", "CockSucker", "cock-sucker", "crap", "cum", "cunt", "cunts", "cuntz", "dominatricks", "dominatrics", "dominatrix", "dyke", "enema", "f u c k", "f u c k e r", "fag", "fag1t", "faget", "fagg1t", "faggit", "faggot", "fagit", "fags", "fagz", "faig", "faigs", "fart", "flipping the bird", "fuck", "fucker", "fuckin", "fucking", "fucks", "Fudge Packer", "fuk", "Fukah", "Fuken", "fuker", "Fukin", "Fukk", "Fukkah", "Fukken", "Fukker", "Fukkin", "g00k", "gay", "gayboy", "gaygirl", "gays", "gayz", "God-damned", "h00r", "h0ar", "h0re", "hells", "hoar", "hoor", "hoore", "jackoff", "jap", "japs", "jerk-off", "jisim", "jiss", "jizm", "jizz", "knob", "knobs", "knobz", "kunt", "kunts", "kuntz", "masochist", "masokist", "massterbait", "masstrbait", "masstrbate", "masterbaiter", "masterbate", "masterbates", "Motha Fucker", "Motha Fuker", "Motha Fukkah", "Motha Fukker", "Mother Fucker", "Mother Fukah", "Mother Fuker", "Mother Fukkah", "Mother Fukker", "mother-fucker", "Mutha Fucker", "Mutha Fukah", "Mutha Fuker", "Mutha Fukkah", "Mutha Fukker", "n1gr", "nastt", "nigur", "niiger", "niigr", "orafis", "orgasim", "orgasm", "orgasum", "oriface", "orifice", "orifiss", "packi", "packie", "packy", "paki", "pakie", "paky", "Phuc", "Phuck", "Phuk", "Phuker", "Phukker", "polac", "polack", "polak", "Poonani", "pr1c", "pr1ck", "pr1k", "pussy", "retard", "sadist", "semen", "skanck", "skank", "skankee", "skankey", "skanks", "Skanky", "slag", "slut", "sluts", "Slutty", "slutz", "turd", "va1jina", "vag1na", "vagiina", "vagina", "vaj1na", "vajina", "vullva", "vulva", "w0p", "wh00r", "wh0re", "whore", "xrated", "blowjob", "clit", "arschloch", "fuck", "shit", "ass", "asshole", "b!tch", "b17ch", "b1tch", "bastard", "bi+ch", "boiolas", "buceta", "c0ck", "cawk", "chink", "cipa", "clits", "cock", "cum", "cunt", "dildo", "dirsa", "ejakulate", "fatass", "fcuk", "fuk", "fux0r", "hoer", "hore", "jism", "kawk", "masturbate", "masterbat*", "masterbat3", "motherfucker", "s.o.b.", "mofo", "phuck", "pimpis", "pusse", "pussy", "scrotum", "sh!t", "shemale", "shi+", "sh!+", "slut", "smut", "teets", "tits", "boobs", "b00bs", "teez", "testical", "testicle", "titt", "w00se", "jackoff", "wank", "whoar", "whore", "*damn", "*dyke", "*fuck*", "*shit*", "@$$", "amcik", "andskota", "arse*", "assrammer", "ayir", "bi7ch", "bitch*", "bollock*", "breasts", "butt-pirate", "cabron", "cazzo", "chraa", "chuj", "Cock*", "cunt*", "d4mn", "daygo", "dego", "dick*", "dike*", "dupa", "dziwka", "ejackulate", "Ekrem*", "Ekto", "enculer", "faen", "fag*", "fanculo", "fanny", "feces", "feg", "Felcher", "ficken", "fitt*", "Flikker", "foreskin", "Fotze", "Fu(*", "fuk*", "futkretzn", "gay", "gook", "guiena", "h0r", "h4x0r", "hell", "helvete", "hoer*", "honkey", "Huevon", "hui", "injun", "jizz", "kanker*", "kike", "klootzak", "kraut", "knulle", "kuk", "kuksuger", "Kurac", "kurwa", "kusi*", "kyrpa*", "mamhoon", "masturbat*", "merd*", "mibun", "monkleigh", "mouliewop", "muie", "mulkku", "muschi", "nepesaurio", "orospu", "paska*", "perse", "picka", "pierdol*", "pillu*", "pimmel", "piss*", "pizda", "poontsee", "poop", "porn", "p0rn", "pr0n", "preteen", "pula", "pule", "puta", "puto", "qahbeh", "queef*", "rautenberg", "schaffer", "scheiss*", "schlampe", "schmuck", "screw", "sh!t*", "sharmuta", "sharmute", "shipal", "shiz", "skribz", "skurwysyn", "sphencter", "spic", "spierdalaj", "splooge", "suka", "b00b*", "testicle*", "titt*", "twat", "vittu", "wank*", "wetback*", "wichser", "wop*", "yed", "zabourah"];
2340var whitelist = [];
2341
2342var WORD_FILTER_OPTIONS = {
2343  considerPrecedingApostrophes: false,
2344  considerFollowUpApostrophes: false
2345
2346  // Leading special characters force lookbehind regex in deep-profanity-filter,
2347  // which breaks on older Safari/WebKit builds used by some clients.
2348};var browserSafeBadwords = badwords.filter(function (word) {
2349  return !/^\W/.test(word) || word.startsWith('*');
2350});
2351
2352var wordFilter = null;
2353var fallbackBadwordPatterns = [];
2354
2355function escapeRegex(value) {
2356  return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2357}
2358
2359function buildFallbackBadwordPattern(word) {
2360  var hasWildcardAtStart = word.startsWith('*');
2361  var hasWildcardAtEnd = word.endsWith('*');
2362  var baseWord = word.replace(/^\*/, '').replace(/\*$/, '');
2363
2364  if (!baseWord) {
2365    return null;
2366  }
2367
2368  var normalizedPattern = escapeRegex(baseWord).replace(/\s+/g, '[\\W_]+');
2369  var prefix = hasWildcardAtStart ? '' : '\\b';
2370  var suffix = hasWildcardAtEnd ? '' : '\\b';
2371
2372  return new RegExp("" + prefix + normalizedPattern + suffix, 'i');
2373}
2374
2375try {
2376  wordFilter = (0, _deepProfanityFilter.preprocessWordLists)(browserSafeBadwords, whitelist, WORD_FILTER_OPTIONS);
2377} catch (error) {
2378  console.warn('Falling back to simplified profanity filter', error);
2379  fallbackBadwordPatterns = browserSafeBadwords.map(buildFallbackBadwordPattern).filter(Boolean);
2380}
2381
2382function containsBadWords(value) {
2383  if (wordFilter) {
2384    return (0, _deepProfanityFilter.doesContainBadWords)(value, wordFilter);
2385  }
2386
2387  return fallbackBadwordPatterns.some(function (pattern) {
2388    return pattern.test(value);
2389  });
2390}
2391
2392function updateUIafterTogglingLists(movieSlug) {
2393  var moviesCountElement = document.querySelector('.js-items-in-list');
2394
2395  if (!moviesCountElement) {
2396    console.warn('Movies count element not found');
2397    return;
2398  }
2399
2400  // Parse the movies count as an integer
2401  var moviesCount = parseInt(moviesCountElement.textContent, 10);
2402
2403  if (isNaN(moviesCount)) {
2404    console.error('Invalid number found in movies count');
2405    return;
2406  }
2407
2408  // If only one movie remains and is removed, reload the page to show the search bar
2409  if (moviesCount === 1) {
2410    window.location.reload();
2411    return;
2412  }
2413
2414  // Decrement the movie count and update the UI
2415  moviesCount -= 1;
2416  moviesCountElement.textContent = moviesCount;
2417
2418  // Remove the movie element from the DOM
2419  var movieToRemove = document.querySelector(".js-" + movieSlug);
2420  if (movieToRemove) {
2421    movieToRemove.remove();
2422  } else {
2423    console.warn("Movie with slug \"" + movieSlug + "\" not found in the DOM.");
2424  }
2425}
2426
2427function validateFormFields(formValues, listNameError, listDescriptionError) {
2428  var hasError = false;
2429  var normalizedName = (0, _deepProfanityFilter.textToLatin)(formValues["name"]);
2430  var normalizedDescription = (0, _deepProfanityFilter.textToLatin)(formValues["description"]);
2431
2432  // Validate name
2433  if (containsBadWords(normalizedName) || formValues["name"].length > 30 || formValues["name"].length > 30 || formValues["description"].length > 240) {
2434    if (listNameError) {
2435      listNameError.classList.remove('is-hidden');
2436    }
2437    hasError = true;
2438  }
2439
2440  // Validate description
2441  if (containsBadWords(normalizedDescription) || formValues["description"].length > 240) {
2442    if (listDescriptionError) {
2443      listDescriptionError.classList.remove('is-hidden');
2444    }
2445    hasError = true;
2446  }
2447
2448  return hasError;
2449}
2450
2451},{"deep-profanity-filter":131}],7:[function(require,module,exports){
2452"use strict";
2453
2454require("scroll-behavior-polyfill");
2455
2456var _events = require("events");
2457
2458var _promisePolyfill = require("promise-polyfill");
2459
2460var _promisePolyfill2 = _interopRequireDefault(_promisePolyfill);
2461
2462require("whatwg-fetch");
2463
2464var _header = require("./modules/header");
2465
2466var _header2 = _interopRequireDefault(_header);
2467
2468var _accordian = require("./modules/accordian");
2469
2470var _accordian2 = _interopRequireDefault(_accordian);
2471
2472var _memberNav = require("./modules/member-nav");
2473
2474var _memberNav2 = _interopRequireDefault(_memberNav);
2475
2476var _searchNav = require("./modules/search-nav");
2477
2478var _searchNav2 = _interopRequireDefault(_searchNav);
2479
2480var _trailer = require("./modules/trailer");
2481
2482var _trailer2 = _interopRequireDefault(_trailer);
2483
2484var _trailersList = require("./modules/trailers-list");
2485
2486var _trailersList2 = _interopRequireDefault(_trailersList);
2487
2488var _videoPlayer = require("./modules/video-player");
2489
2490var _videoPlayer2 = _interopRequireDefault(_videoPlayer);
2491
2492var _movieSlider = require("./modules/movie-slider");
2493
2494var _movieSlider2 = _interopRequireDefault(_movieSlider);
2495
2496var _geo = require("./modules/geo");
2497
2498var _geo2 = _interopRequireDefault(_geo);
2499
2500var _tabs = require("./modules/tabs");
2501
2502var _tabs2 = _interopRequireDefault(_tabs);
2503
2504var _movieTimes = require("./modules/movie-times");
2505
2506var _movieTimes2 = _interopRequireDefault(_movieTimes);
2507
2508var _cinemaTimes = require("./modules/cinema-times");
2509
2510var _cinemaTimes2 = _interopRequireDefault(_cinemaTimes);
2511
2512var _sportTimes = require("./modules/v5/sport-times");
2513
2514var _sportTimes2 = _interopRequireDefault(_sportTimes);
2515
2516var _regionsLists = require("./modules/regions-lists");
2517
2518var _regionsLists2 = _interopRequireDefault(_regionsLists);
2519
2520var _cinemaMap = require("./modules/cinema-map");
2521
2522var _cinemaMap2 = _interopRequireDefault(_cinemaMap);
2523
2524var _readMore = require("./modules/read-more");
2525
2526var _readMore2 = _interopRequireDefault(_readMore);
2527
2528var _readMoreLess = require("./modules/read-more-less");
2529
2530var _readMoreLess2 = _interopRequireDefault(_readMoreLess);
2531
2532var _reviewForm = require("./modules/review-form");
2533
2534var _reviewForm2 = _interopRequireDefault(_reviewForm);
2535
2536var _pagination = require("./modules/pagination");
2537
2538var _pagination2 = _interopRequireDefault(_pagination);
2539
2540var _memberSettings = require("./modules/member-settings");
2541
2542var _memberSettings2 = _interopRequireDefault(_memberSettings);
2543
2544var _votes = require("./modules/votes");
2545
2546var _votes2 = _interopRequireDefault(_votes);
2547
2548var _hearts = require("./modules/hearts");
2549
2550var _hearts2 = _interopRequireDefault(_hearts);
2551
2552var _share = require("./modules/share");
2553
2554var _share2 = _interopRequireDefault(_share);
2555
2556require("./modules/v5/share-extend");
2557
2558var _analytics = require("./modules/analytics");
2559
2560var _analytics2 = _interopRequireDefault(_analytics);
2561
2562var _modals = require("./modules/modals");
2563
2564var _modals2 = _interopRequireDefault(_modals);
2565
2566var _watchlist = require("./modules/watchlist");
2567
2568var _watchlist2 = _interopRequireDefault(_watchlist);
2569
2570var _listCarousel = require("./modules/list-carousel");
2571
2572var _listCarousel2 = _interopRequireDefault(_listCarousel);
2573
2574var _footer = require("./modules/footer");
2575
2576var _footer2 = _interopRequireDefault(_footer);
2577
2578var _filters = require("./modules/filters");
2579
2580var _filters2 = _interopRequireDefault(_filters);
2581
2582var _filtersGlobal = require("./modules/filters-global");
2583
2584var _filtersGlobal2 = _interopRequireDefault(_filtersGlobal);
2585
2586var _colorAverage = require("./modules/color-average");
2587
2588var _colorAverage2 = _interopRequireDefault(_colorAverage);
2589
2590var _lineClampElipsis = require("./modules/line-clamp-elipsis");
2591
2592var _lineClampElipsis2 = _interopRequireDefault(_lineClampElipsis);
2593
2594var _dragHorizontal = require("./modules/drag-horizontal");
2595
2596var _dragHorizontal2 = _interopRequireDefault(_dragHorizontal);
2597
2598var _episodes = require("./modules/episodes");
2599
vendor: 4,145 bytes, lines 2600-2750
2600var _episodes2 = _interopRequireDefault(_episodes);
2601
2602var _tooltip = require("./modules/tooltip");
2603
2604var _tooltip2 = _interopRequireDefault(_tooltip);
2605
2606require("./modules/movie-popup");
2607
2608require("./modules/links-target");
2609
2610require("./modules/countdown");
2611
2612require("./modules/streaming-soon-countdown");
2613
2614require("./modules/yt-player");
2615
2616require("./modules/movie-state-buttons");
2617
2618require("./modules/cinema-order");
2619
2620require("./modules/always-smooth-scroll");
2621
2622var _scrollWithQueryString = require("./modules/scroll-with-query-string");
2623
2624var _scrollWithQueryString2 = _interopRequireDefault(_scrollWithQueryString);
2625
2626require("./modules/mobile-menu");
2627
2628require("./modules/times-streaming-popup");
2629
2630require("./modules/signup-form");
2631
2632require("./modules/v5/reviews-slider");
2633
2634require("./modules/v5/movie-crew-slider");
2635
2636require("./modules/v5/opinion-slider");
2637
2638require("./modules/v5/more-cinemas-slider");
2639
2640require("./modules/v5/regions-visibility-trigger");
2641
2642require("./modules/v5/redirect-on-select");
2643
2644require("./modules/v5/genre-reset");
2645
2646require("./modules/v5/item-type-reset");
2647
2648require("./modules/v5/release-year-reset");
2649
2650require("./modules/v5/match-countdown");
2651
2652require("./modules/v5/read-more-synopsis");
2653
2654require("./modules/v5/scheduled-fixtures-slider");
2655
2656require("./modules/v5/teams-slider");
2657
2658require("./modules/v5/review-slider");
2659
2660require("./modules/v5/dismissable-notification");
2661
2662require("./modules/v5/fullwidth-slider");
2663
2664require("./modules/v5/members");
2665
2666require("./modules/v5/watchlist-options");
2667
2668require("./modules/v5/streamers-form");
2669
2670require("./modules/v5/range-slider");
2671
2672require("./modules/v5/rewards");
2673
2674require("./modules/v5/offers");
2675
2676require("./modules/v5/user-share-list");
2677
2678require("./modules/v5/search-filters");
2679
2680require("./modules/v5/user-edit-list-details");
2681
2682require("./modules/v5/user-new-toggle-lists");
2683
2684require("./modules/v5/user-add-to-list-from-search");
2685
2686require("./modules/v5/user-make-list-public");
2687
2688require("./modules/v5/user-add-cinema-to-fav");
2689
2690require("./modules/v5/blog");
2691
2692require("./modules/v5/join-slider");
2693
2694require("./modules/v5/code-resend");
2695
2696require("./modules/v5/otp-wrong-code");
2697
2698require("./modules/v5/more-cinemas-image-loader");
2699
2700var _homepageInsiteSearch = require("./modules/v5/homepage-insite-search");
2701
2702var _homepageInsiteSearch2 = _interopRequireDefault(_homepageInsiteSearch);
2703
2704require("./modules/v5/_tmp-page");
2705
2706require("./modules/v5/region-cinemas-map-maptiler");
2707
2708require("./modules/v5/fade-in-observer");
2709
2710require("./modules/v6/coming-soon-vertical-nav");
2711
2712require("./modules/v6/single-cinema-view-toggle");
2713
2714require("./modules/v6/times-calendar-context-window");
2715
2716require("./modules/v6/user-share-single-movie");
2717
2718require("./modules/v6/times-calendar-slider");
2719
2720require("./modules/v6/cinema-hero-slider");
2721
2722require("./modules/v6/cinema-hero-overlay-color");
2723
2724require("./modules/v6/flicks-now-playing-mobile-slider");
2725
2726require("./modules/v6/movie-list-swiper");
2727
2728require("./modules/v6/movie-synopsis-modal");
2729
2730require("./modules/v6/homepage-cinemas-map-maptiler");
2731
2732require("./modules/v6/cinema-all-movies-sessions");
2733
2734require("./modules/master-filter/main-filter");
2735
2736require("./modules/master-filter/side-filters-simple");
2737
2738require("./modules/master-filter/side-filters");
2739
2740require("./modules/master-filter/side-filters-single-cat");
2741
2742require("./modules/master-filter/active-filters-count");
2743
2744function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2745
2746function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2747
2748function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2749
2750function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
2750onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2751// import dropdown from './modules/dropdown'
2752
2753// import favourites from './modules/favourites'
2754
2755// import siema from './modules/siema'
2756
2757// import "./modules/cookie-banner";
2758
2759
2760// V5 components
2761
2762// import "./modules/v5/user-watchlist-new";
2763// import "./modules/v5/user-single-movie-toggle-lists";
2764// import "./modules/v5/user-create-new-list";
2765
2766// maps 
2767
2768
2769// master filters
2770
2771
2772// just for testing;
2773//import './modules/v5/color-thief';
2774if (!window.Promise) window.Promise = _promisePolyfill2.default;
2775
2776var App = function (_EventEmitter) {
2777  _inherits(App, _EventEmitter);
2778
2779  function App() {
2780    _classCallCheck(this, App);
2781
2782    return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this));
2783  }
2784
2785  return App;
2786}(_events.EventEmitter);
2787
2788var app = window.app = new App();
2789
2790(0, _header2.default)(app);
2791(0, _accordian2.default)(app);
2792(0, _memberNav2.default)(app);
2793(0, _searchNav2.default)(app);
2794(0, _homepageInsiteSearch2.default)(app);
2795(0, _trailer2.default)(app);
2796(0, _trailersList2.default)(app);
2797(0, _videoPlayer2.default)(app);
2798(0, _movieSlider2.default)(app);
2799(0, _movieTimes2.default)(app);
2800(0, _geo2.default)(app);
2801(0, _tabs2.default)(app);
2802(0, _cinemaTimes2.default)(app);
2803(0, _sportTimes2.default)(app);
2804(0, _regionsLists2.default)(app);
2805// cinemaMap(app)
2806(0, _readMore2.default)(app);
2807(0, _readMoreLess2.default)(app);
2808(0, _reviewForm2.default)(app);
2809// dropdown(app)
2810(0, _pagination2.default)(app);
2811(0, _memberSettings2.default)(app);
2812// favourites(app)
2813(0, _votes2.default)(app);
2814(0, _hearts2.default)(app);
2815(0, _share2.default)(app);
2816(0, _analytics2.default)(app);
2817(0, _modals2.default)(app);
2818(0, _watchlist2.default)(app);
2819(0, _listCarousel2.default)(app);
2820(0, _tooltip2.default)(app);
2821// siema(app)
2822(0, _footer2.default)(app);
2823(0, _filters2.default)(app);
2824(0, _filtersGlobal2.default)(app);
2825(0, _colorAverage2.default)(app);
2826(0, _lineClampElipsis2.default)(app);
2827(0, _dragHorizontal2.default)(app);
2828(0, _episodes2.default)(app);
2829(0, _scrollWithQueryString2.default)();
2830
2831},{"./modules/accordian":8,"./modules/always-smooth-scroll":9,"./modules/analytics":10,"./modules/cinema-map":11,"./modules/cinema-order":12,"./modules/cinema-times":13,"./modules/color-average":14,"./modules/countdown":16,"./modules/drag-horizontal":17,"./modules/episodes":18,"./modules/filters":20,"./modules/filters-global":19,"./modules/footer":21,"./modules/geo":22,"./modules/header":23,"./modules/hearts":24,"./modules/line-clamp-elipsis":25,"./modules/links-target":26,"./modules/list-carousel":27,"./modules/master-filter/active-filters-count":29,"./modules/master-filter/main-filter":30,"./modules/master-filter/side-filters":33,"./modules/master-filter/side-filters-simple":31,"./modules/master-filter/side-filters-single-cat":32,"./modules/member-nav":34,"./modules/member-settings":35,"./modules/mobile-menu":36,"./modules/modals":37,"./modules/movie-popup":38,"./modules/movie-slider":39,"./modules/movie-state-buttons":40,"./modules/movie-times":41,"./modules/pagination":42,"./modules/read-more":44,"./modules/read-more-less":43,"./modules/regions-lists":45,"./modules/review-form":46,"./modules/scroll-with-query-string":47,"./modules/search-nav":48,"./modules/share":49,"./modules/signup-form":50,"./modules/streaming-soon-countdown":51,"./modules/tabs":52,"./modules/times-streaming-popup":53,"./modules/tooltip":54,"./modules/trailer":55,"./modules/trailers-list":56,"./modules/v5/_tmp-page":57,"./modules/v5/blog":58,"./modules/v5/code-resend":59,"./modules/v5/dismissable-notification":60,"./modules/v5/fade-in-observer":61,"./modules/v5/fullwidth-slider":62,"./modules/v5/genre-reset":63,"./modules/v5/homepage-insite-search":64,"./modules/v5/item-type-reset":65,"./modules/v5/join-slider":66,"./modules/v5/match-countdown":68,"./modules/v5/members":69,"./modules/v5/more-cinemas-image-loader":70,"./modules/v5/more-cinemas-slider":71,"./modules/v5/movie-crew-slider":72,"./modules/v5/offers":73,"./modules/v5/opinion-slider":74,"./modules/v5/otp-wrong-code":75,"./modules/v5/range-slider":76,"./modules/v5/read-more-synopsis":77,"./modules/v5/redirect-on-select":78,"./modules/v5/region-cinemas-map-maptiler":79,"./modules/v5/regions-visibility-trigger":80,"./modules/v5/release-year-reset":81,"./modules/v5/review-slider":82,"./modules/v5/reviews-sli
2831der":83,"./modules/v5/rewards":84,"./modules/v5/scheduled-fixtures-slider":85,"./modules/v5/search-filters":86,"./modules/v5/share-extend":87,"./modules/v5/sport-times":88,"./modules/v5/streamers-form":89,"./modules/v5/teams-slider":90,"./modules/v5/user-add-cinema-to-fav":91,"./modules/v5/user-add-to-list-from-search":92,"./modules/v5/user-edit-list-details":93,"./modules/v5/user-make-list-public":94,"./modules/v5/user-new-toggle-lists":95,"./modules/v5/user-share-list":96,"./modules/v5/watchlist-options":97,"./modules/v6/cinema-all-movies-sessions":98,"./modules/v6/cinema-hero-overlay-color":99,"./modules/v6/cinema-hero-slider":100,"./modules/v6/coming-soon-vertical-nav":101,"./modules/v6/flicks-now-playing-mobile-slider":102,"./modules/v6/homepage-cinemas-map-maptiler":103,"./modules/v6/movie-list-swiper":104,"./modules/v6/movie-synopsis-modal":105,"./modules/v6/single-cinema-view-toggle":106,"./modules/v6/times-calendar-context-window":107,"./modules/v6/times-calendar-slider":108,"./modules/v6/user-share-single-movie":109,"./modules/video-player":110,"./modules/votes":111,"./modules/watchlist":112,"./modules/yt-player":113,"events":116,"promise-polyfill":186,"scroll-behavior-polyfill":188,"whatwg-fetch":199}],8:[function(require,module,exports){
2832"use strict";
2833
2834Object.defineProperty(exports, "__esModule", {
2835  value: true
2836});
2837
2838exports.default = function (app) {
2839  var accordions = document.querySelectorAll(".accordian");
2840  if (!accordions.length) return;
2841
2842  accordions.forEach(function (accordion) {
2843    var sections = accordion.querySelectorAll(".accordian__section");
2844    if (!sections.length) return;
2845
2846    // Initial state: respect markup WITHOUT measuring (modal may be hidden).
2847    sections.forEach(function (section) {
2848      var content = section.querySelector(".accordian__section__content");
2849      if (!content) return;
2850
2851      if (section.classList.contains("open")) {
2852        content.style.height = "auto";
2853      } else {
2854        content.style.height = "0px";
2855      }
2856    });
2857
2858    sections.forEach(function (section) {
2859      var trigger = section.querySelector(".accordian__section__trigger");
2860      var content = section.querySelector(".accordian__section__content");
2861      if (!trigger || !content) return;
2862
2863      trigger.addEventListener("click", function (e) {
2864        e.preventDefault();
2865
2866        if (section.classList.contains("open")) {
2867          closeSection(section, content);
2868        } else {
2869          openSection(section, content);
2870        }
2871      });
2872    });
2873
2874    function openSection(section, content) {
2875      section.classList.add("open");
2876
2877      // Start from 0 so we can animate open
2878      content.style.height = "0px";
2879
2880      // Next frame, expand to the full scrollHeight (includes padding)
2881      requestAnimationFrame(function () {
2882        content.style.height = content.scrollHeight + "px";
2883      });
2884
2885      // After animation, use auto so wrapping/padding stays correct
2886      var onEnd = function onEnd(ev) {
2887        if (ev.propertyName !== "height") return;
2888        content.style.height = "auto";
2889        content.removeEventListener("transitionend", onEnd);
2890      };
2891
2892      content.addEventListener("transitionend", onEnd);
2893    }
2894
2895    function closeSection(section, content) {
2896      section.classList.remove("open");
2897
2898      // If currently auto, freeze current height so we can animate to 0
2899      if (content.style.height === "auto") {
2900        content.style.height = content.scrollHeight + "px";
2901      }
2902
2903      requestAnimationFrame(function () {
2904        content.style.height = "0px";
2905      });
2906    }
2907  });
2908};
2909
2910},{}],9:[function(require,module,exports){
2911"use strict";
2912
2913var _smoothscroll = require("smoothscroll");
2914
2915var _smoothscroll2 = _interopRequireDefault(_smoothscroll);
2916
2917function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2918
2919var smoothScrollElements = document.querySelectorAll(".js-smoothscroll");
2920if (smoothScrollElements) {
2921  smoothScrollElements.forEach(function (element) {
2922    element.addEventListener("click", function (e) {
2923      e.preventDefault();
2924      var scrollTarget = document.querySelector(e.currentTarget.hash);
2925      if (scrollTarget) {
2926        (0, _smoothscroll2.default)(scrollTarget, 600);
2927      }
2928    });
2929  });
2930}
2931
2932// Do smoothscroll on dynamically loaded elements
2933var smoothScrollWrapper = document.querySelector(".js-smoothScrollWrapper");
2934if (smoothScrollWrapper) {
2935  smoothScrollWrapper.addEventListener("click", function (e) {
2936    if (!e.target.classList.contains("js-smoothscroll")) {
2937      return;
2938    }
2939    e.preventDefault();
2940    var scrollTarget = document.querySelector(e.target.hash);
2941    if (scrollTarget) {
2942      (0, _smoothscroll2.default)(scrollTarget, 600);
2943    }
2944  });
2945}
2946
2947},{"smoothscroll":191}],10:[function(require,module,exports){
2948'use strict';
2949
2950Object.defineProperty(exports, "__esModule", {
2951  value: true
2952});
2953
2954exports.default = function (app) {
2955  if (!window.dataLayer) return false;
2956
2957  document.querySelector('body').addEventListener('click', function (e) {
2958    if (e.target.classList.contains('ga-track2')) {
2959      var eventjson = e.target.getAttribute('data-eventjson') ? JSON.parse(e.target.getAttribute('data-eventjson')) : null;
2960      if (eventjson) window.dataLayer.push(eventjson);
2961    }
2962  });
2963};
2964
2965},{}],11:[function(require,module,exports){
2966"use strict";
2967
2968var _jsApiLoader = require("@googlemaps/js-api-loader");
2969
2970var _googleMaps = require("../config/google-maps");
2971
2972(0, _jsApiLoader.setOptions)({
2973  key: _googleMaps.GOOGLE_MAPS_API_KEY,
2974  version: "weekly"
2975});
2976
2977async function initSingleCinemaMap() {
2978  var el = document.getElementById("singleCinemaMap");
2979  if (!el) return;
2980
2981  var lat = parseFloat(el.dataset.lat);
2982  var lon = parseFloat(el.dataset.lon);
2983  var title = el.dataset.title || "Cinema";
2984
2985  if (Number.isNaN(lat) || Number.isNaN(lon)) return;
2986
2987  var center = { lat: lat, lng: lon };
2988
2989  var logoImg = document.querySelector(".cinema-hero-v6__logo img");
2990  var logoSrc = logoImg && logoImg.src || "";
2991
2992  var pin = document.createElement("div");
2993  pin.innerHTML = "\n    <div class=\"pin-outer\">\n      " + (logoSrc ? "<img class=\"pin-logo\" src=\"" + logoSrc + "\" alt=\"\">" : "") + "\n      <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"36\" height=\"36\" viewBox=\"0 0 36 36\" fill=\"none\">\n        <path d=\"M17.7539 35.7734L0.000385284 0.00302887L35.5074 0.00302887L17.7539 35.7734Z\" fill=\"#26272C\"/>\n      </svg>\n    </div>\n  ";
2994
2995  var _ref = await (0, _jsApiLoader.importLibrary)("maps"),
2996      Map = _ref.Map;
2997
2998  var _ref2 = await (0, _jsApiLoader.importLibrary)("marker"),
2999      AdvancedMarkerElement = _ref2.AdvancedMarkerElement;
3000
3001  var map = new Map(el, {
3002    center: center,
3003    zoom: 14,
3004    mapId: _googleMaps.GOOGLE_MAPS_MAP_ID,
3005    disableDefaultUI: true,
3006    zoomControl: true
3007  });
3008
3009  new AdvancedMarkerElement({
3010    map: map,
3011    position: center,
3012    title: title,
3013    content: pin
3014  });
3015}
3016
3017initSingleCinemaMap();
3018
3019},{"../config/google-maps":1,"@googlemaps/js-api-loader":114}],12:[function(require,module,exports){
3020'use strict';
3021
3022var _jsCookie = require('js-cookie');
3023
3024var _jsCookie2 = _interopRequireDefault(_jsCookie);
3025
3026var _helpers = require('../helpers/helpers');
3027
3028var _cinemaTimes = require('./cinema-times');
3029
3030function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3031
3032var cinemaOrderWrapper = document.querySelector(".js-cinema-orderby");
3033
3034if (cinemaOrderWrapper) {
3035  setDefaultValueFromCookie();
3036  cinemaOrderWrapper.addEventListener("click", handleOrderChange);
3037}
3038
3039function handleOrderChange(e) {
3040  var button = e.target.closest("button.cinema__orderby-button");
3041  if (!button) return;
3042
3043  // ------------------------------------------------------
3044  // Fetch movies by user preference
3045  // ------------------------------------------------------
3046  var targetValue = button.dataset.order;
3047  fetchMoviesByUserPreference(targetValue);
3048
3049  // ------------------------------------------------------
3050  // Update dropdown value
3051  // ------------------------------------------------------
3052  var targetText = button.querySelector('.cinema__orderby-text');
3053  updateDropdownValue(targetText.innerHTML);
3054  setActiveOrderButton(targetValue);
3055
3056  // ------------------------------------------------------
3057  // Save cookie & Close the form
3058  // @todo: do we need to set a cookie?
3059  // ------------------------------------------------------
3060  // if we need to set and read value from cookie than maybe its bettter to set it as object
3061  // e.g. {name: 'Rotten Tomatoes', value: 'rotten-tomatoes'} ?
3062  _jsCookie2.default.set("cinemaMoviesOrder", JSON.stringify({ name: targetText.innerHTML, value: targetValue }));
3063  closeCinemaMoviesOrderPopup();
3064}
3065
3066function fetchMoviesByUserPreference(choice) {
3067  if (['rt', 'popularity', 'alphabet', 'letterboxd', 'release_date'].includes(choice)) {
3068    (0, _cinemaTimes.loadSessions)(choice);
3069  } else {
3070    (0, _cinemaTimes.loadSessions)();
3071  }
3072}
3073
3074function closeCinemaMoviesOrderPopup() {
3075  var locationPopup = document.querySelector("#cinema-ordering-modal");
3076  if (locationPopup && locationPopup.classList.contains("modal--displaying")) {
3077    (0, _helpers.modalsHandler)("close", locationPopup);
3078  }
3079}
3080
3081function updateDropdownValue(newValue) {
3082  var dropdown = document.querySelector(".js--dropdownSelectedItem");
3083  // const selectedItemText = dropdown.querySelector(".js--location-select--text")
3084  if (dropdown) {
3085    dropdown.innerHTML = newValue;
3086  }
3087}
3088
3089function setActiveOrderButton(value) {
3090  if (!cinemaOrderWrapper) return;
3091
3092  var normalizedValue = value || "";
3093  cinemaOrderWrapper.querySelectorAll(".cinema__orderby-button").forEach(function (button) {
3094    var buttonValue = button.dataset.order || "";
3095    button.classList.toggle("is-active", buttonValue === normalizedValue);
3096  });
3097}
3098
3099function setDefaultValueFromCookie() {
3100  var cookiesValue = _jsCookie2.default.get("cinemaMoviesOrder");
3101  if (!cookiesValue) {
3102    setActiveOrderButton("");
3103    return;
3104  }
3105
3106  var cookiesValueParsed = JSON.parse(cookiesValue);
3107  updateDropdownValue(cookiesValueParsed.name);
3108  fetchMoviesByUserPreference(cookiesValueParsed.value);
3109  setActiveOrderButton(cookiesValueParsed.value);
3110}
3111
3112},{"../helpers/helpers":3,"./cinema-times":13,"js-cookie":171}],13:[function(require,module,exports){
3113"use strict";
3114
3115Object.defineProperty(exports, "__esModule", {
3116  value: true
3117});
3118exports.loadSessions = undefined;
3119
3120var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
3121
3122var _jsCookie = require("js-cookie");
3123
3124var _jsCookie2 = _interopRequireDefault(_jsCookie);
3125
3126var _helpers = require("../helpers/helpers");
3127
3128var _trailer = require("./trailer");
3129
3130function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3131
3132function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
3133
3134var cinemaPage = document.querySelector(".cinema");
3135var cinemaSlug = cinemaPage ? cinemaPage.getAttribute("data-cinema") : null;
3136var CINEMA_TIMES_SKELETON_COUNT = 4;
3137
3138exports.default = function (app) {
3139  if (!document.querySelector(".cinema__times")) return;
3140
3141  var calendarTabs = document.querySelectorAll(".times-calendar__el");
3142  var timesTabs = document.querySelectorAll(".timetable__day");
3143  var jsTimesTabs = document.querySelectorAll(".js--timesTab");
3144  var scrollContainer = document.querySelector(".times-calendar__inner");
3145
3146  [].concat(_toConsumableArray(calendarTabs)).forEach(function (tab, i) {
3147    tab.addEventListener("click", function () {
3148      (0, _helpers.tabsHandler)(tab, i, calendarTabs, timesTabs, "times-calendar__el--active", "timetable__day--active", scrollContainer);
3149      // placeDynamicParallax();
3150      var order = _jsCookie2.default.getJSON("cinemaMoviesOrder");
3151      loadSessions(order && order.value ? order.value : false);
3152    });
3153  });
3154
3155  if (calendarTabs.length) {
3156    calendarTabs[0].click();
3157  }
3158
3159  [].concat(_toConsumableArray(jsTimesTabs)).forEach(function (tab) {
3160    (0, _helpers.timesCardsAnimation)(tab);
3161  });
3162
3163  placeDynamicParallax();
3164};
3165
3166function loadSessions(order) {
3167  var activeDay = document.querySelector(".timetable__day--active");
3168  if (!activeDay) return;
3169  var activeDate = activeDay.getAttribute("data-date");
3170  var previousMarkup = activeDay.innerHTML;
3171  renderTimesSkeleton(activeDay);
3172  var url = "/cinema/sessions/" + cinemaSlug + "/" + activeDate + "/";
3173  if (order) url = url + "?sort_by=" + order;
3174  fetch(url, { credentials: "same-origin", headers: { "is-ajax-call": "yes" } }).then(function (blob) {
3175    return blob.text();
3176  }).then(function (text) {
3177    activeDay.innerHTML = text;
3178  }).then(function () {
3179    var trailerModal = document.querySelector('.trailer-modal');
3180    var trailerEl = document.querySelector('.js--loadTrailer');
3181    if (activeDay) {
3182      var allTrailerButtons = activeDay.querySelectorAll('.js--trailerModalTrigger');
3183      allTrailerButtons.forEach(function (trailerButton) {
3184        trailerButton.addEventListener('click', function (e) {
3185          e.preventDefault();
3186          var trailerUrl = e.target.getAttribute('href');
3187          (0, _trailer.loadTrailer)(trailerUrl, trailerEl, trailerModal);
3188          (0, _helpers.modalsHandler)('open', trailerModal);
3189        });
3190      });
3191    }
3192  }).then(function () {
3193    if ((typeof googletag === "undefined" ? "undefined" : _typeof(googletag)) !== undefined) {
3194      placeDynamicParallax();
3195    }
3196  }).catch(function (err) {
3197    activeDay.innerHTML = previousMarkup;
3198    console.error(err);
3199  });
3200}
3201
3202function renderTimesSkeleton(activeDay) {
3203  activeDay.innerHTML = Array.from({ length: CINEMA_TIMES_SKELETON_COUNT }, function () {
3204    return '<article class="timetable__article js--timesCard cinema-times__article cinema-times__article--placeholder" aria-hidden="true">' + '<div class="cinema-times__left cinema-times__left--placeholder">' + '<div class="cinema-times__image cinema-times__image--placeholder"></div>' + '</div>' + '<div class="cinema-times__content cinema-times__content--placeholder">' + '<span class="cinema-times__title-skeleton"></span>' + '<span class="cinema-times__meta-skeleton"></span>' + '<div class="cinema-times__sessions-skeleton">' + '<span class="cinema-times__session-skeleton"></span>' + '</div>' + '</div>' + '</article>';
3205  }).join("");
3206}
3207
3208function placeDynamicParallax() {
3209  if (screenW == "desktop") return false; // we don't load this on desktop
3210  if (ads_provider == null) return false;
3211  // if (typeof ads_provider !== "undefined") return false;
3212  var currentAd = document.querySelector("#dyn-ads");
3213  if (currentAd != null) {
3214    var currentAdWrapper = currentAd.closest(".ads-fullwidth--gray--single-cinema, .ads-fullwidth--gray");
3215    if (currentAdWrapper) {
3216      currentAdWrapper.parentNode.removeChild(currentAdWrapper);
3217    } else {
3218      currentAd.parentNode.removeChild(currentAd);
3219    }
3220  }
3221  var activeTab = document.getElementsByClassName("timetable__day--active")[0];
3222  if (!activeTab) return false;
3223  var activeTabDynAd = activeTab.querySelector("#dyn-ads");
3224  if (activeTabDynAd != null) {
3225    var activeTabDynAdWrapper = activeTabDynAd.closest(".ads-fullwidth--gray--single-cinema, .ads-fullwidth--gray");
3226    if (activeTabDynAdWrapper) {
3227      activeTabDynAdWrapper.parentNode.removeChild(activeTabDynAdWrapper);
3228    } else {
3229      activeTabDynAd.parentNode.removeChild(activeTabDynAd);
3230    }
3231  }
3232
3233  var cards = activeTab.getElementsByClassName("js--timesCard");
3234  var addAfterEl = cards.length > 1 ? cards[1] : cards[cards.length - 1];
3235
3236  if (addAfterEl) {
3237    addAfterEl.outerHTML += '<div class="ads-fullwidth--gray ads-fullwidth--gray--single-cinema"><div id="dyn-ads"><div id="div-gpt-ad-second"></div><div id="div-gpt-ad-backdrop"></div></div></div>';
3238  }
3239
3240  googletag.cmd.push(function () {
3241    googletag.display("div-gpt-ad-second");
3242    googletag.pubads().refresh([gptadslots[1]]);
3243  });
3244}
3245
3246exports.loadSessions = loadSessions;
3247
3248},{"../helpers/helpers":3,"./trailer":55,"js-cookie":171}],14:[function(require,module,exports){
3249'use strict';
3250
3251Object.defineProperty(exports, "__esModule", {
3252  value: true
3253});
3254
3255function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
3256
3257exports.default = function (app) {
3258  var images = document.querySelectorAll('.js--color-average__img');
3259  if (!images.length) return;
3260
3261  [].concat(_toConsumableArray(images)).forEach(function (image) {
3262    image.crossOrigin = "Anonymous";
3263    if (image.src) {
3264      if (image.complete) {
3265        doImage(image);
3266      } else {
3267        image.addEventListener('load', function () {
3268          return doImage(image);
3269        });
3270      }
3271    } else {
3272      var src = image.getAttribute("data-src");
3273      image.src = src;
3274      image.addEventListener('load', function () {
3275        return doImage(image);
3276      });
3277    }
3278  });
3279
3280  function doImage(image) {
3281    var backgroundBoxID = image.getAttribute('data-box-id');
3282    var backgroundBox = document.querySelector(backgroundBoxID);
3283    if (!backgroundBox) {
3284      console.error("color-averager can't find box");
3285      return;
3286    }
3287    var rgb = getAverageColor(image);
3288    var hsl = rgbToHsl(rgb);
3289
3290    // Keep color darker than 50% so white text has good contrast
3291    if (hsl.l > 0.5) {
3292      hsl.l = 0.5;
3293    }
3294    // hsl.s = 0.24
3295    // hsl.l = 0.31
3296    var hslStr = 'hsl(' + Math.round(hsl.h * 360) + ', ' + Math.round(hsl.s * 100) + '%, ' + Math.round(hsl.l * 100) + '%)';
3297    backgroundBox.style.backgroundColor = hslStr;
3298  }
3299
3300  function getAverageColor(img) {
3301    var canvas = document.createElement('canvas');
3302    var ctx = canvas.getContext('2d');
3303    var width = canvas.width = img.naturalWidth;
3304    var height = canvas.height = img.naturalHeight;
3305
3306    ctx.drawImage(img, 0, 0);
3307
3308    var imageData = ctx.getImageData(0, 0, width, height);
3309    var data = imageData.data;
3310    var r = 0;
3311    var g = 0;
3312    var b = 0;
3313
3314    for (var i = 0, l = data.length; i < l; i += 4) {
3315      r += data[i];
3316      g += data[i + 1];
3317      b += data[i + 2];
3318    }
3319
3320    r = Math.floor(r / (data.length / 4));
3321    g = Math.floor(g / (data.length / 4));
3322    b = Math.floor(b / (data.length / 4));
3323
3324    return { r: r, g: g, b: b };
3325  }
3326
3327  function rgbToHsl(_ref) {
3328    var r = _ref.r,
3329        g = _ref.g,
3330        b = _ref.b;
3331
3332    r /= 255;g /= 255;b /= 255;
3333    var max = Math.max(r, g, b),
3334        min = Math.min(r, g, b);
3335    var h,
3336        s,
3337        l = (max + min) / 2;
3338
3339    if (max == min) {
3340      h = s = 0; // achromatic
3341    } else {
3342      var d = max - min;
3343      s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
3344      switch (max) {
3345        case r:
3346          h = (g - b) / d + (g < b ? 6 : 0);break;
3347        case g:
3348          h = (b - r) / d + 2;break;
3349        case b:
3350          h = (r - g) / d + 4;break;
3351      }
3352      h /= 6;
3353    }
3354
3355    return { h: h, s: s, l: l };
3356  }
3357};
3358
3359},{}],15:[function(require,module,exports){
3360"use strict";
3361
3362var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
3363
3364!function (e) {
3365  "use strict";
3366  var t = function t(e) {
3367    var n = void 0,
3368        s = e || {};for (var _o = 1; _o < arguments.length; _o += 1) {
3369      n = arguments[_o];var r = Object.keys(n);if (r.length) for (var l = 0; l < r.length; l += 1) {
3370        var a = r[l];Object.prototype.hasOwnProperty.call(n, a) && ("object" == _typeof(n[a]) ? t(s[a], n[a]) : s[a] = n[a]);
3371      }
3372    }return s;
3373  },
3374      n = function n(e) {
3375    return null !== e && Symbol.iterator in Object(e);
3376  },
3377      s = function s(e, t, n) {
3378    var s = document.createElement("div"),
3379        o = document.createElement("span"),
3380        r = document.createElement("span"),
3381        l = document.createElement("div");return l.appendChild(o), l.appendChild(r), s.appendChild(l), s.classList.add(t.sectionClass), s.classList.add(n), o.classList.add(t.amountClass), r.classList.add(t.wordClass), e.appendChild(s), { full: s, amount: o, word: r };
3382  },
3383      o = function o(e, t) {
3384    var n = void 0;return e.inline ? ((n = document.createElement("span")).classList.add(e.inlineClass), n) : { days: s(t, e, "simply-days-section"), hours: s(t, e, "simply-hours-section"), minutes: s(t, e, "simply-minutes-section"), seconds: s(t, e, "simply-seconds-section") };
3385  };e.simplyCountdown = function (e, s) {
3386    var r = Object.getPrototypeOf(e),
3387        l = t({ year: 2015, month: 6, day: 28, hours: 0, minutes: 0, seconds: 0, words: { days: { singular: "day", plural: "days" }, hours: { singular: "hour", plural: "hours" }, minutes: { singular: "minute", plural: "minutes" }, seconds: { singular: "second", plural: "seconds" } }, plural: !0, zeroIsPlural: !1, inline: !1, enableUtc: !1, onEnd: function onEnd() {},
3388      refresh: 1e3, inlineClass: "simply-countdown-inline", sectionClass: "simply-section", amountClass: "simply-amount", wordClass: "simply-word", zeroPad: !1, countUp: !1 }, s),
3389        a = void 0,
3390        d = void 0,
3391        i = void 0,
3392        u = void 0,
3393        c = void 0,
3394        m = void 0,
3395        $ = void 0,
3396        p = void 0,
3397        g = void 0,
3398        y = void 0,
3399        h = void 0;h = r === String.prototype ? document.querySelectorAll(e) : e, i = new Date(l.year, l.month - 1, l.day, l.hours, l.minutes, l.seconds), d = l.enableUtc ? new Date(i.getUTCFullYear(), i.getUTCMonth(), i.getUTCDate(), i.getUTCHours(), i.getUTCMinutes(), i.getUTCSeconds()) : i;var C = function C(e) {
3400      var t = e,
3401          n = o(l, t),
3402          s = void 0;(s = function s() {
3403        var e, s;var o = function o() {
3404          $ = parseInt(m / 86400, 10), m %= 86400, p = parseInt(m / 3600, 10), m %= 3600, g = parseInt(m / 60, 10), y = parseInt(m % 60, 10);
3405        };u = new Date(), (m = l.enableUtc ? (d - (c = new Date(u.getFullYear(), u.getMonth(), u.getDate(), u.getHours(), u.getMinutes(), u.getSeconds())).getTime()) / 1e3 : (d - u.getTime()) / 1e3) > 0 ? o() : l.countUp ? (m = (u.getTime() - d) / 1e3, o()) : ($ = 0, p = 0, g = 0, y = 0, window.clearInterval(a), l.onEnd());var r = void 0,
3406            _ref = (e = { days: $, hours: p, minutes: g, seconds: y }, s = l, r = function r(e, t) {
3407          return e > 1 || 0 == e && s.zeroIsPlural ? t.plural : t.singular;
3408        }, s.plural ? { dayWord: r(e.days, s.words.days), hourWord: r(e.hours, s.words.hours), minuteWord: r(e.minutes, s.words.minutes), secondWord: r(e.seconds, s.words.seconds) } : { dayWord: s.words.days.singular, hourWord: s.words.hours.singular, minuteWord: s.words.minutes.singular, secondWord: s.words.seconds.singular }),
3409            i = _ref.dayWord,
3410            h = _ref.hourWord,
3411            C = _ref.minuteWord,
3412            w = _ref.secondWord;l.inline ? t.innerHTML = $ + " " + i + ", " + p + " " + h + ", " + g + " " + C + ", " + y + " " + w + "." : (n.days.amount.textContent = (l.zeroPad && $.toString().length < 2 ? "0" : "") + $, n.days.word.textContent = i, n.hours.amount.textContent = (l.zeroPad && p.toString().length < 2 ? "0" : "") + p, n.hours.word.textContent = h, n.minutes.amount.textContent = (l.zeroPad && g.toString().length < 2 ? "0" : "") + g, n.minutes.word.textContent = C, n.seconds.amount.textContent = (l.zeroPad && y.toString().length < 2 ? "0" : "") + y, n.seconds.word.textContent = w);
3413      })(), a = window.setInterval(s, l.refresh);
3414    };n(h) ? Array.prototype.forEach.call(h, function (e) {
3415      C(e);
3416    }) : C(h);
3417  };
3418}(window), window.jQuery && function (e, t) {
3419  "use strict";
3420  function n(e, n) {
3421    t(e, n);
3422  }e.fn.simplyCountdown = function (e) {
3423    var n, s;return n = this.selector, void t(n, s = e);
3424  };
3425}(jQuery, simplyCountdown);
3426
3427},{}],16:[function(require,module,exports){
3428"use strict";
3429
3430require("../../../../node_modules/simplycountdown.js/dist/simplyCountdown.min.js");
3431
3432var countdownWrapper = document.querySelector(".js-tmp-countdown");
3433
3434if (countdownWrapper) {
3435  var countdown = JSON.parse(countdownWrapper.dataset.countdown);
3436  countdown = countdown.split("-");
3437
3438  if (countdown.length == 3) {
3439    var config = {
3440      year: countdown[0],
3441      month: countdown[1],
3442      day: countdown[2],
3443      seconds: 0
3444    };
3445    simplyCountdown(countdownWrapper, config);
3446  }
3447}
3448
3449var root = document.documentElement;
3450var colorSchemeWrapper = document.querySelector('.tmp-data-for-js-provider');
3451if (colorSchemeWrapper) {
3452  var color = colorSchemeWrapper.dataset.color;
3453  root.style.setProperty('--color-scheme', color);
3454}
3455
3456},{"../../../../node_modules/simplycountdown.js/dist/simplyCountdown.min.js":190}],17:[function(require,module,exports){
3457'use strict';
3458
3459Object.defineProperty(exports, "__esModule", {
3460  value: true
3461});
3462
3463// inspired by https://codepen.io/toddwebdev/pen/yExKoj
3464exports.default = function (app) {
3465  var slider = document.querySelector('.js--drag-horizontal');
3466  if (!slider) return;
3467
3468  var selectedElement = slider.querySelector(".selected").parentNode;
3469  slider.scrollLeft = selectedElement.offsetLeft - slider.offsetWidth / 2 + selectedElement.offsetWidth / 2;
3470
3471  var dragElement = null;
3472  var startX = void 0;
3473  var scrollLeft = void 0;
3474  var clearClick = false;
3475
3476  slider.addEventListener('mousedown', function (e) {
3477    dragElement = e.target;
3478    startX = e.pageX - slider.offsetLeft;
3479    scrollLeft = slider.scrollLeft;
3480  });
3481  slider.addEventListener('mouseleave', function () {
3482    dragElement = null;
3483    clearClick = false;
3484    slider.classList.remove('active');
3485  });
3486  slider.addEventListener('mouseup', function (e) {
3487    if (dragElement && dragElement !== e.target) {
3488      dragElement = null;
3489      clearClick = false;
3490      slider.classList.remove('active');
3491    }
3492  });
3493  slider.addEventListener('mousemove', function (e) {
3494    if (!dragElement) return;
3495    e.preventDefault();
3496    clearClick = true;
3497    slider.classList.add('active');
3498    var x = e.pageX - slider.offsetLeft;
3499    var walk = (x - startX) * 1;
3500    slider.scrollLeft = scrollLeft - walk;
3501  });
3502
3503  // prevent a click if a drag has occurred
3504  slider.addEventListener('click', function (e) {
3505    if (clearClick) {
3506      e.preventDefault();
3507      dragElement = null;
3508      slider.classList.remove('active');
3509      clearClick = false;
3510    }
3511  });
3512};
3513
3514},{}],18:[function(require,module,exports){
3515"use strict";
3516
3517Object.defineProperty(exports, "__esModule", {
3518  value: true
3519});
3520
3521function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
3522
3523exports.default = function (app) {
3524  var episodes = document.querySelectorAll(".js-is-coming-soon");
3525  // s(episodes)
3526  if (!episodes) return;
3527
3528  [].concat(_toConsumableArray(episodes)).forEach(function (episode) {
3529    var parent = episode.parentNode;
3530    var expander = parent.querySelector(".episode__expanding");
3531    if (expander) {
3532      var expanderInner = expander.querySelector(".episode__expanding__inner");
3533      var height = expanderInner.offsetHeight;
3534      episode.addEventListener("click", function (e) {
3535        e.preventDefault();
3536        if (parent.classList.contains("--open")) {
3537          parent.classList.remove("--open");
3538          expander.style.maxHeight = 0;
3539        } else {
3540          parent.classList.add("--open");
3541          expander.style.maxHeight = height + "px";
3542        }
3543      });
3544
3545      window.addEventListener("resize", function (e) {
3546        height = expanderInner.offsetHeight;
3547      });
3548    }
3549  });
3550
3551  // Global show more
3552
3553  var allShowMoreButttons = document.querySelectorAll(".js-show-more-global");
3554  if (allShowMoreButttons) {
3555    allShowMoreButttons.forEach(function (button) {
3556      button.addEventListener("click", function (e) {
3557        console.log('show more button clicked');
3558        var wrapper = e.target.parentNode.parentNode.parentNode;
3559        wrapper.classList.add("show-all-episodes");
3560      });
3561    });
3562  }
3563
3564  var TMPwrapper = document.querySelector('.tmp__main-content');
3565  if (TMPwrapper) {
3566    TMPwrapper.addEventListener('click', function (e) {
3567      if (e.target.classList.contains('js-show-more-global')) {
3568        var wrapper = e.target.parentNode.parentNode.parentNode;
3569        wrapper.classList.add("show-all-episodes");
3570      }
3571    });
3572  }
3573
3574  var movieTabs = document.querySelector("#single-movie-tabs");
3575  if (movieTabs) {
3576    movieTabs.addEventListener("click", function (e) {
3577      if (e.target.classList.contains("js-show-more-cinemas")) {
3578        var wrapper = e.target.parentNode.parentNode.parentNode;
3579        wrapper.classList.add("show-all-cinemas");
3580      }
3581    });
3582  }
3583};
3584
3585},{}],19:[function(require,module,exports){
3586"use strict";
3587
3588Object.defineProperty(exports, "__esModule", {
3589  value: true
3590});
3591
3592exports.default = function (app) {
3593  var globalFiltersForm = document.querySelector(".js--filter-form-global");
3594
3595  var formType = "";
3596
3597  if (globalFiltersForm) {
3598    if (globalFiltersForm.classList.contains("js-filter-form-members-global")) {
3599      formType = "members";
3600    }
3601  }
3602
3603  if (globalFiltersForm) {
3604    setupEventListeners();
3605  }
3606
3607  function setupEventListeners() {
3608    globalFiltersForm.addEventListener("submit", handleFormSubmit);
3609    globalFiltersForm.addEventListener("click", handleLabelClick);
3610  }
3611
3612  function handleFormSubmit(e) {
3613    var submitButton = globalFiltersForm.querySelector('[type="submit"]');
3614    if (submitButton) {
3615      submitButton.classList.add("is-loading");
3616      submitButton.disabled = true;
3617    }
3618
3619    e.preventDefault();
3620    var formData = {};
3621
3622    if (formType === "members") {
3623      formData = {
3624        status: getSelectedValues(".status__label.selected"),
3625        genre: getSelectedValues(".genre__label.selected"),
3626        type: getSelectedValues(".type__label.selected"),
3627        year: getSelectedYearValues()
3628      };
3629    } else {
3630      formData = {
3631        streamers: getSelectedValues(".streamers-form__label.selected"),
3632        genre: getSelectedValues(".genre__label.selected"),
3633        type: getSelectedValues(".type__label.selected"),
3634        year: getSelectedYearValues()
3635      };
3636    }
3637
3638    redirectToFilteredUrl(formData);
3639  }
3640
3641  function redirectToFilteredUrl(formData) {
3642    // check for 'sortby' and 'view' params
3643    var currentUrl = window.location.href;
3644    var urlParams = new URLSearchParams(new URL(currentUrl).search);
3645    var sortbyValue = urlParams.get("sortby");
3646    var viewValue = urlParams.get("view");
3647
3648    var baseUrl = globalFiltersForm.getAttribute("action");
3649
3650    var queryParams = [];
3651
3652    if (viewValue) {
3653      queryParams.push("view=" + viewValue);
3654    }
3655
3656    if (sortbyValue) {
3657      queryParams.push("sortby=" + sortbyValue);
3658    }
3659
3660    // Construct query parameters
3661    Object.keys(formData).forEach(function (key) {
3662      var value = formData[key];
3663      if (Array.isArray(value) && value.length > 0) {
3664        // Special handling for years to create a range
3665        if (key === "year" && value.length === 2) {
3666          if (value[0] == "1911" && value[1] == new Date().getFullYear()) return [];
3667          queryParams.push(key + "=" + value[0] + "-" + value[1]);
3668        } else {
3669          queryParams.push(key + "=" + value.join(","));
3670        }
3671      }
3672    });
3673
3674    var fullUrl = baseUrl + (queryParams.length > 0 ? "?" + queryParams.join("&") : "");
3675    window.location.href = fullUrl;
3676  }
3677
3678  function getSelectedValues(selector) {
3679    return Array.from(globalFiltersForm.querySelectorAll(selector)).map(function (label) {
3680      return label.querySelector("input").value;
3681    });
3682  }
3683
3684  function getSelectedYearValues() {
3685    var output = globalFiltersForm.querySelector(".output");
3686    var spans = output.querySelectorAll("span");
3687    return [Number(spans[0].innerHTML), Number(spans[1].innerHTML)];
3688  }
3689
3690  function handleLabelClick(e) {
3691    // handle streamer labels click
3692    if (e.target.classList.contains("streamers-form__item")) {
3693      e.target.querySelector("label").classList.toggle("selected");
3694      grayOutOrNot();
3695    }
3696
3697    if (e.target.classList.contains("streamers-form__label")) {
3698      e.target.classList.toggle("selected");
3699      grayOutOrNot();
3700    }
3701
3702    // handle genre click
3703    if (e.target.classList.contains("genre__label")) {
3704      e.target.classList.toggle("selected");
3705    }
3706
3707    // handle movies / shows click
3708    if (e.target.classList.contains("type__label")) {
3709      e.target.classList.toggle("selected");
3710    }
3711
3712    if (e.target.classList.contains("status__label")) {
3713      e.target.classList.toggle("selected");
3714    }
3715
3716    // checkboxes workaround
3717    if (e.target.classList.contains("custom-checkbox__checkbox")) {
3718      e.target.parentNode.classList.toggle("selected");
3719    }
3720    if (e.target.classList.contains("tick")) {
3721      e.target.parentNode.parentNode.classList.toggle("selected");
3722    }
3723  }
3724};
3725
3726function grayOutOrNot() {
3727  // gray out streamers if at least one is selected
3728  var globalFilterWrapper = document.querySelector(".streamers-form__list-global");
3729  if (globalFilterWrapper) {
3730    var hasSelectedProviders = globalFilterWrapper.querySelectorAll(".selected").length > 0;
3731    globalFilterWrapper.classList.toggle("is-grayed-out", hasSelectedProviders);
3732  }
3733}
3734
3735},{}],20:[function(require,module,exports){
3736'use strict';
3737
3738Object.defineProperty(exports, "__esModule", {
3739	value: true
3740});
3741
3742function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
3743
3744exports.default = function (app) {
3745	// const ratingSelectForm = document.querySelector('#rating-select-form')
3746	// const genreSelectForm = document.querySelector('#genre-select-form')
3747	// const sortForm = document.querySelector('#sort-form')
3748	// const dateSelectForm = document.querySelector('#date-select-form')
3749	var filterForms = document.querySelectorAll('.js--filter-form');
3750
3751	if (filterForms.length < 1) return;
3752
3753	var resetBtns = document.querySelectorAll('.js--reset-form');
3754
3755	[].concat(_toConsumableArray(filterForms)).forEach(function (form) {
3756		form.addEventListener('submit', function (e) {
3757			var submitButton = form.querySelector('[type="submit"]');
3758			if (submitButton) {
3759				submitButton.classList.add('is-loading');
3760				submitButton.disabled = true;
3761			}
3762			e.preventDefault();
3763			setFilters();
3764		});
3765	});
3766
3767	// forms that aren't multiselect need to set the filters immediately on change
3768	var directSelectEls = getAllRadios();
3769	[].concat(_toConsumableArray(directSelectEls)).forEach(function (e) {
3770		e.addEventListener('change', setFilters);
3771	});
3772	function getAllRadios() {
3773		var radios = [];
3774		[].concat(_toConsumableArray(filterForms)).forEach(function (form) {
3775			radios = [].concat(_toConsumableArray(radios), _toConsumableArray(form.querySelectorAll('input[type=radio]')));
3776		});
3777		return radios;
3778	};
3779
3780	// set selected class on parent for styling
3781	[].concat(_toConsumableArray(resetBtns)).forEach(function (btn) {
3782		btn.addEventListener('click', function () {
3783			var formSelector = btn.getAttribute('data-form');
3784			var targetForm = formSelector ? document.querySelector(formSelector) : null;
3785			if (targetForm && typeof targetForm.reset === 'function') {
3786				targetForm.reset();
3787			}
3788			resetSelected();
3789		});
3790	});
3791
3792	var selectEls = getAllSelectEls();
3793	[].concat(_toConsumableArray(selectEls)).forEach(function (el) {
3794		el.addEventListener('change', resetSelected);
3795	});
3796
3797	function getAllSelectEls() {
3798		var selectEls = [];
3799		[].concat(_toConsumableArray(filterForms)).forEach(function (form) {
3800			selectEls = [].concat(_toConsumableArray(selectEls), _toConsumableArray(form.querySelectorAll('input[type=radio], input[type=checkbox]')));
3801		});
3802		return selectEls;
3803	}
3804
3805	function resetSelected() {
3806		[].concat(_toConsumableArray(selectEls)).forEach(function (el) {
3807			el.parentNode.classList.toggle('selected', el.checked);
3808		});
3809
3810		// gray out streamers if at least one is selected
3811		var singleFilterWrapper = document.querySelector('.streamers-form__list--single-filter');
3812		if (singleFilterWrapper) {
3813			var hasSelectedProviders = singleFilterWrapper.querySelectorAll('.selected').length > 0;
3814			singleFilterWrapper.classList.toggle('is-grayed-out', hasSelectedProviders);
3815		}
3816	}
3817
3818	function setFilters() {
3819		var filters = [];
3820		var target_url = location.pathname;
3821		// console.log(target_url);
3822
3823		[].concat(_toConsumableArray(filterForms)).forEach(function (form) {
3824			var new_filters = getFilters(form);
3825			filters = [].concat(_toConsumableArray(filters), _toConsumableArray(new_filters));
3826			var action = form.getAttribute('data-action');
3827			if (action && new_filters.length > 0) {
3828				target_url = action;
3829			}
3830		});
3831
3832		// console.log(target_url);
3833
3834		// Get the current view (poster/list)
3835		var parameters = new URLSearchParams(window.location.search);
3836		var view = parameters.get('view');
3837
3838		if (window.location.pathname === '/now-playing/' && !view) {
3839			filters.push('view=list');
3840		}
3841
3842		if (view) filters.push('view=' + view);
3843
3844		var filter = "";
3845		if (target_url.includes("?")) {
3846			filter = filter + filters.length > 0 ? "&" + filters.join("&") : "";
3847		} else {
3848			filter = filter + filters.length > 0 ? "?" + filters.join("&") : "";
3849		}
3850		window.location = '' + target_url + filter;
3851	}
3852
3853	function getFilters(form) {
3854		if (form) {
3855			var filterString = form.getAttribute('data-filter');
3856			var isMultiple = form.getAttribute('data-multiple');
3857			var isRange = form.getAttribute('data-range');
3858			var isType = form.getAttribute('data-type');
3859			var selected = [];
3860			var selected_form_els = form.querySelectorAll('input:checked, [name="min"], [name="max"]');
3861			[].concat(_toConsumableArray(selected_form_els)).forEach(function (el) {
3862				var value = el.value;
3863				if (value) selected.push(value);
3864			});
3865			if (selected.length == 0) return [];
3866			if (isType == 1 && selected.length == 2) return []; // if "movie,tv"
3867			if (isMultiple == 1) return [filterString + '=' + selected.join(",")];
3868			if (isRange == 1) {
3869				var year = selected.join("-");
3870				if (year == "1911-" + new Date().getFullYear()) return [];
3871				return [filterString + '=' + year];
3872			}
3873			return selected.map(function (r) {
3874				return filterString + '=' + r;
3875			});
3876		} else return [];
3877	}
3878};
3879
3880},{}],21:[function(require,module,exports){
3881"use strict";
3882
3883Object.defineProperty(exports, "__esModule", {
3884  value: true
3885});
3886
3887function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
3888
3889exports.default = function (app) {
3890
3891  var buttons = document.querySelectorAll('.js--footer-collapse-button');
3892  var buttonCinema = document.querySelector(".js--footer-collapse-button--cinema");
3893  var buttonsStates = document.querySelectorAll(".js--footer-collapse-button--state");
3894
3895  var buttonActiveClass = 'js--footer-collapse-button--active';
3896  var contentActiveClass = 'js--footer-collapse-content--active';
3897
3898  var open = function open(button) {
3899    button.classList.add(buttonActiveClass);
3900    var content = button.nextElementSibling;
3901    content.classList.add(contentActiveClass);
3902    content.style.maxHeight = content.scrollHeight + "px";
3903    setTimeout(function () {
3904      content.style.maxHeight = "none";
3905    }, 200);
3906  };
3907
3908  var close = function close(button) {
3909    button.classList.remove(buttonActiveClass);
3910    var content = button.nextElementSibling;
3911    // content.style.maxHeight = content.scrollHeight + "px";
3912    content.classList.remove(contentActiveClass);
3913    content.style.maxHeight = null;
3914  };
3915
3916  // const updateCinemaHeight = () => {
3917  //   const cinemaContent = document.querySelector(".js--footer-collapse-content--states");
3918  //   cinemaContent.style.maxHeight = "none";
3919  // }
3920
3921  var closeAllStates = function closeAllStates() {
3922    [].concat(_toConsumableArray(buttonsStates)).forEach(function (button) {
3923      close(button);
3924    });
3925  };
3926
3927  var closeAllContent = function closeAllContent() {
3928    [].concat(_toConsumableArray(buttons)).forEach(function (button) {
3929      return close(button);
3930    });
3931    close(buttonCinema);
3932    closeAllStates();
3933  };
3934
3935  [].concat(_toConsumableArray(buttons)).forEach(function (button) {
3936    button.addEventListener("click", function () {
3937      if (button.classList.contains(buttonActiveClass)) {
3938        close(button);
3939      } else {
3940        closeAllContent();
3941        open(button);
3942      }
3943    });
3944  });
3945
3946  [].concat(_toConsumableArray(buttonsStates)).forEach(function (button) {
3947    button.addEventListener("click", function () {
3948      if (button.classList.contains(buttonActiveClass)) {
3949        close(button);
3950      } else {
3951        closeAllStates();
3952        open(button);
3953      }
3954      // updateCinemaHeight()
3955    });
3956  });
3957
3958  buttonCinema && buttonCinema.addEventListener("click", function () {
3959    if (buttonCinema.classList.contains(buttonActiveClass)) {
3960      close(buttonCinema);
3961      closeAllStates();
3962    } else {
3963      closeAllContent();
3964      open(buttonCinema);
3965    }
3966  });
3967};
3968
3969},{}],22:[function(require,module,exports){
3970'use strict';
3971
3972Object.defineProperty(exports, "__esModule", {
3973  value: true
3974});
3975exports.addRegionSwitchEvents = undefined;
3976
3977var _jsCookie = require('js-cookie');
3978
3979var _jsCookie2 = _interopRequireDefault(_jsCookie);
3980
3981var _movieTimes = require('./movie-times');
3982
3983var _helpers = require('../helpers/helpers');
3984
3985function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3986
3987function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } // import {geolocator} from 'geolocator.js'
3988
3989
3990function addRegionSwitchEvents(regionSelectTriggers, geoCookie) {
3991  [].concat(_toConsumableArray(regionSelectTriggers)).forEach(function (trigger) {
3992    trigger.addEventListener('click', function () {
3993      var geocallback = trigger.getAttribute('data-geocallback');
3994      var region = trigger.getAttribute('data-geoRegion');
3995      var regionTitle = (trigger.textContent || '').trim();
3996      if (region) {
3997        saveRegionCookie(region, geoCookie);
3998        var selectedTexts = document.querySelectorAll('.location-select .js--location-select--text');
3999        selectedTexts.forEach(function (selectedItemText) {
4000          var svg = '<svg xmlns="http://www.w3.org/2000/svg" width="11" height="6" viewBox="0 0 11 6" fill="none">\n                    <path d="M11 1.1417L9.7075 0L5.5 3.7085L1.2925 0L0 1.1417L5.5 6L11 1.1417Z" fill="#fd0243"/>\n                  </svg>';
4001          if (location.pathname.includes('cinemas')) {
4002            selectedItemText.innerHTML = regionTitle + ' ' + svg;
4003          } else {
4004            selectedItemText.textContent = regionTitle;
4005          }
4006        });
4007        processCallback({ region: { slug: region, title: regionTitle }, geocallback: geocallback });
4008        [].concat(_toConsumableArray(regionSelectTriggers)).forEach(function (t) {
4009          if (t.classList.contains("regions-lists__region__item--selected")) {
4010            t.classList.remove("regions-lists__region__item--selected");
4011            t.classList.add("regions-lists__region__item--unselected");
4012          }
4013        });
4014        if (trigger.classList.contains("regions-lists__region__item--unselected")) {
4015          trigger.classList.remove("regions-lists__region__item--unselected");
4016          trigger.classList.add("regions-lists__region__item--selected");
4017        }
4018        closeLocationPopup();
4019      } else {}
4020    });
4021  });
4022}
4023
4024function saveLocationCookie(lat, lng, geoCookie) {
4025  var display_name = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
4026
4027  // if (typeof Cookiebot == "undefined" || Cookiebot.consented)
4028  _jsCookie2.default.set('geo', Object.assign(geoCookie, { gps: { lat: lat, lng: lng }, choice: 'gps', ip_detect: false, display_name: display_name }), { expires: 30 });
4029}
4030
4031function saveRegionCookie(region_slug, geoCookie) {
4032  // if (typeof Cookiebot == "undefined" || Cookiebot.consented)
4033  _jsCookie2.default.set('geo', Object.assign(geoCookie, { region: region_slug, choice: 'region', gps: null, ip_detect: false }), { expires: 30 });
4034}
4035
4036function processCallback(_ref) {
4037  var region = _ref.region,
4038      geo = _ref.geo,
4039      geocallback = _ref.geocallback;
4040
4041  switch (geocallback) {
4042    // homepage
4043    case 'nearest-cinemas':
4044      if (geo || region && region.slug) {
4045        var target = document.querySelector(".js--homeCinemas");
4046        target.classList.add('js--homeCinemasLoading');
4047        ajaxHomepageCinemas();
4048      }
4049      break;
4050
4051    // cinema page
4052    case 'nearby-cinemas':
4053      if (geo || region && region.slug) {
4054        var _target = document.querySelector(".js--homeCinemas");
4055        _target.classList.add('js--homeCinemasLoading');
4056        ajaxNearbyCinemas();
4057      }
4058      break;
4059
4060    case 'movie-times':
4061      if (geo) {
4062        (0, _movieTimes.movieGeoSuccess)();
4063      } else if (region && region.slug) {
4064        (0, _movieTimes.movieSelectRegion)(region);
4065      } else {
4066        (0, _movieTimes.movieLoadDefault)();
4067      }
4068      break;
4069
4070    case 'cinemas-list':
4071      if (geo) {
4072        window.location.href = '/cinemas/nearest/';
4073      } else if (region && region.slug) {
4074        window.location.href = '/cinemas/' + region.slug + '/';
4075      }
4076      break;
4077
4078    case 'now-playing-home':
4079      if (region && region.slug) {
4080        if (window.location.href != '/now-playing/' + region.slug + '/') window.location.href = '/now-playing/' + region.slug + '/';
4081      } else {
4082        window.location.href = '/now-playing/';
4083      }
4084      break;
4085
4086    case 'now-playing-list':
4087      if (region && region.slug) {
4088        if (window.location.href = '/now-playing/' + region.slug + '/?view=list') window.location.href = '/now-playing/' + region.slug + '/?view=list';
4089      } else {
4090        window.location.href = '/now-playing/?view=list';
4091      }
4092      break;
4093
4094    case 'coming-soon-cinemas':
4095      window.location.href = '/coming-soon/cinemas/';
4096      break;
4097
4098    default:
4099      break;
4100  }
4101}
4102
4103function closeLocationPopup() {
4104  var locationPopup = document.querySelector('#location-modal');
4105  if (locationPopup && locationPopup.classList.contains('modal--displaying')) {
4106    (0, _helpers.modalsHandler)('close', locationPopup);
4107  }
4108}
4109
4110function ajaxHomepageCinemas() {
4111  var url = '/homepage-cinemas/';
4112  var target = document.querySelector(".js--homeCinemas");
4113  var mapTarget = document.getElementById("cinemas-map-placeholder");
4114  if (target) {
4115    target.innerHTML = getHomepageCinemasSkeletonMarkup();
4116  }
4117  if (mapTarget) {
4118    mapTarget.classList.add('is-loading');
4119    mapTarget.classList.remove('is-expanded');
4120  }
4121  document.dispatchEvent(new CustomEvent('homepage-cinemas:reset-map-size'));
4122  document.dispatchEvent(new CustomEvent('homepage-cinemas:loading'));
4123  fetch(url, { credentials: 'same-origin', headers: { 'is-ajax-call': 'yes' } }).then(function (blob) {
4124    return blob.text();
4125  }).then(function (text) {
4126    target.innerHTML = text;
4127    document.dispatchEvent(new CustomEvent('homepage-cinemas:updated'));
4128  }).then(function () {
4129    return target.classList.remove('js--homeCinemasLoading');
4130  }).catch(function (err) {
4131    return console.error(err);
4132  });
4133
4134  // FOR TOMEK - we could hide the loaders applying a class to js--homeCinemas
4135  // once loaded and set some CSS to hide the loader
4136}
4137
4138function ajaxNearbyCinemas() {
4139  var url = '/nearby-cinemas/';
4140  var target = document.querySelector(".js--homeCinemas");
4141  var mapTarget = document.getElementById("cinemas-map-placeholder");
4142  if (target) {
4143    target.innerHTML = getHomepageCinemasSkeletonMarkup();
4144  }
4145  if (mapTarget) {
4146    mapTarget.classList.add('is-loading');
4147    mapTarget.classList.remove('is-expanded');
4148  }
4149  document.dispatchEvent(new CustomEvent('homepage-cinemas:reset-map-size'));
4150  document.dispatchEvent(new CustomEvent('homepage-cinemas:loading'));
4151  fetch(url, { credentials: 'same-origin', headers: { 'is-ajax-call': 'yes' } }).then(function (blob) {
4152    return blob.text();
4153  }).then(function (text) {
4154    target.innerHTML = text;
4155    document.dispatchEvent(new CustomEvent('homepage-cinemas:updated'));
4156  }).then(function () {
4157    return target.classList.remove('js--homeCinemasLoading');
4158  }).catch(function (err) {
4159    return console.error(err);
4160  });
4161
4162  // FOR TOMEK - we could hide the loaders applying a class to js--homeCinemas
4163  // once loaded and set some CSS to hide the loader
4164}
4165
4166function getHomepageCinemasSkeletonMarkup() {
4167  return '\n    <div class="homepage-cinemas-skeleton" aria-hidden="true">\n      <div class="homepage-cinemas-skeleton__grid">\n        ' + Array.from({ length: 6 }, function () {
4168    return '\n          <div class="homepage-cinemas-skeleton__card"></div>\n        ';
4169  }).join("") + '\n      </div>\n    </div>\n  ';
4170}
4171
4172exports.default = function (app) {
4173
4174  var geoDetactTriggers = document.querySelectorAll('.js--geoDetectTrigger');
4175  var autoTrigger = document.querySelector('.js--geoDetectAutoTrigger');
4176  var postcodeTrigger = document.querySelector('.js--geoPostcodeTrigger');
4177  var regionSelectTriggers = document.querySelectorAll('.js--geoRegionSelectTrigger');
4178  if (!geoDetactTriggers.length && !autoTrigger && !regionSelectTriggers.length && !postcodeTrigger) return;
4179  var geocallback = autoTrigger ? autoTrigger.getAttribute('data-geocallback') : false;
4180
4181  // const geocoder = new google.maps.Geocoder()
4182
4183  var geoCookie = _jsCookie2.default.getJSON('geo') || {};
4184
4185  // if (autoTrigger && geoCookie.gps && geoCookie.gps.lat && geoCookie.gps.lng) {
4186  //   return processLatLng(geoCookie.gps.lat, geoCookie.gps.lng)
4187  // }
4188
4189  function getRegionName(region_slug) {
4190    // a bit of a hack, maybe better to save the region name in the cookie and put it as a local variable in the template?
4191
4192    var locationPopup = document.querySelector('#location-modal');
4193    if (locationPopup) {
4194      var regionEl = locationPopup.querySelector('[data-georegion="' + region_slug + '"]');
4195      if (regionEl) {
4196        var regionName = (regionEl.textContent || '').trim();
4197        return regionName;
4198      }
4199    }
4200    return null;
4201  }
4202
4203  function updateLocationSelectLabels() {
4204    var selectedTexts = document.querySelectorAll('.location-select .js--location-select--text');
4205    if (!selectedTexts.length) return;
4206
4207    var regionName = geoCookie.choice === "region" && geoCookie.region ? getRegionName(geoCookie.region) : null;
4208
4209    selectedTexts.forEach(function (selectedItemText) {
4210      var defaultText = selectedItemText.getAttribute('data-default-text') || 'Near you';
4211      var svg = '<svg xmlns="http://www.w3.org/2000/svg" width="11" height="6" viewBox="0 0 11 6" fill="none">\n                    <path d="M11 1.1417L9.7075 0L5.5 3.7085L1.2925 0L0 1.1417L5.5 6L11 1.1417Z" fill="#fd0243"/>\n                  </svg>';
4212
4213      if (regionName) {
4214        if (location.pathname.includes('cinemas')) {
4215          selectedItemText.innerHTML = regionName + ' ' + svg;
4216        } else {
4217          selectedItemText.textContent = regionName;
4218        }
4219      } else {
4220        if (geoCookie.choice === "gps" && geoCookie.display_name) selectedItemText.textContent = geoCookie.display_name;else selectedItemText.textContent = defaultText;
4221      }
4222    });
4223  }
4224
4225  updateLocationSelectLabels();
4226
4227  addRegionSwitchEvents(regionSelectTriggers, geoCookie);
4228
4229  [].concat(_toConsumableArray(geoDetactTriggers)).forEach(function (trigger) {
4230    trigger.addEventListener('click', function () {
4231      geocallback = trigger.getAttribute('data-geocallback');
4232      trigger.classList.add('js--finding-location');
4233      if (navigator.geolocation) {
4234        navigator.geolocation.getCurrentPosition(success, error);
4235      }
4236    });
4237  });
4238
4239  var inputPostcodeValue = '';
4240  var hasDoneNewAutoSearch = false;
4241  var autocompletePostcode = document.querySelector('#postcodeAuto');
4242  var inputPostcode = document.querySelector('.autocomplete-input');
4243  var noResults = document.querySelector('#no-autocomplete-results');
4244
4245  if (autocompletePostcode) {
4246    new Autocomplete('#postcodeAuto', {
4247      search: function search(input) {
4248        var url = '/search-address/?q=' + input;
4249
4250        return new Promise(function (resolve) {
4251          hasDoneNewAutoSearch = true;
4252          inputPostcodeValue = input;
4253          if (input.length < 2) {
4254            return resolve([]);
4255          }
4256
4257          fetch(url).then(function (response) {
4258            return response.json();
4259          }).then(function (data) {
4260            resolve(data);
4261          });
4262        });
4263      },
4264      debounceTime: 500,
4265      getResultValue: function getResultValue(result) {
4266        return result.formatted_address;
4267      },
4268      onSubmit: function onSubmit(result) {
4269        //this is to force not show he 'no result' list
4270        hasDoneNewAutoSearch = false;
4271        //let's get the lat/lng now
4272        getLatLonByPlace(result.place_id);
4273      },
4274
4275      onUpdate: function onUpdate(results, selectedIndex) {
4276        var showNoResults = inputPostcodeValue && inputPostcodeValue.length >= 2 && results.length === 0 && hasDoneNewAutoSearch;
4277        if (showNoResults) {
4278          autocompletePostcode.classList.add('no-autocomplete-results');
4279          inputPostcode.setAttribute('aria-describedby', 'no-autocomplete-results');
4280        } else {
4281          autocompletePostcode.classList.remove('no-autocomplete-results');
4282          inputPostcode.removeAttribute('aria-describedby');
4283        }
4284      }
4285    });
4286
4287    inputPostcode.addEventListener('focus', function () {
4288      inputPostcode.classList.add('focused');
4289    });
4290    inputPostcode.addEventListener('blur', function () {
4291      inputPostcode.classList.remove('focused');
4292    });
4293  }
4294
4295  function getLatLonByPlace(place_id) {
4296    var url = '/get-geo/?place_id=' + place_id;
4297
4298    fetch(url, { credentials: 'same-origin', headers: { 'is-ajax-call': 'yes' } }).then(function (blob) {
4299      return blob.json();
4300    }).then(function (geoData) {
4301      if (geoData && geoData.geo.lat && geoData.geo.lng) {
4302        var position = {
4303          coords: {
4304            latitude: geoData.geo.lat,
4305            longitude: geoData.geo.lng
4306          },
4307          display_name: geoData.formatted_address ? getShortAddress(geoData.formatted_address) : 'Near You'
4308        };
4309
4310        //reload the data with new geo
4311        geocallback = postcodeTrigger.getAttribute('data-geocallback');
4312        success(position);
4313      } else {
4314        //data not found,TODO should should show some nice looking notification
4315      }
4316    })
4317    //TODO should should show some nice looking notification
4318    .catch(function (err) {
4319      return console.error(err);
4320    });
4321  }
4322
4323  if (autoTrigger) {
4324    window.addEventListener('load', function () {
4325      geocallback = autoTrigger.getAttribute('data-geocallback');
4326      if (navigator.geolocation) {
4327        navigator.geolocation.getCurrentPosition(success, error);
4328      }
4329    });
4330  }
4331
4332  function success(position) {
4333
4334    var trigger = document.querySelector('.js--finding-location');
4335    if (trigger) {
4336      trigger.classList.remove('js--finding-location');
4337    }
4338    closeLocationPopup();
4339
4340    var lat = position.coords.latitude;
4341    var lng = position.coords.longitude;
4342
4343    saveLocationCookie(lat, lng, geoCookie, position.display_name || null);
4344    updateLocationSelectLabels();
4345
4346    processCallback({ geo: { lat: lat, lng: lng }, geocallback: geocallback });
4347  }
4348
4349  function error(e) {
4350    var trigger = document.querySelector('.js--finding-location');
4351    if (trigger) {
4352      trigger.classList.remove('js--finding-location');
4353    }
4354    getIPLocation(function (err, results) {
4355      if (err) {} else {
4356        if (results.slug) {
4357          saveRegionCookie(results.slug, geoCookie);
4358        }
4359        updateLocationSelectLabels();
4360        closeLocationPopup();
4361        processCallback({ region: results, geocallback: geocallback });
4362      }
4363    });
4364  }
4365
4366  // function processRegion(region) {
4367  //   if (region.slug) {
4368
4369  //     if (geocallback === 'homepage-cinemas') {
4370  //       ajaxHomepageCinemas()
4371  //     } else if (geocallback === 'cinemas-list') {
4372  //       window.location = `/cinemas/${region.slug}/`
4373  //     } else if (geocallback === 'movie-times') {
4374  //       movieSelectRegion(region)
4375  //     } else {
4376
4377  //     }
4378  //   } else {
4379  //     if (geocallback === 'movie-times') {
4380  //       movieLoadDefault()
4381  //     }
4382  //   }
4383  // }
4384
4385  // function processLatLng(lat, lng) {
4386
4387  //   if (geocallback === 'homepage-cinemas') {
4388  //     const target = document.querySelector(".js--homeCinemas")
4389  //     target.classList.add('js--homeCinemasLoading')
4390  //     ajaxHomepageCinemas()
4391  //   } else if (geocallback === 'cinemas-list') {
4392  //     window.location.href = '/cinemas/nearest/'
4393  //   } else if (geocallback === 'movie-times') {
4394  //     movieGeoSuccess()
4395  //   } else {
4396
4397  //   }
4398  // }
4399
4400  function getIPLocation(cb) {
4401    var url = '/get-iplocation/?' + new Date().getTime();
4402    fetch(url, { credentials: 'same-origin', headers: { 'is-ajax-call': 'yes' } }).then(function (blob) {
4403      blob.json().then(function (json) {
4404        cb(null, json);
4405      });
4406    }).catch(function (err) {
4407      return cb(err, null);
4408    });
4409  }
4410
4411  // Functions below are not in use at the moment. If we switch to Google's geocoder, we will need it (Tom)
4412  /*
4413  function processLocation(lat, lng) {
4414    const latlng = new google.maps.LatLng(lat, lng)
4415     geocoder.geocode({'latLng': latlng}, (results, status) => {
4416      if (status == google.maps.GeocoderStatus.OK) {
4417        if (results[1]) {
4418          const city = extractCity(results)
4419          if (typeof city.long_name !== 'undefined') {
4420            const citySlug = slugify(city.long_name)
4421            //document.location = '/cinemas/' + citySlug
4422          }
4423        } else {
4424         }
4425      } else {
4426        // API error  check rate limits?
4427      }
4428    })
4429  }
4430    function extractCity(results) {
4431    for (var i = 0; i < results[0].address_components.length; i++) {
4432      for (var b = 0; b < results[0].address_components[i].types.length; b++) {
4433        // there are different types that might hold a city admin_area_lvl_1 usually does in come cases looking for sublocality type will be more appropriate
4434        if (results[0].address_components[i].types[0] == "administrative_area_level_1") {
4435           // this is the object we are looking for
4436          return results[0].address_components[i]
4437        }
4438      }
4439    }
4440     return false
4441  }
4442   // temp - this has to be mapped correctly to google city names
4443  function slugify(text) {
4444    return text.toString().toLowerCase()
4445      .replace(/\s+/g, '-')
4446      .replace(/[^\w\-]+/g, '')
4447      .replace(/\-\-+/g, '-')
4448      .replace(/^-+/, '')
4449      .replace(/-+$/, '')
4450  }
4451  */
4452
4453  var getShortAddress = function getShortAddress(address) {
4454    var parts = address.split(",");
4455    if (parts.length >= 3) {
4456      var cand = parts[1].trim();
4457      if (cand.length === 2) {
4458        // US states
4459        return parts[0].trim();
4460      }
4461      return cand;
4462    }
4463    return parts[0].trim();
4464  };
4465};
4466
4467exports.addRegionSwitchEvents = addRegionSwitchEvents;
4468
4469},{"../helpers/helpers":3,"./movie-times":41,"js-cookie":171}],23:[function(require,module,exports){
4470'use strict';
4471
4472Object.defineProperty(exports, "__esModule", {
4473	value: true
4474});
4475
4476function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
4477
4478exports.default = function (app) {
4479	var triggers = document.querySelectorAll('.header__navItem__trigger');
4480	var dropdowns = [];
4481
4482	[].concat(_toConsumableArray(triggers)).forEach(function (trigger, i) {
4483		var dropdownId = trigger.getAttribute('data-dropdown');
4484		var dropdown = document.querySelector('#' + dropdownId);
4485		dropdowns.push(dropdown);
4486		trigger.addEventListener('click', function (event) {
4487			// event.preventDefault();
4488			if (dropdown.classList.contains("open")) {
4489				close(trigger);
4490			} else {
4491				open(trigger, dropdown);
4492			}
4493		});
4494	});
4495
4496	function open(trigger, dropdown) {
4497		[].concat(_toConsumableArray(triggers)).forEach(function (trigger) {
4498			trigger.classList.remove("open");
4499			trigger.parentNode.classList.remove("open");
4500		});
4501		[].concat(dropdowns).forEach(function (dropdown) {
4502			dropdown.classList.remove("open");
4503		});
4504		dropdown.classList.add("open");
4505		trigger.classList.add("open");
4506		trigger.parentNode.classList.add("open");
4507	}
4508
4509	function close(trigger) {
4510		if (!trigger) return;
4511		var dropdownId = trigger.getAttribute('data-dropdown');
4512		var dropdown = document.querySelector('#' + dropdownId);
4513
4514		dropdown.classList.remove("open");
4515		trigger.classList.remove("open");
4516		trigger.parentNode.classList.remove("open");
4517	}
4518
4519	var header = document.querySelector(".header");
4520	var banner = document.querySelector(".beta-banner");
4521	var headerHeight = header ? header.offsetHeight : 0;
4522	var bannerHeight = banner ? banner.offsetHeight : 0;
4523	var headerTopPosition = 0;
4524	var currentScrollPosition = Math.max(window.scrollY, 0);
4525	var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
4526	var headerContainer = void 0;
4527	if (header) {
4528		headerContainer = header.querySelector('.container');
4529	}
4530	var headerContainerHeight = headerContainer ? headerContainer.offsetHeight : 0;
4531
4532	if (banner) {
4533		document.body.classList.add('has-banner');
4534	}
4535
4536	window.addEventListener("resize", function () {
4537		var newWindowWidth = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
4538		if (newWindowWidth != windowWidth) {
4539			windowWidth = newWindowWidth;
4540			if (header) {
4541				headerHeight = header.offsetHeight;
4542				headerContainerHeight = headerContainer ? headerContainer.offsetHeight : 0;
4543				header.style.transform = 'translateY(0px)';
4544			}
4545		}
4546	});
4547};
4548
4549},{}],24:[function(require,module,exports){
4550'use strict';
4551
4552Object.defineProperty(exports, "__esModule", {
4553  value: true
4554});
4555
4556function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
4557
4558exports.default = function (app) {
4559  var triggers = document.querySelectorAll('.js--heart');
4560
4561  if (!triggers) return;
4562
4563  [].concat(_toConsumableArray(triggers)).forEach(function (trigger, i) {
4564    trigger.addEventListener('click', heart);
4565  });
4566
4567  function heart(event) {
4568    event.preventDefault();
4569    var el = event.target;
4570
4571    var heart = el.getAttribute('data-heart');
4572    var review_id = el.getAttribute('data-review_id');
4573    var source = el.getAttribute('data-source');
4574    var source_id = el.getAttribute('data-source_id');
4575
4576    if (typeof heart == 'undefined' || !review_id || !source || !source_id) return;
4577
4578    var data = { heart: heart, review_id: review_id, source: source, source_id: source_id };
4579
4580    fetch('/heart/review/', {
4581      method: 'POST',
4582      headers: new Headers({ 'Content-Type': 'application/json', 'is-ajax-call': 'yes' }),
4583      body: JSON.stringify(data),
4584      credentials: 'same-origin'
4585    }).then(function (blob) {
4586      return blob.json();
4587    }).then(function (json) {
4588      var score = el.parentNode.querySelector(".js--heart-score");
4589      score.innerText = '' + json.heart.score;
4590
4591      el.setAttribute("data-heart", data.heart == 1 ? 0 : 1);
4592      var svg = el.querySelector('svg');
4593      if (data.heart == 1) {
4594        svg.classList.add('selected');
4595      } else {
4596        svg.classList.remove('selected');
4597      }
4598      el.querySelector("svg > use").setAttribute("xlink:href", data.heart == 1 ? "#heart" : "#heartoutline");
4599    }).catch(function (err) {
4600      return console.log(err);
4601    });
4602  }
4603};
4604
4605},{}],25:[function(require,module,exports){
4606"use strict";
4607
4608Object.defineProperty(exports, "__esModule", {
4609  value: true
4610});
4611
4612function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
4613
4614var lineClamp = require('line-clamp');
4615// js library to truncate text after specified number of lines and add "..."
4616// because this is something that CSS can't do reliably even in this day and age...
4617// boxes need to have class of .js--line-clamp and [data-lines] & [data-data] attributes
4618function clamp(boxes) {
4619  [].concat(_toConsumableArray(boxes)).forEach(function (box) {
4620    var numberOfLines = box.getAttribute("data-lines") || 2;
4621    lineClamp(box, numberOfLines);
4622  });
4623}
4624
4625exports.default = function (app) {
4626  var clampBoxes = document.querySelectorAll(".js--line-clamp");
4627  clamp(clampBoxes);
4628  window.addEventListener("resize", function () {
4629    // when line is calmped the extra original data is lost
4630    // if box increases in size, need to reset the data
4631    [].concat(_toConsumableArray(clampBoxes)).forEach(function (box) {
4632      var data = box.getAttribute("data-data");
4633      if (data) {
4634        box.innerHTML = data;
4635      }
4636    });
4637    clamp(clampBoxes);
4638  });
4639};
4640
4641},{"line-clamp":173}],26:[function(require,module,exports){
4642"use strict";
4643
4644function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
4645
4646var externalLinks = document.querySelectorAll("a[href^='http']");
4647
4648if (externalLinks) {
4649  [].concat(_toConsumableArray(externalLinks)).forEach(function (link, i) {
4650    if (link.classList.contains('self')) {
4651      return;
4652    }
4653    if (link.href.substring(0, 17) !== "https://www.flicks" && link.target != "_blank") {
4654      link.target = "_blank";
4655    }
4656  });
4657}
4658
4659},{}],27:[function(require,module,exports){
4660'use strict';
4661
4662Object.defineProperty(exports, "__esModule", {
4663  value: true
4664});
4665
4666function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
4667
4668exports.default = function (app) {
4669  var carousels = document.querySelectorAll('.js--carousel');
4670  [].concat(_toConsumableArray(carousels)).forEach(function (c) {
4671    var scrollContainer = c.querySelector('.js--carousel__inner');
4672    var items = c.querySelectorAll(".list-carousel-item,.movie-list-carousel-item, .article-item, .more-content-panel-slide, .spotlight-item, .js-team, .js-crew-member, .js-sport-tag, .js-opinion-item, .js-single-cinema, .js-overlay-carousel");
4673    if (!scrollContainer || items.length < 2) {
4674      return;
4675    }
4676
4677    var leftArrow = c.querySelector('.js--carousel__left');
4678    var rightArrow = c.querySelector('.js--carousel__right');
4679
4680    var containerWidth = void 0,
4681        itemWidth = void 0,
4682        numVisibleItems = void 0;
4683    setWidth();
4684    updateNavigationState();
4685
4686    leftArrow.addEventListener('click', function () {
4687      scrollItems(-numVisibleItems);
4688    });
4689
4690    rightArrow.addEventListener('click', function () {
4691      scrollItems(numVisibleItems);
4692    });
4693
4694    window.addEventListener("resize", function () {
4695      setWidth();
4696      updateNavigationState();
4697    });
4698
4699    scrollContainer.addEventListener("scroll", function () {
4700      window.requestAnimationFrame(updateNavigationState);
4701    });
4702
4703    function scrollItems(number) {
4704      var currentItemIndex = getCurrentItemIndex();
4705      var maxIndex = items.length - numVisibleItems;
4706      var newItemIndex = Math.min(Math.max(currentItemIndex + number, 0), maxIndex);
4707      var newOffset = newItemIndex * itemWidth;
4708
4709      var isSmoothScrollSupported = 'scrollBehavior' in document.documentElement.style;
4710
4711      if (isSmoothScrollSupported) {
4712        scrollContainer.scrollLeft = newOffset;
4713      } else {
4714        var currentOffset = scrollContainer.scrollLeft;
4715        var direction = currentOffset > newOffset ? "left" : "right";
4716        var distance = Math.abs(currentOffset - newOffset);
4717        sideScroll(scrollContainer, direction, 4, distance, 30);
4718      }
4719    }
4720
4721    function getCurrentItemIndex() {
4722      var scrollPosition = scrollContainer.scrollLeft;
4723      var currentItemIndex = undefined;
4724
4725      [].concat(_toConsumableArray(items)).forEach(function (i, n) {
4726        var offset = i.offsetLeft;
4727        if (currentItemIndex === undefined && offset >= scrollPosition) {
4728          currentItemIndex = n;
4729        }
4730      });
4731
4732      return currentItemIndex;
4733    }
4734
4735    function setWidth() {
4736      containerWidth = scrollContainer.offsetWidth;
4737      itemWidth = items[0].offsetWidth;
4738      numVisibleItems = Math.floor(containerWidth / itemWidth);
4739
4740      if (numVisibleItems < items.length) {
4741        c.classList.add("js--carousel--active");
4742      } else {
4743        c.classList.remove("js--carousel--active");
4744      }
4745    }
4746
4747    function updateNavigationState() {
4748      var maxScrollLeft = scrollContainer.scrollWidth - scrollContainer.clientWidth;
4749      var canScrollLeft = scrollContainer.scrollLeft > 1;
4750      var canScrollRight = scrollContainer.scrollLeft < maxScrollLeft - 1;
4751
4752      c.classList.toggle("is-at-start", !canScrollLeft);
4753      c.classList.toggle("is-at-end", !canScrollRight);
4754    }
4755  });
4756};
4757
4758function sideScroll(element, direction, speed, distance, step) {
4759  var scrollAmount = 0;
4760  var slideTimer = setInterval(function () {
4761    if (direction == 'left') {
4762      element.scrollLeft -= step;
4763    } else {
4764      element.scrollLeft += step;
4765    }
4766    scrollAmount += step;
4767    if (scrollAmount >= distance) {
4768      window.clearInterval(slideTimer);
4769    }
4770  }, speed);
4771}
4772
4773exports.sideScroll = sideScroll;
4774
4775},{}],28:[function(require,module,exports){
4776"use strict";
4777
4778var LocalStorageExtended = {
4779
4780  set: function set(key, value, ttl) {
4781    var now = new Date();
4782
4783    if (!ttl) ttl = 14;
4784
4785    // `item` is an object which contains the original value
4786    // as well as the time when it's supposed to expire
4787    var item = {
4788      value: value,
4789      expiry: now.getDate() + ttl
4790    };
4791    localStorage.setItem(key, JSON.stringify(item));
4792  },
4793
4794  get: function get(key) {
4795    var itemStr = localStorage.getItem(key);
4796    // if the item doesn't exist, return null
4797    if (!itemStr) {
4798      return null;
4799    }
4800    var item = JSON.parse(itemStr);
4801    var now = new Date();
4802    // compare the expiry time of the item with the current time
4803    if (now.getDate() > item.expiry) {
4804      // If the item is expired, delete the item from storage
4805      // and return null
4806      localStorage.removeItem(key);
4807      return null;
4808    }
4809    return item.value;
4810  }
4811
4812};
4813
4814module.exports = LocalStorageExtended;
4815
4816},{}],29:[function(require,module,exports){
4817"use strict";
4818
4819var dayjs = require("dayjs");
4820var utc = require("dayjs/plugin/utc");
4821var timezone = require("dayjs/plugin/timezone");
4822dayjs.extend(utc);
4823dayjs.extend(timezone);
4824
4825(function () {
4826  var masterFilterButton = document.querySelector('.js--openModal[data-modal-id="master-filters-popup"]');
4827  var badgeElement = document.querySelector(".js-master-filter-active-filters");
4828
4829  if (!masterFilterButton || !badgeElement) return;
4830
4831  var DEFAULT_VALUES = {
4832    sort: "popularity",
4833    when: dayjs().tz("Pacific/Auckland").format("YYYY-MM-DD") + "_" + dayjs().tz("Pacific/Auckland").add(7, 'day').format("YYYY-MM-DD")
4834  };
4835
4836  function getActiveFilterCount() {
4837    var urlParams = new URLSearchParams(window.location.search);
4838
4839    var activeCount = 0;
4840
4841    // sort (only if not default)
4842    var sort = urlParams.get("sortby");
4843    if (sort && sort !== DEFAULT_VALUES.sort) {
4844      activeCount += 1;
4845    }
4846
4847    // when (only if not default)
4848    var when = urlParams.get("when");
4849    if (when && when !== DEFAULT_VALUES.when) {
4850      activeCount += 1;
4851    }
4852
4853    // collection (no default)
4854    if (urlParams.get("collection")) {
4855      activeCount += 1;
4856    }
4857
4858    // release year (YYYY-YYYY)
4859    if (urlParams.get("year")) {
4860      activeCount += 1;
4861    }
4862
4863    // genres
4864    var genresParam = urlParams.getAll("genre[]");
4865    if (genresParam && genresParam.length > 0) {
4866      activeCount += 1;
4867    }
4868
4869    return activeCount;
4870  }
4871
4872  function updateMasterFilterBadge() {
4873    var count = getActiveFilterCount();
4874
4875    // update number
4876    badgeElement.textContent = count > 0 ? count + " setting" + (count > 1 ? 's' : '') : "";
4877
4878    // helper class for styling
4879    if (count > 0) {
4880      masterFilterButton.classList.add("has-filters");
4881    } else {
4882      masterFilterButton.classList.remove("has-filters");
4883    }
4884  }
4885
4886  // initial run on page load
4887  updateMasterFilterBadge();
4888
4889  // update after AJAX filter apply (URL changes via pushState)
4890  document.addEventListener("masterFilters:updated", updateMasterFilterBadge);
4891
4892  // keep badge in sync when navigating browser history
4893  window.addEventListener("popstate", updateMasterFilterBadge);
4894})();
4895
4896},{"dayjs":128,"dayjs/plugin/timezone":129,"dayjs/plugin/utc":130}],30:[function(require,module,exports){
4897"use strict";
4898
4899var dayjs = require("dayjs");
4900var utc = require("dayjs/plugin/utc");
4901var timezone = require("dayjs/plugin/timezone");
4902dayjs.extend(utc);
4903dayjs.extend(timezone);
4904
4905(function () {
4906  var form = document.getElementById("master-filters");
4907  if (!form) return;
4908
4909  var DEFAULTS = {
4910    sort: "popularity",
4911    when: dayjs().tz("Pacific/Auckland").format("YYYY-MM-DD") + "_" + dayjs().tz("Pacific/Auckland").add(7, 'day').format("YYYY-MM-DD")
4912  };
4913
4914  var YEAR_LIMITS = {
4915    min: 1900,
4916    max: new Date().getFullYear()
4917  };
4918
4919  var EMPTY_STATE_HTML = '<p class="now-playing-empty-state" role="status">😔 Sorry, getting nothing - adjust your filters.</p>';
4920  var gridLoadingSnapshot = null;
4921
4922  function updateResultsCount() {
4923    var grid = document.querySelector(".js--now-playing-movies-grid");
4924    var countElement = document.querySelector(".js-now-playing-results-count");
4925    if (!grid || !countElement) return;
4926
4927    var count = grid.querySelectorAll(".now-playing-movie-tile").length;
4928    countElement.textContent = count + " " + (count === 1 ? "title" : "titles");
4929  }
4930
4931  function closeMasterFiltersModal() {
4932    var modal = document.getElementById("master-filters-popup");
4933    if (!modal || !modal.classList) return;
4934
4935    modal.classList.remove("modal--displaying");
4936    document.body.classList.remove("is-hidden");
4937    document.documentElement.classList.remove("is-hidden");
4938  }
4939
4940  function getSkeletonCardCount(grid) {
4941    if (!grid || !grid.querySelectorAll) return 10;
4942
4943    var visibleCards = grid.querySelectorAll(".now-playing-movie-tile").length;
4944    if (!visibleCards) return 10;
4945
4946    return Math.max(5, Math.min(visibleCards, 10));
4947  }
4948
4949  function buildSkeletonCardsHtml(count) {
4950    var cards = "";
4951
4952    for (var i = 0; i < count; i++) {
4953      cards += '<article class="now-playing-movie-tile now-playing-movie-tile--placeholder" aria-hidden="true">' + '<div class="now-playing-movie-tile__media">' + '<div class="now-playing-movie-tile__poster-skeleton"></div>' + '</div>' + '<div class="now-playing-movie-tile__content now-playing-movie-tile__content--placeholder">' + '<span class="now-playing-movie-tile__text-skeleton now-playing-movie-tile__text-skeleton--title"></span>' + '<span class="now-playing-movie-tile__text-skeleton now-playing-movie-tile__text-skeleton--meta"></span>' + '</div>' + '</article>';
4954    }
4955
4956    return cards;
4957  }
4958
4959  function toggleGridLoading(isLoading) {
4960    var grid = document.querySelector(".js--now-playing-movies-grid");
4961    if (!grid || !grid.classList) return;
4962
4963    if (isLoading) {
4964      if (!gridLoadingSnapshot) {
4965        gridLoadingSnapshot = {
4966          html: grid.innerHTML,
4967          isEmpty: grid.classList.contains("is-empty")
4968        };
4969      }
4970
4971      grid.classList.remove("is-empty");
4972      grid.innerHTML = buildSkeletonCardsHtml(getSkeletonCardCount(grid));
4973    } else {
4974      gridLoadingSnapshot = null;
4975    }
4976
4977    grid.classList.toggle("is-loading", !!isLoading);
4978    grid.setAttribute("aria-busy", isLoading ? "true" : "false");
4979  }
4980
4981  function notifyFiltersUpdated() {
4982    var evt;
4983    try {
4984      evt = new CustomEvent("masterFilters:updated");
4985    } catch (e) {
4986      evt = document.createEvent("CustomEvent");
4987      evt.initCustomEvent("masterFilters:updated", true, true, {});
4988    }
4989    document.dispatchEvent(evt);
4990  }
4991
4992  // ------------------------------------------------------------ 
4993  // Form getters
4994  // ------------------------------------------------------------ 
4995  function getRadioValue(name) {
4996    var el = form.querySelector('input[type="radio"][name="' + name + '"]:checked');
4997    return el ? el.value : "";
4998  }
4999
5000  function getSelectedGenres() {
5001    var checked = form.querySelectorAll('input[name="genre[]"]:checked');
5002    var out = [];
5003    for (var i = 0; i < checked.length; i++) {
5004      out.push(checked[i].value);
5005    }return out;
5006  }
5007
5008  // Uses your slider output pattern: .output span span
5009  function getSelectedYearValues() {
5010    var output = form.querySelector(".output");
5011    if (!output) return null;
5012
5013    var spans = output.querySelectorAll("span");
5014    if (!spans || spans.length < 2) return null;
5015
5016    var a = Number(spans[0].innerHTML);
5017    var b = Number(spans[1].innerHTML);
5018
5019    if (isNaN(a) || isNaN(b)) return null;
5020    return [a, b];
5021  }
5022
5023  // ---------- build URL ----------
5024  function buildUrl() {
5025    var current = new URLSearchParams(window.location.search);
5026    var params = new URLSearchParams();
5027
5028    // sort: omit if default latest
5029    var sort = getRadioValue("sortby") || DEFAULTS.sort;
5030    if (sort && sort !== DEFAULTS.sort) params.set("sortby", sort);
5031
5032    // when: omit if default this_week
5033    var when = getRadioValue("when") || DEFAULTS.when;
5034    if (when && when !== DEFAULTS.when) params.set("when", when);
5035
5036    var days = getRadioValue("days") || DEFAULTS.days;
5037    if (days && days !== DEFAULTS.days) params.set("days", days);
5038
5039    // genres: comma list
5040    var genres = getSelectedGenres();
5041    if (genres.length) genres.forEach(function (v) {
5042      return params.append('genre[]', v);
5043    });
5044    // params.set("genre[]", genres);
5045
5046    // year: YYYY-YYYY, omit if full range
5047    var years = getSelectedYearValues();
5048    if (years) {
5049      var minYear = years[0];
5050      var maxYear = years[1];
5051      var isDefault = minYear <= YEAR_LIMITS.min && maxYear >= YEAR_LIMITS.max;
5052      if (!isDefault) params.set("year", String(minYear) + "-" + String(maxYear));
5053    }
5054
5055    var country = getRadioValue("country") || DEFAULTS.country;
5056    if (country && country !== DEFAULTS.country) params.set("country", country);
5057
5058    var awards = getRadioValue("awards") || DEFAULTS.awards;
5059    if (awards && awards !== DEFAULTS.awards) params.set("awards", awards);
5060
5061    var runtime = getRadioValue("runtime") || DEFAULTS.runtime;
5062    if (runtime && runtime !== DEFAULTS.runtime) params.set("runtime", runtime);
5063
5064    var collection = getRadioValue("collection") || DEFAULTS.collection;
5065    if (collection && collection !== DEFAULTS.collection) params.set("collection", collection);
5066
5067    var qs = params.toString();
5068
5069    var path = window.location.pathname.replace(/\/?$/, "/");
5070    return qs ? path + "?" + qs : path;
5071  }
5072
5073  function go(closeModalOnApply) {
5074    if (closeModalOnApply) {
5075      closeMasterFiltersModal();
5076    }
5077
5078    // hit the url endpoint via ajax (update the grid if we get
5079    // anything back, but don’t block the normal redirect)
5080    var url = buildUrl(); // includes `?…` if needed
5081    toggleGridLoading(true);
5082    fetch(url, { credentials: 'same-origin' }).then(function (res) {
5083      return res.text();
5084    }).then(function (html) {
5085
5086      var tempDiv = document.createElement('div');
5087      tempDiv.innerHTML = html;
5088      var extracted = tempDiv.querySelector('.js--now-playing-movies-grid');
5089      var hasMovies = extracted ? !!extracted.querySelector('.now-playing-movie-tile') : !!tempDiv.querySelector('.now-playing-movie-tile');
5090
5091      html = hasMovies ? extracted ? extracted.innerHTML : html : EMPTY_STATE_HTML;
5092
5093      var grid = document.querySelector('.js--now-playing-movies-grid');
5094      grid.classList.toggle("is-empty", !hasMovies);
5095      grid.innerHTML = html;
5096      updateResultsCount();
5097      showHideSideFilters(url);
5098      // Update the URL without reloading the page
5099      window.history.pushState({}, '', url);
5100      notifyFiltersUpdated();
5101      // updateMasterFilterBadge();
5102
5103      if (typeof screenType === "undefined") var screenType = window.matchMedia('(min-width: 768px)').matches ? "desktop" : "mobile";
5104      var removeAdWrapper = document.querySelector(".js--remove-on-" + screenType);
5105      if (removeAdWrapper != null) {
5106        removeAdWrapper.parentNode.removeChild(removeAdWrapper);
5107      }
5108
5109      if (typeof googletag !== "undefined" && googletag.pubads && typeof gptadslots !== "undefined") googletag.pubads().refresh([gptadslots[1]]);
5110
5111      toggleGridLoading(false);
5112    }).catch(function () {
5113      var grid = document.querySelector('.js--now-playing-movies-grid');
5114      if (grid && gridLoadingSnapshot) {
5115        grid.innerHTML = gridLoadingSnapshot.html;
5116        grid.classList.toggle("is-empty", !!gridLoadingSnapshot.isEmpty);
5117        updateResultsCount();
5118      }
5119      toggleGridLoading(false);
5120    });
5121
5122    // window.location.assign(buildUrl());
5123  }
5124
5125  // ----------- show/hide side filters based on current URL & config -----------
5126  function showHideSideFilters(url) {
5127    var sideFiltersButtons = document.querySelectorAll(".js-side-filter");
5128
5129    var qs = url.includes("?") ? url.split("?")[1] : "";
5130    var paramsArr = Array.from(new URLSearchParams(qs));
5131
5132    if (paramsArr.length == 0) {
5133      showSideFilters();
5134    } else if (paramsArr.length == 1) {
5135
5136      var match = Array.from(sideFiltersButtons).find(function (el) {
5137        return el.dataset.type === paramsArr[0][0] && el.dataset.value === paramsArr[0][1];
5138      });
5139      if (match) {
5140        if (!match.classList.contains("is-selected")) {
5141          for (var i = 0; i < sideFiltersButtons.length; i++) {
5142            sideFiltersButtons[i].style.display = sideFiltersButtons[i] !== match ? "none" : "";
5143          }
5144          match.classList.toggle("is-selected");
5145        }
5146      } else {
5147        hideSideFilters();
5148      }
5149    } else {
5150      hideSideFilters();
5151    }
5152  }
5153
5154  function showSideFilters() {
5155    var sideFiltersEl = document.querySelector(".js-side-filters");
5156    var selectedSideFiltersButton = document.querySelector(".js-side-filter.is-selected");
5157    if (selectedSideFiltersButton) {
5158      var sideFilterButtons = document.querySelectorAll(".js-side-filter");
5159      for (var i = 0; i < sideFilterButtons.length; i++) {
5160        sideFilterButtons[i].style.display = "";
5161      }
5162      selectedSideFiltersButton.classList.toggle("is-selected");
5163    }
5164    sideFiltersEl.classList.remove("hidden");
5165  }
5166
5167  function hideSideFilters() {
5168    var sideFiltersEl = document.querySelector(".js-side-filters");
5169    var selectedSideFiltersButton = document.querySelector(".js-side-filter.is-selected");
5170    if (selectedSideFiltersButton) {
5171      var sideFilterButtons = document.querySelectorAll(".js-side-filter");
5172      for (var i = 0; i < sideFilterButtons.length; i++) {
5173        sideFilterButtons[i].style.display = "";
5174      }
5175      selectedSideFiltersButton.classList.toggle("is-selected");
5176    }
5177    sideFiltersEl.classList.add("hidden");
5178  }
5179
5180  // ---------- init form state from URL ----------
5181  function setRadio(name, value) {
5182    var radios = form.querySelectorAll('input[type="radio"][name="' + name + '"]');
5183    for (var i = 0; i < radios.length; i++) {
5184      radios[i].checked = radios[i].value === value;
5185    }
5186  }
5187
5188  function setGenresFromUrl(genres) {
5189    var boxes = form.querySelectorAll('input[name="genre[]"]');
5190    for (var i = 0; i < boxes.length; i++) {
5191      boxes[i].checked = genres.indexOf(boxes[i].value) !== -1;
5192    }
5193  }
5194
5195  function syncGenreLabels() {
5196    var labels = form.querySelectorAll("label.genre-pill");
5197    for (var i = 0; i < labels.length; i++) {
5198      var input = labels[i].querySelector('input[name="genre[]"]');
5199      if (!input) continue;
5200      if (labels[i].classList) labels[i].classList.toggle("is-selected", !!input.checked);
5201    }
5202  }
5203
5204  function resetRangeSliders() {
5205    var sliders = form.querySelectorAll(".js-range-slider, .js-range-slider-2");
5206
5207    for (var i = 0; i < sliders.length; i++) {
5208      var slider = sliders[i];
5209      var minValue = slider.dataset.min;
5210      var maxValue = slider.dataset.max;
5211      var minInput = slider.querySelector('input[name="min"]');
5212      var maxInput = slider.querySelector('input[name="max"]');
5213
5214      if (!minInput || !maxInput) continue;
5215
5216      minInput.value = minValue;
5217      maxInput.value = maxValue;
5218
5219      minInput.dispatchEvent(new Event("input", { bubbles: true }));
5220      maxInput.dispatchEvent(new Event("input", { bubbles: true }));
5221    }
5222  }
5223
5224  function initFromUrl() {
5225    var params = new URLSearchParams(window.location.search);
5226    showHideSideFilters(window.location.href);
5227
5228    var sort = params.get("sortby");
5229    var when = params.get("when");
5230    var days = params.get("days");
5231    var collection = params.get("collection");
5232    var genreStr = params.get("genre");
5233    var genres = genreStr ? genreStr.split(",").filter(Boolean) : [];
5234
5235    // Only set if present (otherwise keep defaults already checked in markup)
5236    if (sort) setRadio("sortby", sort);
5237    if (when) setRadio("when", when);
5238    if (days) setRadio("days", days);
5239    if (collection) setRadio("collection", collection);
5240    if (genres.length) setGenresFromUrl(genres);
5241
5242    syncGenreLabels();
5243  }
5244
5245  // ---------- events ----------
5246  if (form.addEventListener) {
5247    form.addEventListener("submit", function (e) {
5248      if (e.preventDefault) e.preventDefault();
5249      go(true);
5250    });
5251
5252    form.addEventListener("reset", function () {
5253      setTimeout(function () {
5254        var radios = form.querySelectorAll('input[type="radio"]');
5255        for (var i = 0; i < radios.length; i++) {
5256          radios[i].checked = false;
5257        }
5258
5259        var genres = form.querySelectorAll('input[name="genre[]"]');
5260        for (var j = 0; j < genres.length; j++) {
5261          genres[j].checked = false;
5262        }
5263
5264        var checkboxPills = form.querySelectorAll("label.checkbox-pill");
5265        for (var k = 0; k < checkboxPills.length; k++) {
5266          checkboxPills[k].classList.remove("is-selected");
5267        }
5268
5269        syncGenreLabels();
5270        resetRangeSliders();
5271        go(true);
5272      }, 0);
5273    });
5274
5275    // Dispatch custom event so the form updates
5276    document.addEventListener("masterFilters:submit", function () {
5277      go(false);
5278    });
5279  }
5280
5281  initFromUrl();
5282  updateResultsCount();
5283})();
5284
5285},{"dayjs":128,"dayjs/plugin/timezone":129,"dayjs/plugin/utc":130}],31:[function(require,module,exports){
5286'use strict';
5287
5288(function () {
5289  var container = document.querySelector('.js-simple-side-filters');
5290  if (!container) return;
5291
5292  var buttons = container.querySelectorAll('.js-simple-side-filter');
5293
5294  var setActiveFromUrl = function setActiveFromUrl() {
5295    var params = new URLSearchParams(window.location.search);
5296    var activeCategory = params.get('category');
5297
5298    buttons.forEach(function (btn) {
5299      var btnCategory = btn.dataset.category;
5300
5301      var isActive = !activeCategory && btnCategory === '' || btnCategory && btnCategory === activeCategory;
5302
5303      btn.classList.toggle('is-selected', isActive);
5304    });
5305  };
5306
5307  setActiveFromUrl();
5308
5309  container.addEventListener('click', function (e) {
5310    var button = e.target.closest('.js-simple-side-filter');
5311    if (!button) return;
5312
5313    var category = button.dataset.category;
5314    var url = new URL(window.location.href);
5315
5316    if (category) {
5317      url.searchParams.set('category', category);
5318    } else {
5319      url.searchParams.delete('category');
5320    }
5321
5322    window.location.assign(url.toString());
5323  });
5324})();
5325
5326},{}],32:[function(require,module,exports){
5327'use strict';
5328
5329(function () {
5330  var wrapper = document.querySelector('.js-side-filters-cat');
5331  if (!wrapper) return;
5332
5333  var ACTIVE = 'has-filters';
5334  var HIDDEN = 'is-hidden';
5335
5336  var getButtons = function getButtons() {
5337    return wrapper.querySelectorAll('.js-side-filter-cat');
5338  };
5339
5340  var activate = function activate(btn) {
5341    var buttons = getButtons();
5342
5343    for (var i = 0; i < buttons.length; i++) {
5344      var b = buttons[i];
5345      var isActive = b === btn;
5346
5347      b.classList.toggle(ACTIVE, isActive);
5348      b.classList.toggle(HIDDEN, !isActive);
5349      b.setAttribute('aria-pressed', isActive ? 'true' : 'false');
5350    }
5351  };
5352
5353  var clearAll = function clearAll() {
5354    var buttons = getButtons();
5355
5356    for (var i = 0; i < buttons.length; i++) {
5357      var b = buttons[i];
5358      b.classList.remove(ACTIVE);
5359      b.classList.remove(HIDDEN);
5360      b.setAttribute('aria-pressed', 'false');
5361    }
5362  };
5363
5364  wrapper.addEventListener('click', function (e) {
5365    var btn = e.target.closest('button.js-side-filter-cat');
5366    if (!btn) return;
5367
5368    // clicking active button undoes the filter
5369    if (btn.classList.contains(ACTIVE)) {
5370      clearAll();
5371      return;
5372    }
5373
5374    activate(btn);
5375
5376    // optional hook:
5377    // const value = btn.getAttribute('data-value');
5378  });
5379})();
5380
5381},{}],33:[function(require,module,exports){
5382"use strict";
5383
5384(function () {
5385  var sideWrap = document.querySelector(".js-side-filters");
5386  var form = document.getElementById("master-filters");
5387  if (!sideWrap || !form) return;
5388
5389  var buttons = Array.prototype.slice.call(sideWrap.querySelectorAll(".js-side-filter"));
5390
5391  function setSelected(btn) {
5392    for (var i = 0; i < buttons.length; i++) {
5393      if (buttons[i].classList) buttons[i].classList.toggle("is-selected", buttons[i] === btn);
5394    }
5395  }
5396
5397  function showOnly(btn) {
5398    for (var i = 0; i < buttons.length; i++) {
5399      buttons[i].style.display = btn && buttons[i] !== btn ? "none" : "";
5400    }
5401  }
5402
5403  function showAll() {
5404    for (var i = 0; i < buttons.length; i++) {
5405      buttons[i].style.display = "";
5406      if (buttons[i].classList) buttons[i].classList.remove("is-selected");
5407    }
5408  }
5409
5410  function syncGenreLabels() {
5411    var labels = form.querySelectorAll("label.genre-pill");
5412    for (var i = 0; i < labels.length; i++) {
5413      var input = labels[i].querySelector('input[name="genre[]"]');
5414      if (!input) continue;
5415      if (labels[i].classList) labels[i].classList.toggle("is-selected", !!input.checked);
5416    }
5417  }
5418
5419  function setRadio(name, value) {
5420    var radios = form.querySelectorAll('input[type="radio"][name="' + name + '"]');
5421    for (var i = 0; i < radios.length; i++) {
5422      radios[i].checked = radios[i].value === value;
5423    }
5424  }
5425
5426  function clearRadio(name) {
5427    var radios = form.querySelectorAll('input[type="radio"][name="' + name + '"]');
5428    for (var i = 0; i < radios.length; i++) {
5429      radios[i].checked = false;
5430    }
5431  }
5432
5433  function setSingleGenre(value) {
5434    var boxes = form.querySelectorAll('input[name="genre[]"]');
5435    for (var i = 0; i < boxes.length; i++) {
5436      boxes[i].checked = boxes[i].value === value;
5437    }
5438    syncGenreLabels();
5439  }
5440
5441  function clearGenres() {
5442    var boxes = form.querySelectorAll('input[name="genre[]"]');
5443    for (var i = 0; i < boxes.length; i++) {
5444      boxes[i].checked = false;
5445    }
5446    syncGenreLabels();
5447  }
5448
5449  function apply(type, value) {
5450    if (type === "genre[]") setSingleGenre(value);else setRadio(type, value);
5451  }
5452
5453  function clear(type) {
5454    if (type === "genre[]") clearGenres();else clearRadio(type);
5455  }
5456
5457  function requestSubmit() {
5458    var evt;
5459    try {
5460      evt = new CustomEvent("masterFilters:submit");
5461    } catch (e) {
5462      evt = document.createEvent("CustomEvent");
5463      evt.initCustomEvent("masterFilters:submit", true, true, {});
5464    }
5465    document.dispatchEvent(evt);
5466  }
5467
5468  // mark selected side filter based on current URL
5469  function initFromUrl() {
5470    var params = new URLSearchParams(window.location.search);
5471    var when = params.get("when");
5472    var collection = params.get("collection");
5473    var genreStr = params.get("genre");
5474    var genres = genreStr ? genreStr.split(",").filter(Boolean) : [];
5475
5476    var selectedBtn = null;
5477
5478    if (when) {
5479      for (var i = 0; i < buttons.length; i++) {
5480        if (buttons[i].getAttribute("data-type") === "when" && buttons[i].getAttribute("data-value") === when) {
5481          selectedBtn = buttons[i];
5482          break;
5483        }
5484      }
5485    }
5486
5487    if (!selectedBtn && collection) {
5488      for (var j = 0; j < buttons.length; j++) {
5489        if (buttons[j].getAttribute("data-type") === "collection" && buttons[j].getAttribute("data-value") === collection) {
5490          selectedBtn = buttons[j];
5491          break;
5492        }
5493      }
5494    }
5495
5496    if (!selectedBtn && genres.length) {
5497      for (var k = 0; k < buttons.length; k++) {
5498        if (buttons[k].getAttribute("data-type") === "genre") {
5499          var v = buttons[k].getAttribute("data-value");
5500          if (genres.indexOf(v) !== -1) {
5501            selectedBtn = buttons[k];
5502            break;
5503          }
5504        }
5505      }
5506    }
5507
5508    if (selectedBtn) {
5509      setSelected(selectedBtn);
5510      showOnly(selectedBtn);
5511    } else {
5512      // showAll();
5513    }
5514  }
5515
5516  sideWrap.addEventListener("click", function (e) {
5517    var target = e.target;
5518
5519    // closest() fallback
5520    while (target && target !== sideWrap) {
5521      if (target.classList && target.classList.contains("js-side-filter")) break;
5522      target = target.parentNode;
5523    }
5524
5525    if (!target || target === sideWrap) return;
5526    if (e.preventDefault) e.preventDefault();
5527
5528    var type = target.getAttribute("data-type");
5529    var value = target.getAttribute("data-value");
5530
5531    var isSelected = target.classList && target.classList.contains("is-selected");
5532
5533    if (isSelected) {
5534      clear(type);
5535      showAll();
5536      requestSubmit();
5537      return;
5538    }
5539
5540    apply(type, value);
5541    setSelected(target);
5542    showOnly(target);
5543    requestSubmit();
5544  });
5545
5546  initFromUrl();
5547})();
5548
5549},{}],34:[function(require,module,exports){
5550'use strict';
5551
5552Object.defineProperty(exports, "__esModule", {
5553  value: true
5554});
5555
5556var _helpers = require('../helpers/helpers');
5557
5558var _getFormData = require('get-form-data');
5559
5560var _getFormData2 = _interopRequireDefault(_getFormData);
5561
5562function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5563
5564function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
5565
5566exports.default = function (app) {
5567  var nav = document.querySelector('.member-nav');
5568  if (!nav) return;
5569
5570  var btnOpenNav = document.querySelectorAll('.js--openMemberNav');
5571  var allForms = document.querySelectorAll('.member-nav__form');
5572  var btnCloseNav = nav.querySelector('.js--closeMemberNav');
5573  var btnFormLogin = nav.querySelectorAll('.js--memberNavFormLogin');
5574  var btnFormJoin = nav.querySelectorAll('.js--memberNavFormJoin');
5575  var btnFormPassword = nav.querySelectorAll('.js--memberNavFormPassword');
5576  var btnFormUsername = nav.querySelectorAll('.js--memberNavFormUsername');
5577  var btnFormDeleteAccount = document.querySelectorAll('.js--memberNavFormDeleteAccount');
5578  var formLogin = nav.querySelector('.member-nav__form--login');
5579  var formJoin = nav.querySelector('.member-nav__form--join');
5580  var formPassword = nav.querySelector('.member-nav__form--password');
5581  var formUsername = nav.querySelector('.member-nav__form--username');
5582  var passwordForm = document.querySelector('.js--forgotPassword-form');
5583  var deleteAccountForm = document.querySelector('.member-nav__form--delete');
5584
5585  function formLoginJoinHandler(itsForm, otherForm) {
5586    [].concat(_toConsumableArray(allForms)).forEach(function (form) {
5587      return form.classList.remove('member-nav__form--showing');
5588    });
5589    itsForm.classList.add('member-nav__form--showing');
5590  }
5591
5592  if (btnOpenNav.length) [].concat(_toConsumableArray(btnOpenNav)).forEach(function (btn) {
5593    btn.addEventListener('click', function () {
5594      var form = btn.getAttribute("data-form");
5595      if (form == "formPassword") {
5596        formLoginJoinHandler(formPassword);
5597      }
5598      (0, _helpers.modalsHandler)('open', nav);
5599    });
5600  });
5601  btnCloseNav.addEventListener('click', function () {
5602    return (0, _helpers.modalsHandler)('close', nav);
5603  });
5604
5605  [].concat(_toConsumableArray(btnFormLogin)).forEach(function (btn) {
5606    btn.addEventListener('click', function () {
5607      formLoginJoinHandler(formLogin);
5608    });
5609  });
5610  [].concat(_toConsumableArray(btnFormJoin)).forEach(function (btn) {
5611    btn.addEventListener('click', function () {
5612      formLoginJoinHandler(formJoin);
5613    });
5614  });
5615  [].concat(_toConsumableArray(btnFormPassword)).forEach(function (btn) {
5616    btn.addEventListener('click', function () {
5617      formLoginJoinHandler(formPassword);
5618    });
5619  });
5620  [].concat(_toConsumableArray(formUsername)).forEach(function (btn) {
5621    btn.addEventListener('click', function () {
5622      formLoginJoinHandler(formUsername);
5623    });
5624  });
5625  [].concat(_toConsumableArray(btnFormDeleteAccount)).forEach(function (btn) {
5626    btn.addEventListener('click', function () {
5627      formLoginJoinHandler(deleteAccountForm);
5628    });
5629  });
5630
5631  // [...passwordForm].forEach(form => {
5632  //   form.addEventListener('submit', (e) => {
5633  //     e.preventDefault()
5634
5635  //     const url = form.getAttribute('action')
5636  //     const data = getFormData(form)
5637
5638  //     fetch(url, {
5639  //       method: 'post',
5640  //       headers: new Headers({'content-type': 'application/json'}),
5641  //       body: JSON.stringify(data),
5642  //       credentials: 'same-origin'
5643  //     })
5644  //     .then(blob => blob.json())
5645  //     .then(json => {
5646  //       if (json.success) {
5647  //         notification('Check your email to reset the password')
5648  //       }
5649  //       if (json.error) {
5650  //         notification('Error')
5651  //         // notification(json.error)
5652
5653  //         if (json.action && json.action == 'login-popup') {
5654  //           let modal = document.querySelector('.review-modal')
5655  //           const btnOpenNav = document.querySelector('.js--openMemberNav').click()
5656  //           modalsHandler('close', modal)
5657  //         }
5658  //       }
5659  //     })
5660  //     .then(() => {
5661  //       location.reload(1)
5662  //     })
5663  //     .catch(err => console.error(err))
5664
5665  //   })
5666  // });
5667
5668  [].concat(_toConsumableArray(deleteAccountForm)).forEach(function (form) {
5669    // alert('dupaaaaa')
5670    // form.addEventListener('submit', (e) => {
5671    //   e.preventDefault()
5672
5673    //   const url = form.getAttribute('action')
5674    //   const data = getFormData(form)
5675
5676    //   fetch(url, {
5677    //     method: 'post',
5678    //     headers: new Headers({'content-type': 'application/json'}),
5679    //     body: JSON.stringify(data),
5680    //     credentials: 'same-origin'
5681    //   })
5682    //   .then(blob => blob.json())
5683    //   .then(json => {
5684    //     if (json.success) {
5685    //       notification('Check your email to reset the password')
5686    //     }
5687    //     if (json.error) {
5688    //       notification('Error')
5689    //       // notification(json.error)
5690
5691    //       if (json.action && json.action == 'login-popup') {
5692    //         let modal = document.querySelector('.review-modal')
5693    //         const btnOpenNav = document.querySelector('.js--openMemberNav').click()
5694    //         modalsHandler('close', modal)
5695    //       }
5696    //     }
5697    //   })
5698    //   .then(() => {
5699    //     location.reload(1)
5700    //   })
5701    //   .catch(err => console.error(err))
5702
5703    // })
5704  });
5705
5706  function hashchange() {
5707    if (location.hash.length > 0 && btnOpenNav[0] && ["#login", "#signup", "#forgotpassword"].includes(location.hash)) {
5708      btnOpenNav[0].click();
5709      if (location.hash == "#signup") btnFormJoin[0].click();else if (location.hash == "#forgotpassword") btnFormPassword[0].click();
5710      var automodal = document.querySelector(".js--autoModal.modal--displaying");
5711      if (automodal) automodal.classList.remove("modal--displaying");
5712    }
5713  }
5714
5715  window.addEventListener("hashchange", hashchange, false);
5716  hashchange();
5717};
5718
5719},{"../helpers/helpers":3,"get-form-data":153}],35:[function(require,module,exports){
5720"use strict";
5721
5722Object.defineProperty(exports, "__esModule", {
5723  value: true
5724});
5725
5726var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
5727
5728var _helpers = require("../helpers/helpers");
5729
5730var _getFormData = require("get-form-data");
5731
5732var _getFormData2 = _interopRequireDefault(_getFormData);
5733
5734function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5735
5736function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
5737
5738exports.default = function (app) {
5739  if (!document.querySelector(".page__container--member-settings")) return;
5740
5741  var memberEditForm = document.querySelector(".memberedit-form__form");
5742  var uploadAvatarTrigger = document.querySelector(".js--upload-avatar");
5743  var uploadAvatarInput = document.querySelector("#upload-avatar");
5744  var uploadAvatarForm = document.querySelector("#upload-avatar-form");
5745
5746  uploadAvatarTrigger.addEventListener("click", function (e) {
5747    e.preventDefault();
5748    uploadAvatarInput.click();
5749  });
5750
5751  uploadAvatarInput.addEventListener("change", function (e) {
5752    e.preventDefault();
5753    // uploadAvatarForm.submit() // not submitting it in a manual way now
5754
5755    // update image preview if the avatar was changed
5756
5757    var _uploadAvatarInput$fi = _slicedToArray(uploadAvatarInput.files, 1),
5758        file = _uploadAvatarInput$fi[0];
5759
5760    if (file) {
5761      var avatarEditWrapper = document.querySelector(".member-avatar-edit");
5762      if (avatarEditWrapper) {
5763        var avatar = avatarEditWrapper.querySelector(".round-image");
5764        if (avatar) {
5765          avatar.style.backgroundImage = "url(" + URL.createObjectURL(file) + ")";
5766        }
5767      }
5768    }
5769
5770    // Do POST request to update the avatar.
5771    var url = uploadAvatarTrigger.dataset.action;
5772    if (!url) return false;
5773
5774    if (file && url) {
5775      var formData = new FormData();
5776      formData.append("avatar", file);
5777
5778      fetch(url, {
5779        method: "post",
5780        // headers: { "Content-Type": "multipart/form-data" },
5781        body: formData,
5782        credentials: "same-origin"
5783      }).then(function (blob) {
5784        return blob.json();
5785      }).then(function (json) {
5786        return console.log("image updated");
5787      });
5788    }
5789
5790    return false;
5791  });
5792
5793  memberEditForm.addEventListener("submit", function (e) {
5794    e.preventDefault();
5795
5796    var data = (0, _getFormData2.default)(memberEditForm);
5797    var url = memberEditForm.getAttribute("action");
5798
5799    fetch(url, {
5800      method: "post",
5801      headers: new Headers({ "content-type": "application/json" }),
5802      body: JSON.stringify(data),
5803      credentials: "same-origin"
5804    }).then(function (blob) {
5805      return blob.json();
5806    }).then(function (json) {
5807      //console.log(json, "response from the form");
5808      if (json.data.status) {
5809        var successMessage = json.success;
5810        var successMessageWrapper = document.querySelector('.js-success-message');
5811        if (successMessageWrapper) {
5812          successMessageWrapper.classList.add('is-visible');
5813          var successTextArea = document.querySelector('.js-success-message-json');
5814          successTextArea.innerHTML = successMessage + ' ';
5815        }
5816
5817        if (json.redirect) window.location.href = json.redirect;
5818      } else {
5819        var _successMessage = json.failure;
5820        var _successMessageWrapper = document.querySelector('.js-success-message');
5821        if (_successMessageWrapper) {
5822          _successMessageWrapper.classList.add('is-visible');
5823          var _successTextArea = document.querySelector('.js-success-message-json');
5824          _successTextArea.innerHTML = _successMessage + ' ';
5825        }
5826        // if (json.data.status) {
5827      }
5828      //   if (json.data.username) {
5829      //     window.location.href =
5830      //       "/member/" + json.data.username + "/dashboard/";
5831      //   } else {
5832      //     window.location.reload(true);
5833      //   }
5834      // }
5835    }).catch(function (error) {});
5836    return false;
5837  });
5838
5839  /* watch list functions and events */
5840  var watchlistSwitchItems = document.querySelectorAll(".my-watchlist__view-switcher a.switcher__item");
5841  var watchlistDivLists = document.querySelectorAll("div.my-watchlist-div");
5842
5843  function _toggleActiveWatchListDivs(activeDiv) {
5844    [].concat(_toConsumableArray(watchlistDivLists)).forEach(function (watchlistDiv) {
5845      watchlistDiv.classList.add("hidden");
5846      //adding hidden class does not stop elements displaying as 'grid'
5847      watchlistDiv.style.display = "none";
5848    });
5849    if (activeDiv) {
5850      activeDiv.classList.remove("hidden");
5851      activeDiv.style.display = activeDiv.getAttribute("data-displaystyle");
5852    }
5853  }
5854
5855  //function to toggle different views of the watch list
5856  function toggleActiveWatchListSwitchItem(activeSwitchItem) {
5857    [].concat(_toConsumableArray(watchlistSwitchItems)).forEach(function (watchlistSwitchItem) {
5858      watchlistSwitchItem.classList.remove("switcher__item--selected");
5859    });
5860    if (activeSwitchItem) {
5861      activeSwitchItem.classList.add("switcher__item--selected");
5862    }
5863
5864    //now show the correct div list
5865    if (activeSwitchItem) {
5866      var targetList = document.querySelector("div.my-watchlist-div." + activeSwitchItem.getAttribute("data-listclass"));
5867      if (targetList) {
5868        _toggleActiveWatchListDivs(targetList);
5869      }
5870    }
5871  }
5872
5873  //click event on the watch list swtich
5874  [].concat(_toConsumableArray(watchlistSwitchItems)).forEach(function (watchlistSwitchItem) {
5875    watchlistSwitchItem.addEventListener("click", function (e) {
5876      e.preventDefault();
5877      var targetList = document.querySelector("div.my-watchlist-div." + e.currentTarget.getAttribute("data-listclass"));
5878      toggleActiveWatchListSwitchItem(e.currentTarget);
5879    });
5880  });
5881
5882  //init function after page loaded
5883  function initWatchListDivs() {
5884    var currentActiveWatchlistSwitchItem = document.querySelector("a.switcher__item.switcher__item--selected");
5885    toggleActiveWatchListSwitchItem(currentActiveWatchlistSwitchItem);
5886  }
5887  //set the current active one
5888  window.addEventListener("loaded", initWatchListDivs());
5889};
5890
5891},{"../helpers/helpers":3,"get-form-data":153}],36:[function(require,module,exports){
5892"use strict";
5893
5894var mobileHeaders = document.querySelectorAll(".mobile-header");
5895
5896mobileHeaders.forEach(function (header) {
5897    var burgerOpen = header.querySelector(".js-mobile-menu-open");
5898    var closeMenu = header.querySelector(".js-mobile-menu-close");
5899    var flyOutMenu = header.querySelector(".js-mobile-flyout");
5900
5901    if (burgerOpen && flyOutMenu) {
5902        burgerOpen.addEventListener("click", function () {
5903            flyOutMenu.classList.add("is-visible");
5904        });
5905    }
5906
5907    if (closeMenu && flyOutMenu) {
5908        closeMenu.addEventListener("click", function () {
5909            flyOutMenu.classList.remove("is-visible");
5910        });
5911    }
5912});
5913
5914// Right side flyout
5915var flyoutRightOpen = document.querySelector('.js-flyout-right-open');
5916var flyoutRightClose = document.querySelector('.js-flyout-right-close');
5917var flyOutRightMenu = document.querySelector('.js-mobile-flyout-right');
5918
5919if (flyoutRightOpen && flyOutRightMenu) {
5920    flyoutRightOpen.addEventListener('click', function (e) {
5921        flyOutRightMenu.classList.add('is-visible');
5922    });
5923}
5924
5925if (flyoutRightClose && flyOutRightMenu) {
5926    flyoutRightClose.addEventListener('click', function (e) {
5927        flyOutRightMenu.classList.remove('is-visible');
5928    });
5929}
5930
5931// Desktop
5932var flyoutTrigger = document.querySelector('.js-desktop-flyout-open');
5933var flyoutMenu = document.querySelector('.js-desktop-flyout');
5934
5935if (flyoutTrigger && flyoutMenu) {
5936    var isHovering = false;
5937
5938    var showMenu = function showMenu() {
5939        flyoutMenu.classList.add('is-visible');
5940    };
5941
5942    var hideMenu = function hideMenu() {
5943        setTimeout(function () {
5944            if (!isHovering) {
5945                flyoutMenu.classList.remove('is-visible');
5946            }
5947        }, 100);
5948    };
5949
5950    flyoutTrigger.addEventListener('mouseenter', function () {
5951        isHovering = true;
5952        showMenu();
5953    });
5954
5955    flyoutTrigger.addEventListener('mouseleave', function () {
5956        isHovering = false;
5957        hideMenu();
5958    });
5959
5960    flyoutMenu.addEventListener('mouseenter', function () {
5961        isHovering = true;
5962        showMenu();
5963    });
5964
5965    flyoutMenu.addEventListener('mouseleave', function () {
5966        isHovering = false;
5967        hideMenu();
5968    });
5969}
5970
5971},{}],37:[function(require,module,exports){
5972"use strict";
5973
5974Object.defineProperty(exports, "__esModule", {
5975  value: true
5976});
5977exports.addModalOpenListeners = undefined;
5978
5979var _helpers = require("../helpers/helpers");
5980
5981var _jsCookie = require("js-cookie");
5982
5983var _jsCookie2 = _interopRequireDefault(_jsCookie);
5984
5985function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5986
5987function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
5988
5989// to open a modal, give the trigger a class of 'js--openModal'
5990// and a 'data-modal-id' attribute of the id of the modal you would like to open
5991
5992function addModalOpenListeners(buttons) {
5993  [].concat(_toConsumableArray(buttons)).forEach(function (open) {
5994    open.addEventListener("click", function (e) {
5995      var onlyForLoggedInUsers = e.target.classList.contains("js-pass-movie-data") ? true : false;
5996
5997      if (onlyForLoggedInUsers) {
5998        var user = e.target.getAttribute("data-user");
5999        var list = e.target.getAttribute("data-list");
6000        var slug = e.target.getAttribute("data-slug");
6001        var isOn = e.target.getAttribute("data-on");
6002        if (!list || !slug || !isOn) return;
6003        if (!user) {
6004          //session cookie, the value of list 'move' is not the real type of the selected record [movie, tv], don't rely on this, let's use the current url instead
6005          if (cookie_ok) _jsCookie2.default.set("login_redirect", document.location.href);
6006          _jsCookie2.default.set("watchlist_add", slug);
6007          location.href = "/member/login/";
6008          return;
6009        }
6010      }
6011
6012      if (e.target.classList.contains('js-preventDefault')) {
6013        e.preventDefault();
6014      }
6015
6016      var modalID = e.currentTarget.getAttribute("data-modal-id");
6017      var modal = document.getElementById(modalID);
6018      if (modal) (0, _helpers.modalsHandler)("open", modal);else console.error(modalID, "modal doesn't exist");
6019    });
6020  });
6021}
6022
6023function setupEventListeners() {
6024  var modalOpen = document.querySelectorAll(".js--openModal");
6025  var modalClose = document.querySelectorAll(".js--closeModal");
6026  var modalBackgrounds = document.querySelectorAll(".modal--opacity");
6027  var autoOpen = document.querySelector(".js--autoModal");
6028  var autoClose = document.querySelector(".js--autoCloseModal");
6029
6030  addModalOpenListeners(modalOpen);
6031
6032  [].concat(_toConsumableArray(modalClose)).forEach(function (close) {
6033    close.addEventListener("click", function (e) {
6034      var el = e.currentTarget;
6035      var modal = null;
6036      // get parent modal
6037      do {
6038        if (el.matches(".js-modal")) {
6039          modal = el;
6040          break;
6041        }
6042        el = el.parentElement || el.parentNode;
6043      } while (el !== null && el.nodeType === 1);
6044
6045      if (modal) (0, _helpers.modalsHandler)("close", modal);else console.error("can't find modal to close");
6046    });
6047  });
6048
6049  [].concat(_toConsumableArray(modalBackgrounds)).forEach(function (m) {
6050    m.addEventListener("click", function (e) {
6051      if (e.target === m) {
6052        (0, _helpers.modalsHandler)("close", m);
6053      }
6054    });
6055  });
6056
6057  if (autoOpen) {
6058    (0, _helpers.modalsHandler)("open", autoOpen);
6059  }
6060
6061  if (autoClose) {
6062    //automatically close the modal
6063    setTimeout(function () {
6064      (0, _helpers.modalsHandler)("close", autoClose);
6065    }, defaultAlertCloseTime);
6066  }
6067
6068  document.onkeydown = function (evt) {
6069    evt = evt || window.event;
6070    var isEscape = false;
6071    if ("key" in evt) {
6072      isEscape = evt.key === "Escape" || evt.key === "Esc";
6073    } else {
6074      isEscape = evt.keyCode === 27;
6075    }
6076    if (isEscape) {
6077      var modals = document.querySelectorAll(".modal--displaying");
6078      if (modals.length) {
6079        (0, _helpers.modalsHandler)("close", [].concat(_toConsumableArray(modals)).slice(-1).pop());
6080      }
6081    }
6082  };
6083}
6084
6085exports.default = function (app) {
6086  // Initialize listeners on page load
6087  setupEventListeners();
6088
6089  // Monitor dynamic content changes using MutationObserver
6090  // Skip MutationObserver on OTP confirmation page to prevent interference with countdown timer
6091  var isOtpConfirmPage = window.location.pathname.includes('/otp-confirm');
6092
6093  // Monitor dynamic content changes using MutationObserver
6094  if (!isOtpConfirmPage) {
6095    var observer = new MutationObserver(function () {
6096      setupEventListeners();
6097    });
6098
6099    // Set up observer to monitor the body for changes
6100    observer.observe(document.body, {
6101      childList: true,
6102      subtree: true
6103    });
6104  }
6105};
6106
6107exports.addModalOpenListeners = addModalOpenListeners;
6108
6109},{"../helpers/helpers":3,"js-cookie":171}],38:[function(require,module,exports){
6110'use strict';
6111
6112var _helpers = require('../helpers/helpers');
6113
6114var moviePosterWrap = document.querySelector('.js-movie-poster');
6115var movieModal = document.querySelector('.js-movie-modal');
6116var movieModalClose = document.querySelector('.js--close-movie-popup');
6117var posterContainer = document.querySelector('.js-movie-modal__content');
6118var isPosterLoaded = false;
6119
6120var hash = window.location.hash;
6121
6122if (hash === '#poster') {
6123    showPoster();
6124}
6125
6126moviePosterWrap && moviePosterWrap.addEventListener('click', function (e) {
6127    return showPoster(e);
6128});
6129movieModalClose && movieModalClose.addEventListener('click', function (e) {
6130    return hidePoster(e);
6131});
6132
6133function showPoster(e) {
6134    var bigPoster = moviePosterWrap.dataset.poster;
6135    if (!bigPoster) return;
6136
6137    // Open modal
6138    e && e.preventDefault();
6139    (0, _helpers.modalsHandler)('open', movieModal);
6140
6141    // Load image only if opened for the first time
6142    if (!isPosterLoaded) {
6143        var posterImg = document.createElement('img');
6144        posterImg.src = bigPoster;
6145        posterContainer.appendChild(posterImg);
6146        isPosterLoaded = true;
6147    }
6148}
6149
6150function hidePoster(e) {
6151    (0, _helpers.modalsHandler)('close', movieModal);
6152}
6153
6154},{"../helpers/helpers":3}],39:[function(require,module,exports){
6155'use strict';
6156
6157Object.defineProperty(exports, "__esModule", {
6158  value: true
6159});
6160
6161var _lory = require('lory.js');
6162
6163var _helpers = require('../helpers/helpers');
6164
6165function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6166
6167exports.default = function (app) {
6168  if (!document.querySelector('.js_slider')) return;
6169
6170  var sliders = document.querySelectorAll('.js_slider');
6171  var dotContainers = Array.from(document.querySelectorAll('.js_dots')); // - declared dotContainers outside the forEach otherwise, on slide, the dots update would affect only the last .js_dots on the page
6172  var dotCount = void 0;
6173  var dotListItem = void 0;
6174  var events = ['before.lory.init', 'after.lory.init', 'after.lory.slide', 'on.lory.resize'];
6175
6176  [].concat(_toConsumableArray(sliders)).forEach(function (slider, i) {
6177    dotCount = slider.querySelectorAll('.js_slide').length;
6178    dotListItem = document.createElement('li');
6179
6180    events.forEach(function (event) {
6181      return slider.addEventListener(event, function (e) {
6182        return (0, _helpers.handleDotEvent)(e, slider, dotCount, dotContainers[i], dotListItem);
6183      });
6184    });
6185
6186    if (dotCount > 0) {
6187      slider.classList.add("carousel--active");
6188      var leftArrow = slider.querySelector('.js--carousel__left');
6189      var rightArrow = slider.querySelector('.js--carousel__right');
6190    }
6191
6192    (0, _lory.lory)(slider, {
6193      // infinite: 1,
6194      infinite: false,
6195      enableMouseEvents: true,
6196      slideToScroll: 1,
6197      rewindOnResize: false
6198    });
6199  });
6200};
6201
6202},{"../helpers/helpers":3,"lory.js":175}],40:[function(require,module,exports){
6203'use strict';
6204
6205var _connectFlash = require('connect-flash');
6206
6207var _connectFlash2 = _interopRequireDefault(_connectFlash);
6208
6209var _smoothscroll = require('smoothscroll');
6210
6211var _smoothscroll2 = _interopRequireDefault(_smoothscroll);
6212
6213var _helpers = require('../helpers/helpers');
6214
6215function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6216
6217var allButtons = document.querySelectorAll('.js-movie-state-button');
6218var movieTabs = document.querySelector('#movie-tabs');
6219
6220if (allButtons) {
6221    allButtons.forEach(function (button) {
6222        button.addEventListener('click', function (e) {
6223            // movieTabs.scrollIntoView({behavior: "smooth"});
6224            (0, _smoothscroll2.default)(movieTabs, 600);
6225
6226            var tabContainer = document.querySelector('.tabs__container--single-movie');
6227            var tabsTriggers = tabContainer.querySelectorAll('.tabs__tab');
6228            var tabsContent = tabContainer.querySelectorAll('.tab__content');
6229            var trigger = void 0;
6230            if (e.target.classList.contains('js-movie-state-button--streaming')) {
6231                trigger = document.querySelector('.tabs__tab--streaming');
6232            } else {
6233                trigger = document.querySelector('.tabs__tab--cinema');
6234                if (!trigger) {
6235                    trigger = document.querySelector('.tabs__tab--incinemas');
6236                }
6237            }
6238
6239            // Remove active state on all tabs
6240            var allActiveTabs = tabContainer.querySelectorAll('.tabs__tab--active');
6241            allActiveTabs.forEach(function (tab) {
6242                tab.classList.remove('tabs__tab--active');
6243            });
6244
6245            // hide active tab content
6246            var currentlyActive = document.querySelector('.tab__content--active');
6247            if (currentlyActive) {
6248                currentlyActive.classList.remove('tab__content--active');
6249            }
6250
6251            // Add active state to currently picked tab
6252            trigger.classList.add('tabs__tab--active');
6253
6254            // show currently picked tab's content
6255            var tabContent = void 0;
6256            if (trigger.classList.contains('tabs__tab--incinemas')) {
6257                tabContent = document.querySelector('.tab__content--incinemas');
6258            } else {
6259                tabContent = document.querySelector('.tab__content--streaming');
6260            }
6261
6262            tabContent.classList.add('tab__content--active');
6263        });
6264    });
6265}
6266
6267// cinemas
6268
6269},{"../helpers/helpers":3,"connect-flash":127,"smoothscroll":191}],41:[function(require,module,exports){
6270"use strict";
6271
6272Object.defineProperty(exports, "__esModule", {
6273  value: true
6274});
6275exports.movieLoadDefault = exports.movieGeoSuccess = exports.movieSelectRegion = undefined;
6276
6277var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
6278
6279var _jsCookie = require("js-cookie");
6280
6281var _jsCookie2 = _interopRequireDefault(_jsCookie);
6282
6283var _smoothscroll = require("smoothscroll");
6284
6285var _smoothscroll2 = _interopRequireDefault(_smoothscroll);
6286
6287var _helpers = require("../helpers/helpers");
6288
6289var _geo = require("./geo");
6290
6291function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6292
6293function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6294
6295var moviePage = document.querySelector(".movie");
6296var movieSlug = moviePage ? moviePage.getAttribute("data-movie") : null;
6297var movieTimes = document.querySelector(".movie__times");
6298
6299var timesWrapper = document.querySelector(".js--movieTimesAjax");
6300
6301var ajaxTrigger = timesWrapper ? timesWrapper.getAttribute("data-ajaxtrigger") : null;
6302
6303var isTMP = timesWrapper ? timesWrapper.hasAttribute("data-tmp") : null;
6304var MOVIE_TIMES_SKELETON_COUNT = 4;
6305
6306var geoCookie = _jsCookie2.default.getJSON("geo") || {};
6307
6308var loaderHandler = function loaderHandler(cond) {
6309  if (movieTimes) {
6310    cond == "show" ? movieTimes.classList.add("movie__times--loading") : movieTimes.classList.remove("movie__times--loading");
6311  }
6312};
6313
6314// times calendar
6315var calendarTabs = void 0;
6316var timesTabs = void 0;
6317var jsTimesTabs = void 0;
6318var regionSwitchers = void 0;
6319var scrollContainer = void 0;
6320
6321function selectRegion(region) {
6322  loaderHandler("show");
6323
6324  if (calendarTabs) {
6325    [].concat(_toConsumableArray(calendarTabs)).forEach(function (tab, i) {
6326      tab.removeEventListener("click", function () {
6327        (0, _helpers.tabsHandler)(tab, i, calendarTabs, timesTabs, "times-calendar__el--active", "timetable__day--active", scrollContainer);
6328
6329        // placeDynamicParallax();
6330      });
6331    });
6332  }
6333  loadTimes("/movie/times/" + movieSlug + "/" + region.slug + "/", region.title);
6334}
6335
6336function geoSuccess() {
6337  if (calendarTabs) {
6338    [].concat(_toConsumableArray(calendarTabs)).forEach(function (tab, i) {
6339      tab.removeEventListener("click", function () {
6340        (0, _helpers.tabsHandler)(tab, i, calendarTabs, timesTabs, "times-calendar__el--active", "timetable__day--active", scrollContainer);
6341        // placeDynamicParallax();
6342      });
6343    });
6344  }
6345  loadTimes("/movie/geotimes/" + movieSlug + "/", null, true);
6346}
6347
6348function loadDefault() {
6349  loadTimes("/movie/times/" + movieSlug + "/");
6350}
6351
6352// load times function
6353function loadTimes(url, region, isGeo, isCookie) {
6354  var selectedItem = document.querySelector(".js--dropdownSelectedItem");
6355  var selectedItemText = selectedItem.querySelector(".js--location-select--text");
6356  if (isTMP) url = url + "?tmp=1";
6357  fetch(url, { credentials: "same-origin", headers: { "is-ajax-call": "yes" } }).then(function (blob) {
6358    return blob.text();
6359  }).then(function (text) {
6360    loaderHandler("hide");
6361    timesWrapper.innerHTML = text;
6362  }).then(function () {
6363    // if the region has been selected from the dropdown (so doesn't come from the cookies - see eventListener below)
6364    // change copy in the dropdown and scroll
6365
6366    loadSessions();
6367    createCountdownTimer();
6368
6369    if (region) {
6370      selectedItemText.textContent = region;
6371      // if (!isCookie) smoothScroll(movieTimes.offsetTop - 200);
6372    }
6373
6374    if (isGeo) {
6375      selectedItemText.textContent = "Near You";
6376    }
6377
6378    // if (typeof googletag !== undefined) {
6379    // placeDynamicParallax();
6380    // }
6381  }).catch(function (err) {
6382    return console.error(err);
6383  });
6384}
6385
6386function getMovieTimesSkeletonMarkup() {
6387  return Array.from({ length: MOVIE_TIMES_SKELETON_COUNT }, function () {
6388    return '<article class="timetable__article js--timesCard movie-times__article movie-times__article--placeholder" aria-hidden="true">' + '<div class="movie-times__cinema__heading">' + '<div class="movie-times__cinema__heading-placeholder">' + '<div class="movie-times__cinema__img movie-times__cinema__img--placeholder"></div>' + '<div class="movie-times__cinema__copy movie-times__cinema__copy--placeholder">' + '<span class="movie-times__title-skeleton"></span>' + '<span class="movie-times__distance-skeleton"></span>' + '</div>' + '</div>' + '</div>' + '<div class="movie-times__sessions-skeleton">' + '<div class="movie-times__sessions-skeleton-grid">' + '<span class="movie-times__session-skeleton"></span>' + '<span class="movie-times__session-skeleton"></span>' + '</div>' + '</div>' + '</article>';
6389  }).join("");
6390}
6391
6392function renderTimesSkeleton(activeDay) {
6393  if (!activeDay) return;
6394  activeDay.innerHTML = getMovieTimesSkeletonMarkup();
6395  activeDay.classList.add("is-visible");
6396}
6397
6398function loadSessions() {
6399  var activeDay = document.querySelector(".timetable__day--active");
6400  if (!activeDay) return;
6401  var activeCalendarTab = document.querySelector(".times-calendar__el--active");
6402  var previousMarkup = activeDay.innerHTML;
6403  var activeDate = activeDay.getAttribute("data-date");
6404  var activeGeoType = activeDay.getAttribute("data-geotype");
6405  var url = "/movie/sessions/" + movieSlug + "/" + activeDate + "/" + activeGeoType + "/";
6406  if (isTMP) url = url + "?tmp=1";
6407  renderTimesSkeleton(activeDay);
6408  fetch(url, { credentials: "same-origin", headers: { "is-ajax-call": "yes" } }).then(function (blob) {
6409    return blob.text();
6410  }).then(function (text) {
6411    activeDay.innerHTML = text;
6412    activeDay.classList.add("is-visible");
6413    if (activeCalendarTab) {
6414      activeCalendarTab.setAttribute("contentFetched", "true");
6415      activeCalendarTab._timesMarkupCache = text;
6416    }
6417  }).then(function () {
6418    (0, _helpers.timesCardsAnimation)(activeDay);
6419    if ((typeof googletag === "undefined" ? "undefined" : _typeof(googletag)) !== undefined) {
6420      placeDynamicParallax();
6421    }
6422  }).catch(function (err) {
6423    activeDay.innerHTML = previousMarkup;
6424    activeDay.classList.add("is-visible");
6425    console.error(err);
6426  });
6427}
6428
6429exports.default = function (app) {
6430  if (!moviePage || !timesWrapper) return;
6431  // done this after de-ajaxyfying the first load
6432  loadSessions();
6433  loaderHandler("hide");
6434  observerMutation();
6435
6436  if (calendarTabs) {
6437    [].concat(_toConsumableArray(calendarTabs)).forEach(function (tab, i) {
6438      tab.removeEventListener("click", function () {
6439        (0, _helpers.tabsHandler)(tab, i, calendarTabs, timesTabs, "times-calendar__el--active", "timetable__day--active", scrollContainer);
6440        // placeDynamicParallax();
6441      });
6442    });
6443  }
6444
6445  // setup observer to check on DOM changes due to ajax call
6446  // to then select the right nodes and add event listeners.
6447  // The event listeners get removed in the dropdown link 'click' function
6448  var observer = new MutationObserver(function (mutations) {
6449    mutations.forEach(function (mutation) {
6450      observerMutation();
6451    });
6452  });
6453
6454  // Observer config object - "At the very least, childList, attributes, or characterData must be set to true. Otherwise, "An invalid or illegal string was specified" error is thrown."
6455  // Source => https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
6456  var observerConfig = {
6457    attributes: true,
6458    childList: true,
6459    characterData: true
6460  };
6461
6462  // start observing
6463  observer.observe(timesWrapper, observerConfig);
6464
6465  if (ajaxTrigger) {
6466    window.addEventListener("load", function () {
6467      if (ajaxTrigger == "region" && geoCookie.region) {
6468        var regionTitle = document.querySelector(".js--geoRegionSelectTrigger[data-georegion='" + geoCookie.region + "']");
6469        // const activeDate = document.querySelector('.times-calendar__el--active').getAttribute("data-date");
6470        loaderHandler("show");
6471        loadTimes(
6472        // `/movie/times/${movieSlug}/${activeDate}/${geoCookie.region}/`,
6473        "/movie/times/" + movieSlug + "/" + geoCookie.region + "/", regionTitle && regionTitle.textContent ? regionTitle.textContent.trim() : null, false, true);
6474      } else if (ajaxTrigger == "gps") {
6475        loaderHandler("show");
6476        loadTimes("/movie/geotimes/" + movieSlug + "/", null);
6477      } else {
6478        loaderHandler("show");
6479        loadTimes("/movie/times/" + movieSlug + "/");
6480      }
6481    });
6482  }
6483};
6484
6485function placeDynamicParallax() {
6486  if (isTMP) return false; // not on TMP
6487  if (screenW == "desktop") return false; // we don't load this on desktop
6488  if (ads_provider == null) return false;
6489
6490  var currentAd = document.querySelector("#dyn-ads");
6491  if (currentAd != null) {
6492    currentAd.parentNode.removeChild(currentAd);
6493  }
6494  var activeTab = document.getElementsByClassName("timetable__day--active")[0];
6495  var activeTabDynAd = activeTab.querySelector("#dyn-ads");
6496  if (activeTabDynAd != null) {
6497    activeTabDynAd.parentNode.removeChild(activeTabDynAd);
6498  }
6499  var cards = activeTab.getElementsByClassName("js--timesCard");
6500  var addAfterEl = cards.length > 1 ? cards[1] : cards[cards.length - 1];
6501
6502  if (addAfterEl) {
6503    addAfterEl.outerHTML += '<div id="dyn-ads"><div id="div-gpt-ad-second"></div></div>';
6504  }
6505
6506  googletag.cmd.push(function () {
6507    googletag.display("div-gpt-ad-second");
6508    googletag.pubads().refresh([gptadslots[1]]);
6509  });
6510}
6511
6512function createCountdownTimer() {
6513  var countdownWrapper = document.querySelectorAll(".js-streaming-soon");
6514  if (countdownWrapper) {
6515    countdownWrapper.forEach(function (wrapper) {
6516      if (wrapper.childNodes.length > 1) return;
6517
6518      var countdown = JSON.parse(wrapper.dataset.countdown);
6519      countdown = countdown.split("-");
6520
6521      if (countdown.length == 3) {
6522        var config = {
6523          year: countdown[0],
6524          month: countdown[1],
6525          day: countdown[2],
6526          seconds: 0
6527        };
6528        simplyCountdown(wrapper, config);
6529      }
6530    });
6531  }
6532}
6533
6534function observerMutation() {
6535  calendarTabs = document.querySelectorAll(".times-calendar__el");
6536  timesTabs = document.querySelectorAll(".timetable__day");
6537  jsTimesTabs = document.querySelectorAll(".js--timesTab");
6538  regionSwitchers = document.querySelectorAll(".js--switch-region");
6539  scrollContainer = document.querySelector(".times-calendar__inner");
6540
6541  [].concat(_toConsumableArray(calendarTabs)).forEach(function (tab, i) {
6542    if (!tab.hasAttribute("clickEventAdded")) {
6543      tab.addEventListener("click", function () {
6544        (0, _helpers.tabsHandler)(tab, i, calendarTabs, timesTabs, "times-calendar__el--active", "timetable__day--active", scrollContainer, function () {
6545          var targetDay = timesTabs[i];
6546          var cachedMarkup = tab._timesMarkupCache || targetDay.innerHTML;
6547          timesTabs.forEach(function (tabEl) {
6548            tabEl.classList.remove("is-visible");
6549          });
6550          renderTimesSkeleton(targetDay);
6551          if (!tab.hasAttribute("contentFetched")) {
6552            loadSessions();
6553          } else {
6554            setTimeout(function () {
6555              targetDay.innerHTML = cachedMarkup;
6556              targetDay.classList.add("is-visible");
6557              (0, _helpers.timesCardsAnimation)(targetDay);
6558            }, 300);
6559          }
6560        });
6561
6562        // placeDynamicParallax();
6563      });
6564      if (i == 0) {
6565        tab.setAttribute("contentFetched", "true");
6566      }
6567      tab.setAttribute("clickEventAdded", "true");
6568    }
6569  });
6570
6571  (0, _geo.addRegionSwitchEvents)(regionSwitchers, geoCookie);
6572
6573  [].concat(_toConsumableArray(jsTimesTabs)).forEach(function (tab) {
6574    (0, _helpers.timesCardsAnimation)(tab);
6575  });
6576}
6577
6578exports.movieSelectRegion = selectRegion;
6579exports.movieGeoSuccess = geoSuccess;
6580exports.movieLoadDefault = loadDefault;
6581
6582},{"../helpers/helpers":3,"./geo":22,"js-cookie":171,"smoothscroll":191}],42:[function(require,module,exports){
6583'use strict';
6584
6585Object.defineProperty(exports, "__esModule", {
6586  value: true
6587});
6588exports.applyAutoLoad = exports.applyPagination = undefined;
6589
6590var _smoothscroll = require('smoothscroll');
6591
6592var _smoothscroll2 = _interopRequireDefault(_smoothscroll);
6593
6594var _listCarousel = require('./list-carousel');
6595
6596var _listCarousel2 = _interopRequireDefault(_listCarousel);
6597
6598var _tooltip = require('./tooltip');
6599
6600var _tooltip2 = _interopRequireDefault(_tooltip);
6601
6602function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6603
6604function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6605
6606// set global variable to count empty results, so we can stop the pagination when we reach the end of the list
6607var emptyResults = 0;
6608
6609exports.default = function (app) {
6610  var loadMoreBtn = document.querySelector('.js--paginationLoadMore');
6611  var pageContainer = document.querySelector('.js--paginationAppend');
6612  var autoLoad = document.querySelectorAll('.js--paginationLoadMoreAuto').length !== 0;
6613
6614  if (!loadMoreBtn || !pageContainer) return;
6615
6616  window.addEventListener('load', function () {
6617    applyPagination(pageContainer, loadMoreBtn, autoLoad);
6618  });
6619
6620  if (autoLoad) {
6621    applyAutoLoad(loadMoreBtn);
6622  }
6623};
6624
6625function scrollPositionToAutoLoad(loadMoreBtn) {
6626  var loadMoreBtnPosition = loadMoreBtn.offsetTop;
6627  var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;
6628  return window.scrollY > loadMoreBtnPosition - windowHeight;
6629}
6630
6631function applyAutoLoad(loadMoreBtn) {
6632  window.addEventListener('scroll', function () {
6633    var buttonActive = loadMoreBtn.style.pointerEvents === "auto";
6634    if (buttonActive && scrollPositionToAutoLoad(loadMoreBtn)) {
6635      loadMoreBtn.click();
6636    }
6637  });
6638}
6639
6640function applyPagination(pageContainer, loadMoreBtn) {
6641  var autoLoad = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6642
6643  // the content of the next page is pre-loaded and stored in tempEl
6644  // When the LoadMore button is clicked it appends the content to pageContainer
6645  // And then pre-loads the next page ready for the next click
6646  var tempEl = void 0;
6647
6648  loadContent(loadMoreBtn.getAttribute('href'), function (content) {
6649    tempEl = content;
6650    loadMoreBtn.addEventListener('click', function (e) {
6651      e.preventDefault();
6652      loadMoreBtn.style.pointerEvents = null;
6653      loadMoreBtn.style.opacity = null;
6654      loadMoreBtn.parentNode.classList.add("pagination--loading");
6655      appendContentAndLoadNext(tempEl, pageContainer, loadMoreBtn, function (content) {
6656        tempEl = content;
6657        loadMoreBtn.style.pointerEvents = "auto";
6658        loadMoreBtn.style.opacity = "1";
6659        loadMoreBtn.parentNode.classList.remove("pagination--loading");
6660        if (autoLoad && scrollPositionToAutoLoad(loadMoreBtn)) {
6661          loadMoreBtn.click();
6662        }
6663      }, autoLoad);
6664    });
6665    loadMoreBtn.style.pointerEvents = "auto";
6666    loadMoreBtn.style.opacity = "1";
6667    loadMoreBtn.parentNode.classList.remove("pagination--loading");
6668    if (autoLoad && scrollPositionToAutoLoad(loadMoreBtn)) {
6669      loadMoreBtn.click();
6670    }
6671  });
6672}
6673
6674// fetch content
6675function loadContent(url, cb) {
6676  var request = new Request(url, {
6677    headers: new Headers({
6678      'is-ajax-call': 'yes'
6679    }),
6680    credentials: 'same-origin'
6681  });
6682  fetch(request).then(function (blob) {
6683    blob.text().then(function (text) {
6684      var tempEl = document.createElement('div');
6685      // save the html structure of the next page into the previously generated div
6686      tempEl.innerHTML = text;
6687      cb(tempEl);
6688
6689      // if (googletag) {
6690      //   googletag.pubads().refresh()
6691      // }
6692    });
6693  }).catch(function (err) {
6694    return console.error(err);
6695  });
6696}
6697
6698function dispatchPaginationAppended(pageContainer, elements) {
6699  var detail = {
6700    pageContainer: pageContainer,
6701    elements: [].concat(_toConsumableArray(elements))
6702  };
6703
6704  if (typeof window.CustomEvent === 'function') {
6705    window.dispatchEvent(new CustomEvent('pagination:appended', { detail: detail }));
6706    return;
6707  }
6708
6709  var evt = document.createEvent('CustomEvent');
6710  evt.initCustomEvent('pagination:appended', true, true, detail);
6711  window.dispatchEvent(evt);
6712}
6713
6714var appendContentAndLoadNext = function appendContentAndLoadNext(tempEl, pageContainer, loadMoreBtn, cb) {
6715  var autoLoad = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6716
6717  // if the HTML actually contains elements, then go on and get the href
6718  // attribute containing the next page from the pagination url in the requested html
6719  // append each elemnt to the pageContainer, change the href attribute
6720  // value with the new url, scroll down and load the next batch
6721  // OTHERWISE remove the pagination eventListener and let the user know that that's
6722  // all the content we've got
6723  var newLayout = document.querySelector('.js--paginationAppend--v2');
6724
6725  var elements = void 0;
6726  if (newLayout) {
6727    elements = tempEl.querySelectorAll('.js--paginationAppend .article-card__container > *');
6728  } else {
6729    elements = tempEl.querySelectorAll('.js--paginationAppend > *');
6730  }
6731
6732  if (elements.length === 0) {
6733    emptyResults++;
6734  } else {
6735    emptyResults = 0;
6736  }
6737
6738  var tempLoadMore = tempEl.querySelector('.js--paginationLoadMore');
6739
6740  if ((elements.length > 0 || emptyResults < 2) && tempLoadMore) {
6741    var nextPagination = tempLoadMore.getAttribute('href');
6742
6743    if (newLayout) {
6744      var newPageContainer = document.querySelector('.js-paginationAppend--v2');
6745      [].concat(_toConsumableArray(elements)).forEach(function (el) {
6746        return newPageContainer.appendChild(el);
6747      });
6748    } else {
6749      [].concat(_toConsumableArray(elements)).forEach(function (el) {
6750        return pageContainer.appendChild(el);
6751      });
6752    }
6753
6754    dispatchPaginationAppended(pageContainer, elements);
6755
6756    loadMoreBtn.setAttribute('href', nextPagination);
6757    if (!autoLoad) (0, _smoothscroll2.default)(window.scrollY + window.innerHeight / 3);
6758    loadContent(nextPagination, cb);
6759    if (typeof googletag !== 'undefined' && ads_provider == "google") {
6760      googletag.cmd.push(function () {
6761        googletag.display('div-gpt-ad-infinite');
6762        googletag.pubads().refresh([gptadslots[2]]);
6763      });
6764    }
6765    if (pageContainer.classList.contains("js--paginationCarousels")) {
6766      // reload carousels
6767      (0, _listCarousel2.default)(window.app);
6768      (0, _tooltip2.default)(pageContainer);
6769    }
6770  } else {
6771    paginationEnd(loadMoreBtn);
6772    return null;
6773  }
6774};
6775
6776function paginationEnd(loadMoreBtn) {
6777  loadMoreBtn.setAttribute('href', '#');
6778  loadMoreBtn.style.display = 'none';
6779  var wrapper = loadMoreBtn.closest('.js-pagination-wrapper');
6780  wrapper.style.display = 'none';
6781  // loadMoreBtn.style.pointerEvents = 'none'
6782  //loadMoreBtn.style.opacity = '1'
6783  loadMoreBtn.parentNode.classList.remove("pagination--loading");
6784  //loadMoreBtn.textContent = 'That\'s all folks!'
6785  // loadMoreBtn.removeEventListener('click', paginationStart)
6786}
6787
6788// function applyScrollTop(scrollTop){
6789// window.addEventListener('scroll', () => scrollTopHandler(scrollTop))
6790// scrollTop.addEventListener('click', () => smoothScroll(0))
6791// }
6792
6793function scrollTopHandler(scrollTop) {
6794  if (window.scrollY >= 2000 && scrollTop.classList.contains('hidden')) {
6795    scrollTop.classList.remove('hidden');
6796  } else if (window.scrollY <= 2000 && !scrollTop.classList.contains('hidden')) {
6797    scrollTop.classList.add('hidden');
6798  }
6799}
6800
6801exports.applyPagination = applyPagination;
6802exports.applyAutoLoad = applyAutoLoad;
6803
6804},{"./list-carousel":27,"./tooltip":54,"smoothscroll":191}],43:[function(require,module,exports){
6805"use strict";
6806
6807Object.defineProperty(exports, "__esModule", {
6808  value: true
6809});
6810
6811function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6812
6813exports.default = function (app) {
6814  var elements = document.querySelectorAll(".js--readmoreless");
6815  if (!elements) return;
6816
6817  [].concat(_toConsumableArray(elements)).forEach(function (element) {
6818
6819    var expand = element.querySelector(".readmoreless--expand");
6820    var collapse = element.querySelector(".readmoreless--collapse");
6821    var hidden = element.querySelector(".readmoreless--hidden");
6822    var ellipsis = element.querySelector(".readmoreless--ellipsis");
6823
6824    if (expand) {
6825      expand.addEventListener('click', function (e) {
6826        e.preventDefault();
6827        hidden.classList.remove("readmoreless--hidden");
6828        expand.classList.add("hidden");
6829        ellipsis.classList.add("hidden");
6830        collapse.classList.remove("hidden");
6831        element.classList.add('is-expanded');
6832      });
6833
6834      collapse.addEventListener('click', function (e) {
6835        e.preventDefault();
6836        hidden.classList.add("readmoreless--hidden");
6837        expand.classList.remove("hidden");
6838        ellipsis.classList.remove("hidden");
6839        collapse.classList.add("hidden");
6840        element.classList.remove('is-expanded');
6841      });
6842    }
6843  });
6844};
6845
6846},{}],44:[function(require,module,exports){
6847'use strict';
6848
6849Object.defineProperty(exports, "__esModule", {
6850	value: true
6851});
6852
6853function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6854
6855// I think this is old, no? Tom
6856exports.default = function (app) {
6857	var synopsisTrigger = document.querySelector('.js--readMoreSynopsis');
6858	var synopsis = document.querySelector('.description__synopsis');
6859	var reviewTriggers = document.querySelectorAll('.js--readMoreReview');
6860	var reviews = document.querySelectorAll('.review__body--user');
6861
6862	if (!synopsisTrigger || !reviewTriggers) return;
6863
6864	function triggersHandler() {
6865		// if(synopsis.childElementCount > 2) {
6866		// 	synopsisTrigger.style.display = 'inline-block'
6867		// }
6868
6869		// [...reviews].forEach((review, i) => {
6870		// 	review.childElementCount > 2
6871		// 	? reviewTriggers[i].style.display = 'inline-block'
6872		// 	: null
6873		// })
6874	}
6875
6876	function showMore(condition, triggerIndex) {
6877		if (condition === 'synopsis') {
6878			synopsisTrigger.parentNode.classList.toggle('description__synopsis--show-more');
6879		} else if (condition === 'review') {
6880			reviewTriggers[triggerIndex].parentNode.classList.toggle('review__body--show-more');
6881		} else {
6882			return;
6883		}
6884	}
6885
6886	window.addEventListener('load', triggersHandler);
6887	synopsisTrigger.addEventListener('click', function () {
6888		return showMore('synopsis');
6889	});
6890	[].concat(_toConsumableArray(reviewTriggers)).forEach(function (trigger, i) {
6891		trigger.addEventListener('click', function () {
6892			return showMore('review', i);
6893		});
6894	});
6895};
6896
6897},{}],45:[function(require,module,exports){
6898'use strict';
6899
6900Object.defineProperty(exports, "__esModule", {
6901	value: true
6902});
6903
6904function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6905
6906exports.default = function (app) {
6907	var regionsLists = document.querySelector('.regions-lists');
6908
6909	if (!regionsLists) return;
6910
6911	var body = document.querySelector('body');
6912	var stateTriggers = Array.from(document.querySelectorAll('.js--stateTrigger'));
6913	var openClass = 'regions-lists__region--open';
6914
6915	var regionsListsHandler = function regionsListsHandler() {
6916		var container = this.parentNode;
6917		if (container.classList.contains(openClass)) {
6918			container.classList.remove(openClass);
6919		} else {
6920			[].concat(_toConsumableArray(stateTriggers)).forEach(function (trigger) {
6921				return trigger.parentNode.classList.remove(openClass);
6922			});
6923			container.classList.add(openClass);
6924		}
6925	};
6926
6927	[].concat(_toConsumableArray(stateTriggers)).forEach(function (trigger) {
6928		return trigger.addEventListener('click', regionsListsHandler);
6929	});
6930};
6931
6932},{}],46:[function(require,module,exports){
6933'use strict';
6934
6935Object.defineProperty(exports, "__esModule", {
6936  value: true
6937});
6938
6939var _helpers = require('../helpers/helpers');
6940
6941var _getFormData = require('get-form-data');
6942
6943var _getFormData2 = _interopRequireDefault(_getFormData);
6944
6945function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6946
6947function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
6948
6949var formInit = false;
6950
6951function initReviewForm(formInner) {
6952
6953  if (formInit) return;
6954  formInit = true;
6955
6956  var form = formInner.querySelector('.review-form__form');
6957  var rateButtons = formInner.querySelectorAll('.js-rateThis');
6958  var rateInput = formInner.querySelector('#star-rating');
6959  var btnOpenReview = formInner.querySelector('.js--openReviewSection');
6960  var reviewSection = formInner.querySelector('.review-form__review-section');
6961
6962  var btnsStarsRates = document.querySelectorAll('.star-ratebtn');
6963  var modal = document.querySelector('.review-modal');
6964
6965  if (btnOpenReview) {
6966    btnOpenReview.addEventListener('click', function () {
6967      reviewSection.classList.add('review-form__review-section--open');
6968      btnOpenReview.classList.add('review-form__add-button--closed');
6969    });
6970  }
6971
6972  [].concat(_toConsumableArray(btnsStarsRates)).forEach(function (button) {
6973    return button.addEventListener('mouseover', function () {
6974      var selectedBtn = button.value;
6975      [].concat(_toConsumableArray(btnsStarsRates)).forEach(function (b) {
6976        var svg = b.querySelector('svg');
6977        svg.classList.remove('star');
6978        svg.classList.remove('starempty');
6979        if (b.value <= selectedBtn) {
6980          svg.classList.add('star');
6981        } else {
6982          svg.classList.add('starempty');
6983        }
6984      });
6985    });
6986  });
6987
6988  [].concat(_toConsumableArray(btnsStarsRates)).forEach(function (button) {
6989    return button.addEventListener('mouseout', function () {
6990      [].concat(_toConsumableArray(btnsStarsRates)).forEach(function (b) {
6991        var svg = b.querySelector('svg');
6992        svg.classList.remove('star');
6993        svg.classList.remove('starempty');
6994        var rating = b.getAttribute('data-rating');
6995        var rateInput = formInner.querySelector('#star-rating');
6996        var selectedRating = rateInput.value;
6997        // getAttribute gde god da si ga stavio
6998        if (rating <= selectedRating) {
6999          svg.classList.add('star');
7000        } else {
7001          svg.classList.add('starempty');
7002        }
7003      });
7004    });
7005  });
7006
7007  [].concat(_toConsumableArray(rateButtons)).forEach(function (b) {
7008    var svg = b.querySelector('svg');
7009    svg.classList.remove('star');
7010    svg.classList.remove('starempty');
7011    var rating = b.getAttribute('data-rating');
7012    var reviewModal = document.querySelector('.review-modal');
7013    var selectedRating = rateInput.value;
7014    // getAttribute gde god da si ga stavio
7015    if (rating <= selectedRating) {
7016      svg.classList.add('star');
7017    } else {
7018      svg.classList.add('starempty');
7019    }
7020  });
7021
7022  [].concat(_toConsumableArray(rateButtons)).forEach(function (button) {
7023    button.addEventListener('click', function (e) {
7024      var currentTarget = e.currentTarget;
7025      var selectedRating = currentTarget.getAttribute('data-rating');
7026      currentTarget.classList.add('selected');
7027      rateInput.value = selectedRating;
7028      [].concat(_toConsumableArray(rateButtons)).forEach(function (b) {
7029        var svg = b.querySelector('svg');
7030        svg.classList.remove('star');
7031        svg.classList.remove('starempty');
7032        var rating = b.getAttribute('data-rating');
7033        if (rating <= selectedRating) {
7034          svg.classList.add('star');
7035        } else {
7036          svg.classList.add('starempty');
7037        }
7038      });
7039    });
7040  });
7041
7042  // posting reviews here
7043  if (form) {
7044    form.addEventListener("submit", function (e) {
7045      e.preventDefault();
7046
7047      var url = form.getAttribute('action');
7048      var data = (0, _getFormData2.default)(form);
7049
7050      fetch(url, {
7051        method: 'post',
7052        headers: new Headers({ 'content-type': 'application/json' }),
7053        body: JSON.stringify(data),
7054        credentials: 'same-origin'
7055      }).then(function (blob) {
7056        return blob.json();
7057      }).then(function (json) {
7058        if (json.success) {
7059          var _modal = document.querySelector('.review-modal');
7060          (0, _helpers.modalsHandler)('close', _modal);
7061          location.reload(1);
7062        }
7063        if (json.error) {
7064          (0, _helpers.formerror)(json.error, ".review-form__submit");
7065        }
7066      }).catch(function (err) {
7067        return console.error(err);
7068      });
7069    });
7070  }
7071}
7072
7073function loadFormAndInit(movieSlug, formContainer) {
7074  fetch('/review-form/' + movieSlug, { credentials: 'same-origin', headers: { 'is-ajax-call': 'yes' } }).then(function (blob) {
7075    return blob.text();
7076  }).then(function (text) {
7077    // loaderHandler('hide');
7078    formContainer.innerHTML = text;
7079    var formInner = formContainer.querySelector(".review-form");
7080    initReviewForm(formInner);
7081    var modal = document.querySelector('.review-modal');
7082    (0, _helpers.modalsHandler)('open', modal);
7083  }).catch(function (err) {
7084    return console.error(err);
7085  });
7086}
7087
7088exports.default = function (app) {
7089  if (!document.querySelector('.js--openReviewForm')) return;
7090  var btnsOpenForm = document.querySelectorAll('.js--openReviewForm');
7091  var modal = document.querySelector('.review-modal');
7092  var btnCloseForm = modal.querySelector('.js--closeReviewForm');
7093  var formContainer = modal.querySelector('.js--reviewForm');
7094  var formInner = formContainer.querySelector(".review-form");
7095
7096  [].concat(_toConsumableArray(btnsOpenForm)).forEach(function (button) {
7097    return button.addEventListener('click', function (e) {
7098      e.preventDefault();
7099
7100      var forceReload = button.getAttribute("data-force-reload") ? true : false;
7101      if (!formInner || forceReload) {
7102        if (formInner) {
7103          formInner.innerHTML = "";
7104        }
7105        var movieSlug = button.getAttribute("data-movie-slug");
7106        loadFormAndInit(movieSlug, formContainer);
7107        formInner = formContainer.querySelector(".review-form");
7108        btnCloseForm.addEventListener('click', function () {
7109          return (0, _helpers.modalsHandler)('close', modal);
7110        });
7111        return;
7112      }
7113
7114      var rateInput = formInner.querySelector('#star-rating');
7115      if (!rateInput) {
7116        (0, _helpers.modalsHandler)('open', document.querySelector('.member-nav'));
7117      } else {
7118        rateInput.value = button.getAttribute("value");
7119        (0, _helpers.modalsHandler)('open', modal);
7120        initReviewForm(formInner);
7121      }
7122    });
7123  });
7124
7125  if (formInner) {
7126    initReviewForm(formInner);
7127  }
7128
7129  btnCloseForm.addEventListener('click', function () {
7130    return (0, _helpers.modalsHandler)('close', modal);
7131  });
7132};
7133
7134},{"../helpers/helpers":3,"get-form-data":153}],47:[function(require,module,exports){
7135"use strict";
7136
7137Object.defineProperty(exports, "__esModule", {
7138  value: true
7139});
7140exports.default = scrollWithQueryString;
7141function scrollWithQueryString() {
7142  var selector = ".js-scroll-with-query-string";
7143  var target = document.querySelector(selector);
7144
7145  if (!target) return;
7146
7147  function hasQueryString() {
7148    return !!window.location.search && window.location.search.length > 1;
7149  }
7150
7151  function scrollToTarget() {
7152    if (!hasQueryString()) return;
7153
7154    window.requestAnimationFrame(function () {
7155      target.scrollIntoView({
7156        behavior: "smooth",
7157        block: "start"
7158      });
7159    });
7160  }
7161
7162  scrollToTarget();
7163}
7164
7165},{}],48:[function(require,module,exports){
7166'use strict';
7167
7168Object.defineProperty(exports, "__esModule", {
7169  value: true
7170});
7171
7172var _helpers = require('../helpers/helpers');
7173
7174exports.default = function (app) {
7175  var nav = document.querySelector('.search-nav');
7176  if (!nav) return;
7177  var btnOpenNav = document.querySelectorAll('.js--openSearchNav');
7178  var btnCloseNav = nav.querySelector('.js--closeSearchNav');
7179  var formSearch = nav.querySelector('.js--searchNavForm');
7180  var formSearchInput = formSearch.querySelector('input');
7181  var targetEl = nav.querySelector('.js--searchNavResults');
7182  var suggestionEl = nav.querySelector('.js--searchNavSuggest');
7183  var background = nav.querySelector(".search-nav__content");
7184  var activeRequestId = 0;
7185
7186  function buildResultsSkeleton() {
7187    var rows = Array.from({ length: 5 }).map(function () {
7188      return '\n      <li class="search-nav__results-skeleton-item">\n        <div class="search-nav__results-skeleton-row">\n          <div class="search-nav__results-skeleton-thumb"></div>\n          <div class="search-nav__results-skeleton-copy">\n            <span class="search-nav__results-skeleton-line search-nav__results-skeleton-line--title"></span>\n            <span class="search-nav__results-skeleton-line search-nav__results-skeleton-line--meta"></span>\n          </div>\n          <div class="search-nav__results-skeleton-action"></div>\n        </div>\n      </li>\n    ';
7189    }).join('');
7190
7191    return '\n      <div class="search-nav__content__inner search-nav__content__inner--results search-nav__content__inner--loading" aria-hidden="true">\n        <p class="search-nav__suggestions-heading">Search suggestions</p>\n        <ul class="search-nav__results-skeleton-list">' + rows + '</ul>\n      </div>\n    ';
7192  }
7193
7194  function waitForHtmlImages(container) {
7195    var images = Array.from(container.querySelectorAll('img'));
7196
7197    if (!images.length) {
7198      return Promise.resolve();
7199    }
7200
7201    return Promise.all(images.map(function (img) {
7202      return new Promise(function (resolve) {
7203        if (img.complete) {
7204          resolve();
7205          return;
7206        }
7207
7208        img.addEventListener('load', resolve, { once: true });
7209        img.addEventListener('error', resolve, { once: true });
7210      });
7211    }));
7212  }
7213
7214  background.addEventListener("click", function (e) {
7215    if (e.target === e.currentTarget) {
7216      (0, _helpers.modalsHandler)("close", nav);
7217    }
7218  });
7219
7220  function setPlaceholderText() {
7221    var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.querySelector('body').clientWidth;
7222    if (windowWidth < 768) {
7223      formSearchInput.setAttribute("placeholder", "Search");
7224    } else {
7225      formSearchInput.setAttribute("placeholder", "What do you want to watch?");
7226    }
7227  }
7228  setPlaceholderText();
7229  window.addEventListener("resize", setPlaceholderText);
7230
7231  btnOpenNav.forEach(function (btn) {
7232    btn.addEventListener('click', function () {
7233      if (nav.classList.contains('modal--displaying')) {
7234        (0, _helpers.modalsHandler)('close', nav);
7235      } else {
7236        (0, _helpers.modalsHandler)('open', nav);
7237        formSearchInput.focus();
7238      }
7239    });
7240  });
7241
7242  btnCloseNav.addEventListener('click', function () {
7243    return (0, _helpers.modalsHandler)('close', nav);
7244  });
7245
7246  var timeout = null;
7247
7248  formSearchInput.addEventListener('keyup', function (e) {
7249    clearTimeout(timeout);
7250    timeout = setTimeout(function () {
7251      formSearchHandler(e);
7252    }, 600);
7253  });
7254
7255  function formSearchHandler(e) {
7256    var q = e.target.value;
7257    var requestId = ++activeRequestId;
7258
7259    if (q.length > 2) {
7260      var url = '/search/live/?q=' + q;
7261      targetEl.innerHTML = buildResultsSkeleton();
7262      suggestionEl.style.display = 'none';
7263
7264      fetch(url, { credentials: 'same-origin', headers: { 'is-ajax-call': 'yes' } }).then(function (blob) {
7265        return blob.text();
7266      }).then(function (html) {
7267        if (requestId !== activeRequestId) return;
7268
7269        var stagingEl = document.createElement('div');
7270        stagingEl.innerHTML = html;
7271
7272        return waitForHtmlImages(stagingEl).then(function () {
7273          if (requestId !== activeRequestId) return;
7274          targetEl.innerHTML = html;
7275          suggestionEl.style.display = 'none';
7276        });
7277      }).catch(function (err) {
7278        return console.error(err);
7279      });
7280    } else {
7281      activeRequestId += 1;
7282      suggestionEl.style.display = 'block';
7283      targetEl.innerHTML = '';
7284    }
7285  }
7286};
7287
7288},{"../helpers/helpers":3}],49:[function(require,module,exports){
7289'use strict';
7290
7291Object.defineProperty(exports, "__esModule", {
7292  value: true
7293});
7294var ShareButton = require('../helpers/share-button.js');
7295
7296exports.default = function (app) {
7297  var popupTrigger = document.querySelector('.share--popupTrigger');
7298  if (!popupTrigger) return;
7299
7300  function setShareURL() {
7301    //if the trailer modal is showing, return the trailer URL otherwise share the current page
7302    var trailer = document.querySelector('.trailer-modal.modal--displaying .trailer');
7303    if (trailer) {
7304      return window.location.protocol + "//" + window.location.host + trailer.getAttribute('data-url');
7305    } else {
7306      return window.location.href;
7307    }
7308  }
7309  function setEmailDescription(description) {
7310    return description + " " + setShareURL();
7311  }
7312
7313  // see config options here: https://github.com/carrot/share-button/blob/master/docs/configuration-options.md
7314
7315  var config = {
7316    ui: {
7317      networkOrder: ['facebook', 'twitter',
7318      // 'reddit',
7319      'email']
7320    },
7321    networks: {
7322      facebook: {
7323        load_sdk: false,
7324        // load_sdk:     // Load the FB SDK. If false, it will default to Facebook's sharer.php implementation.
7325        //               // NOTE: This will disable the ability to dynamically set values and rely directly on applicable Open Graph tags. [Default: true]
7326        // appId: '138719816181609',
7327        before: function before() {
7328          this.url = setShareURL();
7329        }
7330      },
7331      twitter: {
7332        before: function before() {
7333          this.url = setShareURL();
7334        }
7335      },
7336      // reddit: {
7337      //   before: function() {
7338      //     this.url = setShareURL()
7339      //   }
7340      // },
7341      email: {
7342        before: function before() {
7343          this.description = setEmailDescription(this.description);
7344        }
7345      }
7346    }
7347  };
7348
7349  popupTrigger.addEventListener('click', function () {
7350    return popupTrigger.classList.toggle('share--popupTriggerActive');
7351  });
7352
7353  new ShareButton(config);
7354};
7355
7356},{"../helpers/share-button.js":4}],50:[function(require,module,exports){
7357"use strict";
7358
7359var _toggleFormLoader = require("./../helpers/toggle-form-loader");
7360
7361function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
7362
7363var signupForms = document.querySelectorAll('.js-signup-form');
7364
7365if (signupForms) {
7366  [].concat(_toConsumableArray(signupForms)).forEach(function (form) {
7367    form.addEventListener("submit", async function (e) {
7368      e.preventDefault();
7369
7370      var spinner = form.querySelector('.spinner');
7371      var button = form.querySelector('.js-form-button');
7372      var buttonText = form.querySelector('.text');
7373      var formContent = form.querySelector('.js-form-content');
7374      var message = form.querySelector(".signup-form-message");
7375      var emailField = form.querySelector("[name=email]");
7376
7377      // Show spinner and disable button
7378      spinner.classList.remove('is-hidden');
7379      buttonText.classList.add('is-hidden');
7380      button.disabled = true;
7381
7382      var response = await fetch(form.action, {
7383        method: 'post',
7384        body: new URLSearchParams(new FormData(form))
7385      });
7386      var json = await response.json();
7387
7388      if (json.success) {
7389        message.classList.remove('error');
7390        message.classList.add('success');
7391        formContent.classList.add('is-hidden');
7392        emailField.value = "";
7393      } else {
7394        message.classList.remove('success');
7395        message.classList.add('error');
7396
7397        // Enable button and hide spinner if something doesn't go right
7398        spinner.classList.add('is-hidden');
7399        buttonText.classList.remove('is-hidden');
7400        button.disabled = false;
7401      }
7402
7403      message.innerText = json.message;
7404    });
7405  });
7406}
7407
7408var onlyOnceSubmissions = document.querySelectorAll('.js-only-one-submission');
7409
7410onlyOnceSubmissions.forEach(function (form) {
7411  form.addEventListener('submit', function (e) {
7412    if (form.dataset.submitted === 'true') {
7413      e.preventDefault();
7414      return;
7415    }
7416
7417    form.dataset.submitted = 'true';
7418
7419    (0, _toggleFormLoader.showFormLoader)(form);
7420  });
7421});
7422
7423},{"./../helpers/toggle-form-loader":5}],51:[function(require,module,exports){
7424"use strict";
7425
7426require("simplycountdown.js/dist/simplyCountdown.min");
7427
7428var countdownWrapper = document.querySelectorAll(".js-streaming-soon");
7429
7430if (countdownWrapper) {
7431  countdownWrapper.forEach(function (wrapper) {
7432
7433    var countdown = JSON.parse(wrapper.dataset.countdown);
7434    countdown = countdown.split("-");
7435
7436    if (countdown.length == 3) {
7437      var config = {
7438        year: countdown[0],
7439        month: countdown[1],
7440        day: countdown[2],
7441        seconds: 0
7442      };
7443      simplyCountdown(wrapper, config);
7444    }
7445  });
7446}
7447
7448},{"simplycountdown.js/dist/simplyCountdown.min":190}],52:[function(require,module,exports){
7449'use strict';
7450
7451Object.defineProperty(exports, "__esModule", {
7452	value: true
7453});
7454
7455var _helpers = require('../helpers/helpers');
7456
7457function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
7458
7459exports.default = function (app) {
7460	if (!document.querySelector('.tabs__container')) return;
7461	if (!document.querySelector('.tabs')) return;
7462
7463	var tabContainers = document.querySelectorAll('.tabs__container');
7464	[].concat(_toConsumableArray(tabContainers)).forEach(function (tabContainer, i) {
7465		var tabsTriggers = tabContainer.querySelectorAll('.tabs__tab');
7466		var tabsContent = tabContainer.querySelectorAll('.tab__content');
7467
7468		[].concat(_toConsumableArray(tabsTriggers)).forEach(function (trigger, i) {
7469			trigger.addEventListener('click', function () {
7470				return (0, _helpers.tabsHandler)(trigger, i, tabsTriggers, tabsContent, 'tabs__tab--active', 'tab__content--active');
7471			});
7472		});
7473	});
7474};
7475
7476},{"../helpers/helpers":3}],53:[function(require,module,exports){
7477'use strict';
7478
7479var _helpers = require('../helpers/helpers');
7480
7481var _jsCookie = require('js-cookie');
7482
7483var _jsCookie2 = _interopRequireDefault(_jsCookie);
7484
7485function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7486
7487document.querySelector('body').addEventListener('click', function (event) {
7488  if (event.target.classList.contains("js-times-streaming-popup-trigger")) {
7489    showTimesStreamingPopup(event);
7490  }
7491});
7492
7493function showTimesStreamingPopup(e) {
7494  e.preventDefault();
7495
7496  var timesStreamingModal = document.querySelector('.js-times-streaming-popup');
7497  if (!timesStreamingModal) return false;
7498
7499  var popupLink = timesStreamingModal.querySelector('.js-times-streaming-popup-link');
7500  var popupAdLink = timesStreamingModal.querySelector('.js-times-streaming-popup-ad-link');
7501  var originalLink = e.target;
7502
7503  popupLink.setAttribute('href', originalLink.getAttribute('href'));
7504  popupLink.setAttribute('target', "_blank");
7505  popupLink.innerHTML = originalLink.getAttribute('data-linktype') === 'showtime' ? 'Continue to ticket booking' : 'Continue to stream';
7506  // popupLink.setAttribute('data-category', 'outbound-pu')
7507  popupAdLink.setAttribute('data-action', originalLink.getAttribute('data-action'));
7508  popupAdLink.setAttribute('data-optlabel', originalLink.getAttribute('data-linktype') === 'showtime' ? 'showtime' : 'streaming');
7509  // popupLink.setAttribute('data-optlabel', originalLink.getAttribute('data-optlabel'))
7510
7511  // popupLink.classList.add('ga-track')
7512
7513  if (!_jsCookie2.default.get('times-streaming-popup')) {
7514    (0, _helpers.modalsHandler)('open', timesStreamingModal);
7515    _jsCookie2.default.set('times-streaming-popup', '1', { expires: 1 });
7516    // popupLink.addEventListener('click', (e) => {
7517    //   modalsHandler('close', timesStreamingModal)
7518    // })
7519  } else {
7520    popupLink.click();
7521  }
7522
7523  // const modalOpacity = document.querySelector(".js-times-streaming-popup.modal--opacity")
7524  // modalOpacity.addEventListener('click', (e) => {
7525  //   modalsHandler('close', timesStreamingModal)
7526  // })
7527
7528  var closeButton = timesStreamingModal.querySelector('.js--closeModal');
7529  closeButton.addEventListener('click', function (e) {
7530    (0, _helpers.modalsHandler)('close', timesStreamingModal);
7531  });
7532}
7533
7534},{"../helpers/helpers":3,"js-cookie":171}],54:[function(require,module,exports){
7535'use strict';
7536
7537Object.defineProperty(exports, "__esModule", {
7538    value: true
7539});
7540
7541exports.default = function (app) {
7542    var allSliders = document.querySelectorAll('.js--carousel');
7543
7544    allSliders && allSliders.forEach(function (slider) {
7545        return handleSlider(slider);
7546    });
7547
7548    function handleSlider(slider) {
7549        var closestTooltip = slider.querySelector('.js-tooltip') || slider.parentElement.querySelector('.js-tooltip');
7550        var closestSliderWrapper = slider;
7551
7552        slider.addEventListener('mouseover', function (e) {
7553            handleMouseOver(e, closestTooltip, closestSliderWrapper);
7554        });
7555
7556        slider.addEventListener('mouseout', function (e) {
7557            handleMouseOut(e, closestTooltip);
7558        });
7559    }
7560
7561    function handleMouseOver(e, tooltip, sliderWrapper) {
7562        if (e.target.nodeName !== 'IMG') return;
7563        if (!tooltip) return;
7564
7565        var tooltipContent = e.target.parentElement.dataset.tooltip;
7566        if (tooltipContent == undefined) return;
7567        if (tooltipContent.length > 260) {
7568            tooltipContent = tooltipContent.slice(0, 260) + '...';
7569        }
7570
7571        var tooltipSynopsis = tooltip.querySelector('.js-tooltip-synopsis');
7572
7573        var sliderWrapperLeftEdge = sliderWrapper.getBoundingClientRect().left;
7574        var sliderWrapperRightEdge = sliderWrapper.getBoundingClientRect().right;
7575        var sliderWrapperTopEdge = sliderWrapper.getBoundingClientRect().top;
7576        var sliderWrapperHeight = sliderWrapper.getBoundingClientRect().height;
7577
7578        var _e$target$getBounding = e.target.getBoundingClientRect(),
7579            top = _e$target$getBounding.top,
7580            left = _e$target$getBounding.left,
7581            right = _e$target$getBounding.right,
7582            bottom = _e$target$getBounding.bottom;
7583
7584        var imageSize = right - left;
7585
7586        var spaceLeftOnRightHandSide = window.innerWidth - right;
7587        var canShowTooltipOnTheRight = spaceLeftOnRightHandSide > 250;
7588        var hoveringLastVisibleItem = Math.sign(sliderWrapperRightEdge - right) == '-1';
7589
7590        // tooltip content
7591        tooltipSynopsis.innerHTML = tooltipContent;
7592
7593        // Restart animation when moving between posters in the same grid.
7594        if (tooltip.classList.contains('is-visible')) {
7595            tooltip.classList.remove('is-visible');
7596            // force reflow so adding the class back retriggers transition
7597            void tooltip.offsetWidth;
7598        }
7599
7600        // tooltip position
7601        var tooltipWidth = tooltip.offsetWidth || 245;
7602        var overlapPx = 10;
7603        var tooltipLeftPosition = right - sliderWrapperLeftEdge - overlapPx;
7604
7605        // if hovering on the last visible element and tooltip shows on the right move it slightly left
7606        if (hoveringLastVisibleItem && canShowTooltipOnTheRight) {
7607            tooltipLeftPosition = tooltipLeftPosition + (sliderWrapperRightEdge - right);
7608        }
7609
7610        // fallback: show tooltip on left when there's not enough space on right-hand side
7611        if (!canShowTooltipOnTheRight) {
7612            tooltipLeftPosition = left - sliderWrapperLeftEdge - tooltipWidth + overlapPx;
7613            tooltip.classList.add('is-left');
7614        }
7615
7616        tooltip.style.left = tooltipLeftPosition + 'px';
7617        var tooltipHeight = tooltip.offsetHeight || 190;
7618        var imageMiddleY = (top + bottom) / 2 - sliderWrapperTopEdge;
7619        var maxTop = Math.max(0, sliderWrapperHeight - tooltipHeight);
7620        var tooltipTopPosition = Math.min(Math.max(0, imageMiddleY - tooltipHeight / 2), maxTop);
7621
7622        tooltip.style.top = tooltipTopPosition + 'px';
7623        tooltip.classList.add('is-visible');
7624    }
7625
7626    function handleMouseOut(e, tooltip) {
7627        if (e.target.nodeName !== 'IMG') return;
7628        if (!tooltip) return;
7629        tooltip.classList.remove('is-visible');
7630        tooltip.classList.remove('is-left');
7631    }
7632};
7633
7634function reloadTooltips(container) {
7635    var sliders = container.querySelectorAll('.js--carousel');
7636    sliders && sliders.forEach(function (slider) {
7637        return handleSlider(slider);
7638    });
7639}
7640
7641exports.reloadTooltips = reloadTooltips;
7642
7643},{}],55:[function(require,module,exports){
7644'use strict';
7645
7646Object.defineProperty(exports, "__esModule", {
7647    value: true
7648});
7649exports.loadTrailer = undefined;
7650
7651var _helpers = require('../helpers/helpers');
7652
7653var _modals = require('./modals');
7654
7655var _videoPlayer = require('./video-player');
7656
7657function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
7658
7659function loadTrailer(url, trailerEl, trailerModal) {
7660    var startAtSeconds = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
7661
7662
7663    url = getTrailerPath(url);
7664    if (url.startsWith("/trailer/")) {
7665        //console.log("[Trailer] loadTrailer", { url, startAtSeconds: Math.floor(startAtSeconds) });
7666
7667        // add "is-ajax-call" query string to the url to let server know to return only the trailer markup without the full page (used in app/routes/trailer.js)
7668        var urlObj = new URL(url, window.location.origin);
7669        urlObj.searchParams.set("is-ajax-call", "yes");
7670        url = urlObj.pathname + urlObj.search;
7671
7672        fetch(url, { credentials: "same-origin", headers: { "is-ajax-call": "yes" } }).then(function (blob) {
7673            return blob.text();
7674        }).then(function (text) {
7675            insertAndExecute(trailerEl, text);
7676
7677            var trailer = trailerEl.querySelector(".trailer");
7678
7679            var videoEl = document.getElementById("videoPlayer");
7680            if (videoEl) {
7681                var jwId = videoEl.getAttribute("data-jwid");
7682
7683                var playerInstance = jwplayer(videoEl);
7684                playerInstance.setup({
7685                    playlist: "https://cdn.jwplayer.com/v2/media/" + jwId,
7686                    width: "100%",
7687                    height: "100%",
7688                    controls: true
7689                });
7690
7691                // Seek when player is ready
7692                playerInstance.off("ready"); // avoid stacking if loadTrailer called multiple times
7693                playerInstance.on("ready", function () {
7694                    if (startAtSeconds && startAtSeconds > 0) {
7695                        try {
7696                            playerInstance.seek(startAtSeconds);
7697                        } catch (e) {
7698                            console.log("[Trailer] seek failed", e);
7699                        }
7700                    }
7701                    // autoplay
7702                    try {
7703                        playerInstance.play();
7704                    } catch (e) {
7705                        console.log("[Trailer] play failed", e);
7706                    }
7707                });
7708            } else {
7709                console.log("[Trailer] no #videoPlayer in modal markup");
7710            }
7711
7712            var openModelButtons = trailerEl.querySelectorAll(".js--openModal");
7713            (0, _modals.addModalOpenListeners)(openModelButtons);
7714
7715            var trailerTriggers = trailerEl.querySelectorAll(".js--trailerModalTriggerWrapper");
7716            addTrailerOpenListeners(trailerTriggers, trailerEl, trailerModal);
7717        }).catch(function (err) {
7718            return console.error(err);
7719        });
7720    } else {
7721        console.error("invalid trailer url");
7722    }
7723}
7724
7725function addTrailerOpenListeners(els, trailerEl, trailerModal) {
7726    [].concat(_toConsumableArray(els)).forEach(function (trailer) {
7727        addTrailerOpenListener(trailer, trailerEl, trailerModal);
7728    });
7729}
7730
7731function getTrailerPath(input) {
7732    var isFullUrl = /^https?:\/\//i.test(input);
7733
7734    if (isFullUrl) {
7735        return new URL(input).pathname + new URL(input).search;
7736    }
7737
7738    return input.startsWith("/") ? input : '/' + input;
7739}
7740
7741function addTrailerOpenListener(trigger, trailerEl, trailerModal) {
7742    trigger.addEventListener('click', function (e) {
7743        if (e.target.classList && e.target.classList.contains("js--trailerModalTrigger")) {
7744            e.preventDefault();
7745            var trailerUrl = e.target.getAttribute('href');
7746            if (trailerUrl) {
7747                loadTrailer(trailerUrl, trailerEl, trailerModal);
7748                (0, _helpers.modalsHandler)('open', trailerModal);
7749            } else {
7750                console.error("trailer url missing");
7751            }
7752        }
7753    });
7754}
7755
7756function insertAndExecute(el, text) {
7757    el.innerHTML = text;
7758    var scripts = Array.from(el.getElementsByTagName("script"));
7759    scripts.forEach(function (script) {
7760        if (script.hasAttribute("type") && script.getAttribute("type") === "application/ld+json") return;
7761        if (script.src) {
7762            var tag = document.createElement("script");
7763            tag.src = script.src;
7764            document.head.appendChild(tag);
7765        } else {
7766            eval(script.innerHTML);
7767        }
7768    });
7769}
7770
7771function observeAjaxContent(containerSelector, callback) {
7772    var container = document.querySelector(containerSelector);
7773    if (!container) return;
7774
7775    var observer = new MutationObserver(function (mutations) {
7776        mutations.forEach(function (mutation) {
7777            mutation.addedNodes.forEach(function (node) {
7778                if (node.nodeType === 1) {
7779                    // Element node
7780                    callback(node);
7781                }
7782            });
7783        });
7784    });
7785
7786    observer.observe(container, { childList: true, subtree: true });
7787}
7788
7789exports.default = function (app) {
7790    var trailerModal = document.querySelector('.trailer-modal');
7791    var trailerEl = document.querySelector('.js--loadTrailer');
7792    var trailerWrappers = document.querySelectorAll('.js--trailerModalTriggerWrapper');
7793    var trailerAutoTrigger = document.querySelector('.js--trailerModalTriggerAuto');
7794    var trailerModalClose = trailerModal.querySelector('.js--closeTrailer');
7795
7796    if (trailerAutoTrigger) {
7797        var trailerUrl = trailerAutoTrigger.getAttribute('data-href');
7798        loadTrailer(trailerUrl, trailerEl, trailerModal);
7799        (0, _helpers.modalsHandler)('open', trailerModal);
7800    }
7801
7802    trailerModalClose.addEventListener("click", function () {
7803        var endAt = 0;
7804
7805        // Read current position from modal JW player if possible
7806        var videoEl = document.getElementById("videoPlayer");
7807        if (videoEl) {
7808            try {
7809                var p = jwplayer(videoEl);
7810                if (p && typeof p.getPosition === "function") {
7811                    endAt = p.getPosition() || 0;
7812                }
7813            } catch (err) {
7814                console.log("[Trailer] could not read modal position", err);
7815            }
7816        }
7817
7818        // Notify Coming Soon page to resume card from this time
7819        window.dispatchEvent(new CustomEvent("comingsoon:closeTrailer", {
7820            detail: { endAt: endAt }
7821        }));
7822
7823        (0, _helpers.modalsHandler)("close", trailerModal);
7824        trailerEl.innerHTML = "";
7825    });
7826
7827    addTrailerOpenListeners(trailerWrappers, trailerEl, trailerModal);
7828
7829    // Coming Soon open request (sent from video-player coming soon logic)
7830    window.addEventListener("comingsoon:openTrailer", function (e) {
7831        var detail = e && e.detail ? e.detail : {};
7832        var trailerUrl = detail.trailerUrl;
7833        var startAt = detail.startAt || 0;
7834        var fromId = detail.fromId || null;
7835
7836        if (!trailerUrl) return;
7837
7838        loadTrailer(trailerUrl, trailerEl, trailerModal, startAt);
7839        (0, _helpers.modalsHandler)("open", trailerModal);
7840    });
7841
7842    // Observe new AJAX content
7843    observeAjaxContent('.js-single-movie-ajax', function (newNode) {
7844        if (newNode.matches('.js--trailerModalTriggerWrapper')) {
7845            addTrailerOpenListeners([newNode], trailerEl, trailerModal);
7846        } else {
7847            var triggers = newNode.querySelectorAll('.js--trailerModalTriggerWrapper');
7848            if (triggers.length) {
7849                addTrailerOpenListeners(triggers, trailerEl, trailerModal);
7850            }
7851        }
7852    });
7853};
7854
7855exports.loadTrailer = loadTrailer;
7856
7857},{"../helpers/helpers":3,"./modals":37,"./video-player":110}],56:[function(require,module,exports){
7858'use strict';
7859
7860Object.defineProperty(exports, "__esModule", {
7861  value: true
7862});
7863
7864var _pagination = require('./pagination');
7865
7866function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
7867
7868exports.default = function (app) {
7869  var trailersWrapper = document.querySelector('.js--trailers-container');
7870  if (!trailersWrapper) return;
7871  var categorySelectForm = document.querySelector('#category-select-form');
7872  var url = trailersWrapper.getAttribute('data-uri');
7873
7874  getData(url);
7875  if (categorySelectForm) {
7876    var _categorySelectEls = categorySelectForm.querySelectorAll('input[type=radio]');
7877    if (_categorySelectEls) {
7878      [].concat(_toConsumableArray(_categorySelectEls)).forEach(function (el) {
7879        el.addEventListener('click', function (e) {
7880          var uri = el.getAttribute('data-uri');
7881          getData(uri);
7882        });
7883      });
7884    }
7885  }
7886
7887  function setSelected() {
7888    if (categorySelectEls) {
7889      [].concat(_toConsumableArray(categorySelectEls)).forEach(function (el) {
7890        if (el.checked) {
7891          el.parentNode.classList.add('selected');
7892        } else {
7893          el.parentNode.classList.remove('selected');
7894        }
7895      });
7896    }
7897  }
7898
7899  function getData(url, cb) {
7900    fetch(url, { credentials: 'same-origin', headers: { 'is-ajax-call': 'yes' } }).then(function (blob) {
7901      return blob.text();
7902    }).then(function (text) {
7903      trailersWrapper.innerHTML = text;
7904
7905      var loadMore = trailersWrapper.querySelector('.js--paginationLoadMore');
7906      var pageContainer = trailersWrapper.querySelector('.js--paginationAppend');
7907      (0, _pagination.applyPagination)(pageContainer, loadMore, true);
7908      (0, _pagination.applyAutoLoad)(loadMore);
7909
7910      // const scrollTop = trailersWrapper.querySelector('.js--backToTop')
7911      // applyScrollTop(scrollTop)
7912
7913      setSelected();
7914    }).catch(function (err) {
7915      return console.error(err);
7916    });
7917  }
7918};
7919
7920},{"./pagination":42}],57:[function(require,module,exports){
7921"use strict";
7922
7923var _stickyJs = require("sticky-js");
7924
7925var _stickyJs2 = _interopRequireDefault(_stickyJs);
7926
7927function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7928
7929// loader
7930window.addEventListener("load", function () {
7931  var loader = document.querySelector(".js-tmp-v5-loader");
7932  if (loader) {
7933    setTimeout(function () {
7934      loader.classList.add("fade-out");
7935    }, 1000);
7936  }
7937});
7938
7939// make showtimes bar sticky
7940// let stickyInstance = null;
7941
7942// const observer = new MutationObserver((mutations, obs) => {
7943//   const calendar = document.querySelector(".times-calendar");
7944
7945//   if (calendar && !calendar.classList.contains("sticky-initialized")) {
7946//     // Add required data attribute
7947//     calendar.setAttribute("data-sticky", "");
7948//     calendar.classList.add("sticky-initialized"); // Avoid duplicate init
7949
7950//     // Initialize Sticky.js
7951//     stickyInstance = new Sticky(".times-calendar");
7952
7953//     // Stop observing after sticky is applied
7954//     obs.disconnect();
7955//   }
7956// });
7957
7958// Start observing the DOM
7959// observer.observe(document.body, {
7960//   childList: true,
7961//   subtree: true,
7962// });
7963
7964// jwplayer
7965var videoEl = document.getElementById("BackgroundVideoPlayer");
7966if (videoEl) {
7967  if (window.innerWidth > 768) {
7968    var playerInstance = jwplayer(videoEl);
7969    playerInstance.setup({
7970      playlist: "https://cdn.jwplayer.com/v2/media/" + videoEl.getAttribute("data-jwid"),
7971      width: "100%",
7972      height: "100%",
7973      autostart: "viewable",
7974      mute: true,
7975      repeat: true,
7976      controls: false,
7977      visualPlaylist: false,
7978      displaytitle: false,
7979      displaydescription: false,
7980      aspectratio: '1920x800'
7981      // stretching: "fill",
7982    });
7983    // playerInstance.on("ready", function () {
7984    //   if (window.innerWidth < 768) {
7985    //     document.querySelector(".jwplayer").style.objectFit = "cover";
7986    //   }
7987    // });
7988  }
7989}
7990
7991var videoElMob = document.getElementById("BackgroundVideoPlayerMobile");
7992if (videoElMob) {
7993  if (window.innerWidth <= 768) {
7994    var playerInstance2 = jwplayer(videoElMob);
7995    playerInstance2.setup({
7996      playlist: "https://cdn.jwplayer.com/v2/media/" + videoElMob.getAttribute("data-jwid"),
7997      width: "100%",
7998      height: "100%",
7999      autostart: "viewable",
8000      mute: true,
8001      repeat: true,
8002      controls: false,
8003      visualPlaylist: false,
8004      displaytitle: false,
8005      displaydescription: false,
8006      aspectratio: '1280x896'
8007      // stretching: "fill",
8008    });
8009    playerInstance2.on("ready", function () {
8010      if (window.innerWidth < 768) {
8011        document.querySelector(".jwplayer").style.objectFit = "cover";
8012      }
8013    });
8014  }
8015}
8016
8017// lightbox for TMP poster/gallery
8018if (typeof PhotoSwipeLightbox !== "undefined") {
8019  var getIntrinsicSize = function getIntrinsicSize(src) {
8020    return new Promise(function (resolve, reject) {
8021      var img = new Image();
8022      img.onload = function () {
8023        return resolve({ width: img.naturalWidth, height: img.naturalHeight });
8024      };
8025      img.onerror = reject;
8026      img.src = src;
8027    });
8028  };
8029
8030  var hydrateGalleryDimensions = async function hydrateGalleryDimensions(selector) {
8031    var links = document.querySelectorAll(selector + " a");
8032
8033    await Promise.allSettled(Array.from(links).map(async function (link) {
8034      var src = link.getAttribute("href");
8035      if (!src) return;
8036
8037      var _ref = await getIntrinsicSize(src),
8038          width = _ref.width,
8039          height = _ref.height;
8040
8041      link.setAttribute("data-pswp-width", width);
8042      link.setAttribute("data-pswp-height", height);
8043    }));
8044  };
8045
8046  var initLightbox = function initLightbox(selector) {
8047    if (!document.querySelector(selector)) return;
8048
8049    var lightbox = new PhotoSwipeLightbox({
8050      gallery: selector,
8051      children: "a",
8052      pswpModule: PhotoSwipe,
8053      imageClickAction: "next",
8054      tapAction: "next"
8055    });
8056
8057    lightbox.init();
8058  };
8059
8060  var prepareTmpLightboxes = async function prepareTmpLightboxes() {
8061    await Promise.all([hydrateGalleryDimensions("#tmp-poster"), hydrateGalleryDimensions("#tmp-gallery")]);
8062
8063    initLightbox("#tmp-poster");
8064    initLightbox("#tmp-gallery");
8065  };
8066
8067  prepareTmpLightboxes();
8068}
8069
8070// nav
8071var nav = document.querySelector(".js-tmp-nav");
8072var popupNav = document.querySelector(".tmp-main-nav");
8073if (nav && popupNav) {
8074  nav.addEventListener("click", function (e) {
8075    document.body.classList.toggle("is-blocked");
8076    nav.classList.toggle("is-open");
8077    popupNav.classList.toggle("is-open");
8078  });
8079}
8080
8081},{"sticky-js":193}],58:[function(require,module,exports){
8082"use strict";
8083
8084document.querySelectorAll(".blog-movie-list-tabs-wrap").forEach(function (wrapper) {
8085  var tabButtons = wrapper.querySelectorAll(".blog-movie-list-tab");
8086  var tabContents = wrapper.querySelectorAll(".blog-movie-list-tab-content");
8087
8088  tabButtons.forEach(function (button) {
8089    button.addEventListener("click", function () {
8090      var target = button.dataset.tab;
8091
8092      // Skip if already active
8093      if (button.classList.contains("active")) return;
8094
8095      // Deactivate all in this group
8096      tabButtons.forEach(function (btn) {
8097        return btn.classList.remove("active");
8098      });
8099      tabContents.forEach(function (content) {
8100        return content.classList.remove("active");
8101      });
8102
8103      // Activate clicked tab and corresponding content
8104      button.classList.add("active");
8105      var targetContent = wrapper.querySelector(".blog-movie-list-tab-content[data-content=\"" + target + "\"]");
8106      if (targetContent) {
8107        targetContent.classList.add("active");
8108      }
8109    });
8110  });
8111});
8112
8113// Blog share feature
8114var shouldTrigger = document.querySelector(".blog-container") || document.querySelector(".comps-offers-single");
8115var isBlog = document.querySelector(".blog-container");
8116
8117if (shouldTrigger) {
8118  var shareUrl = window.location.href;
8119  var shareText = isBlog ? document.querySelector(".blog-heading").textContent : document.querySelector('h1').textContent;
8120
8121  var shareLinks = {
8122    messenger: "https://www.addtoany.com/add_to/facebook_messenger?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + shareText,
8123    whatsapp: "https://www.addtoany.com/add_to/whatsapp?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + shareText,
8124    email: "mailto:?subject=" + encodeURIComponent(shareText) + "&body=" + encodeURIComponent("Check out this link: " + shareUrl)
8125  };
8126
8127  var shareButtons = [{ selector: ".js-messenger-share", type: "messenger", newTab: true }, { selector: ".js-whatsapp-share", type: "whatsapp", newTab: true }, { selector: ".js-email-share", type: "email", newTab: false }];
8128
8129  shareButtons.forEach(function (_ref) {
8130    var selector = _ref.selector,
8131        type = _ref.type,
8132        newTab = _ref.newTab;
8133
8134    var button = document.querySelector(selector);
8135    if (button) {
8136      button.addEventListener("click", function (e) {
8137        e.preventDefault();
8138        if (newTab) {
8139          window.open(shareLinks[type], "_blank");
8140        } else {
8141          window.location.href = shareLinks[type]; // this is the key for `mailto:` to work properly
8142        }
8143      });
8144    }
8145  });
8146}
8147
8148// var videoEl = document.getElementById("blog-header-video");
8149// if (videoEl) {
8150//   console.log(videoEl.getAttribute("data-jwid"));
8151//   var playerInstance = jwplayer(videoEl);
8152//   playerInstance.setup({
8153//     playlist:
8154//       "https://cdn.jwplayer.com/v2/media/" + videoEl.getAttribute("data-jwid"),
8155//     width: "100%",
8156//     height: "100%",
8157//     autostart: "viewable",
8158//     mute: true,
8159//     repeat: true,
8160//     controls: false,
8161//     visualPlaylist: false,
8162//     displaytitle: false,
8163//     displaydescription: false,
8164//     aspectratio: "1512x662",
8165//     // stretching: "fill",
8166//   });
8167// }
8168
8169},{}],59:[function(require,module,exports){
8170'use strict';
8171
8172var codeResendWrapper = document.querySelector('.js--code-resend-wrapper');
8173
8174if (codeResendWrapper) {
8175  var startCountdown = function startCountdown() {
8176    var timer = setInterval(function () {
8177      if (countdown > 0) {
8178        codeResendWrapper.textContent = 'You can resend it in ' + countdown + ' seconds.';
8179        countdown--;
8180      } else {
8181        clearInterval(timer);
8182        codeResendWrapper.remove();
8183        codeResendTrigger.classList.remove('is-hidden');
8184      }
8185    }, 1000);
8186  };
8187
8188  var codeResendTrigger = document.querySelector('.js--code-resend-trigger');
8189  var codeResendForm = document.querySelector('.js--code-resend-form');
8190
8191  var countdown = 30;
8192
8193  codeResendTrigger.addEventListener('click', function (e) {
8194    e.preventDefault();
8195    codeResendForm.submit();
8196  });
8197
8198  startCountdown();
8199}
8200
8201},{}],60:[function(require,module,exports){
8202"use strict";
8203
8204var LocalStorageExtended = require('../local-storage-extended.js');
8205
8206var notifications = document.querySelectorAll(".js-dismissable-notification");
8207var dismissedNotificationsFromStorage = JSON.parse(LocalStorageExtended.get("dismissedNotifications")) || [];
8208// console.log('dismissedNotificationsFromStorage', dismissedNotificationsFromStorage)
8209
8210// Hide previously dismissed notifications
8211notifications.forEach(function (notification) {
8212    var id = notification.id;
8213    if (!dismissedNotificationsFromStorage.includes(id)) {
8214        notification.classList.remove("is-hidden");
8215    }
8216
8217    var closeButton = notification.querySelector(".js-dismissable-notification-button");
8218    closeButton.addEventListener("click", function () {
8219        return hideNotification(notification);
8220    });
8221});
8222
8223function hideNotification(notification) {
8224    var id = notification.id;
8225
8226    // Hide the notification in the UI
8227    notification.classList.add("is-hidden");
8228
8229    // Add the dismissed notification id to the list and update local storage
8230    dismissedNotificationsFromStorage.push(id);
8231    LocalStorageExtended.set("dismissedNotifications", JSON.stringify(dismissedNotificationsFromStorage), 14);
8232}
8233
8234},{"../local-storage-extended.js":28}],61:[function(require,module,exports){
8235"use strict";
8236
8237(function () {
8238  function isInViewport(element) {
8239    var rect = element.getBoundingClientRect();
8240    var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
8241    var viewportWidth = window.innerWidth || document.documentElement.clientWidth;
8242
8243    return rect.top < viewportHeight && rect.bottom > 0 && rect.left < viewportWidth && rect.right > 0;
8244  }
8245
8246  var observer = new IntersectionObserver(function (entries, obs) {
8247    entries.forEach(function (entry) {
8248      if (!entry.isIntersecting) return;
8249
8250      entry.target.classList.add("is-visible");
8251      obs.unobserve(entry.target);
8252    });
8253  }, { threshold: 0.15 });
8254
8255  function processFadeScaleElements(root) {
8256    var container = root && root.querySelectorAll ? root : document;
8257
8258    var elements = container.querySelectorAll(".fade-scale:not(.is-observed)");
8259
8260    if (!elements.length) return;
8261
8262    elements.forEach(function (element) {
8263      element.classList.add("is-observed");
8264
8265      // Above the fold: show instantly and remove fade-scale so it never animates
8266      if (isInViewport(element)) {
8267        element.classList.remove("fade-scale");
8268        element.classList.add("is-visible");
8269        return;
8270      }
8271
8272      // Below the fold: animate on entry
8273      observer.observe(element);
8274    });
8275  }
8276
8277  function start() {
8278    // Initial scan
8279    processFadeScaleElements(document);
8280
8281    // Auto-handle dynamically inserted elements
8282    var mo = new MutationObserver(function (mutations) {
8283      mutations.forEach(function (mutation) {
8284        if (!mutation.addedNodes || !mutation.addedNodes.length) return;
8285
8286        mutation.addedNodes.forEach(function (node) {
8287          if (!node || node.nodeType !== 1) return; // element nodes only
8288
8289          // Node itself is fade-scale
8290          if (node.classList && node.classList.contains("fade-scale")) {
8291            processFadeScaleElements(node.parentNode || document);
8292            return;
8293          }
8294
8295          // Or node contains fade-scale children
8296          if (node.querySelector && node.querySelector(".fade-scale")) {
8297            processFadeScaleElements(node);
8298          }
8299        });
8300      });
8301    });
8302
8303    mo.observe(document.documentElement, {
8304      childList: true,
8305      subtree: true
8306    });
8307  }
8308
8309  if (document.readyState === "loading") {
8310    document.addEventListener("DOMContentLoaded", start);
8311  } else {
8312    start();
8313  }
8314})();
8315
8316},{}],62:[function(require,module,exports){
8317'use strict';
8318
8319function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
8320
8321var allFixturesSliders = document.querySelectorAll('.js-fullwidth-slider');
8322allFixturesSliders.forEach(function (slider) {
8323    var prevArrow = slider.querySelector('.js--carousel__left');
8324    var nextArrow = slider.querySelector('.js--carousel__right');
8325    var scrollContainer = slider.querySelector('.js-fullwidth-slider-wrapper');
8326    var items = slider.querySelectorAll('.js-fullwidth-slider-item');
8327
8328    // console.log({scrollContainer, items})
8329
8330    prevArrow.addEventListener('click', function () {
8331        var index = getCurrentItemIndex();
8332        scrollContainer.scrollLeft = getScrollDistance(index - 1);
8333    });
8334
8335    nextArrow.addEventListener('click', function () {
8336        var index = getCurrentItemIndex();
8337        // If at the current position, scroll to the next item; otherwise, scroll to the current item.
8338        var targetIndex = scrollContainer.scrollLeft === items[index].offsetLeft ? index + 1 : index;
8339        scrollContainer.scrollLeft = getScrollDistance(targetIndex);
8340        // console.log({index, targetIndex, scroll: getScrollDistance(targetIndex)});
8341    });
8342
8343    function getCurrentItemIndex() {
8344        var scrollPosition = scrollContainer.scrollLeft;
8345        // Find the first item that's offset is greater than or equal to the current scroll position.
8346        return [].concat(_toConsumableArray(items)).findIndex(function (item, idx) {
8347            return item.offsetLeft >= scrollPosition;
8348        });
8349    }
8350
8351    function getScrollDistance(targetIndex) {
8352        // Ensure the target index is within bounds.
8353        targetIndex = Math.max(0, Math.min(items.length - 1, targetIndex));
8354        return items[targetIndex].offsetLeft;
8355    }
8356});
8357
8358},{}],63:[function(require,module,exports){
8359"use strict";
8360
8361var form = document.getElementById("genre-select-form");
8362
8363if (form) {
8364  var resetButton = document.querySelector(".js-genre-reset-form");
8365  if (resetButton) {
8366    resetButton.addEventListener("click", function (e) {
8367      // remove all '.selected' classes
8368      var allSelectedLabels = form.querySelectorAll(".selected");
8369      allSelectedLabels.forEach(function (label) {
8370        return label.classList.remove("selected");
8371      });
8372
8373      // uncheck all checkboxes
8374      form.querySelectorAll('input[type="checkbox"]').forEach(function (checkbox) {
8375        return checkbox.checked = false;
8376      });
8377    });
8378  }
8379}
8380
8381},{}],64:[function(require,module,exports){
8382'use strict';
8383
8384Object.defineProperty(exports, "__esModule", {
8385  value: true
8386});
8387
8388var _helpers = require('../../helpers/helpers');
8389
8390exports.default = function (app) {
8391  var formSearchList = document.querySelectorAll('.js--insite-search-form');
8392  if (!formSearchList.length) return;
8393
8394  formSearchList.forEach(function (formSearch) {
8395    var collectionData = formSearch.dataset.collection;
8396    var formSearchInput = formSearch.querySelector('input[name="q"]');
8397    var closeIcon = formSearch.querySelector('.close-icon');
8398    var parentSearch = formSearch.closest('.js-insite-search');
8399    var targetEl = parentSearch.querySelector('.js--insite-search-results');
8400
8401    var timeout = null;
8402
8403    closeIcon.addEventListener('click', function (e) {
8404      closeIcon.classList.remove('is-visible');
8405      targetEl.innerHTML = "";
8406      formSearchInput.value = "";
8407      formSearchInput.focus();
8408    });
8409
8410    formSearchInput.addEventListener('keyup', function (e) {
8411      clearTimeout(timeout);
8412      timeout = setTimeout(function () {
8413        formSearchHandler(e.target.value, targetEl, closeIcon);
8414      }, 600);
8415    });
8416
8417    function formSearchHandler(query, targetElement, closeElement) {
8418      if (query.length > 4) {
8419        targetElement.innerHTML = '<div class="results-loading"><span><svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#000"> <g fill="none" fill-rule="evenodd"> <g transform="translate(1 1)" stroke-width="2"> <circle stroke-opacity=".5" cx="18" cy="18" r="18"/> <path d="M36 18c0-9.94-8.06-18-18-18"> <animateTransform attributeName="transform" type="rotate" from="0 18 18" to="360 18 18" dur="1s" repeatCount="indefinite"/> </path> </g> </g></svg></span>Loading results...</div>';
8420        var url = void 0;
8421        if (collectionData === 'movies') {
8422          url = '/search/live/?q=' + encodeURIComponent(query) + '&collection=movies';
8423        } else if (collectionData === 'cinemas') {
8424          url = '/search/live/?q=' + encodeURIComponent(query) + '&collection=cinemas';
8425        } else {
8426          url = '/search/live/?q=' + encodeURIComponent(query);
8427        }
8428
8429        fetch(url, { credentials: 'same-origin', headers: { 'is-ajax-call': 'yes' } }).then(function (response) {
8430          return response.text();
8431        }).then(function (html) {
8432          targetElement.innerHTML = html;
8433          closeElement.classList.add('is-visible');
8434        }).catch(function (err) {
8435          return console.error(err);
8436        });
8437      } else {
8438        targetElement.innerHTML = '';
8439      }
8440    }
8441  });
8442};
8443
8444},{"../../helpers/helpers":3}],65:[function(require,module,exports){
8445"use strict";
8446
8447var form = document.getElementById("type-select-form");
8448var resetButton = document.querySelector(".js-item-type-reset-form");
8449if (form && resetButton) {
8450  resetButton.addEventListener("click", function (e) {
8451    form.querySelectorAll(".selected").forEach(function (label) {
8452      return label.classList.remove("selected");
8453    });
8454
8455    form.querySelectorAll('input[type="checkbox"]').forEach(function (checkbox) {
8456      return checkbox.checked = false;
8457    });
8458  });
8459}
8460
8461var statusForm = document.getElementById("status-select-form");
8462var statusResetButton = document.querySelector(".js-item-status-reset-form");
8463if (statusForm && statusResetButton) {
8464  statusResetButton.addEventListener("click", function (e) {
8465    statusForm.querySelectorAll(".selected").forEach(function (label) {
8466      return label.classList.remove("selected");
8467    });
8468
8469    statusForm.querySelectorAll('input[type="checkbox"]').forEach(function (checkbox) {
8470      return checkbox.checked = false;
8471    });
8472  });
8473}
8474
8475},{}],66:[function(require,module,exports){
8476"use strict";
8477
8478var _swiperBundle = require("../../../../../node_modules/swiper/swiper-bundle.js");
8479
8480var _swiperBundle2 = _interopRequireDefault(_swiperBundle);
8481
8482function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8483
8484var rewardsSlider = new _swiperBundle2.default(".js-rewards-slider", {
8485  loop: true,
8486  loopAdditionalSlides: 8,
8487  spaceBetween: 16,
8488  autoHeight: true,
8489  grabCursor: true,
8490  centeredSlides: true,
8491  autoplay: {
8492    delay: 3500,
8493    disableOnInteraction: false
8494  },
8495  speed: 600,
8496  breakpoints: {
8497    0: { slidesPerView: 1.2, spaceBetween: 16 },
8498    768: { slidesPerView: 2.2, spaceBetween: 18 },
8499    1024: { slidesPerView: 3.2, spaceBetween: 20 },
8500    1280: { slidesPerView: 4.2, spaceBetween: 24 }
8501  }
8502});
8503
8504},{"../../../../../node_modules/swiper/swiper-bundle.js":194}],67:[function(require,module,exports){
8505'use strict';
8506
8507Object.defineProperty(exports, "__esModule", {
8508  value: true
8509});
8510var notificationTimeout = void 0;
8511
8512var openNotification = exports.openNotification = function openNotification() {
8513  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
8514      _ref$text = _ref.text,
8515      text = _ref$text === undefined ? 'Done' : _ref$text;
8516
8517  var notificationElement = document.querySelector('.list-notification');
8518
8519  // Update the text content
8520  notificationElement.querySelector('.list-notification__text').innerHTML = text;
8521
8522  // Show the notification
8523  notificationElement.classList.remove('is-hidden');
8524
8525  // Clear any previous timeout to prevent multiple overlapping notifications
8526  clearTimeout(notificationTimeout);
8527
8528  // Hide the notification after 3 seconds
8529  notificationTimeout = setTimeout(function () {
8530    closeNotification(notificationElement);
8531  }, 5000);
8532};
8533
8534var closeNotification = function closeNotification(notificationElement) {
8535  notificationElement.classList.add('is-hidden');
8536};
8537
8538},{}],68:[function(require,module,exports){
8539"use strict";
8540
8541var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); // import "simplycountdown.js/dist/simplyCountdown.min";
8542
8543
8544require("../countdown-main");
8545
8546var countdownWrapper = document.querySelectorAll(".js-match-countdown");
8547
8548var timeto24 = function timeto24(timeString) {
8549  var _timeString$split = timeString.split(/(?=[ap]m)/i),
8550      _timeString$split2 = _slicedToArray(_timeString$split, 2),
8551      time = _timeString$split2[0],
8552      period = _timeString$split2[1];
8553
8554  var _time$split = time.split(":"),
8555      _time$split2 = _slicedToArray(_time$split, 2),
8556      hours = _time$split2[0],
8557      minutes = _time$split2[1];
8558
8559  hours = hours.replace(/\"/g, "");
8560  // If it's PM and before 12:00 (1:00PM - 11:59PM), add 12 to get 24-hour format.
8561  // If it's AM and exactly 12:00, subtract 12 to get 0 (midnight in 24-hour format).
8562  hours = period.toUpperCase().replace(/\"/g, "") === "PM" ? parseInt(hours) % 12 + 12 : parseInt(hours) % 12;
8563
8564  return [hours, parseInt(minutes)];
8565};
8566
8567if (countdownWrapper) {
8568  countdownWrapper.forEach(function (wrapper) {
8569    var countdown = JSON.parse(wrapper.dataset.countdown);
8570    countdown = countdown.split("-");
8571
8572    var time = timeto24(wrapper.dataset.time);
8573
8574    if (countdown.length == 3 && time.length == 2) {
8575      var config = {
8576        zeroIsPlural: true,
8577        year: countdown[0],
8578        month: countdown[1],
8579        day: countdown[2],
8580        hours: time[0],
8581        minutes: time[1],
8582        seconds: 0,
8583        words: { //words displayed into the countdown
8584          days: { singular: 'day', plural: 'days' },
8585          hours: { singular: 'hour', plural: 'hours' },
8586          minutes: { singular: 'min', plural: 'mins' },
8587          seconds: { singular: 'sec', plural: 'secs' }
8588        }
8589      };
8590      simplyCountdown(wrapper, config);
8591    }
8592  });
8593}
8594
8595},{"../countdown-main":15}],69:[function(require,module,exports){
8596"use strict";
8597
8598var watchlistSelector = document.querySelector(".js-watchlist-select");
8599var backdrop = document.querySelector(".js-profile-main-nav-backdrop");
8600
8601if (watchlistSelector) {
8602  watchlistSelector.addEventListener("click", function (e) {
8603    watchlistSelector.parentElement.classList.add("is-open");
8604    backdrop.classList.add("is-visible");
8605    // watchlistSelector.focus() // Safari doesn't give focus to buttons
8606  });
8607
8608  // watchlistSelector.addEventListener('focusout', e => {
8609  //     watchlistSelector.parentElement.classList.remove('is-open');
8610  // })
8611}
8612
8613if (backdrop) {
8614  backdrop.addEventListener("click", function (e) {
8615    backdrop.classList.remove("is-visible");
8616    watchlistSelector.parentElement.classList.remove("is-open");
8617  });
8618}
8619
8620var enableNotifications = document.querySelector(".js-member-enable-notifications");
8621var disableNotifications = document.querySelector(".js-member-disable-notifications");
8622var userNotifications = document.querySelector(".js-user-notifications");
8623
8624if (enableNotifications && userNotifications) {
8625  enableNotifications.addEventListener("click", function (e) {
8626    userNotifications.setAttribute("value", true);
8627    enableNotifications.classList.add("is-selected");
8628    disableNotifications.classList.remove("is-selected");
8629  });
8630}
8631
8632if (disableNotifications && userNotifications) {
8633  disableNotifications.addEventListener("click", function (e) {
8634    userNotifications.setAttribute("value", false);
8635    enableNotifications.classList.remove("is-selected");
8636    disableNotifications.classList.add("is-selected");
8637  });
8638}
8639
8640},{}],70:[function(require,module,exports){
8641"use strict";
8642
8643(function () {
8644  var MEDIA_SELECTOR = ".more-cinemas__media";
8645  var IMAGE_SELECTOR = ".more-cinemas__media img";
8646
8647  function markLoaded(img) {
8648    if (!img) return;
8649    img.classList.add("is-loaded");
8650    var media = img.closest(MEDIA_SELECTOR);
8651    if (media) media.classList.add("is-loaded");
8652  }
8653
8654  function hydrateImage(img) {
8655    if (!img || img.dataset.moreCinemasImageReady === "true") return;
8656
8657    img.dataset.moreCinemasImageReady = "true";
8658
8659    if (img.complete && img.naturalWidth > 0) {
8660      markLoaded(img);
8661      return;
8662    }
8663
8664    img.addEventListener("load", function () {
8665      return markLoaded(img);
8666    }, { once: true });
8667    img.addEventListener("error", function () {
8668      return markLoaded(img);
8669    }, { once: true });
8670  }
8671
8672  function hydrate() {
8673    var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
8674
8675    var scope = root.querySelectorAll ? root : document;
8676    scope.querySelectorAll(IMAGE_SELECTOR).forEach(hydrateImage);
8677  }
8678
8679  function start() {
8680    hydrate(document);
8681
8682    var observer = new MutationObserver(function (mutations) {
8683      mutations.forEach(function (mutation) {
8684        mutation.addedNodes.forEach(function (node) {
8685          if (!node || node.nodeType !== 1) return;
8686
8687          if (node.matches && node.matches(IMAGE_SELECTOR)) {
8688            hydrateImage(node);
8689            return;
8690          }
8691
8692          if (node.querySelector && node.querySelector(IMAGE_SELECTOR)) {
8693            hydrate(node);
8694          }
8695        });
8696      });
8697    });
8698
8699    observer.observe(document.documentElement, {
8700      childList: true,
8701      subtree: true
8702    });
8703  }
8704
8705  if (document.readyState === "loading") {
8706    document.addEventListener("DOMContentLoaded", start);
8707  } else {
8708    start();
8709  }
8710})();
8711
8712},{}],71:[function(require,module,exports){
8713"use strict";
8714
8715function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
8716
8717var cinemasCarousel = document.querySelector(".more-cinemas-slider-wrapper");
8718
8719if (cinemasCarousel) {
8720  var prevArrow = cinemasCarousel.querySelector(".js--carousel__left");
8721  var nextArrow = cinemasCarousel.querySelector(".js--carousel__right");
8722
8723  var scrollContainer = document.querySelector(".more-cinemas-slider");
8724  var allCinemas = cinemasCarousel.querySelectorAll(".more-cinemas__single-entry");
8725
8726  if (scrollContainer && allCinemas) {
8727    var handleNextClick = function handleNextClick() {
8728      var currentItemIndex = getCurrentItemIndex();
8729      var targetIndex = scrollContainer.scrollLeft === allCinemas[currentItemIndex - 2].offsetLeft ? currentItemIndex + fullyVisibleColumns : currentItemIndex;
8730
8731      scrollContainer.scrollLeft = getScrollDistance(targetIndex);
8732    };
8733
8734    var handlePrevClick = function handlePrevClick() {
8735      var currentItemIndex = getCurrentItemIndex();
8736      var INDEX_STEP_BACK = 6;
8737
8738      if (currentItemIndex - INDEX_STEP_BACK <= 0) {
8739        scrollContainer.scrollLeft = 0;
8740      } else {
8741        scrollContainer.scrollLeft = allCinemas[currentItemIndex - INDEX_STEP_BACK].offsetLeft;
8742      }
8743    };
8744
8745    var getCurrentItemIndex = function getCurrentItemIndex() {
8746      var scrollPosition = scrollContainer.scrollLeft;
8747      return [].concat(_toConsumableArray(allCinemas)).findIndex(function (item) {
8748        return item.offsetLeft >= scrollPosition;
8749      }) + fullyVisibleColumns;
8750    };
8751
8752    var getScrollDistance = function getScrollDistance(targetIndex) {
8753      targetIndex = Math.max(0, Math.min(allCinemas.length - 2, targetIndex));
8754      return allCinemas[targetIndex].offsetLeft;
8755    };
8756
8757    if (allCinemas.length > 4) {
8758      cinemasCarousel.classList.add("is-active");
8759    }
8760
8761    var fullyVisibleColumns = Math.floor(scrollContainer.offsetWidth / allCinemas[0].offsetWidth);
8762
8763    nextArrow.addEventListener("click", handleNextClick);
8764    prevArrow.addEventListener("click", handlePrevClick);
8765  }
8766}
8767
8768},{}],72:[function(require,module,exports){
8769"use strict";
8770
8771var _swiperBundle = require("../../../../../node_modules/swiper/swiper-bundle.js");
8772
8773var _swiperBundle2 = _interopRequireDefault(_swiperBundle);
8774
8775function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8776
8777var crewSlider = new _swiperBundle2.default(".js-crew-slider", {
8778  //slidesPerView: 1.5,
8779  slidesPerView: "auto",
8780  freeMode: true,
8781  resistance: false,
8782  spaceBetween: 8,
8783  mousewheel: {
8784    forceToAxis: true
8785  }
8786  //   breakpoints: {
8787  //     768: {
8788  //       slidesPerView: 4.6,
8789  //     },
8790  //   },
8791});
8792
8793var movieDirectors = document.querySelector('.js-directors');
8794var indexIndicator = 0;
8795
8796if (movieDirectors) {
8797  var directorsCount = parseInt(movieDirectors.dataset.directors);
8798  if (directorsCount > 1) {
8799    indexIndicator = directorsCount - 1;
8800  }
8801}
8802var realRole = document.querySelector('.crew-member__role--0');
8803var fakeRole = document.querySelector('.fake-cast');
8804
8805crewSlider.on('slideChangeTransitionEnd', function (e) {
8806  var index = crewSlider.activeIndex;
8807  if (index > indexIndicator) {
8808    realRole.classList.add('is-hidden');
8809    fakeRole.classList.add('is-visible');
8810  }
8811});
8812
8813crewSlider.on('slideChange', function (e) {
8814  if (e.activeIndex === indexIndicator) {
8815    realRole.classList.remove('is-hidden');
8816    fakeRole.classList.remove('is-visible');
8817  }
8818});
8819
8820},{"../../../../../node_modules/swiper/swiper-bundle.js":194}],73:[function(require,module,exports){
8821"use strict";
8822
8823function getLocalStorageArray(key) {
8824  var data = localStorage.getItem(key);
8825  return data ? JSON.parse(data) : [];
8826}
8827
8828function saveLocalStorageArray(key, array) {
8829  localStorage.setItem(key, JSON.stringify(array));
8830}
8831
8832// function checkRevealedCodes() {
8833//   const allCodes = getLocalStorageArray('revealedCodes');
8834//   const wrapper = document.querySelector('.redeem-wrapper');
8835
8836//   if (!wrapper) return;
8837
8838//   const currentID = wrapper.id;
8839
8840//   if (allCodes.includes(currentID)) {
8841//     const revealButton = document.querySelector('.js-comps-offers-reveal');
8842//     if (revealButton) {
8843//       revealButton.classList.add('is-hidden');
8844//     }
8845
8846//     const redeemCode = wrapper.querySelector('.redeem-code');
8847//     if (redeemCode) {
8848//       redeemCode.classList.add('is-visible');
8849//     }
8850//   }
8851// }
8852
8853// Function to handle button click events
8854async function onRevealButtonClick(event) {
8855  var revealButton = event.target;
8856  var wrapper = revealButton.parentNode;
8857
8858  if (!wrapper) return;
8859
8860  var post_data = {
8861    user_id: revealButton.getAttribute("data-user_id"),
8862    promo_id: revealButton.getAttribute("data-promo_id")
8863  };
8864
8865  var promo_type = revealButton.getAttribute("data-promotype");
8866
8867  var response = await fetch("/member/rewards-comps/entry/", {
8868    method: 'post',
8869    body: new URLSearchParams(post_data)
8870  });
8871  var json = await response.json();
8872  var rewardID = wrapper.id;
8873  revealButton.classList.add('is-hidden');
8874
8875  var redeemCode = wrapper.querySelector('.redeem-code');
8876  if (redeemCode) {
8877    redeemCode.classList.add('is-visible');
8878    if (promo_type == 'reflinks') {
8879      if (json.data.reflink) redeemCode.innerHTML = "<a href=\"" + json.data.reflink + "\" target=\"_blank\">Your unique discount link</a>";else if (json.status == "Error" && json.error_messages.length > 0) redeemCode.innerHTML = json.error_messages[0];
8880    }
8881  }
8882
8883  // Add the rewardID to localStorage
8884  // const codesArray = getLocalStorageArray('revealedCodes');
8885  // if (!codesArray.includes(rewardID)) {
8886  //   codesArray.push(rewardID);
8887  //   saveLocalStorageArray('revealedCodes', codesArray);
8888  // }
8889}
8890
8891// Check initial revealed codes on page load
8892// checkRevealedCodes();
8893
8894var revealButton = document.querySelector('.js-comps-offers-reveal');
8895if (revealButton) {
8896  revealButton.addEventListener('click', onRevealButtonClick);
8897}
8898
8899},{}],74:[function(require,module,exports){
8900"use strict";
8901
8902var _swiperBundle = require("../../../../../node_modules/swiper/swiper-bundle.js");
8903
8904var _swiperBundle2 = _interopRequireDefault(_swiperBundle);
8905
8906function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8907
8908var opinionSlider = new _swiperBundle2.default(".js-more-content-panel-slider", {
8909  slidesPerView: 1,
8910  spaceBetween: 8,
8911  freeMode: true,
8912  resistance: false,
8913  mousewheel: {
8914    forceToAxis: true
8915  },
8916  navigation: {
8917    nextEl: ".more-content-panel-button-next",
8918    prevEl: ".more-content-panel-button-prev"
8919  },
8920  breakpoints: {
8921    768: {
8922      slidesPerView: 2,
8923      spaceBetween: 16
8924    }
8925  }
8926});
8927
8928},{"../../../../../node_modules/swiper/swiper-bundle.js":194}],75:[function(require,module,exports){
8929'use strict';
8930
8931var isOTPConfirm = document.querySelector('.js-otp-confirm');
8932
8933if (isOTPConfirm) {
8934    var otpLabel = document.querySelector('.js-otp-label');
8935    var otpError = document.querySelector('.js-otp-error');
8936
8937    var params = new URLSearchParams(window.location.search);
8938    if (params.has("showerror") && params.get("showerror") == "1") {
8939        otpLabel.classList.add('is-hidden');
8940        otpError.classList.remove('is-hidden');
8941    } else {
8942        otpLabel.classList.remove('is-hidden');
8943        otpError.classList.add('is-hidden');
8944    }
8945}
8946
8947},{}],76:[function(require,module,exports){
8948"use strict";
8949
8950var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
8951
8952var _jsRangeslider = require("js-rangeslider/src/js-rangeslider");
8953
8954var _jsRangeslider2 = _interopRequireDefault(_jsRangeslider);
8955
8956function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8957
8958// Initialize range sliders
8959var rangeSliders = document.querySelectorAll(".js-range-slider, .js-range-slider-2");
8960rangeSliders.forEach(function (slider) {
8961  return new _jsRangeslider2.default(slider, { outputFormatter: function outputFormatter(o) {
8962      return "" + o;
8963    } });
8964});
8965
8966var progressBarValues = {
8967  1980: "calc(61.6071% - 12.3214px)",
8968  1989: "calc(30.3571% - 6.07143px)",
8969  1990: "calc(70.5357% - 14.1071px)",
8970  1999: "calc(21.4286% - 4.28571px)",
8971  2000: "calc(79.4643% - 15.8929px)",
8972  2009: "calc(12.5% - 2.5px)",
8973  2010: "calc(88.3929% - 17.6786px)",
8974  2019: "calc(3.57143% - 0.714286px)",
8975  2020: "calc(97.3214% - 19.4643px)"
8976};
8977
8978// Function to set the range slider value
8979function setSliderValue(form, minValue, maxValue) {
8980  var output = form.querySelector(".output");
8981
8982  var _output$querySelector = output.querySelectorAll("span"),
8983      _output$querySelector2 = _slicedToArray(_output$querySelector, 2),
8984      minSpan = _output$querySelector2[0],
8985      maxSpan = _output$querySelector2[1];
8986
8987  var minInput = form.querySelector('[name="min"]');
8988  var maxInput = form.querySelector('[name="max"]');
8989  var progressBar = form.querySelector(".progress");
8990
8991  minSpan.innerHTML = minValue;
8992  maxSpan.innerHTML = maxValue;
8993  progressBar.style.left = progressBarValues[minValue];
8994  progressBar.style.right = progressBarValues[maxValue];
8995  minInput.value = minValue;
8996  maxInput.value = maxValue;
8997}
8998
8999// Event listener for predefined year buttons
9000document.querySelectorAll(".predefined-year__button").forEach(function (button) {
9001  button.addEventListener("click", function (e) {
9002    var year = Number(e.target.dataset.value);
9003    var formId = e.target.closest(".predefined-year-single") ? "release-year-form" : "global-filters";
9004    var form = document.getElementById(formId);
9005
9006    var currentYear = new Date().getFullYear();
9007    var maxYear = year === 2020 ? currentYear : year + 9;
9008    setSliderValue(form, year, maxYear);
9009  });
9010});
9011
9012},{"js-rangeslider/src/js-rangeslider":172}],77:[function(require,module,exports){
9013'use strict';
9014
9015function findReadMoreWrapper(node) {
9016    var parentWrapper = node;
9017
9018    while (parentWrapper && !(parentWrapper.querySelector && parentWrapper.querySelector('.new-read-more-short') && parentWrapper.querySelector('.new-read-more-full'))) {
9019        parentWrapper = parentWrapper.parentNode;
9020    }
9021
9022    return parentWrapper;
9023}
9024
9025var synopsis = Array.from(document.querySelectorAll('.js-new-read-more'));
9026if (synopsis.length > 0) {
9027    synopsis.forEach(function (s) {
9028        s.addEventListener('click', function (e) {
9029            var parentWrapper = findReadMoreWrapper(s);
9030            if (!parentWrapper) return;
9031
9032            var shortVersion = parentWrapper.querySelector('.new-read-more-short');
9033            var longVersion = parentWrapper.querySelector('.new-read-more-full');
9034            if (!shortVersion || !longVersion) return;
9035
9036            shortVersion.classList.add('is-hidden');
9037            longVersion.classList.remove('is-hidden');
9038        });
9039    });
9040}
9041
9042var collapse = Array.from(document.querySelectorAll('.js-new-read-less'));
9043if (collapse.length > 0) {
9044    collapse.forEach(function (c) {
9045        c.addEventListener('click', function (e) {
9046            var parentWrapper = findReadMoreWrapper(c);
9047            if (!parentWrapper) return;
9048
9049            var longVersion = parentWrapper.querySelector('.new-read-more-full');
9050            var shortVersion = parentWrapper.querySelector('.new-read-more-short');
9051            if (!shortVersion || !longVersion) return;
9052
9053            shortVersion.classList.remove('is-hidden');
9054            longVersion.classList.add('is-hidden');
9055        });
9056    });
9057}
9058
9059},{}],78:[function(require,module,exports){
9060'use strict';
9061
9062var redirectSelect = document.querySelector('.js-redirect-on-select');
9063
9064if (redirectSelect) {
9065   redirectSelect.addEventListener('change', function (e) {
9066      var newLocation = e.target.value;
9067      window.location.href = location.origin + '/' + newLocation;
9068   });
9069}
9070
9071},{}],79:[function(require,module,exports){
9072"use strict";
9073
9074var _jsCookie = require("js-cookie");
9075
9076var _jsCookie2 = _interopRequireDefault(_jsCookie);
9077
9078function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9079
9080var appConfig = typeof window !== "undefined" && window.__APP_CONFIG || {};
9081var MAPTILER_API_KEY = appConfig.maptilerApiKey || appConfig.mapTilerApiKey || "AbmHYXKfqz8hmNs1h31h";
9082var MAPTILER_SDK_URL = "https://esm.sh/@maptiler/[email protected]?bundle";
9083var MAPTILER_SDK_CSS_URL = "https://cdn.jsdelivr.net/npm/@maptiler/[email protected]/dist/maptiler-sdk.css";
9084var MAPTILER_STYLE_FALLBACK = "https://api.maptiler.com/maps/streets-v2/style.json";
9085var MAPTILER_STYLE = appConfig.maptilerStyle || appConfig.mapTilerStyle || MAPTILER_STYLE_FALLBACK;
9086
9087/* =========================
9088   Config
9089========================= */
9090var GLOBAL_USERNAME = "";
9091
9092var CLUSTER_SOURCE_ID = "region-cinemas-source";
9093var CLUSTERS_LAYER_ID = "region-cinemas-clusters";
9094var CLUSTER_COUNT_LAYER_ID = "region-cinemas-cluster-count";
9095var UNCLUSTERED_LAYER_ID = "region-cinemas-unclustered";
9096var EMPTY_GEOJSON = {
9097  type: "FeatureCollection",
9098  features: []
9099};
9100
9101var maptilerSdk = null;
9102var maptilerSdkPromise = null;
9103var activeMap = null;
9104var mapLoaded = false;
9105var clusterInteractionsBound = false;
9106var suppressNextMapClick = false;
9107
9108function ensureMapTilerStylesheet() {
9109  var existingLink = document.querySelector('link[data-maptiler-sdk-css="1"]');
9110  if (existingLink) return;
9111
9112  var link = document.createElement("link");
9113  link.rel = "stylesheet";
9114  link.href = MAPTILER_SDK_CSS_URL;
9115  link.dataset.maptilerSdkCss = "1";
9116  document.head.appendChild(link);
9117}
9118
9119function loadMapTilerSdk() {
9120  if (maptilerSdk) return Promise.resolve(maptilerSdk);
9121  if (maptilerSdkPromise) return maptilerSdkPromise;
9122
9123  ensureMapTilerStylesheet();
9124
9125  maptilerSdkPromise = new Function("specifier", "return import(specifier);")(MAPTILER_SDK_URL).then(function (sdk) {
9126    maptilerSdk = sdk;
9127
9128    if (MAPTILER_API_KEY && maptilerSdk.config) {
9129      maptilerSdk.config.apiKey = MAPTILER_API_KEY;
9130    }
9131
9132    return maptilerSdk;
9133  }).catch(function (error) {
9134    maptilerSdkPromise = null;
9135    throw error;
9136  });
9137
9138  return maptilerSdkPromise;
9139}
9140
9141/* =========================
9142   DOM helpers
9143========================= */
9144var cinemasLoaderWrapper = document.querySelector(".js-cinemas-skeleton-loader");
9145var cinemasListings = document.querySelector(".js-geo-cinemas-container");
9146var noResultsWrapper = document.querySelector(".js-playing-now__no-results");
9147var cinemaFiltersWrapper = document.querySelector(".js-region-cinema-filters");
9148var cinemaFiltersDivider = document.querySelector(".js-region-cinema-filters-divider");
9149
9150function showCinemasLoader() {
9151  if (cinemasLoaderWrapper) cinemasLoaderWrapper.classList.add("is-visible");
9152  if (cinemasListings) cinemasListings.classList.remove("is-visible");
9153}
9154
9155function hideCinemasLoader() {
9156  if (cinemasLoaderWrapper) cinemasLoaderWrapper.classList.remove("is-visible");
9157  if (cinemasListings) cinemasListings.classList.add("is-visible");
9158}
9159
9160function showNoResultsMessage() {
9161  if (noResultsWrapper) noResultsWrapper.classList.add("is-visible");
9162}
9163
9164function hideNoResultsMessage() {
9165  if (noResultsWrapper) noResultsWrapper.classList.remove("is-visible");
9166}
9167
9168/* =========================
9169   Data
9170========================= */
9171var userFavCinemas = [];
9172var currentMode = "near";
9173var IS_REGION_MODE = false;
9174var selectedCinemaTag = "";
9175
9176/* =========================
9177   Map globals
9178========================= */
9179var currentCinemas = [];
9180var currentCinemaById = new Map();
9181var domMarkersById = new Map();
9182
9183var PIN_BASE_ZOOM = 13;
9184var PIN_BASE_SIZE = 28;
9185var PIN_MIN_SIZE = 20;
9186var PIN_MAX_SIZE = 44;
9187var PIN_SCALE_FACTOR = 1.12;
9188var REGION_MIN_AUTO_FIT_ZOOM = 9;
9189var GPS_MIN_AUTO_FIT_ZOOM = 11;
9190var GPS_SEARCH_BOUNDS_KM = 40;
9191var GPS_DESKTOP_MIN_AUTO_FIT_ZOOM = 9;
9192var CLUSTER_MAX_ZOOM = 13;
9193var CLUSTER_RADIUS = 28;
9194var CLUSTER_CLICK_TARGET_ZOOM = 15;
9195var CLUSTER_CLICK_ANIMATION_DURATION = 900;
9196
9197function getMinAutoFitZoom() {
9198  if (IS_REGION_MODE) return REGION_MIN_AUTO_FIT_ZOOM;
9199  if (typeof window !== "undefined" && window.innerWidth >= 768) {
9200    return GPS_DESKTOP_MIN_AUTO_FIT_ZOOM;
9201  }
9202  return GPS_MIN_AUTO_FIT_ZOOM;
9203}
9204
9205function getPinSizeForZoom(zoom) {
9206  var rawSize = PIN_BASE_SIZE * Math.pow(PIN_SCALE_FACTOR, zoom - PIN_BASE_ZOOM);
9207  return Math.round(Math.min(PIN_MAX_SIZE, Math.max(PIN_MIN_SIZE, rawSize)));
9208}
9209
9210function getUnclusteredCircleRadiusExpression() {
9211  var stops = [3, 8, 13, 16];
9212  var values = stops.reduce(function (acc, zoom) {
9213    var radius = Math.max(8, Math.round(getPinSizeForZoom(zoom) * 0.62));
9214    return acc.concat([zoom, radius]);
9215  }, []);
9216
9217  return ["interpolate", ["linear"], ["zoom"]].concat(values);
9218}
9219
9220function createClusterCountLayer() {
9221  return {
9222    id: CLUSTER_COUNT_LAYER_ID,
9223    type: "symbol",
9224    source: CLUSTER_SOURCE_ID,
9225    filter: ["has", "point_count"],
9226    layout: {
9227      "text-field": ["get", "point_count_abbreviated"],
9228      "text-size": 14,
9229      "text-font": ["Open Sans Bold", "Arial Unicode MS Bold"]
9230    },
9231    paint: {
9232      "text-color": "#EAEBEA"
9233    }
9234  };
9235}
9236
9237function createClustersLayer() {
9238  return {
9239    id: CLUSTERS_LAYER_ID,
9240    type: "circle",
9241    source: CLUSTER_SOURCE_ID,
9242    filter: ["has", "point_count"],
9243    paint: {
9244      "circle-color": "#D95959",
9245      "circle-opacity": 0.92,
9246      "circle-stroke-color": "#EAEBEA",
9247      "circle-stroke-width": 2,
9248      "circle-radius": ["step", ["get", "point_count"], 20, 10, 24, 25, 28, 50, 32]
9249    }
9250  };
9251}
9252
9253function createUnclusteredLayer() {
9254  return {
9255    id: UNCLUSTERED_LAYER_ID,
9256    type: "circle",
9257    source: CLUSTER_SOURCE_ID,
9258    filter: ["!", ["has", "point_count"]],
9259    paint: {
9260      "circle-radius": getUnclusteredCircleRadiusExpression(),
9261      "circle-color": "rgba(0, 0, 0, 0)",
9262      "circle-stroke-width": 0
9263    }
9264  };
9265}
9266
9267function cinemaKey(c) {
9268  return String(c.id || c.name || c.slug || "");
9269}
9270
9271/* =========================
9272   Utility
9273========================= */
9274function normalizeCinema(c) {
9275  var slug = c.name || c.slug || "";
9276  var title = c.title || c.name || c.slug || "";
9277
9278  var movieCount = c.movieCount != null ? Number(c.movieCount) : c.movie_count != null ? Number(c.movie_count) : 0;
9279
9280  return {
9281    name: slug,
9282    title: title,
9283    movieCount: movieCount,
9284    city: c.city,
9285
9286    lat: c.lat,
9287    lon: c.lon,
9288
9289    address: c.address || "",
9290    images: c.images || {},
9291
9292    distance: c.distance != null ? c.distance : null,
9293
9294    tags: Array.isArray(c.tags) ? c.tags : [],
9295
9296    id: c.id || null,
9297    slug: c.slug || slug
9298  };
9299}
9300
9301function updateCount(n) {
9302  var countWrapper = document.querySelector(".js-cinemas-count");
9303  if (!countWrapper) return;
9304  var word = n === 1 ? "cinema" : "cinemas";
9305  countWrapper.innerHTML = n + " " + word;
9306}
9307
9308function getUniqueCinemaTags(items) {
9309  var seen = new Set();
9310  var tags = [];
9311
9312  (items || []).forEach(function (cinema) {
9313    (cinema.tags || []).forEach(function (tag) {
9314      var value = String(tag || "").trim();
9315      var key = value.toLowerCase();
9316      if (!value || seen.has(key)) return;
9317      seen.add(key);
9318      tags.push(value);
9319    });
9320  });
9321
9322  return tags;
9323}
9324
9325function filterCinemasBySelectedTag(items) {
9326  if (!selectedCinemaTag) return items;
9327
9328  return (items || []).filter(function (cinema) {
9329    return Array.isArray(cinema.tags) && cinema.tags.some(function (tag) {
9330      return String(tag || "").trim().toLowerCase() === selectedCinemaTag.toLowerCase();
9331    });
9332  });
9333}
9334
9335function renderCinemaFilters(items) {
9336  if (!cinemaFiltersWrapper) return;
9337
9338  var tags = getUniqueCinemaTags(items);
9339
9340  if (!tags.length) {
9341    cinemaFiltersWrapper.innerHTML = "";
9342    cinemaFiltersWrapper.style.display = "none";
9343    if (cinemaFiltersDivider) cinemaFiltersDivider.style.display = "none";
9344    selectedCinemaTag = "";
9345    return;
9346  }
9347
9348  cinemaFiltersWrapper.style.display = "";
9349  if (cinemaFiltersDivider) cinemaFiltersDivider.style.display = "";
9350  cinemaFiltersWrapper.innerHTML = tags.map(function (tag) {
9351    var isSelected = selectedCinemaTag.toLowerCase() === tag.toLowerCase();
9352    return "<button class=\"v6-button side-filter js-region-cinema-filter" + (isSelected ? " is-selected" : "") + "\" type=\"button\" data-tag=\"" + tag + "\"><span>" + tag + "</span></button>";
9353  }).join("");
9354}
9355
9356function cinemasToGeoJSON(items) {
9357  return {
9358    type: "FeatureCollection",
9359    features: (items || []).reduce(function (features, rawCinema) {
9360      var cinema = normalizeCinema(rawCinema);
9361      var key = cinemaKey(cinema);
9362      var lat = parseFloat(cinema.lat);
9363      var lon = parseFloat(cinema.lon);
9364
9365      if (!key || !Number.isFinite(lat) || !Number.isFinite(lon)) return features;
9366
9367      features.push({
9368        type: "Feature",
9369        geometry: {
9370          type: "Point",
9371          coordinates: [lon, lat]
9372        },
9373        properties: {
9374          id: key,
9375          title: cinema.title || cinema.name || "Cinema"
9376        }
9377      });
9378
9379      return features;
9380    }, [])
9381  };
9382}
9383
9384function clearDomMarkers() {
9385  domMarkersById.forEach(function (entry) {
9386    if (entry && entry.marker) entry.marker.remove();
9387  });
9388  domMarkersById.clear();
9389}
9390
9391function createDomMarkerElement(cinema) {
9392  var button = document.createElement("button");
9393  button.type = "button";
9394  button.className = "js-region-cinema-map-marker region-cinema-map-marker";
9395  button.setAttribute("aria-label", cinema.title || cinema.name || "Cinema");
9396
9397  var image = document.createElement("img");
9398  image.className = "region-cinema-map-marker__image";
9399  image.src = cinema.images && cinema.images.image || "";
9400  image.alt = cinema.title || cinema.name || "Cinema";
9401
9402  button.appendChild(image);
9403
9404  button.addEventListener("click", function (event) {
9405    event.preventDefault();
9406    event.stopPropagation();
9407    suppressNextMapClick = true;
9408    showCinemaPanel(cinema);
9409  });
9410
9411  return button;
9412}
9413
9414function syncDomMarkersWithClusters(map) {
9415  if (!mapLoaded || !map || !map.getSource(CLUSTER_SOURCE_ID)) return;
9416  if (!map.getLayer(UNCLUSTERED_LAYER_ID)) return;
9417
9418  var features = map.queryRenderedFeatures(undefined, {
9419    layers: [UNCLUSTERED_LAYER_ID]
9420  });
9421
9422  var visibleIds = new Set();
9423
9424  features.forEach(function (feature) {
9425    var id = String(feature && feature.properties && feature.properties.id || "");
9426    if (!id || visibleIds.has(id)) return;
9427
9428    var geometry = feature.geometry;
9429    var coordinates = geometry && geometry.type === "Point" ? geometry.coordinates : null;
9430    if (!Array.isArray(coordinates) || coordinates.length < 2) return;
9431
9432    var cinema = currentCinemaById.get(id);
9433    if (!cinema) return;
9434
9435    visibleIds.add(id);
9436
9437    if (!domMarkersById.has(id)) {
9438      var marker = new maptilerSdk.Marker({
9439        element: createDomMarkerElement(cinema),
9440        anchor: "center"
9441      }).setLngLat(coordinates).addTo(map);
9442
9443      domMarkersById.set(id, { marker: marker });
9444      return;
9445    }
9446
9447    var existing = domMarkersById.get(id);
9448    existing.marker.setLngLat(coordinates);
9449  });
9450
9451  domMarkersById.forEach(function (entry, id) {
9452    if (visibleIds.has(id)) return;
9453    entry.marker.remove();
9454    domMarkersById.delete(id);
9455  });
9456}
9457
9458function clearAllMarkers() {
9459  clearDomMarkers();
9460  currentCinemaById.clear();
9461
9462  if (mapLoaded && activeMap && activeMap.getSource(CLUSTER_SOURCE_ID)) {
9463    activeMap.getSource(CLUSTER_SOURCE_ID).setData(EMPTY_GEOJSON);
9464  }
9465}
9466
9467function fitMapToCinemas(map, items) {
9468  var minAutoFitZoom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : REGION_MIN_AUTO_FIT_ZOOM;
9469
9470  var bounds = new maptilerSdk.LngLatBounds();
9471  var count = 0;
9472
9473  var _iteratorNormalCompletion = true;
9474  var _didIteratorError = false;
9475  var _iteratorError = undefined;
9476
9477  try {
9478    for (var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
9479      var c = _step.value;
9480
9481      var lat = parseFloat(c.lat);
9482      var lon = parseFloat(c.lon);
9483      if (!Number.isFinite(lat) || !Number.isFinite(lon)) continue;
9484      bounds.extend([lon, lat]);
9485      count += 1;
9486    }
9487  } catch (err) {
9488    _didIteratorError = true;
9489    _iteratorError = err;
9490  } finally {
9491    try {
9492      if (!_iteratorNormalCompletion && _iterator.return) {
9493        _iterator.return();
9494      }
9495    } finally {
9496      if (_didIteratorError) {
9497        throw _iteratorError;
9498      }
9499    }
9500  }
9501
9502  if (count === 0) return Promise.resolve();
9503
9504  var boundsCenter = bounds.getCenter();
9505
9506  if (count === 1) {
9507    var firstCinema = items.find(function (item) {
9508      return Number.isFinite(parseFloat(item.lat)) && Number.isFinite(parseFloat(item.lon));
9509    });
9510    if (firstCinema) {
9511      map.setCenter([parseFloat(firstCinema.lon), parseFloat(firstCinema.lat)]);
9512      map.setZoom(13);
9513    }
9514    return Promise.resolve();
9515  }
9516
9517  return new Promise(function (resolve) {
9518    map.fitBounds(bounds, { padding: 60, duration: 0 });
9519
9520    map.once("idle", function () {
9521      var zoom = Number(map.getZoom());
9522      if (Number.isFinite(zoom) && zoom < minAutoFitZoom) {
9523        map.once("idle", resolve);
9524        if (boundsCenter) {
9525          map.setCenter(boundsCenter);
9526        }
9527        map.setZoom(minAutoFitZoom);
9528        return;
9529      }
9530
9531      if (boundsCenter) {
9532        map.setCenter(boundsCenter);
9533      }
9534      resolve();
9535    });
9536  });
9537}
9538
9539function ensureMapLayers(map, items) {
9540  var geojson = cinemasToGeoJSON(items);
9541
9542  if (map.getSource(CLUSTER_SOURCE_ID)) {
9543    map.getSource(CLUSTER_SOURCE_ID).setData(geojson);
9544    return;
9545  }
9546
9547  map.addSource(CLUSTER_SOURCE_ID, {
9548    type: "geojson",
9549    data: geojson,
9550    cluster: true,
9551    clusterMaxZoom: CLUSTER_MAX_ZOOM,
9552    clusterRadius: CLUSTER_RADIUS
9553  });
9554
9555  map.addLayer(createUnclusteredLayer());
9556  map.addLayer(createClustersLayer());
9557  map.addLayer(createClusterCountLayer());
9558}
9559
9560function hideCinemaPanel() {
9561  var panel = document.querySelector(".js-cinema-panel");
9562  if (!panel) return;
9563
9564  panel.innerHTML = "";
9565  panel.classList.remove("is-visible");
9566}
9567
9568function followUpClusterZoom(map) {
9569  map.once("idle", function () {
9570    syncDomMarkersWithClusters(map);
9571  });
9572}
9573
9574function getClusterLeaves(source, clusterId) {
9575  var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
9576
9577  if (!source || typeof source.getClusterLeaves !== "function") {
9578    return Promise.resolve([]);
9579  }
9580
9581  var maybePromise = source.getClusterLeaves(clusterId, limit, 0);
9582
9583  if (maybePromise && typeof maybePromise.then === "function") {
9584    return maybePromise.then(function (leaves) {
9585      return Array.isArray(leaves) ? leaves : [];
9586    });
9587  }
9588
9589  return new Promise(function (resolve, reject) {
9590    source.getClusterLeaves(clusterId, limit, 0, function (error, leaves) {
9591      if (error) {
9592        reject(error);
9593        return;
9594      }
9595
9596      resolve(Array.isArray(leaves) ? leaves : []);
9597    });
9598  });
9599}
9600
9601async function zoomToCluster(event) {
9602  var feature = event.features && event.features[0];
9603  if (!feature || !feature.properties) return;
9604
9605  if (event.originalEvent) {
9606    if (typeof event.originalEvent.preventDefault === "function") {
9607      event.originalEvent.preventDefault();
9608    }
9609    if (typeof event.originalEvent.stopPropagation === "function") {
9610      event.originalEvent.stopPropagation();
9611    }
9612  }
9613
9614  suppressNextMapClick = true;
9615
9616  var clusterId = feature.properties.cluster_id;
9617  var source = activeMap && activeMap.getSource(CLUSTER_SOURCE_ID);
9618  var targetCoordinates = Array.isArray(feature.geometry && feature.geometry.coordinates) ? feature.geometry.coordinates.slice() : null;
9619
9620  if (!source || !targetCoordinates) return;
9621
9622  try {
9623    var leaves = await getClusterLeaves(source, clusterId);
9624    var bounds = new maptilerSdk.LngLatBounds();
9625    var pointsCount = 0;
9626
9627    leaves.forEach(function (leaf) {
9628      var coordinates = leaf && leaf.geometry && leaf.geometry.type === "Point" ? leaf.geometry.coordinates : null;
9629
9630      if (!Array.isArray(coordinates) || coordinates.length < 2) return;
9631
9632      bounds.extend(coordinates);
9633      pointsCount += 1;
9634    });
9635
9636    followUpClusterZoom(activeMap);
9637
9638    if (pointsCount > 1) {
9639      activeMap.fitBounds(bounds, {
9640        padding: 60,
9641        maxZoom: CLUSTER_CLICK_TARGET_ZOOM,
9642        duration: CLUSTER_CLICK_ANIMATION_DURATION
9643      });
9644      return;
9645    }
9646
9647    activeMap.easeTo({
9648      center: targetCoordinates,
9649      zoom: CLUSTER_CLICK_TARGET_ZOOM,
9650      duration: CLUSTER_CLICK_ANIMATION_DURATION
9651    });
9652  } catch (error) {
9653    activeMap.easeTo({
9654      center: targetCoordinates,
9655      zoom: CLUSTER_CLICK_TARGET_ZOOM,
9656      duration: CLUSTER_CLICK_ANIMATION_DURATION
9657    });
9658  }
9659}
9660
9661function attachMapInteractions(map) {
9662  if (clusterInteractionsBound) return;
9663
9664  map.on("click", CLUSTERS_LAYER_ID, zoomToCluster);
9665  map.on("click", CLUSTER_COUNT_LAYER_ID, zoomToCluster);
9666
9667  map.on("mouseenter", CLUSTERS_LAYER_ID, function () {
9668    map.getCanvas().style.cursor = "pointer";
9669  });
9670  map.on("mouseleave", CLUSTERS_LAYER_ID, function () {
9671    map.getCanvas().style.cursor = "";
9672  });
9673  map.on("mouseenter", CLUSTER_COUNT_LAYER_ID, function () {
9674    map.getCanvas().style.cursor = "pointer";
9675  });
9676  map.on("mouseleave", CLUSTER_COUNT_LAYER_ID, function () {
9677    map.getCanvas().style.cursor = "";
9678  });
9679
9680  clusterInteractionsBound = true;
9681}
9682
9683function attachMapMarkerSyncListeners(map) {
9684  map.on("moveend", function () {
9685    syncDomMarkersWithClusters(map);
9686  });
9687
9688  map.on("zoomend", function () {
9689    syncDomMarkersWithClusters(map);
9690  });
9691
9692  map.on("sourcedata", function (event) {
9693    if (!event || event.sourceId !== CLUSTER_SOURCE_ID) return;
9694    syncDomMarkersWithClusters(map);
9695  });
9696}
9697
9698/* =========================
9699   Favourites
9700========================= */
9701async function loadUserFavCinemas(lat, lng) {
9702  try {
9703    var res = await fetch("/member/json-fav-cinemas/?lat=" + lat + "&lon=" + lng);
9704    if (!res.ok) throw new Error("Fav cinemas API error: " + res.status);
9705
9706    var data = await res.json();
9707
9708    var items = Array.isArray(data.items) ? data.items : Array.isArray(data) ? data : [];
9709
9710    userFavCinemas = items;
9711  } catch (err) {
9712    console.error("Failed to load favourite cinemas:", err);
9713    userFavCinemas = [];
9714  }
9715}
9716
9717/* =========================
9718  List rendering
9719========================= */
9720function formatDistance(value) {
9721  var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "km";
9722
9723  if (value == null || isNaN(value)) return "";
9724
9725  var distance = value;
9726
9727  if (unit === "mi") {
9728    distance = value * 0.621371;
9729    if (distance >= 1) return Math.round(distance) + " " + unit;
9730    return "<1 mi";
9731  }
9732
9733  if (distance >= 1) return Math.round(distance) + " " + unit;
9734  return "<1 km";
9735}
9736
9737function isFavCinema(c) {
9738  return userFavCinemas.some(function (fav) {
9739    return fav.slug === c.name;
9740  });
9741}
9742
9743function upsertFavCinema(slug, isOn) {
9744  if (!slug) return;
9745  if (Number(isOn) === 1) {
9746    var exists = userFavCinemas.some(function (fav) {
9747      return fav.slug === slug;
9748    });
9749    if (!exists) userFavCinemas = userFavCinemas.concat([{ slug: slug }]);
9750    return;
9751  }
9752  userFavCinemas = (userFavCinemas || []).filter(function (fav) {
9753    return fav.slug !== slug;
9754  });
9755}
9756
9757var cinemaToHTML = function cinemaToHTML(c) {
9758  var isFav = isFavCinema(c);
9759  var buttonClasses = isFav ? "more-cinemas__add-to-watchlist js-add-cinema-to-fav ga-track is-fav" : "more-cinemas__add-to-watchlist js-add-cinema-to-fav ga-track";
9760
9761  var isOn = isFav ? "1" : "0";
9762  var href = "/cinema/" + encodeURIComponent(c.name) + "/";
9763  var imgSrc = c.images.image;
9764  var alt = c.title || c.name;
9765  var title = c.title || c.name;
9766  var slug = c.name || "";
9767  var movies = Number(c.movieCount) || 0;
9768  var moviesText = movies + " " + (movies === 1 ? "movie" : "movies");
9769  var formattedDistance = formatDistance(c.distance, distance_unit);
9770
9771  var addressHTML = c.city || c.address ? "<address class=\"more-cinemas__address\" style=\"font-style: normal; margin: 0;\">" + (c.city || c.address) + "</address>" : "";
9772
9773  var distanceHTML = !IS_REGION_MODE && c.distance ? "<span class=\"more-cinemas__distance\">" + formattedDistance + "</span>" : "";
9774  var tagsHTML = c.tags && c.tags.length ? c.tags.map(function (tag) {
9775    return "<span class=\"more-cinemas__type\">" + tag + "</span>";
9776  }).join("<span class=\"more-cinemas__circular-divider\">\u2022</span>") : "";
9777
9778  var moviesHTML = moviesText ? "<span class=\"more-cinemas__movies\">" + moviesText + "</span>" : "";
9779
9780  var detailParts = [addressHTML, distanceHTML, tagsHTML, moviesHTML].filter(Boolean);
9781  var detailsHTML = detailParts.join("<span class=\"more-cinemas__circular-divider\"> \u2022 </span>");
9782
9783  return "\n<div class=\"more-cinemas__single-entry fade-scale\">\n  <a class=\"more-cinemas__link\" href=\"" + href + "\">\n    <div class=\"more-cinemas__media\">\n      <img src=\"" + imgSrc + "\" alt=\"" + alt + "\">\n    </div>\n    <div class=\"more-cinemas__meta\">\n      <h2 class=\"more-cinemas__title\">" + title + "</h2>\n      <div class=\"more-cinemas__details\">\n        " + detailsHTML + "\n      </div>\n    </div>\n  </a>\n  <div class=\"more-cinemas__fav\">\n    <button\n      class=\"" + buttonClasses + "\"\n      title=\"Add to your cinemas list\"\n      data-list=\"cinema\"\n      data-slug=\"" + slug + "\"\n      data-event=\"add_to_cinemas\"\n      data-title=\"" + title + "\"\n      data-on=\"" + isOn + "\"\n      data-cinema=\"" + slug + "\"\n      data-username=\"" + GLOBAL_USERNAME + "\"\n    >\n      <div class=\"cross\"><svg><use xlink:href=\"#v6addtolist\"></use></svg></div>\n      <div class=\"tick\"><svg><use xlink:href=\"#v6onlist\"></use></svg></div>\n    </button>\n  </div>\n</div>";
9784};
9785
9786function renderCinemasList(items) {
9787  var container = document.querySelector(".js-geo-cinemas-container");
9788  if (!container) return;
9789  var favs = [];
9790  var others = [];
9791
9792  items.forEach(function (c) {
9793    if (isFavCinema(c)) favs.push(c);else others.push(c);
9794  });
9795
9796  var ordered = favs.concat(others);
9797  container.innerHTML = ordered.map(cinemaToHTML).join("");
9798}
9799
9800function getBaseCinemaItems() {
9801  if (currentMode === "my") {
9802    return (userFavCinemas || []).map(normalizeCinema);
9803  }
9804
9805  return currentCinemas || [];
9806}
9807
9808async function addCinemasToMap(items, map) {
9809  currentCinemaById = (items || []).reduce(function (acc, rawCinema) {
9810    var cinema = normalizeCinema(rawCinema);
9811    var key = cinemaKey(cinema);
9812    var lat = parseFloat(cinema.lat);
9813    var lon = parseFloat(cinema.lon);
9814
9815    if (!key || !Number.isFinite(lat) || !Number.isFinite(lon)) return acc;
9816
9817    acc.set(key, cinema);
9818    return acc;
9819  }, new Map());
9820
9821  if (!mapLoaded) return;
9822
9823  ensureMapLayers(map, items);
9824  syncDomMarkersWithClusters(map);
9825}
9826
9827async function updateCinemaResults(map) {
9828  var baseItems = getBaseCinemaItems();
9829  var filteredItems = filterCinemasBySelectedTag(baseItems);
9830  var minAutoFitZoom = getMinAutoFitZoom();
9831
9832  renderCinemaFilters(baseItems);
9833  updateCount(filteredItems.length);
9834
9835  if (filteredItems.length) hideNoResultsMessage();else showNoResultsMessage();
9836
9837  renderCinemasList(filteredItems);
9838
9839  if (!map) return;
9840
9841  hideCinemaPanel();
9842  clearAllMarkers();
9843  await addCinemasToMap(filteredItems, map);
9844  await fitMapToCinemas(map, filteredItems, minAutoFitZoom);
9845}
9846
9847function rerenderCurrentList() {
9848  updateCinemaResults(activeMap);
9849}
9850
9851window.addEventListener("fav-cinema-changed", function (e) {
9852  if (!e || !e.detail) return;
9853  upsertFavCinema(e.detail.slug, e.detail.is_on);
9854  rerenderCurrentList();
9855});
9856
9857/* =========================
9858   Bottom panel
9859========================= */
9860function cinemaPanelHTML(c) {
9861  var isFav = isFavCinema(c);
9862  var buttonClasses = isFav ? "more-cinemas__add-to-watchlist js-add-cinema-to-fav ga-track is-fav" : "more-cinemas__add-to-watchlist js-add-cinema-to-fav ga-track";
9863
9864  var isOn = isFav ? "1" : "0";
9865
9866  var href = "/cinema/" + encodeURIComponent(c.name) + "/";
9867  var imgSrc = c.images.image;
9868  var title = c.title || c.name;
9869  var movies = Number(c.movieCount) || 0;
9870  var moviesText = movies ? movies + " " + (movies === 1 ? "movie" : "movies") : "";
9871  var formattedDistance = formatDistance(c.distance, distance_unit);
9872
9873  var metaParts = [];
9874
9875  if (c.city || c.address) {
9876    metaParts.push('<span class="cinema-panel__address">' + (c.city || c.address) + "</span>");
9877  }
9878
9879  if (!IS_REGION_MODE && formattedDistance) {
9880    metaParts.push('<span class="cinema-panel__distance">
9880' + formattedDistance + "</span>");
9881  }
9882
9883  if (c.tags && c.tags.length) {
9884    metaParts.push(c.tags.map(function (tag) {
9885      return "<span class=\"more-cinemas__type\">" + tag + "</span>";
9886    }).join('<span class="cinema-panel__separator"> • </span>'));
9887  }
9888
9889  if (moviesText) {
9890    metaParts.push('<span class="cinema-panel__movies">' + moviesText + "</span>");
9891  }
9892
9893  var meta = metaParts.join('<span class="cinema-panel__separator"> • </span>');
9894
9895  return "\n    <div class=\"cinema-panel__inner\">\n      <a href=\"" + href + "\" class=\"cinema-panel__media\">\n        <img src=\"" + imgSrc + "\" alt=\"" + title + "\">\n      </a>\n      <div class=\"cinema-panel__content\">\n        <a href=\"" + href + "\" class=\"cinema-panel__title\">" + title + "</a>\n        <div class=\"cinema-panel__meta\">" + meta + "</div>\n      </div>\n      <div class=\"cinema-panel__actions\">\n        <button\n          class=\"" + buttonClasses + "\"\n          title=\"Add to your cinemas list\"\n          data-list=\"cinema\"\n          data-slug=\"" + (c.name || "") + "\"\n          data-event=\"add_to_cinemas\"\n          data-title=\"" + title + "\"\n          data-on=\"" + isOn + "\"\n          data-cinema=\"" + (c.name || "") + "\"\n          data-username=\"" + GLOBAL_USERNAME + "\"\n        >\n          <div class=\"cross\"><svg><use xlink:href=\"#v6addtolist\"></use></svg></div>\n          <div class=\"tick\"><svg><use xlink:href=\"#v6onlist\"></use></svg></div>\n        </button>\n      </div>\n    </div>\n  ";
9896}
9897
9898function showCinemaPanel(cinema) {
9899  var panel = document.querySelector(".js-cinema-panel");
9900  if (!panel) return;
9901
9902  panel.innerHTML = cinemaPanelHTML(cinema);
9903  panel.classList.add("is-visible");
9904}
9905
9906/* =========================
9907   Map expand on mobile
9908========================= */
9909var mapExpanded = false;
9910var canAutoExpandMap = false;
9911
9912function makeExpandMapHandler(map, button) {
9913  return function expandMap() {
9914    if (window.innerWidth > 768) return;
9915    if (!canAutoExpandMap) return;
9916    if (mapExpanded) return;
9917
9918    var mapEl = document.getElementById("cinemas-map");
9919    if (!mapEl) return;
9920
9921    mapExpanded = true;
9922    mapEl.classList.add("is-expanded");
9923
9924    if (button) {
9925      button.style.display = "";
9926    }
9927
9928    syncMapAfterSizeTransition(map, mapEl);
9929  };
9930}
9931
9932function makeShrinkMapHandler(map, button) {
9933  return function shrinkMap(e) {
9934    e.preventDefault();
9935    if (window.innerWidth > 768) return;
9936    if (!mapExpanded) return;
9937
9938    var mapEl = document.getElementById("cinemas-map");
9939    if (!mapEl) return;
9940
9941    mapExpanded = false;
9942    mapEl.classList.remove("is-expanded");
9943
9944    if (button) {
9945      button.style.display = "none";
9946    }
9947
9948    syncMapAfterSizeTransition(map, mapEl);
9949  };
9950}
9951
9952function syncMapAfterSizeTransition(map, mapEl, afterSync) {
9953  var handleTransitionEnd = function handleTransitionEnd(event) {
9954    if (event.target !== mapEl || event.propertyName !== "height") return;
9955    mapEl.removeEventListener("transitionend", handleTransitionEnd);
9956
9957    requestAnimationFrame(function () {
9958      map.resize();
9959      if (afterSync) afterSync();
9960    });
9961  };
9962
9963  mapEl.addEventListener("transitionend", handleTransitionEnd);
9964}
9965
9966function attachMapZoomControlLogging(map, mapEl) {
9967  mapEl.addEventListener("click", function (event) {
9968    var zoomInButton = event.target.closest(".maplibregl-ctrl-zoom-in, .maptiler-ctrl-zoom-in");
9969    var zoomOutButton = event.target.closest(".maplibregl-ctrl-zoom-out, .maptiler-ctrl-zoom-out");
9970
9971    if (!zoomInButton && !zoomOutButton) return;
9972
9973    requestAnimationFrame(function () {
9974      requestAnimationFrame(function () {
9975        console.log("[region-cinemas-map] map " + (zoomInButton ? "+" : "-") + " click settled zoom:", Number(map.getZoom()));
9976      });
9977    });
9978  });
9979}
9980
9981/* =========================
9982   Data fetchers
9983========================= */
9984async function fetchNearbyCinemas(lat, lng) {
9985  var latRounded = +Number(lat).toFixed(2);
9986  var lngRounded = +Number(lng).toFixed(2);
9987
9988  var res = await fetch("/cinemas/geo/?lat=" + latRounded + "&lon=" + lngRounded + "&bounds=" + GPS_SEARCH_BOUNDS_KM + "&limit=100");
9989  if (!res.ok) throw new Error("HTTP " + res.status);
9990
9991  var cinemas = await res.json();
9992  return (cinemas.items || []).map(normalizeCinema);
9993}
9994
9995/* =========================
9996   initMap
9997========================= */
9998async function initMap(initialLat, initialLng, username, isRegionMode) {
9999  await loadMapTilerSdk();
10000
10001  IS_REGION_MODE = !!isRegionMode;
10002  var minAutoFitZoom = getMinAutoFitZoom();
10003
10004  var mapElement = document.getElementById("cinemas-map");
10005  GLOBAL_USERNAME = username;
10006
10007  if (!mapElement) return;
10008
10009  mapElement.classList.add("is-loading");
10010
10011  var preventMapPageOverscroll = function preventMapPageOverscroll(event) {
10012    if (window.innerWidth > 768) return;
10013    if (event.touches && event.touches.length > 1) {
10014      event.preventDefault();
10015    }
10016  };
10017
10018  mapElement.addEventListener("touchmove", preventMapPageOverscroll, { passive: false });
10019
10020  showCinemasLoader();
10021  hideNoResultsMessage();
10022
10023  var initialItems = [];
10024  try {
10025    initialItems = await fetchNearbyCinemas(initialLat, initialLng);
10026    currentCinemas = initialItems;
10027
10028    await loadUserFavCinemas(+Number(initialLat).toFixed(2), +Number(initialLng).toFixed(2));
10029    renderCinemaFilters(initialItems);
10030    updateCount(initialItems.length);
10031    if (!initialItems.length) showNoResultsMessage();
10032    renderCinemasList(initialItems);
10033  } catch (err) {
10034    console.error("Initial cinemas fetch failed:", err);
10035    updateCount(0);
10036    showNoResultsMessage();
10037    hideCinemasLoader();
10038    mapElement.classList.remove("is-loading");
10039    return;
10040  }
10041
10042  var fallbackCenter = [Number(initialLng), Number(initialLat)];
10043
10044  activeMap = new maptilerSdk.Map({
10045    container: mapElement,
10046    style: MAPTILER_STYLE,
10047    center: fallbackCenter,
10048    zoom: 3,
10049    attributionControl: false,
10050    dragRotate: false,
10051    touchPitch: false
10052  });
10053
10054  attachMapZoomControlLogging(activeMap, mapElement);
10055
10056  attachMapMarkerSyncListeners(activeMap);
10057
10058  var shrinkBtn = document.createElement("button");
10059  shrinkBtn.type = "button";
10060  shrinkBtn.className = "cinemas-map__shrink";
10061  shrinkBtn.setAttribute("aria-label", "Shrink map");
10062  shrinkBtn.innerHTML = "\n    <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" fill=\"none\">\n      <rect width=\"30\" height=\"30\" rx=\"15\" fill=\"#26272C\" fill-opacity=\"0.6\"/>\n      <path d=\"M22.5 16.2207H20V10.5957H14.375V8.0957H22.5V16.2207ZM7.5 23.0957H15.625V20.5957H10V14.9707H7.5V23.0957Z\" fill=\"white\"/>\n    </svg>\n  ";
10063  shrinkBtn.style.display = "none";
10064  mapElement.appendChild(shrinkBtn);
10065
10066  await new Promise(function (resolve) {
10067    activeMap.on("load", async function () {
10068      mapLoaded = true;
10069      ensureMapLayers(activeMap, initialItems);
10070      attachMapInteractions(activeMap);
10071      await addCinemasToMap(initialItems, activeMap);
10072      await fitMapToCinemas(activeMap, initialItems, minAutoFitZoom);
10073      syncDomMarkersWithClusters(activeMap);
10074      activeMap.once("idle", function () {
10075        syncDomMarkersWithClusters(activeMap);
10076      });
10077      resolve();
10078    });
10079  });
10080
10081  mapElement.classList.remove("is-loading");
10082  hideCinemasLoader();
10083  canAutoExpandMap = true;
10084
10085  var expandMap = makeExpandMapHandler(activeMap, shrinkBtn);
10086  var shrinkMap = makeShrinkMapHandler(activeMap, shrinkBtn);
10087  shrinkBtn.addEventListener("click", shrinkMap);
10088
10089  async function loadNearby() {
10090    currentMode = "near";
10091
10092    hideNoResultsMessage();
10093    showCinemasLoader();
10094
10095    var center = activeMap.getCenter();
10096    var lat = center.lat;
10097    var lng = center.lng;
10098
10099    try {
10100      var items = await fetchNearbyCinemas(lat, lng);
10101      currentCinemas = items;
10102
10103      await loadUserFavCinemas(+lat.toFixed(2), +lng.toFixed(2));
10104      await updateCinemaResults(activeMap);
10105
10106      hideCinemasLoader();
10107    } catch (err) {
10108      console.error("Nearby cinemas fetch failed:", err);
10109      hideCinemasLoader();
10110    }
10111  }
10112
10113  async function loadMyCinemas() {
10114    currentMode = "my";
10115
10116    hideNoResultsMessage();
10117    showCinemasLoader();
10118
10119    if (!GLOBAL_USERNAME) {
10120      hideCinemasLoader();
10121      if (typeof cookie_ok !== "undefined" && cookie_ok) {
10122        _jsCookie2.default.set("login_redirect", window.location.href);
10123        if (typeof cinema !== "undefined") _jsCookie2.default.set("favourite_cinema_add", cinema);
10124      }
10125      location.href = "/member/login/";
10126      return;
10127    }
10128
10129    var center = activeMap.getCenter();
10130    var lat = center.lat;
10131    var lng = center.lng;
10132    var latRounded = +lat.toFixed(2);
10133    var lngRounded = +lng.toFixed(2);
10134
10135    await loadUserFavCinemas(latRounded, lngRounded);
10136    await updateCinemaResults(activeMap);
10137
10138    hideCinemasLoader();
10139  }
10140
10141  activeMap.on("click", function () {
10142    if (suppressNextMapClick) {
10143      suppressNextMapClick = false;
10144      return;
10145    }
10146
10147    expandMap();
10148    hideCinemaPanel();
10149  });
10150
10151  activeMap.on("dragstart", expandMap);
10152
10153  var myCinemasBtn = document.querySelector(".js-my-cinemas-filter");
10154  if (myCinemasBtn) {
10155    if (!myCinemasBtn.dataset.active) myCinemasBtn.dataset.active = "0";
10156
10157    myCinemasBtn.addEventListener("click", async function (e) {
10158      e.preventDefault();
10159
10160      var isActive = myCinemasBtn.dataset.active === "1";
10161
10162      if (!GLOBAL_USERNAME) {
10163        if (typeof cookie_ok !== "undefined" && cookie_ok) {
10164          _jsCookie2.default.set("login_redirect", window.location.href);
10165        }
10166        location.href = "/member/login/";
10167        return;
10168      }
10169
10170      if (isActive) {
10171        myCinemasBtn.dataset.active = "0";
10172        myCinemasBtn.classList.remove("is-active");
10173
10174        await loadNearby();
10175        return;
10176      }
10177
10178      myCinemasBtn.dataset.active = "1";
10179      myCinemasBtn.classList.add("is-active");
10180      await loadMyCinemas();
10181    });
10182  }
10183
10184  if (cinemaFiltersWrapper) {
10185    cinemaFiltersWrapper.addEventListener("click", async function (event) {
10186      var button = event.target.closest(".js-region-cinema-filter");
10187      if (!button) return;
10188
10189      var tag = String(button.getAttribute("data-tag") || "").trim();
10190      var isSelected = selectedCinemaTag.toLowerCase() === tag.toLowerCase();
10191
10192      selectedCinemaTag = isSelected ? "" : tag;
10193      await updateCinemaResults(activeMap);
10194    });
10195  }
10196}
10197
10198/* =========================
10199   Boot
10200========================= */
10201(async function main() {
10202  var geoDataContainer = document.querySelector(".js-geo-data");
10203  if (!geoDataContainer) return;
10204
10205  var _geoDataContainer$dat = geoDataContainer.dataset,
10206      initialLat = _geoDataContainer$dat.lat,
10207      initialLng = _geoDataContainer$dat.lng,
10208      username = _geoDataContainer$dat.username,
10209      geoChoice = _geoDataContainer$dat.geoChoice;
10210
10211
10212  var isRegionMode = geoChoice === "region";
10213
10214  await loadUserFavCinemas(initialLat, initialLng);
10215  await initMap(initialLat, initialLng, username, isRegionMode);
10216})();
10217
10218},{"js-cookie":171}],80:[function(require,module,exports){
10219'use strict';
10220
10221var triggerButton = document.querySelector('.js-select-region');
10222
10223if (triggerButton) {
10224    triggerButton.addEventListener('click', function (_) {
10225        var regionsWrapper = document.querySelector('.js-regions-list');
10226        if (regionsWrapper) {
10227            if (regionsWrapper.classList.contains('is-hidden')) {
10228                regionsWrapper.classList.remove('is-hidden');
10229                triggerButton.classList.add('is-active');
10230            } else {
10231                regionsWrapper.classList.add('is-hidden');
10232                triggerButton.classList.remove('is-active');
10233            }
10234        }
10235    });
10236}
10237
10238},{}],81:[function(require,module,exports){
10239'use strict';
10240
10241var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
10242
10243function resetForm(form) {
10244  var currentYear = new Date().getFullYear();
10245  var progressBar = form.querySelector('.progress');
10246  var output = form.querySelector('.output');
10247
10248  var _output$querySelector = output.querySelectorAll('span'),
10249      _output$querySelector2 = _slicedToArray(_output$querySelector, 2),
10250      minSpan = _output$querySelector2[0],
10251      maxSpan = _output$querySelector2[1];
10252
10253  minSpan.innerHTML = 1911;
10254  maxSpan.innerHTML = '' + currentYear;
10255
10256  progressBar.style.left = "calc(0% - 0px)";
10257  progressBar.style.right = "calc(0% - 0px)";
10258
10259  form.querySelector('[name="min"]').setAttribute("value", 1911);
10260  form.querySelector('[name="max"]').setAttribute("value", currentYear);
10261  form.reset();
10262}
10263
10264var releaseYearForm = document.getElementById("release-year-form");
10265var globalFiltersForm = document.getElementById("global-filters");
10266
10267if (releaseYearForm) {
10268  var resetButton = document.querySelector(".js-release-year-reset-form");
10269  if (resetButton) {
10270    resetButton.addEventListener("click", function () {
10271      return resetForm(releaseYearForm);
10272    });
10273  }
10274}
10275
10276if (globalFiltersForm) {
10277  var _resetButton = document.querySelector(".js-release-year-reset-form-global");
10278  if (_resetButton) {
10279    _resetButton.addEventListener("click", function () {
10280      return resetForm(globalFiltersForm);
10281    });
10282  }
10283}
10284
10285// const form = document.getElementById("release-year-form")
10286
10287// if (form) {
10288//   const resetButton = document.querySelector(".js-release-year-reset-form")
10289//   if (resetButton) {
10290//     resetButton.addEventListener("click", (e) => {
10291//       const currentYear = new Date().getFullYear();
10292//       const progressBar = form.querySelector('.progress');
10293//       // console.log(progressBar);
10294//       const output = form.querySelector('.output');
10295//       const spans = output.querySelectorAll('span');
10296//       spans[0].innerHTML = "1911"
10297//       spans[1].innerHTML = `${currentYear}`
10298//       progressBar.style.left = "calc(0% - 0px)";
10299//       progressBar.style.right = "calc(0% - 0px)";
10300
10301//       const minInput = form.querySelector('[name="min"]');
10302//       minInput.setAttribute('value', 1911);
10303
10304//       const maxInput = form.querySelector('[name="max"]');
10305//       maxInput.setAttribute('value', currentYear);
10306//       form.reset()
10307//     });
10308//   }
10309// }
10310
10311// const formGlobal = document.getElementById("global-filters");
10312// if (formGlobal) {
10313//   const resetButton = document.querySelector(".js-release-year-reset-form-global");
10314//   if (resetButton) {
10315//     resetButton.addEventListener("click", (e) => {
10316//       const currentYear = new Date().getFullYear();
10317//       const progressBar = formGlobal.querySelector('.progress');
10318//       const output = formGlobal.querySelector('.output');
10319//       const spans = output.querySelectorAll('span');
10320//       spans[0].innerHTML = "1911"
10321//       spans[1].innerHTML = `${currentYear}`
10322
10323//       const minInput = formGlobal.querySelector('[name="min"]');
10324//       minInput.setAttribute('value', 1911);
10325
10326//       const maxInput = formGlobal.querySelector('[name="max"]');
10327//       maxInput.setAttribute('value', currentYear);
10328
10329//       progressBar.style.left = "calc(0% - 0px)";
10330//       progressBar.style.right = "calc(0% - 0px)";
10331//       form.reset()
10332//     })
10333//   }
10334// }
10335
10336},{}],82:[function(require,module,exports){
10337"use strict";
10338
10339function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
10340
10341var reviewsCarousel = document.querySelector(".reviews-slider");
10342
10343if (reviewsCarousel) {
10344  var wrapper = reviewsCarousel.closest(".reviews-slider-wrapper");
10345  var prevArrow = reviewsCarousel.querySelector(".js--carousel__left");
10346  var nextArrow = reviewsCarousel.querySelector(".js--carousel__right");
10347
10348  var scrollContainer = document.querySelector(".reviews-slider-inner");
10349  var allReviewElements = reviewsCarousel.querySelectorAll(".single-review");
10350
10351  if (scrollContainer && allReviewElements && wrapper) {
10352    var updateEdgeGradientState = function updateEdgeGradientState() {
10353      var atStart = scrollContainer.scrollLeft <= SCROLL_THRESHOLD;
10354      var atEnd = scrollContainer.scrollLeft >= scrollContainer.scrollWidth - scrollContainer.clientWidth - SCROLL_THRESHOLD;
10355      wrapper.classList.toggle("is-at-start", atStart);
10356      wrapper.classList.toggle("is-at-end", atEnd);
10357    };
10358
10359    var handleNextClick = function handleNextClick() {
10360      var currentItemIndex = getCurrentItemIndex();
10361      var targetIndex = scrollContainer.scrollLeft === allReviewElements[currentItemIndex - 2].offsetLeft ? currentItemIndex + fullyVisibleColumns : currentItemIndex;
10362      scrollContainer.scrollLeft = getScrollDistance(targetIndex);
10363    };
10364
10365    var handlePrevClick = function handlePrevClick() {
10366      var currentItemIndex = getCurrentItemIndex();
10367      var INDEX_STEP_BACK = 6;
10368
10369      if (currentItemIndex - INDEX_STEP_BACK <= 0) {
10370        scrollContainer.scrollLeft = 0;
10371      } else {
10372        scrollContainer.scrollLeft = allReviewElements[currentItemIndex - INDEX_STEP_BACK].offsetLeft;
10373      }
10374    };
10375
10376    var getCurrentItemIndex = function getCurrentItemIndex() {
10377      var scrollPosition = scrollContainer.scrollLeft;
10378      return [].concat(_toConsumableArray(allReviewElements)).findIndex(function (item) {
10379        return item.offsetLeft >= scrollPosition;
10380      }) + fullyVisibleColumns;
10381    };
10382
10383    var getScrollDistance = function getScrollDistance(targetIndex) {
10384      targetIndex = Math.max(0, Math.min(allReviewElements.length - 2, targetIndex));
10385      return allReviewElements[targetIndex].offsetLeft;
10386    };
10387
10388    if (scrollContainer.scrollWidth > scrollContainer.clientWidth) {
10389      reviewsCarousel.classList.add("is-active");
10390    }
10391
10392    var fullyVisibleColumns = Math.floor(scrollContainer.offsetWidth / allReviewElements[0].offsetWidth);
10393
10394    var SCROLL_THRESHOLD = 2;
10395
10396    updateEdgeGradientState();
10397    scrollContainer.addEventListener("scroll", updateEdgeGradientState);
10398    window.addEventListener("resize", updateEdgeGradientState);
10399
10400    nextArrow.addEventListener("click", function () {
10401      handleNextClick();
10402      requestAnimationFrame(updateEdgeGradientState);
10403    });
10404    prevArrow.addEventListener("click", function () {
10405      handlePrevClick();
10406      requestAnimationFrame(updateEdgeGradientState);
10407    });
10408  }
10409}
10410
10411},{}],83:[function(require,module,exports){
10412"use strict";
10413
10414var _swiperBundle = require("../../../../../node_modules/swiper/swiper-bundle.js");
10415
10416var _swiperBundle2 = _interopRequireDefault(_swiperBundle);
10417
10418function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10419
10420// const swiper = new Swiper(".js-reviews-slider", {
10421//   slidesPerView: 1.4,
10422//   mousewheel: {
10423//     forceToAxis: true,
10424//   },
10425//   freeMode: true,
10426//   resistance: false,
10427//   grid: {
10428//     rows: 2,
10429//   },
10430//   spaceBetween: 16,
10431//   breakpoints: {
10432//     768: {
10433//       slidesPerView: 2.5, // 2.5 slides per view on viewports larger than 1000px
10434//     },
10435//   },
10436// });
10437
10438// Automatically adjust wrapper height so it can fit the longest description
10439var reviewElements = document.querySelectorAll(".single-review__review"); // @Tom (V5): for some reason I'm getting dependency graph error when using it in regular way
10440// import Swiper from 'swiper';
10441
10442
10443if (reviewElements) {
10444  var highestHeight = 0;
10445  var highestElement = null;
10446
10447  for (var i = 0; i < reviewElements.length; i++) {
10448    var elementHeight = reviewElements[i].offsetHeight;
10449
10450    if (elementHeight > highestHeight) {
10451      highestHeight = elementHeight;
10452      highestElement = reviewElements[i];
10453    }
10454  }
10455
10456  // take the highest review height, add 2*paddings (32px) + footer/author size with spacing
10457  var sliderIdealHeight = (highestHeight + 64 + 31) * 2 + "px";
10458
10459  var sliderWrapper = document.querySelector(".reviews-slider-wrapper");
10460  if (sliderWrapper) {
10461    sliderWrapper.style.height = sliderIdealHeight;
10462  }
10463}
10464
10465},{"../../../../../node_modules/swiper/swiper-bundle.js":194}],84:[function(require,module,exports){
10466"use strict";
10467
10468var _helpers = require("../../helpers/helpers");
10469
10470var _listNotification = require("./list-notification");
10471
10472var rewardsForm = document.querySelector(".js--form--rewards-comps");
10473var rewardsModal = document.querySelector("#rewards-comps-modal");
10474
10475if (rewardsForm) {
10476
10477  var buttonHidden = document.querySelector(".js-hidden-comp-button");
10478  var buttonActive = document.querySelector(".js-active-comp-button");
10479
10480  rewardsForm.addEventListener("submit", async function (e) {
10481    e.preventDefault();
10482
10483    var form = e.target;
10484    var rewardsConfirmationModal = document.querySelector('.rewards-popup');
10485    var rewardsConfirmationContent = document.querySelector('.rewards-popup__dynamic-content');
10486
10487    var response = await fetch(form.action, {
10488      method: 'post',
10489      body: new URLSearchParams(new FormData(form))
10490    });
10491    var json = await response.json();
10492
10493    if (json.data && json.data.success) {
10494
10495      buttonHidden.classList.toggle("js-hidden-comp-button");
10496      buttonHidden.classList.toggle("js-active-comp-button");
10497
10498      buttonActive.classList.toggle("js-hidden-comp-button");
10499      buttonActive.classList.toggle("js-active-comp-button");
10500
10501      (0, _listNotification.openNotification)({ text: "Thanks, you are in the draw!" });
10502      (0, _helpers.modalsHandler)('close', rewardsModal);
10503
10504      // if (rewardsConfirmationModal) {
10505      //   rewardsConfirmationContent.innerHTML = "Thanks, you are in the draw!";
10506      //   rewardsConfirmationModal.classList.add('modal--displaying');
10507      // }
10508
10509      // modalsHandler('close', rewardsModal)
10510    } else {
10511      if (rewardsConfirmationModal) {
10512        rewardsConfirmationContent.innerHTML = json.data.errors[0];
10513        rewardsConfirmationModal.classList.add('modal--displaying');
10514      }
10515    }
10516
10517    // no matter what the response was close the popup after 5 secs
10518    setTimeout(function () {
10519      rewardsConfirmationModal.classList.remove('modal--displaying');
10520    }, 5000);
10521  });
10522}
10523
10524},{"../../helpers/helpers":3,"./list-notification":67}],85:[function(require,module,exports){
10525'use strict';
10526
10527function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
10528
10529var allFixturesSliders = document.querySelectorAll('.js-scheduled-fixtures');
10530allFixturesSliders.forEach(function (slider) {
10531    var prevArrow = slider.querySelector('.js--carousel__left');
10532    var nextArrow = slider.querySelector('.js--carousel__right');
10533    var scrollContainer = slider.querySelector('.js-schedules-fixtures-wrapper');
10534    var items = slider.querySelectorAll('.js-single-fixture');
10535
10536    prevArrow.addEventListener('click', function () {
10537        var index = getCurrentItemIndex();
10538        scrollContainer.scrollLeft = getScrollDistance(index - 1);
10539    });
10540
10541    nextArrow.addEventListener('click', function () {
10542        var index = getCurrentItemIndex();
10543        // If at the current position, scroll to the next item; otherwise, scroll to the current item.
10544        var targetIndex = scrollContainer.scrollLeft === items[index].offsetLeft ? index + 1 : index;
10545        scrollContainer.scrollLeft = getScrollDistance(targetIndex);
10546    });
10547
10548    function getCurrentItemIndex() {
10549        var scrollPosition = scrollContainer.scrollLeft;
10550        // Find the first item that's offset is greater than or equal to the current scroll position.
10551        return [].concat(_toConsumableArray(items)).findIndex(function (item, idx) {
10552            return item.offsetLeft >= scrollPosition;
10553        });
10554    }
10555
10556    function getScrollDistance(targetIndex) {
10557        // Ensure the target index is within bounds.
10558        targetIndex = Math.max(0, Math.min(items.length - 1, targetIndex));
10559        return items[targetIndex].offsetLeft;
10560    }
10561});
10562
10563},{}],86:[function(require,module,exports){
10564"use strict";
10565
10566var searchFilters = document.querySelector(".js-search-filters");
10567var itemsList = document.querySelectorAll(".padding-spacing-more-bottom li");
10568var filterButtons = document.querySelectorAll(".search-filter__button");
10569
10570if (searchFilters) {
10571  searchFilters.addEventListener("click", function (event) {
10572    if (event.target.classList.contains("search-filter__button")) {
10573      var selectedCollection = event.target.getAttribute("data-collection");
10574
10575      // Remove 'is-active' class from all buttons
10576      document.querySelectorAll(".search-filter__button.is-active").forEach(function (button) {
10577        return button.classList.remove("is-active");
10578      });
10579
10580      // Add 'is-active' class to the clicked button
10581      event.target.classList.add("is-active");
10582
10583      // Filter items based on the selected collection
10584      itemsList.forEach(function (item) {
10585        var itemCollection = item.getAttribute("data-collection-type");
10586
10587        if (selectedCollection === "all") {
10588          item.classList.remove("is-hidden");
10589        } else {
10590          if (itemCollection !== selectedCollection) {
10591            item.classList.add("is-hidden");
10592          } else {
10593            item.classList.remove("is-hidden");
10594          }
10595        }
10596      });
10597    }
10598  });
10599}
10600
10601function fadeOutButtons() {
10602  // Count visible items for each collection type
10603  var counts = {};
10604  itemsList.forEach(function (item) {
10605    if (!item.classList.contains("is-hidden")) {
10606      var type = item.getAttribute("data-collection-type");
10607      counts[type] = (counts[type] || 0) + 1;
10608    }
10609  });
10610
10611  filterButtons.forEach(function (button) {
10612    var collection = button.getAttribute("data-collection");
10613
10614    // If 'all' button OR the collection has items, don't fade it
10615    if (collection === "all" || counts[collection]) {
10616      button.classList.remove("is-faded");
10617    } else {
10618      // Fade out buttons with no results
10619      button.classList.add("is-faded");
10620    }
10621  });
10622}
10623
10624fadeOutButtons();
10625
10626},{}],87:[function(require,module,exports){
10627// // Function to sanitize the title by allowing only letters, numbers, and spaces
10628// function sanitizeTitle(title) {
10629//     return title.replace(/[^a-zA-Z0-9\s]/g, '').trim();
10630// }
10631
10632// // Function to handle and update the element when it appears or updates
10633// function addTrackingData(element) {
10634//     const blogHeading = document.querySelector('.blog-heading');
10635
10636//     let sanitizedTitle = 'default title';
10637//     if (blogHeading) {
10638//         const titleText = blogHeading.textContent;
10639//         sanitizedTitle = sanitizeTitle(titleText);
10640//     }
10641
10642//     const allActiveListItems = element.querySelectorAll('.enabled');
10643
10644//     allActiveListItems.forEach(item => {
10645//         item.setAttribute('data-event', 'article_share_click');
10646//         item.setAttribute('data-title', sanitizedTitle);
10647//         console.log(`Updated: ${item.getAttribute('data-title')}`, item);
10648//     });
10649// }
10650
10651// // Observer for dynamic content within custom element
10652// function observeShareButton() {
10653//     const shareButton = document.querySelector('share-button');
10654
10655//     if (shareButton) {
10656//         // Observe the shadow DOM or internal content
10657//         const target = shareButton.shadowRoot || shareButton;
10658
10659//         const observer = new MutationObserver(() => {
10660//             const socialWrap = target.querySelector('.sb-social');
10661//             if (socialWrap) {
10662//                 addTrackingData(socialWrap);
10663//             }
10664//         });
10665
10666//         // Observe changes in child elements and subtree
10667//         observer.observe(target, {
10668//             childList: true,
10669//             subtree: true
10670//         });
10671
10672//         // Initial check for existing DOM content
10673//         const socialWrap = target.querySelector('.sb-social');
10674//         if (socialWrap) {
10675//             addTrackingData(socialWrap);
10676//         }
10677//     }
10678// }
10679
10680// // Run the script only if the article container exists
10681// const blogContainer = document.querySelector('.blog-container');
10682
10683// if (blogContainer) {
10684//     const pageObserver = new MutationObserver(() => {
10685//         observeShareButton();
10686//     });
10687
10688//     pageObserver.observe(document.body, {
10689//         childList: true,
10690//         subtree: true
10691//     });
10692
10693//     // Fallback for initial load
10694//     observeShareButton();
10695// }
10696"use strict";
10697
10698},{}],88:[function(require,module,exports){
10699"use strict";
10700
10701Object.defineProperty(exports, "__esModule", {
10702  value: true
10703});
10704
10705var _jsCookie = require("js-cookie");
10706
10707var _jsCookie2 = _interopRequireDefault(_jsCookie);
10708
10709var _helpers = require("../../helpers/helpers");
10710
10711function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10712
10713function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
10714
10715exports.default = function (app) {
10716  if (!document.querySelector(".js-sport-times")) return;
10717
10718  var calendarTabs = document.querySelectorAll(".times-calendar__el");
10719  var timesTabs = document.querySelectorAll(".timetable__day");
10720  //const jsTimesTabs = document.querySelectorAll(".js--timesTab");
10721  var scrollContainer = document.querySelector(".times-calendar__inner");
10722
10723  var urlParams = new URLSearchParams(window.location.search);
10724  var defaultDate = urlParams.get('date');
10725
10726  if (defaultDate) {
10727    var activeDay = scrollContainer.querySelector("[data-date=\"" + defaultDate + "\"]");
10728    if (activeDay) {
10729      activeDay.classList.add('times-calendar__el--active');
10730      var contentWrapper = document.querySelector('.vertical-fixtures-timeline--sport-home');
10731      var activeDayContent = contentWrapper.querySelector("[data-date=\"" + defaultDate + "\"]");
10732      activeDayContent.classList.add('timetable__day--active');
10733    }
10734  } else {
10735    // no default date so show first tab
10736    var _activeDay = document.querySelector('.times-calendar__el');
10737    var _activeDayContent = document.querySelector('.vertical-fixtures-timeline__group');
10738    if (_activeDay) {
10739      _activeDay.classList.add('times-calendar__el--active');
10740      _activeDayContent.classList.add('timetable__day--active');
10741    }
10742  }
10743
10744  [].concat(_toConsumableArray(calendarTabs)).forEach(function (tab, i) {
10745    tab.addEventListener("click", function () {
10746      (0, _helpers.tabsHandler)(tab, i, calendarTabs, timesTabs, "times-calendar__el--active", "timetable__day--active", scrollContainer);
10747
10748      var activeDay = document.querySelector(".timetable__day--active");
10749      var activeDate = activeDay.getAttribute("data-date");
10750
10751      var currentUrl = new URL(window.location.href);
10752      currentUrl.searchParams.set('date', activeDate);
10753      window.history.pushState({}, '', currentUrl);
10754    });
10755  });
10756};
10757
10758},{"../../helpers/helpers":3,"js-cookie":171}],89:[function(require,module,exports){
10759"use strict";
10760
10761var streamersFormResetButtons = document.querySelectorAll(".js-reset-streamers-form");
10762var streamersFormResetButtonsSingle = document.querySelectorAll(".js-reset-streamers-form-single");
10763
10764function getScopedForm(button, selectors) {
10765  var modalContent = button.closest(".modal__content");
10766
10767  var _iteratorNormalCompletion = true;
10768  var _didIteratorError = false;
10769  var _iteratorError = undefined;
10770
10771  try {
10772    for (var _iterator = selectors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
10773      var selector = _step.value;
10774
10775      var target = modalContent ? modalContent.querySelector(selector) : document.querySelector(selector);
10776      if (target) return target;
10777    }
10778  } catch (err) {
10779    _didIteratorError = true;
10780    _iteratorError = err;
10781  } finally {
10782    try {
10783      if (!_iteratorNormalCompletion && _iterator.return) {
10784        _iterator.return();
10785      }
10786    } finally {
10787      if (_didIteratorError) {
10788        throw _iteratorError;
10789      }
10790    }
10791  }
10792
10793  return null;
10794}
10795
10796function resetStreamingForm(form, listSelector) {
10797  if (!form || typeof form.reset !== "function") return;
10798
10799  form.reset();
10800
10801  form.querySelectorAll(".selected").forEach(function (label) {
10802    label.classList.remove("selected");
10803  });
10804
10805  form.querySelectorAll('input[type="checkbox"]').forEach(function (checkbox) {
10806    checkbox.checked = false;
10807  });
10808
10809  var list = form.querySelector(listSelector);
10810  if (list) {
10811    list.classList.remove("is-grayed-out");
10812  }
10813}
10814
10815streamersFormResetButtons.forEach(function (button) {
10816  button.addEventListener("click", function () {
10817    var form = getScopedForm(button, [".js-streaming-filter-form", ".js-streaming-filter-form-single"]);
10818
10819    resetStreamingForm(form, ".streamers-form__list-global, .streamers-form__list--single-filter");
10820  });
10821});
10822
10823streamersFormResetButtonsSingle.forEach(function (button) {
10824  button.addEventListener("click", function () {
10825    var form = getScopedForm(button, [".js-streaming-filter-form-single", ".js-streaming-filter-form"]);
10826
10827    resetStreamingForm(form, ".streamers-form__list--single-filter, .streamers-form__list-global");
10828  });
10829});
10830
10831},{}],90:[function(require,module,exports){
10832"use strict";
10833
10834var teamSliders = document.querySelectorAll(".js-teams-slider, .crew-slider");
10835
10836teamSliders.forEach(function (teamSlider) {
10837  var items = teamSlider.querySelectorAll(".js-team, .crew-member");
10838  if (items && items.length) {
10839    var widestWidth = 0;
10840
10841    // Find the widest review element
10842    items.forEach(function (element) {
10843      var elementWidth = element.offsetWidth;
10844      if (elementWidth > widestWidth) {
10845        widestWidth = elementWidth;
10846      }
10847    });
10848
10849    // Adjust the width of all elements to match the widest one
10850    items.forEach(function (element) {
10851      element.style.width = widestWidth + "px";
10852      element.style.minWidth = widestWidth + "px";
10853    });
10854  }
10855});
10856
10857},{}],91:[function(require,module,exports){
10858"use strict";
10859
10860var _listNotification = require("./list-notification");
10861
10862var _jsCookie = require("js-cookie");
10863
10864var _jsCookie2 = _interopRequireDefault(_jsCookie);
10865
10866function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10867
10868var wrappers = document.querySelectorAll('.js-add-cinema-to-fav-wrapper');
10869
10870function getCinemaIdentifier(button) {
10871    return button.dataset.cinema || button.dataset.slug || "";
10872}
10873
10874function getButtonsWithSameCinema(button) {
10875    var identifier = getCinemaIdentifier(button);
10876    if (!identifier) {
10877        return button ? [button] : [];
10878    }
10879
10880    return Array.from(document.querySelectorAll(".js-add-cinema-to-fav")).filter(function (el) {
10881        return getCinemaIdentifier(el) === identifier;
10882    });
10883}
10884
10885function updateFavButtonsState(buttons, isOn) {
10886    var isFav = Number(isOn) === 1;
10887
10888    buttons.forEach(function (el) {
10889        el.classList.toggle("is-fav", isFav);
10890        el.setAttribute("data-on", isFav ? "1" : "0");
10891        el.setAttribute("data-event", isFav ? "remove_from_cinemas" : "add_to_cinemas");
10892        el.setAttribute("title", (isFav ? "Remove from" : "Add to") + " your cinemas list");
10893    });
10894}
10895
10896async function handleFavButtonClick(e) {
10897    var button = e.target.closest('.js-add-cinema-to-fav');
10898    if (!button) return;
10899    if (button.dataset.pending === "1") return;
10900
10901    var allButtonsWithSameCinema = getButtonsWithSameCinema(button);
10902
10903    var _button$dataset = button.dataset,
10904        cinema = _button$dataset.cinema,
10905        username = _button$dataset.username,
10906        on = _button$dataset.on,
10907        cinemaname = _button$dataset.cinemaname;
10908
10909
10910    if (!cinema) return;
10911
10912    if (!username) {
10913        if (cookie_ok) {
10914            _jsCookie2.default.set("login_redirect", window.location.href);
10915            _jsCookie2.default.set("favourite_cinema_add", cinema);
10916        }
10917        location.href = "/member/login/";
10918        return;
10919    } else {
10920        var previousIsOn = Number(on) === 1 ? 1 : 0;
10921        var optimisticIsOn = previousIsOn === 1 ? 0 : 1;
10922
10923        allButtonsWithSameCinema.forEach(function (el) {
10924            el.dataset.pending = "1";
10925        });
10926        updateFavButtonsState(allButtonsWithSameCinema, optimisticIsOn);
10927
10928        try {
10929            var result = await manageFavoriteCinemas({ slug: cinema, isOn: on });
10930            if (result) {
10931                updateFavButtonsState(allButtonsWithSameCinema, result.is_on);
10932                // Let other modules (eg. region-cinemas-map) update UI in real-time
10933                try {
10934                    window.dispatchEvent(new CustomEvent('fav-cinema-changed', {
10935                        detail: { slug: cinema, is_on: result.is_on }
10936                    }));
10937                } catch (e) {}
10938
10939                var text = result.is_on == 1 ? 'Added to' : 'Removed from';
10940                var url = " <a href=\"/member/" + username + "/cinemas/\">your cinemas.</a>";
10941                (0, _listNotification.openNotification)({ text: text + " " + url });
10942
10943                var isCinemasMemberPage = document.querySelector('.cinemas-index');
10944                if (isCinemasMemberPage && result.is_on != 1) {
10945                    var cinemaCard = button.closest('.more-cinemas__single-entry');
10946                    if (cinemaCard) {
10947                        cinemaCard.remove();
10948                        decrementItemsInList();
10949                    }
10950                }
10951            }
10952        } catch (error) {
10953            updateFavButtonsState(allButtonsWithSameCinema, previousIsOn);
10954        } finally {
10955            allButtonsWithSameCinema.forEach(function (el) {
10956                delete el.dataset.pending;
10957            });
10958        }
10959    }
10960}
10961
10962// Add favourite from cookie
10963async function handleFavButtonCookie(cookie_cinema_slug) {
10964    var button = document.querySelector(".js-add-cinema-to-fav[data-cinema=\"" + cookie_cinema_slug + "\"]");
10965    if (!button) return;
10966
10967    _jsCookie2.default.remove("favourite_cinema_add");
10968
10969    var _button$dataset2 = button.dataset,
10970        cinema = _button$dataset2.cinema,
10971        username = _button$dataset2.username,
10972        on = _button$dataset2.on,
10973        cinemaname = _button$dataset2.cinemaname;
10974
10975    if (!cinema) return;
10976
10977    if (!username) {
10978        // do nothing?
10979
10980    } else {
10981        var result = await manageFavoriteCinemas({ slug: cinema, isOn: on });
10982        if (result) {
10983            updateFavButtonsState(getButtonsWithSameCinema(button), result.is_on);
10984            if (cinemaname) {
10985                var text = result.is_on == 1 ? 'added to' : 'removed from';
10986                (0, _listNotification.openNotification)({ text: cinemaname + " " + text 
10986+ " your list" });
10987                // button.scrollIntoView({ behavior: 'smooth', block: 'start' });
10988            }
10989        }
10990    }
10991}
10992
10993// const staticButtons = document.querySelectorAll('.js-add-cinema-to-fav');
10994// staticButtons.forEach(button => button.addEventListener('click', handleFavButtonClick));
10995
10996wrappers.forEach(function (wrapper) {
10997    wrapper.addEventListener('click', handleFavButtonClick);
10998});
10999
11000var favCinemaCookie = _jsCookie2.default.get("favourite_cinema_add");
11001if (favCinemaCookie) {
11002    handleFavButtonCookie(favCinemaCookie);
11003}
11004
11005async function manageFavoriteCinemas(values) {
11006    try {
11007        var response = await fetch('/favourite-toggle/', {
11008            method: 'POST',
11009            headers: new Headers({
11010                'Content-Type': 'application/json'
11011            }),
11012            body: JSON.stringify(values),
11013            credentials: 'same-origin'
11014        });
11015
11016        if (!response.ok) {
11017            throw new Error('Failed to manage favorites');
11018        }
11019
11020        var result = await response.json();
11021        return result;
11022    } catch (error) {
11023        console.error('Couldn\'t add to favorite cinemas:', error);
11024        throw error;
11025    }
11026}
11027
11028function decrementItemsInList() {
11029    var element = document.querySelector(".js-items-in-list");
11030    if (element) {
11031        var currentValue = parseInt(element.textContent, 10) || 0;
11032        element.textContent = Math.max(currentValue - 1, 0); // Ensures it doesn't go below 0
11033    }
11034}
11035
11036},{"./list-notification":67,"js-cookie":171}],92:[function(require,module,exports){
11037"use strict";
11038
11039var _dayjs = require("dayjs");
11040
11041var _dayjs2 = _interopRequireDefault(_dayjs);
11042
11043var _jsCookie = require("js-cookie");
11044
11045var _jsCookie2 = _interopRequireDefault(_jsCookie);
11046
11047var _listNotification = require("./list-notification");
11048
11049function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11050
11051var user = void 0,
11052    username = void 0,
11053    isGlobalTV = void 0;
11054
11055//-- remove from all functionality
11056var removeAllButtons = document.querySelectorAll(".js-remove-from-all-lists");
11057removeAllButtons.forEach(function (button) {
11058  button.addEventListener("click", function (e) {
11059    var listGroup = e.target.closest(".js-all-user-lists");
11060    if (listGroup) {
11061      listGroup.querySelectorAll('input[type="checkbox"][name="lists"]').forEach(function (checkbox) {
11062        checkbox.checked = false;
11063      });
11064    }
11065  });
11066});
11067
11068//--------------------------------------------------------
11069// Handle search buttons from insite-search
11070//--------------------------------------------------------
11071var listElements = document.querySelectorAll(".js-insite-search").length ? document.querySelectorAll(".js-insite-search") : document.querySelectorAll('.js-search-results');
11072
11073// -------------------------------------------------------
11074// Add cinema to user list
11075// -------------------------------------------------------
11076var addCinemaButtonListener = function addCinemaButtonListener() {
11077  if (listElements.length === 0) return;
11078  var listName = 'cinemas';
11079  listElements.forEach(function (listElement) {
11080    listElement.addEventListener('click', async function (e) {
11081      if (e.target && e.target.classList.contains("js-add-cinema-to-fav-search")) {
11082        var _e$target$dataset = e.target.dataset,
11083            cinema = _e$target$dataset.slug,
11084            on = _e$target$dataset.on,
11085            cinemaname = _e$target$dataset.cinemaname,
11086            cinemaicon = _e$target$dataset.cinemaicon,
11087            _user = _e$target$dataset.user,
11088            _username = _e$target$dataset.username;
11089
11090        // do API request
11091
11092        e.target.classList.add("is-loading");
11093        var result = await manageFavoriteCinemas({ slug: cinema, isOn: on });
11094        e.target.classList.remove("is-loading");
11095
11096        closeSearchModal({
11097          modalSelector: "#user-search-cinemas",
11098          notificationText: "Done."
11099        });
11100
11101        // set up notification details
11102        var text = result.is_on == 1 ? 'Added to' : 'Removed from';
11103        var url = " <a href=\"/member/" + _username + "/cinemas/\">your cinemas.</a>";
11104        (0, _listNotification.openNotification)({ text: text + " " + url });
11105
11106        // add cinema card
11107        var cinemaListWrapper = document.querySelector('.all-cinemas-list');
11108        var cinemaObj = {
11109          name: cinemaname ? cinemaname : "",
11110          slug: cinema,
11111          image: cinemaicon ? cinemaicon : "",
11112          moviescount: result.count ? result.count : false,
11113          userId: _user,
11114          username: _username
11115        };
11116        var newCinemaCard = createCinemaCard(cinemaObj);
11117        var newCinemaCardElement = document.createRange().createContextualFragment(newCinemaCard).firstElementChild;
11118        cinemaListWrapper.prepend(newCinemaCardElement); // we want to add new cinema at the top rather than bottom
11119
11120        var lonelyWrap = document.querySelector('.lonely-wrap');
11121        if (lonelyWrap) {
11122          lonelyWrap.style.display = "none";
11123        }
11124
11125        incrementItemsInList();
11126      }
11127    });
11128  });
11129};
11130
11131async function manageFavoriteCinemas(values) {
11132  try {
11133    var response = await fetch('/favourite-toggle/', {
11134      method: 'POST',
11135      headers: new Headers({
11136        'Content-Type': 'application/json'
11137      }),
11138      body: JSON.stringify(values),
11139      credentials: 'same-origin'
11140    });
11141
11142    if (!response.ok) {
11143      throw new Error('Failed to manage favorites');
11144    }
11145
11146    var result = await response.json();
11147    return result;
11148  } catch (error) {
11149    console.error('Couldn\'t add to favorite cinemas:', error);
11150    throw error;
11151  }
11152}
11153
11154// -------------------------------------------------------
11155// Add movie to user list
11156// -------------------------------------------------------
11157var addMovieButtonListener = function addMovieButtonListener() {
11158  if (listElements.length === 0) return;
11159
11160  listElements.forEach(function (listElement) {
11161    var listName = 'watchlist';
11162    var customList = document.querySelector('.js-list-name');
11163    if (customList && customList.dataset.listslug) {
11164      listName = customList.dataset.listslug;
11165    }
11166
11167    listElement.addEventListener("click", async function (e) {
11168      if (e.target && e.target.classList.contains("js-add-movie-to-single-user-list")) {
11169        e.preventDefault();
11170        var movieSlug = e.target.dataset.slug;
11171        user = e.target.dataset.user || null;
11172        username = e.target.dataset.username || null;
11173        isGlobalTV = e.target.dataset.istv == 1 ? true : false;
11174
11175        var values = {
11176          movie_slug: movieSlug,
11177          lists: ["" + listName]
11178        };
11179
11180        // if there's no user redirect to login
11181        if (!user) {
11182          if (cookie_ok) {
11183            _jsCookie2.default.set("login_redirect", window.location.href);
11184            _jsCookie2.default.set("watchlist_add", movieSlug);
11185          }
11186
11187          location.href = "/member/login/";
11188          return;
11189        }
11190
11191        e.target.classList.add("is-loading");
11192        await manageMovieOnWatchlists(values, e.target);
11193        e.target.classList.remove("is-loading");
11194
11195        closeSearchModal({
11196          modalSelector: "#user-search-movies",
11197          notificationText: "Done."
11198        });
11199        // const searchModal = document.querySelector("#user-search-movies");
11200        // if (
11201        //   searchModal &&
11202        //   searchModal.classList.contains("modal--displaying")
11203        // ) {
11204        //   searchModal.classList.remove("modal--displaying");
11205        //   openNotification({ text: "Movie added to your list" });
11206        //   // clear the search form
11207        //   const targetEl = searchModal.querySelector(
11208        //     ".js--insite-search-results"
11209        //   );
11210        //   const formSearchInput = searchModal.querySelector('input[name="q"]');
11211        //   const closeIcon = searchModal.querySelector(".close-icon");
11212        //   targetEl.innerHTML = "";
11213        //   formSearchInput.value = "";
11214        //   closeIcon.classList.remove("is-visible");
11215        // }
11216      }
11217    });
11218  });
11219};
11220
11221function closeSearchModal(_ref) {
11222  var modalSelector = _ref.modalSelector,
11223      notificationText = _ref.notificationText;
11224
11225  var searchModal = document.querySelector(modalSelector);
11226  if (searchModal && searchModal.classList.contains("modal--displaying")) {
11227    searchModal.classList.remove("modal--displaying");
11228    (0, _listNotification.openNotification)({ text: notificationText });
11229
11230    // Clear the search form
11231    var targetEl = searchModal.querySelector(".js--insite-search-results");
11232    var formSearchInput = searchModal.querySelector('input[name="q"]');
11233    var closeIcon = searchModal.querySelector(".close-icon");
11234
11235    if (targetEl) targetEl.innerHTML = "";
11236    if (formSearchInput) formSearchInput.value = "";
11237    if (closeIcon) closeIcon.classList.remove("is-visible");
11238  }
11239}
11240
11241//--------------------------------------------------------
11242// Handle search buttons from insite-search
11243//--------------------------------------------------------
11244var topSearchWrapper = document.querySelector(".js--searchNavResults");
11245var topSearchListName = "watchlist";
11246
11247var addTopSearchMovieButtonListener = function addTopSearchMovieButtonListener() {
11248  if (!topSearchWrapper) return;
11249  topSearchWrapper.addEventListener("click", async function (e) {
11250    if (e.target && e.target.classList.contains("js-add-movie-to-single-user-list")) {
11251      e.preventDefault();
11252      var movieSlug = e.target.dataset.slug;
11253      var values = {
11254        movie_slug: movieSlug,
11255        lists: ["" + topSearchListName]
11256      };
11257
11258      e.target.classList.add("is-loading");
11259      await manageMovieOnWatchlists(values, e.target, true);
11260      e.target.classList.remove("is-loading");
11261    }
11262  });
11263};
11264
11265//--------------------------------------------------------
11266// Helpers
11267//--------------------------------------------------------
11268async function manageMovieOnWatchlists(values, targetRef) {
11269  var isTopSearch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
11270
11271  try {
11272    var response = await fetch("/watchlist-movie-edit/" + values.movie_slug + "/", {
11273      method: "POST",
11274      headers: new Headers({
11275        "content-type": "application/json",
11276        "is-ajax-call": "yes"
11277      }),
11278      body: JSON.stringify(values),
11279      credentials: "same-origin"
11280    });
11281
11282    var result = await response.json();
11283    if (result.status == "OK") {
11284      targetRef.classList.add("on-watchlist");
11285      //console.log("Movie added to watchlist:", result);
11286
11287      // New fetch call to get video data
11288      if (!isTopSearch) {
11289        var source = isGlobalTV ? "tv" : "movie";
11290        var newResponse = await fetch("/" + source + "/api/" + values.movie_slug + "/", {
11291          method: "GET",
11292          headers: new Headers({
11293            "is-ajax-call": "yes"
11294          }),
11295          credentials: "same-origin"
11296        });
11297
11298        // Create movie card
11299        var movie = await newResponse.json();
11300        //console.log("Got single movie data:", movie);
11301        var ajaxWrapper = document.querySelector(".js-single-movie-ajax") || document.querySelector(".js--paginationAppend");
11302        if (ajaxWrapper) {
11303          var filterWrapper = document.querySelector(".membership-filters");
11304          if (filterWrapper) {
11305            filterWrapper.classList.remove("is-hidden");
11306          }
11307          var newMovieCard = createMovieCard(movie);
11308          var newMovieCardElement = document.createRange().createContextualFragment(newMovieCard).firstElementChild;
11309          ajaxWrapper.prepend(newMovieCardElement); // we want to add new movie at the top rather than bottom
11310        }
11311
11312        // Increase count number of movies on the list.
11313        incrementItemsInList();
11314
11315        (0, _listNotification.openNotification)({ text: "Done" });
11316      }
11317    }
11318
11319    return result;
11320  } catch (error) {
11321    console.error("Error adding movie to watchlist:", error);
11322    throw error;
11323  }
11324}
11325
11326function createCinemaCard(cinema) {
11327  return "\n        <div class=\"more-cinemas__single-entry\">\n            <a class=\"more-cinemas__link\" href=\"/cinema/" + cinema.slug + "/\">\n                <div class=\"more-cinemas__media\">\n                    <img src=\"" + cinema.image + "\" alt=\"" + cinema.name + "\">\n                </div>\n                <div class=\"more-cinemas__meta\">\n                    <h2 class=\"more-cinemas__title\">" + cinema.name + "</h2>\n                    " + (cinema.moviescount ? "<div class=\"more-cinemas__details\">\n                        <span class=\"more-cinemas__movies\">" + cinema.moviescount + " movies</span>\n                    </div>" : '') + "\n                </div>\n            </a>\n            <div class=\"more-cinemas__fav\">\n                <button class=\"more-cinemas__add-to-watchlist js-add-cinema-to-fav is-fav\"\n                    title=\"Add to your cinemas list\"\n                    data-list=\"cinema\"\n                    data-slug=\"" + cinema.slug + "\"\n                    data-on=\"0\"\n                    data-user=\"" + cinema.userId + "\"\n                    data-cinema=\"" + cinema.slug + "\"\n                    data-cinemaname=\"" + cinema.name + "\"\n                    data-username=\"" + cinema.username + "\">\n                    <div class=\"cross\">\n                        <svg><use xlink:href=\"#watchlist-add-v2\"></use></svg>\n                    </div>\n                    <div class=\"tick\">\n                        <svg><use xlink:href=\"#onwatchlist\"></use></svg>\n                    </div>\n                </button>\n            </div>\n        </div>\n    ";
11328}
11329
11330function createMovieCard(movie) {
11331  var statusHTML = createMembershipStatusCinemaSection(movie);
11332  var providersHTML = createProvidersList(movie);
11333  var type = isGlobalTV ? "tv" : "movie";
11334  var poster = movie.images["poster_300_x_442"] ? movie.images["poster_300_x_442"] : "https://d32qys9a6wm9no.cloudfront.net/images/others/not_available/poster_300x442.png?t=1731327035";
11335  return "\n    <article class=\"movie-list-item js-" + movie.name + "\">\n      <div class=\"movie-list-item__image js--addToWatchlistWrapper\">
11335\n        <a href=\"/" + type + "/" + movie.name + "/\">\n          <img src=\"" + poster + "\" alt=\"" + movie.title + "\">\n        </a>\n        " + (movie.shortTags ? "\n          <ul class=\"movie-list-carousel-item__short-tag-wrap\">\n            " + movie.shortTags.map(function (tag) {
11336    var tagForCss = tag.replace(/\s+/g, "-").toLowerCase();
11337    return "<li class=\"movie-list-carousel-item__short-tag short-tag__item--" + tagForCss + "\">" + tag + "</li>";
11338  }).join("") + "\n          </ul>\n        " : "") + "\n        <div class=\"movie-watchlist-options\">\n            <button class=\"js-pass-movie-data js-check-lists-status js--openModal\" \n              data-list=\"movie\" \n              data-slug=\"" + movie.name + "\" \n              data-on=\"1\" \n              data-user=\"" + user + "\" \n              data-username=\"" + username + "\" \n              data-title=\"" + movie.title + "\" \n              data-modal-id=\"user-toggle-lists\">\n              <span class=\"tick\">\n                <svg>\n                  <use xlink:href=\"#watchlist-remove-v2\"></use>\n                </svg>\n              </span>\n            </button>\n        </div>\n      </div>\n\n      <div class=\"movie-list-item__content\">\n        <div class=\"movie-list-item__content__top\">\n          <h2 class=\"movie-list-item__title\">\n            <a href=\"/" + type + "/" + movie.name + "/\">" + movie.title + "</a>\n          </h2>\n          \n          <div class=\"movie-list-item__meta\">\n            " + (movie.classification || movie.duration || movie["rotten_tomatoes"].rt_value || movie["rotten_tomatoes"].rt_audience_value || movie.flicks_recommends && movie.flicks_recommends.length > 0 ? "\n              <small class=\"movie-list-item__movie-icons\">\n                " + (movie.classification ? "<span class=\"movie-list-item__movie-classification\">" + movie.classification + "</span>" : "") + "\n                " + (movie.duration ? "<span class=\"movie-list-item__movie-duration\">" + movie.duration + " mins</span>" : "") + "\n                " + ((movie.classification || movie.duration) && (movie.flicks_recommends && movie.flicks_recommends.length > 0 || movie["rotten_tomatoes"].rt_value || movie["rotten_tomatoes"].rt_audience_value) ? '<span class="movie-list-item__divider">|</span>' : "") + "\n                " + (movie.flicks_recommends && movie.flicks_recommends.length > 0 ? "\n                  <span class=\"movie-list-item__flicks-recommends-badge\">\n                    <img src=\"" + movie.flicks_recommends_icon + "\" alt=\"Recommended\">\n                  </span>\n                " : "") + "\n                " + (movie["rotten_tomatoes"].rt_value ? "\n                  <span class=\"movie-list-item__rotten-tomatoes-score\">\n                    <a href=\"" + movie["rotten_tomatoes"].rt_link + "\" target=\"_blank\">\n                      <img src=\"" + movie["rotten_tomatoes"].rt_icon_small + "\" alt=\"RT\">\n                      <span>" + movie["rotten_tomatoes"].rt_value + "</span>\n                    </a>\n                  </span>\n                " : "") + "\n                " + (movie["rotten_tomatoes"].rt_audience_value ? "\n                  <span class=\"movie-list-item__rotten-tomatoes-score movie-list-item__rotten-tomatoes-score--audience\">\n                    <a href=\"" + movie["rotten_tomatoes"].rt_audience_review_link + "\" target=\"_blank\">\n                      <img src=\"" + movie["rotten_tomatoes"].rt_audience_icon_small + "\" alt=\"Audience Score\">\n                      <span>" + movie["rotten_tomatoes"].rt_audience_value + "</span>\n                    </a>\n                  </span>\n                " : "") + "\n              </small>\n            " : "") + "\n\n            " + (movie.trailer ? "\n              <div class=\"movie-list-item__trailer-wrap\">\n                <a href=\"/trailer/" + movie.name + "/" + movie.trailer.id + "/" + (isGlobalTV ? "tv/" : "") + "\" \n                  data-modal=\"/trailer/modal/" + movie.name + "/" + movie.trailer.id + "/" + (isGlobalTV ? "tv/" : "") + "\" \n                  class=\"trailer-play-link js--trailerModalTrigger js--trailerModalTriggerWrapper\">\n                  <svg><use xlink:href=\"#playbuttoncircled\"></use></svg>
11338\n                  <span>Trailer</span>\n                </a>\n              </div>\n            " : "") + "\n          </div>\n\n          " + statusHTML + "\n          " + providersHTML + "\n\n      </div>\n    </article>\n  ";
11339}
11340
11341function createMembershipStatusCinemaSection(movie) {
11342  var statusHTML = "<ul class=\"movie-list-item__status\">";
11343
11344  // In Cinemas Now
11345  if (movie.state === "NOW PLAYING IN CINEMAS" || movie.secondaryState === "NOW PLAYING IN CINEMAS") {
11346    statusHTML += "\n      <li>\n        <a href=\"/movie/" + movie.name + "\" class=\"members-in-cinemas-now-button\">\n          <span>In Cinemas Now</span>\n        </a>\n      </li>\n    ";
11347  }
11348
11349  // Coming Soon to Cinemas
11350  if (movie.state === "COMING SOON TO CINEMAS" || movie.secondaryState === "COMING SOON TO CINEMAS") {
11351    if (movie.releaseDate) {
11352      statusHTML += "\n        <li>\n          <svg><use xlink:href=\"#scheduled-future\"></use></svg>\n          <span>In cinemas " + (0, _dayjs2.default)(movie.releaseDate).format("MMM D") + "</span>\n        </li>\n      ";
11353    } else {
11354      statusHTML += "\n        <li>\n          <svg><use xlink:href=\"#scheduled-future\"></use></svg>\n          <span>" + movie.state + "</span>\n        </li>\n      ";
11355    }
11356  }
11357
11358  // Archive
11359  if (movie.state === "ARCHIVE" || movie.secondaryState === "ARCHIVE") {
11360    statusHTML += "\n      <li>\n        <span>:( Not Available</span>\n      </li>\n    ";
11361  }
11362
11363  // Streaming Status
11364  if (movie.state !== "STREAMING NOW" && movie.secondaryState !== "STREAMING NOW") {
11365    statusHTML += createMembershipStatusStreamingState(movie.state, movie.secondaryState, movie.streamingReleaseDate);
11366  }
11367
11368  statusHTML += "</ul>";
11369  return statusHTML;
11370}
11371
11372function createMembershipStatusStreamingState(state, secondaryState, releaseDate) {
11373  if (state === "STREAMING SOON" || secondaryState === "STREAMING SOON") {
11374    return "\n      <li>\n        <svg><use xlink:href=\"#scheduled-future\"></use></svg>\n        <span>Streaming from " + (0, _dayjs2.default)(releaseDate).format("MMM D") + "</span>\n      </li>\n    ";
11375  }
11376  return "";
11377}
11378
11379function createProvidersList(movie) {
11380  if (movie.state !== "STREAMING SOON" && movie.secondaryState !== "STREAMING SOON") {
11381    var providersLimit = window.innerWidth <= 768 ? 3 : 4;
11382    var html = "\n      <ul class=\"movie-list-item__providers\">\n    ";
11383
11384    var streamingSource = void 0;
11385    if (isGlobalTV) {
11386      if (movie.streaming[0].streaming && Array.isArray(movie.streaming[0].streaming)) {
11387        streamingSource = movie.streaming[0].streaming.length > providersLimit ? movie.streaming[0].streaming.slice(0, providersLimit) : movie.streaming[0].streaming;
11388      }
11389    } else {
11390      if (movie.streaming && Array.isArray(movie.streaming)) {
11391        streamingSource = movie.streaming.length > providersLimit ? movie.streaming.slice(0, providersLimit) : movie.streaming;
11392      }
11393    }
11394
11395    streamingSource.forEach(function (provider) {
11396      html += "\n        <li class=\"movie-list-item__provider\">\n          <a href=\"" + provider.url + "\" target=\"_blank\">\n            <img src=\"" + provider.icon + "\" alt=\"" + provider.provider + "\">\n          </a>\n         </li>\n      ";
11397    });
11398
11399    if (streamingSource.length > providersLimit) {
11400      var count = movie.streaming.length - providersLimit;
11401      html += "\n        <li class=\"movie-list-item__more-items\">\n          <a href=\"/movie/" + movie.name + "/\">\n            <span class=\"movie-list-item__more-items-count\">+" + count + "</span> more\n          </a>\n        </li>\n      ";
11402    }
11403
11404    html += "</ul>";
11405    return html;
11406  }
11407  return "";
11408}
11409
11410function incrementItemsInList(selector) {
11411  var element = document.querySelector(".js-items-in-list");
11412  if (element) {
11413    var currentValue = parseInt(element.textContent, 10) || 0;
11414    element.textContent = currentValue + 1;
11415  }
11416}
11417
11418if (listElements && listElements.length > 0 && listElements[0].dataset.list === 'cinemas') {
11419  addCinemaButtonListener();
11420} else {
11421  addMovieButtonListener();
11422}
11423
11424addTopSearchMovieButtonListener();
11425
11426},{"./list-notification":67,"dayjs":128,"js-cookie":171}],93:[function(require,module,exports){
11427"use strict";
11428
11429var _toggleFormLoader = require("./../../helpers/toggle-form-loader");
11430
11431var _userListsHelpers = require("./../../helpers/user-lists-helpers");
11432
11433var _listNotification = require("./list-notification");
11434
11435var deleteList = document.querySelector(".js-user-delete-list");
11436var modal = document.getElementById("user-edit-list-details");
11437var confirmForm = document.querySelector("#confirm-yourself");
11438
11439//----------------------------------------------------------------
11440// Handle modal
11441//----------------------------------------------------------------
11442if (modal) {
11443  var step1 = modal.querySelector(".js-modal-step-1");
11444  var step2 = modal.querySelector(".js-modal-step-2");
11445  //const done = modal.querySelector(".js-modal-done");
11446
11447  // ---------------------------------------------
11448  //  Save changes click
11449  // ---------------------------------------------
11450  var editListForm = document.querySelector("#edit-list-details");
11451
11452  if (editListForm) {
11453    editListForm.addEventListener("submit", function (e) {
11454      e.preventDefault();
11455      (0, _toggleFormLoader.showFormLoader)(editListForm);
11456
11457      var formData = new FormData(editListForm);
11458      var formValues = {};
11459      formData.forEach(function (value, key) {
11460        if (key === "is_public") {
11461          formValues["is_public"] = value === "on" ? true : false;
11462        } else formValues[key] = value;
11463      });
11464      if (!formValues["is_public"]) {
11465        formValues["is_public"] = false;
11466      }
11467
11468      var listNameError = editListForm.querySelector('.js-form-error-list-name');
11469      var listDescriptionError = editListForm.querySelector('.js-form-error-list-description');
11470      if (listNameError) {
11471        listNameError.classList.add('is-hidden');
11472      }
11473      if (listDescriptionError) {
11474        listDescriptionError.classList.add('is-hidden');
11475      }
11476
11477      if ((0, _userListsHelpers.validateFormFields)(formValues, listNameError, listDescriptionError)) {
11478        (0, _toggleFormLoader.hideFormLoader)(editListForm);
11479        return;
11480      }
11481
11482      var list = document.querySelector("#edit-list-slug");
11483      if (list) {
11484
11485        fetch("/watchlist-edit/" + formValues["list"] + "/", {
11486          method: "POST",
11487          headers: new Headers({
11488            "content-type": "application/json",
11489            "is-ajax-call": "yes"
11490          }),
11491          body: JSON.stringify(formValues),
11492          credentials: "same-origin"
11493        }).then(function (response) {
11494          return response.json();
11495        }).then(function (json) {
11496          var listTitleOnPage = document.querySelector('.member-header__title');
11497          if (listTitleOnPage) {
11498            listTitleOnPage.textContent = formValues["name"];
11499          }
11500          (0, _toggleFormLoader.hideFormLoader)(editListForm);
11501          modal.classList.remove('modal--displaying');
11502          (0, _listNotification.openNotification)({ text: "List updated." });
11503        }).catch(function (err) {
11504          return console.log(err);
11505        });
11506      }
11507    });
11508  }
11509
11510  // ---------------------------------------------
11511  // on delete list click just show confirmation
11512  // ---------------------------------------------
11513  deleteList && deleteList.addEventListener("click", function (e) {
11514    step1.classList.add("is-hidden");
11515    step2.classList.remove("is-hidden");
11516  });
11517
11518  // ---------------------------------------------
11519  // On step 2: when confirm is clicked
11520  // ---------------------------------------------
11521  var _confirmForm = document.querySelector('#confirm-yourself');
11522  if (_confirmForm) {
11523    _confirmForm.addEventListener("submit", async function (e) {
11524      e.preventDefault();
11525      var listSlug = document.querySelector("#edit-list-slug").value;
11526      if (!listSlug) return;
11527
11528      (0, _toggleFormLoader.showFormLoader)(_confirmForm);
11529
11530      try {
11531        var response = await fetch("/watchlist-delete/" + listSlug + "/", {
11532          method: 'GET',
11533          headers: new Headers({
11534            "content-type": "application/json",
11535            "is-ajax-call": "yes"
11536          })
11537        });
11538
11539        if (response.ok) {
11540          //console.log(`Watchlist: ${listSlug} deleted successfully`);
11541
11542          (0, _toggleFormLoader.hideFormLoader)(_confirmForm);
11543          modal.classList.remove('modal--displaying');
11544          (0, _listNotification.openNotification)({
11545            text: "List deleted. Redirecting..."
11546          });
11547
11548          // redirect user to the lists page
11549          setTimeout(function () {
11550            var currentUrl = window.location.href;
11551            var urlParts = currentUrl.split('/');
11552            urlParts = urlParts.filter(function (part) {
11553              return part !== listSlug;
11554            });
11555            var redirectUrl = urlParts.join('/');
11556            window.location.href = redirectUrl;
11557          }, 1000);
11558        } else {
11559          console.error('Failed to delete the watchlist', response.status);
11560        }
11561      } catch (e) {
11562        console.error('Error deleting the watchlist:', e);
11563      }
11564    });
11565
11566    // ---------------------------------------------
11567    // get back to step one if closed
11568    // ---------------------------------------------
11569    var resetButtons = document.querySelectorAll(".js-reset-to-first-step");
11570    resetButtons.forEach(function (button) {
11571      button.addEventListener("click", function () {
11572        step1.classList.remove("is-hidden");
11573        step2.classList.add("is-hidden");
11574      });
11575    });
11576  }
11577}
11578
11579},{"./../../helpers/toggle-form-loader":5,"./../../helpers/user-lists-helpers":6,"./list-notification":67}],94:[function(require,module,exports){
11580'use strict';
11581
11582var _listNotification = require('./list-notification');
11583
11584// Function to sync all 'is_public' inputs when any input value is changed
11585var syncAllInputs = function syncAllInputs(inputs) {
11586  inputs.forEach(function (input) {
11587    input.addEventListener("change", function () {
11588      var isChecked = input.checked;
11589      inputs.forEach(function (cb) {
11590        return cb.checked = isChecked;
11591      });
11592    });
11593  });
11594};
11595
11596// Initialize synchronization for all 'is_public' inputs
11597var allInputs = document.querySelectorAll('input[name="is_public"]');
11598syncAllInputs(allInputs);
11599
11600// Function to handle form submission
11601var submitForm = async function submitForm() {
11602  var shareListForm = document.querySelector('#share-list');
11603  if (!shareListForm) return;
11604
11605  var formData = new FormData(shareListForm);
11606  var formValues = Object.fromEntries(formData.entries());
11607  formValues["is_public"] = formValues["is_public"] === "on";
11608
11609  try {
11610    var response = await fetch('/watchlist-edit/' + formValues["list"] + '/', {
11611      method: "POST",
11612      headers: new Headers({
11613        "content-type": "application/json",
11614        "is-ajax-call": "yes"
11615      }),
11616      body: JSON.stringify(formValues),
11617      credentials: "same-origin"
11618    });
11619    var json = await response.json();
11620    var notificationText = formValues["is_public"] ? "Your list is public." : "Your list is private.";
11621    (0, _listNotification.openNotification)({ text: notificationText });
11622  } catch (err) {
11623    console.error("Error submitting form:", err);
11624  }
11625};
11626
11627// Attach the change event for the form submission on toggle
11628var submitOnChange = document.querySelector('.js-submit-on-change');
11629if (submitOnChange) {
11630  submitOnChange.addEventListener('change', submitForm);
11631}
11632
11633},{"./list-notification":67}],95:[function(require,module,exports){
11634"use strict";
11635
11636var _checkMovieStatusOnAllLists = require("./../../helpers/check-movie-status-on-all-lists");
11637
11638var _toggleFormLoader = require("./../../helpers/toggle-form-loader");
11639
11640var _userListsHelpers = require("./../../helpers/user-lists-helpers");
11641
11642var _helpers = require("./../../helpers/helpers");
11643
11644var _listNotification = require("./list-notification");
11645
11646var _jsCookie = require("js-cookie");
11647
11648var _jsCookie2 = _interopRequireDefault(_jsCookie);
11649
11650function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11651
11652// Selectors
11653var userToggleListsPopup = document.querySelector("#user-toggle-lists");
11654var createNewListButton = document.querySelector(".js-create-new-list");
11655var toggleListsForm = document.querySelector("#user-lists-toggle-form");
11656var createNewListFormWrapper = document.querySelector(".js-user-create-form-wrapper");
11657var movieListsForm = document.querySelector("#user-lists-toggle-form");
11658var createNewListForm = document.querySelector("#create-new-list-form");
11659
11660var movieSlug = void 0,
11661    movieTitle = void 0,
11662    username = void 0,
11663    originalButtonReference = void 0,
11664    isWatchlistCarousel = void 0;
11665
11666var closeModal = function closeModal(modalEl) {
11667  if (!modalEl) return;
11668  (0, _helpers.modalsHandler)("close", modalEl);
11669};
11670
11671// reset toggle list form on close
11672var closeButton = document.querySelector('.js-reset-toggle-list-form');
11673if (closeButton) {
11674  closeButton.addEventListener('click', function (e) {
11675    movieListsForm.classList.remove('is-hidden');
11676    createNewListFormWrapper.classList.add('is-hidden');
11677  });
11678}
11679
11680//--------------------------------------------------------------------------
11681// check on which lists movie is present
11682//--------------------------------------------------------------------------
11683if (userToggleListsPopup) {
11684  (0, _checkMovieStatusOnAllLists.startMovieStatusCheck)();
11685}
11686
11687// hide remove from all lists button on popup close
11688var editListsCloseButtons = document.querySelectorAll('.js-hide-remove-from-all-btn');
11689editListsCloseButtons.forEach(function (button) {
11690  button.addEventListener('click', function (e) {
11691    var removefromAllListsBtn = document.querySelector('.js-remove-from-all-lists');
11692    if (removefromAllListsBtn) {
11693      removefromAllListsBtn.classList.add('is-hidden');
11694    }
11695  });
11696});
11697
11698//--------------------------------------------------------------------------
11699// Pass movie data so can be used in modal
11700//--------------------------------------------------------------------------
11701var updatePopupTitle = function updatePopupTitle(title) {
11702  var currentModal = document.querySelector("#user-toggle-lists");
11703  if (!currentModal) return;
11704
11705  var modalHeading = currentModal.querySelector(".js-modal-heading");
11706  modalHeading.innerHTML = title;
11707};
11708
11709var passMovieSlugToHiddenFormFields = function passMovieSlugToHiddenFormFields(slug) {
11710  var hiddenInputs = document.querySelectorAll('input[name="movie_slug"]');
11711  hiddenInputs.forEach(function (input) {
11712    return input.value = slug;
11713  });
11714};
11715
11716var setupModalTriggerListeners = function setupModalTriggerListeners() {
11717  var modalTriggerButtons = document.querySelectorAll(".js-pass-movie-data");
11718  modalTriggerButtons.forEach(function (button) {
11719    button.addEventListener("click", function (e) {
11720      movieSlug = e.target.dataset.slug;
11721      movieTitle = e.target.dataset.title;
11722      username = e.target.dataset.username;
11723      originalButtonReference = e.target;
11724      isWatchlistCarousel = e.target.dataset.watchlistcarousel == "1" ? true : false;
11725
11726      updatePopupTitle(movieTitle);
11727      passMovieSlugToHiddenFormFields(movieSlug);
11728    });
11729  });
11730};
11731
11732var observeDynamicModalTriggers = function observeDynamicModalTriggers() {
11733  var observer = new MutationObserver(function () {
11734    setupModalTriggerListeners();
11735  });
11736
11737  observer.observe(document.body, {
11738    childList: true,
11739    subtree: true
11740  });
11741};
11742
11743setupModalTriggerListeners();
11744observeDynamicModalTriggers();
11745
11746//--------------------------------------------------------------------------
11747// Show 'create new list' form
11748//--------------------------------------------------------------------------
11749if (createNewListButton && toggleListsForm && createNewListFormWrapper) {
11750  createNewListButton.addEventListener("click", function (e) {
11751    e.preventDefault();
11752    toggleListsForm.classList.add("is-hidden");
11753    createNewListFormWrapper.classList.remove("is-hidden");
11754  });
11755}
11756
11757if (createNewListButton) {
11758  createNewListButton.addEventListener("click", function (e) {
11759    username = e.target.dataset.username;
11760  });
11761}
11762
11763//--------------------------------------------------------------------------
11764// Update the lists
11765// (submit 'user-lists-toggle-form' form)
11766//--------------------------------------------------------------------------
11767if (movieListsForm) {
11768  movieListsForm.addEventListener("submit", async function (e) {
11769    e.preventDefault();
11770    (0, _toggleFormLoader.showFormLoader)(movieListsForm);
11771
11772    var formData = new FormData(movieListsForm);
11773    var formValues = {
11774      movie_slug: formData.get("movie_slug"),
11775      lists: formData.getAll("lists")
11776    };
11777
11778    try {
11779      //const response = await manageMovieOnWatchlists(formValues);
11780      var response = await addMovieToList(formValues['movie_slug'], formValues['lists']);
11781      if (response.status == "OK") {
11782        var addedTo = response.data['added_to'];
11783        var removedFrom = response.data['removed_from'];
11784
11785        closeModal(userToggleListsPopup);
11786        manageNotifications(response.data);
11787        (0, _toggleFormLoader.hideFormLoader)(movieListsForm);
11788
11789        updateCustomListUIAfterChange(removedFrom, formValues["movie_slug"]); // Watchlist or Custom Lists update the UI after change
11790        updateSingleMoviePageButtonState(formValues["movie_slug"]); // SINGLE MOVIE PAGE update the button
11791        notifyWildFlicksWatchlistChanged(response.data, formValues);
11792
11793        // Handle "+" and tick icons across the page
11794        if (originalButtonReference) {
11795          if (isWatchlistCarousel) {
11796            var removedFromWatchlist = removedFrom.some(function (item) {
11797              return item.list === "watchlist";
11798            });
11799            if (removedFromWatchlist) {
11800              originalButtonReference.classList.remove('on-watchlist');
11801            }
11802
11803            var addedToWatchlist = addedTo.some(function (item) {
11804              return item.list === "watchlist";
11805            });
11806            if (addedToWatchlist) {
11807              originalButtonReference.classList.add('on-watchlist');
11808            }
11809          } else {
11810            var allMoviesOnThisPage = document.querySelectorAll("[data-slug=\"" + formValues["movie_slug"] + "\"]");
11811
11812            if (response.data['lists_count'] > 0) {
11813              allMoviesOnThisPage.forEach(function (button) {
11814                if (button.getAttribute('data-watchlistcarousel') !== '1') {
11815                  button.classList.add('on-watchlist');
11816                }
11817              });
11818            } else {
11819              allMoviesOnThisPage.forEach(function (button) {
11820                if (button.getAttribute('data-watchlistcarousel') !== '1') {
11821                  button.classList.remove('on-watchlist');
11822                }
11823              });
11824            }
11825
11826            // clicked somewhere else but was removed from watchlist
11827            var wasRemovedWatchlist = removedFrom.some(function (item) {
11828              return item.list === "watchlist";
11829            });
11830            if (wasRemovedWatchlist) {
11831              var watchListWrapper = document.querySelector('.js-watchlist-watcher');
11832              if (watchListWrapper) {
11833                var selectedMovieButton = watchListWrapper.querySelector("[data-slug=\"" + formValues["movie_slug"] + "\"]");
11834                if (selectedMovieButton) {
11835                  selectedMovieButton.classList.remove('on-watchlist');
11836                }
11837              }
11838            }
11839          }
11840        }
11841      }
11842    } catch (error) {
11843      console.error("Error updating movie lists:", error);
11844    }
11845  });
11846}
11847
11848var manageNotifications = function manageNotifications(responseData) {
11849
11850  // Default to empty arrays if properties are missing
11851  var addedTo = responseData['added_to'];
11852  var removedFrom = responseData['removed_from'];
11853
11854  // Helper function to generate list URL
11855  var generateListURL = function generateListURL(listSlug) {
11856    if (listSlug === 'watchlist') {
11857      return window.location.origin + "/member/" + username + "/dashboard/";
11858    }
11859    return window.location.origin + "/member/" + username + "/lists/" + listSlug + "/";
11860  };
11861
11862  if (!addedTo.length && removedFrom.length === 1) {
11863    var listURL = generateListURL(removedFrom[0].list);
11864    (0, _listNotification.openNotification)({ text: "Removed from <a href=\"" + listURL + "\">" + removedFrom[0].name + "</a>" });
11865  } else if (!removedFrom.length && addedTo.length === 1) {
11866    var _listURL = generateListURL(addedTo[0].list);
11867    (0, _listNotification.openNotification)({ text: "Added to <a href=\"" + _listURL + "\">" + addedTo[0].name + "</a>" });
11868  } else {
11869    (0, _listNotification.openNotification)({ text: "Done" });
11870  }
11871};
11872
11873var notifyWildFlicksWatchlistChanged = function notifyWildFlicksWatchlistChanged(responseData, formValues) {
11874  if (typeof window === "undefined" || typeof window.CustomEvent !== "function") return;
11875
11876  var slug = formValues["movie_slug"];
11877  if (!slug) return;
11878
11879  var selectedLists = Array.isArray(formValues.lists) ? formValues.lists : [];
11880  var baseDetail = {
11881    slug: slug,
11882    type: originalButtonReference && originalButtonReference.dataset.contentType ? originalButtonReference.dataset.contentType : "movie",
11883    title: movieTitle || "",
11884    lists: selectedLists,
11885    source: "legacy-modal"
11886  };
11887
11888  window.dispatchEvent(new CustomEvent("wild-flicks-watchlist-changed", {
11889    detail: baseDetail
11890  }));
11891
11892  var addedTo = responseData["added_to"] || [];
11893  var removedFrom = responseData["removed_from"] || [];
11894  addedTo.forEach(function (list) {
11895    window.dispatchEvent(new CustomEvent("wild-flicks-watchlist-changed", {
11896      detail: Object.assign({}, baseDetail, {
11897        added: true,
11898        list: list.list,
11899        listName: list.name
11900      })
11901    }));
11902  });
11903  removedFrom.forEach(function (list) {
11904    window.dispatchEvent(new CustomEvent("wild-flicks-watchlist-changed", {
11905      detail: Object.assign({}, baseDetail, {
11906        added: false,
11907        list: list.list,
11908        listName: list.name
11909      })
11910    }));
11911  });
11912};
11913
11914var updateCustomListUIAfterChange = function updateCustomListUIAfterChange(removedFrom, movieSlug) {
11915  var isSingleListPage = document.querySelector(".js-list-name");
11916  if (isSingleListPage) {
11917    var listSlug = isSingleListPage.dataset.listslug;
11918    if (listSlug) {
11919      var wasRemovedFromCurrentList = removedFrom.some(function (item) {
11920        return item.list === listSlug;
11921      });
11922      if (wasRemovedFromCurrentList) {
11923        (0, _userListsHelpers.updateUIafterTogglingLists)(movieSlug);
11924      }
11925    }
11926  }
11927};
11928
11929var updateSingleMoviePageButtonState = function updateSingleMoviePageButtonState(movieSlug) {
11930  var singleMoviePageOrBlog = document.querySelector(".js-single-movie-template") || document.querySelector('.blog-container') || document.querySelector('.trailer-landing');
11931  if (singleMoviePageOrBlog) {
11932    (async function () {
11933      try {
11934        var response = await fetch("/watchlist-get-movie-lists/" + movieSlug + "/");
11935        if (!response.ok) {
11936          throw new Error("Failed to fetch watchlists");
11937        }
11938
11939        var data = await response.json();
11940        var parentEl = originalButtonReference.closest('.js-advanced-button-outer');
11941        if (!parentEl) return;
11942
11943        var addedButton = parentEl.querySelector(".js-button-added-to-list");
11944        var advancedButton = parentEl.querySelector(".js-watchlist-advanced-buttons");
11945        // const addedButton = document.querySelector(".js-button-added-to-list");
11946        // const advancedButton = document.querySelector(
11947        //   ".js-watchlist-advanced-buttons"
11948        // );
11949
11950        // const addedButton = document.querySelector(".js-button-added-to-list");
11951        // const advancedButton = document.querySelector(
11952        //   ".js-watchlist-advanced-buttons"
11953        // );
11954        if (addedButton && advancedButton) {
11955          if (data.length > 0) {
11956            advancedButton.classList.add("is-hidden");
11957            addedButton.classList.remove("is-hidden");
11958          } else {
11959            advancedButton.classList.remove("is-hidden");
11960            addedButton.classList.add("is-hidden");
11961          }
11962        }
11963      } catch (error) {
11964        console.error("Error:", error);
11965      }
11966    })();
11967  }
11968};
11969
11970//--------------------------------------------------------------------------
11971// Create new list (and optionally add a movie there immediately)
11972//--------------------------------------------------------------------------
11973if (createNewListForm) {
11974  createNewListForm.addEventListener("submit", async function (e) {
11975    var listNameError = document.querySelector('.js-form-error-list-name');
11976    var listDescriptionError = document.querySelector('.js-form-error-list-description');
11977    if (listNameError) {
11978      listNameError.classList.add('is-hidden');
11979    }
11980    if (listDescriptionError) {
11981      listDescriptionError.classList.add('is-hidden');
11982    }
11983
11984    e.preventDefault();
11985    (0, _toggleFormLoader.showFormLoader)(createNewListForm);
11986
11987    var formData = new FormData(e.target);
11988    var formValues = {};
11989    formData.forEach(function (value, key) {
11990      formValues[key] = value;
11991    });
11992
11993    if ((0, _userListsHelpers.validateFormFields)(formValues, listNameError, listDescriptionError)) {
11994      (0, _toggleFormLoader.hideFormLoader)(createNewListForm);
11995      return;
11996    }
11997
11998    var newList = await createWatchlist(formValues);
11999
12000    // if you create a new list that exists it returns empty array, otherwise it's an object.
12001    if (Array.isArray(newList)) return;
12002
12003    var newListName = newList.name;
12004    var newListSlug = newList.list;
12005
12006    // if event happened when clicking on any particular movie add this movie to the list immediately
12007    if (formValues["movie_slug"] && newListSlug) {
12008      var result = await addMovieToList(formValues["movie_slug"], newListSlug);
12009      if (result.status === "OK") {
12010        closeModal(userToggleListsPopup);
12011        notifyWildFlicksWatchlistChanged({
12012          added_to: [{ list: newListSlug, name: newListName }],
12013          removed_from: []
12014        }, {
12015          movie_slug: formValues["movie_slug"],
12016          lists: [newListSlug]
12017        });
12018      } else {
12019        console.error("Error adding movie to the watchlist: " + listID, result);
12020      }
12021    }
12022
12023    (0, _toggleFormLoader.hideFormLoader)(createNewListForm);
12024
12025    if (originalButtonReference) {
12026      originalButtonReference.classList.add('on-watchlist');
12027    }
12028
12029    // restore to defaults so the list toggle form is visible next time user clicks on the button
12030    createNewListForm.classList.add("is-hidden");
12031    var listsToggleForm = document.querySelector("#user-lists-toggle-form");
12032    if (listsToggleForm) {
12033      listsToggleForm.classList.remove("is-hidden");
12034    }
12035
12036    // hide currently open modal
12037    var currentPopup = document.querySelector("#user-create-new-list");
12038    if (currentPopup) {
12039      closeModal(currentPopup);
12040    }
12041
12042    // show notification
12043    var listURL = void 0;
12044    if (newListSlug === 'watchlist') {
12045      listURL = window.location.origin + "/member/" + username + "/dashboard/";
12046    } else {
12047      listURL = window.location.origin + "/member/" + username + "/lists/" + newListSlug + "/";
12048    }
12049    (0, _listNotification.openNotification)({ text: "<a href=\"" + listURL + "\">" + newListName + "</a> created." });
12050
12051    // Redirect user to newly created list
12052    setTimeout(function () {
12053      if (username) {
12054        window.location.href = window.location.origin + "/member/" + username + "/lists/" + newListSlug + "/";
12055      }
12056    }, 500);
12057  });
12058}
12059
12060async function createWatchlist(formValues) {
12061
12062  try {
12063    var response = await fetch("/watchlist-create/", {
12064      method: "POST",
12065      headers: new Headers({
12066        "content-type": "application/json",
12067        "is-ajax-call": "yes"
12068      }),
12069      body: JSON.stringify(formValues),
12070      credentials: "same-origin"
12071    });
12072
12073    var result = await response.json();
12074
12075    // Return the created list ID
12076    return result;
12077  } catch (error) {
12078    console.error("Error creating watchlist:", error);
12079    throw error; // Propagate the error so it can be handled later if necessary
12080  }
12081}
12082
12083async function addMovieToList(movieSlug, listId) {
12084  try {
12085    var updatedFormValues = void 0;
12086
12087    if (Array.isArray(listId)) {
12088      updatedFormValues = {
12089        movie_slug: movieSlug,
12090        lists: listId
12091      };
12092    } else {
12093      updatedFormValues = {
12094        movie_slug: movieSlug,
12095        lists: ["" + listId]
12096      };
12097    }
12098
12099    var response = await fetch("/watchlist-movie-edit/" + updatedFormValues.movie_slug + "/", {
12100      method: "POST",
12101      headers: new Headers({
12102        "content-type": "application/json",
12103        "is-ajax-call": "yes"
12104      }),
12105      body: JSON.stringify(updatedFormValues),
12106      credentials: "same-origin"
12107    });
12108
12109    var result = await response.json();
12110    return result;
12111  } catch (error) {
12112    console.error("An error occurred:", error);
12113    throw error;
12114  }
12115}
12116
12117// @LUKE - this is the cookie processing thing
12118// if (Cookies.get('watchlist_add') && !Cookies.get('login_redirect')) {
12119//   // ------------------------------------------------
12120//   // variables
12121//   const popupToOpen = document.querySelector('#user-toggle-lists');
12122//   const getListWrapper = document.querySelector('#user-lists-toggle-form');
12123//   const movieSlug = Cookies.get('watchlist_add');
12124//   originalButtonReference = document.querySelector(`button[data-slug="${movieSlug}"]`);
12125
12126//   // @Tom: variables needed
12127//   const movieTitle = movieSlug;
12128//   const userName = originalButtonReference.getAttribute("data-username");
12129//   const userId = originalButtonReference.getAttribute("data-user");
12130//   // ------------------------------------------------
12131
12132//   Cookies.remove('watchlist_add');
12133
12134//   const setFormValues = (form, values) => {
12135//     if (!form) return;
12136//     Object.entries(values).forEach(([selector, value]) => {
12137//       const input = form.querySelector(selector);
12138//       if (input) input.value = value;
12139//     });
12140//   };
12141
12142//   // ------------------------------------------------
12143//   // Check movie status
12144//   // ------------------------------------------------
12145//   if (getListWrapper) {
12146//     getListWrapper.classList.add('is-loading');
12147//   }
12148//   fetchAndCheckWatchlists(movieSlug); // pass variable
12149
12150//   // ------------------------------------------------
12151//   // load values for 'toggle lists' form
12152//   // ------------------------------------------------
12153//   if (popupToOpen) {
12154//     popupToOpen.classList.add('modal--displaying');
12155//     const popupTitle = popupToOpen.querySelector('.js-modal-heading');
12156//     if (popupTitle) {
12157//       popupTitle.textContent = movieTitle;
12158//     }
12159//   }
12160
12161//   const firstForm = document.querySelector('#user-lists-toggle-form');
12162//   if (firstForm) {
12163//     setFormValues(document.querySelector('#user-lists-toggle-form'), {
12164//       '#create-list-movie-slug': movieSlug,
12165//     });
12166
12167//     const createNewListBtn = firstForm.querySelector('.js-create-new-list');
12168//     if (createNewListBtn) {
12169//       createNewListBtn.setAttribute('data-username', userName);
12170//     }
12171
12172//   }
12173
12174//   // ------------------------------------------------
12175//   // load values for 'create new list' form
12176//   // ------------------------------------------------
12177//   const createNewListForm = popupToOpen.querySelector('#create-new-list-form');
12178//   if (createNewListForm) {
12179//     setFormValues(document.querySelector('#create-new-list-form'), {
12180//       '#create-list-movie-slug': movieSlug,
12181//       '[name="username"]': userName,
12182//       '[name="user_id"]': userId,
12183//     });
12184//   }
12185// }
12186
12187},{"./../../helpers/check-movie-status-on-all-lists":2,"./../../helpers/helpers":3,"./../../helpers/toggle-form-loader":5,"./../../helpers/user-lists-helpers":6,"./list-notification":67,"js-cookie":171}],96:[function(require,module,exports){
12188"use strict";
12189
12190var _listNotification = require("./list-notification");
12191
12192var listVisibilityCheckbox = document.querySelector("#list-visibility-toggle");
12193var copyURLButton = document.querySelector(".js-big-share-button-copy-url");
12194var mainShareButton = document.querySelector(".js-big-share-main");
12195var fallbackButtons = document.querySelector(".js-fallback-buttons");
12196var allShareButtons = document.querySelectorAll(".js-big-share-button");
12197
12198var title = void 0,
12199    description = void 0,
12200    comesFromHubPage = void 0;
12201var listSlug = void 0,
12202    listName = void 0,
12203    listDescription = void 0,
12204    listPublicStatus = void 0,
12205    username = void 0;
12206if (mainShareButton && mainShareButton.dataset) {
12207  var _mainShareButton$data = mainShareButton.dataset;
12208  title = _mainShareButton$data.title;
12209  description = _mainShareButton$data.description;
12210} else {
12211  title = description = null;
12212}
12213
12214var shareText = "Behold my Flicks list: ";
12215var TMPmodal = document.querySelector('.js-modal--tmp-share');
12216if (TMPmodal) {
12217  shareText = "Watch the " + TMPmodal.dataset.title + " trailer: ";
12218}
12219
12220var shareUrl = window.location.href;
12221var shareLinks = {
12222  messenger: "https://www.addtoany.com/add_to/facebook_messenger?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + shareText,
12223  whatsapp: "https://www.addtoany.com/add_to/whatsapp?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + shareText,
12224  facebook: "https://www.addtoany.com/add_to/facebook?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + shareText
12225};
12226
12227var buttonsWithData = document.querySelectorAll('.js-read-list-data-from-button');
12228buttonsWithData.forEach(function (button) {
12229  button.addEventListener('click', function (e) {
12230    e.preventDefault();
12231    comesFromHubPage = true;
12232
12233    var _e$target$dataset = e.target.dataset;
12234    listSlug = _e$target$dataset.listslug;
12235    listName = _e$target$dataset.listname;
12236    listDescription = _e$target$dataset.listdescription;
12237    listPublicStatus = _e$target$dataset.listpublic;
12238    username = _e$target$dataset.username;
12239
12240
12241    var form = document.querySelector('#share-list');
12242    if (form) {
12243      var listSlugInput = form.querySelector('#edit-list-slug');
12244      if (listSlugInput) {
12245        listSlugInput.value = listSlug;
12246      }
12247      var newListNameInput = form.querySelector('#new_list_name');
12248      if (newListNameInput) {
12249        newListNameInput.value = listName;
12250      }
12251
12252      var newListDescriptionInput = form.querySelector('#new_list_description');
12253      if (newListDescriptionInput) {
12254        newListDescriptionInput.value = listDescription;
12255      }
12256
12257      var newPublicStatusCheckbox = form.querySelector('input[name="is_public"]');
12258      if (newPublicStatusCheckbox) {
12259        var newStatus = listPublicStatus === 'true';
12260        newPublicStatusCheckbox.checked = listPublicStatus === 'true';
12261        var allBtns = document.querySelectorAll('.js-big-share-button');
12262        allBtns.forEach(function (btn) {
12263          if (newStatus) {
12264            btn.classList.remove('is-disabled');
12265          } else {
12266            btn.classList.add('is-disabled');
12267          }
12268        });
12269      }
12270
12271      shareUrl = window.origin + "/member/" + username + "/lists/" + listSlug + "/";
12272      shareLinks = {
12273        messenger: "https://www.addtoany.com/add_to/facebook_messenger?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + shareText,
12274        whatsapp: "https://www.addtoany.com/add_to/whatsapp?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + shareText,
12275        facebook: "https://www.addtoany.com/add_to/facebook?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + shareText
12276      };
12277    }
12278  });
12279});
12280
12281var openShareLink = function openShareLink(link) {
12282  return window.open(link, "_blank");
12283};
12284
12285function isMobileDevice() {
12286  return window.innerWidth <= 768;
12286 // Adjust the width threshold as needed
12287}
12288// ---------------------------------------------------------------
12289// Initial load, check if can use native device share option
12290// (largely iPhones only, but some Androids too)
12291// ---------------------------------------------------------------
12292function isMobileDevice() {
12293  return window.innerWidth <= 1000;
12294}
12295
12296if (navigator.share && mainShareButton && isMobileDevice()) {
12297  // Use navigator.share for mobile devices
12298  mainShareButton.addEventListener("click", async function () {
12299    try {
12300      await navigator.share({
12301        title: shareText,
12302        text: description,
12303        url: shareUrl
12304      });
12305    } catch (error) {
12306      console.error("Error sharing:", error);
12307    }
12308  });
12309} else {
12310  // Fallback for desktops or unsupported browsers
12311  if (fallbackButtons) {
12312    fallbackButtons.style.display = "block";
12313  }
12314  if (mainShareButton) {
12315    mainShareButton.style.display = "none";
12316  }
12317
12318  // Add event listeners for fallback share buttons
12319  var messengerShare = document.getElementById("messenger-share");
12320  if (messengerShare) {
12321    messengerShare.addEventListener("click", function (e) {
12322      e.preventDefault();
12323      openShareLink(shareLinks.messenger);
12324    });
12325  }
12326
12327  var whatsappShare = document.getElementById("whatsapp-share");
12328  if (whatsappShare) {
12329    whatsappShare.addEventListener("click", function (e) {
12330      e.preventDefault();
12331      openShareLink(shareLinks.whatsapp);
12332    });
12333  }
12334
12335  var facebookShare = document.getElementById("facebook-share");
12336  if (facebookShare) {
12337    facebookShare.addEventListener("click", function (e) {
12338      e.preventDefault();
12339      openShareLink(shareLinks.facebook);
12340    });
12341  }
12342}
12343
12344// ---------------------------------------------------------------
12345// On Visibility Checkbox Toggle
12346// ---------------------------------------------------------------
12347if (listVisibilityCheckbox) {
12348  listVisibilityCheckbox.addEventListener("change", function (e) {
12349    var isChecked = listVisibilityCheckbox.checked;
12350    isChecked ? enableAllButtons() : disableAllButtons();
12351
12352    // POST REQUEST TO SET THE checkbox value
12353    // @Tom (multi-list): Add logic here
12354  });
12355}
12356
12357// ---------------------------------------------------------------
12358// Copy to clipboard
12359// Note: may not work on local as needs https
12360// ---------------------------------------------------------------
12361if (copyURLButton) {
12362  copyURLButton.addEventListener("click", function (e) {
12363    e.preventDefault();
12364    navigator.clipboard.writeText(shareUrl).then(function () {
12365      (0, _listNotification.openNotification)({ text: "URL copied to clipboard." });
12366    }).catch(function (err) {
12367      console.error("Failed to copy URL: ", err);
12368    });
12369  });
12370}
12371
12372function disableAllButtons() {
12373  allShareButtons.forEach(function (button) {
12374    return button.classList.add("is-disabled");
12375  });
12376}
12377
12378function enableAllButtons() {
12379  allShareButtons.forEach(function (button) {
12380    return button.classList.remove("is-disabled");
12381  });
12382}
12383
12384},{"./list-notification":67}],97:[function(require,module,exports){
12385"use strict";
12386
12387var watchlistFormButton = document.querySelectorAll(".js-watchlist-options");
12388var optionsForm = document.querySelector("#more-options-form");
12389
12390// ------------------------------------------------------------
12391// Change the popup title so it matches the clicked movie
12392// Update the movie ID in the form
12393// ------------------------------------------------------------
12394watchlistFormButton.forEach(function (button) {
12395  button.addEventListener("click", function (e) {
12396    var movieTitle = button.dataset.title;
12397    var movieTitleInsidePopup = document.querySelector(".js-more-options-movie-title");
12398    if (movieTitleInsidePopup) {
12399      movieTitleInsidePopup.innerHTML = movieTitle;
12400    }
12401
12402    var movieID = button.dataset.id;
12403    var movieIDinput = document.querySelector(".js-hidden-movie-id");
12404    movieIDinput.value = movieID;
12405  });
12406});
12407
12408// ------------------------------------------------------------
12409// Handle the form submission
12410// ------------------------------------------------------------
12411if (optionsForm) {
12412  optionsForm.addEventListener("click", function (e) {
12413    if (e.target.classList.contains("watching-options-label")) {
12414      e.target.classList.toggle("selected");
12415    }
12416  });
12417
12418  optionsForm.addEventListener("submit", function (e) {
12419    e.preventDefault();
12420
12421    // ----------------------------------------
12422    // GET REQUEST
12423
12424    // - Do we need to check the status of the movie so we
12425    // - show default values ticked/unticked? (watchlist / seen it)
12426    // ----------------------------------------
12427
12428    // ----------------------------------------
12429    // POST REQUEST
12430    // ----------------------------------------
12431    var path = "api/post/request/url/";
12432    var movieID = document.querySelector(".js-hidden-movie-id").value;
12433    var finalURL = path + "/" + movieID;
12434
12435    var selectedValues = Array.from(optionsForm.querySelectorAll('input[type="checkbox"]')).filter(function (checkbox) {
12436      return checkbox.checked;
12437    }).map(function (checkbox) {
12438      return checkbox.value;
12439    });
12440
12441    // example data
12442    var formData = {
12443      id: movieID,
12444      selected: selectedValues
12445    };
12446
12447    // console.log(formData, "form data");
12448
12449    // fetch(finalUrl, {
12450    //   method: post,
12451    //   headers: {
12452    //     "Content-Type": "application/json",
12453    //   },
12454    //   body: JSON.stringify(formData),
12455    // })
12456    //   .then((response) => {
12457    //     if (!response.ok) throw new Error("Network response was not ok.");
12458    //     return response.json();
12459    //   })
12460    //   .then((data) => {
12461    //     console.log(data);
12462    //   })
12463    //   .catch((error) => {
12464    //     console.error(
12465    //       "There has been a problem:",
12466    //       error
12467    //     );
12468    //   });
12469  });
12470}
12471
12472},{}],98:[function(require,module,exports){
12473"use strict";
12474
12475(function () {
12476  var TRIGGER_SELECTOR = ".js--openCinemaAllMoviesSessions";
12477  var CINEMA_WRAPPER_SELECTOR = ".js-cinema-single";
12478  var ENDPOINT = "/cinema/cinema-times-movie-popup/";
12479  var ALL_MOVIES_SKELETON_COUNT = 6;
12480  var lastRequestId = 0;
12481
12482  function getModalContentElement(modalId) {
12483    if (!modalId) return null;
12484    var modal = document.getElementById(modalId);
12485    if (!modal) return null;
12486    return modal.querySelector(".modal__content");
12487  }
12488
12489  function renderLoading(contentEl) {
12490    if (!contentEl) return;
12491    contentEl.innerHTML = "\n      <div class=\"loader-loop loader-loop--dark is-visible\" aria-live=\"polite\" aria-busy=\"true\">\n        <span></span>\n      </div>\n    ";
12492  }
12493
12494  function renderError(contentEl) {
12495    if (!contentEl) return;
12496    contentEl.innerHTML = "\n      <div class=\"modal__content-top\">\n        <div class=\"modal__content-top-left\">\n          <p>Could not load sessions. Please try again.</p>\n        </div>\n      </div>\n    ";
12497  }
12498
12499  function renderAllMoviesSkeleton() {
12500    var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ALL_MOVIES_SKELETON_COUNT;
12501
12502    var items = Array.from({ length: count }, function () {
12503      return "\n      <article class=\"cinema-single-all-movies cinema-single-all-movies--skeleton\" aria-hidden=\"true\">\n        <div class=\"cinema-single-all-movies__poster-wrapper\">\n          <span class=\"cinema-single-all-movies__poster-link cinema-single-all-movies__poster-link--skeleton\">\n            <span class=\"cinema-single-all-movies__poster-img-skeleton\"></span>\n          </span>\n        </div>\n        <div class=\"cinema-single-all-movies__content cinema-single-all-movies__content--skeleton\">\n          <span class=\"cinema-single-all-movies__title-skeleton\"></span>\n          <div class=\"cinema-single-all-movies__meta-skeleton\">\n            <span class=\"cinema-single-all-movies__meta-line-skeleton cinema-single-all-movies__meta-line-skeleton--short\"></span>\n            <span class=\"cinema-single-all-movies__meta-line-skeleton\"></span>\n          </div>\n        </div>\n      </article>\n    ";
12504    }).join("");
12505
12506    return "\n      <section class=\"cinema-single-all-movies-grid cinema-single-all-movies-grid--wide cinema-single-all-movies-grid--skeleton\" aria-hidden=\"true\">\n        " + items + "\n      </section>\n    ";
12507  }
12508
12509  document.addEventListener("click", async function (event) {
12510    var trigger = event.target.closest(TRIGGER_SELECTOR);
12511    if (!trigger) return;
12512
12513    var cinemaWrapper = document.querySelector(CINEMA_WRAPPER_SELECTOR);
12514    var cinemaSlug = cinemaWrapper ? cinemaWrapper.getAttribute("data-cinema") : null;
12515    var movieSlug = trigger.getAttribute("data-slug");
12516    var modalId = trigger.getAttribute("data-modal-id");
12517
12518    if (!cinemaSlug || !movieSlug) {
12519      return;
12520    }
12521
12522    var query = new URLSearchParams({
12523      cinema_slug: cinemaSlug,
12524      movie_slug: movieSlug
12525    });
12526    var contentEl = getModalContentElement(modalId);
12527    var requestId = ++lastRequestId;
12528    renderLoading(contentEl);
12529
12530    try {
12531      var response = await fetch(ENDPOINT + "?" + query.toString(), {
12532        credentials: "same-origin",
12533        headers: { "is-ajax-call": "yes" }
12534      });
12535      if (!response.ok) throw new Error("Request failed with status " + response.status);
12536      var html = await response.text();
12537
12538      // Ignore stale responses if user clicked another movie meanwhile.
12539      if (requestId !== lastRequestId) return;
12540      if (contentEl) {
12541        contentEl.innerHTML = html;
12542        if (typeof window.updateTimesCalendarLabelHeightClasses === "function") {
12543          window.updateTimesCalendarLabelHeightClasses(contentEl);
12544        }
12545      }
12546    } catch (error) {
12547      console.error("[CinemaAllMoviesSessions] Could not load popup HTML", error);
12548      if (requestId !== lastRequestId) return;
12549      renderError(contentEl);
12550    }
12551  });
12552
12553  // filtering and ajax reload of sessions for all movies page
12554  var allMoviesWrapper = document.querySelector(".js--cinema-all-movies-wrapper");
12555  if (!allMoviesWrapper) return;
12556
12557  var filtersWrapper = document.querySelector(".js--cinema-all-movies-filters");
12558
12559  var orderButtons = filtersWrapper ? filtersWrapper.querySelectorAll(".cinema__orderby-button") : [];
12560
12561  orderButtons.forEach(function (button) {
12562    button.addEventListener("click", async function (event) {
12563      event.preventDefault();
12564      var sort_by = button.getAttribute("data-order");
12565      var currentURL = new URL(window.location.href);
12566      currentURL.searchParams.set("sort_by", sort_by);
12567      allMoviesWrapper.innerHTML = renderAllMoviesSkeleton();
12568      allMoviesWrapper.setAttribute("aria-busy", "true");
12569
12570      // fetch new sessions HTML
12571      try {
12572        var response = await fetch(currentURL.toString(), {
12573          credentials: "same-origin",
12574          headers: { "is-ajax-call": "yes" }
12575        });
12576        if (!response.ok) throw new Error("Request failed with status " + response.status);
12577        var html = await response.text();
12578        var extractedHTML = new DOMParser().parseFromString(html, "text/html").querySelector(".js--cinema-all-movies-wrapper").innerHTML;
12579        allMoviesWrapper.innerHTML = extractedHTML;
12580        allMoviesWrapper.removeAttribute("aria-busy");
12581      } catch (error) {
12582        console.error("[CinemaAllMoviesSessions] Could not load sessions for sort_by:", sort_by, error);
12583        allMoviesWrapper.innerHTML = "<p>Could not load sessions. Please try again.</p>";
12584        allMoviesWrapper.removeAttribute("aria-busy");
12585      }
12586    });
12587  });
12588})();
12589
12590},{}],99:[function(require,module,exports){
12591"use strict";
12592
12593var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
12594
12595var _colorThiefMin = require("../../../../../node_modules/colorthief/dist/color-thief.min.js");
12596
12597var _colorThiefMin2 = _interopRequireDefault(_colorThiefMin);
12598
12599function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12600
12601(function () {
12602  var heroes = document.querySelectorAll(".cinema-hero-v6--has-image");
12603
12604  if (!heroes.length) return;
12605
12606  var colorThief = new _colorThiefMin2.default();
12607
12608  heroes.forEach(function (hero) {
12609    var background = hero.querySelector(".cinema-hero-v6__bg[data-image-url]");
12610    var overlay = hero.querySelector(".cinema-hero-v6__overlay");
12611
12612    if (!background || !overlay) return;
12613
12614    var imageUrl = background.dataset.imageUrl;
12615
12616    if (!imageUrl) return;
12617
12618    extractDominantColor(imageUrl).then(function (_ref) {
12619      var r = _ref.r,
12620          g = _ref.g,
12621          b = _ref.b;
12622
12623      overlay.style.backgroundColor = "rgba(" + r + ", " + g + ", " + b + ", 0.5)";
12624    }).catch(function () {
12625      // Keep the CSS fallback overlay color if extraction fails.
12626    });
12627  });
12628
12629  function extractDominantColor(imageUrl) {
12630    return loadImage("/api/image-proxy?url=" + encodeURIComponent(imageUrl)).then(readDominantColor);
12631  }
12632
12633  function loadImage(src) {
12634    return new Promise(function (resolve, reject) {
12635      var img = new Image();
12636
12637      img.crossOrigin = "Anonymous";
12638      img.onload = function () {
12639        return resolve(img);
12640      };
12641      img.onerror = reject;
12642      img.src = src;
12643
12644      if (img.complete) {
12645        resolve(img);
12646      }
12647    });
12648  }
12649
12650  function readDominantColor(img) {
12651    var _colorThief$getColor = colorThief.getColor(img),
12652        _colorThief$getColor2 = _slicedToArray(_colorThief$getColor, 3),
12653        r = _colorThief$getColor2[0],
12654        g = _colorThief$getColor2[1],
12655        b = _colorThief$getColor2[2];
12656
12657    return { r: r, g: g, b: b };
12658  }
12659})();
12660
12661},{"../../../../../node_modules/colorthief/dist/color-thief.min.js":125}],100:[function(require,module,exports){
12662"use strict";
12663
12664var _swiperBundle = require("../../../../../node_modules/swiper/swiper-bundle.js");
12665
12666var _swiperBundle2 = _interopRequireDefault(_swiperBundle);
12667
12668function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12669
12670var cinemaHeroSliders = document.querySelectorAll(".js-cinema-hero-v6-swiper");
12671
12672cinemaHeroSliders.forEach(function (sliderEl) {
12673  var slidesCount = sliderEl.querySelectorAll(".swiper-slide").length;
12674
12675  if (!slidesCount) return;
12676
12677  var hasMultipleSlides = slidesCount > 1;
12678  var paginationEl = sliderEl.querySelector(".swiper-pagination");
12679  var autoplayDelay = 3500;
12680  var transitionSpeed = 650;
12681
12682  sliderEl.style.setProperty("--cinema-hero-pagination-duration", autoplayDelay + transitionSpeed + "ms");
12683
12684  new _swiperBundle2.default(sliderEl, {
12685    slidesPerView: 1,
12686    spaceBetween: 0,
12687    loop: hasMultipleSlides,
12688    speed: transitionSpeed,
12689    autoplay: hasMultipleSlides ? {
12690      delay: autoplayDelay,
12691      disableOnInteraction: false,
12692      pauseOnMouseEnter: false
12693    } : false,
12694    pagination: hasMultipleSlides && paginationEl ? {
12695      el: paginationEl,
12696      clickable: true
12697    } : false
12698  });
12699});
12700
12701},{"../../../../../node_modules/swiper/swiper-bundle.js":194}],101:[function(require,module,exports){
12702'use strict';
12703
12704(function () {
12705  var section = document.querySelector('.video-cards');
12706  if (!section) return;
12707
12708  var nav = document.querySelector('.video-cards-nav');
12709  if (!nav) return;
12710
12711  var btnUp = nav.querySelector('.video-cards-nav__btn--up');
12712  var btnDown = nav.querySelector('.video-cards-nav__btn--down');
12713
12714  var GAP_RIGHT = 40; // px outside card edge
12715  var EDGE_PAD = 8;
12716
12717  var cards = [];
12718  var activeIndex = 0;
12719
12720  var clamp = function clamp(n, min, max) {
12721    return Math.max(min, Math.min(max, n));
12722  };
12723  var hasMorePagination = function hasMorePagination() {
12724    var loadMoreBtn = document.querySelector('.js--paginationLoadMore');
12725    if (!loadMoreBtn) return false;
12726
12727    return loadMoreBtn.style.display !== 'none' && loadMoreBtn.getAttribute('href') !== '#';
12728  };
12729
12730  var updateButtons = function updateButtons() {
12731    if (!cards.length) {
12732      if (btnUp) btnUp.classList.add('is-hidden');
12733      if (btnDown) btnDown.classList.add('is-hidden');
12734      return;
12735    }
12736
12737    if (btnUp) btnUp.classList.toggle('is-hidden', activeIndex <= 0);
12738    if (btnDown) btnDown.classList.toggle('is-hidden', activeIndex >= cards.length - 1 && !hasMorePagination());
12739  };
12740
12741  var computeActiveIndexByCenter = function computeActiveIndexByCenter() {
12742    if (!cards.length) return 0;
12743
12744    var viewportCenterY = window.innerHeight / 2;
12745    var bestIdx = 0;
12746    var bestDist = Infinity;
12747
12748    for (var i = 0; i < cards.length; i++) {
12749      var r = cards[i].getBoundingClientRect();
12750      var cardCenterY = r.top + r.height / 2;
12751      var dist = Math.abs(cardCenterY - viewportCenterY);
12752      if (dist < bestDist) {
12753        bestDist = dist;
12754        bestIdx = i;
12755      }
12756    }
12757    return bestIdx;
12758  };
12759
12760  // Fixed X based on lane/card right edge
12761  var setFixedNavX = function setFixedNavX() {
12762    var refCard = cards[activeIndex] || cards[0];
12763    if (!refCard) return;
12764
12765    var cardRect = refCard.getBoundingClientRect();
12766    var navRect = nav.getBoundingClientRect();
12767
12768    var left = cardRect.right + GAP_RIGHT;
12769    left = clamp(left, EDGE_PAD, window.innerWidth - navRect.width - EDGE_PAD);
12770
12771    nav.style.left = Math.round(left) + 'px';
12772  };
12773
12774  // Show nav only while inside the section
12775  var updateNavVisibilityAndPinning = function updateNavVisibilityAndPinning() {
12776    var sectionRect = section.getBoundingClientRect();
12777    var navRect = nav.getBoundingClientRect();
12778
12779    var sectionBottomAboveViewport = sectionRect.bottom <= 0;
12780    var sectionTopBelowViewport = sectionRect.top >= window.innerHeight;
12781
12782    var outside = sectionBottomAboveViewport || sectionTopBelowViewport;
12783    nav.classList.toggle('is-outside', outside);
12784
12785    if (outside) return;
12786
12787    var viewportCenterY = window.innerHeight / 2;
12788    var minCenter = sectionRect.top + navRect.height / 2 + EDGE_PAD;
12789    var maxCenter = sectionRect.bottom - navRect.height / 2 - EDGE_PAD;
12790
12791    var clampedCenter = clamp(viewportCenterY, minCenter, maxCenter);
12792
12793    nav.style.top = Math.round(clampedCenter) + 'px';
12794  };
12795
12796  var scrollToIndex = function scrollToIndex(index) {
12797    if (!cards.length) return;
12798
12799    var next = clamp(index, 0, cards.length - 1);
12800    var el = cards[next];
12801    if (!el) return;
12802
12803    activeIndex = next;
12804    updateButtons();
12805
12806    el.scrollIntoView({
12807      behavior: 'smooth',
12808      block: 'center',
12809      inline: 'nearest'
12810    });
12811  };
12812
12813  var io = new IntersectionObserver(function (entries) {
12814    var visible = entries.filter(function (e) {
12815      return e.isIntersecting;
12816    });
12817    if (!visible.length) return;
12818
12819    var viewportCenterY = window.innerHeight / 2;
12820    var bestEntry = null;
12821    var bestDist = Infinity;
12822
12823    var _iteratorNormalCompletion = true;
12824    var _didIteratorError = false;
12825    var _iteratorError = undefined;
12826
12827    try {
12828      for (var _iterator = visible[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12829        var e = _step.value;
12830
12831        var r = e.target.getBoundingClientRect();
12832        var cy = r.top + r.height / 2;
12833        var d = Math.abs(cy - viewportCenterY);
12834        if (d < bestDist) {
12835          bestDist = d;
12836          bestEntry = e;
12837        }
12838      }
12839    } catch (err) {
12840      _didIteratorError = true;
12841      _iteratorError = err;
12842    } finally {
12843      try {
12844        if (!_iteratorNormalCompletion && _iterator.return) {
12845          _iterator.return();
12846        }
12847      } finally {
12848        if (_didIteratorError) {
12849          throw _iteratorError;
12850        }
12851      }
12852    }
12853
12854    if (bestEntry) {
12855      var idx = cards.indexOf(bestEntry.target);
12856      if (idx !== -1 && idx !== activeIndex) {
12857        activeIndex = idx;
12858        updateButtons();
12859      }
12860    }
12861  }, { root: null, rootMargin: '-45% 0px -45% 0px', threshold: 0.01 });
12862
12863  var observedCards = new WeakSet();
12864  var refreshCards = function refreshCards() {
12865    cards = Array.from(section.querySelectorAll('.video-card__outer'));
12866    activeIndex = clamp(computeActiveIndexByCenter(), 0, Math.max(cards.length - 1, 0));
12867
12868    cards.forEach(function (card) {
12869      if (observedCards.has(card)) return;
12870      io.observe(card);
12871      observedCards.add(card);
12872    });
12873
12874    updateButtons();
12875    setFixedNavX();
12876    updateNavVisibilityAndPinning();
12877  };
12878
12879  if (btnUp) btnUp.addEventListener('click', function () {
12880    return scrollToIndex(activeIndex - 1);
12881  });
12882  if (btnDown) btnDown.addEventListener('click', function () {
12883    return scrollToIndex(activeIndex + 1);
12884  });
12885
12886  var rafId = null;
12887  var onScrollOrResize = function onScrollOrResize() {
12888    if (rafId) return;
12889    rafId = requestAnimationFrame(function () {
12890      rafId = null;
12891      setFixedNavX();
12892      updateNavVisibilityAndPinning();
12893    });
12894  };
12895
12896  var onPaginationAppend = function onPaginationAppend(event) {
12897    var detail = event && event.detail;
12898    if (!detail || !detail.pageContainer || !section.contains(detail.pageContainer)) return;
12899
12900    refreshCards();
12901  };
12902
12903  window.addEventListener('scroll', onScrollOrResize, { passive: true });
12904  window.addEventListener('resize', onScrollOrResize);
12905  window.addEventListener('pagination:appended', onPaginationAppend);
12906
12907  refreshCards();
12908
12909  requestAnimationFrame(function () {
12910    setFixedNavX();
12911    updateNavVisibilityAndPinning();
12912  });
12913})();
12914
12915},{}],102:[function(require,module,exports){
12916"use strict";
12917
12918var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
12919
12920var _swiperBundle = require("../../../../../node_modules/swiper/swiper-bundle.js");
12921
12922var _swiperBundle2 = _interopRequireDefault(_swiperBundle);
12923
12924function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12925
12926function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12927
12928/* global jwplayer */
12929
12930var DEBUG = false;
12931
12932function log() {
12933  var _console;
12934
12935  for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
12936    args[_key] = arguments[_key];
12937  }
12938
12939  if (DEBUG) (_console = console).log.apply(_console, ["[FlicksNowPlayingMobileSlider]"].concat(args));
12940}
12941
12942function getJwAspectRatio() {
12943  return window.matchMedia("(max-width: 767px)").matches ? "1:1" : "16:9";
12944}
12945
12946function getJwStretching() {
12947  return "fill";
12948}
12949
12950function isRealDesktop() {
12951  return window.matchMedia("(min-width: 1200px) and (hover: hover) and (pointer: fine)").matches;
12952}
12953
12954function isFiniteNumber(value) {
12955  return typeof value === "number" && Number.isFinite(value);
12956}
12957
12958var FlicksNowPlayingMobileSlider = function () {
12959  function FlicksNowPlayingMobileSlider(root) {
12960    _classCallCheck(this, FlicksNowPlayingMobileSlider);
12961
12962    this.root = root;
12963    this.swiperEl = root.querySelector(".js-flicks-now-playing-mobile-swiper");
12964    this.prevBtn = root.querySelector(".js-flicks-now-playing-mobile-prev");
12965    this.nextBtn = root.querySelector(".js-flicks-now-playing-mobile-next");
12966    this.swiper = null;
12967    this.currentMediaEl = null;
12968    this.previousMediaEl = null;
12969    this.playersByMediaEl = new Map();
12970    this.pendingRaf = 0;
12971    this.pendingReason = "";
12972    this.modalResume = { jwid: null, startAt: 0 };
12973    this._onResize = null;
12974    this._viewportObserver = null;
12975    this.globalSoundOn = false;
12976    this.isViewportEligible = true;
12977  }
12978
12979  _createClass(FlicksNowPlayingMobileSlider, [{
12980    key: "markReady",
12981    value: function markReady() {
12982      if (!this.root) return;
12983      this.root.classList.remove("is-loading");
12984      this.root.classList.add("is-ready");
12985    }
12986  }, {
12987    key: "waitForPosterImages",
12988    value: function waitForPosterImages() {
12989      var _this = this;
12990
12991      var posterImgs = Array.from(this.root.querySelectorAll(".js-flicks-media-poster img"));
12992
12993      if (!posterImgs.length) {
12994        this.markReady();
12995        return;
12996      }
12997
12998      var remaining = posterImgs.length;
12999
13000      var done = function done() {
13001        remaining -= 1;
13002        if (remaining <= 0) {
13003          _this.markReady();
13004        }
13005      };
13006
13007      posterImgs.forEach(function (img) {
13008        if (img.complete) {
13009          done();
13010          return;
13011        }
13012
13013        img.addEventListener("load", done, { once: true });
13014        img.addEventListener("error", done, { once: true });
13015      });
13016    }
13017  }, {
13018    key: "getCardEl",
13019    value: function getCardEl(mediaEl) {
13020      return mediaEl ? mediaEl.closest(".flicks-card") : null;
13021    }
13022  }, {
13023    key: "isSoundOnForMedia",
13024    value: function isSoundOnForMedia(mediaEl) {
13025      if (isRealDesktop()) return this.globalSoundOn;
13026
13027      var rec = mediaEl ? this.playersByMediaEl.get(mediaEl) : null;
13028      return !!(rec && rec.soundOn);
13029    }
13030  }, {
13031    key: "applySoundUiForMedia",
13032    value: function applySoundUiForMedia(mediaEl) {
13033      var cardEl = this.getCardEl(mediaEl);
13034      if (!cardEl) return;
13035
13036      cardEl.classList.toggle("flicks-card--sound-on", this.isSoundOnForMedia(mediaEl));
13037    }
13038  }, {
13039    key: "applySoundToMedia",
13040    value: function applySoundToMedia(mediaEl) {
13041      var _this2 = this;
13042
13043      if (!mediaEl) return;
13044
13045      var rec = this.playersByMediaEl.get(mediaEl);
13046      if (!rec || !rec.ready) return;
13047
13048      setTimeout(function () {
13049        if (_this2.currentMediaEl !== mediaEl) return;
13050
13051        try {
13052          rec.player.setMute(!_this2.isSoundOnForMedia(mediaEl));
13053        } catch (e) {}
13054      }, 60);
13055    }
13056  }, {
13057    key: "applySoundUiToAll",
13058    value: function applySoundUiToAll() {
13059      var _this3 = this;
13060
13061      this.root.querySelectorAll(".js-flicks-media").forEach(function (mediaEl) {
13062        _this3.applySoundUiForMedia(mediaEl);
13063      });
13064    }
13065  }, {
13066    key: "toggleSoundForMedia",
13067    value: function toggleSoundForMedia(mediaEl) {
13068      if (!mediaEl) return;
13069
13070      if (isRealDesktop()) {
13071        this.globalSoundOn = !this.globalSoundOn;
13072        this.applySoundUiToAll();
13073        if (this.currentMediaEl) {
13074          this.applySoundToMedia(this.currentMediaEl);
13075        }
13076        log("sound toggled", {
13077          scope: "global",
13078          soundOn: this.globalSoundOn
13079        });
13080        return;
13081      }
13082
13083      var rec = this.ensurePlayer(mediaEl);
13084      if (!rec) return;
13085
13086      rec.soundOn = !rec.soundOn;
13087      this.applySoundUiForMedia(mediaEl);
13088      this.applySoundToMedia(mediaEl);
13089      log("sound toggled", {
13090        jwid: rec.jwid,
13091        soundOn: rec.soundOn
13092      });
13093    }
13094  }, {
13095    key: "shouldPrewarm",
13096    value: function shouldPrewarm() {
13097      return !isRealDesktop();
13098    }
13099  }, {
13100    key: "bindAudioToggle",
13101    value: function bindAudioToggle() {
13102      var _this4 = this;
13103
13104      this.root.querySelectorAll(".js-flicks-audio-toggle").forEach(function (btn) {
13105        btn.addEventListener("click", function () {
13106          var cardEl = btn.closest(".flicks-card");
13107          var mediaEl = cardEl ? cardEl.querySelector(".js-flicks-media") : null;
13108          _this4.toggleSoundForMedia(mediaEl);
13109        });
13110
13111        btn.addEventListener("keydown", function (e) {
13112          if (e.key === "Enter" || e.key === " ") {
13113            e.preventDefault();
13114            var cardEl = btn.closest(".flicks-card");
13115            var mediaEl = cardEl ? cardEl.querySelector(".js-flicks-media") : null;
13116            _this4.toggleSoundForMedia(mediaEl);
13117          }
13118        });
13119      });
13120    }
13121  }, {
13122    key: "hidePoster",
13123    value: function hidePoster(mediaEl) {
13124      if (!mediaEl) return;
13125
13126      var posterEl = mediaEl.querySelector(".js-flicks-media-poster");
13127      if (!posterEl) return;
13128
13129      posterEl.classList.add("is-hidden");
13130      log("poster hidden");
13131    }
13132  }, {
13133    key: "showPoster",
13134    value: function showPoster(mediaEl) {
13135      if (!mediaEl) return;
13136
13137      var rec = this.playersByMediaEl.get(mediaEl);
13138      if (rec && rec.hasFirstFrame) return;
13139
13140      var posterEl = mediaEl.querySelector(".js-flicks-media-poster");
13141      if (!posterEl) return;
13142
13143      posterEl.classList.remove("is-hidden");
13144      log("poster shown");
13145    }
13146  }, {
13147    key: "setProgress",
13148    value: function setProgress(rec, value) {
13149      if (!rec || !rec.progressBarEl) return;
13150
13151      var clamped = Math.max(0, Math.min(1, value || 0));
13152      rec.progressBarEl.style.width = clamped * 100 + "%";
13153    }
13154  }, {
13155    key: "setProgressVisible",
13156    value: function setProgressVisible(rec, isVisible) {
13157      if (!rec || !rec.progressEl) return;
13158
13159      rec.progressEl.classList.toggle("is-visible", !!isVisible);
13160    }
13161  }, {
13162    key: "setActiveSlide",
13163    value: function setActiveSlide(reason) {
13164      if (!this.swiper || !this.swiper.slides) return;
13165
13166      var activeIndex = Number(this.swiper.activeIndex) || 0;
13167
13168      Array.prototype.forEach.call(this.swiper.slides, function (slideEl, index) {
13169        slideEl.classList.toggle("is-active", index === activeIndex);
13170      });
13171
13172      this.root.setAttribute("data-active-index", String(activeIndex));
13173      log("active slide", { reason: reason, activeIndex: activeIndex });
13174    }
13175  }, {
13176    key: "getActiveMediaEl",
13177    value: function getActiveMediaEl() {
13178      if (!this.swiper || !this.swiper.slides) return null;
13179
13180      var activeSlide = this.swiper.slides[this.swiper.activeIndex];
13181      if (!activeSlide) return null;
13182
13183      return activeSlide.querySelector(".js-flicks-media");
13184    }
13185  }, {
13186    key: "getMediaElForIndex",
13187    value: function getMediaElForIndex(index) {
13188      if (!this.swiper || !this.swiper.slides) return null;
13189      if (!Number.isFinite(index)) return null;
13190      if (index < 0 || index >= this.swiper.slides.length) return null;
13191
13192      var slideEl = this.swiper.slides[index];
13193      return slideEl ? slideEl.querySelector(".js-flicks-media") : null;
13194    }
13195  }, {
13196    key: "getJwid",
13197    value: function getJwid(mediaEl) {
13198      if (!mediaEl) return "";
13199      return (mediaEl.getAttribute("data-jwid") || "").trim();
13200    }
13201  }, {
13202    key: "findMountEl",
13203    value: function findMountEl(mediaEl) {
13204      if (!mediaEl) return null;
13205      return mediaEl.querySelector(".js-jw-mount") || mediaEl.querySelector(".js-jw-video");
13206    }
13207  }, {
13208    key: "findMediaElByJwid",
13209    value: function findMediaElByJwid(jwid) {
13210      if (!jwid) return null;
13211
13212      var mediaEls = this.root.querySelectorAll(".js-flicks-media");
13213      for (var i = 0; i < mediaEls.length; i += 1) {
13214        if (this.getJwid(mediaEls[i]) === jwid) return mediaEls[i];
13215      }
13216
13217      return null;
13218    }
13219  }, {
13220    key: "applyAspectRatioToAllPlayers",
13221    value: function applyAspectRatioToAllPlayers() {
13222      var aspectratio = getJwAspectRatio();
13223      var stretching = getJwStretching();
13224
13225      this.playersByMediaEl.forEach(function (rec) {
13226        if (!rec || !rec.player) return;
13227
13228        try {
13229          rec.player.setConfig({ aspectratio: aspectratio, stretching: stretching });
13230        } catch (e) {}
13231      });
13232    }
13233  }, {
13234    key: "bindResizeAspectRatio",
13235    value: function bindResizeAspectRatio() {
13236      var _this5 = this;
13237
13238      if (this._onResize) return;
13239
13240      this._onResize = function () {
13241        _this5.applyAspectRatioToAllPlayers();
13242        _this5.syncDesktopMousewheel();
13243      };
13244
13245      window.addEventListener("resize", this._onResize);
13246    }
13247  }, {
13248    key: "syncDesktopMousewheel",
13249    value: function syncDesktopMousewheel() {
13250      if (!this.swiper || !this.swiper.mousewheel) return;
13251
13252      if (isRealDesktop()) {
13253        this.swiper.mousewheel.enable();
13254      } else {
13255        this.swiper.mousewheel.disable();
13256      }
13257    }
13258  }, {
13259    key: "getSlideIndexForMedia",
13260    value: function getSlideIndexForMedia(mediaEl) {
13261      if (!mediaEl) return null;
13262
13263      var slideEl = mediaEl.closest(".js-flicks-slide");
13264      if (!slideEl) return null;
13265
13266      var index = Number(slideEl.getAttribute("data-slide-index"));
13267      return Number.isFinite(index) ? index : null;
13268    }
13269  }, {
13270    key: "pauseMedia",
13271    value: function pauseMedia(mediaEl, reason) {
13272      if (!mediaEl) return;
13273
13274      var rec = this.playersByMediaEl.get(mediaEl);
13275      if (!rec) return;
13276
13277      if (rec.retryTimer) {
13278        clearTimeout(rec.retryTimer);
13279        rec.retryTimer = 0;
13280      }
13281
13282      try {
13283        rec.player.pause(true);
13284      } catch (e) {}
13285
13286      this.showPoster(mediaEl);
13287      log("paused previous media", {
13288        reason: reason,
13289        jwid: rec.jwid
13290      });
13291    }
13292  }, {
13293    key: "capturePosition",
13294    value: function capturePosition(mediaEl) {
13295      if (!mediaEl) return 0;
13296
13297      var rec = this.playersByMediaEl.get(mediaEl);
13298      if (!rec) return 0;
13299
13300      try {
13301        var pos = rec.player.getPosition();
13302        if (isFiniteNumber(pos) && pos >= 0) {
13303          rec.lastPos = pos;
13304          return pos;
13305        }
13306      } catch (e) {}
13307
13308      return isFiniteNumber(rec.lastPos) ? rec.lastPos : 0;
13309    }
13310  }, {
13311    key: "ensurePlayer",
13312    value: function ensurePlayer(mediaEl) {
13313      var _this6 = this;
13314
13315      if (!mediaEl) return null;
13316      if (this.playersByMediaEl.has(mediaEl)) return this.playersByMediaEl.get(mediaEl);
13317
13318      var jwid = this.getJwid(mediaEl);
13319      var mountEl = this.findMountEl(mediaEl);
13320      var id = mountEl && mountEl.id ? mountEl.id : "";
13321
13322      if (!jwid || !mountEl || !id || typeof jwplayer !== "function") {
13323        return null;
13324      }
13325
13326      log("setup player", { id: id, jwid: jwid });
13327
13328      var player = jwplayer(id).setup({
13329        playlist: "https://cdn.jwplayer.com/v2/media/" + jwid,
13330        width: "100%",
13331        height: "100%",
13332        autostart: false,
13333        mute: true,
13334        playsinline: true,
13335        controls: false,
13336        stretching: getJwStretching(),
13337        aspectratio: getJwAspectRatio(),
13338        displaytitle: false,
13339        displaydescription: false
13340      });
13341
13342      var rec = {
13343        id: id,
13344        jwid: jwid,
13345        player: player,
13346        ready: false,
13347        retryTimer: 0,
13348        playAttempts: 0,
13349        hasFirstFrame: false,
13350        soundOn: false,
13351        prewarming: false,
13352        prewarmRequested: false,
13353        lastPos: 0,
13354        resumeAt: 0,
13355        progressEl: mediaEl.closest(".flicks-card") ? mediaEl.closest(".flicks-card").querySelector(".js-flicks-progress") : null,
13356        progressBarEl: mediaEl.closest(".flicks-card") ? mediaEl.closest(".flicks-card").querySelector(".js-flicks-progress-bar") : null
13357      };
13358
13359      this.playersByMediaEl.set(mediaEl, rec);
13360      this.applySoundUiForMedia(mediaEl);
13361      this.setProgress(rec, 0);
13362      this.setProgressVisible(rec, false);
13363
13364      player.on("ready", function () {
13365        rec.ready = true;
13366        log("player ready", { id: id, jwid: jwid });
13367
13368        try {
13369          rec.player.setConfig({
13370            aspectratio: getJwAspectRatio(),
13371            stretching: getJwStretching()
13372          });
13373        } catch (e) {}
13374
13375        if (_this6.currentMediaEl === mediaEl) {
13376          _this6.playMedia(mediaEl, "ready");
13377        } else if (_this6.shouldPrewarm() && rec.prewarmRequested && !rec.hasFirstFrame) {
13378          _this6.prewarmMedia(mediaEl, "ready");
13379        }
13380      });
13381
13382      player.on("play", function () {
13383        _this6.hidePoster(mediaEl);
13384        _this6.applySoundToMedia(mediaEl);
13385        _this6.setProgressVisible(rec, true);
13386        log("player play", { id: id, jwid: jwid });
13387      });
13388
13389      player.on("pause", function () {
13390        if (rec.prewarming) {
13391          log("player prewarm pause", { id: id, jwid: jwid });
13392          return;
13393        }
13394
13395        if (_this6.currentMediaEl === mediaEl && !rec.hasFirstFrame && rec.playAttempts < 3) {
13396          if (rec.retryTimer) {
13397            clearTimeout(rec.retryTimer);
13398          }
13399
13400          rec.retryTimer = setTimeout(function () {
13401            rec.retryTimer = 0;
13402            if (_this6.currentMediaEl !== mediaEl) return;
13403
13404            log("retrying play after early pause", {
13405              id: id,
13406              jwid: jwid,
13407              attempt: rec.playAttempts + 1
13408            });
13409            _this6.playMedia(mediaEl, "pause-retry");
13410          }, 140);
13411        }
13412
13413        if (_this6.currentMediaEl !== mediaEl) {
13414          _this6.setProgressVisible(rec, false);
13415        }
13416
13417        log("player pause", { id: id, jwid: jwid });
13418      });
13419
13420      player.on("time", function (e) {
13421        var position = e && isFiniteNumber(e.position) ? e.position : 0;
13422        var duration = e && isFiniteNumber(e.duration) ? e.duration : 0;
13423
13424        rec.lastPos = position;
13425        _this6.setProgressVisible(rec, true);
13426        _this6.setProgress(rec, duration > 0 ? position / duration : 0);
13427      });
13428
13429      player.on("firstFrame", function () {
13430        rec.hasFirstFrame = true;
13431        rec.playAttempts = 0;
13432        if (rec.retryTimer) {
13433          clearTimeout(rec.retryTimer);
13434          rec.retryTimer = 0;
13435        }
13436
13437        _this6.hidePoster(mediaEl);
13438        if (rec.prewarming && _this6.currentMediaEl !== mediaEl) {
13439          rec.prewarming = false;
13440          rec.prewarmRequested = false;
13441          try {
13442            rec.player.pause(true);
13443          } catch (e) {}
13444          log("player prewarmed", { id: id, jwid: jwid });
13445        } else {
13446          _this6.applySoundToMedia(mediaEl);
13447        }
13448
13449        log("player firstFrame", { id: id, jwid: jwid });
13450      });
13451
13452      player.on("complete", function () {
13453        rec.playAttempts = 0;
13454        rec.lastPos = 0;
13455        rec.resumeAt = 0;
13456        if (rec.retryTimer) {
13457          clearTimeout(rec.retryTimer);
13458          rec.retryTimer = 0;
13459        }
13460
13461        var posterEl = mediaEl.querySelector(".js-flicks-media-poster");
13462        if (posterEl) {
13463          posterEl.classList.remove("is-hidden");
13464          log("poster shown");
13465        }
13466        _this6.setProgress(rec, 1);
13467        _this6.setProgressVisible(rec, false);
13468        log("player complete", { id: id, jwid: jwid });
13469      });
13470
13471      player.on("error", function (e) {
13472        log("player error", {
13473          id: id,
13474          jwid: jwid,
13475          message: e && e.message ? e.message : null,
13476          code: e && e.code ? e.code : null
13477        });
13478      });
13479
13480      return rec;
13481    }
13482  }, {
13483    key: "playMedia",
13484    value: function playMedia(mediaEl, reason) {
13485      var rec = this.ensurePlayer(mediaEl);
13486      if (!rec) return;
13487      if (!rec.ready) {
13488        log("play deferred until ready", { reason: reason, jwid: rec.jwid });
13489        return;
13490      }
13491
13492      rec.prewarming = false;
13493      rec.prewarmRequested = false;
13494      rec.playAttempts += 1;
13495
13496      try {
13497        rec.player.setMute(true);
13498      } catch (e) {}
13499
13500      var resumeAt = isFiniteNumber(rec.resumeAt) && rec.resumeAt > 0 ? rec.resumeAt : 0;
13501      if (resumeAt > 0.2) {
13502        try {
13503          rec.player.seek(resumeAt);
13504          rec.lastPos = resumeAt;
13505          log("seek before play", { reason: reason, jwid: rec.jwid, resumeAt: resumeAt });
13506        } catch (e) {}
13507      }
13508      rec.resumeAt = 0;
13509
13510      try {
13511        rec.player.play();
13512        log("play attempt", { reason: reason, jwid: rec.jwid });
13513      } catch (e) {
13514        log("play threw", {
13515          reason: reason,
13516          jwid: rec.jwid,
13517          message: e && e.message ? e.message : String(e)
13518        });
13519      }
13520    }
13521  }, {
13522    key: "prewarmMedia",
13523    value: function prewarmMedia(mediaEl, reason) {
13524      if (!this.shouldPrewarm()) return;
13525
13526      var rec = this.ensurePlayer(mediaEl);
13527      if (!rec) return;
13528      if (rec.hasFirstFrame || this.currentMediaEl === mediaEl) return;
13529
13530      rec.prewarmRequested = true;
13531
13532      if (!rec.ready) {
13533        log("prewarm deferred until ready", { reason: reason, jwid: rec.jwid });
13534        return;
13535      }
13536
13537      if (rec.prewarming) return;
13538
13539      rec.prewarming = true;
13540
13541      try {
13542        rec.player.setMute(true);
13543      } catch (e) {}
13544
13545      try {
13546        rec.player.play();
13547        log("prewarm attempt", { reason: reason, jwid: rec.jwid });
13548      } catch (e) {
13549        rec.prewarming = false;
13550        log("prewarm threw", {
13551          reason: reason,
13552          jwid: rec.jwid,
13553          message: e && e.message ? e.message : String(e)
13554        });
13555      }
13556    }
13557  }, {
13558    key: "prewarmNextSlide",
13559    value: function prewarmNextSlide(reason) {
13560      if (!this.shouldPrewarm()) return;
13561      if (!this.isViewportEligible) return;
13562      if (!this.swiper) return;
13563
13564      var activeIndex = Number(this.swiper.activeIndex) || 0;
13565      for (var index = activeIndex + 1; index < this.swiper.slides.length; index += 1) {
13566        var nextMediaEl = this.getMediaElForIndex(index);
13567        var nextJwid = this.getJwid(nextMediaEl);
13568
13569        if (!nextMediaEl || !nextJwid) continue;
13570
13571        this.prewarmMedia(nextMediaEl, reason);
13572        return;
13573      }
13574    }
13575  }, {
13576    key: "updatePlayback",
13577    value: function updatePlayback(reason) {
13578      var mediaEl = this.getActiveMediaEl();
13579      var jwid = this.getJwid(mediaEl);
13580      var previousMediaEl = this.currentMediaEl;
13581
13582      this.previousMediaEl = previousMediaEl;
13583      this.currentMediaEl = mediaEl;
13584
13585      if (previousMediaEl && previousMediaEl !== mediaEl) {
13586        this.pauseMedia(previousMediaEl, reason);
13587      }
13588
13589      if (!this.isViewportEligible) {
13590        if (mediaEl) {
13591          this.pauseMedia(mediaEl, reason + ":outOfViewport");
13592        }
13593        log("playback blocked by viewport", { reason: reason });
13594        return;
13595      }
13596
13597      if (!mediaEl) {
13598        log("no active media", { reason: reason });
13599        return;
13600      }
13601
13602      if (!jwid) {
13603        log("active slide has no jwid, skipping", { reason: reason });
13604        return;
13605      }
13606
13607      this.playMedia(mediaEl, reason);
13608      this.prewarmNextSlide(reason);
13609    }
13610  }, {
13611    key: "bindViewportObserver",
13612    value: function bindViewportObserver() {
13613      var _this7 = this;
13614
13615      if (this._viewportObserver || !this.root || typeof IntersectionObserver !== "function") {
13616        return;
13617      }
13618
13619      this._viewportObserver = new IntersectionObserver(function (entries) {
13620        var entry = entries && entries[0];
13621        if (!entry) return;
13622
13623        var isEligible = !!entry.isIntersecting && (entry.intersectionRatio || 0) >= 0.5;
13624
13625        if (_this7.isViewportEligible === isEligible) return;
13626
13627        _this7.isViewportEligible = isEligible;
13628
13629        if (!isEligible) {
13630          if (_this7.currentMediaEl) {
13631            _this7.pauseMedia(_this7.currentMediaEl, "viewportExit");
13632          }
13633          return;
13634        }
13635
13636        _this7.schedulePlaybackUpdate("viewportEnter");
13637      }, {
13638        threshold: [0, 0.5, 1]
13639      });
13640
13641      this._viewportObserver.observe(this.root);
13642    }
13643  }, {
13644    key: "schedulePlaybackUpdate",
13645    value: function schedulePlaybackUpdate(reason) {
13646      var _this8 = this;
13647
13648      this.pendingReason = reason;
13649
13650      if (this.pendingRaf) return;
13651
13652      this.pendingRaf = requestAnimationFrame(function () {
13653        _this8.pendingRaf = 0;
13654        _this8.updatePlayback(_this8.pendingReason);
13655      });
13656    }
13657  }, {
13658    key: "bindTrailerFullscreen",
13659    value: function bindTrailerFullscreen() {
13660      var _this9 = this;
13661
13662      this.root.addEventListener("click", function (e) {
13663        var btn = e.target.closest(".js--FlicksFullscreen");
13664        if (!btn) return;
13665
13666        e.preventDefault();
13667        e.stopPropagation();
13668
13669        var trailerUrl = btn.getAttribute("data-trailer-href");
13670        var jwid = btn.getAttribute("data-jwid");
13671        if (!trailerUrl || !jwid) return;
13672
13673        var mediaEl = _this9.findMediaElByJwid(jwid);
13674        if (!mediaEl) return;
13675
13676        var rec = _this9.ensurePlayer(mediaEl);
13677        var startAt = rec ? _this9.capturePosition(mediaEl) : 0;
13678
13679        _this9.modalResume.jwid = jwid;
13680        _this9.modalResume.startAt = startAt;
13681
13682        if (_this9.currentMediaEl) {
13683          _this9.pauseMedia(_this9.currentMediaEl, "openTrailer");
13684        }
13685
13686        window.dispatchEvent(new CustomEvent("comingsoon:openTrailer", {
13687          detail: {
13688            trailerUrl: trailerUrl,
13689            startAt: startAt,
13690            fromId: jwid
13691          }
13692        }));
13693      });
13694
13695      window.addEventListener("comingsoon:closeTrailer", function (e) {
13696        if (!_this9.modalResume.jwid) return;
13697
13698        var jwid = _this9.modalResume.jwid;
13699        var endAt = e && e.detail && typeof e.detail.endAt === "number" ? e.detail.endAt : _this9.modalResume.startAt;
13700
13701        var mediaEl = _this9.findMediaElByJwid(jwid);
13702        if (!mediaEl) {
13703          _this9.modalResume.jwid = null;
13704          _this9.modalResume.startAt = 0;
13705          return;
13706        }
13707
13708        var rec = _this9.ensurePlayer(mediaEl);
13709        if (rec && isFiniteNumber(endAt) && endAt >= 0) {
13710          rec.lastPos = endAt;
13711          rec.resumeAt = endAt;
13712        }
13713
13714        var slideIndex = _this9.getSlideIndexForMedia(mediaEl);
13715        if (_this9.swiper && Number.isFinite(slideIndex) && _this9.swiper.activeIndex !== slideIndex) {
13716          _this9.swiper.slideTo(slideIndex);
13717        } else {
13718          _this9.currentMediaEl = mediaEl;
13719          _this9.schedulePlaybackUpdate("closeTrailer");
13720        }
13721
13722        _this9.modalResume.jwid = null;
13723        _this9.modalResume.startAt = 0;
13724      });
13725    }
13726  }, {
13727    key: "init",
13728    value: function init() {
13729      var _this10 = this;
13730
13731      if (!this.root || !this.swiperEl) return;
13732
13733      this.root.classList.add("is-loading");
13734      this.bindAudioToggle();
13735      this.bindTrailerFullscreen();
13736      this.bindResizeAspectRatio();
13737      this.bindViewportObserver();
13738      this.waitForPosterImages();
13739
13740      this.swiper = new _swiperBundle2.default(this.swiperEl, {
13741        slidesPerView: 1.02,
13742        spaceBetween: 12,
13743        speed: 320,
13744        watchOverflow: true,
13745        allowTouchMove: true,
13746        threshold: 8,
13747        mousewheel: {
13748          enabled: false,
13749          forceToAxis: true,
13750          sensitivity: 0.42,
13751          thresholdDelta: 14,
13752          thresholdTime: 420,
13753          releaseOnEdges: false
13754        },
13755        navigation: this.prevBtn && this.nextBtn ? {
13756          prevEl: this.prevBtn,
13757          nextEl: this.nextBtn
13758        } : undefined,
13759        breakpoints: {
13760          768: {
13761            slidesPerView: "auto",
13762            spaceBetween: 12,
13763            allowTouchMove: false
13764          },
13765          1024: {
13766            slidesPerView: "auto",
13767            spaceBetween: 16,
13768            allowTouchMove: false
13769          }
13770        },
13771        on: {
13772          init: function init() {
13773            _this10.setActiveSlide("init");
13774            _this10.schedulePlaybackUpdate("init");
13775          },
13776          slideChangeTransitionEnd: function slideChangeTransitionEnd() {
13777            _this10.setActiveSlide("transitionEnd");
13778            _this10.schedulePlaybackUpdate("transitionEnd");
13779          }
13780        }
13781      });
13782
13783      this.syncDesktopMousewheel();
13784      this.setActiveSlide("post-init");
13785      this.schedulePlaybackUpdate("post-init");
13786    }
13787  }]);
13788
13789  return FlicksNowPlayingMobileSlider;
13790}();
13791
13792document.querySelectorAll(".js-flicks-now-playing-mobile-slider").forEach(function (root) {
13793  var inst = new FlicksNowPlayingMobileSlider(root);
13794  inst.init();
13795});
13796
13797},{"../../../../../node_modules/swiper/swiper-bundle.js":194}],103:[function(require,module,exports){
13798"use strict";
13799
13800var appConfig = typeof window !== "undefined" && window.__APP_CONFIG || {};
13801var MAPTILER_API_KEY = appConfig.maptilerApiKey || appConfig.mapTilerApiKey || "AbmHYXKfqz8hmNs1h31h";
13802var MAPTILER_SDK_URL = "https://esm.sh/@maptiler/[email protected]?bundle";
13803var MAPTILER_SDK_CSS_URL = "https://cdn.jsdelivr.net/npm/@maptiler/[email protected]/dist/maptiler-sdk.css";
13804var MAPTILER_STYLE_FALLBACK = "https://api.maptiler.com/maps/streets-v2/style.json";
13805var MAPTILER_STYLE = appConfig.maptilerStyle || appConfig.mapTilerStyle || MAPTILER_STYLE_FALLBACK;
13806
13807var REGION_MIN_AUTO_FIT_ZOOM = 9;
13808var GPS_MIN_AUTO_FIT_ZOOM = 11;
13809var CLUSTER_MAX_ZOOM = 13;
13810var CLUSTER_RADIUS = 28;
13811var CLUSTER_CLICK_TARGET_ZOOM = 15;
13812var CLUSTER_CLICK_ANIMATION_DURATION = 900;
13813
13814var map = null;
13815var currentSignature = "";
13816var syncFrame = null;
13817var mapExpanded = false;
13818var canAutoExpandMap = false;
13819var activePanelCinemaId = "";
13820var mapLoaded = false;
13821var activePointsById = {};
13822var suppressNextMapClick = false;
13823var maptilerSdk = null;
13824var maptilerSdkPromise = null;
13825
13826var SOURCE_ID = "homepage-cinemas-source";
13827var CLUSTERS_LAYER_ID = "homepage-cinemas-clusters";
13828var CLUSTER_COUNT_LAYER_ID = "homepage-cinemas-cluster-count";
13829var UNCLUSTERED_LAYER_ID = "homepage-cinemas-unclustered";
13830var domMarkersById = new Map();
13831
13832function ensureMapTilerStylesheet() {
13833  var existingLink = document.querySelector('link[data-maptiler-sdk-css="1"]');
13834  if (existingLink) return;
13835
13836  var link = document.createElement("link");
13837  link.rel = "stylesheet";
13838  link.href = MAPTILER_SDK_CSS_URL;
13839  link.dataset.maptilerSdkCss = "1";
13840  document.head.appendChild(link);
13841}
13842
13843function loadMapTilerSdk() {
13844  if (maptilerSdk) return Promise.resolve(maptilerSdk);
13845  if (maptilerSdkPromise) return maptilerSdkPromise;
13846
13847  ensureMapTilerStylesheet();
13848
13849  maptilerSdkPromise = new Function("specifier", "return import(specifier);")(MAPTILER_SDK_URL).then(function (sdk) {
13850    maptilerSdk = sdk;
13851
13852    if (MAPTILER_API_KEY && maptilerSdk.config) {
13853      maptilerSdk.config.apiKey = MAPTILER_API_KEY;
13854    }
13855
13856    return maptilerSdk;
13857  }).catch(function (error) {
13858    maptilerSdkPromise = null;
13859    throw error;
13860  });
13861
13862  return maptilerSdkPromise;
13863}
13864
13865function getHomepageSortMeta(entry) {
13866  var title = (entry.getAttribute("data-homepage-title") || "").trim().toLowerCase();
13867  var distance = Number(entry.getAttribute("data-homepage-distance"));
13868  var button = entry.querySelector(".js-add-cinema-to-fav");
13869  var isFav = !!(button && (button.classList.contains("is-fav") || button.getAttribute("data-on") === "1"));
13870
13871  return {
13872    title: title,
13873    distance: distance,
13874    hasDistance: Number.isFinite(distance),
13875    isFav: isFav
13876  };
13877}
13878
13879function sortHomepageCinemaEntries(container) {
13880  var list = container.querySelector(".all-cinemas-list");
13881  if (!list) return;
13882
13883  var sortMode = list.getAttribute("data-homepage-sort-mode") || "distance";
13884  var visibleCount = Number(list.getAttribute("data-visible-count")) || 6;
13885  var entries = Array.from(list.querySelectorAll(".more-cinemas__single-entry"));
13886
13887  if (!entries.length) return;
13888
13889  entries.sort(function (a, b) {
13890    var metaA = getHomepageSortMeta(a);
13891    var metaB = getHomepageSortMeta(b);
13892
13893    if (metaA.isFav !== metaB.isFav) {
13894      return metaA.isFav ? -1 : 1;
13895    }
13896
13897    if (sortMode === "region") {
13898      return metaA.title.localeCompare(metaB.title);
13899    }
13900
13901    if (metaA.hasDistance && metaB.hasDistance && metaA.distance !== metaB.distance) {
13902      return metaA.distance - metaB.distance;
13903    }
13904
13905    if (metaA.hasDistance !== metaB.hasDistance) {
13906      return metaA.hasDistance ? -1 : 1;
13907    }
13908
13909    return metaA.title.localeCompare(metaB.title);
13910  });
13911
13912  entries.forEach(function (entry, index) {
13913    if (list.children[index] !== entry) {
13914      list.appendChild(entry);
13915    }
13916
13917    var isHidden = index >= visibleCount;
13918    var shouldBeAriaHidden = isHidden ? "true" : "false";
13919
13920    if (entry.classList.contains("is-homepage-hidden") !== isHidden) {
13921      entry.classList.toggle("is-homepage-hidden", isHidden);
13922    }
13923
13924    if (entry.getAttribute("aria-hidden") !== shouldBeAriaHidden) {
13925      entry.setAttribute("aria-hidden", shouldBeAriaHidden);
13926    }
13927  });
13928}
13929
13930function getHomepageMinAutoFitZoom(container) {
13931  var list = container.querySelector(".all-cinemas-list");
13932  var sortMode = list ? list.getAttribute("data-homepage-sort-mode") || "distance" : "distance";
13933  return sortMode === "region" ? REGION_MIN_AUTO_FIT_ZOOM : GPS_MIN_AUTO_FIT_ZOOM;
13934}
13935
13936function getEntriesWithCoords(container) {
13937  var entries = container.querySelectorAll(".more-cinemas__single-entry");
13938  var points = [];
13939
13940  entries.forEach(function (el, index) {
13941    var lat = parseFloat(el.getAttribute("data-lat"));
13942    var lng = parseFloat(el.getAttribute("data-lon"));
13943
13944    if (!Number.isFinite(lat) || !Number.isFinite(lng)) return;
13945
13946    var titleEl = el.querySelector(".more-cinemas__title");
13947    var title = (titleEl && titleEl.textContent ? titleEl.textContent.trim() : "") || "Cinema";
13948    var imageEl = el.querySelector(".more-cinemas__media img");
13949    var imageSrc = imageEl ? imageEl.currentSrc || imageEl.src || "" : "";
13950    var linkEl = el.querySelector(".more-cinemas__link");
13951    var detailsEl = el.querySelector(".more-cinemas__details");
13952    var favButton = el.querySelector(".js-add-cinema-to-fav");
13953    var stableId = favButton && favButton.getAttribute("data-slug") || el.getAttribute("data-slug") || title || String(index);
13954
13955    points.push({
13956      id: stableId,
13957      lat: lat,
13958      lng: lng,
13959      title: title,
13960      imageSrc: imageSrc,
13961      href: linkEl ? linkEl.getAttribute("href") || "" : "",
13962      detailsHTML: detailsEl ? detailsEl.innerHTML : "",
13963      favButtonHTML: favButton ? favButton.outerHTML : "",
13964      sourceEntry: el
13965    });
13966  });
13967
13968  return points;
13969}
13970
13971function pointsSignature(points) {
13972  return points.map(function (point) {
13973    return point.id + ":" + point.lat + ":" + point.lng + ":" + point.imageSrc;
13974  }).join("|");
13975}
13976
13977function ensureCinemaPanel(mapEl) {
13978  var panel = mapEl.querySelector(".js-homepage-cinema-panel");
13979  if (panel) return panel;
13980
13981  panel = document.createElement("div");
13982  panel.className = "cinema-panel js-homepage-cinema-panel";
13983  mapEl.appendChild(panel);
13984  return panel;
13985}
13986
13987function hideCinemaPanel(mapEl) {
13988  var panel = ensureCinemaPanel(mapEl);
13989  panel.innerHTML = "";
13990  panel.classList.remove("is-visible");
13991  activePanelCinemaId = "";
13992}
13993
13994function cinemaPanelHTML(cinema) {
13995  var detailsHTML = cinema.detailsHTML ? "<div class=\"cinema-panel__meta\">" + cinema.detailsHTML + "</div>" : "";
13996  var actionsHTML = cinema.favButtonHTML ? "<div class=\"cinema-panel__actions\">" + cinema.favButtonHTML + "</div>" : "";
13997
13998  return "\n    <div class=\"cinema-panel__inner\">\n      <a href=\"" + (cinema.href || "#") + "\" class=\"cinema-panel__media\">\n        <img src=\"" + cinema.imageSrc + "\" alt=\"" + cinema.title + "\">\n      </a>\n      <div class=\"cinema-panel__content\">\n        <a href=\"" + (cinema.href || "#") + "\" class=\"cinema-panel__title\">" + cinema.title + "</a>\n        " + detailsHTML + "\n      </div>\n      " + actionsHTML + "\n    </div>\n  ";
13999}
14000
14001function showCinemaPanel(cinema, mapEl) {
14002  var panel = ensureCinemaPanel(mapEl);
14003  panel.innerHTML = cinemaPanelHTML(cinema);
14004  panel.classList.add("is-visible");
14005  activePanelCinemaId = cinema.id;
14006}
14007
14008function syncPanelFavouriteButton(mapEl, cinema) {
14009  var panel = mapEl.querySelector(".js-homepage-cinema-panel");
14010  var sourceButton = cinema && cinema.sourceEntry ? cinema.sourceEntry.querySelector(".js-add-cinema-to-fav") : null;
14011  var panelButton = panel ? panel.querySelector(".js-add-cinema-to-fav") : null;
14012
14013  if (!sourceButton || !panelButton) return;
14014
14015  panelButton.className = sourceButton.className;
14016  panelButton.dataset.on = sourceButton.dataset.on;
14017  panelButton.dataset.event = sourceButton.dataset.event;
14018}
14019
14020function fitMapToPoints(activeMap, points, minAutoFitZoom) {
14021  var bounds = new maptilerSdk.LngLatBounds();
14022  var count = 0;
14023
14024  points.forEach(function (point) {
14025    if (!Number.isFinite(point.lat) || !Number.isFinite(point.lng)) return;
14026    bounds.extend([point.lng, point.lat]);
14027    count += 1;
14028  });
14029
14030  if (!count) return Promise.resolve();
14031
14032  var boundsCenter = bounds.getCenter();
14033
14034  if (count === 1) {
14035    activeMap.setCenter([points[0].lng, points[0].lat]);
14036    activeMap.setZoom(13);
14037    return Promise.resolve();
14038  }
14039
14040  return new Promise(function (resolve) {
14041    activeMap.fitBounds(bounds, { padding: 60, duration: 0 });
14042    activeMap.once("idle", function () {
14043      var zoom = Number(activeMap.getZoom());
14044      if (Number.isFinite(zoom) && zoom < minAutoFitZoom) {
14045        activeMap.once("idle", resolve);
14046        if (boundsCenter) {
14047          activeMap.setCenter(boundsCenter);
14048        }
14049        activeMap.setZoom(minAutoFitZoom);
14050        return;
14051      }
14052
14053      if (boundsCenter) {
14054        activeMap.setCenter(boundsCenter);
14055      }
14056      resolve();
14057    });
14058  });
14059}
14060
14061function getUnclusteredCircleRadiusExpression() {
14062  return ["interpolate", ["linear"], ["zoom"], 3, 8, 8, 10, 13, 16, 16, 20];
14063}
14064
14065function syncMapAfterSizeTransition(activeMap, mapEl, afterSync) {
14066  var handleTransitionEnd = function handleTransitionEnd(event) {
14067    if (event.target !== mapEl || event.propertyName !== "height") return;
14068    mapEl.removeEventListener("transitionend", handleTransitionEnd);
14069
14070    requestAnimationFrame(function () {
14071      activeMap.resize();
14072      if (afterSync) afterSync();
14073    });
14074  };
14075
14076  mapEl.addEventListener("transitionend", handleTransitionEnd);
14077}
14078
14079function makeExpandMapHandler(activeMap, mapEl, button) {
14080  return function expandMap() {
14081    if (window.innerWidth > 768) return;
14082    if (!canAutoExpandMap || mapExpanded) return;
14083
14084    mapExpanded = true;
14085    mapEl.classList.add("is-expanded");
14086
14087    syncMapAfterSizeTransition(activeMap, mapEl);
14088  };
14089}
14090
14091function makeShrinkMapHandler(activeMap, mapEl, button) {
14092  return function shrinkMap(event) {
14093    event.preventDefault();
14094    if (window.innerWidth > 768) return;
14095    if (!mapExpanded) return;
14096
14097    mapExpanded = false;
14098    mapEl.classList.remove("is-expanded");
14099
14100    syncMapAfterSizeTransition(activeMap, mapEl);
14101  };
14102}
14103
14104function mapPointsToGeoJSON(points) {
14105  var features = points.map(function (point) {
14106    return {
14107      type: "Feature",
14108      geometry: {
14109        type: "Point",
14110        coordinates: [point.lng, point.lat]
14111      },
14112      properties: {
14113        id: point.id,
14114        title: point.title
14115      }
14116    };
14117  });
14118
14119  return {
14120    type: "FeatureCollection",
14121    features: features
14122  };
14123}
14124
14125function clearDomMarkers() {
14126  domMarkersById.forEach(function (entry) {
14127    if (entry && entry.marker) entry.marker.remove();
14128  });
14129  domMarkersById.clear();
14130}
14131
14132function createDomMarkerElement(cinema, mapEl) {
14133  var button = document.createElement("button");
14134  button.type = "button";
14135  button.className = "js-homepage-cinema-map-marker homepage-cinema-map-marker";
14136  button.setAttribute("aria-label", cinema.title || "Cinema");
14137
14138  var image = document.createElement("img");
14139  image.className = "homepage-cinema-map-marker__image";
14140  image.src = cinema.imageSrc || "";
14141  image.alt = cinema.title || "Cinema";
14142
14143  button.appendChild(image);
14144
14145  button.addEventListener("click", function (event) {
14146    event.preventDefault();
14147    event.stopPropagation();
14148    suppressNextMapClick = true;
14149    showCinemaPanel(cinema, mapEl);
14150  });
14151
14152  return button;
14153}
14154
14155function syncDomMarkersWithClusters(activeMap, mapEl) {
14156  if (!mapLoaded || !activeMap || !activeMap.getSource(SOURCE_ID)) return;
14157  if (!activeMap.getLayer(UNCLUSTERED_LAYER_ID)) return;
14158
14159  var features = activeMap.queryRenderedFeatures(undefined, {
14160    layers: [UNCLUSTERED_LAYER_ID]
14161  });
14162
14163  var visibleIds = new Set();
14164
14165  features.forEach(function (feature) {
14166    var id = String(feature && feature.properties && feature.properties.id || "");
14167    if (!id || visibleIds.has(id)) return;
14168
14169    var geometry = feature.geometry;
14170    var coordinates = geometry && geometry.type === "Point" ? geometry.coordinates : null;
14171    if (!Array.isArray(coordinates) || coordinates.length < 2) return;
14172
14173    var cinema = activePointsById[id];
14174    if (!cinema) return;
14175
14176    visibleIds.add(id);
14177
14178    if (!domMarkersById.has(id)) {
14179      var marker = new maptilerSdk.Marker({
14180        element: createDomMarkerElement(cinema, mapEl),
14181        anchor: "center"
14182      }).setLngLat(coordinates).addTo(activeMap);
14183
14184      domMarkersById.set(id, { marker: marker });
14185      return;
14186    }
14187
14188    var existing = domMarkersById.get(id);
14189    existing.marker.setLngLat(coordinates);
14190  });
14191
14192  domMarkersById.forEach(function (entry, id) {
14193    if (visibleIds.has(id)) return;
14194    entry.marker.remove();
14195    domMarkersById.delete(id);
14196  });
14197}
14198
14199function ensureMapLayers(activeMap, points) {
14200  var data = mapPointsToGeoJSON(points);
14201
14202  if (activeMap.getSource(SOURCE_ID)) {
14203    activeMap.getSource(SOURCE_ID).setData(data);
14204    return;
14205  }
14206
14207  activeMap.addSource(SOURCE_ID, {
14208    type: "geojson",
14209    data: data,
14210    cluster: true,
14211    clusterMaxZoom: CLUSTER_MAX_ZOOM,
14212    clusterRadius: CLUSTER_RADIUS
14213  });
14214
14215  activeMap.addLayer({
14216    id: UNCLUSTERED_LAYER_ID,
14217    type: "circle",
14218    source: SOURCE_ID,
14219    filter: ["!", ["has", "point_count"]],
14220    paint: {
14221      "circle-radius": getUnclusteredCircleRadiusExpression(),
14222      "circle-color": "rgba(0, 0, 0, 0)",
14223      "circle-stroke-width": 0
14224    }
14225  });
14226
14227  activeMap.addLayer({
14228    id: CLUSTERS_LAYER_ID,
14229    type: "circle",
14230    source: SOURCE_ID,
14231    filter: ["has", "point_count"],
14232    paint: {
14233      "circle-color": "#D95959",
14234      "circle-opacity": 0.92,
14235      "circle-stroke-color": "#EAEBEA",
14236      "circle-stroke-width": 2,
14237      "circle-radius": ["step", ["get", "point_count"], 20, 10, 24, 25, 28, 50, 32]
14238    }
14239  });
14240
14241  activeMap.addLayer({
14242    id: CLUSTER_COUNT_LAYER_ID,
14243    type: "symbol",
14244    source: SOURCE_ID,
14245    filter: ["has", "point_count"],
14246    layout: {
14247      "text-field": ["get", "point_count_abbreviated"],
14248      "text-size": 14,
14249      "text-font": ["Open Sans Bold", "Arial Unicode MS Bold"]
14250    },
14251    paint: {
14252      "text-color": "#EAEBEA"
14253    }
14254  });
14255}
14256
14257function followUpClusterZoom(activeMap, mapEl) {
14258  activeMap.once("idle", function () {
14259    syncDomMarkersWithClusters(activeMap, mapEl);
14260  });
14261}
14262
14263function getClusterLeaves(source, clusterId) {
14264  var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
14265
14266  if (!source || typeof source.getClusterLeaves !== "function") {
14267    return Promise.resolve([]);
14268  }
14269
14270  var maybePromise = source.getClusterLeaves(clusterId, limit, 0);
14271
14272  if (maybePromise && typeof maybePromise.then === "function") {
14273    return maybePromise.then(function (leaves) {
14274      return Array.isArray(leaves) ? leaves : [];
14275    });
14276  }
14277
14278  return new Promise(function (resolve, reject) {
14279    source.getClusterLeaves(clusterId, limit, 0, function (error, leaves) {
14280      if (error) {
14281        reject(error);
14282        return;
14283      }
14284
14285      resolve(Array.isArray(leaves) ? leaves : []);
14286    });
14287  });
14288}
14289
14290async function zoomToCluster(event, activeMap, mapEl) {
14291  var feature = event.features && event.features[0];
14292  if (!feature || !feature.properties) return;
14293
14294  if (event.originalEvent) {
14295    if (typeof event.originalEvent.preventDefault === "function") {
14296      event.originalEvent.preventDefault();
14297    }
14298    if (typeof event.originalEvent.stopPropagation === "function") {
14299      event.originalEvent.stopPropagation();
14300    }
14301  }
14302
14303  suppressNextMapClick = true;
14304
14305  var clusterId = feature.properties.cluster_id;
14306  var source = activeMap.getSource(SOURCE_ID);
14307  var targetCoordinates = Array.isArray(feature.geometry && feature.geometry.coordinates) ? feature.geometry.coordinates.slice() : null;
14308
14309  if (!source || !targetCoordinates) return;
14310
14311  try {
14312    var leaves = await getClusterLeaves(source, clusterId);
14313    var bounds = new maptilerSdk.LngLatBounds();
14314    var pointsCount = 0;
14315
14316    leaves.forEach(function (leaf) {
14317      var coordinates = leaf && leaf.geometry && leaf.geometry.type === "Point" ? leaf.geometry.coordinates : null;
14318
14319      if (!Array.isArray(coordinates) || coordinates.length < 2) return;
14320
14321      bounds.extend(coordinates);
14322      pointsCount += 1;
14323    });
14324
14325    followUpClusterZoom(activeMap, mapEl);
14326
14327    if (pointsCount > 1) {
14328      activeMap.fitBounds(bounds, {
14329        padding: 60,
14330        maxZoom: CLUSTER_CLICK_TARGET_ZOOM,
14331        duration: CLUSTER_CLICK_ANIMATION_DURATION
14332      });
14333      return;
14334    }
14335
14336    activeMap.easeTo({
14337      center: targetCoordinates,
14338      zoom: CLUSTER_CLICK_TARGET_ZOOM,
14339      duration: CLUSTER_CLICK_ANIMATION_DURATION
14340    });
14341  } catch (error) {
14342    activeMap.easeTo({
14343      center: targetCoordinates,
14344      zoom: CLUSTER_CLICK_TARGET_ZOOM,
14345      duration: CLUSTER_CLICK_ANIMATION_DURATION
14346    });
14347  }
14348}
14349
14350function attachLayerInteractions(activeMap, mapEl) {
14351  activeMap.on("click", CLUSTERS_LAYER_ID, function (event) {
14352    zoomToCluster(event, activeMap, mapEl);
14353  });
14354
14355  activeMap.on("click", CLUSTER_COUNT_LAYER_ID, function (event) {
14356    zoomToCluster(event, activeMap, mapEl);
14357  });
14358
14359  activeMap.on("mouseenter", CLUSTERS_LAYER_ID, function () {
14360    activeMap.getCanvas().style.cursor = "pointer";
14361  });
14362
14363  activeMap.on("mouseleave", CLUSTERS_LAYER_ID, function () {
14364    activeMap.getCanvas().style.cursor = "";
14365  });
14366
14367  activeMap.on("mouseenter", CLUSTER_COUNT_LAYER_ID, function () {
14368    activeMap.getCanvas().style.cursor = "pointer";
14369  });
14370
14371  activeMap.on("mouseleave", CLUSTER_COUNT_LAYER_ID, function () {
14372    activeMap.getCanvas().style.cursor = "";
14373  });
14374}
14375
14376function attachMapMarkerSyncListeners(activeMap, mapEl) {
14377  activeMap.on("moveend", function () {
14378    syncDomMarkersWithClusters(activeMap, mapEl);
14379  });
14380
14381  activeMap.on("zoomend", function () {
14382    syncDomMarkersWithClusters(activeMap, mapEl);
14383  });
14384
14385  activeMap.on("sourcedata", function (event) {
14386    if (!event || event.sourceId !== SOURCE_ID) return;
14387    syncDomMarkersWithClusters(activeMap, mapEl);
14388  });
14389}
14390
14391function ensureSourceData(points, mapEl) {
14392  if (!mapLoaded || !map) return;
14393  ensureMapLayers(map, points);
14394  syncDomMarkersWithClusters(map, mapEl);
14395}
14396
14397function ensureMap(mapEl, points) {
14398  if (map) return Promise.resolve(map);
14399
14400  return loadMapTilerSdk().then(function () {
14401    var fallbackCenter = points.length ? [points[0].lng, points[0].lat] : [174.76, -36.85];
14402
14403    map = new maptilerSdk.Map({
14404      container: mapEl,
14405      style: MAPTILER_STYLE,
14406      center: fallbackCenter,
14407      zoom: 3,
14408      attributionControl: false,
14409      dragRotate: false,
14410      touchPitch: false
14411    });
14412
14413    var preventMapPageOverscroll = function preventMapPageOverscroll(event) {
14414      if (window.innerWidth > 768) return;
14415      if (event.touches && event.touches.length > 1) {
14416        event.preventDefault();
14417      }
14418    };
14419
14420    mapEl.addEventListener("touchmove", preventMapPageOverscroll, { passive: false });
14421
14422    var shrinkBtn = document.createElement("button");
14423    shrinkBtn.type = "button";
14424    shrinkBtn.className = "cinemas-map__shrink";
14425    shrinkBtn.setAttribute("aria-label", "Shrink map");
14426    shrinkBtn.innerHTML = "\n      <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" fill=\"none\">\n        <rect width=\"30\" height=\"30\" rx=\"15\" fill=\"#26272C\" fill-opacity=\"0.6\"/>\n        <path d=\"M22.5 16.2207H20V10.5957H14.375V8.0957H22.5V16.2207ZM7.5 23.0957H15.625V20.5957H10V14.9707H7.5V23.0957Z\" fill=\"white\"/>\n      </svg>\n    ";
14427    shrinkBtn.addEventListener("click", makeShrinkMapHandler(map, mapEl, shrinkBtn));
14428    mapEl.appendChild(shrinkBtn);
14429
14430    var expandMap = makeExpandMapHandler(map, mapEl, shrinkBtn);
14431
14432    map.on("click", function () {
14433      if (suppressNextMapClick) {
14434        suppressNextMapClick = false;
14435        return;
14436      }
14437
14438      expandMap();
14439      hideCinemaPanel(mapEl);
14440    });
14441
14442    map.on("dragstart", expandMap);
14443
14444    return new Promise(function (resolve) {
14445      map.on("load", function () {
14446        mapLoaded = true;
14447        attachMapMarkerSyncListeners(map, mapEl);
14448        ensureMapLayers(map, points);
14449        attachLayerInteractions(map, mapEl);
14450
14451        syncDomMarkersWithClusters(map, mapEl);
14452        resolve(map);
14453      });
14454    });
14455  });
14456}
14457
14458async function renderPoints(mapEl, points) {
14459  var activeMap = await ensureMap(mapEl, points);
14460
14461  hideCinemaPanel(mapEl);
14462
14463  activePointsById = points.reduce(function (acc, point) {
14464    acc[point.id] = point;
14465    return acc;
14466  }, {});
14467
14468  ensureSourceData(points, mapEl);
14469
14470  var container = mapEl.closest(".cinemas-near-you");
14471  var minAutoFitZoom = container ? getHomepageMinAutoFitZoom(container) : REGION_MIN_AUTO_FIT_ZOOM;
14472
14473  await fitMapToPoints(activeMap, points, minAutoFitZoom);
14474  syncDomMarkersWithClusters(activeMap, mapEl);
14475  activeMap.once("idle", function () {
14476    syncDomMarkersWithClusters(activeMap, mapEl);
14477  });
14478
14479  mapEl.classList.add("is-ready");
14480  mapEl.classList.remove("is-loading");
14481  canAutoExpandMap = true;
14482  document.dispatchEvent(new CustomEvent("homepage-cinemas:map-synced"));
14483}
14484
14485async function syncMap(container, mapEl) {
14486  sortHomepageCinemaEntries(container);
14487
14488  var points = getEntriesWithCoords(container);
14489  if (!points.length) return;
14490
14491  var nextSignature = pointsSignature(points);
14492  if (nextSignature === currentSignature) return;
14493
14494  currentSignature = nextSignature;
14495  await renderPoints(mapEl, points);
14496}
14497
14498async function forceSyncMap() {
14499  var container = document.querySelector(".cinemas-near-you");
14500  var mapEl = document.getElementById("cinemas-map-placeholder");
14501  if (!container || !mapEl) return;
14502
14503  currentSignature = "";
14504  await syncMap(container, mapEl);
14505}
14506
14507function scheduleSync(container, mapEl) {
14508  if (syncFrame) cancelAnimationFrame(syncFrame);
14509
14510  syncFrame = requestAnimationFrame(function () {
14511    syncFrame = null;
14512    syncMap(container, mapEl);
14513  });
14514}
14515
14516function run() {
14517  var container = document.querySelector(".cinemas-near-you");
14518  var mapEl = document.getElementById("cinemas-map-placeholder");
14519  if (!container || !mapEl) return;
14520
14521  mapEl.addEventListener("click", function (event) {
14522    var button = event.target.closest(".js-homepage-cinema-panel .js-add-cinema-to-fav");
14523    if (!button) return;
14524
14525    var panel = event.currentTarget.querySelector(".js-homepage-cinema-panel");
14526    var cinemaId = panel && activePanelCinemaId ? activePanelCinemaId : "";
14527    if (!cinemaId) return;
14528
14529    var selector = ".more-cinemas__single-entry .js-add-cinema-to-fav[data-slug=\"" + CSS.escape(cinemaId) + "\"]";
14530    var sourceButton = container.querySelector(selector);
14531    if (!sourceButton) return;
14532
14533    event.preventDefault();
14534    sourceButton.click();
14535
14536    requestAnimationFrame(function () {
14537      var sourcePoint = getEntriesWithCoords(container).find(function (point) {
14538        return point.id === cinemaId;
14539      });
14540      if (sourcePoint) syncPanelFavouriteButton(mapEl, sourcePoint);
14541    });
14542  });
14543
14544  scheduleSync(container, mapEl);
14545
14546  var observer = new MutationObserver(function () {
14547    scheduleSync(container, mapEl);
14548  });
14549
14550  observer.observe(container, { childList: true, subtree: true, attributes: true });
14551
14552  document.addEventListener("homepage-cinemas:updated", function () {
14553    requestAnimationFrame(function () {
14554      forceSyncMap();
14555    });
14556  });
14557
14558  window.addEventListener("fav-cinema-changed", function () {
14559    requestAnimationFrame(function () {
14560      sortHomepageCinemaEntries(container);
14561      scheduleSync(container, mapEl);
14562    });
14563  });
14564
14565  document.addEventListener("homepage-cinemas:reset-map-size", function () {
14566    mapExpanded = false;
14567    canAutoExpandMap = false;
14568    mapEl.classList.remove("is-expanded");
14569
14570    hideCinemaPanel(mapEl);
14571    clearDomMarkers();
14572    activePointsById = {};
14573
14574    if (map) {
14575      requestAnimationFrame(function () {
14576        map.resize();
14577      });
14578    }
14579  });
14580}
14581
14582run();
14583
14584},{}],104:[function(require,module,exports){
14585"use strict";
14586
14587var _swiperBundle = require("../../../../../node_modules/swiper/swiper-bundle.js");
14588
14589var _swiperBundle2 = _interopRequireDefault(_swiperBundle);
14590
14591function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14592
14593function initSwiperCarousels(_ref) {
14594  var rootSelector = _ref.rootSelector,
14595      swiperSelector = _ref.swiperSelector,
14596      prevSelector = _ref.prevSelector,
14597      nextSelector = _ref.nextSelector,
14598      disabledClass = _ref.disabledClass,
14599      options = _ref.options;
14600
14601  var roots = document.querySelectorAll(rootSelector);
14602
14603  roots.forEach(function (root) {
14604    var swiperEl = root.querySelector(swiperSelector);
14605    if (!swiperEl) return;
14606
14607    var prevBtn = root.querySelector(prevSelector);
14608    var nextBtn = root.querySelector(nextSelector);
14609    var slidesCount = swiperEl.querySelectorAll(".swiper-slide").length;
14610
14611    if (!slidesCount) {
14612      root.style.display = "none";
14613      return;
14614    }
14615
14616    var hasNavigation = prevBtn && nextBtn;
14617    var mobileBreakpointQuery = window.matchMedia("(max-width: 767px)");
14618    var swiper = null;
14619    var isMobileLayout = mobileBreakpointQuery.matches;
14620
14621    var buildSwiper = function buildSwiper() {
14622      var instance = new _swiperBundle2.default(swiperEl, Object.assign({
14623        init: false,
14624        loop: false,
14625        simulateTouch: false,
14626        mousewheel: {
14627          forceToAxis: true,
14628          sensitivity: 1,
14629          releaseOnEdges: true
14630        }
14631      }, options, hasNavigation ? {
14632        navigation: {
14633          prevEl: prevBtn,
14634          nextEl: nextBtn
14635        }
14636      } : {}));
14637
14638      if (hasNavigation && disabledClass) {
14639        var updateNavState = function updateNavState() {
14640          var isBeginning = instance.isBeginning;
14641          var isEnd = instance.isEnd;
14642
14643          prevBtn.disabled = isBeginning;
14644          nextBtn.disabled = isEnd;
14645
14646          prevBtn.classList.toggle(disabledClass, isBeginning);
14647          nextBtn.classList.toggle(disabledClass, isEnd);
14648        };
14649
14650        instance.on("init", updateNavState);
14651        instance.on("slideChange", updateNavState);
14652        instance.on("progress", updateNavState);
14653        instance.on("transitionEnd", updateNavState);
14654        instance.on("breakpoint", updateNavState);
14655      }
14656
14657      instance.init();
14658      return instance;
14659    };
14660
14661    var resetSwiperInlineStyles = function resetSwiperInlineStyles() {
14662      swiperEl.removeAttribute("style");
14663
14664      var wrapper = swiperEl.querySelector(".swiper-wrapper");
14665      if (wrapper) {
14666        wrapper.removeAttribute("style");
14667      }
14668
14669      swiperEl.querySelectorAll(".swiper-slide").forEach(function (slide) {
14670        slide.removeAttribute("style");
14671      });
14672    };
14673
14674    var rebuildSwiperForViewportChange = function rebuildSwiperForViewportChange() {
14675      var nextIsMobileLayout = mobileBreakpointQuery.matches;
14676      if (nextIsMobileLayout === isMobileLayout) return;
14677
14678      isMobileLayout = nextIsMobileLayout;
14679
14680      if (swiper && !swiper.destroyed) {
14681        swiper.destroy(true, true);
14682      }
14683
14684      resetSwiperInlineStyles();
14685      swiper = buildSwiper();
14686    };
14687
14688    swiper = buildSwiper();
14689
14690    if (typeof mobileBreakpointQuery.addEventListener === "function") {
14691      mobileBreakpointQuery.addEventListener("change", rebuildSwiperForViewportChange);
14692    } else if (typeof mobileBreakpointQuery.addListener === "function") {
14693      mobileBreakpointQuery.addListener(rebuildSwiperForViewportChange);
14694    }
14695  });
14696}
14697
14698// Movie tiles carousel (existing)
14699initSwiperCarousels({
14700  rootSelector: ".js-movie-v6-swiper-root",
14701  swiperSelector: ".js-movie-v6-swiper",
14702  prevSelector: ".js-movie-v6-swiper-prev",
14703  nextSelector: ".js-movie-v6-swiper-next",
14704  disabledClass: "movie-v6-carousel__arrow--disabled",
14705  options: {
14706    slidesPerView: 2.2,
14707    slidesPerGroup: 1,
14708    spaceBetween: 12,
14709    speed: 500,
14710    cssMode: true,
14711    freeMode: false,
14712    breakpoints: {
14713      768: {
14714        cssMode: false,
14715        slidesPerView: 3.2,
14716        slidesPerGroup: 3,
14717        freeMode: {
14718          enabled: true,
14719          momentum: false,
14720          momentumBounce: false
14721        }
14722      },
14723      1024: {
14724        cssMode: false,
14725        slidesPerView: 4.4,
14726        slidesPerGroup: 4,
14727        freeMode: {
14728          enabled: true,
14729          momentum: false,
14730          momentumBounce: false
14731        }
14732      },
14733      1280: {
14734        cssMode: false,
14735        slidesPerView: 5.6,
14736        slidesPerGroup: 5,
14737        freeMode: {
14738          enabled: true,
14739          momentum: false,
14740          momentumBounce: false
14741        }
14742      }
14743    }
14744  }
14745});
14746
14747// Discover / opinion cards carousel
14748initSwiperCarousels({
14749  rootSelector: ".js-discover-v6-swiper-root",
14750  swiperSelector: ".js-discover-v6-swiper",
14751  prevSelector: ".js-discover-v6-swiper-prev",
14752  nextSelector: ".js-discover-v6-swiper-next",
14753  disabledClass: "discover-v6-carousel__arrow--disabled",
14754  options: {
14755    slidesPerView: 1.3,
14756    slidesPerGroup: 1,
14757    spaceBetween: 12,
14758    speed: 500,
14759    cssMode: true,
14760    freeMode: false,
14761    breakpoints: {
14762      768: {
14763        cssMode: false,
14764        slidesPerView: 2.2,
14765        slidesPerGroup: 1,
14766        spaceBetween: 16,
14767        freeMode: {
14768          enabled: true,
14769          momentum: false,
14770          momentumBounce: false
14771        }
14772      },
14773      1024: {
14774        cssMode: false,
14775        slidesPerView: 3.2,
14776        slidesPerGroup: 1,
14777        spaceBetween: 16,
14778        freeMode: {
14779          enabled: true,
14780          momentum: false,
14781          momentumBounce: false
14782        }
14783      }
14784    }
14785  }
14786});
14787
14788// Trailer cards carousel (streaming / coming soon)
14789initSwiperCarousels({
14790  rootSelector: ".js-trailer-v6-swiper-root",
14791  swiperSelector: ".js-trailer-v6-swiper",
14792  prevSelector: ".js-trailer-v6-swiper-prev",
14793  nextSelector: ".js-trailer-v6-swiper-next",
14794  disabledClass: "trailer-v6-carousel__arrow--disabled",
14795  options: {
14796    slidesPerView: 1.2,
14797    slidesPerGroup: 1,
14798    spaceBetween: 16,
14799    speed: 500,
14800    cssMode: true,
14801    freeMode: false,
14802    breakpoints: {
14803      768: {
14804        cssMode: false,
14805        slidesPerView: 2.2,
14806        slidesPerGroup: 1,
14807        freeMode: {
14808          enabled: true,
14809          momentum: false,
14810          momentumBounce: false
14811        }
14812      },
14813      1024: {
14814        cssMode: false,
14815        slidesPerView: 2.5,
14816        slidesPerGroup: 1,
14817        freeMode: {
14818          enabled: true,
14819          momentum: false,
14820          momentumBounce: false
14821        }
14822      }
14823    }
14824  }
14825});
14826
14827initSwiperCarousels({
14828  rootSelector: ".js-promo-v6-swiper-root",
14829  swiperSelector: ".js-promo-v6-swiper",
14830  prevSelector: ".js-promo-v6-swiper-prev",
14831  nextSelector: ".js-promo-v6-swiper-next",
14832  disabledClass: "promo-v6-carousel__arrow--disabled",
14833  options: {
14834    slidesPerView: 1.2,
14835    slidesPerGroup: 1,
14836    spaceBetween: 16,
14837    speed: 500,
14838    cssMode: true,
14839    freeMode: false,
14840    breakpoints: {
14841      768: {
14842        cssMode: false,
14843        slidesPerView: 2.2,
14844        slidesPerGroup: 1,
14845        freeMode: {
14846          enabled: true,
14847          momentum: false,
14848          momentumBounce: false
14849        }
14850      },
14851      1024: {
14852        cssMode: false,
14853        slidesPerView: 2.5,
14854        slidesPerGroup: 1,
14855        freeMode: {
14856          enabled: true,
14857          momentum: false,
14858          momentumBounce: false
14859        }
14860      }
14861    }
14862  }
14863});
14864
14865initSwiperCarousels({
14866  rootSelector: ".js-sport-teams-v6-swiper-root",
14867  swiperSelector: ".js-sport-teams-v6-swiper",
14868  prevSelector: ".js-sport-teams-v6-swiper-prev",
14869  nextSelector: ".js-sport-teams-v6-swiper-next",
14870  disabledClass: "sport-teams-v6-carousel__arrow--disabled",
14871  options: {
14872    slidesPerView: "auto",
14873    slidesPerGroup: 1,
14874    spaceBetween: 12,
14875    speed: 500,
14876    cssMode: true,
14877    freeMode: false,
14878    breakpoints: {
14879      768: {
14880        cssMode: false,
14881        slidesPerView: "auto",
14882        slidesPerGroup: 1,
14883        freeMode: {
14884          enabled: true,
14885          momentum: false,
14886          momentumBounce: false
14887        }
14888      }
14889    }
14890  }
14891});
14892
14893},{"../../../../../node_modules/swiper/swiper-bundle.js":194}],105:[function(require,module,exports){
14894'use strict';
14895
14896(function () {
14897  var SELECTORS = {
14898    trigger: '.js--openModal[data-modal-id="movie-synopsis-modal-v6"]',
14899    slider: '.js-movie-synopsis-cast-slider',
14900    track: '.js-movie-synopsis-cast-slider-track',
14901    item: '.js-movie-synopsis-cast-slider-item',
14902    left: '.js-movie-synopsis-cast-slider-left',
14903    right: '.js-movie-synopsis-cast-slider-right'
14904  };
14905
14906  function updateSliderState(slider) {
14907    var track = slider.querySelector(SELECTORS.track);
14908    var left = slider.querySelector(SELECTORS.left);
14909    var right = slider.querySelector(SELECTORS.right);
14910
14911    if (!track || !left || !right) return;
14912
14913    var maxScrollLeft = track.scrollWidth - track.clientWidth;
14914    var hasOverflow = maxScrollLeft > 1;
14915    var atStart = track.scrollLeft <= 1;
14916    var atEnd = track.scrollLeft >= maxScrollLeft - 1;
14917
14918    slider.classList.toggle("is-active", hasOverflow);
14919    slider.classList.toggle("is-at-start", !hasOverflow || atStart);
14920    slider.classList.toggle("is-at-end", !hasOverflow || atEnd);
14921    left.disabled = !hasOverflow || atStart;
14922    right.disabled = !hasOverflow || atEnd;
14923  }
14924
14925  function getTargetScrollLeft(track, direction) {
14926    var items = Array.from(track.querySelectorAll(SELECTORS.item));
14927    if (!items.length) return track.scrollLeft;
14928
14929    var currentScroll = track.scrollLeft;
14930    var edge = direction === "right" ? currentScroll + track.clientWidth : currentScroll - 1;
14931
14932    if (direction === "right") {
14933      var nextItem = items.find(function (item) {
14934        return item.offsetLeft > edge;
14935      });
14936      return nextItem ? nextItem.offsetLeft : track.scrollWidth;
14937    }
14938
14939    var previousItems = items.filter(function (item) {
14940      return item.offsetLeft < edge;
14941    });
14942    var previousItem = previousItems.length ? previousItems[previousItems.length - 1] : items[0];
14943    return previousItem ? previousItem.offsetLeft : 0;
14944  }
14945
14946  function scrollSlider(slider, direction) {
14947    var track = slider.querySelector(SELECTORS.track);
14948    if (!track) return;
14949
14950    track.scrollTo({
14951      left: getTargetScrollLeft(track, direction),
14952      behavior: "smooth"
14953    });
14954  }
14955
14956  function initSlider(slider) {
14957    if (!slider || slider.dataset.synopsisSliderReady === "true") {
14958      if (slider) updateSliderState(slider);
14959      return;
14960    }
14961
14962    var track = slider.querySelector(SELECTORS.track);
14963    var left = slider.querySelector(SELECTORS.left);
14964    var right = slider.querySelector(SELECTORS.right);
14965
14966    if (!track || !left || !right) return;
14967
14968    left.addEventListener("click", function () {
14969      return scrollSlider(slider, "left");
14970    });
14971    right.addEventListener("click", function () {
14972      return scrollSlider(slider, "right");
14973    });
14974    track.addEventListener("scroll", function () {
14975      return updateSliderState(slider);
14976    }, { passive: true });
14977    window.addEventListener("resize", function () {
14978      return updateSliderState(slider);
14979    });
14980
14981    slider.dataset.synopsisSliderReady = "true";
14982    updateSliderState(slider);
14983  }
14984
14985  function initVisibleModalSliders() {
14986    document.querySelectorAll(SELECTORS.slider).forEach(function (slider) {
14987      initSlider(slider);
14988      updateSliderState(slider);
14989    });
14990  }
14991
14992  document.addEventListener("click", function (event) {
14993    var trigger = event.target.closest(SELECTORS.trigger);
14994    if (!trigger) return;
14995
14996    window.requestAnimationFrame(function () {
14997      initVisibleModalSliders();
14998    });
14999  });
15000
15001  initVisibleModalSliders();
15002  document.addEventListener("DOMContentLoaded", initVisibleModalSliders);
15003})();
15004
15005},{}],106:[function(require,module,exports){
15006'use strict';
15007
15008(function () {
15009  var wrapper = document.querySelector('.js-cinema-times-toggle');
15010  if (!wrapper) return;
15011
15012  function buildNextUrl(view) {
15013    var url = new URL(window.location.href);
15014
15015    // Keep every existing param, only modify `view`
15016    if (view === 'all-movies') {
15017      url.searchParams.set('view', 'all-movies');
15018    } else {
15019      // default view: remove param entirely (cleaner url)
15020      url.searchParams.delete('view');
15021    }
15022
15023    return url.toString();
15024  }
15025
15026  wrapper.addEventListener('click', function (e) {
15027    var link = e.target.closest('a.js-viewToggle');
15028    if (!link) return;
15029
15030    e.preventDefault();
15031
15032    var view = link.getAttribute('data-view') || 'calendar';
15033    var nextUrl = buildNextUrl(view);
15034
15035    // Reload to the new url (with other params)
15036    window.location.href = nextUrl;
15037  });
15038
15039  var toggles = wrapper.querySelectorAll('a.js-viewToggle');
15040  for (var i = 0; i < toggles.length; i++) {
15041    var a = toggles[i];
15042    var view = a.getAttribute('data-view') || 'calendar';
15043    a.setAttribute('href', buildNextUrl(view));
15044  }
15045})();
15046
15047},{}],107:[function(require,module,exports){
15048"use strict";
15049
15050(function () {
15051  var OPEN_CLASS = "is-context-open";
15052  var ITEM_SELECTOR = ".times-calendar-times__el";
15053  var TOGGLE_SELECTOR = ".js-context-toggle";
15054  var MENU_SELECTOR = ".times-calendar__context-window";
15055  var LABEL_SELECTOR = ".times-calendar-times__el__label";
15056  var BUTTON_SELECTOR = ".times-calendar-times__button";
15057  var ARTICLE_SELECTOR = ".cinema-times__article";
15058  var ARTICLE_OPEN_CLASS = "is-context-active";
15059  var ONE_LINE_ITEM_CLASS = "times-calendar-times__el--label-1-line";
15060  var TWO_LINE_ITEM_CLASS = "times-calendar-times__el--label-2-lines";
15061  var ONE_LINE_CLASS = "times-calendar-times__button--label-1-line";
15062  var TWO_LINE_CLASS = "times-calendar-times__button--label-2-lines";
15063  var rafId = null;
15064
15065  function updateLabelHeightClasses() {
15066    var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
15067
15068    root.querySelectorAll(ITEM_SELECTOR).forEach(function (itemEl) {
15069      var buttonEl = itemEl.querySelector(BUTTON_SELECTOR);
15070      var labelEl = itemEl.querySelector(LABEL_SELECTOR);
15071      if (!buttonEl) return;
15072
15073      itemEl.classList.remove(ONE_LINE_ITEM_CLASS, TWO_LINE_ITEM_CLASS);
15074      buttonEl.classList.remove(ONE_LINE_CLASS, TWO_LINE_CLASS);
15075
15076      if (!labelEl) return;
15077
15078      var labelHeight = Math.round(labelEl.offsetHeight || labelEl.getBoundingClientRect().height);
15079
15080      if (labelHeight >= 24) {
15081        itemEl.classList.add(TWO_LINE_ITEM_CLASS);
15082        buttonEl.classList.add(TWO_LINE_CLASS);
15083      } else if (labelHeight > 0) {
15084        itemEl.classList.add(ONE_LINE_ITEM_CLASS);
15085        buttonEl.classList.add(ONE_LINE_CLASS);
15086      }
15087    });
15088  }
15089
15090  function scheduleLabelHeightClasses() {
15091    var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
15092
15093    if (rafId) cancelAnimationFrame(rafId);
15094    rafId = requestAnimationFrame(function () {
15095      updateLabelHeightClasses(root);
15096      rafId = null;
15097    });
15098  }
15099
15100  function closeItem(itemEl) {
15101    itemEl.classList.remove(OPEN_CLASS);
15102    var toggle = itemEl.querySelector(TOGGLE_SELECTOR);
15103    if (toggle) toggle.setAttribute("aria-expanded", "false");
15104    var articleEl = itemEl.closest(ARTICLE_SELECTOR);
15105    if (articleEl && !articleEl.querySelector(ITEM_SELECTOR + "." + OPEN_CLASS)) {
15106      articleEl.classList.remove(ARTICLE_OPEN_CLASS);
15107    }
15108  }
15109
15110  function closeAll() {
15111    var exceptItemEl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
15112
15113    document.querySelectorAll(ITEM_SELECTOR + "." + OPEN_CLASS).forEach(function (itemEl) {
15114      if (exceptItemEl && itemEl === exceptItemEl) return;
15115      closeItem(itemEl);
15116    });
15117  }
15118
15119  function openItem(itemEl) {
15120    itemEl.classList.add(OPEN_CLASS);
15121    var toggle = itemEl.querySelector(TOGGLE_SELECTOR);
15122    if (toggle) toggle.setAttribute("aria-expanded", "true");
15123    var articleEl = itemEl.closest(ARTICLE_SELECTOR);
15124    if (articleEl) articleEl.classList.add(ARTICLE_OPEN_CLASS);
15125  }
15126
15127  window.updateTimesCalendarLabelHeightClasses = updateLabelHeightClasses;
15128
15129  document.addEventListener("click", function (e) {
15130    var toggle = e.target.closest(TOGGLE_SELECTOR);
15131
15132    if (toggle) {
15133      var itemEl = toggle.closest(ITEM_SELECTOR);
15134      if (!itemEl) return;
15135
15136      var isOpen = itemEl.classList.contains(OPEN_CLASS);
15137      closeAll(itemEl);
15138
15139      if (isOpen) {
15140        closeItem(itemEl);
15141      } else {
15142        openItem(itemEl);
15143      }
15144
15145      return;
15146    }
15147
15148    if (e.target.closest(MENU_SELECTOR)) return;
15149
15150    closeAll();
15151  });
15152
15153  document.addEventListener("keydown", function (e) {
15154    if (e.key === "Escape") closeAll();
15155  });
15156
15157  if (document.readyState === "loading") {
15158    document.addEventListener("DOMContentLoaded", function () {
15159      return scheduleLabelHeightClasses();
15160    }, { once: true });
15161  } else {
15162    scheduleLabelHeightClasses();
15163  }
15164
15165  window.addEventListener("resize", function () {
15166    return scheduleLabelHeightClasses();
15167  });
15168
15169  if (document.fonts && document.fonts.ready && typeof document.fonts.ready.then === "function") {
15170    document.fonts.ready.then(function () {
15171      return scheduleLabelHeightClasses();
15172    });
15173  }
15174
15175  var observer = new MutationObserver(function (mutations) {
15176    var shouldUpdate = mutations.some(function (mutation) {
15177      return Array.from(mutation.addedNodes).some(function (node) {
15178        if (!(node instanceof Element)) return false;
15179        return node.matches(ITEM_SELECTOR) || Boolean(node.querySelector(ITEM_SELECTOR));
15180      });
15181    });
15182
15183    if (shouldUpdate) scheduleLabelHeightClasses();
15184  });
15185
15186  observer.observe(document.body, { childList: true, subtree: true });
15187})();
15188
15189},{}],108:[function(require,module,exports){
15190"use strict";
15191
15192function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
15193
15194(function () {
15195  var root = document.querySelector(".times-calendar");
15196  if (!root) return;
15197
15198  var scrollEl = root.querySelector(".times-calendar__inner");
15199  var leftBtn = root.querySelector(".times-calendar__arrow--left");
15200  var rightBtn = root.querySelector(".times-calendar__arrow--right");
15201  if (!scrollEl || !leftBtn || !rightBtn) return;
15202
15203  var LEFT_OVERLAY = 20;
15204  var RIGHT_OVERLAY = 20;
15205
15206  var EPS = 2;
15207
15208  var getItems = function getItems() {
15209    return Array.from(scrollEl.querySelectorAll(".times-calendar__el"));
15210  };
15211
15212  function updateArrows() {
15213    var maxScrollLeft = scrollEl.scrollWidth - scrollEl.clientWidth;
15214    var canLeft = scrollEl.scrollLeft > EPS;
15215    var canRight = scrollEl.scrollLeft < maxScrollLeft - EPS;
15216
15217    leftBtn.classList.toggle("is-disabled", !canLeft);
15218    rightBtn.classList.toggle("is-disabled", !canRight);
15219    leftBtn.disabled = !canLeft;
15220    rightBtn.disabled = !canRight;
15221
15222    leftBtn.setAttribute("aria-disabled", String(!canLeft));
15223    rightBtn.setAttribute("aria-disabled", String(!canRight));
15224  }
15225
15226  function measureSoon() {
15227    requestAnimationFrame(function () {
15228      return requestAnimationFrame(updateArrows);
15229    });
15230  }
15231
15232  function scrollPage(direction) {
15233    var vRect = scrollEl.getBoundingClientRect();
15234    var effectiveLeft = vRect.left + LEFT_OVERLAY;
15235    var effectiveRight = vRect.right - RIGHT_OVERLAY;
15236
15237    var items = getItems();
15238    if (!items.length) return;
15239
15240    if (direction === "right") {
15241      // Find the last FULLY visible item in the viewport
15242      var anchor = null;
15243      var _iteratorNormalCompletion = true;
15244      var _didIteratorError = false;
15245      var _iteratorError = undefined;
15246
15247      try {
15248        for (var _iterator = items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
15249          var el = _step.value;
15250
15251          var r = el.getBoundingClientRect();
15252          if (r.left >= effectiveLeft - EPS && r.right <= effectiveRight + EPS) {
15253            anchor = el;
15254          }
15255        }
15256      } catch (err) {
15257        _didIteratorError = true;
15258        _iteratorError = err;
15259      } finally {
15260        try {
15261          if (!_iteratorNormalCompletion && _iterator.return) {
15262            _iterator.return();
15263          }
15264        } finally {
15265          if (_didIteratorError) {
15266            throw _iteratorError;
15267          }
15268        }
15269      }
15270
15271      if (!anchor) {
15272        anchor = items.find(function (el) {
15273          return el.getBoundingClientRect().right > effectiveLeft + EPS;
15274        }) || items[0];
15275      }
15276
15277      var aRect = anchor.getBoundingClientRect();
15278      var delta = aRect.left - effectiveLeft; // positive number
15279      scrollEl.scrollBy({ left: delta, behavior: "smooth" });
15280    } else {
15281      // Find the first FULLY visible item in the effective viewport
15282      var _anchor = null;
15283      var _iteratorNormalCompletion2 = true;
15284      var _didIteratorError2 = false;
15285      var _iteratorError2 = undefined;
15286
15287      try {
15288        for (var _iterator2 = items[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
15289          var _el = _step2.value;
15290
15291          var _r = _el.getBoundingClientRect();
15292          if (_r.left >= effectiveLeft - EPS && _r.right <= effectiveRight + EPS) {
15293            _anchor = _el;
15294            break;
15295          }
15296        }
15297      } catch (err) {
15298        _didIteratorError2 = true;
15299        _iteratorError2 = err;
15300      } finally {
15301        try {
15302          if (!_iteratorNormalCompletion2 && _iterator2.return) {
15303            _iterator2.return();
15304          }
15305        } finally {
15306          if (_didIteratorError2) {
15307            throw _iteratorError2;
15308          }
15309        }
15310      }
15311
15312      if (!_anchor) {
15313        _anchor = [].concat(_toConsumableArray(items)).reverse().find(function (el) {
15314          return el.getBoundingClientRect().left < effectiveRight - EPS;
15315        }) || items[items.length - 1];
15316      }
15317
15318      var _aRect = _anchor.getBoundingClientRect();
15319      var _delta = _aRect.right - effectiveRight; // negative number
15320      scrollEl.scrollBy({ left: _delta, behavior: "smooth" });
15321    }
15322  }
15323
15324  leftBtn.addEventListener("click", function () {
15325    return scrollPage("left");
15326  });
15327  rightBtn.addEventListener("click", function () {
15328    return scrollPage("right");
15329  });
15330
15331  scrollEl.addEventListener("scroll", function () {
15332    return requestAnimationFrame(updateArrows);
15333  });
15334  window.addEventListener("resize", measureSoon);
15335
15336  // Dynamic content support
15337  var mo = new MutationObserver(measureSoon);
15338  mo.observe(scrollEl, { childList: true, subtree: true });
15339
15340  measureSoon();
15341})();
15342
15343},{}],109:[function(require,module,exports){
15344"use strict";
15345
15346var _listNotification = require("../v5/list-notification");
15347
15348(function () {
15349  var MODAL_ID = "user-share-movie-session";
15350  var TRIGGER_SELECTOR = ".js-share-showtime-trigger, .js-share-movie-trigger";
15351  var EMAIL_LINK_ID = "email-movie-share";
15352  var isMobileDevice = function isMobileDevice() {
15353    return window.innerWidth <= 1000;
15354  };
15355  var hasNativeShare = typeof navigator !== "undefined" && typeof navigator.share === "function" && isMobileDevice();
15356
15357  var defaultShareText = "Check out this showtime.";
15358  var currentSharePayload = {
15359    title: document.title || "Share showtime",
15360    text: defaultShareText,
15361    url: window.location.href
15362  };
15363
15364  function buildEmailShareLink() {
15365    var shareUrl = currentSharePayload.url || window.location.href;
15366    var shareText = currentSharePayload.text || defaultShareText;
15367    var shareTitle = currentSharePayload.title || "Share showtime";
15368
15369    return "mailto:?subject=" + encodeURIComponent(shareTitle) + "&body=" + encodeURIComponent(shareText + "\n\n" + shareUrl);
15370  }
15371
15372  function getMetaDescription() {
15373    var metaEl = document.querySelector('meta[name="twitter:description"]') || document.querySelector('meta[property="og:description"]') || document.querySelector('meta[name="description"]');
15374
15375    if (!metaEl) return "";
15376
15377    return (metaEl.getAttribute("content") || "").trim();
15378  }
15379
15380  function syncEmailLink() {
15381    var emailLink = document.getElementById(EMAIL_LINK_ID);
15382    if (!emailLink) return;
15383
15384    emailLink.setAttribute("href", buildEmailShareLink());
15385  }
15386
15387  function toAbsoluteUrl(raw) {
15388    if (!raw) return window.location.href;
15389    // Already absolute (any protocol or protocol-relative) → return as-is.
15390    if (/^[a-z][a-z0-9+.-]*:/i.test(raw) || raw.startsWith("//")) return raw;
15391    // Root-relative path → promote to the current browser origin so the recipient
15392    // gets a clickable URL regardless of which environment we're on.
15393    if (raw.startsWith("/")) return window.location.origin + raw;
15394    return raw;
15395  }
15396
15397  function buildSharePayload(btn) {
15398    if (!btn) return currentSharePayload;
15399
15400    var shareUrl = toAbsoluteUrl(btn.getAttribute("data-url")) || window.location.href;
15401    var title = btn.getAttribute("data-title") || document.title || "Share showtime";
15402    var shareFormat = btn.getAttribute("data-share-format");
15403
15404    if (shareFormat === "single-cinema-showtime") {
15405      var cinema = btn.getAttribute("data-cinema") || "";
15406      var date = btn.getAttribute("data-date") || "";
15407      var time = btn.getAttribute("data-time") || "";
15408      var text = "Keen? " + title + " at " + cinema + ", " + date + " \u2013 " + time + ".";
15409      var emailTitle = cinema ? title + " at " + cinema : title;
15410
15411      return { title: emailTitle, text: text, url: shareUrl };
15412    }
15413
15414    if (shareFormat === "single-movie") {
15415      var _text = btn.getAttribute("data-description") || getMetaDescription() || defaultShareText;
15416
15417      return {
15418        title: title,
15419        text: _text,
15420        url: shareUrl
15421      };
15422    }
15423
15424    return {
15425      title: title,
15426      text: btn.getAttribute("data-description") || defaultShareText,
15427      url: shareUrl
15428    };
15429  }
15430
15431  document.addEventListener("click", async function (e) {
15432    var btn = e.target.closest(TRIGGER_SELECTOR);
15433    if (!btn) return;
15434
15435    currentSharePayload = buildSharePayload(btn);
15436    syncEmailLink();
15437
15438    if (!hasNativeShare) {
15439      return;
15440    }
15441
15442    e.preventDefault();
15443    e.stopPropagation();
15444
15445    try {
15446      await navigator.share(currentSharePayload);
15447    } catch (err) {
15448      console.log("Share cancelled or failed:", err);
15449    }
15450  }, true);
15451
15452  document.addEventListener("click", function (e) {
15453    var modal = document.getElementById(MODAL_ID);
15454    if (!modal || !modal.contains(e.target)) return;
15455
15456    var shareUrl = currentSharePayload.url || window.location.href;
15457    var shareText = currentSharePayload.text || defaultShareText;
15458
15459    var copyBtn = e.target.closest(".js-big-share-button-copy-url");
15460    if (copyBtn) {
15461      e.preventDefault();
15462      e.stopPropagation();
15463
15464      navigator.clipboard.writeText(shareUrl).then(function () {
15465        (0, _listNotification.openNotification)({ text: "URL copied to clipboard." });
15466      }).catch(function (err) {
15467        console.error("Failed to copy URL:", err);
15468        (0, _listNotification.openNotification)({ text: "Could not copy URL. Try selecting the link manually." });
15469      });
15470      return;
15471    }
15472
15473    var shareLinks = {
15474      messenger: "https://www.addtoany.com/add_to/facebook_messenger?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + encodeURIComponent(shareText),
15475      whatsapp: "https://www.addtoany.com/add_to/whatsapp?linkurl=" + encodeURIComponent(shareUrl) + "&linkname=" + encodeURIComponent(shareText)
15476    };
15477
15478    var whatsappBtn = e.target.closest("#whatsapp-movie-share");
15479    if (whatsappBtn) {
15480      e.preventDefault();
15481      e.stopPropagation();
15482      window.open(shareLinks.whatsapp, "_blank", "noopener,noreferrer");
15483      return;
15484    }
15485
15486    var messengerBtn = e.target.closest("#messenger-movie-share");
15487    if (messengerBtn) {
15488      e.preventDefault();
15489      e.stopPropagation();
15490      window.open(shareLinks.messenger, "_blank", "noopener,noreferrer");
15491      return;
15492    }
15493  }, true);
15494
15495  syncEmailLink();
15496})();
15497
15498},{"../v5/list-notification":67}],110:[function(require,module,exports){
15499"use strict";
15500
15501Object.defineProperty(exports, "__esModule", {
15502  value: true
15503});
15504
15505var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
15506
15507function addVideoListeners(video) {
15508  //***** video player should automatically have all the controls we need
15509
15510  // // video.addEventListener('click', () => {
15511  // // 	if (video.paused){
15512  // // 		video.play()
15513  // // 		// setFullscreen()
15514  // // 	} else {
15515  // // 		video.pause()
15516  // // 	}
15517  // // })
15518  // // const fullScreebnBtn = document.querySelector(".js--requestFullScreen");
15519  // // fullScreebnBtn.addEventListener("click", ()=>setFullscreen(video))
15520
15521  // autoplay doesn't always work automatically on mobile
15522  var autoplay = video.getAttribute("autoplay");
15523  if (autoplay) {
15524    if (video.readyState >= video.HAVE_FUTURE_DATA) {
15525      video.play();
15526    } else {
15527      video.addEventListener("canplay", function (event) {
15528        video.play();
15529      });
15530    }
15531  }
15532}
15533
15534function setFullscreen(video) {
15535  if (video.requestFullscreen) {
15536    document.fullscreenElement ? video.exitFullscreen() : video.requestFullscreen();
15537  } else if (video.mozRequestFullScreen) {
15538    document.mozFullscreenElement ? video.mozExitFullscreen() : video.mozRequestFullscreen();
15539  } else if (video.webkitRequestFullscreen) {
15540    document.webkitFullscreenElement ? video.webkitExitFullscreen() : video.webkitRequestFullscreen();
15541  } else if (video.msRequestFullscreen) {
15542    document.msFullscreenElement ? video.msExitFullscreen() : video.msRequestFullscreen();
15543  }
15544}
15545
15546exports.default = function (app) {
15547  //
15548  // 1) BLOG EMBEDS
15549  //
15550  var jwpEmbeds = document.querySelectorAll(".blog-jwp-player");
15551  jwpEmbeds.forEach(function (embed) {
15552    var playerInstance = jwplayer(embed);
15553    var options = {
15554      playlist: "https://cdn.jwplayer.com/v2/media/" + embed.getAttribute("data-jwid"),
15555      width: "100%",
15556      height: "100%"
15557    };
15558    playerInstance.setup(options);
15559  });
15560
15561  //
15562  // 2) HEADER / HERO VIDEO
15563  //
15564  var setupVideoPlayer = function setupVideoPlayer(videoEl) {
15565    var playerInstance = jwplayer(videoEl);
15566    var isTrailerLanding = videoEl.hasAttribute("data-trailer-landing");
15567    var shouldAutoplayTrailerLanding = videoEl.getAttribute("data-trailer-autoplay") === "true";
15568
15569    var options = {
15570      playlist: "https://cdn.jwplayer.com/v2/media/" + videoEl.getAttribute("data-jwid"),
15571      width: "100%",
15572      height: "100%"
15573    };
15574
15575    if (videoEl.hasAttribute("data-background")) {
15576      var ar = window.innerWidth <= 768 ? "414x515" : "1512x662";
15577
15578      Object.assign(options, {
15579        autostart: "viewable",
15580        mute: true,
15581        repeat: true,
15582        controls: false,
15583        visualPlaylist: false,
15584        displaytitle: false,
15585        displaydescription: false,
15586        aspectratio: ar,
15587        stretching: "fill"
15588      });
15589    }
15590
15591    if (isTrailerLanding) {
15592      Object.assign(options, {
15593        autostart: shouldAutoplayTrailerLanding,
15594        mute: false,
15595        controls: true,
15596        repeat: false,
15597        visualPlaylist: false,
15598        displaytitle: false,
15599        displaydescription: false
15600      });
15601    }
15602
15603    playerInstance.setup(options);
15604
15605    if (isTrailerLanding && shouldAutoplayTrailerLanding) {
15606      playerInstance.on("autostartNotAllowed", function () {
15607        try {
15608          playerInstance.setMute(true);
15609          playerInstance.play();
15610        } catch (e) {
15611          console.log("[Trailer Landing] autoplay fallback failed", e);
15612        }
15613      });
15614    }
15615  };
15616
15617  var hasMobileVideo = document.querySelector(".js-has-mobile-video");
15618  var videoEl = void 0;
15619
15620  if (hasMobileVideo) {
15621    videoEl = window.innerWidth > 768 ? document.getElementById("videoPlayer") : document.getElementById("mobileVideoPlayer");
15622  } else {
15623    videoEl = document.getElementById("videoPlayer");
15624  }
15625
15626  if (videoEl) {
15627    setupVideoPlayer(videoEl);
15628  }
15629
15630  //
15631  // 3) COMING-SOON
15632  //
15633
15634  //
15635  // 3) COMING-SOON
15636  //
15637
15638  var comingSoonEls = document.querySelectorAll('[data-jwid][data-comingsoon="true"]');
15639
15640  if (!comingSoonEls.length) {
15641    return;
15642  }
15643
15644  var players = {}; // id -> { jw, wrapper, lastTime }
15645  var activeId = null;
15646  var globalMuted = true;
15647  var observer = void 0;
15648  var audioControlsInitialized = false;
15649  var modalResumeListenersInitialized = false;
15650
15651  // When opening modal from a card, we store which card did it
15652  var resumeState = { fromId: null, fromTime: 0 };
15653
15654  function isComingSoonMobile() {
15655    return window.matchMedia("(max-width: 767px)").matches;
15656  }
15657
15658  function setComingSoonProgress(playerState, value) {
15659    if (!playerState || !playerState.progressBarEl) return;
15660
15661    var clamped = Math.max(0, Math.min(1, value || 0));
15662    playerState.progressBarEl.style.width = clamped * 100 + "%";
15663  }
15664
15665  function syncComingSoonPlaybackUi(id) {
15666    var playerState = players[id];
15667    if (!playerState || !playerState.mobilePlaybackEl) return;
15668
15669    var isActive = id === activeId;
15670    var isMobile = isComingSoonMobile();
15671    var isPaused = !!playerState.isPausedByUser;
15672    var shouldShow = isMobile && isActive && isPaused;
15673
15674    playerState.mobilePlaybackEl.classList.toggle("is-visible", shouldShow);
15675    playerState.mobilePlaybackEl.classList.toggle("is-paused", shouldShow && isPaused);
15676  }
15677
15678  function observeComingSoonWrapper(wrapper) {
15679    if (!observer || !wrapper || wrapper.dataset.comingSoonObserved === "true") return;
15680
15681    observer.observe(wrapper);
15682    wrapper.dataset.comingSoonObserved = "true";
15683  }
15684
15685  function setupComingSoonPlayer(el) {
15686    var id = el.getAttribute("data-jwid");
15687    var wrapper = el.closest(".video-card__outer");
15688
15689    if (!id || !wrapper) {
15690      return;
15691    }
15692
15693    if (el.dataset.comingSoonInit === "true") {
15694      observeComingSoonWrapper(wrapper);
15695      return;
15696    }
15697
15698    el.dataset.comingSoonInit = "true";
15699
15700    // Pre-create entry so time events can write to it safely
15701    players[id] = {
15702      jw: null,
15703      wrapper: wrapper,
15704      lastTime: 0,
15705      lastDuration: 0,
15706      isPausedByUser: false,
15707      mobilePlaybackEl: wrapper.querySelector(".js-coming-soon-mobile-playback"),
15708      progressBarEl: wrapper.querySelector(".js-coming-soon-progress-bar")
15709    };
15710    setComingSoonProgress(players[id], 0);
15711
15712    var jw = jwplayer(el).setup({
15713      playlist: "https://cdn.jwplayer.com/v2/media/" + id,
15714      width: "100%",
15715      height: "100%",
15716      autostart: false,
15717      mute: true,
15718      repeat: true,
15719      controls: false,
15720      visualPlaylist: false,
15721      displaytitle: false,
15722      displaydescription: false,
15723      aspectratio: "16:9",
15724      stretching: "uniform"
15725    });
15726
15727    // Track time for THIS card (this is per id, so yes, it tracks each one)
15728    jw.on("time", function (e) {
15729      // Only log while it is the active one, to avoid noise
15730      var pos = e && typeof e.position === "number" ? e.position : 0;
15731      var duration = e && typeof e.duration === "number" ? e.duration : 0;
15732      players[id].lastTime = pos;
15733      players[id].lastDuration = duration;
15734      setComingSoonProgress(players[id], duration > 0 ? pos / duration : 0);
15735      syncComingSoonPlaybackUi(id);
15736
15737      // if (id === activeId) {
15738      //   // Log about once every 2 seconds
15739      //   const rounded = Math.floor(pos);
15740      //   if (rounded % 2 === 0) {
15741      //     console.log(`[ComingSoon] tracking active ${id}:`, rounded, "sec");
15742      //   }
15743      // }
15744    });
15745
15746    // jw.on("play", () => {
15747    //   console.log(`[ComingSoon] play ${id}`);
15748    // });
15749
15750    // jw.on("pause", () => {
15751    //   console.log(`[ComingSoon] pause ${id} at`, Math.floor(players[id].lastTime));
15752    // });
15753
15754    // jw.on("stop", () => {
15755    //   console.log(`[ComingSoon] stop ${id} at`, Math.floor(players[id].lastTime));
15756    // });
15757
15758    jw.on("ready", function () {
15759      players[id].jw = jw;
15760      syncComingSoonPlaybackUi(id);
15761      evaluateActive();
15762    });
15763
15764    wrapper.addEventListener("click", function (e) {
15765      if (!isComingSoonMobile()) return;
15766      if (id !== activeId) return;
15767
15768      var blockedTarget = e.target.closest(".video-card__audio-controls, .video-card__fullscreen, .video-card__content, .video-card__buttons");
15769
15770      if (blockedTarget) return;
15771      if (!players[id] || !players[id].jw) return;
15772
15773      e.preventDefault();
15774
15775      if (players[id].isPausedByUser) {
15776        players[id].isPausedByUser = false;
15777        players[id].jw.play();
15778      } else {
15779        players[id].isPausedByUser = true;
15780        players[id].jw.pause(true);
15781      }
15782
15783      syncComingSoonPlaybackUi(id);
15784    });
15785  }
15786
15787  function initObserver() {
15788    if (observer) return;
15789
15790    observer = new IntersectionObserver(onIntersect, {
15791      root: null,
15792      threshold: [0, 0.1, 0.25, 0.5, 0.75, 1]
15793    });
15794
15795    Object.values(players).forEach(function (_ref) {
15796      var wrapper = _ref.wrapper;
15797
15798      observeComingSoonWrapper(wrapper);
15799    });
15800
15801    window.addEventListener("resize", evaluateActive);
15802  }
15803
15804  function onIntersect() {
15805    evaluateActive();
15806  }
15807
15808  // Core logic unchanged but with extra logs
15809  function evaluateActive() {
15810    var vh = window.innerHeight || document.documentElement.clientHeight;
15811    var middle = vh / 2;
15812
15813    var candidateId = null;
15814    var bestTop = -Infinity;
15815
15816    Object.entries(players).forEach(function (_ref2) {
15817      var _ref3 = _slicedToArray(_ref2, 2),
15818          id = _ref3[0],
15819          wrapper = _ref3[1].wrapper;
15820
15821      if (!wrapper || !wrapper.getBoundingClientRect) return;
15822
15823      var rect = wrapper.getBoundingClientRect();
15824      var top = rect.top;
15825      var bottom = rect.bottom;
15826
15827      // Off-screen
15828      if (bottom <= 0 || top >= vh) return;
15829
15830      // Only consider if top edge has reached/passed middle line
15831      if (top <= middle && top > bestTop) {
15832        bestTop = top;
15833        candidateId = id;
15834      }
15835    });
15836
15837    if (!candidateId) {
15838      // Keep current active if still visible
15839      if (activeId && players[activeId]) {
15840        var wrapper = players[activeId].wrapper;
15841
15842        var r = wrapper.getBoundingClientRect();
15843        var stillVisible = r.bottom > 0 && r.top < vh;
15844        if (stillVisible) return;
15845      }
15846
15847      if (activeId) {
15848        Object.entries(players).forEach(function (_ref4) {
15849          var _ref5 = _slicedToArray(_ref4, 2),
15850              id = _ref5[0],
15851              jw = _ref5[1].jw;
15852
15853          players[id].isPausedByUser = false;
15854          if (jw) {
15855            jw.pause(true);
15856          }
15857          syncComingSoonPlaybackUi(id);
15858        });
15859        activeId = null;
15860      }
15861      return;
15862    }
15863
15864    if (candidateId === activeId) return;
15865
15866    Object.entries(players).forEach(function (_ref6) {
15867      var _ref7 = _slicedToArray(_ref6, 2),
15868          id = _ref7[0],
15869          jw = _ref7[1].jw;
15870
15871      if (!jw) return;
15872
15873      if (id === candidateId) {
15874        players[id].isPausedByUser = false;
15875        jw.setMute(globalMuted);
15876
15877        // If we previously stored a lastTime for this card, you can optionally resume it.
15878        // For now, we DO NOT auto-resume on scroll, only on modal close.
15879        jw.play();
15880      } else {
15881        players[id].isPausedByUser = false;
15882        jw.pause(true);
15883      }
15884
15885      syncComingSoonPlaybackUi(id);
15886    });
15887
15888    activeId = candidateId;
15889    syncComingSoonPlaybackUi(activeId);
15890  }
15891
15892  // === 4) GLOBAL AUDIO TOGGLE ===
15893  function initAudioControls() {
15894    if (audioControlsInitialized) {
15895      return;
15896    }
15897
15898    var audioControls = document.querySelectorAll(".video-card__audio-controls");
15899
15900    if (!audioControls.length) {
15901      return;
15902    }
15903
15904    audioControlsInitialized = true;
15905
15906    function updateIcons() {
15907      audioControls.forEach(function (btn) {
15908        if (globalMuted) btn.classList.remove("is-enabled");else btn.classList.add("is-enabled");
15909      });
15910    }
15911
15912    audioControls.forEach(function (btn) {
15913      btn.addEventListener("click", function (e) {
15914        e.preventDefault();
15915        e.stopPropagation();
15916
15917        globalMuted = !globalMuted;
15918
15919        Object.values(players).forEach(function (_ref8) {
15920          var jw = _ref8.jw;
15921          return jw && jw.setMute(globalMuted);
15922        });
15923        updateIcons();
15924      });
15925    });
15926
15927    updateIcons();
15928  }
15929
15930  // === FULLSCREEN BUTTON CLICK (WORKS RELIABLY) ===
15931  document.addEventListener("click", function (e) {
15932    var btn = e.target.closest(".js--FlicksFullscreen");
15933    if (!btn) return;
15934
15935    e.preventDefault();
15936    e.stopPropagation();
15937
15938    // Get trailer URL
15939    var href = btn.getAttribute("data-trailer-href");
15940
15941    // Get jwid directly from button (most reliable)
15942    var id = btn.getAttribute("data-jwid");
15943
15944    // Fallback: try to find it from DOM (just in case)
15945    if (!id) {
15946      var outer = btn.closest(".video-card__outer");
15947      var card = outer ? outer.querySelector('[data-jwid][data-comingsoon="true"]') : null;
15948      id = card ? card.getAttribute("data-jwid") : null;
15949    }
15950
15951    if (!id || !href) {
15952      return;
15953    }
15954
15955    if (!players[id] || !players[id].jw) {
15956      return;
15957    }
15958
15959    // Save resume info
15960    resumeState.fromId = id;
15961    resumeState.fromTime = players[id].lastTime || 0;
15962
15963    // Pause current video
15964    players[id].isPausedByUser = true;
15965    players[id].jw.pause(true);
15966    syncComingSoonPlaybackUi(id);
15967
15968    // Tell trailer.js to open modal
15969    window.dispatchEvent(new CustomEvent("comingsoon:openTrailer", {
15970      detail: {
15971        trailerUrl: href,
15972        startAt: resumeState.fromTime,
15973        fromId: id
15974      }
15975    }));
15976  });
15977
15978  // === 6) RESUME FROM MODAL CLOSE ===
15979  // trailer.js should dispatch "comingsoon:closeTrailer" with { endAt: seconds }
15980  function initModalResumeListeners() {
15981    if (modalResumeListenersInitialized) {
15982      return;
15983    }
15984
15985    modalResumeListenersInitialized = true;
15986
15987    window.addEventListener("comingsoon:closeTrailer", function (e) {
15988      var endAt = e && e.detail && typeof e.detail.endAt === "number" ? e.detail.endAt : 0;
15989
15990      var id = resumeState.fromId;
15991      if (!id || !players[id] || !players[id].jw) {
15992        resumeState.fromId = null;
15993        resumeState.fromTime = 0;
15994        return;
15995      }
15996
15997      // Store latest time back to the card
15998      players[id].lastTime = endAt || players[id].lastTime || 0;
15999
16000      // Make it active and stop others
16001      activeId = id;
16002
16003      Object.entries(players).forEach(function (_ref9) {
16004        var _ref10 = _slicedToArray(_ref9, 2),
16005            pid = _ref10[0],
16006            obj = _ref10[1];
16007
16008        if (!obj.jw) return;
16009        if (pid !== id) obj.jw.pause(true);
16010      });
16011
16012      var jw = players[id].jw;
16013      var t = players[id].lastTime || 0;
16014
16015      players[id].isPausedByUser = false;
16016      jw.setMute(globalMuted);
16017
16018      // Seek after play tends to be more reliable with some configs
16019      jw.play();
16020      if (t > 0) {
16021        jw.seek(t);
16022      }
16023
16024      syncComingSoonPlaybackUi(id);
16025
16026      resumeState.fromId = null;
16027      resumeState.fromTime = 0;
16028    });
16029  }
16030
16031  function setupComingSoonPlayers() {
16032    var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
16033
16034    var els = root.querySelectorAll('[data-jwid][data-comingsoon="true"]');
16035    if (!els.length) return;
16036
16037    els.forEach(function (el) {
16038      return setupComingSoonPlayer(el);
16039    });
16040
16041    initObserver();
16042    initAudioControls();
16043    initModalResumeListeners();
16044    evaluateActive();
16045  }
16046
16047  setupComingSoonPlayers(document);
16048
16049  window.addEventListener("pagination:appended", function (event) {
16050    var detail = event && event.detail ? event.detail : null;
16051    var pageContainer = detail && detail.pageContainer ? detail.pageContainer : null;
16052
16053    if (!pageContainer || !pageContainer.closest(".video-cards")) {
16054      return;
16055    }
16056
16057    setupComingSoonPlayers(pageContainer);
16058  });
16059
16060  window.addEventListener("resize", function () {
16061    Object.keys(players).forEach(function (id) {
16062      syncComingSoonPlaybackUi(id);
16063    });
16064  });
16065
16066  // leave 
16067};
16068
16069exports.addVideoListeners = addVideoListeners;
16070exports.setFullscreen = setFullscreen;
16071
16072},{}],111:[function(require,module,exports){
16073'use strict';
16074
16075Object.defineProperty(exports, "__esModule", {
16076  value: true
16077});
16078
16079function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
16080
16081exports.default = function (app) {
16082  var triggers = document.querySelectorAll('.js--vote');
16083
16084  if (!triggers) return;
16085
16086  [].concat(_toConsumableArray(triggers)).forEach(function (trigger) {
16087    trigger.addEventListener('click', vote);
16088  });
16089
16090  var voteWrappers = document.querySelectorAll('.js--voteWrapper');
16091  [].concat(_toConsumableArray(voteWrappers)).forEach(function (wrapper) {
16092    return addVoteWrapperHandlers(wrapper);
16093  });
16094
16095  function vote(event) {
16096    event.preventDefault();
16097    var el = event.target;
16098
16099    if (!el.classList.contains("js--vote--enabled")) {
16100      return;
16101    }
16102
16103    var vote = el.getAttribute('data-vote');
16104    var movie_id = el.getAttribute('data-movie_id');
16105    var name = el.getAttribute('data-name');
16106
16107    if (typeof vote == 'undefined' || !movie_id || !name) return;
16108
16109    var data = { vote: vote, movie_id: movie_id, name: name };
16110
16111    fetch('/vote/movie/', {
16112      method: 'POST',
16113      headers: new Headers({ 'Content-Type': 'application/json', 'is-ajax-call': 'yes' }),
16114      body: JSON.stringify(data),
16115      credentials: 'same-origin'
16116    }).then(function (blob) {
16117      return blob.json();
16118    }).then(function (json) {
16119      json.vote = data.vote;
16120      if (el.classList.contains("btn__thumbs--up")) {
16121        [].concat(_toConsumableArray(document.querySelectorAll(".btn__thumbs--up"))).forEach(function (e) {
16122          if (movie_id == e.getAttribute("data-movie_id")) {
16123            e.classList.add("btn__thumbs--selected");
16124          }
16125        });
16126      } else if (el.classList.contains("btn__thumbs--down")) {
16127        [].concat(_toConsumableArray(document.querySelectorAll(".btn__thumbs--down"))).forEach(function (e) {
16128          if (movie_id == e.getAttribute("data-movie_id")) {
16129            e.classList.add("btn__thumbs--selected");
16130          }
16131        });
16132      };
16133      [].concat(_toConsumableArray(document.querySelectorAll(".js--vote"))).forEach(function (e) {
16134        if (movie_id == e.getAttribute("data-movie_id")) {
16135          disable(e);
16136        }
16137      });
16138
16139      var percents = document.querySelectorAll('.js--vote--percent');
16140
16141      [].concat(_toConsumableArray(percents)).forEach(function (percent) {
16142        percent.innerText = json.talk.percent + '%';
16143      });
16144    }).catch(function (err) {
16145      return console.log(err);
16146    });
16147  }
16148
16149  function disable(el) {
16150    el.classList.remove("js--vote--enabled");
16151    el.setAttribute("title", "You already voted");
16152  }
16153
16154  function addVoteWrapperHandlers(wrapper) {
16155    wrapper.addEventListener('click', function (e) {
16156      if (e.target.classList.contains("js--vote")) {
16157        e.preventDefault();
16158
16159        vote(e);
16160      }
16161    });
16162  }
16163};
16164
16165},{}],112:[function(require,module,exports){
16166"use strict";
16167
16168Object.defineProperty(exports, "__esModule", {
16169  value: true
16170});
16171exports.handleWatchlistClick = undefined;
16172
16173var _helpers = require("../helpers/helpers");
16174
16175var _jsCookie = require("js-cookie");
16176
16177var _jsCookie2 = _interopRequireDefault(_jsCookie);
16178
16179var _listNotification = require("./v5/list-notification");
16180
16181function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16182
16183function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
16184
16185function addWatchlistWrapperHandlers(wrapper) {
16186  wrapper.addEventListener("click", function (e) {
16187    if (!e.defaultPrevented) {
16188      var watchlistBtn = e.target.closest(".js--addToWatchlist");
16189      if (watchlistBtn) {
16190        e.preventDefault();
16191
16192        handleWatchlistClick(watchlistBtn);
16193      }
16194    }
16195  });
16196}
16197
16198var timeoutId = void 0;
16199function handleWatchlistClick(btn) {
16200  var list = btn.getAttribute("data-list");
16201  var slug = btn.getAttribute("data-slug");
16202  var isOn = btn.getAttribute("data-on");
16203  var user = btn.getAttribute("data-user");
16204  var page = btn.getAttribute("data-page");
16205  var username = btn.getAttribute("data-username");
16206
16207  if (!list || !slug || !isOn) return;
16208
16209  if (!user) {
16210    if (cookie_ok) {
16211      _jsCookie2.default.set("login_redirect", window.location.href);
16212      _jsCookie2.default.set("watchlist_add", slug);
16213    }
16214    // const btnOpenNav = document.querySelector('.js--openMemberNav').click()
16215    location.href = "/member/login/";
16216    return;
16217  }
16218
16219  // if it's watchlist page remove item from the list and update the number of titles
16220  if (btn.classList.contains("watchlist-button")) {
16221    var item = document.querySelector(".js-" + slug);
16222    if (item) {
16223      item.remove();
16224    }
16225    var itemsCount = document.querySelector(".js-items-in-list");
16226    if (itemsCount) {
16227      var currentValue = parseInt(itemsCount.textContent, 10) || 0;
16228      itemsCount.textContent = currentValue - 1;
16229    }
16230  }
16231
16232  var watchlistWrappers = document.querySelectorAll(".js--addToWatchlistWrapper");
16233  var sameMovies = document.querySelectorAll(".js--addToWatchlist[data-slug='" + slug + "'");
16234
16235  if (isOn == "0") {
16236    btn.classList.add("on-watchlist");
16237    btn.setAttribute("data-on", 1);
16238
16239    // handle new advanced button
16240    var buttonParent = btn.parentElement;
16241    if (buttonParent.classList.contains("js-watchlist-advanced-buttons")) {
16242      buttonParent.classList.add("is-hidden");
16243      var oneMoreLevelUp = buttonParent.parentElement;
16244      if (oneMoreLevelUp) {
16245        var addedToWatchlistButton = oneMoreLevelUp.querySelector(".js-button-added-to-list");
16246        if (addedToWatchlistButton) {
16247          addedToWatchlistButton.classList.remove("is-hidden");
16248        }
16249      }
16250    }
16251
16252    // [...watchlistWrappers].forEach(wrapper=> { processWatchlistTrigger(wrapper, 1, page) });
16253    [].concat(_toConsumableArray(sameMovies)).forEach(function (movieWrapper) {
16254      processWatchlistTrigger(movieWrapper, 1, page);
16255    });
16256  }
16257  if (isOn == "1") {
16258    btn.classList.remove("on-watchlist");
16259    btn.setAttribute("data-on", 0);
16260    // [...watchlistWrappers].forEach(wrapper=> { processWatchlistTrigger(wrapper, 0, page) });
16261    [].concat(_toConsumableArray(sameMovies)).forEach(function (movieWrapper) {
16262      processWatchlistTrigger(movieWrapper, 0, page);
16263    });
16264  }
16265
16266  var data = { list: list, slug: slug, isOn: isOn };
16267
16268  fetch("/watchlist-toggle/", {
16269    method: "post",
16270    headers: new Headers({
16271      "content-type": "application/json",
16272      "is-ajax-call": "yes"
16273    }),
16274    body: JSON.stringify(data),
16275    credentials: "same-origin"
16276  }).then(function (blob) {
16277    var watchlistWithLink = "<a href=\"" + window.origin + "/member/" 
16277+ username + "/dashboard/\">watchlist</a>";
16278
16279    var notificationText = isOn == "1" ? "Removed from " + watchlistWithLink : "Added to " + watchlistWithLink;
16280    (0, _listNotification.openNotification)({ text: "" + notificationText });
16281    //   const modal = document.querySelector(".watchlist-popup");
16282    //   const watchlistText = document.querySelector(".js--watchlistText");
16283    //   const watchlistFavIcon = document.querySelector(
16284    //     ".watchlist-popup .watchlist-btn"
16285    //   );
16286    //   const watchlistFavIconWrapper = btn.querySelector(
16287    //     ".watchlist-icon-wrapper"
16288    //   );
16289    //   watchlistText.innerText = isOn == "1" ? "Removed from" : "Added to";
16290    //   watchlistFavIcon.classList.remove('watchlist-off-btn');
16291    //   watchlistFavIcon.classList.remove('watchlist-on-btn');
16292    //   if (isOn == "1") {
16293    //     watchlistFavIcon.classList.add("watchlist-off-btn");
16294
16295    //     if (watchlistFavIconWrapper) {
16296    //       watchlistFavIconWrapper.classList.remove("tick");
16297    //       watchlistFavIconWrapper.classList.add("plus");
16298    //       watchlistFavIconWrapper
16299    //         .querySelector("svg > use")
16300    //         .setAttribute("xlink:href", "#watchlist-add-v2");
16301
16302    //     }
16303    //   } else {
16304    //     watchlistFavIcon.classList.add("watchlist-on-btn");
16305
16306    //     if (watchlistFavIconWrapper) {
16307    //       watchlistFavIconWrapper.classList.remove("plus");
16308    //       watchlistFavIconWrapper.classList.add("tick");
16309    //       watchlistFavIconWrapper
16310    //         .querySelector("svg > use")
16311    //         .setAttribute("xlink:href", "#watchlist-remove-v2");
16312    //     }
16313    //   }
16314    //   modalsHandler("open", modal);
16315    // clearTimeout(timeoutId);
16316    //   timeoutId = setTimeout(() => {
16317    //     modalsHandler("close", modal);
16318    //   }, 5000);
16319  }).catch(function (err) {
16320    return console.error(err);
16321  });
16322}
16323
16324function processWatchlistTrigger(wrapper, is_on, page) {
16325  var watchlistAdvancedButtons = document.querySelector(".js-watchlist-advanced-buttons");
16326  var addedToListButton = document.querySelector(".js-button-added-to-list");
16327  if (is_on) {
16328    wrapper.classList.add("on-watchlist");
16329    if (watchlistAdvancedButtons && addedToListButton) {
16330      watchlistAdvancedButtons.classList.add("is-hidden");
16331      addedToListButton.classList.remove("is-hidden");
16332    }
16333    // if (page == "blog") {
16334    // 	const blogButtonIcon = wrapper.querySelector(".js--watchlist-blog-icon use")
16335    // 	blogButtonIcon.setAttribute("href", "#watchlistremove")
16336    // }
16337  } else {
16338    wrapper.classList.remove("on-watchlist");
16339    if (watchlistAdvancedButtons && addedToListButton) {
16340      watchlistAdvancedButtons.classList.remove("is-hidden");
16341      addedToListButton.classList.add("is-hidden");
16342    }
16343    // if (page == "blog") {
16344    // 	const blogButtonIcon = wrapper.querySelector(".js--watchlist-blog-icon use")
16345    // 	blogButtonIcon.setAttribute("href", "#watchlistadd")
16346    // }
16347  }
16348
16349  wrapper.setAttribute("data-on", is_on);
16350}
16351
16352exports.default = function (app) {
16353  var modal = document.querySelector(".watchlist-popup");
16354  var btnCloseForm = modal.querySelector(".js--closeReviewForm");
16355  var btnCloseFormWatchlist = modal.querySelector(".js--closeWatchlistForm");
16356  var watchlistWrappers = document.querySelectorAll(".js--addToWatchlistWrapper");
16357  [].concat(_toConsumableArray(watchlistWrappers)).forEach(function (wrapper) {
16358    return addWatchlistWrapperHandlers(wrapper);
16359  });
16360
16361  if (btnCloseForm) {
16362    btnCloseForm.addEventListener("click", function () {
16363      (0, _helpers.modalsHandler)("close", modal);
16364    });
16365  }
16366  if (btnCloseFormWatchlist) {
16367    btnCloseFormWatchlist.addEventListener("click", function () {
16368      (0, _helpers.modalsHandler)("close", modal);
16369    });
16370  }
16371};
16372
16373exports.handleWatchlistClick = handleWatchlistClick;
16374
16375},{"../helpers/helpers":3,"./v5/list-notification":67,"js-cookie":171}],113:[function(require,module,exports){
16376'use strict';
16377
16378var _ytPlayer = require('yt-player');
16379
16380var _ytPlayer2 = _interopRequireDefault(_ytPlayer);
16381
16382function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16383
16384var playerWrapper = document.querySelector('.js-yt-player');
16385if (playerWrapper) {
16386    var playerOuter = playerWrapper.parentElement.parentElement.parentElement;
16387    var player = new _ytPlayer2.default(playerWrapper);
16388    var popupTriggers = document.querySelectorAll('.js-yt-reveal');
16389    var closeButton = document.querySelector('.js-yt-close');
16390    var overlay = document.querySelector('.youtube-player');
16391    var lastVideoId = void 0;
16392
16393    popupTriggers.forEach(function (trigger) {
16394        trigger.addEventListener('click', function (e) {
16395            var videoID = e.target.dataset.id;
16396            // Don't load new video if the same one was clicked
16397            // Benefit: Plays the video from where it was paused
16398            if (videoID !== lastVideoId) {
16399                player.load(videoID);
16400            }
16401            player.play();
16402            playerOuter.classList.add('is-visible');
16403            lastVideoId = videoID;
16404        });
16405    });
16406
16407    closeButton.addEventListener('click', function (e) {
16408        playerOuter.classList.remove('is-visible');
16409        player.pause();
16410    });
16411
16412    overlay.addEventListener('click', function (e) {
16413        playerOuter.classList.remove('is-visible');
16414        player.pause();
16415    });
16416}
16417
16418},{"yt-player":201}],114:[function(require,module,exports){
16419(function (process){(function (){
16420!function(o,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((o="undefined"!=typeof globalThis?globalThis:o||self).jsApiLoader={})}(this,function(o){"use strict";const e=o=>{var e,n,r,t="The Google Maps JavaScript API",a="google",i="importLibrary",s="__ib__",p=document,c=window,l=c[a]||(c[a]={}),d=l.maps||(l.maps={}),m=new Set,g=new URLSearchParams;d[i]?console.warn(t+" only loads once. Ignoring:",o):d[i]=(c,...l)=>m.add(c)&&(e||(e=new Promise(async(i,c)=>{for(r in await(n=p.createElement("script")),g.set("libraries",[...m]+""),o)g.set(r.replace(/[A-Z]/g,o=>"_"+o[0].toLowerCase()),o[r]);g.set("callback",a+".maps."+s),function(o,e){o.src=e}(n,"https://maps.googleapis.com/maps/api/js?"+g),d[s]=i,n.onerror=()=>e=c(Error(t+" could not load.")),n.nonce=p.querySelector("script[nonce]")?.nonce||"",p.head.append(n)}))).then(()=>d[i](c,...l))};process.env.NODE_ENV;process.env.NODE_ENV;let n=!1;o.Loader=class{constructor(...o){throw new Error("[@googlemaps/js-api-loader]: The Loader class is no longer available in this version.\nPlease use the new functional API: setOptions() and importLibrary().\nFor more information, see the updated documentation at: https://github.com/googlemaps/js-api-loader/blob/main/README.md")}},o.importLibrary=async function(o){if(!window?.google?.maps?.importLibrary)throw new Error("google.maps.importLibrary is not installed.");return await google.maps.importLibrary(o)},o.setOptions=function(o){n?(o=>{JSON.stringify(o)})(o):(!function(o){const n=Boolean(window.google?.maps?.importLibrary);n&&(o=>{JSON.stringify(o)})(o);n||e(o)}(o),n=!0)}});
16421
16422
16423}).call(this)}).call(this,require('_process'))
16424},{"_process":185}],115:[function(require,module,exports){
16425(function (global){(function (){
16426'use strict';
16427
16428var possibleNames = require('possible-typed-array-names');
16429
16430var g = typeof globalThis === 'undefined' ? global : globalThis;
16431
16432/** @type {import('.')} */
16433module.exports = function availableTypedArrays() {
16434	var /** @type {ReturnType<typeof availableTypedArrays>} */ out = [];
16435	for (var i = 0; i < possibleNames.length; i++) {
16436		if (typeof g[possibleNames[i]] === 'function') {
16437			// @ts-expect-error
16438			out[out.length] = possibleNames[i];
16439		}
16440	}
16441	return out;
16442};
16443
16444}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
16445},{"possible-typed-array-names":184}],116
vendor: 14,934 bytes, lines 16445-16944
16445:[function(require,module,exports){
16446// Copyright Joyent, Inc. and other Node contributors.
16447//
16448// Permission is hereby granted, free of charge, to any person obtaining a
16449// copy of this software and associated documentation files (the
16450// "Software"), to deal in the Software without restriction, including
16451// without limitation the rights to use, copy, modify, merge, publish,
16452// distribute, sublicense, and/or sell copies of the Software, and to permit
16453// persons to whom the Software is furnished to do so, subject to the
16454// following conditions:
16455//
16456// The above copyright notice and this permission notice shall be included
16457// in all copies or substantial portions of the Software.
16458//
16459// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16460// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16461// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
16462// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16463// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16464// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
16465// USE OR OTHER DEALINGS IN THE SOFTWARE.
16466
16467'use strict';
16468
16469var R = typeof Reflect === 'object' ? Reflect : null
16470var ReflectApply = R && typeof R.apply === 'function'
16471  ? R.apply
16472  : function ReflectApply(target, receiver, args) {
16473    return Function.prototype.apply.call(target, receiver, args);
16474  }
16475
16476var ReflectOwnKeys
16477if (R && typeof R.ownKeys === 'function') {
16478  ReflectOwnKeys = R.ownKeys
16479} else if (Object.getOwnPropertySymbols) {
16480  ReflectOwnKeys = function ReflectOwnKeys(target) {
16481    return Object.getOwnPropertyNames(target)
16482      .concat(Object.getOwnPropertySymbols(target));
16483  };
16484} else {
16485  ReflectOwnKeys = function ReflectOwnKeys(target) {
16486    return Object.getOwnPropertyNames(target);
16487  };
16488}
16489
16490function ProcessEmitWarning(warning) {
16491  if (console && console.warn) console.warn(warning);
16492}
16493
16494var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
16495  return value !== value;
16496}
16497
16498function EventEmitter() {
16499  EventEmitter.init.call(this);
16500}
16501module.exports = EventEmitter;
16502module.exports.once = once;
16503
16504// Backwards-compat with node 0.10.x
16505EventEmitter.EventEmitter = EventEmitter;
16506
16507EventEmitter.prototype._events = undefined;
16508EventEmitter.prototype._eventsCount = 0;
16509EventEmitter.prototype._maxListeners = undefined;
16510
16511// By default EventEmitters will print a warning if more than 10 listeners are
16512// added to it. This is a useful default which helps finding memory leaks.
16513var defaultMaxListeners = 10;
16514
16515function checkListener(listener) {
16516  if (typeof listener !== 'function') {
16517    throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
16518  }
16519}
16520
16521Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
16522  enumerable: true,
16523  get: function() {
16524    return defaultMaxListeners;
16525  },
16526  set: function(arg) {
16527    if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
16528      throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
16529    }
16530    defaultMaxListeners = arg;
16531  }
16532});
16533
16534EventEmitter.init = function() {
16535
16536  if (this._events === undefined ||
16537      this._events === Object.getPrototypeOf(this)._events) {
16538    this._events = Object.create(null);
16539    this._eventsCount = 0;
16540  }
16541
16542  this._maxListeners = this._maxListeners || undefined;
16543};
16544
16545// Obviously not all Emitters should be limited to 10. This function allows
16546// that to be increased. Set to zero for unlimited.
16547EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
16548  if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
16549    throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
16550  }
16551  this._maxListeners = n;
16552  return this;
16553};
16554
16555function _getMaxListeners(that) {
16556  if (that._maxListeners === undefined)
16557    return EventEmitter.defaultMaxListeners;
16558  return that._maxListeners;
16559}
16560
16561EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
16562  return _getMaxListeners(this);
16563};
16564
16565EventEmitter.prototype.emit = function emit(type) {
16566  var args = [];
16567  for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
16568  var doError = (type === 'error');
16569
16570  var events = this._events;
16571  if (events !== undefined)
16572    doError = (doError && events.error === undefined);
16573  else if (!doError)
16574    return false;
16575
16576  // If there is no 'error' event listener then throw.
16577  if (doError) {
16578    var er;
16579    if (args.length > 0)
16580      er = args[0];
16581    if (er instanceof Error) {
16582      // Note: The comments on the `throw` lines are intentional, they show
16583      // up in Node's output if this results in an unhandled exception.
16584      throw er; // Unhandled 'error' event
16585    }
16586    // At least give some kind of context to the user
16587    var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
16588    err.context = er;
16589    throw err; // Unhandled 'error' event
16590  }
16591
16592  var handler = events[type];
16593
16594  if (handler === undefined)
16595    return false;
16596
16597  if (typeof handler === 'function') {
16598    ReflectApply(handler, this, args);
16599  } else {
16600    var len = handler.length;
16601    var listeners = arrayClone(handler, len);
16602    for (var i = 0; i < len; ++i)
16603      ReflectApply(listeners[i], this, args);
16604  }
16605
16606  return true;
16607};
16608
16609function _addListener(target, type, listener, prepend) {
16610  var m;
16611  var events;
16612  var existing;
16613
16614  checkListener(listener);
16615
16616  events = target._events;
16617  if (events === undefined) {
16618    events = target._events = Object.create(null);
16619    target._eventsCount = 0;
16620  } else {
16621    // To avoid recursion in the case that type === "newListener"! Before
16622    // adding it to the listeners, first emit "newListener".
16623    if (events.newListener !== undefined) {
16624      target.emit('newListener', type,
16625                  listener.listener ? listener.listener : listener);
16626
16627      // Re-assign `events` because a newListener handler could have caused the
16628      // this._events to be assigned to a new object
16629      events = target._events;
16630    }
16631    existing = events[type];
16632  }
16633
16634  if (existing === undefined) {
16635    // Optimize the case of one listener. Don't need the extra array object.
16636    existing = events[type] = listener;
16637    ++target._eventsCount;
16638  } else {
16639    if (typeof existing === 'function') {
16640      // Adding the second element, need to change to array.
16641      existing = events[type] =
16642        prepend ? [listener, existing] : [existing, listener];
16643      // If we've already got an array, just append.
16644    } else if (prepend) {
16645      existing.unshift(listener);
16646    } else {
16647      existing.push(listener);
16648    }
16649
16650    // Check for listener leak
16651    m = _getMaxListeners(target);
16652    if (m > 0 && existing.length > m && !existing.warned) {
16653      existing.warned = true;
16654      // No error code for this since it is a Warning
16655      // eslint-disable-next-line no-restricted-syntax
16656      var w = new Error('Possible EventEmitter memory leak detected. ' +
16657                          existing.length + ' ' + String(type) + ' listeners ' +
16658                          'added. Use emitter.setMaxListeners() to ' +
16659                          'increase limit');
16660      w.name = 'MaxListenersExceededWarning';
16661      w.emitter = target;
16662      w.type = type;
16663      w.count = existing.length;
16664      ProcessEmitWarning(w);
16665    }
16666  }
16667
16668  return target;
16669}
16670
16671EventEmitter.prototype.addListener = function addListener(type, listener) {
16672  return _addListener(this, type, listener, false);
16673};
16674
16675EventEmitter.prototype.on = EventEmitter.prototype.addListener;
16676
16677EventEmitter.prototype.prependListener =
16678    function prependListener(type, listener) {
16679      return _addListener(this, type, listener, true);
16680    };
16681
16682function onceWrapper() {
16683  if (!this.fired) {
16684    this.target.removeListener(this.type, this.wrapFn);
16685    this.fired = true;
16686    if (arguments.length === 0)
16687      return this.listener.call(this.target);
16688    return this.listener.apply(this.target, arguments);
16689  }
16690}
16691
16692function _onceWrap(target, type, listener) {
16693  var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
16694  var wrapped = onceWrapper.bind(state);
16695  wrapped.listener = listener;
16696  state.wrapFn = wrapped;
16697  return wrapped;
16698}
16699
16700EventEmitter.prototype.once = function once(type, listener) {
16701  checkListener(listener);
16702  this.on(type, _onceWrap(this, type, listener));
16703  return this;
16704};
16705
16706EventEmitter.prototype.prependOnceListener =
16707    function prependOnceListener(type, listener) {
16708      checkListener(listener);
16709      this.prependListener(type, _onceWrap(this, type, listener));
16710      return this;
16711    };
16712
16713// Emits a 'removeListener' event if and only if the listener was removed.
16714EventEmitter.prototype.removeListener =
16715    function removeListener(type, listener) {
16716      var list, events, position, i, originalListener;
16717
16718      checkListener(listener);
16719
16720      events = this._events;
16721      if (events === undefined)
16722        return this;
16723
16724      list = events[type];
16725      if (list === undefined)
16726        return this;
16727
16728      if (list === listener || list.listener === listener) {
16729        if (--this._eventsCount === 0)
16730          this._events = Object.create(null);
16731        else {
16732          delete events[type];
16733          if (events.removeListener)
16734            this.emit('removeListener', type, list.listener || listener);
16735        }
16736      } else if (typeof list !== 'function') {
16737        position = -1;
16738
16739        for (i = list.length - 1; i >= 0; i--) {
16740          if (list[i] === listener || list[i].listener === listener) {
16741            originalListener = list[i].listener;
16742            position = i;
16743            break;
16744          }
16745        }
16746
16747        if (position < 0)
16748          return this;
16749
16750        if (position === 0)
16751          list.shift();
16752        else {
16753          spliceOne(list, position);
16754        }
16755
16756        if (list.length === 1)
16757          events[type] = list[0];
16758
16759        if (events.removeListener !== undefined)
16760          this.emit('removeListener', type, originalListener || listener);
16761      }
16762
16763      return this;
16764    };
16765
16766EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
16767
16768EventEmitter.prototype.removeAllListeners =
16769    function removeAllListeners(type) {
16770      var listeners, events, i;
16771
16772      events = this._events;
16773      if (events === undefined)
16774        return this;
16775
16776      // not listening for removeListener, no need to emit
16777      if (events.removeListener === undefined) {
16778        if (arguments.length === 0) {
16779          this._events = Object.create(null);
16780          this._eventsCount = 0;
16781        } else if (events[type] !== undefined) {
16782          if (--this._eventsCount === 0)
16783            this._events = Object.create(null);
16784          else
16785            delete events[type];
16786        }
16787        return this;
16788      }
16789
16790      // emit removeListener for all listeners on all events
16791      if (arguments.length === 0) {
16792        var keys = Object.keys(events);
16793        var key;
16794        for (i = 0; i < keys.length; ++i) {
16795          key = keys[i];
16796          if (key === 'removeListener') continue;
16797          this.removeAllListeners(key);
16798        }
16799        this.removeAllListeners('removeListener');
16800        this._events = Object.create(null);
16801        this._eventsCount = 0;
16802        return this;
16803      }
16804
16805      listeners = events[type];
16806
16807      if (typeof listeners === 'function') {
16808        this.removeListener(type, listeners);
16809      } else if (listeners !== undefined) {
16810        // LIFO order
16811        for (i = listeners.length - 1; i >= 0; i--) {
16812          this.removeListener(type, listeners[i]);
16813        }
16814      }
16815
16816      return this;
16817    };
16818
16819function _listeners(target, type, unwrap) {
16820  var events = target._events;
16821
16822  if (events === undefined)
16823    return [];
16824
16825  var evlistener = events[type];
16826  if (evlistener === undefined)
16827    return [];
16828
16829  if (typeof evlistener === 'function')
16830    return unwrap ? [evlistener.listener || evlistener] : [evlistener];
16831
16832  return unwrap ?
16833    unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
16834}
16835
16836EventEmitter.prototype.listeners = function listeners(type) {
16837  return _listeners(this, type, true);
16838};
16839
16840EventEmitter.prototype.rawListeners = function rawListeners(type) {
16841  return _listeners(this, type, false);
16842};
16843
16844EventEmitter.listenerCount = function(emitter, type) {
16845  if (typeof emitter.listenerCount === 'function') {
16846    return emitter.listenerCount(type);
16847  } else {
16848    return listenerCount.call(emitter, type);
16849  }
16850};
16851
16852EventEmitter.prototype.listenerCount = listenerCount;
16853function listenerCount(type) {
16854  var events = this._events;
16855
16856  if (events !== undefined) {
16857    var evlistener = events[type];
16858
16859    if (typeof evlistener === 'function') {
16860      return 1;
16861    } else if (evlistener !== undefined) {
16862      return evlistener.length;
16863    }
16864  }
16865
16866  return 0;
16867}
16868
16869EventEmitter.prototype.eventNames = function eventNames() {
16870  return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
16871};
16872
16873function arrayClone(arr, n) {
16874  var copy = new Array(n);
16875  for (var i = 0; i < n; ++i)
16876    copy[i] = arr[i];
16877  return copy;
16878}
16879
16880function spliceOne(list, index) {
16881  for (; index + 1 < list.length; index++)
16882    list[index] = list[index + 1];
16883  list.pop();
16884}
16885
16886function unwrapListeners(arr) {
16887  var ret = new Array(arr.length);
16888  for (var i = 0; i < ret.length; ++i) {
16889    ret[i] = arr[i].listener || arr[i];
16890  }
16891  return ret;
16892}
16893
16894function once(emitter, name) {
16895  return new Promise(function (resolve, reject) {
16896    function errorListener(err) {
16897      emitter.removeListener(name, resolver);
16898      reject(err);
16899    }
16900
16901    function resolver() {
16902      if (typeof emitter.removeListener === 'function') {
16903        emitter.removeListener('error', errorListener);
16904      }
16905      resolve([].slice.call(arguments));
16906    };
16907
16908    eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
16909    if (name !== 'error') {
16910      addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
16911    }
16912  });
16913}
16914
16915function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
16916  if (typeof emitter.on === 'function') {
16917    eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
16918  }
16919}
16920
16921function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
16922  if (typeof emitter.on === 'function') {
16923    if (flags.once) {
16924      emitter.once(name, listener);
16925    } else {
16926      emitter.on(name, listener);
16927    }
16928  } else if (typeof emitter.addEventListener === 'function') {
16929    // EventTarget does not have `error` event semantics like Node
16930    // EventEmitters, we do not listen for `error` events here.
16931    emitter.addEventListener(name, function wrapListener(arg) {
16932      // IE does not have builtin `{ once: true }` support so we
16933      // have to do it manually.
16934      if (flags.once) {
16935        emitter.removeEventListener(name, wrapListener);
16936      }
16937      listener(arg);
16938    });
16939  } else {
16940    throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
16941  }
16942}
16943
16944},{}],1
1694417:[function(require,module,exports){
16945'use strict';
16946
16947var bind = require('function-bind');
16948
16949var $apply = require('./functionApply');
16950var $call = require('./functionCall');
16951var $reflectApply = require('./reflectApply');
16952
16953/** @type {import('./actualApply')} */
16954module.exports = $reflectApply || bind.call($call, $apply);
16955
16956},{"./functionApply":119,"./functionCall":120,"./reflectApply":122,"function-bind":151}],118:[function(require,module,exports){
16957'use strict';
16958
16959var bind = require('function-bind');
16960var $apply = require('./functionApply');
16961var actualApply = require('./actualApply');
16962
16963/** @type {import('./applyBind')} */
16964module.exports = function applyBind() {
16965	return actualApply(bind, $apply, arguments);
16966};
16967
16968},{"./actualApply":117,"./functionApply":119,"function-bind":151}],119:[function(require,module,exports){
16969'use strict';
16970
16971/** @type {import('./functionApply')} */
16972module.exports = Function.prototype.apply;
16973
16974},{}],120:[function(require,module,exports){
16975'use strict';
16976
16977/** @type {import('./functionCall')} */
16978module.exports = Function.prototype.call;
16979
16980},{}],121:[function(require,module,exports){
16981'use strict';
16982
16983var bind = require('function-bind');
16984var $TypeError = require('es-errors/type');
16985
16986var $call = require('./functionCall');
16987var $actualApply = require('./actualApply');
16988
16989/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
16990module.exports = function callBindBasic(args) {
16991	if (args.length < 1 || typeof args[0] !== 'function') {
16992		throw new $TypeError('a function is required');
16993	}
16994	return $actualApply(bind, $call, args);
16995};
16996
16997},{"./actualApply":117,"./functionCall":120,"es-errors/type":146,"function-bind":151}],122:[function(require,module,exports){
16998'use strict';
16999
17000/** @type {import('./reflectApply')} */
17001module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
17002
17003},{}],123:[function(require,module,exports){
17004'use strict';
17005
17006var setFunctionLength = require('set-function-length');
17007
17008var $defineProperty = require('es-define-property');
17009
17010var callBindBasic = require('call-bind-apply-helpers');
17011var applyBind = require('call-bind-apply-helpers/applyBind');
17012
17013module.exports = function callBind(originalFunction) {
17014	var func = callBindBasic(arguments);
17015	var adjustedLength = originalFunction.length - (arguments.length - 1);
17016	return setFunctionLength(
17017		func,
17018		1 + (adjustedLength > 0 ? adjustedLength : 0),
17019		true
17020	);
17021};
17022
17023if ($defineProperty) {
17024	$defineProperty(module.exports, 'apply', { value: applyBind });
17025} else {
17026	module.exports.apply = applyBind;
17027}
17028
17029},{"call-bind-apply-helpers":121,"call-bind-apply-helpers/applyBind":118,"es-define-property":140,"set-function-length":189}],124:[function(require,module,exports){
17030'use strict';
17031
17032var GetIntrinsic = require('get-intrinsic');
17033
17034var callBindBasic = require('call-bind-apply-helpers');
17035
17036/** @type {(thisArg: string, searchString: string, position?: number) => number} */
17037var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
17038
17039/** @type {import('.')} */
17040module.exports = function callBoundIntrinsic(name, allowMissing) {
17041	/* eslint no-extra-parens: 0 */
17042
17043	var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
17044	if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
17045		return callBindBasic(/** @type {const} */ ([intrinsic]));
17046	}
17047	return intrinsic;
17048};
17049
17050},{"call-bind-apply-helpers":121,"get-intrinsic":154}],125:[function(require,module,exports){
17051!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t||self).ColorThief=n()}(this,function(){var t=function(t,n){return t<n?-1:t>n?1:0},n=function(t){return t.reduce(function(t,n){return t+n},0)},r=/*#__PURE__*/function(){function t(t){this.colors=t}var n=t.prototype;return n.palette=function(){return this.colors},n.map=function(t){return t},t}(),o=function(){function o(t,n,r){return(t<<10)+(n<<5)+r}function e(t){var n=[],r=!1;function o(){n.sort(t),r=!0}return{push:function(t){n.push(t),r=!1},peek:function(t){return r||o(),void 0===t&&(t=n.length-1),n[t]},pop:function(){return r||o(),n.pop()},size:function(){return n.length},map:function(t){return n.map(t)},debug:function(){return r||o(),n}}}function i(t,n,r,o,e,i,u){var a=this;a.r1=t,a.r2=n,a.g1=r,a.g2=o,a.b1=e,a.b2=i,a.histo=u}
17051function u(){this.vboxes=new e(function(n,r){return t(n.vbox.count()*n.vbox.volume(),r.vbox.count()*r.vbox.volume())})}function a(t,n){if(n.count()){var r=n.r2-n.r1+1,e=n.g2-n.g1+1,i=Math.max.apply(null,[r,e,n.b2-n.b1+1]);if(1==n.count())return[n.copy()];var u,a,c,f,s=0,h=[],l=[];if(i==r)for(u=n.r1;u<=n.r2;u++){for(f=0,a=n.g1;a<=n.g2;a++)for(c=n.b1;c<=n.b2;c++)f+=t[o(u,a,c)]||0;h[u]=s+=f}else if(i==e)for(u=n.g1;u<=n.g2;u++){for(f=0,a=n.r1;a<=n.r2;a++)for(c=n.b1;c<=n.b2;c++)f+=t[o(a,u,c)]||0;h[u]=s+=f}else for(u=n.b1;u<=n.b2;u++){for(f=0,a=n.r1;a<=n.r2;a++)for(c=n.g1;c<=n.g2;c++)f+=t[o(a,c,u)]||0;h[u]=s+=f}return h.forEach(function(t,n){l[n]=s-t}),function(t){var r,o,e,i,a,c=t+"1",f=t+"2",v=0;for(u=n[c];u<=n[f];u++)if(h[u]>s/2){for(e=n.copy(),i=n.copy(),a=(r=u-n[c])<=(o=n[f]-u)?Math.min(n[f]-1,~~(u+o/2)):Math.max(n[c],~~(u-1-r/2));!h[a];)a++;for(v=l[a];!v&&h[a-1];)v=l[--a];return e[f]=a,i[c]=e[f]+1,[e,i]}}(i==r?"r":i==e?"g":"b")}}return i.prototype={volume:function(t){var n=this;return n._volume&&!t||(n._volume=(n.r2-n.r1+1)*(n.g2-n.g1+1)*(n.b2-n.b1+1)),n._volume},count:function(t){var n=this,r=n.histo;if(!n._count_set||t){var e,i,u,a=0;for(e=n.r1;e<=n.r2;e++)for(i=n.g1;i<=n.g2;i++)for(u=n.b1;u<=n.b2;u++)a+=r[o(e,i,u)]||0;n._count=a,n._count_set=!0}return n._count},copy:function(){var t=this;return new i(t.r1,t.r2,t.g1,t.g2,t.b1,t.b2,t.histo)},avg:function(t){var n=this,r=n.histo;if(!n._avg||t){var e,i,u,a,c=0,f=0,s=0,h=0;if(n.r1===n.r2&&n.g1===n.g2&&n.b1===n.b2)n._avg=[n.r1<<3,n.g1<<3,n.b1<<3];else{for(i=n.r1;i<=n.r2;i++)for(u=n.g1;u<=n.g2;u++)for(a=n.b1;a<=n.b2;a++)c+=e=r[o(i,u,a)]||0,f+=e*(i+.5)*8,s+=e*(u+.5)*8,h+=e*(a+.5)*8;n._avg=c?[~~(f/c),~~(s/c),~~(h/c)]:[~~(8*(n.r1+n.r2+1)/2),~~(8*(n.g1+n.g2+1)/2),~~(8*(n.b1+n.b2+1)/2)]}}return n._avg},contains:function(t){var n=this,r=t[0]>>3;return gval=t[1]>>3,bval=t[2]>>3,r>=n.r1&&r<=n.r2&&gval>=n.g1&&gval<=n.g2&&bval>=n.b1&&bval<=n.b2}},u.prototype={push:function(t){this.vboxes.push({vbox:t,color:t.avg()})},palette:function(){return this.vboxes.map(function(t){return t.color})},size:function(){return this.vboxes.size()},map:function(t){for(var n=this.vboxes,r=0;r<n.size();r++)if(n.peek(r).vbox.contains(t))return n.peek(r).color;return this.nearest(t)},nearest:function(t){for(var n,r,o,e=this.vboxes,i=0;i<e.size();i++)((r=Math.sqrt(Math.pow(t[0]-e.peek(i).color[0],2)+Math.pow(t[1]-e.peek(i).color[1],2)+Math.pow(t[2]-e.peek(i).color[2],2)))<n||void 0===n)&&(n=r,o=e.peek(i).color);return o},forcebw:function(){var r=this.vboxes;r.sort(function(r,o){return t(n(r.color),n(o.color))});var o=r[0].color;o[0]<5&&o[1]<5&&o[2]<5&&(r[0].color=[0,0,0]);var e=r.length-1,i=r[e].color;i[0]>251&&i[1]>251&&i[2]>251&&(r[e].color=[255,255,255])}},{quantize:function(n,c){if(!Number.isInteger(c)||c<1||c>256)throw new Error("Invalid maximum color count. It must be an integer between 1 and 256.");if(!n.length||c<2||c>256)return!1;if(!n.length||c<2||c>256)return!1;for(var f=[],s=new Set,h=0;h<n.length;h++){var l=n[h],v=l.join(",");s.has(v)||(s.add(v),f.push(l))}if(f.length<=c)return new r(f);var g=function(t){var n,r=new Array(32768);return t.forEach(function(t){n=o(t[0]>>3,t[1]>>3,t[2]>>3),r[n]=(r[n]||0)+1}),r}(n);g.forEach(function(){});var p=function(t,n){var r,o,e,u=1e6,a=0,c=1e6,f=0,s=1e6,h=0;return t.forEach(function(t){(r=t[0]>>3)<u?u=r:r>a&&(a=r),(o=t[1]>>3)<c?c=o:o>f&&(f=o),(e=t[2]>>3)<s?s=e:e>h&&(h=e)}),new i(u,a,c,f,s,h,n)}(n,g),b=new e(function(n,r){return t(n.count(),r.count())});function d(t,n){for(var r,o=t.size(),e=0;e<1e3;){if(o>=n)return;if(e++>1e3)return;if((r=t.pop()).count()){var i=a(g,r),u=i[0],c=i[1];if(!u)return;t.push(u),c&&(t.push(c),o++)}else t.push(r),e++}}b.push(p),d(b,.75*c);for(var m=new e(function(n,r){return t(n.count()*n.volume(),r.count()*r.volume())});b.size();)m.push(b.pop());d(m,c);for(var w=new u;m.size();)w.push(m.pop());return w}}}().quantize,e=function(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.width=this.canvas.width=t.naturalWidth,this.height=this.canvas.height=t.naturalHeight,this.context.drawImage(t,0,0,this.width,this.height)};e.prototype.getImageData=function(){return this.context.getImageData(0,0,this.width,this.height)};var u=function(){};return u.prototype.getColor=function(t,n){return void 0===n&&(n=10),this.getPalette(t,5,n)[0]},u.prototype.getPalette=function(t,n,r){var i=function(t){var n=t.colorCount,r=t.quality;if(void 0!==n&&Number.isInteger(n)){if(1===n)throw new Error("colorCount should be between 2 and 20. To get one color, call getColor() instead of getPalette()");n=Math.max(n,2),n=Math.min(n,20)}else n=10;return(void 0===r||!Number.isInteger(r)||r<1)&&(r=10),{colorCount:n,quality:r}}({colorCount:n,quality:r}),u=new e(t),a=function(t,n,r){for(var o,e,i,u,a,c=t,f=[],s=0;s<n;s+=r)e=c[0+(o=4*s)],i=c[o+1],u=c[o+2],(void 0===(a=c[o+3])||a>=125)&&(e>250&&i>250&&u>250||f.push([e,i,u]));return f}(u.getImageData().data,u.width*u.height,i.quality),c=o(a,i.colorCount);return c?c.palette():null},u.prototype.getColorFromUrl=function(t,n,r){var o=this,e=document.createElement("img");e.addEventListener("load",function(){var i=o.getPalette(e,5,r);n(i[0],t)}),e.src=t},u.prototype.getImageData=function(t,n){var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){if(200==this.status){var t=new Uint8Array(this.response);i=t.length;for(var r=new Array(i),o=0;o<t.length;o++)r[o]=String.fromCharCode(t[o]);var e=r.join(""),u=window.btoa(e);n("data:image/png;base64,"+u)}},r.send()},u.prototype.getColorAsync=function(t,n,r){var o=this;this.getImageData(t,function(t){var e=document.createElement("img");e.addEventListener("load",function(){var t=o.getPalette(e,5,r);n(t[0],this)}),e.src=t})},u});
17052
17053},{}],126:[function(require,module,exports){
17054/**
17055 * Module dependencies.
17056 */
17057var format = require('util').format;
17058var isArray = require('util').isArray;
17059
17060
17061/**
17062 * Expose `flash()` function on requests.
17063 *
17064 * @return {Function}
17065 * @api public
17066 */
17067module.exports = function flash(options) {
17068  options = options || {};
17069  var safe = (options.unsafe === undefined) ? true : !options.unsafe;
17070  
17071  return function(req, res, next) {
17072    if (req.flash && safe) { return next(); }
17073    req.flash = _flash;
17074    next();
17075  }
17076}
17077
17078/**
17079 * Queue flash `msg` of the given `type`.
17080 *
17081 * Examples:
17082 *
17083 *      req.flash('info', 'email sent');
17084 *      req.flash('error', 'email delivery failed');
17085 *      req.flash('info', 'email re-sent');
17086 *      // => 2
17087 *
17088 *      req.flash('info');
17089 *      // => ['email sent', 'email re-sent']
17090 *
17091 *      req.flash('info');
17092 *      // => []
17093 *
17094 *      req.flash();
17095 *      // => { error: ['email delivery failed'], info: [] }
17096 *
17097 * Formatting:
17098 *
17099 * Flash notifications also support arbitrary formatting support.
17100 * For example you may pass variable arguments to `req.flash()`
17101 * and use the %s specifier to be replaced by the associated argument:
17102 *
17103 *     req.flash('info', 'email has been sent to %s.', userName);
17104 *
17105 * Formatting uses `util.format()`, which is available on Node 0.6+.
17106 *
17107 * @param {String} type
17108 * @param {String} msg
17109 * @return {Array|Object|Number}
17110 * @api public
17111 */
17112function _flash(type, msg) {
17113  if (this.session === undefined) throw Error('req.flash() requires sessions');
17114  var msgs = this.session.flash = this.session.flash || {};
17115  if (type && msg) {
17116    // util.format is available in Node.js 0.6+
17117    if (arguments.length > 2 && format) {
17118      var args = Array.prototype.slice.call(arguments, 1);
17119      msg = format.apply(undefined, args);
17120    } else if (isArray(msg)) {
17121      msg.forEach(function(val){
17122        (msgs[type] = msgs[type] || []).push(val);
17123      });
17124      return msgs[type].length;
17125    }
17126    return (msgs[type] = msgs[type] || []).push(msg);
17127  } else if (type) {
17128    var arr = msgs[type];
17129    delete msgs[type];
17130    return arr || [];
17131  } else {
17132    this.session.flash = {};
17133    return msgs;
17134  }
17135}
17136
17137},{"util":198}],127:[function(require,module,exports){
17138/**
17139 * Expose middleware.
17140 */
17141exports = module.exports = require('./flash');
17142
17143},{"./flash":126}],128:[function(require,module,exports){
17144!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}
vendor: 5,420 bytes, line 17144
17144|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))}
17144,m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
17145},{}],129:[function(require,module,exports){
17146!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs_plugin_timezone=e()}(this,(function(){"use strict";var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){void 0===i&&(i={});var o=new Date(t),r=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r}(n,i);return r.formatToParts(o)},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10))}var d=r[3],l=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",v=+e;return(o.utc(h).valueOf()-(v-=v%1e3))/6e4},f=i.prototype;f.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),a=this.toDate(),u=a.toLocaleString("en-US",{timeZone:t}),f=Math.round((a-new Date(u))/1e3/60),s=15*-Math.round(a.getTimezoneOffset()/15)-f;if(!Number(s))n=this.utcOffset(0,e);else if(n=o(u,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(s,!0),e){var m=n.utcOffset();n=n.add(i-m,"minute")}return n.$x.$timezone=t,n},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return n&&n.value};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return s.call(n,t,e).tz(this.$x.$timezone,!0)},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return[i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)]}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(t){r=t}}}));
17147},{}],130:[function(require,module,exports){
17148!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs_plugin_utc=i()}(this,(function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var r=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),r.call(this,t)};var o=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else o.call(this)};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s;if(0===u)return this.utc(f);var r=this.clone();if(f)return r.$offset=u,r.$u=!1,r;var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(r=this.local().add(u+o,t)).$offset=u,r.$x.$localOffset=o,r};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return"s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)}}}));
17149},{}],131:[function(require,module,exports){
17150"use strict";
17151var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17152    if (k2 === undefined) k2 = k;
17153    var desc = Object.getOwnPropertyDescriptor(m, k);
17154    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17155      desc = { enumerable: true, get: function() { return m[k]; } };
17156    }
17157    Object.defineProperty(o, k2, desc);
17158}) : (function(o, m, k, k2) {
17159    if (k2 === undefined) k2 = k;
17160    o[k2] = m[k];
17161}));
17162var __exportStar = (this && this.__exportStar) || function(m, exports
17162) {
17163    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17164};
17165Object.defineProperty(exports, "__esModule", { value: true });
17166__exportStar(require("./input_preprocessor"), exports);
17167__exportStar(require("./word_filter"), exports);
17168__exportStar(require("./wordlist_preprocessor"), exports);
17169
17170},{"./input_preprocessor":132,"./word_filter":136,"./wordlist_preprocessor":137}],132:[function(require,module,exports){
17171"use strict";
17172Object.defineProperty(exports, "__esModule", { value: true });
17173exports.reduceRepeatCharacters = exports.textToLatin = exports.removeTextAccents = exports.unEmoji = void 0;
17174/**
17175 * Replaces all emojis in a text that feature a letter with
17176 * normal latin characters.
17177 * Example: "🇬⭕ 🔛" turns into "go on" or
17178 * "🅿🇺®️💰🇪" turns into "purse".
17179 * Note: This does NOT replace random emojis used to represent
17180 * or mask letters, such as '🌸' representing an 'O'.
17181 *
17182 * Suggested usage: `textToLatin(unEmoji(inputText))`
17183 * @param {string} inputText - The text from which you would like to remove all text based emojis.
17184 * @returns the input text, with all letter based emojis transformed to become text.
17185 */
17186function unEmoji(inputText) {
17187    return inputText
17188        .replace(/🆔/g, 'id')
17189        .replace(/🆚/g, 'vs')
17190        .replace(/🔤/g, 'abc')
17191        .replace(/🆎/g, 'ab')
17192        .replace(/🆑/g, 'cl')
17193        .replace(/🆘/g, 'sos')
17194        .replace(/🚾/g, 'wc')
17195        .replace(/🆖/g, 'ng')
17196        .replace(/🆗/g, 'ok')
17197        .replace(/🆙/g, 'up')
17198        .replace(/🆒/g, 'cool')
17199        .replace(/🆕/g, 'new')
17200        .replace(/🔟/g, '10')
17201        .replace(/🆓/g, 'free')
17202        .replace(/🔚/g, 'end')
17203        .replace(/🔙/g, 'back')
17204        .replace(/🔛/g, 'on')
17205        .replace(/🔝/g, 'top')
17206        .replace(/🔜/g, 'soon')
17207        .replace(/🇦|🅰/g, 'a')
17208        .replace(/🇧|🅱/g, 'b')
17209        .replace(/🇨|©️/g, 'c')
17210        .replace(/🇩/g, 'd')
17211        .replace(/🇪/g, 'e')
17212        .replace(/🇫/g, 'f')
17213        .replace(/🇬/g, 'g')
17214        .replace(/🇭/g, 'h')
17215        .replace(/🇮/g, 'i')
17216        .replace(/🇯/g, 'j')
17217        .replace(/🇰/g, 'k')
17218        .replace(/🇱/g, 'l')
17219        .replace(/🇲/g, 'm')
17220        .replace(/🇳/g, 'n')
17221        .replace(/🇴|🅾|⭕/g, 'o')
17222        .replace(/🇵|🅿/g, 'p')
17223        .replace(/🇶/g, 'q')
17224        .replace(/🇷|®️/g, 'r')
17225        .replace(/🇸|💰/g, 's')
17226        .replace(/🇹/g, 't')
17227        .replace(/🇺/g, 'u')
17228        .replace(/🇻/g, 'v')
17229        .replace(/🇼/g, 'w')
17230        .replace(/🇽|❎|❌/g, 'x')
17231        .replace(/🇾/g, 'y')
17232        .replace(/🇿/g, 'z');
17233}
17234exports.unEmoji = unEmoji;
17235/**
17236 * Removes most common accents from characters.
17237 * Example: The text "Z̵̡̭͝ả̶̬̘̈́l̶̜͗g̵̜̲͒́o̶̞̅̊" becomes "Zalgo",
17238 * the text "à-côtés" becomes "a-cotes",
17239 * non-latin characters stay non-latin, e.g. "ᑕⓞ֑ο̤͕𝕃ܑׅ" becomes "ᑕⓞο𝕃".
17240 * @param {string} inputText - The text for which you wish to have all
17241 * accents removed.
17242 * @returns the input text, stripped of all accents.
17243 */
17244function removeTextAccents(inputText) {
17245    return inputText
17246        .normalize('NFD')
17247        .replace(/[\u0300-\u036f]|[\u0591-\u05bd]|\u05bf|\u05c1|\u05c2|\u05c4|\u05c5|\u05c7|\u0711|[\u0730-\u074a]/g, '');
17248}
17249exports.removeTextAccents = removeTextAccents;
17250/**
17251 * Converts a text of fancy unicode font to latin alphabet characters.
17252 * This translation happens based on "visual appearance" of the letters,
17253 * so if you do this to text that is written in a language of non-latin
17254 * alphabet, you will get weird outputs.
17255 *
17256 * Disclaimer: This may at times mistranslate messages, and the list of
17257 * characters that get converted is most likely not complete, although
17258 * it is very thoroughly assembled. It will remove most common accents,
17259 * and returns a latin string in lower case letters. Any characters that
17260 * could not be mapped to latin characters will still appear in the string.
17261 *
17262 * Example:
17263 * "ᵺⓘ꯱ ₮Ꮛ乂Շ" would turn into "this text" or "Z̵̡̭͝ả̶̬̘̈́l̶̜͗g̵̜̲͒́o̶̞̅̊" turns into "zalgo", or
17264 * "ᑕⓞ֑ο̤͕𝕃ܑׅ" turns into "cool".
17265 *
17266 * Suggested usage: `textToLatin(unEmoji(inputText))`
17267 * @param {string} inputText - The text which you would like to convert to latin
17268 * @returns the input text, with foreign or special alphabet letters translated
17269 * to latin lower case characters
17270 */
17271function textToLatin(inputText) {
17272    inputText = removeTextAccents(inputText);
17273    inputText = unEmoji(inputText);
17274    // replace upper case letters that look different in lower case
17275    inputText = inputText
17276        .replace(/Ð/g, 'd')
17277        .replace(/Σ/g, 'e')
17278        .replace(/Ⴚ/g, 'g')
17279        .replace(/Η/g, 'h')
17280        .replace(/Ꮰ/g, 'j')
17281        .replace(/Μ/g, 'm')
17282        .replace(/Ꭴ/g, 'q')
17283        .replace(/Շ/g, 't')
17284        .replace(/Ô±/g, 'u')
17285        .replace(/Հ/g, 'z');
17286    // convert to lower case and replace the rest
17287    inputText = inputText.toLowerCase();
17288    return inputText
17289        .replace(/ᴀ|ₐ|ᴬ|ᵃ|α|ⱥ|ɐ|ᶏ|ẚ|𝐚|𝐀|𝑎|𝐴|𝑨|𝒂|𝖺|𝖠|ⓐ|𝔞|𝔄|𝖆|𝕬|𝓪|𝓐|𝒶|𝒜|𝕒|𝔸|a|🄰|ɑ|ค|𝗮|𝗔|𝘢|𝘈|𝙖|𝘼|𝚊|𝙰|λ|₳|卂|ム|ᗩ/g, 'a')
17290        .replace(/ᴁ|æ|ᴂ/g, 'ae')
17291        .replace(/ꜵ/g, 'ao')
17292        .replace(/ꜷ/g, 'au')
17293        .replace(/ꜹ/g, 'av')
17294        .replace(/ꜻ|ꜳ/g, 'aa')
17295        .replace(/ꜽ/g, 'ay')
17296        .replace(/ʙ|ᴃ|в|ᵦ|ᴮ|ᵇ|ɓ|ƀ|ƃ|ᵬ|ᶀ|𝐛|𝐁|𝒃|𝑩|𝖻|𝖡|ⓑ|𝔟|𝔅|𝖇|𝕭|𝓫|𝓑|𝒷|𝑏|𝐵|𝕓|𝔹|b|🄱|ℬ|ϐ|๒|ⴆ|ɮ|ᏸ|ც|๖|𝗯|𝗕|𝘣|𝘉|𝙗|𝘽|𝚋|𝙱|ß|฿|乃|ҍ|β|ᗷ/g, 'b')
17297        .replace(/ᴄ|ᶜ|¢|ƈ|ȼ|ꞇ|𝒸|ɕ|ᶗ|ɔ|ↄ|ᴐ|𝐜|𝐂|𝑐|𝐶|𝒄|𝑪|𝖼|𝖢|ⓒ|𝔠|ℭ|𝖈|𝕮|𝓬|𝓒|𝒞|𝕔|ℂ|c|🄲|ᥴ|🅲|ς|ፈ|𝗰|𝗖|𝘤|𝘊|𝙘|𝘾|𝚌|𝙲|ᄃ|₵|匚|↻|ᑕ|ᑢ|℃/g, 'c')
17298        .replace(/ᴅ|ᴰ|ᵈ|∂|ꝺ|ɗ|đ|ƌ|𝒹|ȡ|ᶑ|ᵭ|ᶁ|ɖ|𝐝|𝐃|𝒅|𝑫|𝖽|𝖣|𝑑|𝐷|ⓓ|𝔡|𝔇|𝖉|𝕯|𝓭|𝓓|𝒟|𝕕|𝔻|d|🄳|ᗪ|ᦔ|ժ|🅳|๔|ԃ|ꮄ|໓|𝗱|𝗗|𝘥|𝘋|𝙙|𝘿|𝚍|𝙳|り|ꭰ|ᕲ/g, 'd')
17299        .replace(/dz|dž/g, 'dz')
17300        .replace(/ᴇ|ₑ|ᴱ|ᵉ|ⱻ|ɛ|є|ɇ|ɵ|ꜿ|ǝ|ⱸ|ᶒ|ᶓ|ɘ|𝐞|𝐄|𝒆|𝑬|𝖾|𝖤|ⓔ|𝔢|𝔈|𝖊|𝕰|𝓮|𝓔|𝑒|𝐸|𝕖|𝔼|e|🄴|🅴|ҽ|ꮛ|𝗲|𝗘|𝘦|𝘌|𝙚|𝙀|𝚎|𝙴|乇|ξ|ᘿ|€|ᗴ/g, 'e')
17301        .replace(/ꜰ|ᶠ|ƒ|ʄ|ꝭ|𝒻|ꝼ|ᵮ|ᶂ|ẜ|ẝ|ғ|ᵳ|𝐟|𝐅|𝒇|𝑭|𝖿|𝖥|ꟻ|ⓕ|𝔣|𝔉|𝖋|𝕱|𝓯|𝓕|𝑓|𝐹|𝕗|𝔽|f|🄵|ℱ|𝒇|ᠻ|⨍|🅵|ϝ|𝗳|𝗙|𝘧|𝘍|𝙛|𝙁|𝚏|𝙵|£|₣|ꭶ|千|キ|ᖴ/g, 'f')
17302        .replace(/fi/g, 'fi')
17303        .replace(/fl/g, 'fl')
17304        .replace(/ff/g, 'ff')
17305        .replace(/ffi/g, 'ffi')
17306        .replace(/ffl/g, 'ffl')
17307        .replace(/ɢ|ʛ|ᴳ|ᵍ|ɠ|ǥ|ᶃ|ɡ|ᵷ|𝓰|𝐠|𝐆|𝐺|𝒈|𝑮|𝗀|𝖦|ⓖ|𝔤|𝔊|𝖌|𝕲|𝓖|𝑔|𝒢|𝕘|𝔾|g|🄶|ق|ᧁ|🅶|ﻮ|ꮆ|ງ|𝗴|𝗚|𝘨|𝘎|𝙜|𝙂|𝚐|𝙶|₲|ム|ց|ᘜ/g, 'g')
17308        .replace(/ʜ|н|ₕ|ᴴ|ʰ|ⱨ|ħ|ɦ|ɥ|ʮ|ʯ|𝐡|𝐇|𝒉|𝑯|𝗁|𝖧|ⓗ|𝔥|ℌ|𝖍|𝕳|𝓱|𝓗|𝒽|𝐻|𝕙|ℍ|h|🄷|ℋ|🅷|ђ|ԋ|ꮒ|ɧ|𝗵|𝗛|𝘩|𝘏|𝙝|𝙃|𝚑|𝙷|卄|ん|հ|ᕼ/g, 'h')
17309        .replace(/ƕ/g, 'hu')
17310        .replace(/ɪ|ᵢ|ᴵ|ᶦ|ⁱ|ι|ı|ɨ|ᶖ|ᴉ|𝐢|𝐈|𝒊|𝑰|𝗂|𝖨|𝚤|ⓘ|𝔦|ℑ|𝖎|𝕴|𝓲|𝓘|𝒾|𝑖|𝐼|𝕚|𝕀|i|🄸|꠸|🅸|เ|ꭵ|𝗶|𝗜|𝘪|𝘐|𝙞|𝙄|𝚒|𝙸|丨|ノ|ᓰ|ᶤ/g, 'i')
17311        .replace(/ij/g, 'ij')
17312        .replace(/ᴊ|ⱼ|ᴶ|ʲ|ʝ|ɉ|ȷ|ɟ|𝐣|𝐉|𝑗|𝐽|𝒋|𝑱|𝔧|𝗃|𝖩|𝚥|ⓙ|𝔧|𝔍|𝖏|𝕵|𝓳|𝓙|𝒿|𝒥|𝕛|𝕁|j|🄹|ℐ|ј|꠹|յ|🅹|ว|𝗷|𝗝|𝘫|𝘑|𝙟|𝙅|𝚓|𝙹|נ|フ|ل|ᒍ|ᒚ|ڶ|ᒎ/g, 'j')
17313        .replace(/ᴋ|к|ₖ|ᴷ|ᵏ|ⱪ|ꝃ|ƙ|ꝁ|ꝅ|ᶄ|ʞ|𝐤|𝐊|𝑘|𝐾|𝒌|𝑲|𝗄|𝖪|ⓚ|𝔨|𝔎|𝖐|𝕶|𝓴|𝓚|𝓀|𝒦|𝕜|𝕂|k|🄺|ҝ|ᛕ|🅺|ӄ|ꮶ|𝗸|𝗞|𝘬|𝘒|𝙠|𝙆|𝚔|𝙺|₭|ス|ҟ|ᖽᐸ|ҡ/g, 'k')
17314        .replace(/ʟ|ᴌ|ₗ|ᴸ|ˡ|ℓ|ⱡ|ꝉ|ŀ|ł|ꞁ|ɬ|ȴ|ᶅ|ɭ|ſ|ɿ|ן|𝐥|𝐋|𝒍|𝑳|𝗅|𝖫|⅃|ⓛ|𝔩|𝔏|𝖑|𝕷|𝓵|𝓛|𝓁|𝑙|𝐿|𝕝|𝕃|l|🄻|ℒ|ᥣ|🅻|ʅ|ꮭ|ɩ|𝗹|𝗟|𝘭|𝘓|𝙡|𝙇|𝚕|𝙻|ᄂ|ㄥ|レ|ӏ|ᒪ/g, 'l')
17315        .replace(/lj/g, 'lj')
17316        .replace(/ᴍ|м|ₘ|ᴹ|ᵐ|ɱ|ᵯ|ᶆ|ɰ|𝐦|𝐌|𝒎|𝑴|𝗆|𝖬|ⓜ|𝔪|𝔐|𝖒|𝕸|𝓶|𝓜|𝓂|𝑚|𝑀|𝕞|𝕄|m|🄼|ℳ|ᗰ|🅼|๓|ꮇ|𝗺|𝗠|𝘮|𝘔|𝙢|𝙈|𝚖|𝙼|₥|爪|ᄊ|ᘻ|ϻ/g, 'm')
17317        .replace(/ɴ|ₙ|ᴺ|ⁿ|ᴎ|и|ꞃ|ɲ|ƞ|ȵ|ᵰ|ᶇ|ɳ|ᴝ|𝐧|𝐍|𝑛|𝑁|𝒏|𝑵|𝗇|𝖭|ⓝ|𝔫|𝔑|𝖓|𝕹|𝓷|𝓝|𝓃|𝒩|𝕟|ℕ|n|🄽|🅽|ภ|ռ|ꮑ|ŋ|ຖ|𝗻|𝗡|𝘯|𝘕|𝙣|𝙉|𝚗|𝙽|п|η|₦|几|刀|ղ|ហ|ᑎ|ᘉ|ᶰ/g, 'n')
17318        .replace(/nj/g, 'nj')
17319        .replace(/ᴏ|ₒ|ᴼ|ᵒ|σ|ꝋ|ꝍ|ø|ȣ|ⱺ|ᴑ|ᴓ|𝐨|𝐎|𝑂|𝒐|𝑶|𝗈|𝖮|ⓞ|𝔬|𝔒|𝖔|𝕺|𝓸|𝓞|𝑜|𝒪|𝕠|𝕆|o|ꭴ|🄾|❀|๏|օ|ꭷ|໐|𝗼|𝗢|𝘰|𝘖|𝙤|𝙊|𝚘|𝙾|ө|ð|ㄖ|の|♢|ට|ᓍ|♡|🏵|ᗝ|ο|❁|☯/g, 'o')
17320        .replace(/ꝏ/g, 'oo')
17321        .replace(/ɶ|œ|ᴔ/g, 'oe')
17322        .replace(/Æ£/g, 'on')
17323        .replace(/ᴘ|ₚ|ᴾ|ᵖ|ρ|ꝓ|ƥ|ꝕ|ᵽ|ꝑ|ᵱ|ᶈ|𝐩|𝐏|𝑝|𝑃|ꟼ|𝒑|𝑷|𝗉|𝖯|ⓟ|𝔭|𝔓|𝖕|𝕻|𝓹|𝓟|𝓅|𝒫|𝕡|ℙ|p|🄿|℘|ק|ք|ꭾ|𝗽|𝗣|𝘱|𝘗|𝙥|𝙋|𝚙|𝙿|þ|₱|卩|ア|φ|ᑭ|ᕵ/g, 'p')
17324        .replace(/ǫ|ᵩ|ᵠ|ꝙ|ꝗ|ʠ|ɋ|𝐪|𝐐|𝒒|𝑸|𝗊|𝖰|ⓠ|𝔮|𝔔|𝖖|𝕼|𝓺|𝓠|𝓆|𝒬|𝕢|ℚ|q|🅀|𝑞|𝑄|🆀|ϙ|զ|๑|𝗾|𝗤|𝘲|𝘘|𝙦|𝙌|𝚚|𝚀|ゐ|ҩ|ᑫ|ᕴ/g, 'q')
17325        .replace(/ʀ|ᵣ|ᴿ|ʳ|ᴕ|ᴚ|ʁ|ᴙ|я|ꞅ|ɍ|ɽ|ɾ|ɼ|ᵲ|ᶉ|ɹ|ɻ|ɺ|ⱹ|ꮧ|𝐫|𝐑|𝒓|𝑹|𝗋|𝖱|ⓡ|𝔯|ℜ|𝖗|𝕽|𝓻|𝓡|𝓇|𝑟|𝑅|𝕣|ℝ|r|🅁|ℛ|ꭈ|🆁|г|ꮢ|ཞ|𝗿|𝗥|𝘳|𝘙|𝙧|𝙍|𝚛|𝚁|尺|འ|ᖇ/g, 'r')
17326        .replace(/ꜱ|ₛ|ˢ|ʂ|ᵴ|ᶊ|ȿ|ꝸ|𝐬|𝐒|𝑠|𝑆|𝒔|𝑺|𝗌|𝖲|ⓢ|ꙅ|𝔰|𝔖|𝖘|𝕾|𝓼|𝓢|𝓈|𝒮|𝕤|𝕊|s|🅂|ᦓ|꯱|🆂|ร|ֆ|ꮥ|𝘀|𝗦|𝘴|𝘚|𝙨|𝙎|𝚜|𝚂|ƨ|ѕ|§|₴|丂|ϛ|ᔕ/g, 's')
17327        .replace(/st/g, 'st')
17328        .replace(/ᴛ|т|ₜ|ᵀ|ᵗ|ƚ|ɫ|ⱦ|ƭ|ʈ|ŧ|ȶ|ᵵ|ƫ|ʇ|𝐭|𝐓|𝒕|𝑻|𝗍|𝖳|ⓣ|𝔱|𝔗|𝖙|𝕿|𝓽|𝓣|𝓉|𝒯|𝕥|𝕋|t|🅃|𝑇|🆃|ꮦ|𝘁|𝗧|𝘵|𝑡|𝘛|𝙩|𝙏|𝚝|𝚃|†|₮|ㄒ|イ|է|ͳ|ᖶ|丅/g, 't')
17329        .replace(/ᵺ/g, 'th')
17330        .replace(/ꜩ/g, 'tz')
17331        .replace(/ᴜ|ᵤ|ᵁ|ᵘ|ʋ|ᶙ|𝐮|𝐔|𝑢|𝑈|𝒖|𝑼|𝗎|𝖴|ⓤ|𝔲|𝔘|𝖚|𝖀|𝓾|𝓤|𝓊|𝒰|𝕦|𝕌|u|🅄|υ|🆄|ย|ʊ|ꮼ|ꮰ|น|𝘂|𝗨|𝘶|𝘜|𝙪|𝙐|𝚞|𝚄|ц|µ|μ|ʉ|ㄩ|ひ|մ|ᑌ|ᑘ/g, 'u')
17332        .replace(/ᵫ/g, 'ue')
17333        .replace(/ᴠ|ᵥ|ⱽ|ᵛ|ν|ʌ|ꝟ|ⱴ|ᶌ|ⱱ|𝐯|𝐕|𝑣|𝑉|𝒗|𝑽|𝗏|𝖵|ⓥ|𝔳|𝔙|𝖛|𝖁|𝓿|𝓥|𝓋|𝒱|𝕧|𝕍|v|🅅|🆅|ש|ꮙ|۷|ง|𝘃|𝗩|𝘷|𝘝|𝙫|𝙑|𝚟|𝚅|ᐯ|√|ѵ|ỽ|ᐺ/g, 'v')
17334        .replace(/ꝡ/g, 'vy')
17335        .replace(/ᴡ|ᵂ|ʷ|ω|ⱳ|ʍ|ɯ|𝐰|𝐖|𝑤|𝑊|𝒘|𝑾|𝗐|𝖶|ⓦ|𝔴|𝔚|𝖜|𝖂|𝔀|𝓦|𝓌|𝒲|𝕨|𝕎|w|🅆|ฬ|🆆|ա|ꮗ|ຟ|𝘄|𝗪|𝘸|𝘞|𝙬|𝙒|𝚠|𝚆|щ|₩|山|చ|ᗯ|ᘺ/g, 'w')
17336        .replace(/χ|ₓ|ˣ|ᶍ|𝐱|𝐗|𝑥|𝑋|𝒙|𝑿|𝗑|𝖷|ⓧ|𝔵|𝔛|𝖝|𝖃|𝔁|𝓧|𝓍|𝒳|𝕩|𝕏|x|🅇|🆇|א|ӽ|ҳ|𝘅|𝗫|𝘹|𝘟|𝙭|𝙓|𝚡|𝚇|×|ӿ|乂|メ|ჯ|᙭|ж|ጀ/g, 'x')
17337        .replace(/ʏ|ᵧ|ʸ|ч|ƴ|ỿ|ɏ|ʎ|𝐲|𝐘|𝑦|𝑌|𝒚|𝒀|𝗒|𝖸|ⓨ|𝔶|𝔜|𝖞|𝖄|𝔂|𝓨|𝓎|𝒴|𝕪|𝕐|y|🅈|ⴘ|ү|🆈|ץ|ყ|ꭹ|ฯ|𝘆|𝗬|𝘺|𝘠|𝙮|𝙔|𝚢|𝚈|у|¥|ㄚ|リ|վ|ӌ|ᖻ/g, 'y')
17338        .replace(/ᴢ|ᶻ|ꝫ|ᵹ|ⱬ|ȥ|ƶ|ʑ|ᵶ|ᶎ|ʐ|ɀ|𝐳|𝐙|𝑧|𝑍|𝒛|𝒁|𝗓|𝖹|ⓩ|𝔷|ℨ|𝖟|𝖅|𝔃|𝓩|𝓏|𝒵|𝕫|ℤ|z|🅉|ƺ|🆉|չ|ፚ|ຊ|𝘇|𝗭|𝘻|𝘡|𝙯|𝙕|𝚣|𝚉|乙|ᘔ|ᗱ|շ/g, 'z');
17339}
17340exports.textToLatin = textToLatin;
17341/**
17342 * For any given input text, reduce any repeating characters to a given maximum amount of repetitions.
17343 *
17344 * As an example, the input string: `"heeellllooooo"` becomes: `"heelloo"` if that number is 2, or
17345 * `"heeelllooo"` if that number is 3, or `helo` if that number is 1.
17346 *
17347 * For English, it is recommended to not use values lower than 2. If this preprocessing is used, make
17348 * sure that the bad words and allowed terms also feature at most the same number of repeated characters.
17349 * I.e. if using this with the number "2", there is no use of putting words like "helllo" on the lists.
17350 * @param inputText - The text from which to remove repeat characters.
17351 * @param maxAllowedCharsInSequence - The maximum number of characters in sequence (such as "aaa", "bbb",
17352 * ...) that are allowed to remain in the input string. `Recommended: 2 or 3`, depending on the language
17353 * of your input text.
17354 * @returns The input text with all repeat characters that occur more than the max amount in sequence
17355 * removed.
17356 * @throws If `maxAllowedCharsInSequence` is not an integer (such as 1.5) or if it is 0 or less.
17357 */
17358function reduceRepeatCharacters(inputText, maxAllowedCharsInSequence) {
17359    if (maxAllowedCharsInSequence === void 0) { maxAllowedCharsInSequence = 2; }
17360    if (!Number.isInteger(maxAllowedCharsInSequence) || maxAllowedCharsInSequence < 1) {
17361        throw new Error('reduceRepeatCharacters - maxAllowedCharsInSequence needs to be an integer that is larger than 0');
17362    }
17363    // match any word character `(\w)`, then refer to the last match `\1` and check if it appears
17364    // n or more times `{n,}` (where n is maxAllowedCharsInSequence)
17365    // replace this with our matched character '$1' repeated n times
17366    // in normal regexp terms this would be `string.replace(/(\w)\1{2,}/g, '$1$1')` if `n = 2`
17367    var regexp = new RegExp('(\\w)\\1{' + maxAllowedCharsInSequence + ',}', 'g');
17368    var replacementStr = '$1'.repeat(maxAllowedCharsInSequence);
17369    return inputText.replace(regexp, replacementStr);
17370}
17371exports.reduceRepeatCharacters = reduceRepeatCharacters;
17372
17373},{}],133:[function(require,module,exports){
17374"use strict";
17375var __values = (this && this.__values) || function(o) {
17376    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
17377    if (m) return m.call(o);
17378    if (o && typeof o.length === "number") return {
17379        next: function () {
17380            if (o && i >= o.length) o = void 0;
17381            return { value: o && o[i++], done: !o };
17382        }
17383    };
17384    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
17385};
17386Object.defineProperty(exports, "__esModule", { value: true });
17387exports.reconstructLocations = exports.reduceInputString = void 0;
17388/**
17389 * Reduce a string by removing any special characters that are not latin characters,
17390 * numbers or whitespace. Keep track of the segment start indices and lengths so that
17391 * we can reverse engineer where each segment really started in the original string.
17392 * @param inputString - The string that needs to be reduced by removing all special characters.
17393 * @returns The reduced string (with all special characters removed), as well as an array
17394 * of start indices and lengths that indicate where each part of the string really started
17395 * and ended in the original string.
17396 */
17397var reduceInputString = function (inputString) {
17398    var e_1, _a;
17399    var matches = inputString.matchAll(/[a-zA-Z0-9\s]+/g);
17400    var outString = '';
17401    var locationInfo = [];
17402    try {
17403        for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
17404            var match = matches_1_1.value;
17405            locationInfo.push({
17406                index: outString.length,
17407                offset: match.index - outString.length,
17408            });
17409            outString += match[0];
17410        }
17411    }
17412    catch (e_1_1) { e_1 = { error: e_1_1 }; }
17413    finally {
17414        try {
17415            if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
17416        }
17417        finally { if (e_1) throw e_1.error; }
17418    }
17419    return {
17420        reducedInput: outString,
17421        reducedLocations: locationInfo,
17422    };
17423};
17424exports.reduceInputString = reduceInputString;
17425/**
17426 * Reconstructs the original "Location Information" of a bad word in a string that got
17427 * reduced and then matched against a regular expression. Uses the information that was
17428 * gathered when reducing the string (by removing all special characters except whitespace).
17429 * @param reducedInfos - Information generated by `reduceInputString` before matching the
17430 * reduced string against a regular expression.
17431 * @param matchInfo - Information on the matched words and locations, gotten when matching
17432 * the string from `reduceInputString` against a regular expression.
17433 * @returns BadWordMatchData with the locations and lengths of the matches projected back
17434 * onto the original, unreduced string.
17435 */
17436var reconstructLocations = function (reducedInfos, matchInfo) {
17437    var e_2, _a, e_3, _b;
17438    var newMatchInfo = [];
17439    try {
17440        for (var matchInfo_1 = __values(matchInfo), matchInfo_1_1 = matchInfo_1.next(); !matchInfo_1_1.done; matchInfo_1_1 = matchInfo_1.next()) {
17441            var match = matchInfo_1_1.value;
17442            var matchEndIndex = match.startIndex + match.length;
17443            var startOffset = 0;
17444            var endOffset = 0;
17445            try {
17446                for (var reducedInfos_1 = (e_3 = void 0, __values(reducedInfos)), reducedInfos_1_1 = reducedInfos_1.next(); !reducedInfos_1_1.done; reducedInfos_1_1 = reducedInfos_1.next()) {
17447                    var reducedInfo = reducedInfos_1_1.value;
17448                    if (reducedInfo.index <= match.startIndex) {
17449                        startOffset = reducedInfo.offset;
17450                        endOffset = reducedInfo.offset;
17451                    }
17452                    else if (reducedInfo.index < matchEndIndex) {
17453                        endOffset = reducedInfo.offset;
17454                    }
17455                    else {
17456                        break;
17457                    }
17458                }
17459            }
17460            catch (e_3_1) { e_3 = { error: e_3_1 }; }
17461            finally {
17462                try {
17463                    if (reducedInfos_1_1 && !reducedInfos_1_1.done && (_b = reducedInfos_1.return)) _b.call(reducedInfos_1);
17464                }
17465                finally { if (e_3) throw e_3.error; }
17466            }
17467            newMatchInfo.push({
17468                word: match.word,
17469                startIndex: match.startIndex + startOffset,
17470                length: match.length + endOffset - startOffset,
17471            });
17472        }
17473    }
17474    catch (e_2_1) { e_2 = { error: e_2_1 }; }
17475    finally {
17476        try {
17477            if (matchInfo_1_1 && !matchInfo_1_1.done && (_a = matchInfo_1.return)) _a.call(matchInfo_1);
17478        }
17479        finally { if (e_2) throw e_2.error; }
17480    }
17481    return newMatchInfo;
17482};
17483exports.reconstructLocations = reconstructLocations;
17484
17485},{}],134:[function(require,module,exports){
17486"use strict";
17487Object.defineProperty(exports, "__esModule", { value: true });
17488exports.getCircumventionWhitelistRegExp = exports.getCircumventionRegExp = exports.getNormalRegExp = exports.getRegExpComponents = exports.escapeStringForRegex = void 0;
17489// strings used to build regular expressions
17490var oneOrMoreNonWordCharacters = '[\\W_]+';
17491var aSingleWordCharacter = '[^\\W_]';
17492var nonWordCharactersExceptApostrophe = "[^a-zA-Z0-9'‘’]+";
17493var wordBoundary = '\\b';
17494// regular expressions to clean up strings used to build regular expressions
17495var nonWordCharsAtEndsOfString = /^\[\\W\_\]\+|\[\\W\_\]\+$/g; // identify the "non-word-characters" at the start or end of a string
17496var nonWordCharactersWithSpaceBetween = /\[\\W\_\]\+\s+\[\\W\_\]\+/g; // identify when two "non-word-characters" surround somes whitespace
17497var nonWordCharsAfterEscapeSlash = /\\\[\\W\_\]\+{1}/g; // identify the "non-word-characters interjected between escaped characters"
17498/**
17499 * For a character that is either a wildcard `*`, a letter `[a-zA-Z]` or anything else,
17500 * return a regular expression that matches either anything (for a wildcard), any word
17501 * boundary (for a letter), or any whitespace or start/end of string for all remaining cases.
17502 *
17503 * @param inputCharacter A string with a single character.
17504 * @param atStart Whether the character given was at the start or end of the string.
17505 * @returns a string used to build a regular expression
17506 */
17507var getRegExpComponentCharacter = function (inputCharacter, atStart) {
17508    if (inputCharacter === '*') {
17509        // match anything after wildcard characters
17510        return '';
17511    }
17512    if (inputCharacter.match(/[\W_]/g)) {
17513        // non-word character at start of search term: positive lookbehind for any whitespace or start of string
17514        // non-word character at end of search term: positive lookahead for any whitespace or end of string
17515        return atStart ? '(?<=^|\\s)' : '(?=\\s|$)';
17516    }
17517    // match a word boundery after word characters
17518    return wordBoundary;
17519};
17520/**
17521 * Escape a string so that we can build a `new RegExp(...)` with it and preserve
17522 * any special characters within the string, such as `. * + ? ^ $ { } ( ) [ ] \\ /`
17523 * and still match them properly. If you wish to match a singular backslash `\`
17524 * literally, make sure that in your badwordlist or whitelist, as well as in your
17525 * string that you are testing against, the backslash is escaped by replacing it
17526 * with `\\`.
17527 * @param inputString - The string you wish to escape for creating a regular expression.
17528 * @returns The escaped string that can be used in `new RegExp(...)`
17529 */
17530var escapeStringForRegex = function (inputString) {
17531    return inputString.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
17532};
17533exports.escapeStringForRegex = escapeStringForRegex;
17534/**
17535 * Splits up a word that has optional wildcards '*' at its start or end.
17536 * Removes the wildcards, and returns an empty string for start and end
17537 * if there was a wildcard, or a word-boundary string if there was none.
17538 * These components are then used to build regular expressions with.
17539 *
17540 * @param {string} badword - The bad word to split into its components.
17541 * @returns An object with the components accessible as obj.start, obj.word and obj.end
17542 */
17543var getRegExpComponents = function (badword) {
17544    if (badword === '') {
17545        return { start: '', word: '', end: '' };
17546    }
17547    var sliceStart = badword.startsWith('*') ? 1 : 0; // if there's a * at the start, remove it
17548    var sliceEnd = badword.endsWith('*') ? -1 : undefined; // if there's a * at the end, remove it
17549    return {
17550        start: getRegExpComponentCharacter(badword[0], true),
17551        word: (0, exports.escapeStringForRegex)(badword.slice(sliceStart, sliceEnd)),
17552        end: getRegExpComponentCharacter(badword[badword.length - 1], false),
17553    };
17554};
17555exports.getRegExpComponents = getRegExpComponents;
17556/**
17557 * Turn a bad word into a regular expression that checks if it is present
17558 * in the string with word boundaries \b on each side that does not have a wildcard.
17559 *
17560 * The word "kitty" would result in the regular expression:
17561 * /\bkitty\b/g
17562 * the word "hell*" would result in the regular expression:
17563 * /\bhell/g
17564 * If the word is a phrase with whitespace, replace that whitespace with a regular
17565 * expression that represents one or more non word characters.
17566 * The phrase "ban ananas" turns into:
17567 * /\bban[\W_]+ananas\b/g
17568 *
17569 * @param {WordRegexComponents} badWordComponents - The bad word, split into components by getRegExpComponents(...)
17570 * @returns The regular expression that can be used to find this word in a string.
17571 */
17572var getNormalRegExp = function (badwordComponents) {
17573    return new RegExp(badwordComponents.start +
17574        badwordComponents.word.replace(/\s+/g, oneOrMoreNonWordCharacters) +
17575        badwordComponents.end, 'g');
17576};
17577exports.getNormalRegExp = getNormalRegExp;
17578// TODO: can we not just replace all whitespace with nothing first, then all nothing with non-word characters, then remove at start and end of string?
17579/**
17580 * Turn a bad word into a regular expression that checks for non-word characters
17581 * interjected between all of the characters, but containing a word boundary
17582 * on each side that does not have a wildcard.
17583 *
17584 * The word "kitty" would result in: /\bk[\W_]+i[\W_]+t[\W_]+t[\W_]+y\b/g
17585 *
17586 * It checks for variations such as:
17587 * "k i t t y", "k-i-t-t-y", "k.i,t;t~y" (with a word boundary at each side)
17588 *
17589 * The word "hell*" would result in: /\bh[\W_]+e[\W_]+l[\W_]+l/g
17590 *
17591 * Phrases with whitespace
17592 * If the word is a phrase with whitespace, turn the whitespace into the same
17593 * regular expression that allows any non-word character, but make sure there is only
17594 * one of these non-word-character-regexpressions at a space, as they allow 1 or more
17595 * characters already (specified with the + at the end)
17596 * So, "ban ananas" turns into:
17597 * /\bb[\W_]+a[\W_]+n[\W_]+a[\W_]+n[\W_]+a[\W_]+n[\W_]+a[\W_]+s\b/g
17598 *
17599 * @param {WordRegexComponents} badWordComponents - The bad word, split into components by getRegExpComponents(...)
17600 * @returns The regular expression that can be used to find this word in a string.
17601 */
17602var getCircumventionRegExp = function (badwordComponents) {
17603    return new RegExp(badwordComponents.start +
17604        badwordComponents.word
17605            .split('')
17606            .join(oneOrMoreNonWordCharacters)
17607            .replace(nonWordCharsAtEndsOfString, '')
17608            .replace(nonWordCharsAfterEscapeSlash, '\\')
17609            .replace(nonWordCharactersWithSpaceBetween, oneOrMoreNonWordCharacters) +
17610        badwordComponents.end, 'g');
17611};
17612exports.getCircumventionRegExp = getCircumventionRegExp;
17613/**
17614 * Create a regular expression used for whitelisting, that treats singularly spaced out characters
17615 * in front or after a bad word as "breaking the pattern" of the circumvention regular expression,
17616 * so that words such as:
17617 * "h e l l"
17618 * can still get blocked, but words such as
17619 * "s h e l l"
17620 * will make sure that the input doesn't trigger on the phrase "hell".
17621 *
17622 * For an explanation on matchApostrophes, check the description of `preprocessWordLists(...)`,
17623 * which covers the case of apostrophes matched vs. not matched at both the start and end of the word.
17624 *
17625 * @param {WordRegexComponents} badWordComponents - The bad word, split into components by getRegExpComponents(...)
17626 * @param {boolean} atWordStart - Whether this regex whitelists the word with an additional letter at the start
17627 * or whether it covers the case of an additional letter at the end.
17628 * @param {boolean} matchApostrophes - Whether the regular expression treats apostrophes before and after the word differently.
17629 * @returns The regular expression that can be used to find this word in a string, or undefined if the regular expression
17630 * is irrelevant and should not be used.
17631 */
17632var getCircumventionWhitelistRegExp = function (badwordComponents, atWordStart, matchApostrophes) {
17633    var newWordComponents = {
17634        start: badwordComponents.start,
17635        end: badwordComponents.end,
17636        word: badwordComponents.word,
17637    };
17638    if (atWordStart) {
17639        if (badwordComponents.start) {
17640            // match a word boundary, followed by a singular character, then an amount of empty characters
17641            newWordComponents.start = matchApostrophes ? '(?<!' + aSingleWordCharacter + "['‘’])" : '';
17642            newWordComponents.start += wordBoundary + aSingleWordCharacter + oneOrMoreNonWordCharacters;
17643        }
17644        else {
17645            return undefined;
17646        }
17647    }
17648    else {
17649        if (badwordComponents.end) {
17650            // match an amount of empty characters, followed by a singular character, then a word boundary
17651            newWordComponents.end = matchApostrophes ? nonWordCharactersExceptApostrophe : oneOrMoreNonWordCharacters;
17652            newWordComponents.end += aSingleWordCharacter + wordBoundary;
17653        }
17654        else {
17655            return undefined;
17656        }
17657    }
17658    return (0, exports.getCircumventionRegExp)(newWordComponents);
17659};
17660exports.getCircumventionWhitelistRegExp = getCircumventionWhitelistRegExp;
17661
17662},{}],135:[function(require,module,exports){
17663"use strict";
17664var __values = (this && this.__values) || function(o) {
17665    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
17666    if (m) return m.call(o);
17667    if (o && typeof o.length === "number") return {
17668        next: function () {
17669            if (o && i >= o.length) o = void 0;
17670            return { value: o && o[i++], done: !o };
17671        }
17672    };
17673    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
17674};
17675Object.defineProperty(exports, "__esModule", { value: true });
17676exports.replaceChars = exports.grawlix = void 0;
17677var grawlixSymbols = '%&$#?£@!';
17678/**
17679 * Transforms the full input string into so-called 'grawlix' (`%&$#?£@!`) characters.
17680 * @param inputString - The text we want to be turned into grawlix characters.
17681 * @returns The text, transformed into a mess of `%&$#?£@!` characters.
17682 * Simple whitespace will be preserved.
17683 */
17684var grawlix = function (inputString) {
17685    var outString = '';
17686    var lastCharacter = '';
17687    for (var i = 0; i < inputString.length; i++) {
17688        if (inputString.charAt(i).match(/[^a-zA-Z0-9]/g)) {
17689            outString += inputString.charAt(i);
17690        }
17691        else {
17692            var symbolIndex = inputString.charCodeAt(i) % grawlixSymbols.length;
17693            if (lastCharacter === grawlixSymbols[symbolIndex]) {
17694                symbolIndex = (symbolIndex + 1) % grawlixSymbols.length;
17695            }
17696            outString += grawlixSymbols[symbolIndex];
17697            lastCharacter = grawlixSymbols[symbolIndex];
17698        }
17699    }
17700    return outString;
17701};
17702exports.grawlix = grawlix;
17703/**
17704 * Replaces the full input strings with a repetition of the replacement character, but preserves
17705 * simple whitespace.
17706 * @param inputString - The text that we want to replace with the replacement character.
17707 * @param replacementCharacter - The character that we want to replace it with. If a string of
17708 * `length > 1` is provided, it will only use the first character.
17709 * @returns The text, transformed into a repetition of the replacement character, but with
17710 * simple whitespaces being preserved.
17711 */
17712var replaceChars = function (inputString, replacementCharacter) {
17713    var e_1, _a;
17714    var replaceChar = replacementCharacter[0];
17715    var outString = '';
17716    try {
17717        for (var inputString_1 = __values(inputString), inputString_1_1 = inputString_1.next(); !inputString_1_1.done; inputString_1_1 = inputString_1.next()) {
17718            var char = inputString_1_1.value;
17719            if (char.match(/[^a-zA-Z0-9]/g)) {
17720                outString += char;
17721            }
17722            else {
17723                outString += replaceChar;
17724            }
17725        }
17726    }
17727    catch (e_1_1) { e_1 = { error: e_1_1 }; }
17728    finally {
17729        try {
17730            if (inputString_1_1 && !inputString_1_1.done && (_a = inputString_1.return)) _a.call(inputString_1);
17731        }
17732        finally { if (e_1) throw e_1.error; }
17733    }
17734    return outString;
17735};
17736exports.replaceChars = replaceChars;
17737
17738},{}],136:[function(require,module,exports){
17739"use strict";
17740var __rest = (this && this.__rest) || function (s, e) {
17741    var t = {};
17742    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17743        t[p] = s[p];
17744    if (s != null && typeof Object.getOwnPropertySymbols === "function")
17745        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17746            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17747                t[p[i]] = s[p[i]];
17748        }
17749    return t;
17750};
17751var __values = (this && this.__values) || function(o) {
17752    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
17753    if (m) return m.call(o);
17754    if (o && typeof o.length === "number") return {
17755        next: function () {
17756            if (o && i >= o.length) o = void 0;
17757            return { value: o && o[i++], done: !o };
17758        }
17759    };
17760    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
17761};
17762Object.defineProperty(exports, "__esModule", { value: true });
17763exports.censorText = exports.replaceBadWords = exports.findAllBadWords = exports.getBadWords = exports.findAnyBadWord = exports.findBadWordLocations = exports.doesContainBadWords = exports.getWhitelistType = exports.WordReplacementType = exports.WordReplacementMethod = exports.InputPreprocessMethod = void 0;
17764var input_preprocessor_1 = require("./input_preprocessor");
17765var reduce_input_string_1 = require("./reduce_input_string");
17766var replace_input_1 = require("./replace_input");
17767var wordlist_preprocessor_1 = require("./wordlist_preprocessor");
17768var InputPreprocessMethod;
17769(function (InputPreprocessMethod) {
17770    InputPreprocessMethod[InputPreprocessMethod["Thorough"] = 0] = "Thorough";
17771    InputPreprocessMethod[InputPreprocessMethod["CaseInsensitive"] = 1] = "CaseInsensitive";
17772    InputPreprocessMethod[InputPreprocessMethod["ExactMatch"] = 2] = "ExactMatch";
17773})(InputPreprocessMethod || (exports.InputPreprocessMethod = InputPreprocessMethod = {}));
17774var WordReplacementMethod;
17775(function (WordReplacementMethod) {
17776    WordReplacementMethod[WordReplacementMethod["ReplaceAll"] = 0] = "ReplaceAll";
17777    WordReplacementMethod[WordReplacementMethod["KeepFirstCharacter"] = 1] = "KeepFirstCharacter";
17778    WordReplacementMethod[WordReplacementMethod["KeepFirstAndLastCharacter"] = 2] = "KeepFirstAndLastCharacter";
17779})(WordReplacementMethod || (exports.WordReplacementMethod = WordReplacementMethod = {}));
17780var WordReplacementType;
17781(function (WordReplacementType) {
17782    WordReplacementType[WordReplacementType["RepeatCharacter"] = 0] = "RepeatCharacter";
17783    WordReplacementType[WordReplacementType["Grawlix"] = 1] = "Grawlix";
17784})(WordReplacementType || (exports.WordReplacementType = WordReplacementType = {}));
17785/**
17786 * Turns an object of type `BadWordMatchInfo` into the type `BadWordMatchData`
17787 */
17788var toBadWordMatchData = function (badWordMatchInfo) {
17789    var isWhitelisted = badWordMatchInfo.isWhitelisted, matchData = __rest(badWordMatchInfo, ["isWhitelisted"]);
17790    return matchData;
17791};
17792/**
17793 * Turns an object of type `BadWordMatchData` into the type `BadWordMatchInfo`.
17794 * Always sets isWhitelisted to false on the newly generated MatchInfo objects.
17795 */
17796var toBadWordMatchInfo = function (badWordMatchData) {
17797    return Object.assign({}, badWordMatchData, { isWhitelisted: false });
17798};
17799/**
17800 * Checks if the bad word is fully contained within the whitelisted word,
17801 * given their start indices and lengths.
17802 * @param badWordStartIndex - The index at which the bad word starts in the input string.
17803 * @param badWordLength - The length of the bad word in the input string.
17804 * @param goodWordStartIndex - The index at which the whitelisted word starts in the input string.
17805 * @param goodWordLength - The length of the whitelisted word in the input string.
17806 * @returns True, if the bad word is fully contained in this whitelisted term. False, otherwise.
17807 */
17808var isMatchWhitelisted = function (badWordStartIndex, badWordLength, goodWordStartIndex, goodWordLength) {
17809    return (badWordStartIndex >= goodWordStartIndex && badWordStartIndex + badWordLength <= goodWordStartIndex + goodWordLength);
17810};
17811/**
17812 * Whether to check the whitelist's `Normal` regular expressions (check for a direct match),
17813 * or their `Strict` regular expressions (check for a circumvention of that word), or `Both`.
17814 */
17815var WhitelistCheckType;
17816(function (WhitelistCheckType) {
17817    WhitelistCheckType[WhitelistCheckType["Normal"] = 0] = "Normal";
17818    WhitelistCheckType[WhitelistCheckType["Strict"] = 1] = "Strict";
17819    WhitelistCheckType[WhitelistCheckType["Both"] = 2] = "Both";
17820})(WhitelistCheckType || (WhitelistCheckType = {}));
17821/**
17822 * Removes any terms related to the bad word from `badwordData` that are whitelisted by the
17823 * `whitelistMap` (potentially modified by `overrideData`) from the `badWordMatchInfo` array of
17824 * all matches that were found for this bad word.
17825 * `Note!` Might have side effects and modify the input array `badWordMatchInfo`
17826 * @param inputString - the input string for which we found any bad word matches
17827 * @param badwordData - the bad word we found matches for
17828 * @param badWordMatchInfo - the matches we found of this bad word.
17829 * StartIndices and length need to be related to input string.
17830 * @param whitelistMap - the whitelisted words to check for overlaps with any found bad words
17831 * @param checkType - `Normal`, `Strict` or `Both`, defining which whitelist regular expressions to check.
17832 * If normal, only the word itself is matched. If strict, only circumvention terms are checked in the
17833 * whitelist. If both, both are checked.
17834 * @param overrideData - (Optional) Any potential overrides to the whitelist map.
17835 * @param whitelistWordType - (Optional) Only consider the whitelisted words of a specific type, e.g.
17836 * `WhitelistWordType.Reduced` only considers whitelist terms that don't match the bad word directly,
17837 * since they contain some special characters that, if removed, makes the term match the bad word.
17838 * `WhitelistWordType.Circumvention` only considers whitelist terms that match the bad word's circumvention
17839 * regular expression.
17840 * @returns the `badWordMatchInfo` array without any terms that were whitelisted under the input conditions.
17841 */
17842var removeWhitelistedMatchesFromMatchInfos = function (inputString, badwordData, badWordMatchInfo, whitelistMap, checkType, overrideData, whitelistWordType) {
17843    var e_1, _a, e_2, _b, e_3, _c;
17844    if (badWordMatchInfo.length === 0) {
17845        return [];
17846    }
17847    var whitelistArray = whitelistMap[badwordData.word] || [];
17848    if (overrideData) {
17849        // remove all the whitelisted words that the override disables
17850        if (overrideData.whitelistDisables[badwordData.word]) {
17851            whitelistArray = whitelistArray.filter(function (element) { return !overrideData.whitelistDisables[badwordData.word].includes(element.word); });
17852        }
17853        // add all the whitelisted words that the override adds
17854        if (overrideData.whitelistEnables[badwordData.word]) {
17855            whitelistArray = whitelistArray.concat(overrideData.whitelistEnables[badwordData.word]);
17856        }
17857    }
17858    if (whitelistWordType !== undefined) {
17859        // if a type is specified, only check the whitelist terms of that type
17860        whitelistArray = whitelistArray.filter(function (elem) { return (0, wordlist_preprocessor_1.hasWhitelistWordType)(elem, whitelistWordType); });
17861    }
17862    // if we are checking for bad word circumventions also check the specific "strict" whitelist
17863    // that avoids blocking good content such as "s h e l l" for discovering bad content within, such as "h e l l"
17864    var whitelistRegexData = checkType === WhitelistCheckType.Normal
17865        ? whitelistArray.map(function (elem) { return elem.normalRegexp; })
17866        : whitelistArray.map(function (elem) { return elem.strictRegexp; }).concat(badwordData.whitelistedStrictRegexpArray);
17867    if (checkType === WhitelistCheckType.Both) {
17868        whitelistRegexData = whitelistRegexData.concat(whitelistArray.map(function (elem) { return elem.normalRegexp; }));
17869    }
17870    try {
17871        // iterate through the whitelist that overlaps with this bad word,
17872        // based on start index and match length, we can determine if a bad word
17873        // is okay to be used (i.e. whether it is whitelisted).
17874        for (var whitelistRegexData_1 = __values(whitelistRegexData), whitelistRegexData_1_1 = whitelistRegexData_1.next(); !whitelistRegexData_1_1.done; whitelistRegexData_1_1 = whitelistRegexData_1.next()) {
17875            var whitelistRegex = whitelistRegexData_1_1.value;
17876            var whitelistMatches = inputString.matchAll(whitelistRegex);
17877            if (whitelistMatches) {
17878                try {
17879                    for (var whitelistMatches_1 = (e_2 = void 0, __values(whitelistMatches)), whitelistMatches_1_1 = whitelistMatches_1.next(); !whitelistMatches_1_1.done; whitelistMatches_1_1 = whitelistMatches_1.next()) {
17880                        var whitelistMatch = whitelistMatches_1_1.value;
17881                        try {
17882                            for (var badWordMatchInfo_1 = (e_3 = void 0, __values(badWordMatchInfo)), badWordMatchInfo_1_1 = badWordMatchInfo_1.next(); !badWordMatchInfo_1_1.done; badWordMatchInfo_1_1 = badWordMatchInfo_1.next()) {
17883                                var badWordElement = badWordMatchInfo_1_1.value;
17884                                if (isMatchWhitelisted(badWordElement.startIndex, badWordElement.length, whitelistMatch.index, whitelistMatch[0].length)) {
17885                                    badWordElement.isWhitelisted = true; // remove later, to not break the loop
17886                                }
17887                            }
17888                        }
17889                        catch (e_3_1) { e_3 = { error: e_3_1 }; }
17890                        finally {
17891                            try {
17892                                if (badWordMatchInfo_1_1 && !badWordMatchInfo_1_1.done && (_c = badWordMatchInfo_1.return)) _c.call(badWordMatchInfo_1);
17893                            }
17894                            finally { if (e_3) throw e_3.error; }
17895                        }
17896                        badWordMatchInfo = badWordMatchInfo.filter(function (element) { return !element.isWhitelisted; });
17897                        if (badWordMatchInfo.length === 0) {
17898                            return []; //  early out - all bad words were whitelisted
17899                        }
17900                    }
17901                }
17902                catch (e_2_1) { e_2 = { error: e_2_1 }; }
17903                finally {
17904                    try {
17905                        if (whitelistMatches_1_1 && !whitelistMatches_1_1.done && (_b = whitelistMatches_1.return)) _b.call(whitelistMatches_1);
17906                    }
17907                    finally { if (e_2) throw e_2.error; }
17908                }
17909            }
17910        }
17911    }
17912    catch (e_1_1) { e_1 = { error: e_1_1 }; }
17913    finally {
17914        try {
17915            if (whitelistRegexData_1_1 && !whitelistRegexData_1_1.done && (_a = whitelistRegexData_1.return)) _a.call(whitelistRegexData_1);
17916        }
17917        finally { if (e_1) throw e_1.error; }
17918    }
17919    return badWordMatchInfo;
17920};
17921/**
17922 * Finds the location(s) of a given bad word's appearances in an input string.
17923 * Includes checks of the whitelist, in order to ensure that whitelisted occurrences
17924 * of bad words are not considered "bad".
17925 * Can check either strictly, considering circumvention attempts, or non-strictly,
17926 * considering only whether the bad word (or phrase) itself appears in the input string.
17927 * @param inputString - The text to check for bad words.
17928 * @param badwordData - The data for one bad word - from of the array of bad word data generated by `preprocessWordLists`
17929 * @param whitelistMap - The map of whitelisted words, generated by `preprocessWordLists`
17930 * @param checkStrict - Whether to check for circumventions or not.
17931 * @param overrideData - (Default: `undefined`) Data used to modify a list by removing words or whitelisted
17932 * terms or by adding new whitelisted terms. Created with `preprocessWordListOverrideData`
17933 * @returns An array of BadWordMatchData that contains the word and the start indices and
17934 * lengths of any substrings matching the word.
17935 */
17936var findBadWordMatchData = function (inputString, badwordData, whitelistMap, checkStrict, overrideData) {
17937    var e_4, _a;
17938    var badwordRegExp = checkStrict ? badwordData.strictRegexp : badwordData.normalRegexp;
17939    var matches = inputString.matchAll(badwordRegExp);
17940    // make a checklist of which matches we found, remove them once we see they are whitelisted
17941    var badWordMatchInfo = [];
17942    try {
17943        for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
17944            var match = matches_1_1.value;
17945            badWordMatchInfo.push({
17946                word: badwordData.word,
17947                isWhitelisted: false,
17948                startIndex: match.index,
17949                length: match[0].length,
17950            });
17951        }
17952    }
17953    catch (e_4_1) { e_4 = { error: e_4_1 }; }
17954    finally {
17955        try {
17956            if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
17957        }
17958        finally { if (e_4) throw e_4.error; }
17959    }
17960    if (badWordMatchInfo.length === 0) {
17961        return []; // no bad word was found
17962    }
17963    var checkType = checkStrict ? WhitelistCheckType.Strict : WhitelistCheckType.Normal;
17964    badWordMatchInfo = removeWhitelistedMatchesFromMatchInfos(inputString, badwordData, badWordMatchInfo, whitelistMap, checkType, overrideData);
17965    return badWordMatchInfo.map(function (match) { return toBadWordMatchData(match); });
17966};
17967/**
17968 * Figure out if the good word matches the bad word in its normal form
17969 * or if it represents a variant that reduces to the bad word (by removing special characters)
17970 * or if it represents a circumvention that spaces out the bad word.
17971 *
17972 * @param goodword - the whitelist term
17973 * @param badwordData - the bad word's regular expressions, created with `getBadWordData(...)`
17974 * @returns `WhitelistWordType.None` if the whitelist term does not match this bad word,
17975 * `WhitelistWordType.Normal` if the term matches the bad word in its normal form,
17976 * `WhitelistWordType.Reduced` if the term without special characters (reduced string) matches the word,
17977 * `WhitelistWordType.Circumvention` if the whitelisted word matches the bad word's circumvention regexp,
17978 * `WhitelistWordType.ReducedAndCircumvention` if it matches both the reduced string and the circumvention.
17979 */
17980var getWhitelistType = function (goodword, badwordData) {
17981    // Figure out if the good word matches the bad word in its normal form
17982    // or if it represents a variant that reduces to the bad word (by removing special characters)
17983    // or if it represents a circumvention that spaces out the bad word.
17984    var whitelistType = wordlist_preprocessor_1.WhitelistWordType.None;
17985    if (goodword.match(badwordData.normalRegexp)) {
17986        whitelistType = wordlist_preprocessor_1.WhitelistWordType.Normal;
17987    }
17988    else if (badwordData.strictRegexp) {
17989        var reducedGoodwordData = (0, reduce_input_string_1.reduceInputString)(goodword);
17990        if (reducedGoodwordData.reducedInput.match(badwordData.normalRegexp)) {
17991            whitelistType = wordlist_preprocessor_1.WhitelistWordType.Reduced;
17992        }
17993        // using findBadWordMatchData as the integrated circumvention whitelist regexps need to be checked
17994        // for edge cases such as s h e l l (fully spaced out words that contain a bad word, parsed "shell")
17995        var circumventionMatches = findBadWordMatchData(goodword, badwordData, {}, true);
17996        if (circumventionMatches.length > 0) {
17997            whitelistType =
17998                whitelistType === wordlist_preprocessor_1.WhitelistWordType.Reduced
17999                    ? wordlist_preprocessor_1.WhitelistWordType.ReducedAndCircumvention
18000                    : wordlist_preprocessor_1.WhitelistWordType.Circumvention;
18001        }
18002    }
18003    return whitelistType;
18004};
18005exports.getWhitelistType = getWhitelistType;
18006/**
18007 * Given your preprocessed bad word list and whitelist, checks if a given text contains any bad word
18008 * that hasn't been allowed by the whitelist. Checks for the most common circumventions as well.
18009 *
18010 * IMPORTANT: Make sure that any backslash in the inputString is escaped correctly.
18011 * If you are trying to see whether the string `¯\_(ツ)_/¯` is a bad word, you have to
18012 * enter it as `¯\\_(ツ)_/¯` to match it correctly.
18013 *
18014 * @param inputString - The text you wish to check for bad words.
18015 * @param processedWordLists - The preprocessed bad word list and whitelist, generated by `preprocessWordLists(...)`
18016 * @param overrideData - (Default: `undefined`) Data used to modify a list by removing words or whitelisted
18017 * terms or by adding new whitelisted terms. Created with `preprocessWordListOverrideData`
18018 * @returns True if any bad word was found, false if no bad word was found or all bad words were whitelisted.
18019 */
18020var doesContainBadWords = function (inputString, processedWordLists, overrideData) {
18021    if ((0, exports.findAnyBadWord)(inputString, processedWordLists, overrideData)) {
18022        return true;
18023    }
18024    return false;
18025};
18026exports.doesContainBadWords = doesContainBadWords;
18027/**
18028 * Finds all bad words contained in a string, as well as their locations, indicated by start index and length.
18029 *
18030 * IMPORTANT: Make sure that any backslash in the inputString is escaped correctly.
18031 * If you are trying to see whether the string `¯\_(ツ)_/¯` is a bad word, you have to
18032 * enter it as `¯\\_(ツ)_/¯` to match it correctly.
18033 *
18034 * @param inputString  - The text you wish to check for bad words.
18035 * @param processedWordLists - The preprocessed bad word list and whitelist, generated by `preprocessWordLists(...)`
18036 * @param firstMatchOnly - (Default: `false`) If true, returns only the first match. If false, returns all matched
18037 * bad words.
18038 * @param overrideData - (Default: `undefined`) Data used to modify a list by removing words or whitelisted
18039 * terms or by adding new whitelisted terms. Created with `preprocessWordListOverrideData`
18040 * --------
18041 * @returns an array of information about all found bad words and where they are located in the input string.
18042 */
18043var findBadWordLocations = function (inputString, processedWordLists, _a) {
18044    var e_5, _b;
18045    var _c = _a === void 0 ? {} : _a, _d = _c.firstMatchOnly, firstMatchOnly = _d === void 0 ? false : _d, overrideData = _c.overrideData;
18046    var allBadWordLocations = [];
18047    var _loop_1 = function (badwordData) {
18048        // check if we ignore the word, in that case we can skip it
18049        if (overrideData && overrideData.badWordDisables.includes(badwordData.word)) {
18050            return "continue";
18051        }
18052        // if we check for an exact match
18053        // try to match the word with its special characters, as they could
18054        // form word boundaries, such as in "test-kitty-word".
18055        var locations = findBadWordMatchData(inputString, badwordData, processedWordLists.whitelistMap, false, overrideData);
18056        // if we are only looking for one word, return it at this point
18057        if (firstMatchOnly && locations.length > 0) {
18058            return { value: [locations[0]] };
18059        }
18060        // if we are checking circumventions at all
18061        if (badwordData.strictRegexp !== undefined) {
18062            // try removing all special characters from the input string
18063            // and match it against the word itself, with word boundaries.
18064            var reducedData = (0, reduce_input_string_1.reduceInputString)(inputString);
18065            if (reducedData.reducedInput !== inputString) {
18066                var matchedReducedStringLocations = findBadWordMatchData(reducedData.reducedInput, badwordData, processedWordLists.whitelistMap, false, overrideData);
18067                var actualReducedStringLocations = [];
18068                if (matchedReducedStringLocations.length > 0) {
18069                    actualReducedStringLocations = (0, reduce_input_string_1.reconstructLocations)(reducedData.reducedLocations, matchedReducedStringLocations);
18070                    // remove duplicates found of words that were the same in the normal and the reduced input string
18071                    actualReducedStringLocations = actualReducedStringLocations.filter(function (loc) {
18072                        return locations.findIndex(function (foundLoc) { return foundLoc.startIndex === loc.startIndex && foundLoc.length === loc.length; }) === -1;
18073                    });
18074                    // check if we whitelisted any specific terms that were matched
18075                    var reducedStringMatchInfos = actualReducedStringLocations.map(function (elem) { return toBadWordMatchInfo(elem); });
18076                    reducedStringMatchInfos = removeWhitelistedMatchesFromMatchInfos(inputString, badwordData, reducedStringMatchInfos, processedWordLists.whitelistMap, WhitelistCheckType.Both, overrideData, wordlist_preprocessor_1.WhitelistWordType.Reduced);
18077                    actualReducedStringLocations = reducedStringMatchInfos.map(function (elem) { return toBadWordMatchData(elem); });
18078                    if (actualReducedStringLocations.length > 0 && firstMatchOnly) {
18079                        return { value: [actualReducedStringLocations[0]] };
18080                    }
18081                }
18082                locations = locations.concat(actualReducedStringLocations);
18083            }
18084            // finally try to match the word with common circumventions, such as
18085            // "bad k i t t y" while ensuring words such as "k i t t y c a t" are considered bad.
18086            var circumventions = findBadWordMatchData(inputString, badwordData, processedWordLists.whitelistMap, true, overrideData);
18087            if (circumventions.length > 0) {
18088                var circumventionMatchInfos = circumventions.map(function (elem) { return toBadWordMatchInfo(elem); });
18089                circumventionMatchInfos = removeWhitelistedMatchesFromMatchInfos(inputString, badwordData, circumventionMatchInfos, processedWordLists.whitelistMap, WhitelistCheckType.Both, overrideData, wordlist_preprocessor_1.WhitelistWordType.Circumvention);
18090                circumventions = circumventionMatchInfos.map(function (elem) { return toBadWordMatchData(elem); });
18091                if (firstMatchOnly && circumventions.length > 0) {
18092                    return { value: [circumventions[0]] };
18093                }
18094                locations = locations.concat(circumventions);
18095            }
18096        }
18097        // collect all the matches for this bad word
18098        allBadWordLocations = allBadWordLocations.concat(locations);
18099    };
18100    try {
18101        for (var _e = __values(processedWordLists.badWordData), _f = _e.next(); !_f.done; _f = _e.next()) {
18102            var badwordData = _f.value;
18103            var state_1 = _loop_1(badwordData);
18104            if (typeof state_1 === "object")
18105                return state_1.value;
18106        }
18107    }
18108    catch (e_5_1) { e_5 = { error: e_5_1 }; }
18109    finally {
18110        try {
18111            if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
18112        }
18113        finally { if (e_5) throw e_5.error; }
18114    }
18115    return allBadWordLocations;
18116};
18117exports.findBadWordLocations = findBadWordLocations;
18118/**
18119 * Given your preprocessed bad word list and whitelist, checks if a given text contains any bad word
18120 * that hasn't been allowed by the whitelist. Checks for the most common circumventions as well.
18121 * If any bad word was found, the first word that was found will be returned.
18122 *
18123 * IMPORTANT: Make sure that any backslash in the inputString is escaped correctly.
18124 * If you are trying to see whether the string `¯\_(ツ)_/¯` is a bad word, you have to
18125 * enter it as `¯\\_(ツ)_/¯` to match it correctly.
18126 *
18127 * @param inputString  - The text you wish to check for bad words.
18128 * @param processedWordLists - The preprocessed bad word list and whitelist, generated by `preprocessWordLists(...)`
18129 * @param overrideData - (Default: `undefined`) Data used to modify a list by removing words or whitelisted
18130 * terms or by adding new whitelisted terms. Created with `preprocessWordListOverrideData`
18131 * @returns The first bad word that was found in the input, or undefined if no bad word was found.
18132 */
18133var findAnyBadWord = function (inputString, processedWordLists, overrideData) {
18134    var result = (0, exports.findBadWordLocations)(inputString, processedWordLists, {
18135        firstMatchOnly: true,
18136        overrideData: overrideData,
18137    });
18138    if (result.length > 0) {
18139        return result[0].word;
18140    }
18141    return undefined;
18142};
18143exports.findAnyBadWord = findAnyBadWord;
18144/**
18145 * Given the bad word locations found by `findBadWordLocations(...)`,
18146 * extract all the bad words from that data.
18147 * This function is useful if you need both the bad words as well as the input string
18148 * with all bad words replaced (check out `replaceBadWords(...)` for the latter.)
18149 *
18150 * If the bad words are all you need, consider using `findAllBadWords(...)` instead.
18151 * If you only need one bad word, consider using `findAnyBadWord(...)`, and if you
18152 * only need to know whether there is a bad word, consider using `doesContainBadWord(...)`.
18153 *
18154 * @param badWordLocations - The locations of bad words in your input string checked
18155 * with `findBadWordLocations(...)`
18156 * @returns An array of strings of all bad words found in the text. Only contains each
18157 * bad word once, even if they repeat.
18158 */
18159var getBadWords = function (badWordLocations) {
18160    var e_6, _a;
18161    var foundWords = [];
18162    try {
18163        for (var badWordLocations_1 = __values(badWordLocations), badWordLocations_1_1 = badWordLocations_1.next(); !badWordLocations_1_1.done; badWordLocations_1_1 = badWordLocations_1.next()) {
18164            var matchInfo = badWordLocations_1_1.value;
18165            if (!foundWords.includes(matchInfo.word)) {
18166                foundWords.push(matchInfo.word);
18167            }
18168        }
18169    }
18170    catch (e_6_1) { e_6 = { error: e_6_1 }; }
18171    finally {
18172        try {
18173            if (badWordLocations_1_1 && !badWordLocations_1_1.done && (_a = badWordLocations_1.return)) _a.call(badWordLocations_1);
18174        }
18175        finally { if (e_6) throw e_6.error; }
18176    }
18177    return foundWords;
18178};
18179exports.getBadWords = getBadWords;
18180/**
18181 * Given your preprocessed bad word list and whitelist, checks for all bad words in a given input text
18182 * that haven't been allowed by the whitelist. Checks for the most common circumventions as well.
18183 * Returns an array of strings of all bad words.
18184 *
18185 * IMPORTANT: Make sure that any backslash in the inputString is escaped correctly.
18186 * If you are trying to see whether the string `¯\_(ツ)_/¯` is a bad word, you have to
18187 * enter it as `¯\\_(ツ)_/¯` to match it correctly.
18188 *
18189 * @param inputString - The text you wish to check for bad words.
18190 * @param processedWordLists - The preprocessed bad word list and whitelist, generated by `preprocessWordLists(...)`
18191 * @param overrideData - (Default: `undefined`) Data used to modify a list by removing words or whitelisted
18192 * terms or by adding new whitelisted terms. Created with `preprocessWordListOverrideData`
18193 * @returns The first bad word that was found in the input, or undefined if no bad word was found.
18194 */
18195var findAllBadWords = function (inputString, processedWordLists, overrideData) {
18196    var badWordLocations = (0, exports.findBadWordLocations)(inputString, processedWordLists, { overrideData: overrideData });
18197    return (0, exports.getBadWords)(badWordLocations);
18198};
18199exports.findAllBadWords = findAllBadWords;
18200/**
18201 * Sanitise any text by replacing bad words in it with Grawlix (`$!#@&%`) or a single repeated character.
18202 * This function is useful if you need both the bad words as well as the input string
18203 * with all bad words replaced (check out `getBadWords(...)` for the latter.)
18204 *
18205 * If you only need a "censored" input string but are not interested in identifying which bad words were
18206 * censored, consider using `censorText(...)` instead.
18207 *
18208 * @param inputString - The text that got checked for bad words in `findBadWordLocations(...)`
18209 * @param badWordLocations - The information on all bad word matches found with `findBadWordLocations(...)`
18210 * @param replacementMethod - (Default: `WordReplacementMethod.ReplaceAll`) Used to select whether to replace the
18211 * whole word, or keep the first (and last) characters from the bad word intact.
18212 * @param replacementType - (Default: `WordReplacementType.Grawlix`) Used to select whether to replace the
18213 * word with a jumbled mess of Grawlix (`$!#@&%`)  characters, or with a selected repeatable character defined
18214 * in the next parameter.
18215 * @param replacementRepeatCharacter - (Default: `-`) The character to repeat in order to replace the bad word.
18216 * (If several characters are entered, only the first one will be used.)
18217 * @returns the input string, with all bad words replaced by either Grawlix or a repeated character.
18218 */
18219var replaceBadWords = function (inputString, badWordLocations, _a) {
18220    var e_7, _b;
18221    var _c = _a === void 0 ? {}
18221 : _a, _d = _c.replacementMethod, replacementMethod = _d === void 0 ? WordReplacementMethod.ReplaceAll : _d, _e = _c.replacementType, replacementType = _e === void 0 ? WordReplacementType.Grawlix : _e, _f = _c.replacementRepeatCharacter, replacementRepeatCharacter = _f === void 0 ? '-' : _f;
18222    var outString = inputString;
18223    try {
18224        for (var badWordLocations_2 = __values(badWordLocations), badWordLocations_2_1 = badWordLocations_2.next(); !badWordLocations_2_1.done; badWordLocations_2_1 = badWordLocations_2.next()) {
18225            var badWordLocation = badWordLocations_2_1.value;
18226            var startIndex = badWordLocation.startIndex + (replacementMethod === WordReplacementMethod.ReplaceAll ? 0 : 1);
18227            var lengthModifier = 0;
18228            if (replacementMethod === WordReplacementMethod.KeepFirstAndLastCharacter) {
18229                lengthModifier = 2;
18230            }
18231            else if (replacementMethod === WordReplacementMethod.KeepFirstCharacter) {
18232                lengthModifier = 1;
18233            }
18234            var length = badWordLocation.length - lengthModifier;
18235            var wordToReplace = outString.substring(startIndex, startIndex + length);
18236            var newBadWord = replacementType === WordReplacementType.Grawlix
18237                ? (0, replace_input_1.grawlix)(wordToReplace)
18238                : (0, replace_input_1.replaceChars)(wordToReplace, replacementRepeatCharacter);
18239            outString = outString.substring(0, startIndex) + newBadWord + outString.substring(startIndex + length);
18240        }
18241    }
18242    catch (e_7_1) { e_7 = { error: e_7_1 }; }
18243    finally {
18244        try {
18245            if (badWordLocations_2_1 && !badWordLocations_2_1.done && (_b = badWordLocations_2.return)) _b.call(badWordLocations_2);
18246        }
18247        finally { if (e_7) throw e_7.error; }
18248    }
18249    return outString;
18250};
18251exports.replaceBadWords = replaceBadWords;
18252/**
18253 * Sanitise any text by replacing bad words in it with Grawlix (`$!#@&%`) or a single repeated character.
18254 *
18255 * @param inputString - The text that got checked for bad words in `findBadWordLocations(...)`
18256 * @param processedWordLists - The preprocessed bad word list and whitelist, generated by `preprocessWordLists(...)`
18257 * @param inputPreprocessMethod - (Default: `InputPreprocessMethod.CaseInsensitive`) Used to preprocess the input
18258 * string before identifying bad words. `CaseInsensitive`: transforms the input to lower case and then matches it against
18259 * the bad word list.
18260 * `Thorough` uses the `textToLatin()` function to remove text accents, translate letter emojis and
18261 * any other fancy unicode fonts to latin before testing for bad words. Note: If non-latin characters are found,
18262 * the censored text will be returned all in lower case and in latin letters.
18263 * `ExactMatch` matches the input string against the bad word list exactly.
18264 * @param reduceRepeatCharactersTo - (Default: `undefined` meaning repeat characters are not modified.)
18265 * Otherwise required to be a number >= 1. `Will throw an error if this number is <= 0.`
18266 * The amount of characters a repeating sequence of characters (e.g. "aaaabcc") is reduced to in _*every*_ input string.
18267 * (e.g. "abc" if the number is 1, "aabcc" if the number is 2, "aaabcc" if the number is 3, etc.)
18268 * This reduction will be applied after any other input preprocess method. (Uses function `reduceRepeatCharacters(...)`)
18269 *
18270 * `Important:` keep in mind that reducing to 1
18271 * repeat character will likely result in mismatches/false positives ("loot" -> "lot"). Depending on the language of the
18272 * input, this number should be around 2 or 3.
18273 *
18274 * `Note:` when setting this number to 1 or larger, keep in mind that all words in your filter need to adhere to this,
18275 * so if you set the number to 2, putting "princessship" on the bad word list won't take effect, as any such input would
18276 * get reduced to "princesship".
18277 * @param replacementMethod - (Default: `WordReplacementMethod.ReplaceAll`) Used to select whether to replace the
18278 * whole word, or keep the first (and last) characters from the bad word intact.
18279 * @param replacementType - (Default: `WordReplacementType.Grawlix`) Used to select whether to replace the
18280 * word with a jumbled mess of Grawlix (`$!#@&%`)  characters, or with a selected repeatable character defined
18281 * in the next parameter.
18282 * @param replacementRepeatCharacter - (Default: `-`) The character to repeat in order to replace the bad word.
18283 * (If several characters are entered, only the first one will be used.)
18284 * @param overrideData - (Default: `undefined`) Data used to modify a list by removing words or whitelisted
18285 * terms or by adding new whitelisted terms. Created with `preprocessWordListOverrideData`
18286 * @returns the input string, with all bad words replaced by either Grawlix or a repeated character.
18287 */
18288var censorText = function (inputString, processedWordLists, _a, overrideData) {
18289    var _b = _a === void 0 ? {}
18289 : _a, _c = _b.inputPreprocessMethod, inputPreprocessMethod = _c === void 0 ? InputPreprocessMethod.CaseInsensitive : _c, _d = _b.reduceRepeatCharactersTo, reduceRepeatCharactersTo = _d === void 0 ? undefined : _d, _e = _b.replacementMethod, replacementMethod = _e === void 0 ? WordReplacementMethod.ReplaceAll : _e, _f = _b.replacementType, replacementType = _f === void 0 ? WordReplacementType.Grawlix : _f, _g = _b.replacementRepeatCharacter, replacementRepeatCharacter = _g === void 0 ? '-' : _g;
18290    var stringToScan = inputString;
18291    if (inputPreprocessMethod === InputPreprocessMethod.CaseInsensitive) {
18292        stringToScan = stringToScan.toLowerCase();
18293    }
18294    else if (inputPreprocessMethod === InputPreprocessMethod.Thorough) {
18295        stringToScan = (0, input_preprocessor_1.textToLatin)(inputString);
18296    }
18297    if (reduceRepeatCharactersTo !== undefined) {
18298        stringToScan = (0, input_preprocessor_1.reduceRepeatCharacters)(stringToScan, reduceRepeatCharactersTo);
18299    }
18300    var locations = (0, exports.findBadWordLocations)(stringToScan, processedWordLists, { overrideData: overrideData });
18301    if (locations.length === 0) {
18302        return inputString;
18303    }
18304    var stringToReplace = stringToScan;
18305    if (stringToScan === inputString.toLowerCase()) {
18306        stringToReplace = inputString;
18307    }
18308    return (0, exports.replaceBadWords)(stringToReplace, locations, {
18309        replacementMethod: replacementMethod,
18310        replacementType: replacementType,
18311        replacementRepeatCharacter: replacementRepeatCharacter,
18312    });
18313};
18314exports.censorText = censorText;
18315
18316},{"./input_preprocessor":132,"./reduce_input_string":133,"./replace_input":135,"./wordlist_preprocessor":137}],137:[function(require,module,exports){
18317"use strict";
18318var __values = (this && this.__values) || function(o) {
18319    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
18320    if (m) return m.call(o);
18321    if (o && typeof o.length === "number") return {
18322        next: function () {
18323            if (o && i >= o.length) o = void 0;
18324            return { value: o && o[i++], done: !o };
18325        }
18326    };
18327    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
18328};
18329Object.defineProperty(exports, "__esModule", { value: true });
18330exports.preprocessWordListOverrideData = exports.preprocessWordLists = exports.hasWhitelistWordType = exports.isValidWhitelist = exports.getWhitelistWordData = exports.getBadWordData = exports.WhitelistWordType = void 0;
18331var regex_handler_1 = require("./regex_handler");
18332var word_filter_1 = require("./word_filter");
18333/**
18334 * Which type the whitelisted word is, whether it whitelists the word itself (`Normal`), if the
18335 * whitelisted term without any special characters matches the word (`Reduced`), if the whitelisted
18336 * term matches the bad word's circumvention regular expression (`Circumvention`) or if it matches
18337 * both as Reduced and Circumvention (`ReducedAndCircumvention`).
18338 * Type `None` is for whitelisted words that don't whitelist this bad word in any way.
18339 */
18340var WhitelistWordType;
18341(function (WhitelistWordType) {
18342    WhitelistWordType[WhitelistWordType["None"] = 0] = "None";
18343    WhitelistWordType[WhitelistWordType["Normal"] = 1] = "Normal";
18344    WhitelistWordType[WhitelistWordType["Reduced"] = 2] = "Reduced";
18345    WhitelistWordType[WhitelistWordType["Circumvention"] = 3] = "Circumvention";
18346    WhitelistWordType[WhitelistWordType["ReducedAndCircumvention"] = 4] = "ReducedAndCircumvention";
18347})(WhitelistWordType || (exports.WhitelistWordType = WhitelistWordType = {}));
18348/**
18349 * Creates the regular expressions used for testing for the presence of a bad word in a string.
18350 * @param badword - The bad word to create regular expressions for.
18351 * @param checkCircumventions - (Default: `true`)
18352 * if false, the bad word matched exactly. If true, the bad word is additionally
18353 * matched with any special characters in between, such as `ki%tt-y`, as well as
18354 * with all characters spaced out, such as `k i t t y`. It makes sense to set this
18355 * value to `false` when matching URLs/links or in-text-emojis such as `¯\_(ツ)_/¯`
18356 * @param considerPrecedingApostrophes - (Default: `true`)
18357 * if true, and in the case of spaced out words without a wildcard at the start,
18358 * it will NOT allow phrases such as "i'd b a d w o r d" or "it's b a d w o r d"
18359 * or "n'o't'a'b'a'd'w'o'r'd" (the latter may be considered okay by some.)
18360 * If considerPrecedingApostrophes = false, all of the above are allowed.
18361 * Consider setting this value based on the language you're targeting, but for
18362 * English it might be reasonable to set it to "true".
18363 * @param considerFollowUpApostrophes - (Default: `true`)
18364 * if true, and in the case of spaced out words without a wildcard at the end,
18365 * it will NOT allow phrases such as "b a d w o r d's" or "b a d w o r d'i n g" or
18366 * "b'a'd'w'o'r'd'i'n'g" (where "badword" is the blocked term)
18367 * If considerFollowUpApostrophes = false, all of the above are allowed.
18368 * (Note: In either case, formats such as "b a d w o r d'ing" and "b a d w o r d'ed" get blocked)
18369 * Consider setting this value based on the language you're targeting, but for
18370 * English it might be reasonable to set it to "true".
18371 * Note: The apostrophe circumventions are very rarely used, so this is an
18372 * edge case, especially because cases where the word is not s p a c e d out are
18373 * handled differently.
18374 * @returns an object containing the bad word and the regular expressions associated with it.
18375 */
18376var getBadWordData = function (badword, _a) {
18377    var _b = _a === void 0 ? {} : _a, _c = _b.checkCircumventions, checkCircumventions = _c === void 0 ? true : _c, _d = _b.considerPrecedingApostrophes, considerPrecedingApostrophes = _d === void 0 ? true : _d, _e = _b.considerFollowUpApostrophes, considerFollowUpApostrophes = _e === void 0 ? true : _e;
18378    var badWordComponents = (0, regex_handler_1.getRegExpComponents)(badword);
18379    var badwordRegexp = (0, regex_handler_1.getNormalRegExp)(badWordComponents);
18380    var circumventionRegexp = checkCircumventions ? (0, regex_handler_1.getCircumventionRegExp)(badWordComponents) : undefined;
18381    return {
18382        word: badword,
18383        normalRegexp: badwordRegexp,
18384        strictRegexp: circumventionRegexp,
18385        whitelistedStrictRegexpArray: checkCircumventions
18386            ? [
18387                (0, regex_handler_1.getCircumventionWhitelistRegExp)(badWordComponents, true, considerPrecedingApostrophes),
18388                (0, regex_handler_1.getCircumventionWhitelistRegExp)(badWordComponents, false, considerFollowUpApostrophes),
18389            ].filter(function (item) { return item !== undefined; })
18390            : [],
18391    };
18392};
18393exports.getBadWordData = getBadWordData;
18394/**
18395 * Creates the regular expressions and informations used for testing for the presence of an allowed term in a string, in relation to
18396 * a bad word. Is used to build the ProcessedWordLists data.)
18397 * @param whitelistWord - the allowed word or phrase to create regular expressions for
18398 * @param badwordData - the regular expressions to check for a specific bad word in a string, created with `getBadWordData(...)`
18399 * @returns - undefined if the whitelisted word does not match the bad word
18400 * - otherwise it returns the WhitelistWordData containing
18401 * the whitelistWord, the regular expressions associated with it, and the WhitelistWordType of this allowed word with respect to the
18402 * given bad word data.
18403 */
18404var getWhitelistWordData = function (whitelistWord, badwordData) {
18405    if (whitelistWord === '') {
18406        return undefined;
18407    }
18408    var whitelistType = (0, word_filter_1.getWhitelistType)(whitelistWord, badwordData);
18409    if (whitelistType === WhitelistWordType.None) {
18410        return undefined;
18411    }
18412    var whitelistWordComponents = (0, regex_handler_1.getRegExpComponents)(whitelistWord);
18413    return {
18414        word: whitelistWord,
18415        normalRegexp: (0, regex_handler_1.getNormalRegExp)(whitelistWordComponents),
18416        strictRegexp: (0, regex_handler_1.getCircumventionRegExp)(whitelistWordComponents),
18417        type: whitelistType,
18418    };
18419};
18420exports.getWhitelistWordData = getWhitelistWordData;
18421/**
18422 * Tests if a word is a valid whitelist for a given bad word.
18423 * @param goodword - The word to check whether it whitelists the bad word.
18424 * @param badword - The bad word to check.
18425 * @param checkCircumventions - (Default: `true`)
18426 * **Highly recommended to use the same word filter options as for the word list you're building!**
18427 * Whether the whitelisted word is allowed to be a circumvention of the
18428 * bad word. If false, only direct matches count.
18429 * @param considerPrecedingApostrophes - (Default: `true`)
18430 * **Highly recommended to use the same word filter options as for the word list you're building!**
18431 * Whether your bad word's circumventions consider phrases such as "i'd b a d w o r d" or
18432 * "it's b a d w o r d" or "n'o't'a'b'a'd'w'o'r'd" as bad (it does if this param is `true`).
18433 * This determines whether such a term counts as a valid whitelist or not.
18434 * @param considerFollowUpApostrophes - (Default: `true`)
18435 * **Highly recommended to use the same word filter options as for the word list you're building!**
18436 * Whether your bad word's circumventions consider phrases such as "b a d w o r d's" or
18437 * "b a d w o r d'i n g" or "b'a'd'w'o'r'd'i'n'g" as bad (it does if this param is `true`).
18438 * This determines whether such a term counts as a valid whitelist or not.
18439 * @returns True if goodword whitelists badword. False if it does not.
18440 *
18441 * _(Returns `true` if badword is empty string `''`)_
18442 */
18443var isValidWhitelist = function (goodword, badword, _a) {
18444    var _b = _a === void 0 ? {}
18444 : _a, _c = _b.checkCircumventions, checkCircumventions = _c === void 0 ? true : _c, _d = _b.considerPrecedingApostrophes, considerPrecedingApostrophes = _d === void 0 ? true : _d, _e = _b.considerFollowUpApostrophes, considerFollowUpApostrophes = _e === void 0 ? true : _e;
18445    var badWordData = (0, exports.getBadWordData)(badword, {
18446        checkCircumventions: checkCircumventions,
18447        considerPrecedingApostrophes: considerPrecedingApostrophes,
18448        considerFollowUpApostrophes: considerFollowUpApostrophes,
18449    });
18450    return (0, word_filter_1.getWhitelistType)(goodword, badWordData) !== WhitelistWordType.None;
18451};
18452exports.isValidWhitelist = isValidWhitelist;
18453/**
18454 * Check if the given whitelist word data has a specified type.
18455 * For word data types `WhitelistWordType.Reduced` or `WhitelistWordType.Circumvention`
18456 * additionally check if the type we're checking against is `WhitelistWordType.ReducedAndCircumvention`
18457 * since some terms can fall into both categories.
18458 * @param wordData - The whitelist word data to check for a type
18459 * @param wordType - The type to check for
18460 * @returns - true if the whitelist data has this type
18461 */
18462var hasWhitelistWordType = function (wordData, wordType) {
18463    if (wordData.type === wordType) {
18464        return true;
18465    }
18466    if (wordData.type === WhitelistWordType.ReducedAndCircumvention) {
18467        return wordType === WhitelistWordType.Reduced || wordType === WhitelistWordType.Circumvention;
18468    }
18469    if (wordData.type === WhitelistWordType.Reduced || wordData.type === WhitelistWordType.Circumvention) {
18470        return wordType === WhitelistWordType.ReducedAndCircumvention;
18471    }
18472    return false;
18473};
18474exports.hasWhitelistWordType = hasWhitelistWordType;
18475/**
18476 * Creates the regular expressions facilitating the search of bad words,
18477 * as well as the lookup table of all whitelisted words (linked to only the
18478 * those bad words which are contained in this whitelisted word).
18479 * This is used in the filtering algorithms.
18480 *
18481 * IMPORTANT: If you wish to match a backslash `\` character in any bad word,
18482 * you will always need to escape it. Trying to detect someone entering
18483 * `¯\_(ツ)_/¯` would mean your bad word would need to be `¯\\_(ツ)_/¯`.
18484 * If you allow others to define bad word inputs, always sanitise strings
18485 * containing backslashes by replacing them with two backslashes.
18486 *
18487 * @param badwords - an array of bad words or phrases that are being
18488 * checked in the texts that we filter
18489 * @param whitelist - an array of whitelisted words or phrases that
18490 * contain one or more bad words but are purposefully not being checked
18491 * @param checkCircumventions - (Default: `true`)
18492 * if false, the bad word matched exactly. If true, the bad word is additionally
18493 * matched with any special characters in between, such as `ki%tt-y`, as well as
18494 * with all characters spaced out, such as `k i t t y`. It makes sense to set this
18495 * value to `false` when matching URLs/links or in-text-emojis such as `¯\_(ツ)_/¯`
18496 * @param considerPrecedingApostrophes - (Default: `true`)
18497 * if true, and in the case of spaced out words without a wildcard at the start,
18498 * it will NOT allow phrases such as "i'd b a d w o r d" or "it's b a d w o r d"
18499 * or "n'o't'a'b'a'd'w'o'r'd" (the latter may be considered okay by some.)
18500 * If considerPrecedingApostrophes = false, all of the above are allowed.
18501 * Consider setting this value based on the language you're targeting, but for
18502 * English it might be reasonable to set it to "true".
18503 * @param considerFollowUpApostrophes - (Default: `true`)
18504 * if true, and in the case of spaced out words without a wildcard at the end,
18505 * it will NOT allow phrases such as "b a d w o r d's" or "b a d w o r d'i n g" or
18506 * "b'a'd'w'o'r'd'i'n'g" (where "badword" is the blocked term)
18507 * If considerFollowUpApostrophes = false, all of the above are allowed.
18508 * (Note: In either case, formats such as "b a d w o r d'ing" and "b a d w o r d'ed" get blocked)
18509 * Consider setting this value based on the language you're targeting, but for
18510 * English it might be reasonable to set it to "true".
18511 * Note: The apostrophe circumventions are very rarely used, so this is an
18512 * edge case, especially because cases where the word is not s p a c e d out are
18513 * handled differently.
18514 * @returns preprocessed bad words and whitelist words, with the whitelist entries mapped
18515 * to the bad words that they overlap/cover
18516 */
18517var preprocessWordLists = function (badwords, whitelist, _a) {
18518    var e_1, _b, e_2, _c;
18519    var _d = _a === void 0 ? {} : _a, _e = _d.checkCircumventions, checkCircumventions = _e === void 0 ? true : _e, _f = _d.considerPrecedingApostrophes, considerPrecedingApostrophes = _f === void 0 ? true : _f, _g = _d.considerFollowUpApostrophes, considerFollowUpApostrophes = _g === void 0 ? true : _g;
18520    var badWordData = [];
18521    var whitelistMap = {}; // map from badword -> [goodwords] (array of good word data)
18522    var filterOptions = {
18523        checkCircumventions: checkCircumventions,
18524        considerPrecedingApostrophes: considerPrecedingApostrophes,
18525        considerFollowUpApostrophes: considerFollowUpApostrophes,
18526    };
18527    try {
18528        for (var badwords_1 = __values(badwords), badwords_1_1 = badwords_1.next(); !badwords_1_1.done; badwords_1_1 = badwords_1.next()) {
18529            var badword = badwords_1_1.value;
18530            if (badword === '') {
18531                continue;
18532            }
18533            var currentBadWordData = (0, exports.getBadWordData)(badword, filterOptions);
18534            badWordData.push(currentBadWordData);
18535            try {
18536                for (var whitelist_1 = (e_2 = void 0, __values(whitelist)), whitelist_1_1 = whitelist_1.next(); !whitelist_1_1.done; whitelist_1_1 = whitelist_1.next()) {
18537                    var goodword = whitelist_1_1.value;
18538                    var whitelistWordData = (0, exports.getWhitelistWordData)(goodword, currentBadWordData);
18539                    if (whitelistWordData) {
18540                        if (whitelistMap[badword]) {
18541                            whitelistMap[badword].push(whitelistWordData);
18542                        }
18543                        else {
18544                            whitelistMap[badword] = [whitelistWordData];
18545                        }
18546                    }
18547                }
18548            }
18549            catch (e_2_1) { e_2 = { error: e_2_1 }; }
18550            finally {
18551                try {
18552                    if (whitelist_1_1 && !whitelist_1_1.done && (_c = whitelist_1.return)) _c.call(whitelist_1);
18553                }
18554                finally { if (e_2) throw e_2.error; }
18555            }
18556        }
18557    }
18558    catch (e_1_1) { e_1 = { error: e_1_1 }; }
18559    finally {
18560        try {
18561            if (badwords_1_1 && !badwords_1_1.done && (_b = badwords_1.return)) _b.call(badwords_1);
18562        }
18563        finally { if (e_1) throw e_1.error; }
18564    }
18565    return {
18566        badWordData: badWordData,
18567        whitelistMap: whitelistMap,
18568        filterOptions: filterOptions,
18569    };
18570};
18571exports.preprocessWordLists = preprocessWordLists;
18572/**
18573 * Prepares data that is piggybacked onto an existing, processed word list to modify it.
18574 * This override data can then be used to disable bad words in an existing list, as well
18575 * as disable existing whitelisted terms or add further whitelisted content.
18576 *
18577 * This feature can be used if one modifiable "default" word list is shared between many
18578 * applications, while each application can modify it, especially when modifications are
18579 * expected to contain significantly less words than the original "default" list.
18580 *
18581 * @param defaultWordList - the preprocessed word list that the next parameters will use
18582 * as a base for their preprocessing. Created with `preprocessWordLists(...)`
18583 * @param disabledDefaultWords - an array of strings of all bad words in the defaultWordList
18584 * that should be ignored when testing strings against this list
18585 * @param disabledDefaultWhitelist - an array of strings of all whitelisted terms in the
18586 * defaultWordList that should not be whitelisted and instead still count as bad words
18587 * @param additionalWhitelistWords - an array of strings of additional whitelist terms that
18588 * should be considered "okay" even if there is a bad word in them
18589 * @returns preprocessed override data that can be used in the algorithms that find, locate
18590 * or replace bad words in an input string
18591 */
18592var preprocessWordListOverrideData = function (defaultWordList, disabledDefaultWords, disabledDefaultWhitelist, additionalWhitelistWords) {
18593    var e_3, _a, e_4, _b, e_5, _c, e_6, _d;
18594    // make sure we only add words that really disable entries
18595    var badWordDisables = [];
18596    var _loop_1 = function (disabledBadWord) {
18597        if (defaultWordList.badWordData.findIndex(function (entry) { return entry.word === disabledBadWord; }) >= 0) {
18598            badWordDisables.push(disabledBadWord);
18599        }
18600    };
18601    try {
18602        for (var disabledDefaultWords_1 = __values(disabledDefaultWords), disabledDefaultWords_1_1 = disabledDefaultWords_1.next(); !disabledDefaultWords_1_1.done; disabledDefaultWords_1_1 = disabledDefaultWords_1.next()) {
18603            var disabledBadWord = disabledDefaultWords_1_1.value;
18604            _loop_1(disabledBadWord);
18605        }
18606    }
18607    catch (e_3_1) { e_3 = { error: e_3_1 }; }
18608    finally {
18609        try {
18610            if (disabledDefaultWords_1_1 && !disabledDefaultWords_1_1.done && (_a = disabledDefaultWords_1.return)) _a.call(disabledDefaultWords_1);
18611        }
18612        finally { if (e_3) throw e_3.error; }
18613    }
18614    var whitelistDisables = {};
18615    var whitelistEnables = {};
18616    try {
18617        for (var _e = __values(defaultWordList.badWordData), _f = _e.next(); !_f.done; _f = _e.next()) {
18618            var defaultBadWordData = _f.value;
18619            var badword = defaultBadWordData.word;
18620            var _loop_2 = function (disabledGoodword) {
18621                if (disabledGoodword === '') {
18622                    return "continue";
18623                }
18624                if (defaultWordList.whitelistMap[badword] && // only disable words that are present in the whitelist map
18625                    defaultWordList.whitelistMap[badword].findIndex(function (entry) { return entry.word === disabledGoodword; }) >= 0) {
18626                    if (whitelistDisables[badword]) {
18627                        whitelistDisables[badword].push(disabledGoodword);
18628                    }
18629                    else {
18630                        whitelistDisables[badword] = [disabledGoodword];
18631                    }
18632                }
18633            };
18634            try {
18635                // make sure to mark any disabled whitelist entries as such,
18636                // to link them to the bad word(s) that they cover and to double check that they exist in that whitelist
18637                for (var disabledDefaultWhitelist_1 = (e_5 = void 0, __values(disabledDefaultWhitelist)), disabledDefaultWhitelist_1_1 = disabledDefaultWhitelist_1.next(); !disabledDefaultWhitelist_1_1.done; disabledDefaultWhitelist_1_1 = disabledDefaultWhitelist_1.next()) {
18638                    var disabledGoodword = disabledDefaultWhitelist_1_1.value;
18639                    _loop_2(disabledGoodword);
18640                }
18641            }
18642            catch (e_5_1) { e_5 = { error: e_5_1 }; }
18643            finally {
18644                try {
18645                    if (disabledDefaultWhitelist_1_1 && !disabledDefaultWhitelist_1_1.done && (_c = disabledDefaultWhitelist_1.return)) _c.call(disabledDefaultWhitelist_1);
18646                }
18647                finally { if (e_5) throw e_5.error; }
18648            }
18649            var _loop_3 = function (goodword) {
18650                if (goodword === '') {
18651                    return "continue";
18652                }
18653                var badwordData = (0, exports.getBadWordData)(badword, defaultWordList.filterOptions);
18654                if (!defaultWordList.whitelistMap[badword] || // make sure the whitelisted word is not already there
18655                    defaultWordList.whitelistMap[badword].findIndex(function (entry) { return entry.word === goodword; }) < 0) {
18656                    var whitelistWordData = (0, exports.getWhitelistWordData)(goodword, badwordData);
18657                    if (whitelistWordData) {
18658                        if (whitelistEnables[badword]) {
18659                            whitelistEnables[badword].push(whitelistWordData);
18660                        }
18661                        else {
18662                            whitelistEnables[badword] = [whitelistWordData];
18663                        }
18664                    }
18665                }
18666            };
18667            try {
18668                // make sure to add any new whitelisted elements and preprocess them accordingly
18669                for (var additionalWhitelistWords_1 = (e_6 = void 0, __values(additionalWhitelistWords)), additionalWhitelistWords_1_1 = additionalWhitelistWords_1.next(); !additionalWhitelistWords_1_1.done; additionalWhitelistWords_1_1 = additionalWhitelistWords_1.next()) {
18670                    var goodword = additionalWhitelistWords_1_1.value;
18671                    _loop_3(goodword);
18672                }
18673            }
18674            catch (e_6_1) { e_6 = { error: e_6_1 }; }
18675            finally {
18676                try {
18677                    if (additionalWhitelistWords_1_1 && !additionalWhitelistWords_1_1.done && (_d = additionalWhitelistWords_1.return)) _d.call(additionalWhitelistWords_1);
18678                }
18679                finally { if (e_6) throw e_6.error; }
18680            }
18681        }
18682    }
18683    catch (e_4_1) { e_4 = { error: e_4_1 }; }
18684    finally {
18685        try {
18686            if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
18687        }
18688        finally { if (e_4) throw e_4.error; }
18689    }
18690    return {
18691        badWordDisables: badWordDisables,
18692        whitelistDisables: whitelistDisables,
18693        whitelistEnables: whitelistEnables,
18694    };
18695};
18696exports.preprocessWordListOverrideData = preprocessWordListOverrideData;
18697
18698},{"./regex_handler":134,"./word_filter":136}],138:[function(require,module,exports){
18699'use strict';
18700
18701var $defineProperty = require('es-define-property');
18702
18703var $SyntaxError = require('es-errors/syntax');
18704var $TypeError = require('es-errors/type');
18705
vendor: 9,731 bytes, lines 18706-19029
18706var gopd = require('gopd');
18707
18708/** @type {import('.')} */
18709module.exports = function defineDataProperty(
18710	obj,
18711	property,
18712	value
18713) {
18714	if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
18715		throw new $TypeError('`obj` must be an object or a function`');
18716	}
18717	if (typeof property !== 'string' && typeof property !== 'symbol') {
18718		throw new $TypeError('`property` must be a string or a symbol`');
18719	}
18720	if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
18721		throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
18722	}
18723	if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
18724		throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
18725	}
18726	if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
18727		throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
18728	}
18729	if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
18730		throw new $TypeError('`loose`, if provided, must be a boolean');
18731	}
18732
18733	var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
18734	var nonWritable = arguments.length > 4 ? arguments[4] : null;
18735	var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
18736	var loose = arguments.length > 6 ? arguments[6] : false;
18737
18738	/* @type {false | TypedPropertyDescriptor<unknown>} */
18739	var desc = !!gopd && gopd(obj, property);
18740
18741	if ($defineProperty) {
18742		$defineProperty(obj, property, {
18743			configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
18744			enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
18745			value: value,
18746			writable: nonWritable === null && desc ? desc.writable : !nonWritable
18747		});
18748	} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
18749		// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
18750		obj[property] = value; // eslint-disable-line no-param-reassign
18751	} else {
18752		throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
18753	}
18754};
18755
18756},{"es-define-property":140,"es-errors/syntax":145,"es-errors/type":146,"gopd":159}],139:[function(require,module,exports){
18757'use strict';
18758
18759var callBind = require('call-bind-apply-helpers');
18760var gOPD = require('gopd');
18761
18762var hasProtoAccessor;
18763try {
18764	// eslint-disable-next-line no-extra-parens, no-proto
18765	hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
18766} catch (e) {
18767	if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
18768		throw e;
18769	}
18770}
18771
18772// eslint-disable-next-line no-extra-parens
18773var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
18774
18775var $Object = Object;
18776var $getPrototypeOf = $Object.getPrototypeOf;
18777
18778/** @type {import('./get')} */
18779module.exports = desc && typeof desc.get === 'function'
18780	? callBind([desc.get])
18781	: typeof $getPrototypeOf === 'function'
18782		? /** @type {import('./get')} */ function getDunder(value) {
18783			// eslint-disable-next-line eqeqeq
18784			return $getPrototypeOf(value == null ? value : $Object(value));
18785		}
18786		: false;
18787
18788},{"call-bind-apply-helpers":121,"gopd":159}],140:[function(require,module,exports){
18789'use strict';
18790
18791/** @type {import('.')} */
18792var $defineProperty = Object.defineProperty || false;
18793if ($defineProperty) {
18794	try {
18795		$defineProperty({}, 'a', { value: 1 });
18796	} catch (e) {
18797		// IE 8 has a broken defineProperty
18798		$defineProperty = false;
18799	}
18800}
18801
18802module.exports = $defineProperty;
18803
18804},{}],141:[function(require,module,exports){
18805'use strict';
18806
18807/** @type {import('./eval')} */
18808module.exports = EvalError;
18809
18810},{}],142:[function(require,module,exports){
18811'use strict';
18812
18813/** @type {import('.')} */
18814module.exports = Error;
18815
18816},{}],143:[function(require,module,exports){
18817'use strict';
18818
18819/** @type {import('./range')} */
18820module.exports = RangeError;
18821
18822},{}],144:[function(require,module,exports){
18823'use strict';
18824
18825/** @type {import('./ref')} */
18826module.exports = ReferenceError;
18827
18828},{}],145:[function(require,module,exports){
18829'use strict';
18830
18831/** @type {import('./syntax')} */
18832module.exports = SyntaxError;
18833
18834},{}],146:[function(require,module,exports){
18835'use strict';
18836
18837/** @type {import('./type')} */
18838module.exports = TypeError;
18839
18840},{}],147:[function(require,module,exports){
18841'use strict';
18842
18843/** @type {import('./uri')} */
18844module.exports = URIError;
18845
18846},{}],148:[function(require,module,exports){
18847'use strict';
18848
18849/** @type {import('.')} */
18850module.exports = Object;
18851
18852},{}],149:[function(require,module,exports){
18853'use strict';
18854
18855var isCallable = require('is-callable');
18856
18857var toStr = Object.prototype.toString;
18858var hasOwnProperty = Object.prototype.hasOwnProperty;
18859
18860/** @type {<This, A extends readonly unknown[]>(arr: A, iterator: (this: This | void, value: A[number], index: number, arr: A) => void, receiver: This | undefined) => void} */
18861var forEachArray = function forEachArray(array, iterator, receiver) {
18862    for (var i = 0, len = array.length; i < len; i++) {
18863        if (hasOwnProperty.call(array, i)) {
18864            if (receiver == null) {
18865                iterator(array[i], i, array);
18866            } else {
18867                iterator.call(receiver, array[i], i, array);
18868            }
18869        }
18870    }
18871};
18872
18873/** @type {<This, S extends string>(string: S, iterator: (this: This | void, value: S[number], index: number, string: S) => void, receiver: This | undefined) => void} */
18874var forEachString = function forEachString(string, iterator, receiver) {
18875    for (var i = 0, len = string.length; i < len; i++) {
18876        // no such thing as a sparse string.
18877        if (receiver == null) {
18878            iterator(string.charAt(i), i, string);
18879        } else {
18880            iterator.call(receiver, string.charAt(i), i, string);
18881        }
18882    }
18883};
18884
18885/** @type {<This, O>(obj: O, iterator: (this: This | void, value: O[keyof O], index: keyof O, obj: O) => void, receiver: This | undefined) => void} */
18886var forEachObject = function forEachObject(object, iterator, receiver) {
18887    for (var k in object) {
18888        if (hasOwnProperty.call(object, k)) {
18889            if (receiver == null) {
18890                iterator(object[k], k, object);
18891            } else {
18892                iterator.call(receiver, object[k], k, object);
18893            }
18894        }
18895    }
18896};
18897
18898/** @type {(x: unknown) => x is readonly unknown[]} */
18899function isArray(x) {
18900    return toStr.call(x) === '[object Array]';
18901}
18902
18903/** @type {import('.')._internal} */
18904module.exports = function forEach(list, iterator, thisArg) {
18905    if (!isCallable(iterator)) {
18906        throw new TypeError('iterator must be a function');
18907    }
18908
18909    var receiver;
18910    if (arguments.length >= 3) {
18911        receiver = thisArg;
18912    }
18913
18914    if (isArray(list)) {
18915        forEachArray(list, iterator, receiver);
18916    } else if (typeof list === 'string') {
18917        forEachString(list, iterator, receiver);
18918    } else {
18919        forEachObject(list, iterator, receiver);
18920    }
18921};
18922
18923},{"is-callable":167}],150:[function(require,module,exports){
18924'use strict';
18925
18926/* eslint no-invalid-this: 1 */
18927
18928var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
18929var toStr = Object.prototype.toString;
18930var max = Math.max;
18931var funcType = '[object Function]';
18932
18933var concatty = function concatty(a, b) {
18934    var arr = [];
18935
18936    for (var i = 0; i < a.length; i += 1) {
18937        arr[i] = a[i];
18938    }
18939    for (var j = 0; j < b.length; j += 1) {
18940        arr[j + a.length] = b[j];
18941    }
18942
18943    return arr;
18944};
18945
18946var slicy = function slicy(arrLike, offset) {
18947    var arr = [];
18948    for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
18949        arr[j] = arrLike[i];
18950    }
18951    return arr;
18952};
18953
18954var joiny = function (arr, joiner) {
18955    var str = '';
18956    for (var i = 0; i < arr.length; i += 1) {
18957        str += arr[i];
18958        if (i + 1 < arr.length) {
18959            str += joiner;
18960        }
18961    }
18962    return str;
18963};
18964
18965module.exports = function bind(that) {
18966    var target = this;
18967    if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
18968        throw new TypeError(ERROR_MESSAGE + target);
18969    }
18970    var args = slicy(arguments, 1);
18971
18972    var bound;
18973    var binder = function () {
18974        if (this instanceof bound) {
18975            var result = target.apply(
18976                this,
18977                concatty(args, arguments)
18978            );
18979            if (Object(result) === result) {
18980                return result;
18981            }
18982            return this;
18983        }
18984        return target.apply(
18985            that,
18986            concatty(args, arguments)
18987        );
18988
18989    };
18990
18991    var boundLength = max(0, target.length - args.length);
18992    var boundArgs = [];
18993    for (var i = 0; i < boundLength; i++) {
18994        boundArgs[i] = '$' + i;
18995    }
18996
18997    bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
18998
18999    if (target.prototype) {
19000        var Empty = function Empty() {};
19001        Empty.prototype = target.prototype;
19002        bound.prototype = new Empty();
19003        Empty.prototype = null;
19004    }
19005
19006    return bound;
19007};
19008
19009},{}],151:[function(require,module,exports){
19010'use strict';
19011
19012var implementation = require('./implementation');
19013
19014module.exports = Function.prototype.bind || implementation;
19015
19016},{"./implementation":150}],152:[function(require,module,exports){
19017'use strict';
19018
19019/** @type {GeneratorFunctionConstructor | false} */
19020var cached;
19021
19022/** @type {import('./index.js')} */
19023module.exports = function getGeneratorFunction() {
19024	if (typeof cached === 'undefined') {
19025		try {
19026			// eslint-disable-next-line no-new-func
19027			cached = Function('return function* () {}')().constructor;
19028		} catch (e) {
19029			cached = false;
19030		}
19031	}
19032	return cached;
19033};
19034
19035
19036},{}],153:[function(require,module,exports){
19037'use strict';
19038
19039exports.__esModule = true;
19040var NODE_LIST_CLASSES = {
19041  '[object HTMLCollection]': true,
19042  '[object NodeList]': true,
19043  '[object RadioNodeList]': true
19044};
19045
19046// .type values for elements which can appear in .elements and should be ignored
19047var IGNORED_ELEMENT_TYPES = {
19048  'button': true,
19049  'fieldset': true,
19050  // 'keygen': true,
19051  // 'output': true,
19052  'reset': true,
19053  'submit': true
19054};
19055
19056var CHECKED_INPUT_TYPES = {
19057  'checkbox': true,
19058  'radio': true
19059};
19060
19061var TRIM_RE = /^\s+|\s+$/g;
19062
19063var slice = Array.prototype.slice;
19064var toString = Object.prototype.toString;
19065
19066/**
19067 * @param {HTMLFormElement} form
19068 * @param {Object} options
19069 * @return {Object.<string,(string|Array.<string>)>} an object containing
19070 *   submittable value(s) held in the form's .elements collection, with
19071 *   properties named as per element names or ids.
19072 */
19073function getFormData(form) {
19074  var options = arguments.length <= 1 || arguments[1] === undefined ? { trim: false } : arguments[1];
19075
19076  if (!form) {
19077    throw new Error('A form is required by getFormData, was given form=' + form);
19078  }
19079
19080  var data = {};
19081  var elementName = undefined;
19082  var elementNames = [];
19083  var elementNameLookup = {};
19084
19085  // Get unique submittable element names for the form
19086  for (var i = 0, l = form.elements.length; i < l; i++) {
19087    var element = form.elements[i];
19088    if (IGNORED_ELEMENT_TYPES[element.type] || element.disabled) {
19089      continue;
19090    }
19091    elementName = element.name || element.id;
19092    if (elementName && !elementNameLookup[elementName]) {
19093      elementNames.push(elementName);
19094      elementNameLookup[elementName] = true;
19095    }
19096  }
19097
19098  // Extract element data name-by-name for consistent handling of special cases
19099  // around elements which contain multiple inputs.
19100  for (var i = 0, l = elementNames.length; i < l; i++) {
19101    elementName = elementNames[i];
19102    var value = getNamedFormElementData(form, elementName, options);
19103    if (value != null) {
19104      data[elementName] = value;
19105    }
19106  }
19107
19108  return data;
19109}
19110
19111/**
19112 * @param {HTMLFormElement} form
19113 * @param {string} elementName
19114 * @param {Object} options
19115 * @return {(string|Array.<string>)} submittable value(s) in the form for a
19116 *   named element from its .elements collection, or null if there was no
19117 *   element with that name or the element had no submittable value(s).
19118 */
19119function getNamedFormElementData(form, elementName) {
19120  var options = arguments.length <= 2 || arguments[2] === undefined ? { trim: false } : arguments[2];
19121
19122  if (!form) {
19123    throw new Error('A form is required by getNamedFormElementData, was given form=' + form);
19124  }
19125  if (!elementName && toString.call(elementName) !== '[object String]') {
19126    throw new Error('A form element name is required by getNamedFormElementData, was given elementName=' + elementName);
19127  }
19128
19129  var element = form.elements[elementName];
19130  if (!element || element.disabled) {
19131    return null;
19132  }
19133
19134  if (!NODE_LIST_CLASSES[toString.call(element)]) {
19135    return getFormElementValue(element, options.trim);
19136  }
19137
19138  // Deal with multiple form controls which have the same name
19139  var data = [];
19140  var allRadios = true;
19141  for (var i = 0, l = element.length; i < l; i++) {
19142    if (element[i].disabled) {
19143      continue;
19144    }
19145    if (allRadios && element[i].type !== 'radio') {
19146      allRadios = false;
19147    }
19148    var value = getFormElementValue(element[i], options.trim);
19149    if (value != null) {
19150      data = data.concat(value);
19151    }
19152  }
19153
19154  // Special case for an element with multiple same-named inputs which were all
19155  // radio buttons: if there was a selected value, only return the value.
19156  if (allRadios && data.length === 1) {
19157    return data[0];
19158  }
19159
19160  return data.length > 0 ? data : null;
19161}
19162
19163/**
19164 * @param {HTMLElement} element a form element.
19165 * @param {booleam} trim should values for text entry inputs be trimmed?
19166 * @return {(string|Array.<string>|File|Array.<File>)} the element's submittable
19167 *   value(s), or null if it had none.
19168 */
19169function getFormElementValue(element, trim) {
19170  var value = null;
19171  var type = element.type;
19172
19173  if (type === 'select-one') {
19174    if (element.options.length) {
19175      value = element.options[element.selectedIndex].value;
19176    }
19177    return value;
19178  }
19179
19180  if (type === 'select-multiple') {
19181    value = [];
19182    for (var i = 0, l = element.options.length; i < l; i++) {
19183      if (element.options[i].selected) {
19184        value.push(element.options[i].value);
19185      }
19186    }
19187    if (value.length === 0) {
19188      value = null;
19189    }
19190    return value;
19191  }
19192
19193  // If a file input doesn't have a files attribute, fall through to using its
19194  // value attribute.
19195  if (type === 'file' && 'files' in element) {
19196    if (element.multiple) {
19197      value = slice.call(element.files);
19198      if (value.length === 0) {
19199        value = null;
19200      }
19201    } else {
19202      // Should be null if not present, according to the spec
19203      value = element.files[0];
19204    }
19205    return value;
19206  }
19207
19208  if (!CHECKED_INPUT_TYPES[type]) {
19209    value = trim ? element.value.replace(TRIM_RE, '') : element.value;
19210  } else if (element.checked) {
19211    value = element.value;
19212  }
19213
19214  return value;
19215}
19216
19217getFormData.getNamedFormElementData = getNamedFormElementData;
19218
19219exports['default'] = getFormData;
19220module.exports = exports['default'];
19221},{}],154:[function(require,module,exports){
19222'use strict';
19223
19224var undefined;
19225
19226var $Object = require('es-object-atoms');
19227
19228var $Error = require('es-errors');
19229var $EvalError = require('es-errors/eval');
19230var $RangeError = require('es-errors/range');
19231var $ReferenceError = require('es-errors/ref');
19232var $SyntaxError = require('es-errors/syntax');
19233var $TypeError = require('es-errors/type');
19234var $URIError = require('es-errors/uri');
19235
19236var abs = require('math-intrinsics/abs');
19237var floor = require('math-intrinsics/floor');
19238var max = require('math-intrinsics/max');
19239var min = require('math-intrinsics/min');
19240var pow = require('math-intrinsics/pow');
vendor: 5,463 bytes, lines 19241-19368
19241var round = require('math-intrinsics/round');
19242var sign = require('math-intrinsics/sign');
19243
19244var $Function = Function;
19245
19246// eslint-disable-next-line consistent-return
19247var getEvalledConstructor = function (expressionSyntax) {
19248	try {
19249		return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
19250	} catch (e) {}
19251};
19252
19253var $gOPD = require('gopd');
19254var $defineProperty = require('es-define-property');
19255
19256var throwTypeError = function () {
19257	throw new $TypeError();
19258};
19259var ThrowTypeError = $gOPD
19260	? (function () {
19261		try {
19262			// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
19263			arguments.callee; // IE 8 does not throw here
19264			return throwTypeError;
19265		} catch (calleeThrows) {
19266			try {
19267				// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
19268				return $gOPD(arguments, 'callee').get;
19269			} catch (gOPDthrows) {
19270				return throwTypeError;
19271			}
19272		}
19273	}())
19274	: throwTypeError;
19275
19276var hasSymbols = require('has-symbols')();
19277
19278var getProto = require('get-proto');
19279var $ObjectGPO = require('get-proto/Object.getPrototypeOf');
19280var $ReflectGPO = require('get-proto/Reflect.getPrototypeOf');
19281
19282var $apply = require('call-bind-apply-helpers/functionApply');
19283var $call = require('call-bind-apply-helpers/functionCall');
19284
19285var needsEval = {};
19286
19287var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);
19288
19289var INTRINSICS = {
19290	__proto__: null,
19291	'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
19292	'%Array%': Array,
19293	'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
19294	'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
19295	'%AsyncFromSyncIteratorPrototype%': undefined,
19296	'%AsyncFunction%': needsEval,
19297	'%AsyncGenerator%': needsEval,
19298	'%AsyncGeneratorFunction%': needsEval,
19299	'%AsyncIteratorPrototype%': needsEval,
19300	'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
19301	'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
19302	'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
19303	'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
19304	'%Boolean%': Boolean,
19305	'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
19306	'%Date%': Date,
19307	'%decodeURI%': decodeURI,
19308	'%decodeURIComponent%': decodeURIComponent,
19309	'%encodeURI%': encodeURI,
19310	'%encodeURIComponent%': encodeURIComponent,
19311	'%Error%': $Error,
19312	'%eval%': eval, // eslint-disable-line no-eval
19313	'%EvalError%': $EvalError,
19314	'%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array,
19315	'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
19316	'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
19317	'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
19318	'%Function%': $Function,
19319	'%GeneratorFunction%': needsEval,
19320	'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
19321	'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
19322	'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
19323	'%isFinite%': isFinite,
19324	'%isNaN%': isNaN,
19325	'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
19326	'%JSON%': typeof JSON === 'object' ? JSON : undefined,
19327	'%Map%': typeof Map === 'undefined' ? undefined : Map,
19328	'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
19329	'%Math%': Math,
19330	'%Number%': Number,
19331	'%Object%': $Object,
19332	'%Object.getOwnPropertyDescriptor%': $gOPD,
19333	'%parseFloat%': parseFloat,
19334	'%parseInt%': parseInt,
19335	'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
19336	'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
19337	'%RangeError%': $RangeError,
19338	'%ReferenceError%': $ReferenceError,
19339	'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
19340	'%RegExp%': RegExp,
19341	'%Set%': typeof Set === 'undefined' ? undefined : Set,
19342	'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
19343	'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
19344	'%String%': String,
19345	'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
19346	'%Symbol%': hasSymbols ? Symbol : undefined,
19347	'%SyntaxError%': $SyntaxError,
19348	'%ThrowTypeError%': ThrowTypeError,
19349	'%TypedArray%': TypedArray,
19350	'%TypeError%': $TypeError,
19351	'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
19352	'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
19353	'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
19354	'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
19355	'%URIError%': $URIError,
19356	'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
19357	'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
19358	'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,
19359
19360	'%Function.prototype.call%': $call,
19361	'%Function.prototype.apply%': $apply,
19362	'%Object.defineProperty%': $defineProperty,
19363	'%Object.getPrototypeOf%': $ObjectGPO,
19364	'%Math.abs%': abs,
19365	'%Math.floor%': floor,
19366	'%Math.max%': max,
19367	'%Math.min%': min,
19368	'%Math.pow%': pow,
vendor: 5,518 bytes, lines 19369-19504
19369	'%Math.round%': round,
19370	'%Math.sign%': sign,
19371	'%Reflect.getPrototypeOf%': $ReflectGPO
19372};
19373
19374if (getProto) {
19375	try {
19376		null.error; // eslint-disable-line no-unused-expressions
19377	} catch (e) {
19378		// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
19379		var errorProto = getProto(getProto(e));
19380		INTRINSICS['%Error.prototype%'] = errorProto;
19381	}
19382}
19383
19384var doEval = function doEval(name) {
19385	var value;
19386	if (name === '%AsyncFunction%') {
19387		value = getEvalledConstructor('async function () {}');
19388	} else if (name === '%GeneratorFunction%') {
19389		value = getEvalledConstructor('function* () {}');
19390	} else if (name === '%AsyncGeneratorFunction%') {
19391		value = getEvalledConstructor('async function* () {}');
19392	} else if (name === '%AsyncGenerator%') {
19393		var fn = doEval('%AsyncGeneratorFunction%');
19394		if (fn) {
19395			value = fn.prototype;
19396		}
19397	} else if (name === '%AsyncIteratorPrototype%') {
19398		var gen = doEval('%AsyncGenerator%');
19399		if (gen && getProto) {
19400			value = getProto(gen.prototype);
19401		}
19402	}
19403
19404	INTRINSICS[name] = value;
19405
19406	return value;
19407};
19408
19409var LEGACY_ALIASES = {
19410	__proto__: null,
19411	'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
19412	'%ArrayPrototype%': ['Array', 'prototype'],
19413	'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
19414	'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
19415	'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
19416	'%ArrayProto_values%': ['Array', 'prototype', 'values'],
19417	'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
19418	'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
19419	'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
19420	'%BooleanPrototype%': ['Boolean', 'prototype'],
19421	'%DataViewPrototype%': ['DataView', 'prototype'],
19422	'%DatePrototype%': ['Date', 'prototype'],
19423	'%ErrorPrototype%': ['Error', 'prototype'],
19424	'%EvalErrorPrototype%': ['EvalError', 'prototype'],
19425	'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
19426	'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
19427	'%FunctionPrototype%': ['Function', 'prototype'],
19428	'%Generator%': ['GeneratorFunction', 'prototype'],
19429	'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
19430	'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
19431	'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
19432	'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
19433	'%JSONParse%': ['JSON', 'parse'],
19434	'%JSONStringify%': ['JSON', 'stringify'],
19435	'%MapPrototype%': ['Map', 'prototype'],
19436	'%NumberPrototype%': ['Number', 'prototype'],
19437	'%ObjectPrototype%': ['Object', 'prototype'],
19438	'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
19439	'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
19440	'%PromisePrototype%': ['Promise', 'prototype'],
19441	'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
19442	'%Promise_all%': ['Promise', 'all'],
19443	'%Promise_reject%': ['Promise', 'reject'],
19444	'%Promise_resolve%': ['Promise', 'resolve'],
19445	'%RangeErrorPrototype%': ['RangeError', 'prototype'],
19446	'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
19447	'%RegExpPrototype%': ['RegExp', 'prototype'],
19448	'%SetPrototype%': ['Set', 'prototype'],
19449	'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
19450	'%StringPrototype%': ['String', 'prototype'],
19451	'%SymbolPrototype%': ['Symbol', 'prototype'],
19452	'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
19453	'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
19454	'%TypeErrorPrototype%': ['TypeError', 'prototype'],
19455	'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
19456	'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
19457	'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
19458	'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
19459	'%URIErrorPrototype%': ['URIError', 'prototype'],
19460	'%WeakMapPrototype%': ['WeakMap', 'prototype'],
19461	'%WeakSetPrototype%': ['WeakSet', 'prototype']
19462};
19463
19464var bind = require('function-bind');
19465var hasOwn = require('hasown');
19466var $concat = bind.call($call, Array.prototype.concat);
19467var $spliceApply = bind.call($apply, Array.prototype.splice);
19468var $replace = bind.call($call, String.prototype.replace);
19469var $strSlice = bind.call($call, String.prototype.slice);
19470var $exec = bind.call($call, RegExp.prototype.exec);
19471
19472/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
19473var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
19474var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
19475var stringToPath = function stringToPath(string) {
19476	var first = $strSlice(string, 0, 1);
19477	var last = $strSlice(string, -1);
19478	if (first === '%' && last !== '%') {
19479		throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
19480	} else if (last === '%' && first !== '%') {
19481		throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
19482	}
19483	var result = [];
19484	$replace(string, rePropName, function (match, number, quote, subString) {
19485		result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
19486	});
19487	return result;
19488};
19489/* end adaptation */
19490
19491var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
19492	var intrinsicName = name;
19493	var alias;
19494	if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
19495		alias = LEGACY_ALIASES[intrinsicName];
19496		intrinsicName = '%' + alias[0] + '%';
19497	}
19498
19499	if (hasOwn(INTRINSICS, intrinsicName)) {
19500		var value = INTRINSICS[intrinsicName];
19501		if (value === needsEval) {
19502			value = doEval(intrinsicName);
19503		}
19504		if (typeof value === 'undefined' && !allowMissing) {
vendor: 7,309 bytes, lines 19505-19727
19505			throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
19506		}
19507
19508		return {
19509			alias: alias,
19510			name: intrinsicName,
19511			value: value
19512		};
19513	}
19514
19515	throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
19516};
19517
19518module.exports = function GetIntrinsic(name, allowMissing) {
19519	if (typeof name !== 'string' || name.length === 0) {
19520		throw new $TypeError('intrinsic name must be a non-empty string');
19521	}
19522	if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
19523		throw new $TypeError('"allowMissing" argument must be a boolean');
19524	}
19525
19526	if ($exec(/^%?[^%]*%?$/, name) === null) {
19527		throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
19528	}
19529	var parts = stringToPath(name);
19530	var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
19531
19532	var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
19533	var intrinsicRealName = intrinsic.name;
19534	var value = intrinsic.value;
19535	var skipFurtherCaching = false;
19536
19537	var alias = intrinsic.alias;
19538	if (alias) {
19539		intrinsicBaseName = alias[0];
19540		$spliceApply(parts, $concat([0, 1], alias));
19541	}
19542
19543	for (var i = 1, isOwn = true; i < parts.length; i += 1) {
19544		var part = parts[i];
19545		var first = $strSlice(part, 0, 1);
19546		var last = $strSlice(part, -1);
19547		if (
19548			(
19549				(first === '"' || first === "'" || first === '`')
19550				|| (last === '"' || last === "'" || last === '`')
19551			)
19552			&& first !== last
19553		) {
19554			throw new $SyntaxError('property names with quotes must have matching quotes');
19555		}
19556		if (part === 'constructor' || !isOwn) {
19557			skipFurtherCaching = true;
19558		}
19559
19560		intrinsicBaseName += '.' + part;
19561		intrinsicRealName = '%' + intrinsicBaseName + '%';
19562
19563		if (hasOwn(INTRINSICS, intrinsicRealName)) {
19564			value = INTRINSICS[intrinsicRealName];
19565		} else if (value != null) {
19566			if (!(part in value)) {
19567				if (!allowMissing) {
19568					throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
19569				}
19570				return void undefined;
19571			}
19572			if ($gOPD && (i + 1) >= parts.length) {
19573				var desc = $gOPD(value, part);
19574				isOwn = !!desc;
19575
19576				// By convention, when a data property is converted to an accessor
19577				// property to emulate a data property that does not suffer from
19578				// the override mistake, that accessor's getter is marked with
19579				// an `originalValue` property. Here, when we detect this, we
19580				// uphold the illusion by pretending to see that original data
19581				// property, i.e., returning the value rather than the getter
19582				// itself.
19583				if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
19584					value = desc.get;
19585				} else {
19586					value = value[part];
19587				}
19588			} else {
19589				isOwn = hasOwn(value, part);
19590				value = value[part];
19591			}
19592
19593			if (isOwn && !skipFurtherCaching) {
19594				INTRINSICS[intrinsicRealName] = value;
19595			}
19596		}
19597	}
19598	return value;
19599};
19600
19601},{"call-bind-apply-helpers/functionApply":119,"call-bind-apply-helpers/functionCall":120,"es-define-property":140,"es-errors":142,"es-errors/eval":141,"es-errors/range":143,"es-errors/ref":144,"es-errors/syntax":145,"es-errors/type":146,"es-errors/uri":147,"es-object-atoms":148,"function-bind":151,"get-proto":157,"get-proto/Object.getPrototypeOf":155,"get-proto/Reflect.getPrototypeOf":156,"gopd":159,"has-symbols":161,"hasown":164,"math-intrinsics/abs":176,"math-intrinsics/floor":177,"math-intrinsics/max":179,"math-intrinsics/min":180,"math-intrinsics/pow":181,"math-intrinsics/round":182,"math-intrinsics/sign":183}],155:[function(require,module,exports){
19602'use strict';
19603
19604var $Object = require('es-object-atoms');
19605
19606/** @type {import('./Object.getPrototypeOf')} */
19607module.exports = $Object.getPrototypeOf || null;
19608
19609},{"es-object-atoms":148}],156:[function(require,module,exports){
19610'use strict';
19611
19612/** @type {import('./Reflect.getPrototypeOf')} */
19613module.exports = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null;
19614
19615},{}],157:[function(require,module,exports){
19616'use strict';
19617
19618var reflectGetProto = require('./Reflect.getPrototypeOf');
19619var originalGetProto = require('./Object.getPrototypeOf');
19620
19621var getDunderProto = require('dunder-proto/get');
19622
19623/** @type {import('.')} */
19624module.exports = reflectGetProto
19625	? function getProto(O) {
19626		// @ts-expect-error TS can't narrow inside a closure, for some reason
19627		return reflectGetProto(O);
19628	}
19629	: originalGetProto
19630		? function getProto(O) {
19631			if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
19632				throw new TypeError('getProto: not an object');
19633			}
19634			// @ts-expect-error TS can't narrow inside a closure, for some reason
19635			return originalGetProto(O);
19636		}
19637		: getDunderProto
19638			? function getProto(O) {
19639				// @ts-expect-error TS can't narrow inside a closure, for some reason
19640				return getDunderProto(O);
19641			}
19642			: null;
19643
19644},{"./Object.getPrototypeOf":155,"./Reflect.getPrototypeOf":156,"dunder-proto/get":139}],158:[function(require,module,exports){
19645'use strict';
19646
19647/** @type {import('./gOPD')} */
19648module.exports = Object.getOwnPropertyDescriptor;
19649
19650},{}],159:[function(require,module,exports){
19651'use strict';
19652
19653/** @type {import('.')} */
19654var $gOPD = require('./gOPD');
19655
19656if ($gOPD) {
19657	try {
19658		$gOPD([], 'length');
19659	} catch (e) {
19660		// IE 8 has a broken gOPD
19661		$gOPD = null;
19662	}
19663}
19664
19665module.exports = $gOPD;
19666
19667},{"./gOPD":158}],160:[function(require,module,exports){
19668'use strict';
19669
19670var $defineProperty = require('es-define-property');
19671
19672var hasPropertyDescriptors = function hasPropertyDescriptors() {
19673	return !!$defineProperty;
19674};
19675
19676hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
19677	// node v0.6 has a bug where array lengths can be Set but not Defined
19678	if (!$defineProperty) {
19679		return null;
19680	}
19681	try {
19682		return $defineProperty([], 'length', { value: 1 }).length !== 1;
19683	} catch (e) {
19684		// In Firefox 4-22, defining length on an array throws an exception.
19685		return true;
19686	}
19687};
19688
19689module.exports = hasPropertyDescriptors;
19690
19691},{"es-define-property":140}],161:[function(require,module,exports){
19692'use strict';
19693
19694var origSymbol = typeof Symbol !== 'undefined' && Symbol;
19695var hasSymbolSham = require('./shams');
19696
19697/** @type {import('.')} */
19698module.exports = function hasNativeSymbols() {
19699	if (typeof origSymbol !== 'function') { return false; }
19700	if (typeof Symbol !== 'function') { return false; }
19701	if (typeof origSymbol('foo') !== 'symbol') { return false; }
19702	if (typeof Symbol('bar') !== 'symbol') { return false; }
19703
19704	return hasSymbolSham();
19705};
19706
19707},{"./shams":162}],162:[function(require,module,exports){
19708'use strict';
19709
19710/** @type {import('./shams')} */
19711/* eslint complexity: [2, 18], max-statements: [2, 33] */
19712module.exports = function hasSymbols() {
19713	if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
19714	if (typeof Symbol.iterator === 'symbol') { return true; }
19715
19716	/** @type {{ [k in symbol]?: unknown }} */
19717	var obj = {};
19718	var sym = Symbol('test');
19719	var symObj = Object(sym);
19720	if (typeof sym === 'string') { return false; }
19721
19722	if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
19723	if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
19724
19725	// temp disabled per https://github.com/ljharb/object.assign/issues/17
19726	// if (sym instanceof Symbol) { return false; }
19727	// temp disabled per https://github.com/WebReflection/get-own-property-symbol
vendor: 8,682 bytes, lines 19727-20007
19727s/issues/4
19728	// if (!(symObj instanceof Symbol)) { return false; }
19729
19730	// if (typeof Symbol.prototype.toString !== 'function') { return false; }
19731	// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
19732
19733	var symVal = 42;
19734	obj[sym] = symVal;
19735	for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
19736	if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
19737
19738	if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
19739
19740	var syms = Object.getOwnPropertySymbols(obj);
19741	if (syms.length !== 1 || syms[0] !== sym) { return false; }
19742
19743	if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
19744
19745	if (typeof Object.getOwnPropertyDescriptor === 'function') {
19746		// eslint-disable-next-line no-extra-parens
19747		var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym));
19748		if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
19749	}
19750
19751	return true;
19752};
19753
19754},{}],163:[function(require,module,exports){
19755'use strict';
19756
19757var hasSymbols = require('has-symbols/shams');
19758
19759/** @type {import('.')} */
19760module.exports = function hasToStringTagShams() {
19761	return hasSymbols() && !!Symbol.toStringTag;
19762};
19763
19764},{"has-symbols/shams":162}],164:[function(require,module,exports){
19765'use strict';
19766
19767var call = Function.prototype.call;
19768var $hasOwn = Object.prototype.hasOwnProperty;
19769var bind = require('function-bind');
19770
19771/** @type {import('.')} */
19772module.exports = bind.call(call, $hasOwn);
19773
19774},{"function-bind":151}],165:[function(require,module,exports){
19775if (typeof Object.create === 'function') {
19776  // implementation from standard node.js 'util' module
19777  module.exports = function inherits(ctor, superCtor) {
19778    if (superCtor) {
19779      ctor.super_ = superCtor
19780      ctor.prototype = Object.create(superCtor.prototype, {
19781        constructor: {
19782          value: ctor,
19783          enumerable: false,
19784          writable: true,
19785          configurable: true
19786        }
19787      })
19788    }
19789  };
19790} else {
19791  // old school shim for old browsers
19792  module.exports = function inherits(ctor, superCtor) {
19793    if (superCtor) {
19794      ctor.super_ = superCtor
19795      var TempCtor = function () {}
19796      TempCtor.prototype = superCtor.prototype
19797      ctor.prototype = new TempCtor()
19798      ctor.prototype.constructor = ctor
19799    }
19800  }
19801}
19802
19803},{}],166:[function(require,module,exports){
19804'use strict';
19805
19806var hasToStringTag = require('has-tostringtag/shams')();
19807var callBound = require('call-bound');
19808
19809var $toString = callBound('Object.prototype.toString');
19810
19811/** @type {import('.')} */
19812var isStandardArguments = function isArguments(value) {
19813	if (
19814		hasToStringTag
19815		&& value
19816		&& typeof value === 'object'
19817		&& Symbol.toStringTag in value
19818	) {
19819		return false;
19820	}
19821	return $toString(value) === '[object Arguments]';
19822};
19823
19824/** @type {import('.')} */
19825var isLegacyArguments = function isArguments(value) {
19826	if (isStandardArguments(value)) {
19827		return true;
19828	}
19829	return value !== null
19830		&& typeof value === 'object'
19831		&& 'length' in value
19832		&& typeof value.length === 'number'
19833		&& value.length >= 0
19834		&& $toString(value) !== '[object Array]'
19835		&& 'callee' in value
19836		&& $toString(value.callee) === '[object Function]';
19837};
19838
19839var supportsStandardArguments = (function () {
19840	return isStandardArguments(arguments);
19841}());
19842
19843// @ts-expect-error TODO make this not error
19844isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
19845
19846/** @type {import('.')} */
19847module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
19848
19849},{"call-bound":124,"has-tostringtag/shams":163}],167:[function(require,module,exports){
19850'use strict';
19851
19852var fnToStr = Function.prototype.toString;
19853var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
19854var badArrayLike;
19855var isCallableMarker;
19856if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
19857	try {
19858		badArrayLike = Object.defineProperty({}, 'length', {
19859			get: function () {
19860				throw isCallableMarker;
19861			}
19862		});
19863		isCallableMarker = {};
19864		// eslint-disable-next-line no-throw-literal
19865		reflectApply(function () { throw 42; }, null, badArrayLike);
19866	} catch (_) {
19867		if (_ !== isCallableMarker) {
19868			reflectApply = null;
19869		}
19870	}
19871} else {
19872	reflectApply = null;
19873}
19874
19875var constructorRegex = /^\s*class\b/;
19876var isES6ClassFn = function isES6ClassFunction(value) {
19877	try {
19878		var fnStr = fnToStr.call(value);
19879		return constructorRegex.test(fnStr);
19880	} catch (e) {
19881		return false; // not a function
19882	}
19883};
19884
19885var tryFunctionObject = function tryFunctionToStr(value) {
19886	try {
19887		if (isES6ClassFn(value)) { return false; }
19888		fnToStr.call(value);
19889		return true;
19890	} catch (e) {
19891		return false;
19892	}
19893};
19894var toStr = Object.prototype.toString;
19895var objectClass = '[object Object]';
19896var fnClass = '[object Function]';
19897var genClass = '[object GeneratorFunction]';
19898var ddaClass = '[object HTMLAllCollection]'; // IE 11
19899var ddaClass2 = '[object HTML document.all class]';
19900var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
19901var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
19902
19903var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
19904
19905var isDDA = function isDocumentDotAll() { return false; };
19906if (typeof document === 'object') {
19907	// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
19908	var all = document.all;
19909	if (toStr.call(all) === toStr.call(document.all)) {
19910		isDDA = function isDocumentDotAll(value) {
19911			/* globals document: false */
19912			// in IE 6-8, typeof document.all is "object" and it's truthy
19913			if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
19914				try {
19915					var str = toStr.call(value);
19916					return (
19917						str === ddaClass
19918						|| str === ddaClass2
19919						|| str === ddaClass3 // opera 12.16
19920						|| str === objectClass // IE 6-8
19921					) && value('') == null; // eslint-disable-line eqeqeq
19922				} catch (e) { /**/ }
19923			}
19924			return false;
19925		};
19926	}
19927}
19928
19929module.exports = reflectApply
19930	? function isCallable(value) {
19931		if (isDDA(value)) { return true; }
19932		if (!value) { return false; }
19933		if (typeof value !== 'function' && typeof value !== 'object') { return false; }
19934		try {
19935			reflectApply(value, null, badArrayLike);
19936		} catch (e) {
19937			if (e !== isCallableMarker) { return false; }
19938		}
19939		return !isES6ClassFn(value) && tryFunctionObject(value);
19940	}
19941	: function isCallable(value) {
19942		if (isDDA(value)) { return true; }
19943		if (!value) { return false; }
19944		if (typeof value !== 'function' && typeof value !== 'object') { return false; }
19945		if (hasToStringTag) { return tryFunctionObject(value); }
19946		if (isES6ClassFn(value)) { return false; }
19947		var strClass = toStr.call(value);
19948		if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; }
19949		return tryFunctionObject(value);
19950	};
19951
19952},{}],168:[function(require,module,exports){
19953'use strict';
19954
19955var callBound = require('call-bound');
19956var safeRegexTest = require('safe-regex-test');
19957var isFnRegex = safeRegexTest(/^\s*(?:function)?\*/);
19958var hasToStringTag = require('has-tostringtag/shams')();
19959var getProto = require('get-proto');
19960
19961var toStr = callBound('Object.prototype.toString');
19962var fnToStr = callBound('Function.prototype.toString');
19963
19964var getGeneratorFunction = require('generator-function');
19965
19966/** @type {import('.')} */
19967module.exports = function isGeneratorFunction(fn) {
19968	if (typeof fn !== 'function') {
19969		return false;
19970	}
19971	if (isFnRegex(fnToStr(fn))) {
19972		return true;
19973	}
19974	if (!hasToStringTag) {
19975		var str = toStr(fn);
19976		return str === '[object GeneratorFunction]';
19977	}
19978	if (!getProto) {
19979		return false;
19980	}
19981	var GeneratorFunction = getGeneratorFunction();
19982	return GeneratorFunction && getProto(fn) === GeneratorFunction.prototype;
19983};
19984
19985},{"call-bound":124,"generator-function":152,"get-proto":157,"has-tostringtag/shams":163,"safe-regex-test":187}],169:[function(require,module,exports){
19986'use strict';
19987
19988var callBound = require('call-bound');
19989var hasToStringTag = require('has-tostringtag/shams')();
19990var hasOwn = require('hasown');
19991var gOPD = require('gopd');
19992
19993/** @type {import('.')} */
19994var fn;
19995
19996if (hasToStringTag) {
19997	/** @type {(receiver: ThisParameterType<typeof RegExp.prototype.exec>, ...args: Parameters<typeof RegExp.prototype.exec>) => ReturnType<typeof RegExp.prototype.exec>} */
19998	var $exec = callBound('RegExp.prototype.exec');
19999	/** @type {object} */
20000	var isRegexMarker = {};
20001
20002	var throwRegexMarker = function () {
20003		throw isRegexMarker;
20004	};
20005	/** @type {{ toString(): never, valueOf(): never, [Symbol.toPrimitive]?(): never }} */
20006	var badStringifier = {
20007		toString: throwRegexMarker,
20008		valueOf: throwRegexMarker
20009	};
20010
20011	if (typeof Symbol.toPrimitive === 'symbol') {
20012		badStringifier[Symbol.toPrimitive] = throwRegexMarker;
20013	}
20014
20015	/** @type {import('.')} */
20016	// @ts-expect-error TS can't figure out that the $exec call always throws
20017	// eslint-disable-next-line consistent-return
20018	fn = function isRegex(value) {
20019		if (!value || typeof value !== 'object') {
20020			return false;
20021		}
20022
20023		// eslint-disable-next-line no-extra-parens
20024		var descriptor = /** @type {NonNullable<typeof gOPD>} */ (gOPD)(/** @type {{ lastIndex?: unknown }} */ (value), 'lastIndex');
20025		var hasLastIndexDataProperty = descriptor && hasOwn(descriptor, 'value');
20026		if (!hasLastIndexDataProperty) {
20027			return false;
20028		}
20029
20030		try {
20031			// eslint-disable-next-line no-extra-parens
20032			$exec(value, /** @type {string} */ (/** @type {unknown} */ (badStringifier)));
20033		} catch (e) {
20034			return e === isRegexMarker;
20035		}
20036	};
20037} else {
20038	/** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
20039	var $toString = callBound('Object.prototype.toString');
20040	/** @const @type {'[object RegExp]'} */
20041	var regexClass = '[object RegExp]';
20042
20043	/** @type {import('.')} */
20044	fn = function isRegex(value) {
20045		// In older browsers, typeof regex incorrectly returns 'function'
20046		if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
20047			return false;
20048		}
20049
20050		return $toString(value) === regexClass;
20051	};
20052}
20053
20054module.exports = fn;
20055
20056},{"call-bound":124,"gopd":159,"has-tostringtag/shams":163,"hasown":164}],170:[function(require,module,exports){
20057'use strict';
20058
20059var whichTypedArray = require('which-typed-array');
20060
20061/** @type {import('.')} */
20062module.exports = function isTypedArray(value) {
20063	return !!whichTypedArray(value);
20064};
20065
20066},{"which-typed-array":200}],171:[function(require,module,exports){
20067/*!
20068 * JavaScript Cookie v2.2.1
20069 * https://github.com/js-cookie/js-cookie
20070 *
20071 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
20072 * Released under the MIT license
20073 */
20074;(function (factory) {
20075	var registeredInModuleLoader;
20076	if (typeof define === 'function' && define.amd) {
20077		define(factory);
20078		registeredInModuleLoader = true;
20079	}
20080	if (typeof exports === 'object') {
20081		module.exports = factory();
20082		registeredInModuleLoader = true;
20083	}
20084	if (!registeredInModuleLoader) {
20085		var OldCookies = window.Cookies;
20086		var api = window.Cookies = factory();
20087		api.noConflict = function () {
20088			window.Cookies = OldCookies;
20089			return api;
20090		};
20091	}
20092}(function () {
20093	function extend () {
20094		var i = 0;
20095		var result = {};
20096		for (; i < arguments.length; i++) {
20097			var attributes = arguments[ i ];
20098			for (var key in attributes) {
20099				result[key] = attributes[key];
20100			}
20101		}
20102		return result;
20103	}
20104
20105	function decode (s) {
20106		return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
20107	}
20108
20109	function init (converter) {
20110		function api() {}
20111
20112		function set (key, value, attributes) {
20113			if (typeof document === 'undefined') {
20114				return;
20115			}
20116
20117			attributes = extend({
20118				path: '/'
20119			}, api.defaults, attributes);
20120
20121			if (typeof attributes.expires === 'number') {
20122				attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
20123			}
20124
20125			// We're using "expires" because "max-age" is not supported by IE
20126			attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
20127
20128			try {
20129				var result = JSON.stringify(value);
20130				if (/^[\{\[]/.test(result)) {
20131					value = result;
20132				}
20133			} catch (e) {}
20134
20135			value = converter.write ?
20136				converter.write(value, key) :
20137				encodeURIComponent(String(value))
20138					.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
20139
20140			key = encodeURIComponent(String(key))
20141				.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
20142				.replace(/[\(\)]/g, escape);
20143
20144			var stringifiedAttributes = '';
20145			for (var attributeName in attributes) {
20146				if (!attributes[attributeName]) {
20147					continue;
20148				}
20149				stringifiedAttributes += '; ' + attributeName;
20150				if (attributes[attributeName] === true) {
20151					continue;
20152				}
20153
20154				// Considers RFC 6265 section 5.2:
20155				// ...
20156				// 3.  If the remaining unparsed-attributes contains a %x3B (";")
20157				//     character:
20158				// Consume the characters of the unparsed-attributes up to,
20159				// not including, the first %x3B (";") character.
20160				// ...
20161				stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
20162			}
20163
20164			return (document.cookie = key + '=' + value + stringifiedAttributes);
20165		}
20166
20167		function get (key, json) {
20168			if (typeof document === 'undefined') {
20169				return;
20170			}
20171
20172			var jar = {};
20173			// To prevent the for loop in the first place assign an empty array
20174			// in case there are no cookies at all.
20175			var cookies = document.cookie ? document.cookie.split('; ') : [];
20176			var i = 0;
20177
20178			for (; i < cookies.length; i++) {
20179				var parts = cookies[i].split('=');
20180				var cookie = parts.slice(1).join('=');
20181
20182				if (!json && cookie.charAt(0) === '"') {
20183					cookie = cookie.slice(1, -1);
20184				}
20185
20186				try {
20187					var name = decode(parts[0]);
20188					cookie = (converter.read || converter)(cookie, name) ||
20189						decode(cookie);
20190
20191					if (json) {
20192						try {
20193							cookie = JSON.parse(cookie);
20194						} catch (e) {}
20195					}
20196
20197					jar[name] = cookie;
20198
20199					if (key === name) {
20200						break;
20201					}
20202				} catch (e) {}
20203			}
20204
20205			return key ? jar[key] : jar;
20206		}
20207
20208		api.set = set;
20209		api.get = function (key) {
20210			return get(key, false /* read as raw */);
20211		};
20212		api.getJSON = function (key) {
20213			return get(key, true /* read as json */);
20214		};
20215		api.remove = function (key, attributes) {
20216			set(key, '', extend(attributes, {
20217				expires: -1
20218			}));
20219		};
20220
20221		api.defaults = {};
20222
20223		api.withConverter = init;
20224
20225		return api;
20226	}
20227
20228	return init(function () {});
20229}));
20230
20231},{}],172:[function(require,module,exports){
20232/**
20233 * (c) David Giesemann
20234 * [email protected]
20235 */
20236
20237class RangeSlider {
20238    #element
20239    #maxInput
20240    #maxOutput
20241    #minInput
20242    #minOutput
20243    #progress
20244    #settings
20245
20246    constructor(element,options){
20247        this.#element = element
20248        this.#settings = Object.assign({
20249            min: this.#element.dataset.min || 0,
20250            max: this.#element.dataset.max || 100,
20251            minInputName: "min",
20252            maxInputName: "max",
20253            minInputValue: this.#element.dataset.vmin || 0,
20254            maxInputValue: this.#element.dataset.vmax || 100,
20255            step: this.#element.dataset.step || 1,
20256            outputFormatter: output => `${output} &euro;`,
20257            progress: true,
20258            output: true,
20259        },options)
20260
20261        const slider = this.#getHTMLElement("div")
20262        slider.className = "slider"
20263
20264        if(this.#settings.progress){
20265            this.#progress = this.#getHTMLElement("div")
20266            this.#progress.className = "progress"
20267            slider.appendChild(this.#progress)
20268        }
20269
20270        this.#minInput = this.#getHTMLElement("input",{
20271            type: "range",
20272            min: this.#settings.min,
20273            max: this.#settings.max,
20274            name: this.#settings.minInputName,
20275            value: this.#settings.minInputValue,
20276            step: this.#settings.step
20277        })
20278        slider.appendChild(this.#minInput)
20279
20280        this.#maxInput = this.#getHTMLElement("input",{
20281            type: "range",
20282            min: this.#settings.min,
20283            max: this.#settings.max,
20284            name: this.#settings.maxInputName,
20285            value: this.#settings.maxInputValue,
20286            step: this.#settings.step
20287        })
20288        slider.appendChild(this.#maxInput)
20289
20290        this.#element.appendChild(slider)
20291
20292        if(this.#settings.output){
20293            const output = this.#getHTMLElement("div")
20294            output.className = "output"
20295
20296            this.#minOutput = this.#getHTMLElement("span")
20297            output.appendChild(this.#minOutput)
20298
20299            this.#maxOutput = this.#getHTMLElement("span")
20300            output.appendChild(this.#maxOutput)
20301
20302            this.#element.appendChild(output)
20303        }
20304
20305        this.min = this.#settings.minInputValue
20306        this.max = this.#settings.maxInputValue
20307
20308        this.#init()
20309    }
20310
20311    get min(){
20312        return this.#minInput.value * 1
20313    }
20314
20315    get max(){
20316        return this.#maxInput.value * 1
20317    }
20318
20319    set min(v){
20320        this.#minInput.value = v <= this.max ? v : this.max
20321
20322        if(this.#settings.output) this.#minOutput.innerHTML = `${this.#settings.outputFormatter(this.min)}`
20323
20324        const quotient = (this.min - this.#settings.min) / (this.#settings.max - this.#settings.min)
20325        const percentage = quotient * 100
20326        const handleDiameter = this.#element.querySelector(".slider").clientHeight
20327
20328        if(this.#settings.progress) this.#progress.style.left = `calc( ${percentage}% - ${quotient} * ${handleDiameter}px )`
20329    }
20330
20331    set max(v){
20332        this.#maxInput.value = v >= this.min ? v : this.min
20333
20334        if(this.#settings.output) this.#maxOutput.innerHTML = `${this.#settings.outputFormatter(this.max)}`
20335
20336        const quotient = 1 - ((this.max - this.#settings.min) / (this.#settings.max - this.#settings.min))
20337        const percentage = quotient * 100
20338        const handleDiameter = this.#element.querySelector(".slider").clientHeight
20339
20340        if(this.#settings.progress) this.#progress.style.right = `
20340calc( ${percentage}% - ${quotient} * ${handleDiameter}px )`
20341    }
20342
20343    #getHTMLElement(tagName,attributes){
20344        const element = document.createElement(tagName)
20345
20346        for (const attribute in attributes){
20347            element.setAttribute(attribute,attributes[attribute])
20348        }
20349
20350        return element
20351    }
20352
20353    #init(){
20354        this.#element.addEventListener("input", e => {
20355            if(e.target === this.#minInput) this.min = e.target.value
20356            if(e.target === this.#maxInput) this.max = e.target.value
20357        })
20358    }
20359}
20360
20361module.exports = RangeSlider
20362
20363},{}],173:[function(require,module,exports){
20364const ELLIPSIS_CHARACTER = '\u2026'
20365
20366function lineClamp (rootElement, lineCount, options) {
20367  rootElement.style.cssText +=
20368    'overflow:hidden;overflow-wrap:break-word;word-wrap:break-word'
20369
20370  const maximumHeight =
20371    (lineCount || 1) *
20372    parseInt(window.getComputedStyle(rootElement).lineHeight, 10)
20373
20374  // Exit if text does not overflow `rootElement`.
20375  if (rootElement.scrollHeight <= maximumHeight) {
20376    return false
20377  }
20378
20379  return truncateElementNode(
20380    rootElement,
20381    rootElement,
20382    maximumHeight,
20383    (options && options.ellipsis) || ELLIPSIS_CHARACTER
20384  )
20385}
20386
20387function truncateElementNode (
20388  element,
20389  rootElement,
20390  maximumHeight,
20391  ellipsisCharacter
20392) {
20393  const childNodes = element.childNodes
20394  let i = childNodes.length - 1
20395  while (i > -1) {
20396    const childNode = childNodes[i--]
20397    if (
20398      (childNode.nodeType === 1 &&
20399        truncateElementNode(
20400          childNode,
20401          rootElement,
20402          maximumHeight,
20403          ellipsisCharacter
20404        )) ||
20405      (childNode.nodeType === 3 &&
20406        truncateTextNode(
20407          childNode,
20408          rootElement,
20409          maximumHeight,
20410          ellipsisCharacter
20411        ))
20412    ) {
20413      return true
20414    }
20415    element.removeChild(childNode)
20416  }
20417  return false
20418}
20419
20420function truncateTextNode (
20421  textNode,
20422  rootElement,
20423  maximumHeight,
20424  ellipsisCharacter
20425) {
20426  let lastIndexOfWhitespace
20427  let textContent = textNode.textContent
20428  while (textContent.length > 1) {
20429    lastIndexOfWhitespace = textContent.lastIndexOf(' ')
20430    if (lastIndexOfWhitespace === -1) {
20431      break
20432    }
20433    textNode.textContent = textContent.substring(0, lastIndexOfWhitespace)
20434    if (rootElement.scrollHeight <= maximumHeight) {
20435      textNode.textContent = textContent
20436      break
20437    }
20438    textContent = textNode.textContent
20439  }
20440  return truncateTextNodeByCharacter(
20441    textNode,
20442    rootElement,
20443    maximumHeight,
20444    ellipsisCharacter
20445  )
20446}
20447
20448const TRAILING_WHITESPACE_AND_PUNCTUATION_REGEX = /[ .,;!?'‘’“”\-–—]+$/
20449
20450function truncateTextNodeByCharacter (
20451  textNode,
20452  rootElement,
20453  maximumHeight,
20454  ellipsisCharacter
20455) {
20456  let textContent = textNode.textContent
20457  let length = textContent.length
20458  while (length > 1) {
20459    // Trim off one trailing character and any trailing punctuation and whitespace.
20460    textContent = textContent
20461      .substring(0, length - 1)
20462      .replace(TRAILING_WHITESPACE_AND_PUNCTUATION_REGEX, '')
20463    length = textContent.length
20464    textNode.textContent = textContent + ellipsisCharacter
20465    if (rootElement.scrollHeight <= maximumHeight) {
20466      return true
20467    }
20468  }
20469  return false
20470}
20471
20472module.exports = lineClamp
20473
20474},{}],174:[function(require,module,exports){
20475/*! load-script2. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
20476module.exports = function loadScript2 (src, attrs, parentNode) {
20477  return new Promise((resolve, reject) => {
20478    const script = document.createElement('script')
20479    script.async = true
20480    script.src = src
20481
20482    for (const [k, v] of Object.entries(attrs || {})) {
20483      script.setAttribute(k, v)
20484    }
20485
20486    script.onload = () => {
20487      script.onerror = script.onload = null
20488      resolve(script)
20489    }
20490
20491    script.onerror = () => {
20492      script.onerror = script.onload = null
20493      reject(new Error(`Failed to load ${src}`))
20494    }
20495
20496    const node = parentNode || document.head || document.getElementsByTagName('head')[0]
20497    node.appendChild(script)
20498  })
20499}
20500
20501},{}],175:[function(require,module,exports){
20502(function webpackUniversalModuleDefinition(root, factory) {
20503	if(typeof exports === 'object' && typeof module === 'object')
20504		module.exports = factory();
20505	else if(typeof define === 'function' && define.amd)
20506		define([], factory);
20507	else {
20508		var a = factory();
20509		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
20510	}
20511})(typeof self !== 'undefined' ? self : this, function() {
20512return /******/ (function(modules) { // webpackBootstrap
20513/******/ 	// The module cache
20514/******/ 	var installedModules = {};
20515/******/
20516/******/ 	// The require function
20517/******/ 	function __webpack_require__(moduleId) {
20518/******/
20519/******/ 		// Check if module is in cache
20520/******/ 		if(installedModules[moduleId]) {
20521/******/ 			return installedModules[moduleId].exports;
20522/******/ 		}
20523/******/ 		// Create a new module (and put it into the cache)
20524/******/ 		var module = installedModules[moduleId] = {
20525/******/ 			i: moduleId,
20526/******/ 			l: false,
20527/******/ 			exports: {}
20528/******/ 		};
20529/******/
20530/******/ 		// Execute the module function
20531/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
20532/******/
20533/******/ 		// Flag the module as loaded
20534/******/ 		module.l = true;
20535/******/
20536/******/ 		// Return the exports of the module
20537/******/ 		return module.exports;
20538/******/ 	}
20539/******/
20540/******/
20541/******/ 	// expose the modules object (__webpack_modules__)
20542/******/ 	__webpack_require__.m = modules;
20543/******/
20544/******/ 	// expose the module cache
20545/******/ 	__webpack_require__.c = installedModules;
20546/******/
20547/******/ 	// define getter function for harmony exports
20548/******/ 	__webpack_require__.d = function(exports, name, getter) {
20549/******/ 		if(!__webpack_require__.o(exports, name)) {
20550/******/ 			Object.defineProperty(exports, name, {
20551/******/ 				configurable: false,
20552/******/ 				enumerable: true,
20553/******/ 				get: getter
20554/******/ 			});
20555/******/ 		}
20556/******/ 	};
20557/******/
20558/******/ 	// getDefaultExport function for compatibility with non-harmony modules
20559/******/ 	__webpack_require__.n = function(module) {
20560/******/ 		var getter = module && module.__esModule ?
20561/******/ 			function getDefault() { return module['default']; } :
20562/******/ 			function getModuleExports() { return module; };
20563/******/ 		__webpack_require__.d(getter, 'a', getter);
20564/******/ 		return getter;
20565/******/ 	};
20566/******/
20567/******/ 	// Object.prototype.hasOwnProperty.call
20568/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
20569/******/
20570/******/ 	// __webpack_public_path__
20571/******/ 	__webpack_require__.p = "";
20572/******/
20573/******/ 	// Load entry module and return exports
20574/******/ 	return __webpack_require__(__webpack_require__.s = 7);
20575/******/ })
20576/************************************************************************/
20577/******/ ([
20578/* 0 */
20579/***/ (function(module, exports, __webpack_require__) {
20580
20581"use strict";
20582
20583
20584Object.defineProperty(exports, "__esModule", {
20585    value: true
20586});
20587
20588var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* globals jQuery */
20589
20590exports.lory = lory;
20591
20592var _detectPrefixes = __webpack_require__(1);
20593
20594var _detectPrefixes2 = _interopRequireDefault(_detectPrefixes);
20595
20596var _detectSupportsPassive = __webpack_require__(2);
20597
20598var _detectSupportsPassive2 = _interopRequireDefault(_detectSupportsPassive);
20599
20600var _dispatchEvent = __webpack_require__(3);
20601
20602var _dispatchEvent2 = _interopRequireDefault(_dispatchEvent);
20603
20604var _defaults = __webpack_require__(6);
20605
20606var _defaults2 = _interopRequireDefault(_defaults);
20607
20608function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20609
20610var slice = Array.prototype.slice;
20611
20612function lory(slider, opts) {
20613    var position = void 0;
20614    var slidesWidth = void 0;
20615    var frameWidth = void 0;
20616    var slides = void 0;
20617
20618    /**
20619     * slider DOM elements
20620     */
20621    var frame = void 0;
20622    var slideContainer = void 0;
20623    var prevCtrl = void 0;
20624    var nextCtrl = void 0;
20625    var prefixes = void 0;
20626    var transitionEndCallback = void 0;
20627
20628    var index = 0;
20629    var options = {};
20630    var touchEventParams = (0, _detectSupportsPassive2.default)() ? { passive: true } : false;
20631
20632    /**
20633     * if object is jQuery convert to native DOM element
20634     */
20635    if (typeof jQuery !== 'undefined' && slider instanceof jQuery) {
20636        slider = slider[0];
20637    }
20638
20639    /**
20640     * private
20641     * set active class to element which is the current slide
20642     */
20643    function setActiveElement(slides, currentIndex) {
20644        var _options = options,
20645            classNameActiveSlide = _options.classNameActiveSlide;
20646
20647
20648        slides.forEach(function (element, index) {
20649            if (element.classList.contains(classNameActiveSlide)) {
20650                element.classList.remove(classNameActiveSlide);
20651            }
20652        });
20653
20654        slides[currentIndex].classList.add(classNameActiveSlide);
20655    }
20656
20657    /**
20658     * private
20659     * setupInfinite: function to setup if infinite is set
20660     *
20661     * @param  {array} slideArray
20662     * @return {array} array of updated slideContainer elements
20663     */
20664    function setupInfinite(slideArray) {
20665        var _options2 = options,
20666            infinite = _options2.infinite;
20667
20668
20669        var front = slideArray.slice(0, infinite);
20670        var back = slideArray.slice(slideArray.length - infinite, slideArray.length);
20671
20672        front.forEach(function (element) {
20673            var cloned = element.cloneNode(true);
20674
20675            slideContainer.appendChild(cloned);
20676        });
20677
20678        back.reverse().forEach(function (element) {
20679            var cloned = element.cloneNode(true);
20680
20681            slideContainer.insertBefore(cloned, slideContainer.firstChild);
20682        });
20683
20684        slideContainer.addEventListener(prefixes.transitionEnd, onTransitionEnd);
20685
20686        return slice.call(slideContainer.children);
20687    }
20688
20689    /**
20690     * [dispatchSliderEvent description]
20691     * @return {[type]} [description]
20692     */
20693    function dispatchSliderEvent(phase, type, detail) {
20694        (0, _dispatchEvent2.default)(slider, phase + '.lory.' + type, detail);
20695    }
20696
20697    /**
20698     * translates to a given position in a given time in milliseconds
20699     *
20700     * @to        {number} number in pixels where to translate to
20701     * @duration  {number} time in milliseconds for the transistion
20702     * @ease      {string} easing css property
20703     */
20704    function translate(to, duration, ease) {
20705        var style = slideContainer && slideContainer.style;
20706
20707        if (style) {
20708            style[prefixes.transition + 'TimingFunction'] = ease;
20709            style[prefixes.transition + 'Duration'] = duration + 'ms';
20710            style[prefixes.transform] = 'translateX(' + to + 'px)';
20711        }
20712    }
20713
20714    /**
20715     * returns an element's width
20716     */
20717    function elementWidth(element) {
20718        return element.getBoundingClientRect().width || element.offsetWidth;
20719    }
20720
20721    /**
20722     * slidefunction called by prev, next & touchend
20723     *
20724     * determine nextIndex and slide to next postion
20725     * under restrictions of the defined options
20726     *
20727     * @direction  {boolean}
20728     */
20729    function slide(nextIndex, direction) {
20730        var _options3 = options,
20731            slideSpeed = _options3.slideSpeed,
20732            slidesToScroll = _options3.slidesToScroll,
20733            infinite = _options3.infinite,
20734            rewind = _options3.rewind,
20735            rewindPrev = _options3.rewindPrev,
20736            rewindSpeed = _options3.rewindSpeed,
20737            ease = _options3.ease,
20738            classNameActiveSlide = _options3.classNameActiveSlide,
20739            _options3$classNameDi = _options3.classNameDisabledNextCtrl,
20740            classNameDisabledNextCtrl = _options3$classNameDi === undefined ? 'disabled' : _options3$classNameDi,
20741            _options3$classNameDi2 = _options3.classNameDisabledPrevCtrl,
20742            classNameDisabledPrevCtrl = _options3$classNameDi2 === undefined ? 'disabled' : _options3$classNameDi2;
20743
20744
20745        var duration = slideSpeed;
20746
20747        var nextSlide = direction ? index + 1 : index - 1;
20748        var maxOffset = Math.round(slidesWidth - frameWidth);
20749
20750        dispatchSliderEvent('before', 'slide', {
20751            index: index,
20752            nextSlide: nextSlide
20753        });
20754
20755        /**
20756         * Reset control classes
20757         */
20758        if (prevCtrl) {
20759            prevCtrl.classList.remove(classNameDisabledPrevCtrl);
20760        }
20761        if (nextCtrl) {
20762            nextCtrl.classList.remove(classNameDisabledNextCtrl);
20763        }
20764
20765        if (typeof nextIndex !== 'number') {
20766            if (direction) {
20767                if (infinite && index + infinite * 2 !== slides.length) {
20768                    nextIndex = index + (infinite - index % infinite);
20769                } else {
20770                    nextIndex = index + slidesToScroll;
20771                }
20772            } else {
20773                if (infinite && index % infinite !== 0) {
20774                    nextIndex = index - index % infinite;
20775                } else {
20776                    nextIndex = index - slidesToScroll;
20777                }
20778            }
20779        }
20780
20781        nextIndex = Math.min(Math.max(nextIndex, 0), slides.length - 1);
20782
20783        if (infinite && direction === undefined) {
20784            nextIndex += infinite;
20785        }
20786
20787        if (rewindPrev && Math.abs(position.x) === 0 && direction === false) {
20788            nextIndex = slides.length - 1;
20789            duration = rewindSpeed;
20790        }
20791
20792        var nextOffset = Math.min(Math.max(slides[nextIndex].offsetLeft * -1, maxOffset * -1), 0);
20793
20794        if (rewind && Math.abs(position.x) === maxOffset && direction) {
20795            nextOffset = 0;
20796            nextIndex = 0;
20797            duration = rewindSpeed;
20798        }
20799
20800        /**
20801         * translate to the nextOffset by a defined duration and ease function
20802         */
20803        translate(nextOffset, duration, ease);
20804
20805        /**
20806         * update the position with the next position
20807         */
20808        position.x = nextOffset;
20809
20810        /**
20811         * update the index with the nextIndex only if
20812         * the offset of the nextIndex is in the range of the maxOffset
20813         */
20814        if (slides[nextIndex].offsetLeft <= maxOffset) {
20815            index = nextIndex;
20816        }
20817
20818        if (infinite && (nextIndex === slides.length - infinite || nextIndex === slides.length - slides.length % infinite || nextIndex === 0)) {
20819            if (direction) {
20820                index = infinite;
20821            }
20822
20823            if (!direction) {
20824                index = slides.length - infinite * 2;
20825            }
20826
20827            position.x = slides[index].offsetLeft * -1;
20828
20829            transitionEndCallback = function transitionEndCallback() {
20830                translate(slides[index].offsetLeft * -1, 0, undefined);
20831            };
20832        }
20833
20834        if (classNameActiveSlide) {
20835            setActiveElement(slice.call(slides), index);
20836        }
20837
20838        /**
20839         * update classes for next and prev arrows
20840         * based on user settings
20841         */
20842        if (prevCtrl && !infinite && !rewindPrev && nextIndex === 0) {
20843            prevCtrl.classList.add(classNameDisabledPrevCtrl);
20844        }
20845
20846        if (nextCtrl && !infinite && !rewind && nextIndex + 1 === slides.length) {
20847            nextCtrl.classList.add(classNameDisabledNextCtrl);
20848        }
20849
20850        dispatchSliderEvent('after', 'slide', {
20851            currentSlide: index
20852        });
20853    }
20854
20855    /**
20856     * public
20857     * setup function
20858     */
20859    function setup() {
20860        dispatchSliderEvent('before', 'init');
20861
20862        prefixes = (0, _detectPrefixes2.default)();
20863        options = _extends({}, _defaults2.default, opts);
20864
20865        var _options4 = options,
20866            classNameFrame = _options4.classNameFrame,
20867            classNameSlideContainer = _options4.classNameSlideContainer,
20868            classNamePrevCtrl = _options4.classNamePrevCtrl,
20869            classNameNextCtrl = _options4.classNameNextCtrl,
20870            _options4$classNameDi = _options4.classNameDisabledNextCtrl,
20871            classNameDisabledNextCtrl = _options4$classNameDi === undefined ? 'disabled' : _options4$classNameDi,
20872            _options4$classNameDi2 = _options4.classNameDisabledPrevCtrl,
20873            classNameDisabledPrevCtrl = _options4$classNameDi2 === undefined ? 'disabled' : _options4$classNameDi2,
20874            enableMouseEvents = _options4.enableMouseEvents,
20875            classNameActiveSlide = _options4.classNameActiveSlide,
20876            initialIndex = _options4.initialIndex;
20877
20878
20879        index = initialIndex;
20880        frame = slider.getElementsByClassName(classNameFrame)[0];
20881        slideContainer = frame.getElementsByClassName(classNameSlideContainer)[0];
20882        prevCtrl = slider.getElementsByClassName(classNamePrevCtrl)[0];
20883        nextCtrl = slider.getElementsByClassName(classNameNextCtrl)[0];
20884
20885        position = {
20886            x: slideContainer.offsetLeft,
20887            y: slideContainer.offsetTop
20888        };
20889
20890        if (options.infinite) {
20891            slides = setupInfinite(slice.call(slideContainer.children));
20892        } else {
20893            slides = slice.call(slideContainer.children);
20894
20895            if (prevCtrl && !options.rewindPrev) {
20896                prevCtrl.classList.add(classNameDisabledPrevCtrl);
20897            }
20898
20899            if (nextCtrl && slides.length === 1 && !options.rewind) {
20900                nextCtrl.classList.add(classNameDisabledNextCtrl);
20901            }
20902        }
20903
20904        reset();
20905
20906        if (classNameActiveSlide) {
20907            setActiveElement(slides, index);
20908        }
20909
20910        if (prevCtrl && nextCtrl) {
20911            prevCtrl.addEventListener('click', prev);
20912            nextCtrl.addEventListener('click', next);
20913        }
20914
20915        frame.addEventListener('touchstart', onTouchstart, touchEventParams);
20916
20917        if (enableMouseEvents) {
20918            frame.addEventListener('mousedown', onTouchstart);
20919            frame.addEventListener('click', onClick);
20920        }
20921
20922        options.window.addEventListener('resize', onResize);
20923
20924        dispatchSliderEvent('after', 'init');
20925    }
20926
20927    /**
20928     * public
20929     * reset function: called on resize
20930     */
20931    function reset() {
20932        var _options5 = options,
20933            infinite = _options5.infinite,
20934            ease = _options5.ease,
20935            rewindSpeed = _options5.rewindSpeed,
20936            rewindOnResize = _options5.rewindOnResize,
20937            classNameActiveSlide = _options5.classNameActiveSlide,
20938            initialIndex = _options5.initialIndex;
20939
20940
20941        slidesWidth = elementWidth(slideContainer);
20942        frameWidth = elementWidth(frame);
20943
20944        if (frameWidth === slidesWidth) {
20945            slidesWidth = slides.reduce(function (previousValue, slide) {
20946                return previousValue + elementWidth(slide);
20947            }, 0);
20948        }
20949
20950        if (rewindOnResize) {
20951            index = initialIndex;
20952        } else {
20953            ease = null;
20954            rewindSpeed = 0;
20955        }
20956
20957        if (infinite) {
20958            translate(slides[index + infinite].offsetLeft * -1, 0, null);
20959
20960            index = index + infinite;
20961            position.x = slides[index].offsetLeft * -1;
20962        } else {
20963            translate(slides[index].offsetLeft * -1, rewindSpeed, ease);
20964            position.x = slides[index].offsetLeft * -1;
20965        }
20966
20967        if (classNameActiveSlide) {
20968            setActiveElement(slice.call(slides), index);
20969        }
20970    }
20971
20972    /**
20973     * public
20974     * slideTo: called on clickhandler
20975     */
20976    function slideTo(index) {
20977        slide(index);
20978    }
20979
20980    /**
20981     * public
20982     * returnIndex function: called on clickhandler
20983     */
20984    function returnIndex() {
20985        return index - options.infinite || 0;
20986    }
20987
20988    /**
20989     * public
20990     * prev function: called on clickhandler
20991     */
20992    function prev() {
20993        slide(false, false);
20994    }
20995
20996    /**
20997     * public
20998     * next function: called on clickhandler
20999     */
21000    function next() {
21001        slide(false, true);
21002    }
21003
21004    /**
21005     * public
21006     * destroy function: called to gracefully destroy the lory instance
21007     */
21008    function destroy() {
21009        dispatchSliderEvent('before', 'destroy');
21010
21011        // remove event listeners
21012        frame.removeEventListener(prefixes.transitionEnd, onTransitionEnd);
21013        frame.removeEventListener('touchstart', onTouchstart, touchEventParams);
21014        frame.removeEventListener('touchmove', onTouchmove, touchEventParams);
21015        frame.removeEventListener('touchend', onTouchend);
21016        frame.removeEventListener('mousemove', onTouchmove);
21017        frame.removeEventListener('mousedown', onTouchstart);
21018        frame.removeEventListener('mouseup', onTouchend);
21019        frame.removeEventListener('mouseleave', onTouchend);
21020        frame.removeEventListener('click', onClick);
21021
21022        options.window.removeEventListener('resize', onResize);
21023
21024        if (prevCtrl) {
21025            prevCtrl.removeEventListener('click', prev);
21026        }
21027
21028        if (nextCtrl) {
21029            nextCtrl.removeEventListener('click', next);
21030        }
21031
21032        // remove cloned slides if infinite is set
21033        if (options.infinite) {
21034            Array.apply(null, Array(options.infinite)).forEach(function () {
21035                slideContainer.removeChild(slideContainer.firstChild);
21036                slideContainer.removeChild(slideContainer.lastChild);
21037            });
21038        }
21039
21040        dispatchSliderEvent('after', 'destroy');
21041    }
21042
21043    // event handling
21044
21045    var touchOffset = void 0;
21046    var delta = void 0;
21047    var isScrolling = void 0;
21048
21049    function onTransitionEnd() {
21050        if (transitionEndCallback) {
21051            transitionEndCallback();
21052
21053            transitionEndCallback = undefined;
21054        }
21055    }
21056
21057    function onTouchstart(event) {
21058        var _options6 = options,
21059            enableMouseEvents = _options6.enableMouseEvents;
21060
21061        var touches = event.touches ? event.touches[0] : event;
21062
21063        if (enableMouseEvents) {
21064            frame.addEventListener('mousemove', onTouchmove);
21065            frame.addEventListener('mouseup', onTouchend);
21066            frame.addEventListener('mouseleave', onTouchend);
21067        }
21068
21069        frame.addEventListener('touchmove', onTouchmove, touchEventParams);
21070        frame.addEventListener('touchend', onTouchend);
21071
21072        var pageX = touches.pageX,
21073            pageY = touches.pageY;
21074
21075
21076        touchOffset = {
21077            x: pageX,
21078            y: pageY,
21079            time: Date.now()
21080        };
21081
21082        isScrolling = undefined;
21083
21084        delta = {};
21085
21086        dispatchSliderEvent('on', 'touchstart', {
21087            event: event
21088        });
21089    }
21090
21091    function onTouchmove(event) {
21092        var touches = event.touches ? event.touches[0] : event;
21093        var pageX = touches.pageX,
21094            pageY = touches.pageY;
21095
21096
21097        delta = {
21098            x: pageX - touchOffset.x,
21099            y: pageY - touchOffset.y
21100        };
21101
21102        if (typeof isScrolling === 'undefined') {
21103            isScrolling = !!(isScrolling || Math.abs(delta.x) < Math.abs(delta.y));
21104        }
21105
21106        if (!isScrolling && touchOffset) {
21107            translate(position.x + delta.x, 0, null);
21108        }
21109
21110        // may be
21111        dispatchSliderEvent('on', 'touchmove', {
21112            event: event
21113        });
21114    }
21115
21116    function onTouchend(event) {
21117        /**
21118         * time between touchstart and touchend in milliseconds
21119         * @duration {number}
21120         */
21121        var duration = touchOffset ? Date.now() - touchOffset.time : undefined;
21122
21123        /**
21124         * is valid if:
21125         *
21126         * -> swipe attempt time is over 300 ms
21127         * and
21128         * -> swipe distance is greater than 25px
21129         * or
21130         * -> swipe distance is more then a third of the swipe area
21131         *
21132         * @isValidSlide {Boolean}
21133         */
21134        var isValid = Number(duration) < 300 && Math.abs(delta.x) > 25 || Math.abs(delta.x) > frameWidth / 3;
21135
21136        /**
21137         * is out of bounds if:
21138         *
21139         * -> index is 0 and delta x is greater than 0
21140         * or
21141         * -> index is the last slide and delta is smaller than 0
21142         *
21143         * @isOutOfBounds {Boolean}
21144         */
21145        var isOutOfBounds = !index && delta.x > 0 || index === slides.length - 1 && delta.x < 0;
21146
21147        var direction = delta.x < 0;
21148
21149        if (!isScrolling) {
21150            if (isValid && !isOutOfBounds) {
21151                slide(false, direction);
21152            } else {
21153                translate(position.x, options.snapBackSpeed);
21154            }
21155        }
21156
21157        touchOffset = undefined;
21158
21159        /**
21160         * remove eventlisteners after swipe attempt
21161         */
21162        frame.removeEventListener('touchmove', onTouchmove);
21163        frame.removeEventListener('touchend', onTouchend);
21164        frame.removeEventListener('mousemove', onTouchmove);
21165        frame.removeEventListener('mouseup', onTouchend);
21166        frame.removeEventListener('mouseleave', onTouchend);
21167
21168        dispatchSliderEvent('on', 'touchend', {
21169            event: event
21170        });
21171    }
21172
21173    function onClick(event) {
21174        if (delta.x) {
21175            event.preventDefault();
21176        }
21177    }
21178
21179    function onResize(event) {
21180        if (frameWidth !== elementWidth(frame)) {
21181            reset();
21182
21183            dispatchSliderEvent('on', 'resize', {
21184                event: event
21185            });
21186        }
21187    }
21188
21189    // trigger initial setup
21190    setup();
21191
21192    // expose public api
21193    return {
21194        setup: setup,
21195        reset: reset,
21196        slideTo: slideTo,
21197        returnIndex: returnIndex,
21198        prev: prev,
21199        next: next,
21200        destroy: destroy
21201    };
21202}
21203
21204/***/ }),
21205/* 1 */
21206/***/ (function(module, exports, __webpack_require__) {
21207
21208"use strict";
21209
21210
21211Object.defineProperty(exports, "__esModule", {
21212    value: true
21213});
21214exports.default = detectPrefixes;
21215/**
21216 * Detecting prefixes for saving time and bytes
21217 */
21218function detectPrefixes() {
21219    var transform = void 0;
21220    var transition = void 0;
21221    var transitionEnd = void 0;
21222
21223    (function () {
21224        var el = document.createElement('_');
21225        var style = el.style;
21226
21227        var prop = void 0;
21228
21229        if (style[prop = 'webkitTransition'] === '') {
21230            transitionEnd = 'webkitTransitionEnd';
21231            transition = prop;
21232        }
21233
21234        if (style[prop = 'transition'] === '') {
21235            transitionEnd = 'transitionend';
21236            transition = prop;
21237        }
21238
21239        if (style[prop = 'webkitTransform'] === '') {
21240            transform = prop;
21241        }
21242
21243        if (style[prop = 'msTransform'] === '') {
21244            transform = prop;
21245        }
21246
21247        if (style[prop = 'transform'] === '') {
21248            transform = prop;
21249        }
21250
21251        document.body.insertBefore(el, null);
21252        style[transform] = 'translateX(0)';
21253        document.body.removeChild(el);
21254    })();
21255
21256    return {
21257        transform: transform,
21258        transition: transition,
21259        transitionEnd: transitionEnd
21260    };
21261}
21262
21263/***/ }),
21264/* 2 */
21265/***/ (function(module, exports, __webpack_require__) {
21266
21267"use strict";
21268
21269
21270Object.defineProperty(exports, "__esModule", {
21271    value: true
21272});
21273exports.default = detectSupportsPassive;
21274function detectSupportsPassive() {
21275    var supportsPassive = false;
21276
21277    try {
21278        var opts = Object.defineProperty({}, 'passive', {
21279            get: function get() {
21280                supportsPassive = true;
21281            }
21282        });
21283
21284        window.addEventListener('testPassive', null, opts);
21285        window.removeEventListener('testPassive', null, opts);
21286    } catch (e) {}
21287
21288    return supportsPassive;
21289}
21290
21291/***/ }),
21292/* 3 */
21293/***/ (function(module, exports, __webpack_require__) {
21294
21295"use strict";
21296
21297
21298Object.defineProperty(exports, "__esModule", {
21299    value: true
21300});
21301exports.default = dispatchEvent;
21302
21303var _customEvent = __webpack_require__(4);
21304
21305var _customEvent2 = _interopRequireDefault(_customEvent);
21306
21307function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21308
21309/**
21310 * dispatch custom events
21311 *
21312 * @param  {element} el         slideshow element
21313 * @param  {string}  type       custom event name
21314 * @param  {object}  detail     custom detail information
21315 */
21316function dispatchEvent(target, type, detail) {
21317    var event = new _customEvent2.default(type, {
21318        bubbles: true,
21319        cancelable: true,
21320        detail: detail
21321    });
21322
21323    target.dispatchEvent(event);
21324}
21325
21326/***/ }),
21327/* 4 */
21328/***/ (function(module, exports, __webpack_require__) {
21329
21330/* WEBPACK VAR INJECTION */(function(global) {
21331var NativeCustomEvent = global.CustomEvent;
21332
21333function useNative () {
21334  try {
21335    var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });
21336    return  'cat' === p.type && 'bar' === p.detail.foo;
21337  } catch (e) {
21338  }
21339  return false;
21340}
21341
21342/**
21343 * Cross-browser `CustomEvent` constructor.
21344 *
21345 * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
21346 *
21347 * @public
21348 */
21349
21350module.exports = useNative() ? NativeCustomEvent :
21351
21352// IE >= 9
21353'undefined' !== typeof document && 'function' === typeof document.createEvent ? function CustomEvent (type, params) {
21354  var e = document.createEvent('CustomEvent');
21355  if (params) {
21356    e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);
21357  } else {
21358    e.initCustomEvent(type, false, false, void 0);
21359  }
21360  return e;
21361} :
21362
21363// IE <= 8
21364function CustomEvent (type, params) {
21365  var e = document.createEventObject();
21366  e.type = type;
21367  if (params) {
21368    e.bubbles = Boolean(params.bubbles);
21369    e.cancelable = Boolean(params.cancelable);
21370    e.detail = params.detail;
21371  } else {
21372    e.bubbles = false;
21373    e.cancelable = false;
21374    e.detail = void 0;
21375  }
21376  return e;
21377}
21378
21379/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
21380
21381/***/ }),
21382/* 5 */
21383/***/ (function(module, exports) {
21384
21385var g;
21386
21387// This works in non-strict mode
21388g = (function() {
21389	return this;
21390})();
21391
21392try {
21393	// This works if eval is allowed (see CSP)
21394	g = g || Function("return this")() || (1,eval)("this");
21395} catch(e) {
21396	// This works if the window reference is available
21397	if(typeof window === "object")
21398		g = window;
21399}
21400
21401// g can still be undefined, but nothing to do about it...
21402// We return undefined, instead of nothing here, so it's
21403// easier to handle this case. if(!global) { ...}
21404
21405module.exports = g;
21406
21407
21408/***/ }),
21409/* 6 */
21410/***/ (function(module, exports, __webpack_require__) {
21411
21412"use strict";
21413
21414
21415Object.defineProperty(exports, "__esModule", {
21416  value: true
21417});
21418exports.default = {
21419  /**
21420   * slides scrolled at once
21421   * @slidesToScroll {Number}
21422   */
21423  slidesToScroll: 1,
21424
21425  /**
21426   * time in milliseconds for the animation of a valid slide attempt
21427   * @slideSpeed {Number}
21428   */
21429  slideSpeed: 300,
21430
21431  /**
21432   * time in milliseconds for the animation of the rewind after the last slide
21433   * @rewindSpeed {Number}
21434   */
21435  rewindSpeed: 600,
21436
21437  /**
21438   * time for the snapBack of the slider if the slide attempt was not valid
21439   * @snapBackSpeed {Number}
21440   */
21441  snapBackSpeed: 200,
21442
21443  /**
21444   * Basic easing functions: https://developer.mozilla.org/de/docs/Web/CSS/transition-timing-function
21445   * cubic bezier easing functions: http://easings.net/de
21446   * @ease {String}
21447   */
21448  ease: 'ease',
21449
21450  /**
21451   * if slider reached the last slide, with next click the slider goes back to the startindex.
21452   * use infinite or rewind, not both
21453   * @rewind {Boolean}
21454   */
21455  rewind: false,
21456
21457  /**
21458   * number of visible slides or false
21459   * use infinite or rewind, not both
21460   * @infinite {number}
21461   */
21462  infinite: false,
21463
21464  /**
21465   * the slide index to show when the slider is initialized.
21466   * @initialIndex {number}
21467   */
21468  initialIndex: 0,
21469
21470  /**
21471   * class name for slider frame
21472   * @classNameFrame {string}
21473   */
21474  classNameFrame: 'js_frame',
21475
21476  /**
21477   * class name for slides container
21478   * @classNameSlideContainer {string}
21479   */
21480  classNameSlideContainer: 'js_slides',
21481
21482  /**
21483   * class name for slider prev control
21484   * @classNamePrevCtrl {string}
21485   */
21486  classNamePrevCtrl: 'js_prev',
21487
21488  /**
21489   * class name for slider next control
21490   * @classNameNextCtrl {string}
21491   */
21492  classNameNextCtrl: 'js_next',
21493
21494  /**
21495   * class name for current active slide
21496   * if emptyString then no class is set
21497   * @classNameActiveSlide {string}
21498   */
21499  classNameActiveSlide: 'active',
21500
21501  /**
21502   * enables mouse events for swiping on desktop devices
21503   * @enableMouseEvents {boolean}
21504   */
21505  enableMouseEvents: false,
21506
21507  /**
21508   * window instance
21509   * @window {object}
21510   */
21511  window: typeof window !== 'undefined' ? window : null,
21512
21513  /**
21514   * If false, slides lory to the first slide on window resize.
21515   * @rewindOnResize {boolean}
21516   */
21517  rewindOnResize: true
21518};
21519
21520/***/ }),
21521/* 7 */
21522/***/ (function(module, exports, __webpack_require__) {
21523
21524module.exports = __webpack_require__(0);
21525
21526
21527/***/ })
21528/******/ ]);
21529});
21530},{}],176:[function(require,module,exports){
21531'use strict';
21532
21533/** @type {import('./abs')} */
21534module.exports = Math.abs;
21535
21536},{}],177:[function(require,module,exports){
21537'use strict';
21538
21539/** @type {import('./floor')} */
21540module.exports = Math.floor;
21541
21542},{}],178:[function(require,module,exports){
21543'use strict';
21544
21545/** @type {import('./isNaN')} */
21546module.exports = Number.isNaN || function isNaN(a) {
21547	return a !== a;
21548};
21549
21550},{}],179:[function(require,module,exports){
21551'use strict';
21552
21553/** @type {import('./max')} */
21554module.exports = Math.max;
21555
21556},{}],180:[function(require,module,exports){
21557'use strict';
21558
21559/** @type {import('./min')} */
21560module.exports = Math.min;
21561
21562},{}],181:[function(require,module,exports){
21563'use strict';
21564
21565/** @type {import('./pow')} */
21566module.exports = Math.pow;
21567
21568},{}],182:[function(require,module,exports){
21569'use strict';
21570
21571/** @type {import('./round')} */
21572module.exports = Math.round;
21573
21574},{}],183:[function(require,module,exports){
21575'use strict';
21576
21577var $isNaN = require('./isNaN');
21578
21579/** @type {import('./sign')} */
21580module.exports = function sign(number) {
21581	if ($isNaN(number) || number === 0) {
21582		return number;
21583	}
21584	return number < 0 ? -1 : +1;
21585};
21586
21587},{"./isNaN":178}],184:[function(require,module,exports){
21588'use strict';
21589
21590/** @type {import('.')} */
21591module.exports = [
21592	'Float16Array',
21593	'Float32Array',
21594	'Float64Array',
21595	'Int8Array',
21596	'Int16Array',
21597	'Int32Array',
21598	'Uint8Array',
21599	'Uint8ClampedArray',
21600	'Uint16Array',
21601	'Uint32Array',
21602	'BigInt64Array',
21603	'BigUint64Array'
21604];
21605
21606},{}],185:[function(require,module,exports){
21607// shim for using process in browser
21608var process = module.exports = {};
21609
21610// cached from whatever global is present so that test runners that stub it
21611// don't break things.  But we need to wrap it in a try catch in case it is
21612// wrapped in strict mode code which doesn't define any globals.  It's inside a
21613// function because try/catches deoptimize in certain engines.
21614
21615var cachedSetTimeout;
21616var cachedClearTimeout;
21617
21618function defaultSetTimout() {
21619    throw new Error('setTimeout has not been defined');
21620}
21621function defaultClearTimeout () {
21622    throw new Error('clearTimeout has not been defined');
21623}
21624(function () {
21625    try {
21626        if (typeof setTimeout === 'function') {
21627            cachedSetTimeout = setTimeout;
21628        } else {
21629            cachedSetTimeout = defaultSetTimout;
21630        }
21631    } catch (e) {
21632        cachedSetTimeout = defaultSetTimout;
21633    }
21634    try {
21635        if (typeof clearTimeout === 'function') {
21636            cachedClearTimeout = clearTimeout;
21637        } else {
21638            cachedClearTimeout = defaultClearTimeout;
21639        }
21640    } catch (e) {
21641        cachedClearTimeout = defaultClearTimeout;
21642    }
21643} ())
21644function runTimeout(fun) {
21645    if (cachedSetTimeout === setTimeout) {
21646        //normal enviroments in sane situations
21647        return setTimeout(fun, 0);
21648    }
21649    // if setTimeout wasn't available but was latter defined
21650    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
21651        cachedSetTimeout = setTimeout;
21652        return setTimeout(fun, 0);
21653    }
21654    try {
21655        // when when somebody has screwed with setTimeout but no I.E. maddness
21656        return cachedSetTimeout(fun, 0);
21657    } catch(e){
21658        try {
21659            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
21660            return cachedSetTimeout.call(null, fun, 0);
21661        } catch(e){
21662            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
21663            return cachedSetTimeout.call(this, fun, 0);
21664        }
21665    }
21666
21667
21668}
21669function runClearTimeout(marker) {
21670    if (cachedClearTimeout === clearTimeout) {
21671        //normal enviroments in sane situations
21672        return clearTimeout(marker);
21673    }
21674    // if clearTimeout wasn't available but was latter defined
21675    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
21676        cachedClearTimeout = clearTimeout;
21677        return clearTimeout(marker);
21678    }
21679    try {
21680        // when when somebody has screwed with setTimeout but no I.E. maddness
21681        return cachedClearTimeout(marker);
21682    } catch (e){
21683        try {
21684            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
21685            return cachedClearTimeout.call(null, marker);
21686        } catch (e){
21687            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
21688            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
21689            return cachedClearTimeout.call(this, marker);
21690        }
21691    }
21692
21693
21694
21695}
21696var queue = [];
21697var draining = false;
vendor: 5,315 bytes, lines 21698-21904
21698var currentQueue;
21699var queueIndex = -1;
21700
21701function cleanUpNextTick() {
21702    if (!draining || !currentQueue) {
21703        return;
21704    }
21705    draining = false;
21706    if (currentQueue.length) {
21707        queue = currentQueue.concat(queue);
21708    } else {
21709        queueIndex = -1;
21710    }
21711    if (queue.length) {
21712        drainQueue();
21713    }
21714}
21715
21716function drainQueue() {
21717    if (draining) {
21718        return;
21719    }
21720    var timeout = runTimeout(cleanUpNextTick);
21721    draining = true;
21722
21723    var len = queue.length;
21724    while(len) {
21725        currentQueue = queue;
21726        queue = [];
21727        while (++queueIndex < len) {
21728            if (currentQueue) {
21729                currentQueue[queueIndex].run();
21730            }
21731        }
21732        queueIndex = -1;
21733        len = queue.length;
21734    }
21735    currentQueue = null;
21736    draining = false;
21737    runClearTimeout(timeout);
21738}
21739
21740process.nextTick = function (fun) {
21741    var args = new Array(arguments.length - 1);
21742    if (arguments.length > 1) {
21743        for (var i = 1; i < arguments.length; i++) {
21744            args[i - 1] = arguments[i];
21745        }
21746    }
21747    queue.push(new Item(fun, args));
21748    if (queue.length === 1 && !draining) {
21749        runTimeout(drainQueue);
21750    }
21751};
21752
21753// v8 likes predictible objects
21754function Item(fun, array) {
21755    this.fun = fun;
21756    this.array = array;
21757}
21758Item.prototype.run = function () {
21759    this.fun.apply(null, this.array);
21760};
21761process.title = 'browser';
21762process.browser = true;
21763process.env = {};
21764process.argv = [];
21765process.version = ''; // empty string to avoid regexp issues
21766process.versions = {};
21767
21768function noop() {}
21769
21770process.on = noop;
21771process.addListener = noop;
21772process.once = noop;
21773process.off = noop;
21774process.removeListener = noop;
21775process.removeAllListeners = noop;
21776process.emit = noop;
21777process.prependListener = noop;
21778process.prependOnceListener = noop;
21779
21780process.listeners = function (name) { return [] }
21781
21782process.binding = function (name) {
21783    throw new Error('process.binding is not supported');
21784};
21785
21786process.cwd = function () { return '/' };
21787process.chdir = function (dir) {
21788    throw new Error('process.chdir is not supported');
21789};
21790process.umask = function() { return 0; };
21791
21792},{}],186:[function(require,module,exports){
21793(function (setImmediate){(function (){
21794(function (root) {
21795
21796  // Store setTimeout reference so promise-polyfill will be unaffected by
21797  // other code modifying setTimeout (like sinon.useFakeTimers())
21798  var setTimeoutFunc = setTimeout;
21799
21800  function noop() {}
21801  
21802  // Polyfill for Function.prototype.bind
21803  function bind(fn, thisArg) {
21804    return function () {
21805      fn.apply(thisArg, arguments);
21806    };
21807  }
21808
21809  function Promise(fn) {
21810    if (!(this instanceof Promise)) throw new TypeError('Promises must be constructed via new');
21811    if (typeof fn !== 'function') throw new TypeError('not a function');
21812    this._state = 0;
21813    this._handled = false;
21814    this._value = undefined;
21815    this._deferreds = [];
21816
21817    doResolve(fn, this);
21818  }
21819
21820  function handle(self, deferred) {
21821    while (self._state === 3) {
21822      self = self._value;
21823    }
21824    if (self._state === 0) {
21825      self._deferreds.push(deferred);
21826      return;
21827    }
21828    self._handled = true;
21829    Promise._immediateFn(function () {
21830      var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
21831      if (cb === null) {
21832        (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
21833        return;
21834      }
21835      var ret;
21836      try {
21837        ret = cb(self._value);
21838      } catch (e) {
21839        reject(deferred.promise, e);
21840        return;
21841      }
21842      resolve(deferred.promise, ret);
21843    });
21844  }
21845
21846  function resolve(self, newValue) {
21847    try {
21848      // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
21849      if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.');
21850      if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
21851        var then = newValue.then;
21852        if (newValue instanceof Promise) {
21853          self._state = 3;
21854          self._value = newValue;
21855          finale(self);
21856          return;
21857        } else if (typeof then === 'function') {
21858          doResolve(bind(then, newValue), self);
21859          return;
21860        }
21861      }
21862      self._state = 1;
21863      self._value = newValue;
21864      finale(self);
21865    } catch (e) {
21866      reject(self, e);
21867    }
21868  }
21869
21870  function reject(self, newValue) {
21871    self._state = 2;
21872    self._value = newValue;
21873    finale(self);
21874  }
21875
21876  function finale(self) {
21877    if (self._state === 2 && self._deferreds.length === 0) {
21878      Promise._immediateFn(function() {
21879        if (!self._handled) {
21880          Promise._unhandledRejectionFn(self._value);
21881        }
21882      });
21883    }
21884
21885    for (var i = 0, len = self._deferreds.length; i < len; i++) {
21886      handle(self, self._deferreds[i]);
21887    }
21888    self._deferreds = null;
21889  }
21890
21891  function Handler(onFulfilled, onRejected, promise) {
21892    this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
21893    this.onRejected = typeof onRejected === 'function' ? onRejected : null;
21894    this.promise = promise;
21895  }
21896
21897  /**
21898   * Take a potentially misbehaving resolver function and make sure
21899   * onFulfilled and onRejected are only called once.
21900   *
21901   * Makes no guarantees about asynchrony.
21902   */
21903  function doResolve(fn, self) {
21904    var done = false;
21905    try {
21906      fn(function (value) {
21907        if (done) return;
21908        done = true;
21909        resolve(self, value);
21910      }, function (reason) {
21911        if (done) return;
21912        done = true;
21913        reject(self, reason);
21914      });
21915    } catch (ex) {
21916      if (done) return;
21917      done = true;
21918      reject(self, ex);
21919    }
21920  }
21921
21922  Promise.prototype['catch'] = function (onRejected) {
21923    return this.then(null, onRejected);
21924  };
21925
21926  Promise.prototype.then = function (onFulfilled, onRejected) {
21927    var prom = new (this.constructor)(noop);
21928
21929    handle(this, new Handler(onFulfilled, onRejected, prom));
21930    return prom;
21931  };
21932
21933  Promise.all = function (arr) {
21934    return new Promise(function (resolve, reject) {
21935      if (!arr || typeof arr.length === 'undefined') throw new TypeError('Promise.all accepts an array');
21936      var args = Array.prototype.slice.call(arr);
21937      if (args.length === 0) return resolve([]);
21938      var remaining = args.length;
21939
21940      function res(i, val) {
21941        try {
21942          if (val && (typeof val === 'object' || typeof val === 'function')) {
21943            var then = val.then;
21944            if (typeof then === 'function') {
21945              then.call(val, function (val) {
21946                res(i, val);
21947              }, reject);
21948              return;
21949            }
21950          }
21951          args[i] = val;
21952          if (--remaining === 0) {
21953            resolve(args);
21954          }
21955        } catch (ex) {
21956          reject(ex);
21957        }
21958      }
21959
21960      for (var i = 0; i < args.length; i++) {
21961        res(i, args[i]);
21962      }
21963    });
21964  };
21965
21966  Promise.resolve = function (value) {
21967    if (value && typeof value === 'object' && value.constructor === Promise) {
21968      return value;
21969    }
21970
21971    return new Promise(function (resolve) {
21972      resolve(value);
21973    });
21974  };
21975
21976  Promise.reject = function (value) {
21977    return new Promise(function (resolve, reject) {
21978      reject(value);
21979    });
21980  };
21981
21982  Promise.race = function (values) {
21983    return new Promise(function (resolve, reject) {
21984      for (var i = 0, len = values.length; i < len; i++) {
21985        values[i].then(resolve, reject);
21986      }
21987    });
21988  };
21989
21990  // Use polyfill for setImmediate for performance gains
21991  Promise._immediateFn = (typeof setImmediate === 'function' && function (fn) { setImmediate(fn); }) ||
21992    function (fn) {
21993      setTimeoutFunc(fn, 0);
21994    };
21995
21996  Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
21997    if (typeof console !== 'undefined' && console) {
21998      console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
21999    }
22000  };
22001
22002  /**
22003   * Set the immediate function to execute callbacks
22004   * @param fn {function} Function to execute
22005   * @deprecated
22006   */
22007  Promise._setImmediateFn = function _setImmediateFn(fn) {
22008    Promise._immediateFn = fn;
22009  };
22010
22011  /**
22012   * Change the function to execute on unhandled rejection
22013   * @param {function} fn Function to execute on unhandled rejection
22014   * @deprecated
22015   */
22016  Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
22017    Promise._unhandledRejectionFn = fn;
22018  };
22019  
22020  if (typeof module !== 'undefined' && module.exports) {
22021    module.exports = Promise;
22022  } else if (!root.Promise) {
22023    root.Promise = Promise;
22024  }
22025
22026})(this);
22027
22028}).call(this)}).call(this,require("timers").setImmediate)
22029},{"timers":195}],187:[function(require,module,exports){
22030'use strict';
22031
22032var callBound = require('call-bound');
22033var isRegex = require('is-regex');
22034
22035var $exec = callBound('RegExp.prototype.exec');
22036var $TypeError = require('es-errors/type');
22037
22038/** @type {import('.')} */
22039module.exports = function regexTester(regex) {
22040	if (!isRegex(regex)) {
22041		throw new $TypeError('`regex` must be a RegExp');
22042	}
22043	return function test(s) {
22044		return $exec(regex, s) !== null;
22045	};
22046};
22047
22048},{"call-bound":124,"es-errors/type":146,"is-regex":169}],188:[function(require,module,exports){
22049(function () {
22050    'use strict';
22051
22052    var UNSUPPORTED_ENVIRONMENT = typeof window === "undefined";
22053
22054    /**
22055     * Is true if the browser natively supports the 'scroll-behavior' CSS-property.
22056     * @type {boolean}
22057     */
22058    var SUPPORTS_SCROLL_BEHAVIOR = UNSUPPORTED_ENVIRONMENT ? false : "scrollBehavior" in document.documentElement.style;
22059
22060    
22061
22062    /*! *****************************************************************************
22063    Copyright (c) Microsoft Corporation. All rights reserved.
22064    Licensed under the Apache License, Version 2.0 (the "License");
22064 you may not use
22065    this file except in compliance with the License. You may obtain a copy of the
22066    License at http://www.apache.org/licenses/LICENSE-2.0
22067
22068    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22069    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
22070    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
22071    MERCHANTABLITY OR NON-INFRINGEMENT.
22072
22073    See the Apache Version 2.0 License for specific language governing permissions
22074    and limitations under the License.
22075    ***************************************************************************** */
22076
22077    var __assign = function() {
22078        __assign = Object.assign || function __assign(t) {
22079            for (var s, i = 1, n = arguments.length; i < n; i++) {
22080                s = arguments[i];
22081                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
22082            }
22083            return t;
22084        };
22085        return __assign.apply(this, arguments);
22086    };
22087
22088    function __read(o, n) {
22089        var m = typeof Symbol === "function" && o[Symbol.iterator];
22090        if (!m) return o;
22091        var i = m.call(o), r, ar = [], e;
22092        try {
22093            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
22094        }
22095        catch (error) { e = { error: error }; }
22096        finally {
22097            try {
22098                if (r && !r.done && (m = i["return"])) m.call(i);
22099            }
22100            finally { if (e) throw e.error; }
22101        }
22102        return ar;
22103    }
22104
22105    function getScrollingElement() {
22106        if (document.scrollingElement != null) {
22107            return document.scrollingElement;
22108        }
22109        else {
22110            return document.documentElement;
22111        }
22112    }
22113
22114    var STYLE_ATTRIBUTE_PROPERTY_NAME = "scroll-behavior";
22115    var STYLE_ATTRIBUTE_PROPERTY_REGEXP = new RegExp(STYLE_ATTRIBUTE_PROPERTY_NAME + ":\\s*([^;]*)");
22116    /**
22117     * Given an Element, this function appends the given ScrollBehavior CSS property value to the elements' 'style' attribute.
22118     * If it doesnt already have one, it will add it.
22119     * @param {Element} element
22120     * @param {ScrollBehavior} behavior
22121     */
22122    function appendScrollBehaviorToStyleAttribute(element, behavior) {
22123        var addition = STYLE_ATTRIBUTE_PROPERTY_NAME + ":" + behavior;
22124        var attributeValue = element.getAttribute("style");
22125        if (attributeValue == null || attributeValue === "") {
22126            element.setAttribute("style", addition);
22127            return;
22128        }
22129        // The style attribute may already include a 'scroll-behavior:<something>' in which case that should be replaced
22130        var existingValueForProperty = parseScrollBehaviorFromStyleAttribute(element);
22131        if (existingValueForProperty != null) {
22132            var replacementProperty = STYLE_ATTRIBUTE_PROPERTY_NAME + ":" + existingValueForProperty;
22133            // Replace the variant that ends with a semi-colon which it may
22134            attributeValue = attributeValue.replace(replacementProperty + ";", "");
22135            // Replace the variant that *doesn't* end with a semi-colon
22136            attributeValue = attributeValue.replace(replacementProperty, "");
22137        }
22138        // Now, append the behavior to the string.
22139        element.setAttribute("style", attributeValue.endsWith(";") ? "" + attributeValue + addition : ";" + attributeValue + addition);
22140    }
22141    /**
22142     * Given an Element, this function attempts to parse its 'style' attribute (if it has one)' to extract
22143     * a value for the 'scroll-behavior' CSS property (if it is given within that style attribute)
22144     * @param {Element} element
22145     * @returns {ScrollBehavior?}
22146     */
22147    function parseScrollBehaviorFromStyleAttribute(element) {
22148        var styleAttributeValue = element.getAttribute("style");
22149        if (styleAttributeValue != null && styleAttributeValue.includes(STYLE_ATTRIBUTE_PROPERTY_NAME)) {
22150            var match = styleAttributeValue.match(STYLE_ATTRIBUTE_PROPERTY_REGEXP);
22151            if (match != null) {
22152                var _a = __read(match, 2), behavior = _a[1];
22153                if (behavior != null && behavior !== "") {
22154                    return behavior;
22155                }
22156            }
22157        }
22158        return undefined;
22159    }
22160
22161    var styleDeclarationPropertyName = "scrollBehavior";
22162    /**
22163     * Determines the scroll behavior to use, depending on the given ScrollOptions and the position of the Element
22164     * within the DOM
22165     * @param {Element|HTMLElement|Window} inputTarget
22166     * @param {ScrollOptions} [options]
22167     * @returns {ScrollBehavior}
22168     */
22169    function getScrollBehavior(inputTarget, options) {
22170        // If the given 'behavior' is 'smooth', apply smooth scrolling no matter what
22171        if (options != null && options.behavior === "smooth")
22172            return "smooth";
22173        var target = "style" in inputTarget ? inputTarget : getScrollingElement();
22174        var value;
22175        if ("style" in target) {
22176            // Check if scroll-behavior is set as a property on the CSSStyleDeclaration
22177            var scrollBehaviorPropertyValue = target.style[styleDeclarationPropertyName];
22178            // Return it if it is given and has a proper value
22179            if (scrollBehaviorPropertyValue != null && scrollBehaviorPropertyValue !== "") {
22180                value = scrollBehaviorPropertyValue;
22181            }
22182        }
22183        if (value == null) {
22184            var attributeValue = target.getAttribute("scroll-behavior");
22185            if (attributeValue != null && attributeValue !== "") {
22186                value = attributeValue;
22187            }
22188        }
22189        if (value == null) {
22190            // Otherwise, check if it is set as an inline style
22191            value = parseScrollBehaviorFromStyleAttribute(target);
22192        }
22193        if (value == null) {
22194            // Take the computed style for the element and see if it contains a specific 'scroll-behavior' value
22195            var computedStyle = getComputedStyle(target);
22196            var computedStyleValue = computedStyle.getPropertyValue("scrollBehavior");
22197            if (computedStyleValue != null && computedStyleValue !== "") {
22198                value = computedStyleValue;
22199            }
22200        }
22201        // In all other cases, use the value from the CSSOM
22202        return value;
22203    }
22204
22205    
22206
22207    
22208
22209    var HALF = 0.5;
22210    /**
22211     * The easing function to use when applying the smooth scrolling
22212     * @param {number} k
22213     * @returns {number}
22214     */
22215    function ease(k) {
22216        return HALF * (1 - Math.cos(Math.PI * k));
22217    }
22218
22219    var NOOP = {
22220        reset: function () { }
22221    };
22222    var map = typeof WeakMap === "undefined" ? undefined : new WeakMap();
22223    function disableScrollSnap(scroller) {
22224        // If scroll-behavior is natively supported, or if there is no native WeakMap support, there's no need for this fix
22225        if (SUPPORTS_SCROLL_BEHAVIOR || map == null) {
22226            return NOOP;
22227        }
22228        var scrollingElement = getScrollingElement();
22229        var cachedScrollSnapValue;
22230        var cachedScrollBehaviorStyleAttributeValue;
22231        var secondaryScroller;
22232        var secondaryScrollerCachedScrollSnapValue;
22233        var secondaryScrollerCachedScrollBehaviorStyleAttributeValue;
22234        var existingResult = map.get(scroller);
22235        if (existingResult != null) {
22236            cachedScrollSnapValue = existingResult.cachedScrollSnapValue;
22237            cachedScrollBehaviorStyleAttributeValue = existingResult.cachedScrollBehaviorStyleAttributeValue;
22238            secondaryScroller = existingResult.secondaryScroller;
22239            secondaryScrollerCachedScrollSnapValue = existingResult.secondaryScrollerCachedScrollSnapValue;
22240            secondaryScrollerCachedScrollBehaviorStyleAttributeValue = existingResult.secondaryScrollerCachedScrollBehaviorStyleAttributeValue;
22241            existingResult.release();
22242        }
22243        else {
22244            cachedScrollSnapValue = scroller.style.scrollSnapType === "" ? null : scroller.style.scrollSnapType;
22245            cachedScrollBehaviorStyleAttributeValue = parseScrollBehaviorFromStyleAttribute(scroller);
22246            secondaryScroller = scroller === scrollingElement && scrollingElement !== document.body ? document.body : undefined;
22247            secondaryScrollerCachedScrollSnapValue =
22248                secondaryScroller == null ? undefined : secondaryScroller.style.scrollSnapType === "" ? null : secondaryScroller.style.scrollSnapType;
22249            secondaryScrollerCachedScrollBehaviorStyleAttributeValue =
22250                secondaryScroller == null ? undefined : parseScrollBehaviorFromStyleAttribute(secondaryScroller);
22251            var cachedComputedScrollSnapValue = getComputedStyle(scroller).getPropertyValue("scroll-snap-type");
22252            var secondaryScrollerCachedComputedScrollSnapValue = secondaryScroller == null ? undefined : getComputedStyle(secondaryScroller).getPropertyValue("scroll-snap-type");
22253            // If it just so happens that there actually isn't any scroll snapping going on, there's no point in performing any additional work here.
22254            if (cachedComputedScrollSnapValue === "none" && secondaryScrollerCachedComputedScrollSnapValue === "none") {
22255                return NOOP;
22256            }
22257        }
22258        scroller.style.scrollSnapType = "none";
22259        if (secondaryScroller !== undefined) {
22260            secondaryScroller.style.scrollSnapType = "none";
22261        }
22262        if (cachedScrollBehaviorStyleAttributeValue !== undefined) {
22263            appendScrollBehaviorToStyleAttribute(scroller, cachedScrollBehaviorStyleAttributeValue);
22264        }
22265        if (secondaryScroller !== undefined && secondaryScrollerCachedScrollBehaviorStyleAttributeValue !== undefined) {
22266            appendScrollBehaviorToStyleAttribute(secondaryScroller, secondaryScrollerCachedScrollBehaviorStyleAttributeValue);
22267        }
22268        var hasReleased = false;
22269        var eventTarget = scroller === scrollingElement ? window : scroller;
22270        function release() {
22271            eventTarget.removeEventListener("scroll", resetHandler);
22272            if (map != null) {
22273                map["delete"](scroller);
22274            }
22275            hasReleased = true;
22276        }
22277        function resetHandler() {
22278            scroller.style.scrollSnapType = cachedScrollSnapValue;
22279            if (secondaryScroller != null && secondaryScrollerCachedScrollSnapValue !== undefined) {
22280                secondaryScroller.style.scrollSnapType = secondaryScrollerCachedScrollSnapValue;
22281            }
22282            if (cachedScrollBehaviorStyleAttributeValue !== undefined) {
22283                appendScrollBehaviorToStyleAttribute(scroller, cachedScrollBehaviorStyleAttributeValue);
22284            }
22285            if (secondaryScroller !== undefined && secondaryScrollerCachedScrollBehaviorStyleAttributeValue !== undefined) {
22286                appendScrollBehaviorToStyleAttribute(secondaryScroller, secondaryScrollerCachedScrollBehaviorStyleAttributeValue);
22287            }
22288            release();
22289        }
22290        function reset() {
22291            setTimeout(function () {
22292                if (hasReleased)
22293                    return;
22294                eventTarget.addEventListener("scroll", resetHandler);
22295            });
22296        }
22297        map.set(scroller, {
22298            release: release,
22299            cachedScrollSnapValue: cachedScrollSnapValue,
22300            cachedScrollBehaviorStyleAttributeValue: cachedScrollBehaviorStyleAttributeValue,
22301            secondaryScroller: secondaryScroller,
22302            secondaryScrollerCachedScrollSnapValue: secondaryScrollerCachedScrollSnapValue,
22303            secondaryScrollerCachedScrollBehaviorStyleAttributeValue: secondaryScrollerCachedScrollBehaviorStyleAttributeValue
22304        });
22305        return {
22306            reset: reset
22307        };
22308    }
22309
22310    /**
22311     * The duration of a smooth scroll
22312     * @type {number}
22313     */
22314    var SCROLL_TIME = 15000;
22315    /**
22316     * Performs a smooth repositioning of the scroll
22317     * @param {ISmoothScrollOptions} options
22318     */
22319    function smoothScroll(options) {
22320        var startTime = options.startTime, startX = options.startX, startY = options.startY, endX = options.endX, endY = options.endY, method = options.method, scroller = options.scroller;
22321        var timeLapsed = 0;
22322        var distanceX = endX - startX;
22323        var distanceY = endY - startY;
22324        var speed = Math.max(Math.abs((distanceX / 1000) * SCROLL_TIME), Math.abs((distanceY / 1000) * SCROLL_TIME));
22325        // Temporarily disables any scroll snapping that may be active since it fights for control over the scroller with this polyfill
22326        var scrollSnapFix = disableScrollSnap(scroller);
22327        requestAnimationFrame(function animate(timestamp) {
22328            timeLapsed += timestamp - startTime;
22329            var percentage = Math.max(0, Math.min(1, speed === 0 ? 0 : timeLapsed / speed));
22330            var positionX = Math.floor(startX + distanceX * ease(percentage));
22331            var positionY = Math.floor(startY + distanceY * ease(percentage));
22332            method(positionX, positionY);
22333            if (positionX !== endX || positionY !== endY) {
22334                requestAnimationFrame(animate);
22335            }
22336            else {
22337                if (scrollSnapFix != null) {
22338                    scrollSnapFix.reset();
22339                    scrollSnapFix = undefined;
22340                }
22341            }
22342        });
22343    }
22344
22345    /**
22346     * Returns a High Resolution timestamp if possible, otherwise fallbacks to Date.now()
22347     * @returns {number}
22348     */
22349    function now() {
22350        if ("performance" in window)
22351            return performance.now();
22352        return Date.now();
22353    }
22354
22355    
22356
22357    var ELEMENT_ORIGINAL_SCROLL = UNSUPPORTED_ENVIRONMENT ? undefined : Element.prototype.scroll;
22358
22359    var WINDOW_ORIGINAL_SCROLL = UNSUPPORTED_ENVIRONMENT ? undefined : window.scroll;
22360
22361    var ELEMENT_ORIGINAL_SCROLL_BY = UNSUPPORTED_ENVIRONMENT ? undefined : Element.prototype.scrollBy;
22362
22363    var WINDOW_ORIGINAL_SCROLL_BY = UNSUPPORTED_ENVIRONMENT ? undefined : window.scrollBy;
22364
22365    var ELEMENT_ORIGINAL_SCROLL_TO = UNSUPPORTED_ENVIRONMENT ? undefined : Element.prototype.scrollTo;
22366
22367    var WINDOW_ORIGINAL_SCROLL_TO = UNSUPPORTED_ENVIRONMENT ? undefined : window.scrollTo;
22368
22369    /**
22370     * A fallback if Element.prototype.scroll is not defined
22371     * @param {number} x
22372     * @param {number} y
22373     */
22374    function elementPrototypeScrollFallback(x, y) {
22375        this.__adjustingScrollPosition = true;
22376        this.scrollLeft = x;
22377        this.scrollTop = y;
22378        delete this.__adjustingScrollPosition;
22379    }
22380    /**
22381     * A fallback if Element.prototype.scrollTo is not defined
22382     * @param {number} x
22383     * @param {number} y
22384     */
22385    function elementPrototypeScrollToFallback(x, y) {
22386        return elementPrototypeScrollFallback.call(this, x, y);
22387    }
22388    /**
22389     * A fallback if Element.prototype.scrollBy is not defined
22390     * @param {number} x
22391     * @param {number} y
22392     */
22393    function elementPrototypeScrollByFallback(x, y) {
22394        this.__adjustingScrollPosition = true;
22395        this.scrollLeft += x;
22396        this.scrollTop += y;
22397        delete this.__adjustingScrollPosition;
22398    }
22399    /**
22400     * Gets the original non-patched prototype method for the given kind
22401     * @param {ScrollMethodName} kind
22402     * @param {Element|Window} element
22403     * @return {Function}
22404     */
22405    function getOriginalScrollMethodForKind(kind, element) {
22406        switch (kind) {
22407            case "scroll":
22408                if (element instanceof Element) {
22409                    if (ELEMENT_ORIGINAL_SCROLL != null) {
22410                        return ELEMENT_ORIGINAL_SCROLL;
22411                    }
22412                    else {
22413                        return elementPrototypeScrollFallback;
22414                    }
22415                }
22416                else {
22417                    return WINDOW_ORIGINAL_SCROLL;
22418                }
22419            case "scrollBy":
22420                if (element instanceof Element) {
22421                    if (ELEMENT_ORIGINAL_SCROLL_BY != null) {
22422                        return ELEMENT_ORIGINAL_SCROLL_BY;
22423                    }
22424                    else {
22425                        return elementPrototypeScrollByFallback;
22426                    }
22427                }
22428                else {
22429                    return WINDOW_ORIGINAL_SCROLL_BY;
22430                }
22431            case "scrollTo":
22432                if (element instanceof Element) {
22433                    if (ELEMENT_ORIGINAL_SCROLL_TO != null) {
22434                        return ELEMENT_ORIGINAL_SCROLL_TO;
22435                    }
22436                    else {
22437                        return elementPrototypeScrollToFallback;
22438                    }
22439                }
22440                else {
22441                    return WINDOW_ORIGINAL_SCROLL_TO;
22442                }
22443        }
22444    }
22445
22446    /**
22447     * Gets the Smooth Scroll Options to use for the step function
22448     * @param {Element|Window} element
22449     * @param {number} x
22450     * @param {number} y
22451     * @param {ScrollMethodName} kind
22452     * @returns {ISmoothScrollOptions}
22453     */
22454    function getSmoothScrollOptions(element, x, y, kind) {
22455        var startTime = now();
22456        if (!(element instanceof Element)) {
22457            // Use window as the scroll container
22458            var scrollX_1 = window.scrollX, pageXOffset_1 = window.pageXOffset, scrollY_1 = window.scrollY, pageYOffset_1 = window.pageYOffset;
22459            var startX = scrollX_1 == null || scrollX_1 === 0 ? pageXOffset_1 : scrollX_1;
22460            var startY = scrollY_1 == null || scrollY_1 === 0 ? pageYOffset_1 : scrollY_1;
22461            return {
22462                startTime: startTime,
22463                startX: startX,
22464                startY: startY,
22465                endX: Math.floor(kind === "scrollBy" ? startX + x : x),
22466                endY: Math.floor(kind === "scrollBy" ? startY + y : y),
22467                method: getOriginalScrollMethodForKind("scrollTo", window).bind(window),
22468                scroller: getScrollingElement()
22469            };
22470        }
22471        else {
22472            var scrollLeft = element.scrollLeft, scrollTop = element.scrollTop;
22473            var startX = scrollLeft;
22474            var startY = scrollTop;
22475            return {
22476                startTime: startTime,
22477                startX: startX,
22478                startY: startY,
22479                endX: Math.floor(kind === "scrollBy" ? startX + x : x),
22480                endY: Math.floor(kind === "scrollBy" ? startY + y : y),
22481                method: getOriginalScrollMethodForKind("scrollTo", element).bind(element),
22482                scroller: element
22483            };
22484        }
22485    }
22486
22487    /**
22488     * Ensures that the given value is numeric
22489     * @param {number} value
22490     * @return {number}
22491     */
22492    function ensureNumeric(value) {
22493        if (value == null)
22494            return 0;
22495        else if (typeof value === "number") {
22496            return value;
22497        }
22498        else if (typeof value === "string") {
22499            return parseFloat(value);
22500        }
22501        else {
22502            return 0;
22503        }
22504    }
22505
22506    /**
22507     * Returns true if the given value is some ScrollToOptions
22508     * @param {number | ScrollToOptions} value
22509     * @return {value is ScrollToOptions}
22510     */
22511    function isScrollToOptions(value) {
22512        return value != null && typeof value === "object";
22513    }
22514
22515    /**
22516     * Handles a scroll method
22517     * @param {Element|Window} element
22518     * @param {ScrollMethodName} kind
22519     * @param {number | ScrollToOptions} optionsOrX
22520     * @param {number} y
22521     */
22522    function handleScrollMethod(element, kind, optionsOrX, y) {
22523        onScrollWithOptions(getScrollToOptionsWithValidation(optionsOrX, y), element, kind);
22524    }
22525    /**
22526     * Invoked when a 'ScrollToOptions' dict is provided to 'scroll()' as the first argument
22527     * @param {ScrollToOptions} options
22528     * @param {Element|Window} element
22529     * @param {ScrollMethodName} kind
22530     */
22531    function onScrollWithOptions(options, element, kind) {
22532        var behavior = getScrollBehavior(element, options);
22533        // If the behavior is 'auto' apply instantaneous scrolling
22534        if (behavior == null || behavior === "auto") {
22535            getOriginalScrollMethodForKind(kind, element).call(element, options.left, options.top);
22536        }
22537        else {
22538            smoothScroll(getSmoothScrollOptions(element, options.left, options.top, kind));
22539        }
22540    }
22541    /**
22542     * Normalizes the given scroll coordinates
22543     * @param {number?} x
22544     * @param {number?} y
22545     * @return {Required<Pick<ScrollToOptions, "top" | "left">>}
22546     */
22547    function normalizeScrollCoordinates(x, y) {
22548        return {
22549            left: ensureNumeric(x),
22550            top: ensureNumeric(y)
22551        };
22552    }
22553    /**
22554     * Gets ScrollToOptions based on the given arguments. Will throw if validation fails
22555     * @param {number | ScrollToOptions} optionsOrX
22556     * @param {number} y
22557     * @return {Required<ScrollToOptions>}
22558     */
22559    function getScrollToOptionsWithValidation(optionsOrX, y) {
22560        // If only one argument is given, and it isn't an options object, throw a TypeError
22561        if (y === undefined && !isScrollToOptions(optionsOrX)) {
22562            throw new TypeError("Failed to execute 'scroll' on 'Element': parameter 1 ('options') is not an object.");
22563        }
22564        // Scroll based on the primitive values given as arguments
22565        if (!isScrollToOptions(optionsOrX)) {
22566            return __assign(__assign({}, normalizeScrollCoordinates(optionsOrX, y)), { behavior: "auto" });
22567        }
22568        // Scroll based on the received options object
22569        else {
22570            return __assign(__assign({}, normalizeScrollCoordinates(optionsOrX.left, optionsOrX.top)), { behavior: optionsOrX.behavior == null ? "auto" : optionsOrX.behavior });
22571        }
22572    }
22573
22574    /**
22575     * Patches the 'scroll' method on the Element prototype
22576     */
22577    function patchElementScroll() {
22578        Element.prototype.scroll = function (optionsOrX, y) {
22579            handleScrollMethod(this, "scroll", optionsOrX, y);
22580        };
22581    }
22582
22583    /**
22584     * Patches the 'scrollBy' method on the Element prototype
22585     */
22586    function patchElementScrollBy() {
22587        Element.prototype.scrollBy = function (optionsOrX, y) {
22588            handleScrollMethod(this, "scrollBy", optionsOrX, y);
22589        };
22590    }
22591
22592    /**
22593     * Patches the 'scrollTo' method on the Element prototype
22594     */
22595    function patchElementScrollTo() {
22596        Element.prototype.scrollTo = function (optionsOrX, y) {
22597            handleScrollMethod(this, "scrollTo", optionsOrX, y);
22598        };
22599    }
22600
22601    /**
22602     * Patches the 'scroll' method on the Window prototype
22603     */
22604    function patchWindowScroll() {
22605        window.scroll = function (optionsOrX, y) {
22606            handleScrollMethod(this, "scroll", optionsOrX, y);
22607        };
22608    }
22609
22610    /**
22611     * Patches the 'scrollBy' method on the Window prototype
22612     */
22613    function patchWindowScrollBy() {
22614        window.scrollBy = function (optionsOrX, y) {
22615            handleScrollMethod(this, "scrollBy", optionsOrX, y);
22616        };
22617    }
22618
22619    /**
22620     * Patches the 'scrollTo' method on the Window prototype
22621     */
22622    function patchWindowScrollTo() {
22623        window.scrollTo = function (optionsOrX, y) {
22624            handleScrollMethod(this, "scrollTo", optionsOrX, y);
22625        };
22626    }
22627
22628    // tslint:disable:no-any
22629    /**
22630     * Gets the parent of an element, taking into account DocumentFragments, ShadowRoots, as well as the root context (window)
22631     * @param {EventTarget} currentElement
22632     * @returns {EventTarget | null}
22633     */
22634    function getParent(currentElement) {
22635        if ("nodeType" in currentElement && currentElement.nodeType === 1) {
22636            return currentElement.parentNode;
22637        }
22638        if ("ShadowRoot" in window && currentElement instanceof window.ShadowRoot) {
22639            return currentElement.host;
22640        }
22641        else if (currentElement === document) {
22642            return window;
22643        }
22644        else if (currentElement instanceof Node)
22645            return currentElement.parentNode;
22646        return null;
22647    }
22648
22649    /**
22650     * Returns true if the given overflow property represents a scrollable overflow value
22651     * @param {string | null} overflow
22652     * @return {boolean}
22653     */
22654    function canOverflow(overflow) {
22655        return overflow !== "visible" && overflow !== "clip";
22656    }
22657    /**
22658     * Returns true if the given element is scrollable
22659     * @param {Element} element
22660     * @return {boolean}
22661     */
22662    function isScrollable(element) {
22663        if (element.clientHeight < element.scrollHeight || element.clientWidth < element.scrollWidth) {
22664            var style = getComputedStyle(element, null);
22665            return canOverflow(style.overflowY) || canOverflow(style.overflowX);
22666        }
22667        return false;
22668    }
22669    /**
22670     * Finds the nearest ancestor of an element that can scroll
22671     * @param {Element} target
22672     * @returns {Element|Window?}
22673     */
22674    function findNearestAncestorsWithScrollBehavior(target) {
22675        var currentElement = target;
22676        var scrollingElement = getScrollingElement();
22677        while (currentElement != null) {
22678            var behavior = getScrollBehavior(currentElement);
22679            if (behavior != null && (currentElement === scrollingElement || isScrollable(currentElement))) {
22680                return [currentElement, behavior];
22681            }
22682            var parent_1 = getParent(currentElement);
22683            currentElement = parent_1;
22684        }
22685        // No such element could be found. Start over, but this time find the nearest ancestor that can simply scroll
22686        currentElement = target;
22687        while (currentElement != null) {
22688            if (currentElement === scrollingElement || isScrollable(currentElement)) {
22689                return [currentElement, "auto"];
22690            }
22691            var parent_2 = getParent(currentElement);
22692            currentElement = parent_2;
22693        }
22694        // Default to the scrolling element
22695        return [scrollingElement, "auto"];
22696    }
22697
22698    // tslint:disable:no-any
22699    /**
22700     * Finds the nearest root from an element
22701     * @param {Element} target
22702     * @returns {Document|ShadowRoot}
22703     */
22704    function findNearestRoot(target) {
22705        var currentElement = target;
22706        while (currentElement != null) {
22707            if ("ShadowRoot" in window && currentElement instanceof window.ShadowRoot) {
22708                // Assume this is a ShadowRoot
22709                return currentElement;
22710            }
22711            var parent_1 = getParent(currentElement);
22712            if (parent_1 === currentElement) {
22713                return document;
22714            }
22715            currentElement = parent_1;
22716        }
22717        return document;
22718    }
22719
22720    /**
22721     * Gets the origin of the given Location or HTMLAnchorElement if available in the runtime, and otherwise shims it. (it's a one-liner)
22722     * @returns {string}
22723     */
22724    function getLocationOrigin(locationLike) {
22725        if (locationLike === void 0) { locationLike = location; }
22726        if ("origin" in locationLike && locationLike.origin != null) {
22727            return locationLike.origin;
22728        }
22729        var port = locationLike.port != null && locationLike.port.length > 0 ? ":" + locationLike.port : "";
22730        if (locationLike.protocol === "http:" && port === ":80") {
22731            port = "";
22732        }
22733        else if (locationLike.protocol === "https:" && port === ":443") {
22734            port = "";
22735        }
22736        return locationLike.protocol + "//" + locationLike.hostname + port;
22737    }
22738
22739    /**
22740     * A Regular expression that matches id's of the form "#[digit]"
22741     * @type {RegExp}
22742     */
22743    var ID_WITH_LEADING_DIGIT_REGEXP = /^#\d/;
22744    /**
22745     * Catches anchor navigation to IDs within the same root and ensures that they can be smooth-scrolled
22746     * if the scroll behavior is smooth in the first rooter within that context
22747     */
22748    function catchNavigation() {
22749        // Listen for 'click' events globally
22750        window.addEventListener("click", function (e) {
22751            // Only work with trusted events on HTMLAnchorElements
22752            if (!e.isTrusted || !(e.target instanceof HTMLAnchorElement))
22753                return;
22754            var _a = e.target, pathname = _a.pathname, search = _a.search, hash = _a.hash;
22755            var pointsToCurrentPage = getLocationOrigin(e.target) === getLocationOrigin(location) && pathname === location.pathname && search === location.search;
22756            // Only work with HTMLAnchorElements that navigates to a specific ID on the current page
22757            if (!pointsToCurrentPage || hash == null || hash.length < 1) {
22758                return;
22759            }
22760            // Find the nearest root, whether it be a ShadowRoot or the document itself
22761            var root = findNearestRoot(e.target);
22762            // Attempt to match the selector from that root. querySelector' doesn't support IDs that start with a digit, so work around that limitation
22763            var elementMatch = hash.match(ID_WITH_LEADING_DIGIT_REGEXP) != null ? root.getElementById(hash.slice(1)) : root.querySelector(hash);
22764            // If no selector could be found, don't proceed
22765            if (elementMatch == null)
22766                return;
22767            // Find the nearest ancestor that can be scrolled
22768            var _b = __read(findNearestAncestorsWithScrollBehavior(elementMatch), 2), behavior = _b[1];
22769            // If the behavior isn't smooth, don't proceed
22770            if (behavior !== "smooth")
22771                return;
22772            // Otherwise, first prevent the default action.
22773            e.preventDefault();
22774            // Now, scroll to the element with that ID
22775            elementMatch.scrollIntoView({
22776                behavior: behavior
22777            });
22778        });
22779    }
22780
22781    var ELEMENT_ORIGINAL_SCROLL_INTO_VIEW = UNSUPPORTED_ENVIRONMENT ? undefined : Element.prototype.scrollIntoView;
22782
22783    /**
22784     * The majority of this file is based on https://github.com/stipsan/compute-scroll-into-view (MIT license),
22785     * but has been rewritten to accept a scroller as an argument.
22786     */
22787    /**
22788     * Find out which edge to align against when logical scroll position is "nearest"
22789     * Interesting fact: "nearest" works similarly to "if-needed", if the element is fully visible it will not scroll it
22790     *
22791     * Legends:
22792     * ┌────────┐ ┏ ━ ━ ━ ┓
22793     * │ target │   frame
22794     * └────────┘ ┗ ━ ━ ━ ┛
22795     */
22796    function alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) {
22797        /**
22798         * If element edge A and element edge B are both outside scrolling box edge A and scrolling box edge B
22799         *
22800         *          ┌──┐
22801         *        ┏━│━━│━┓
22802         *          │  │
22803         *        ┃ │  │ ┃        do nothing
22804         *          │  │
22805         *        ┗━│━━│━┛
22806         *          └──┘
22807         *
22808         *  If element edge C and element edge D are both outside scrolling box edge C and scrolling box edge D
22809         *
22810         *    ┏ ━ ━ ━ ━ ┓
22811         *   ┌───────────┐
22812         *   │┃         ┃│        do nothing
22813         *   └───────────┘
22814         *    ┗ ━ ━ ━ ━ ┛
22815         */
22816        if ((elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd) ||
22817            (elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd)) {
22818            return 0;
22819        }
22820        /**
22821         * If element edge A is outside scrolling box edge A and element height is less than scrolling box he
22821ight
22822         *
22823         *          ┌──┐
22824         *        ┏━│━━│━┓         ┏━┌━━┐━┓
22825         *          └──┘             │  │
22826         *  from  ┃      ┃     to  ┃ └──┘ ┃
22827         *
22828         *        ┗━ ━━ ━┛         ┗━ ━━ ━┛
22829         *
22830         * If element edge B is outside scrolling box edge B and element height is greater than scrolling box height
22831         *
22832         *        ┏━ ━━ ━┓         ┏━┌━━┐━┓
22833         *                           │  │
22834         *  from  ┃ ┌──┐ ┃     to  ┃ │  │ ┃
22835         *          │  │             │  │
22836         *        ┗━│━━│━┛         ┗━│━━│━┛
22837         *          │  │             └──┘
22838         *          │  │
22839         *          └──┘
22840         *
22841         * If element edge C is outside scrolling box edge C and element width is less than scrolling box width
22842         *
22843         *       from                 to
22844         *    ┏ ━ ━ ━ ━ ┓         ┏ ━ ━ ━ ━ ┓
22845         *  ┌───┐                 ┌───┐
22846         *  │ ┃ │       ┃         ┃   │     ┃
22847         *  └───┘                 └───┘
22848         *    ┗ ━ ━ ━ ━ ┛         ┗ ━ ━ ━ ━ ┛
22849         *
22850         * If element edge D is outside scrolling box edge D and element width is greater than scrolling box width
22851         *
22852         *       from                 to
22853         *    ┏ ━ ━ ━ ━ ┓         ┏ ━ ━ ━ ━ ┓
22854         *        ┌───────────┐   ┌───────────┐
22855         *    ┃   │     ┃     │   ┃         ┃ │
22856         *        └───────────┘   └───────────┘
22857         *    ┗ ━ ━ ━ ━ ┛         ┗ ━ ━ ━ ━ ┛
22858         */
22859        if ((elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize) ||
22860            (elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize)) {
22861            return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;
22862        }
22863        /**
22864         * If element edge B is outside scrolling box edge B and element height is less than scrolling box height
22865         *
22866         *        ┏━ ━━ ━┓         ┏━ ━━ ━┓
22867         *
22868         *  from  ┃      ┃     to  ┃ ┌──┐ ┃
22869         *          ┌──┐             │  │
22870         *        ┗━│━━│━┛         ┗━└━━┘━┛
22871         *          └──┘
22872         *
22873         * If element edge A is outside scrolling box edge A and element height is greater than scrolling box height
22874         *
22875         *          ┌──┐
22876         *          │  │
22877         *          │  │             ┌──┐
22878         *        ┏━│━━│━┓         ┏━│━━│━┓
22879         *          │  │             │  │
22880         *  from  ┃ └──┘ ┃     to  ┃ │  │ ┃
22881         *                           │  │
22882         *        ┗━ ━━ ━┛         ┗━└━━┘━┛
22883         *
22884         * If element edge C is outside scrolling box edge C and element width is greater than scrolling box width
22885         *
22886         *           from                 to
22887         *        ┏ ━ ━ ━ ━ ┓         ┏ ━ ━ ━ ━ ┓
22888         *  ┌───────────┐           ┌───────────┐
22889         *  │     ┃     │   ┃       │ ┃         ┃
22890         *  └───────────┘           └───────────┘
22891         *        ┗ ━ ━ ━ ━ ┛         ┗ ━ ━ ━ ━ ┛
22892         *
22893         * If element edge D is outside scrolling box edge D and element width is less than scrolling box width
22894         *
22895         *           from                 to
22896         *        ┏ ━ ━ ━ ━ ┓         ┏ ━ ━ ━ ━ ┓
22897         *                ┌───┐             ┌───┐
22898         *        ┃       │ ┃ │       ┃     │   ┃
22899         *                └───┘             └───┘
22900         *        ┗ ━ ━ ━ ━ ┛         ┗ ━ ━ ━ ━ ┛
22901         *
22902         */
22903        if ((elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize) || (elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize)) {
22904            return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd;
22905        }
22906        return 0;
22907    }
22908    function computeScrollIntoView(target, scroller, options) {
22909        var block = options.block, inline = options.inline;
22910        // Used to handle the top most element that can be scrolled
22911        var scrollingElement = getScrollingElement();
22912        // Support pinch-zooming properly, making sure elements scroll into the visual viewport
22913        // Browsers that don't support visualViewport will report the layout viewport dimensions on document.documentElement.clientWidth/Height
22914        // and viewport dimensions on window.innerWidth/Height
22915        // https://www.quirksmode.org/mobile/viewports2.html
22916        // https://bokand.github.io/viewport/index.html
22917        var viewportWidth = window.visualViewport != null ? visualViewport.width : innerWidth;
22918        var viewportHeight = window.visualViewport != null ? visualViewport.height : innerHeight;
22919        var viewportX = window.scrollX != null ? window.scrollX : window.pageXOffset;
22920        var viewportY = window.scrollY != null ? window.scrollY : window.pageYOffset;
22921        var _a = target.getBoundingClientRect(), targetHeight = _a.height, targetWidth = _a.width, targetTop = _a.top, targetRight = _a.right, targetBottom = _a.bottom, targetLeft = _a.left;
22922        // These values mutate as we loop through and generate scroll coordinates
22923        var targetBlock = block === "start" || block === "nearest" ? targetTop : block === "end" ? targetBottom : targetTop + targetHeight / 2; // block === 'center
22924        var targetInline = inline === "center" ? targetLeft + targetWidth / 2 : inline === "end" ? targetRight : targetLeft; // inline === 'start || inline === 'nearest
22925        var _b = scroller.getBoundingClientRect(), height = _b.height, width = _b.width, top = _b.top, right = _b.right, bottom = _b.bottom, left = _b.left;
22926        var frameStyle = getComputedStyle(scroller);
22927        var borderLeft = parseInt(frameStyle.borderLeftWidth, 10);
22928        var borderTop = parseInt(frameStyle.borderTopWidth, 10);
22929        var borderRight = parseInt(frameStyle.borderRightWidth, 10);
22930        var borderBottom = parseInt(frameStyle.borderBottomWidth, 10);
22931        var blockScroll = 0;
22932        var inlineScroll = 0;
22933        // The property existance checks for offset[Width|Height] is because only HTMLElement objects have them, but any Element might pass by here
22934        // @TODO find out if the "as HTMLElement" overrides can be dropped
22935        var scrollbarWidth = "offsetWidth" in scroller ? scroller.offsetWidth - scroller.clientWidth - borderLeft - borderRight : 0;
22936        var scrollbarHeight = "offsetHeight" in scroller ? scroller.offsetHeight - scroller.clientHeight - borderTop - borderBottom : 0;
22937        if (scrollingElement === scroller) {
22938            // Handle viewport logic (document.documentElement or document.body)
22939            if (block === "start") {
22940                blockScroll = targetBlock;
22941            }
22942            else if (block === "end") {
22943                blockScroll = targetBlock - viewportHeight;
22944            }
22945            else if (block === "nearest") {
22946                blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight);
22947            }
22948            else {
22949                // block === 'center' is the default
22950                blockScroll = targetBlock - viewportHeight / 2;
22951            }
22952            if (inline === "start") {
22953                inlineScroll = targetInline;
22954            }
22955            else if (inline === "center") {
22956                inlineScroll = targetInline - viewportWidth / 2;
22957            }
22958            else if (inline === "end") {
22959                inlineScroll = targetInline - viewportWidth;
22960            }
22961            else {
22962                // inline === 'nearest' is the default
22963                inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth);
22964            }
22965            // Apply scroll position offsets and ensure they are within bounds
22966            // @TODO add more test cases to cover this 100%
22967            blockScroll = Math.max(0, blockScroll + viewportY);
22968            inlineScroll = Math.max(0, inlineScroll + viewportX);
22969        }
22970        else {
22971            // Handle each scrolling frame that might exist between the target and the viewport
22972            if (block === "start") {
22973                blockScroll = targetBlock - top - borderTop;
22974            }
22975            else if (block === "end") {
22976                blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight;
22977            }
22978            else if (block === "nearest") {
22979                blockScroll = alignNearest(top, bottom, height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight);
22980            }
22981            else {
22982                // block === 'center' is the default
22983                blockScroll = targetBlock - (top + height / 2) + scrollbarHeight / 2;
22984            }
22985            if (inline === "start") {
22986                inlineScroll = targetInline - left - borderLeft;
22987            }
22988            else if (inline === "center") {
22989                inlineScroll = targetInline - (left + width / 2) + scrollbarWidth / 2;
22990            }
22991            else if (inline === "end") {
22992                inlineScroll = targetInline - right + borderRight + scrollbarWidth;
22993            }
22994            else {
22995                // inline === 'nearest' is the default
22996                inlineScroll = alignNearest(left, right, width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);
22997            }
22998            var scrollLeft = scroller.scrollLeft, scrollTop = scroller.scrollTop;
22999            // Ensure scroll coordinates are not out of bounds while applying scroll offsets
23000            blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, scroller.scrollHeight - height + scrollbarHeight));
23001            inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, scroller.scrollWidth - width + scrollbarWidth));
23002        }
23003        return {
23004            top: blockScroll,
23005            left: inlineScroll
23006        };
23007    }
23008
23009    /**
23010     * Patches the 'scrollIntoView' method on the Element prototype
23011     */
23012    function patchElementScrollIntoView() {
23013        Element.prototype.scrollIntoView = function (arg) {
23014            var normalizedOptions = arg == null || arg === true
23015                ? {
23016                    block: "start",
23017                    inline: "nearest"
23018                }
23019                : arg === false
23020                    ? {
23021                        block: "end",
23022                        inline: "nearest"
23023                    }
23024                    : arg;
23025            // Find the nearest ancestor that can be scrolled
23026            var _a = __read(findNearestAncestorsWithScrollBehavior(this), 2), ancestorWithScroll = _a[0], ancestorWithScrollBehavior = _a[1];
23027            var behavior = normalizedOptions.behavior != null ? normalizedOptions.behavior : ancestorWithScrollBehavior;
23028            // If the behavior isn't smooth, simply invoke the original implementation and do no more
23029            if (behavior !== "smooth") {
23030                // Assert that 'scrollIntoView' is actually defined
23031                if (ELEMENT_ORIGINAL_SCROLL_INTO_VIEW != null) {
23032                    ELEMENT_ORIGINAL_SCROLL_INTO_VIEW.call(this, normalizedOptions);
23033                }
23034                // Otherwise, invoke 'scrollTo' instead and provide the scroll coordinates
23035                else {
23036                    var _b = computeScrollIntoView(this, ancestorWithScroll, normalizedOptions), top_1 = _b.top, left = _b.left;
23037                    getOriginalScrollMethodForKind("scrollTo", this).call(this, left, top_1);
23038                }
23039                return;
23040            }
23041            ancestorWithScroll.scrollTo(__assign({ behavior: behavior }, computeScrollIntoView(this, ancestorWithScroll, normalizedOptions)));
23042        };
23043        // On IE11, HTMLElement has its own declaration of scrollIntoView and does not inherit this from the prototype chain, so we'll need to patch that one too.
23044        if (HTMLElement.prototype.scrollIntoView != null && HTMLElement.prototype.scrollIntoView !== Element.prototype.scrollIntoView) {
23045            HTMLElement.prototype.scrollIntoView = Element.prototype.scrollIntoView;
23046        }
23047    }
23048
23049    var ELEMENT_ORIGINAL_SCROLL_TOP_SET_DESCRIPTOR = UNSUPPORTED_ENVIRONMENT
23050        ? undefined
23051        : Object.getOwnPropertyDescriptor(Element.prototype, "scrollTop").set;
23052
23053    /**
23054     * Patches the 'scrollTop' property descriptor on the Element prototype
23055     */
23056    function patchElementScrollTop() {
23057        Object.defineProperty(Element.prototype, "scrollTop", {
23058            set: function (scrollTop) {
23059                if (this.__adjustingScrollPosition) {
23060                    return ELEMENT_ORIGINAL_SCROLL_TOP_SET_DESCRIPTOR.call(this, scrollTop);
23061                }
23062                handleScrollMethod(this, "scrollTo", this.scrollLeft, scrollTop);
23063                return scrollTop;
23064            }
23065        });
23066    }
23067
23068    var ELEMENT_ORIGINAL_SCROLL_LEFT_SET_DESCRIPTOR = UNSUPPORTED_ENVIRONMENT
23069        ? undefined
23070        : Object.getOwnPropertyDescriptor(Element.prototype, "scrollLeft").set;
23071
23072    /**
23073     * Patches the 'scrollLeft' property descriptor on the Element prototype
23074     */
23075    function patchElementScrollLeft() {
23076        Object.defineProperty(Element.prototype, "scrollLeft", {
23077            set: function (scrollLeft) {
23078                if (this.__adjustingScrollPosition) {
23079                    return ELEMENT_ORIGINAL_SCROLL_LEFT_SET_DESCRIPTOR.call(this, scrollLeft);
23080                }
23081                handleScrollMethod(this, "scrollTo", scrollLeft, this.scrollTop);
23082                return scrollLeft;
23083            }
23084        });
23085    }
23086
23087    /**
23088     * Applies the polyfill
23089     */
23090    function patch() {
23091        // Element.prototype methods
23092        patchElementScroll();
23093        patchElementScrollBy();
23094        patchElementScrollTo();
23095        patchElementScrollIntoView();
23096        // Element.prototype descriptors
23097        patchElementScrollLeft();
23098        patchElementScrollTop();
23099        // window methods
23100        patchWindowScroll();
23101        patchWindowScrollBy();
23102        patchWindowScrollTo();
23103        // Navigation
23104        catchNavigation();
23105    }
23106
23107    /**
23108     * Is true if the browser natively supports the Element.prototype.[scroll|scrollTo|scrollBy|scrollIntoView] methods
23109     * @type {boolean}
23110     */
23111    var SUPPORTS_ELEMENT_PROTOTYPE_SCROLL_METHODS = UNSUPPORTED_ENVIRONMENT
23112        ? false
23113        : "scroll" in Element.prototype && "scrollTo" in Element.prototype && "scrollBy" in Element.prototype && "scrollIntoView" in Element.prototype;
23114
23115    if (!UNSUPPORTED_ENVIRONMENT && (!SUPPORTS_SCROLL_BEHAVIOR || !SUPPORTS_ELEMENT_PROTOTYPE_SCROLL_METHODS)) {
23116        patch();
23117    }
23118
23119}());
23120
23121
23122},{}],189:[function(require,module,exports){
23123'use strict';
23124
23125var GetIntrinsic = require('get-intrinsic');
23126var define = require('define-data-property');
23127var hasDescriptors = require('has-property-descriptors')();
23128var gOPD = require('gopd');
23129
23130var $TypeError = require('es-errors/type');
23131var $floor = GetIntrinsic('%Math.floor%');
23132
23133/** @type {import('.')} */
23134module.exports = function setFunctionLength(fn, length) {
23135	if (typeof fn !== 'function') {
23136		throw new $TypeError('`fn` is not a function');
23137	}
23138	if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
23139		throw new $TypeError('`length` must be a positive 32-bit integer');
23140	}
23141
23142	var loose = arguments.length > 2 && !!arguments[2];
23143
23144	var functionLengthIsConfigurable = true;
23145	var functionLengthIsWritable = true;
23146	if ('length' in fn && gOPD) {
23147		var desc = gOPD(fn, 'length');
23148		if (desc && !desc.configurable) {
23149			functionLengthIsConfigurable = false;
23150		}
23151		if (desc && !desc.writable) {
23152			functionLengthIsWritable = false;
23153		}
23154	}
23155
23156	if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
23157		if (hasDescriptors) {
23158			define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
23159		} else {
23160			define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
23161		}
23162	}
23163	return fn;
23164};
23165
23166},{"define-data-property":138,"es-errors/type":146,"get-intrinsic":154,"gopd":159,"has-property-descriptors":160}],190:[function(require,module,exports){
23167"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t){
23168/*!
23169   * Project : simply-countdown
23170   * Date : 27/06/2015
23171   * License : MIT
23172   * Version : 1.6.0
23173   * Author : Vincent Loy <[email protected]>
23174   * Contributors :
23175   *  - Justin Beasley <[email protected]>
23176   *  - Nathan Smith <[email protected]>
23177   */
23178var n=function t(n){for(var e,o=n||{},s=1;s<arguments.length;s+=1){e=arguments[s];var r=Object.keys(e);if(r.length)for(var a=0;a<r.length;a+=1){var l=r[a];Object.prototype.hasOwnProperty.call(e,l)&&("object"===_typeof(e[l])?t(o[l],e[l]):o[l]=e[l])}}return o},e=function(t,n,e){var o=document.createElement("div"),s=document.createElement("span"),r=document.createElement("span"),a=document.createElement("div");return a.appendChild(s),a.appendChild(r),o.appendChild(a),o.classList.add(n.sectionClass),o.classList.add(e),s.classList.add(n.amountClass),r.classList.add(n.wordClass),t.appendChild(o),{full:o,amount:s,word:r}};t.simplyCountdown=function(t,o){var s,r,a,l,i,u,c,d,p,m,y,g=Object.getPrototypeOf(t),w=n({year:2015,month:6,day:28,hours:0,minutes:0,seconds:0,words:{days:{singular:"day",plural:"days"},hours:{singular:"hour",plural:"hours"},minutes:{singular:"minute",plural:"minutes"},seconds:{singular:"second",plural:"seconds"}},plural:!0,inline:!1,enableUtc:!1,onEnd:function(){},refresh:1e3,inlineClass:"simply-countdown-inline",sectionClass:"simply-section",amountClass:"simply-amount",wordClass:"simply-word",zeroPad:!1,countUp:!1},o);y=g===String.prototype?document.querySelectorAll(t):t,a=new Date(w.year,w.month-1,w.day,w.hours,w.minutes,w.seconds),r=w.enableUtc?new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds()):a;var f,h=function(t){var n,o=t,a=function(t,n){var o;return t.inline?((o=document.createElement("span")).classList.add(t.inlineClass),o):{days:e(n,t,"simply-days-section"),hours:e(n,t,"simply-hours-section"),minutes:e(n,t,"simply-minutes-section"),seconds:e(n,t,"simply-seconds-section")}}(w,o);(n=function(){var t,n,e,y,g=function(){c=parseInt(u/86400,10),u%=86400,d=parseInt(u/3600,10),u%=3600,p=parseInt(u/60,10),m=parseInt(u%60,10)};l=new Date,w.enableUtc?(i=new Date(l.getFullYear(),l.getMonth(),l.getDate(),l.getHours(),l.getMinutes(),l.getSeconds()),u=(r-i.getTime())/1e3):u=(r-l.getTime())/1e3,u>0?g():w.countUp?(u=(l.getTime()-r)/1e3,g()):(c=0,d=0,p=0,m=0,window.clearInterval(s),w.onEnd()),w.plural?(t=c>1?w.words.days.plural:w.words.days.singular,n=d>1?w.words.hours.plural:w.words.hours.singular,e=p>1?w.words.minutes.plural:w.words.minutes.singular,y=m>1?w.words.seconds.plural:w.words.seconds.singular):(t=w.words.days.singular,n=w.words.hours.singular,e=w.words.minutes.singular,y=w.words.seconds.singular),w.inline?o.innerHTML="".concat(c," ").concat(t,", ")+"".concat(d," ").concat(n,", ")+"".concat(p," ").concat(e,", ")+"".concat(m," ").concat(y,"."):(a.days.amount.textContent=(w.zeroPad&&c.toString().length<2?"0":"")+c,a.days.word.textContent=t,a.hours.amount.textContent=(w.zeroPad&&d.toString().length<2?"0":"")+d,a.hours.word.textContent=n,a.minutes.amount.textContent=(w.zeroPad&&p.toString().length<2?"0":"")+p,a.minutes.word.textContent=e,a.seconds.amount.textContent=(w.zeroPad&&m.toString().length<2?"0":"")+m,a.seconds.word.textContent=y)})(),s=window.setInterval(n,w.refresh)};null!==(f=y)&&Symbol.iterator in Object(f)?Array.prototype.forEach.call(y,(function(t){h(t)})):h(y)}}(window),window.jQuery&&function(t,n){t.fn.simplyCountdown=function(t){return function(t,e){n(t,e)}(this.selector,t)}}(jQuery,simplyCountdown);
23179},{}],191:[function(require,module,exports){
23180(function (root, smoothScroll) {
23181  'use strict';
23182
23183  // Support RequireJS and CommonJS/NodeJS module formats.
23184  // Attach smoothScroll to the `window` when executed as a <script>.
23185
23186  // RequireJS
23187  if (typeof define === 'function' && define.amd) {
23188    define(smoothScroll);
23189
23190  // CommonJS
23191  } else if (typeof exports === 'object' && typeof module === 'object') {
23192    module.exports = smoothScroll();
23193
23194  } else {
23195    root.smoothScroll = smoothScroll();
23196  }
23197
23198})(this, function(){
23199'use strict';
23200
23201// Do not initialize smoothScroll when running server side, handle it in client:
23202if (typeof window !== 'object') return;
23203
23204// We do not want this script to be applied in browsers that do not support those
23205// That means no smoothscroll on IE9 and below.
23206if(document.querySelectorAll === void 0 || window.pageYOffset === void 0 || history.pushState === void 0) { return; }
23207
23208// Get the top position of an element in the document
23209var getTop = function(element, start) {
23210    // return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset
23211    if(element.nodeName === 'HTML') return -start
23212    return element.getBoundingClientRect().top + start
23213}
23214// ease in out function thanks to:
23215// http://blog.greweb.fr/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
23216var easeInOutCubic = function (t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 }
23217
23218// calculate the scroll position we should be in
23219// given the start and end point of the scroll
23220// the time elapsed from the beginning of the scroll
23221// and the total duration of the scroll (default 500ms)
23222var position = function(start, end, elapsed, duration) {
23223    if (elapsed > duration) return end;
23224    return start + (end - start) * easeInOutCubic(elapsed / duration); // <-- you can change the easing funtion there
23225    // return start + (end - start) * (elapsed / duration); // <-- this would give a linear scroll
23226}
23227
23228// we use requestAnimationFrame to be called by the browser before every repaint
23229// if the first argument is an element then scroll to the top of this element
23230// if the first argument is numeric then scroll to this location
23231// if the callback exist, it is called when the scrolling is finished
23232// if context is set then scroll that element, else scroll window
23233var smoothScroll = function(el, duration, callback, context){
23234    duration = duration || 500;
23235    context = context || window;
23236    var start = context.scrollTop || window.pageYOffset;
23237
23238    if (typeof el === 'number') {
23239      var end = parseInt(el);
23240    } else {
23241      var end = getTop(el, start);
23242    }
23243
23244    var clock = Date.now();
23245    var requestAnimationFrame = window.requestAnimationFrame ||
23246        window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame ||
23247        function(fn){window.setTimeout(fn, 15);};
23248
23249    var step = function(){
23250        var elapsed = Date.now() - clock;
23251        if (context !== window) {
23252          context.scrollTop = position(start, end, elapsed, duration);
23253        }
23254        else {
23255          window.scroll(0, position(start, end, elapsed, duration));
23256        }
23257
23258        if (elapsed > duration) {
23259            if (typeof callback === 'function') {
23260                callback(el);
23261            }
23262        } else {
23263            requestAnimationFrame(step);
23264        }
23265    }
23266    step();
23267}
23268
23269var linkHandler = function(ev) {
23270    ev.preventDefault();
23271
23272    if (location.hash !== this.hash) window.history.pushState(null, null, this.hash)
23273    // using the history api to solve issue #1 - back doesn't work
23274    // most browser don't update :target when the history api is used:
23275    // THIS IS A BUG FROM THE BROWSERS.
23276    // change the scrolling duration in this call
23277    var node = document.getElementById(this.hash.substring(1))
23278    if(!node) return; // Do not scroll to non-existing node
23279
23280    smoothScroll(node, 500, function(el) {
23281        location.replace('#' + el.id)
23282        // this will cause the :target to be activated.
23283    });
23284}
23285
23286// We look for all the internal links in the documents and attach the smoothscroll function
23287document.addEventListener("DOMContentLoaded", function () {
23288    var internal = document.querySelectorAll('a[href^="#"]:not([href="#"])'), a;
23289    for(var i=internal.length; a=internal[--i];){
23290        a.addEventListener("click", linkHandler, false);
23291    }
23292});
23293
23294// return smoothscroll API
23295return smoothScroll;
23296
23297});
23298
23299},{}],192:[function(require,module,exports){
23300function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23301
23302function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23303
23304function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23305
23306/**
23307 * Sticky.js
23308 * Library for sticky elements written in vanilla javascript. With this library you can easily set sticky elements on your website. It's also responsive.
23309 *
23310 * @version 1.3.0
23311 * @author Rafal Galus <[email protected]>
23312 * @website https://rgalus.github.io/sticky-js/
23313 * @repo https://github.com/rgalus/sticky-js
23314 * @license https://github.com/rgalus/sticky-js/blob/master/LICENSE
23315 */
23316var Sticky = /*#__PURE__*/function () {
23317  /**
23318   * Sticky instance constructor
23319   * @constructor
23320   * @param {string} selector - Selector which we can find elements
23321   * @param {string}
23321 options - Global options for sticky elements (could be overwritten by data-{option}="" attributes)
23322   */
23323  function Sticky() {
23324    var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
23325    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23326
23327    _classCallCheck(this, Sticky);
23328
23329    this.selector = selector;
23330    this.elements = [];
23331    this.version = '1.3.0';
23332    this.vp = this.getViewportSize();
23333    this.body = document.querySelector('body');
23334    this.options = {
23335      wrap: options.wrap || false,
23336      wrapWith: options.wrapWith || '<span></span>',
23337      marginTop: options.marginTop || 0,
23338      marginBottom: options.marginBottom || 0,
23339      stickyFor: options.stickyFor || 0,
23340      stickyClass: options.stickyClass || null,
23341      stickyContainer: options.stickyContainer || 'body'
23342    };
23343    this.updateScrollTopPosition = this.updateScrollTopPosition.bind(this);
23344    this.updateScrollTopPosition();
23345    window.addEventListener('load', this.updateScrollTopPosition);
23346    window.addEventListener('scroll', this.updateScrollTopPosition);
23347    this.run();
23348  }
23349  /**
23350   * Function that waits for page to be fully loaded and then renders & activates every sticky element found with specified selector
23351   * @function
23352   */
23353
23354
23355  _createClass(Sticky, [{
23356    key: "run",
23357    value: function run() {
23358      var _this = this;
23359
23360      // wait for page to be fully loaded
23361      var pageLoaded = setInterval(function () {
23362        if (document.readyState === 'complete') {
23363          clearInterval(pageLoaded);
23364          var elements = document.querySelectorAll(_this.selector);
23365
23366          _this.forEach(elements, function (element) {
23367            return _this.renderElement(element);
23368          });
23369        }
23370      }, 10);
23371    }
23372    /**
23373     * Function that assign needed variables for sticky element, that are used in future for calculations and other
23374     * @function
23375     * @param {node} element - Element to be rendered
23376     */
23377
23378  }, {
23379    key: "renderElement",
23380    value: function renderElement(element) {
23381      var _this2 = this;
23382
23383      // create container for variables needed in future
23384      element.sticky = {}; // set default variables
23385
23386      element.sticky.active = false;
23387      element.sticky.marginTop = parseInt(element.getAttribute('data-margin-top')) || this.options.marginTop;
23388      element.sticky.marginBottom = parseInt(element.getAttribute('data-margin-bottom')) || this.options.marginBottom;
23389      element.sticky.stickyFor = parseInt(element.getAttribute('data-sticky-for')) || this.options.stickyFor;
23390      element.sticky.stickyClass = element.getAttribute('data-sticky-class') || this.options.stickyClass;
23391      element.sticky.wrap = element.hasAttribute('data-sticky-wrap') ? true : this.options.wrap; // @todo attribute for stickyContainer
23392      // element.sticky.stickyContainer = element.getAttribute('data-sticky-container') || this.options.stickyContainer;
23393
23394      element.sticky.stickyContainer = this.options.stickyContainer;
23395      element.sticky.container = this.getStickyContainer(element);
23396      element.sticky.container.rect = this.getRectangle(element.sticky.container);
23397      element.sticky.rect = this.getRectangle(element); // fix when element is image that has not yet loaded and width, height = 0
23398
23399      if (element.tagName.toLowerCase() === 'img') {
23400        element.onload = function () {
23401          return element.sticky.rect = _this2.getRectangle(element);
23402        };
23403      }
23404
23405      if (element.sticky.wrap) {
23406        this.wrapElement(element);
23407      } // activate rendered element
23408
23409
23410      this.activate(element);
23411    }
23412    /**
23413     * Wraps element into placeholder element
23414     * @function
23415     * @param {node} element - Element to be wrapped
23416     */
23417
23418  }, {
23419    key: "wrapElement",
23420    value: function wrapElement(element) {
23421      element.insertAdjacentHTML('beforebegin', element.getAttribute('data-sticky-wrapWith') || this.options.wrapWith);
23422      element.previousSibling.appendChild(element);
23423    }
23424    /**
23425     * Function that activates element when specified conditions are met and then initalise events
23426     * @function
23427     * @param {node} element - Element to be activated
23428     */
23429
23430  }, {
23431    key: "activate",
23432    value: function activate(element) {
23433      if (element.sticky.rect.top + element.sticky.rect.height < element.sticky.container.rect.top + element.sticky.container.rect.height && element.sticky.stickyFor < this.vp.width && !element.sticky.active) {
23434        element.sticky.active = true;
23435      }
23436
23437      if (this.elements.indexOf(element) < 0) {
23438        this.elements.push(element);
23439      }
23440
23441      if (!element.sticky.resizeEvent) {
23442        this.initResizeEvents(element);
23443        element.sticky.resizeEvent = true;
23444      }
23445
23446      if (!element.sticky.scrollEvent) {
23447        this.initScrollEvents(element);
23448        element.sticky.scrollEvent = true;
23449      }
23450
23451      this.setPosition(element);
23452    }
23453    /**
23454     * Function which is adding onResizeEvents to window listener and assigns function to element as resizeListener
23455     * @function
23456     * @param {node} element - Element for which resize events are initialised
23457     */
23458
23459  }, {
23460    key: "initResizeEvents",
23461    value: function initResizeEvents(element) {
23462      var _this3 = this;
23463
23464      element.sticky.resizeListener = function () {
23465        return _this3.onResizeEvents(element);
23466      };
23467
23468      window.addEventListener('resize', element.sticky.resizeListener);
23469    }
23470    /**
23471     * Removes element listener from resize event
23472     * @function
23473     * @param {node} element - Element from which listener is deleted
23474     */
23475
23476  }, {
23477    key: "destroyResizeEvents",
23478    value: function destroyResizeEvents(element) {
23479      window.removeEventListener('resize', element.sticky.resizeListener);
23480    }
23481    /**
23482     * Function which is fired when user resize window. It checks if element should be activated or deactivated and then run setPosition function
23483     * @function
23484     * @param {node} element - Element for which event function is fired
23485     */
23486
23487  }, {
23488    key: "onResizeEvents",
23489    value: function onResizeEvents(element) {
23490      this.vp = this.getViewportSize();
23491      element.sticky.rect = this.getRectangle(element);
23492      element.sticky.container.rect = this.getRectangle(element.sticky.container);
23493
23494      if (element.sticky.rect.top + element.sticky.rect.height < element.sticky.container.rect.top + element.sticky.container.rect.height && element.sticky.stickyFor < this.vp.width && !element.sticky.active) {
23495        element.sticky.active = true;
23496      } else if (element.sticky.rect.top + element.sticky.rect.height >= element.sticky.container.rect.top + element.sticky.container.rect.height || element.sticky.stickyFor >= this.vp.width && element.sticky.active) {
23497        element.sticky.active = false;
23498      }
23499
23500      this.setPosition(element);
23501    }
23502    /**
23503     * Function which is adding onScrollEvents to window listener and assigns function to element as scrollListener
23504     * @function
23505     * @param {node} element - Element for which scroll events are initialised
23506     */
23507
23508  }, {
23509    key: "initScrollEvents",
23510    value: function initScrollEvents(element) {
23511      var _this4 = this;
23512
23513      element.sticky.scrollListener = function () {
23514        return _this4.onScrollEvents(element);
23515      };
23516
23517      window.addEventListener('scroll', element.sticky.scrollListener);
23518    }
23519    /**
23520     * Removes element listener from scroll event
23521     * @function
23522     * @param {node} element - Element from which listener is deleted
23523     */
23524
23525  }, {
23526    key: "destroyScrollEvents",
23527    value: function destroyScrollEvents(element) {
23528      window.removeEventListener('scroll', element.sticky.scrollListener);
23529    }
23530    /**
23531     * Function which is fired when user scroll window. If element is active, function is invoking setPosition function
23532     * @function
23533     * @param {node} element - Element for which event function is fired
23534     */
23535
23536  }, {
23537    key: "onScrollEvents",
23538    value: function onScrollEvents(element) {
23539      if (element.sticky && element.sticky.active) {
23540        this.setPosition(element);
23541      }
23542    }
23543    /**
23544     * Main function for the library. Here are some condition calculations and css appending for sticky element when user scroll window
23545     * @function
23546     * @param {node} element - Element that will be positioned if it's active
23547     */
23548
23549  }, {
23550    key: "setPosition",
23551    value: function setPosition(element) {
23552      this.css(element, {
23553        position: '',
23554        width: '',
23555        top: '',
23556        left: ''
23557      });
23558
23559      if (this.vp.height < element.sticky.rect.height || !element.sticky.active) {
23560        return;
23561      }
23562
23563      if (!element.sticky.rect.width) {
23564        element.sticky.rect = this.getRectangle(element);
23565      }
23566
23567      if (element.sticky.wrap) {
23568        this.css(element.parentNode, {
23569          display: 'block',
23570          width: element.sticky.rect.width + 'px',
23571          height: element.sticky.rect.height + 'px'
23572        });
23573      }
23574
23575      if (element.sticky.rect.top === 0 && element.sticky.container === this.body) {
23576        this.css(element, {
23577          position: 'fixed',
23578          top: element.sticky.rect.top + 'px',
23579          left: element.sticky.rect.left + 'px',
23580          width: element.sticky.rect.width + 'px'
23581        });
23582
23583        if (element.sticky.stickyClass) {
23584          element.classList.add(element.sticky.stickyClass);
23585        }
23586      } else if (this.scrollTop > element.sticky.rect.top - element.sticky.marginTop) {
23587        this.css(element, {
23588          position: 'fixed',
23589          width: element.sticky.rect.width + 'px',
23590          left: element.sticky.rect.left + 'px'
23591        });
23592
23593        if (this.scrollTop + element.sticky.rect.height + element.sticky.marginTop > element.sticky.container.rect.top + element.sticky.container.offsetHeight - element.sticky.marginBottom) {
23594          if (element.sticky.stickyClass) {
23595            element.classList.remove(element.sticky.stickyClass);
23596          }
23597
23598          this.css(element, {
23599            top: element.sticky.container.rect.top + element.sticky.container.offsetHeight - (this.scrollTop + element.sticky.rect.height + element.sticky.marginBottom) + 'px'
23600          });
23601        } else {
23602          if (element.sticky.stickyClass) {
23603            element.classList.add(element.sticky.stickyClass);
23604          }
23605
23606          this.css(element, {
23607            top: element.sticky.marginTop + 'px'
23608          });
23609        }
23610      } else {
23611        if (element.sticky.stickyClass) {
23612          element.classList.remove(element.sticky.stickyClass);
23613        }
23614
23615        this.css(element, {
23616          position: '',
23617          width: '',
23618          top: '',
23619          left: ''
23620        });
23621
23622        if (element.sticky.wrap) {
23623          this.css(element.parentNode, {
23624            display: '',
23625            width: '',
23626            height: ''
23627          });
23628        }
23629      }
23630    }
23631    /**
23632     * Function that updates element sticky rectangle (with sticky container), then activate or deactivate element, then update position if it's active
23633     * @function
23634     */
23635
23636  }, {
23637    key: "update",
23638    value: function update() {
23639      var _this5 = this;
23640
23641      this.forEach(this.elements, function (element) {
23642        element.sticky.rect = _this5.getRectangle(element);
23643        element.sticky.container.rect = _this5.getRectangle(element.sticky.container);
23644
23645        _this5.activate(element);
23646
23647        _this5.setPosition(element);
23648      });
23649    }
23650    /**
23651     * Destroys sticky element, remove listeners
23652     * @function
23653     */
23654
23655  }, {
23656    key: "destroy",
23657    value: function destroy() {
23658      var _this6 = this;
23659
23660      window.removeEventListener('load', this.updateScrollTopPosition);
23661      window.removeEventListener('scroll', this.updateScrollTopPosition);
23662      this.forEach(this.elements, function (element) {
23663        _this6.destroyResizeEvents(element);
23664
23665        _this6.destroyScrollEvents(element);
23666
23667        delete element.sticky;
23668      });
23669    }
23670    /**
23671     * Function that returns container element in which sticky element is stuck (if is not specified, then it's stuck to body)
23672     * @function
23673     * @param {node} element - Element which sticky container are looked for
23674     * @return {node} element - Sticky container
23675     */
23676
23677  }, {
23678    key: "getStickyContainer",
23679    value: function getStickyContainer(element) {
23680      var container = element.parentNode;
23681
23682      while (!container.hasAttribute('data-sticky-container') && !container.parentNode.querySelector(element.sticky.stickyContainer) && container !== this.body) {
23683        container = container.parentNode;
23684      }
23685
23686      return container;
23687    }
23688    /**
23689     * Function that returns element rectangle & position (width, height, top, left)
23690     * @function
23691     * @param {node} element - Element which position & rectangle are returned
23692     * @return {object}
23693     */
23694
23695  }, {
23696    key: "getRectangle",
23697    value: function getRectangle(element) {
23698      this.css(element, {
23699        position: '',
23700        width: '',
23701        top: '',
23702        left: ''
23703      });
23704      var width = Math.max(element.offsetWidth, element.clientWidth, element.scrollWidth);
23705      var height = Math.max(element.offsetHeight, element.clientHeight, element.scrollHeight);
23706      var top = 0;
23707      var left = 0;
23708
23709      do {
23710        top += element.offsetTop || 0;
23711        left += element.offsetLeft || 0;
23712        element = element.offsetParent;
23713      } while (element);
23714
23715      return {
23716        top: top,
23717        left: left,
23718        width: width,
23719        height: height
23720      };
23721    }
23722    /**
23723     * Function that returns viewport dimensions
23724     * @function
23725     * @return {object}
23726     */
23727
23728  }, {
23729    key: "getViewportSize",
23730    value: function getViewportSize() {
23731      return {
23732        width: Math.max(document.documentElement.clientWidth, window.innerWidth || 0),
23733        height: Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
23734      };
23735    }
23736    /**
23737     * Function that updates window scroll position
23738     * @function
23739     * @return {number}
23740     */
23741
23742  }, {
23743    key: "updateScrollTopPosition",
23744    value: function updateScrollTopPosition() {
23745      this.scrollTop = (window.pageYOffset || document.scrollTop) - (document.clientTop || 0) || 0;
23746    }
23747    /**
23748     * Helper function for loops
23749     * @helper
23750     * @param {array}
23751     * @param {function} callback - Callback function (no need for explanation)
23752     */
23753
23754  }, {
23755    key: "forEach",
23756    value: function forEach(array, callback) {
23757      for (var i = 0, len = array.length; i < len; i++) {
23758        callback(array[i]);
23759      }
23760    }
23761    /**
23762     * Helper function to add/remove css properties for specified element.
23763     * @helper
23764     * @param {node} element - DOM element
23765     * @param {object} properties - CSS properties that will be added/removed from specified element
23766     */
23767
23768  }, {
23769    key: "css",
23770    value: function css(element, properties) {
23771      for (var property in properties) {
23772        if (properties.hasOwnProperty(property)) {
23773          element.style[property] = properties[property];
23774        }
23775      }
23776    }
23777  }]);
23778
23779  return Sticky;
23780}();
23781/**
23782 * Export function that supports AMD, CommonJS and Plain Browser.
23783 */
23784
23785
23786(function (root, factory) {
23787  if (typeof exports !== 'undefined') {
23788    module.exports = factory;
23789  } else if (typeof define === 'function' && define.amd) {
23790    define([], function () {
23791      return factory;
23792    });
23793  } else {
vendor: 4,552 bytes, lines 23794-23982
23794    root.Sticky = factory;
23795  }
23796})(this, Sticky);
23797},{}],193:[function(require,module,exports){
23798
23799var Sticky = require('./dist/sticky.compile.js');
23800
23801module.exports = Sticky;
23802
23803},{"./dist/sticky.compile.js":192}],194:[function(require,module,exports){
23804/**
23805 * Swiper 9.4.1
23806 * Most modern mobile touch slider and framework with hardware accelerated transitions
23807 * https://swiperjs.com
23808 *
23809 * Copyright 2014-2023 Vladimir Kharlampidi
23810 *
23811 * Released under the MIT License
23812 *
23813 * Released on: June 13, 2023
23814 */
23815
23816(function (global, factory) {
23817    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
23818    typeof define === 'function' && define.amd ? define(factory) :
23819    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Swiper = factory());
23820})(this, (function () { 'use strict';
23821
23822    /**
23823     * SSR Window 4.0.2
23824     * Better handling for window object in SSR environment
23825     * https://github.com/nolimits4web/ssr-window
23826     *
23827     * Copyright 2021, Vladimir Kharlampidi
23828     *
23829     * Licensed under MIT
23830     *
23831     * Released on: December 13, 2021
23832     */
23833    /* eslint-disable no-param-reassign */
23834    function isObject$1(obj) {
23835      return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object;
23836    }
23837    function extend$1(target, src) {
23838      if (target === void 0) {
23839        target = {};
23840      }
23841      if (src === void 0) {
23842        src = {};
23843      }
23844      Object.keys(src).forEach(key => {
23845        if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) {
23846          extend$1(target[key], src[key]);
23847        }
23848      });
23849    }
23850    const ssrDocument = {
23851      body: {},
23852      addEventListener() {},
23853      removeEventListener() {},
23854      activeElement: {
23855        blur() {},
23856        nodeName: ''
23857      },
23858      querySelector() {
23859        return null;
23860      },
23861      querySelectorAll() {
23862        return [];
23863      },
23864      getElementById() {
23865        return null;
23866      },
23867      createEvent() {
23868        return {
23869          initEvent() {}
23870        };
23871      },
23872      createElement() {
23873        return {
23874          children: [],
23875          childNodes: [],
23876          style: {},
23877          setAttribute() {},
23878          getElementsByTagName() {
23879            return [];
23880          }
23881        };
23882      },
23883      createElementNS() {
23884        return {};
23885      },
23886      importNode() {
23887        return null;
23888      },
23889      location: {
23890        hash: '',
23891        host: '',
23892        hostname: '',
23893        href: '',
23894        origin: '',
23895        pathname: '',
23896        protocol: '',
23897        search: ''
23898      }
23899    };
23900    function getDocument() {
23901      const doc = typeof document !== 'undefined' ? document : {};
23902      extend$1(doc, ssrDocument);
23903      return doc;
23904    }
23905    const ssrWindow = {
23906      document: ssrDocument,
23907      navigator: {
23908        userAgent: ''
23909      },
23910      location: {
23911        hash: '',
23912        host: '',
23913        hostname: '',
23914        href: '',
23915        origin: '',
23916        pathname: '',
23917        protocol: '',
23918        search: ''
23919      },
23920      history: {
23921        replaceState() {},
23922        pushState() {},
23923        go() {},
23924        back() {}
23925      },
23926      CustomEvent: function CustomEvent() {
23927        return this;
23928      },
23929      addEventListener() {},
23930      removeEventListener() {},
23931      getComputedStyle() {
23932        return {
23933          getPropertyValue() {
23934            return '';
23935          }
23936        };
23937      },
23938      Image() {},
23939      Date() {},
23940      screen: {},
23941      setTimeout() {},
23942      clearTimeout() {},
23943      matchMedia() {
23944        return {};
23945      },
23946      requestAnimationFrame(callback) {
23947        if (typeof setTimeout === 'undefined') {
23948          callback();
23949          return null;
23950        }
23951        return setTimeout(callback, 0);
23952      },
23953      cancelAnimationFrame(id) {
23954        if (typeof setTimeout === 'undefined') {
23955          return;
23956        }
23957        clearTimeout(id);
23958      }
23959    };
23960    function getWindow() {
23961      const win = typeof window !== 'undefined' ? window : {};
23962      extend$1(win, ssrWindow);
23963      return win;
23964    }
23965
23966    function deleteProps(obj) {
23967      const object = obj;
23968      Object.keys(object).forEach(key => {
23969        try {
23970          object[key] = null;
23971        } catch (e) {
23972          // no getter for object
23973        }
23974        try {
23975          delete object[key];
23976        } catch (e) {
23977          // something got wrong
23978        }
23979      });
23980    }
23981    function nextTick(callback, delay) {
23982      if (delay === void 0) {
vendor: 6,590 bytes, lines 23983-24149
23983        delay = 0;
23984      }
23985      return setTimeout(callback, delay);
23986    }
23987    function now() {
23988      return Date.now();
23989    }
23990    function getComputedStyle$1(el) {
23991      const window = getWindow();
23992      let style;
23993      if (window.getComputedStyle) {
23994        style = window.getComputedStyle(el, null);
23995      }
23996      if (!style && el.currentStyle) {
23997        style = el.currentStyle;
23998      }
23999      if (!style) {
24000        style = el.style;
24001      }
24002      return style;
24003    }
24004    function getTranslate(el, axis) {
24005      if (axis === void 0) {
24006        axis = 'x';
24007      }
24008      const window = getWindow();
24009      let matrix;
24010      let curTransform;
24011      let transformMatrix;
24012      const curStyle = getComputedStyle$1(el);
24013      if (window.WebKitCSSMatrix) {
24014        curTransform = curStyle.transform || curStyle.webkitTransform;
24015        if (curTransform.split(',').length > 6) {
24016          curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
24017        }
24018        // Some old versions of Webkit choke when 'none' is passed; pass
24019        // empty string instead in this case
24020        transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
24021      } else {
24022        transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
24023        matrix = transformMatrix.toString().split(',');
24024      }
24025      if (axis === 'x') {
24026        // Latest Chrome and webkits Fix
24027        if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
24028        // Crazy IE10 Matrix
24029        else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
24030        // Normal Browsers
24031        else curTransform = parseFloat(matrix[4]);
24032      }
24033      if (axis === 'y') {
24034        // Latest Chrome and webkits Fix
24035        if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
24036        // Crazy IE10 Matrix
24037        else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
24038        // Normal Browsers
24039        else curTransform = parseFloat(matrix[5]);
24040      }
24041      return curTransform || 0;
24042    }
24043    function isObject(o) {
24044      return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
24045    }
24046    function isNode(node) {
24047      // eslint-disable-next-line
24048      if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
24049        return node instanceof HTMLElement;
24050      }
24051      return node && (node.nodeType === 1 || node.nodeType === 11);
24052    }
24053    function extend() {
24054      const to = Object(arguments.length <= 0 ? undefined : arguments[0]);
24055      const noExtend = ['__proto__', 'constructor', 'prototype'];
24056      for (let i = 1; i < arguments.length; i += 1) {
24057        const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];
24058        if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
24059          const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);
24060          for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
24061            const nextKey = keysArray[nextIndex];
24062            const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
24063            if (desc !== undefined && desc.enumerable) {
24064              if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
24065                if (nextSource[nextKey].__swiper__) {
24066                  to[nextKey] = nextSource[nextKey];
24067                } else {
24068                  extend(to[nextKey], nextSource[nextKey]);
24069                }
24070              } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
24071                to[nextKey] = {};
24072                if (nextSource[nextKey].__swiper__) {
24073                  to[nextKey] = nextSource[nextKey];
24074                } else {
24075                  extend(to[nextKey], nextSource[nextKey]);
24076                }
24077              } else {
24078                to[nextKey] = nextSource[nextKey];
24079              }
24080            }
24081          }
24082        }
24083      }
24084      return to;
24085    }
24086    function setCSSProperty(el, varName, varValue) {
24087      el.style.setProperty(varName, varValue);
24088    }
24089    function animateCSSModeScroll(_ref) {
24090      let {
24091        swiper,
24092        targetPosition,
24093        side
24094      } = _ref;
24095      const window = getWindow();
24096      const startPosition = -swiper.translate;
24097      let startTime = null;
24098      let time;
24099      const duration = swiper.params.speed;
24100      swiper.wrapperEl.style.scrollSnapType = 'none';
24101      window.cancelAnimationFrame(swiper.cssModeFrameID);
24102      const dir = targetPosition > startPosition ? 'next' : 'prev';
24103      const isOutOfBound = (current, target) => {
24104        return dir === 'next' && current >= target || dir === 'prev' && current <= target;
24105      };
24106      const animate = () => {
24107        time = new Date().getTime();
24108        if (startTime === null) {
24109          startTime = time;
24110        }
24111        const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
24112        const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
24113        let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
24114        if (isOutOfBound(currentPosition, targetPosition)) {
24115          currentPosition = targetPosition;
24116        }
24117        swiper.wrapperEl.scrollTo({
24118          [side]: currentPosition
24119        });
24120        if (isOutOfBound(currentPosition, targetPosition)) {
24121          swiper.wrapperEl.style.overflow = 'hidden';
24122          swiper.wrapperEl.style.scrollSnapType = '';
24123          setTimeout(() => {
24124            swiper.wrapperEl.style.overflow = '';
24125            swiper.wrapperEl.scrollTo({
24126              [side]: currentPosition
24127            });
24128          });
24129          window.cancelAnimationFrame(swiper.cssModeFrameID);
24130          return;
24131        }
24132        swiper.cssModeFrameID = window.requestAnimationFrame(animate);
24133      };
24134      animate();
24135    }
24136    function getSlideTransformEl(slideEl) {
24137      return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowEl && slideEl.shadowEl.querySelector('.swiper-slide-transform') || slideEl;
24138    }
24139    function elementChildren(element, selector) {
24140      if (selector === void 0) {
24141        selector = '';
24142      }
24143      return [...element.children].filter(el => el.matches(selector));
24144    }
24145    function createElement(tag, classes) {
24146      if (classes === void 0) {
24147        classes = [];
24148      }
24149      const el = document.createElement(tag);
vendor: 3,655 bytes, lines 24150-24257
24150      el.classList.add(...(Array.isArray(classes) ? classes : [classes]));
24151      return el;
24152    }
24153    function elementOffset(el) {
24154      const window = getWindow();
24155      const document = getDocument();
24156      const box = el.getBoundingClientRect();
24157      const body = document.body;
24158      const clientTop = el.clientTop || body.clientTop || 0;
24159      const clientLeft = el.clientLeft || body.clientLeft || 0;
24160      const scrollTop = el === window ? window.scrollY : el.scrollTop;
24161      const scrollLeft = el === window ? window.scrollX : el.scrollLeft;
24162      return {
24163        top: box.top + scrollTop - clientTop,
24164        left: box.left + scrollLeft - clientLeft
24165      };
24166    }
24167    function elementPrevAll(el, selector) {
24168      const prevEls = [];
24169      while (el.previousElementSibling) {
24170        const prev = el.previousElementSibling; // eslint-disable-line
24171        if (selector) {
24172          if (prev.matches(selector)) prevEls.push(prev);
24173        } else prevEls.push(prev);
24174        el = prev;
24175      }
24176      return prevEls;
24177    }
24178    function elementNextAll(el, selector) {
24179      const nextEls = [];
24180      while (el.nextElementSibling) {
24181        const next = el.nextElementSibling; // eslint-disable-line
24182        if (selector) {
24183          if (next.matches(selector)) nextEls.push(next);
24184        } else nextEls.push(next);
24185        el = next;
24186      }
24187      return nextEls;
24188    }
24189    function elementStyle(el, prop) {
24190      const window = getWindow();
24191      return window.getComputedStyle(el, null).getPropertyValue(prop);
24192    }
24193    function elementIndex(el) {
24194      let child = el;
24195      let i;
24196      if (child) {
24197        i = 0;
24198        // eslint-disable-next-line
24199        while ((child = child.previousSibling) !== null) {
24200          if (child.nodeType === 1) i += 1;
24201        }
24202        return i;
24203      }
24204      return undefined;
24205    }
24206    function elementParents(el, selector) {
24207      const parents = []; // eslint-disable-line
24208      let parent = el.parentElement; // eslint-disable-line
24209      while (parent) {
24210        if (selector) {
24211          if (parent.matches(selector)) parents.push(parent);
24212        } else {
24213          parents.push(parent);
24214        }
24215        parent = parent.parentElement;
24216      }
24217      return parents;
24218    }
24219    function elementTransitionEnd(el, callback) {
24220      function fireCallBack(e) {
24221        if (e.target !== el) return;
24222        callback.call(el, e);
24223        el.removeEventListener('transitionend', fireCallBack);
24224      }
24225      if (callback) {
24226        el.addEventListener('transitionend', fireCallBack);
24227      }
24228    }
24229    function elementOuterSize(el, size, includeMargins) {
24230      const window = getWindow();
24231      if (includeMargins) {
24232        return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));
24233      }
24234      return el.offsetWidth;
24235    }
24236
24237    let support;
24238    function calcSupport() {
24239      const window = getWindow();
24240      const document = getDocument();
24241      return {
24242        smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style,
24243        touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch)
24244      };
24245    }
24246    function getSupport() {
24247      if (!support) {
24248        support = calcSupport();
24249      }
24250      return support;
24251    }
24252
24253    let deviceCached;
24254    function calcDevice(_temp) {
24255      let {
24256        userAgent
24257      } = _temp === void 0 ? {} : _temp;
vendor: 6,998 bytes, lines 24258-24460
24258      const support = getSupport();
24259      const window = getWindow();
24260      const platform = window.navigator.platform;
24261      const ua = userAgent || window.navigator.userAgent;
24262      const device = {
24263        ios: false,
24264        android: false
24265      };
24266      const screenWidth = window.screen.width;
24267      const screenHeight = window.screen.height;
24268      const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
24269      let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
24270      const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
24271      const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
24272      const windows = platform === 'Win32';
24273      let macos = platform === 'MacIntel';
24274
24275      // iPadOs 13 fix
24276      const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];
24277      if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) {
24278        ipad = ua.match(/(Version)\/([\d.]+)/);
24279        if (!ipad) ipad = [0, 1, '13_0_0'];
24280        macos = false;
24281      }
24282
24283      // Android
24284      if (android && !windows) {
24285        device.os = 'android';
24286        device.android = true;
24287      }
24288      if (ipad || iphone || ipod) {
24289        device.os = 'ios';
24290        device.ios = true;
24291      }
24292
24293      // Export object
24294      return device;
24295    }
24296    function getDevice(overrides) {
24297      if (overrides === void 0) {
24298        overrides = {};
24299      }
24300      if (!deviceCached) {
24301        deviceCached = calcDevice(overrides);
24302      }
24303      return deviceCached;
24304    }
24305
24306    let browser;
24307    function calcBrowser() {
24308      const window = getWindow();
24309      let needPerspectiveFix = false;
24310      function isSafari() {
24311        const ua = window.navigator.userAgent.toLowerCase();
24312        return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
24313      }
24314      if (isSafari()) {
24315        const ua = String(window.navigator.userAgent);
24316        if (ua.includes('Version/')) {
24317          const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num));
24318          needPerspectiveFix = major < 16 || major === 16 && minor < 2;
24319        }
24320      }
24321      return {
24322        isSafari: needPerspectiveFix || isSafari(),
24323        needPerspectiveFix,
24324        isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)
24325      };
24326    }
24327    function getBrowser() {
24328      if (!browser) {
24329        browser = calcBrowser();
24330      }
24331      return browser;
24332    }
24333
24334    function Resize(_ref) {
24335      let {
24336        swiper,
24337        on,
24338        emit
24339      } = _ref;
24340      const window = getWindow();
24341      let observer = null;
24342      let animationFrame = null;
24343      const resizeHandler = () => {
24344        if (!swiper || swiper.destroyed || !swiper.initialized) return;
24345        emit('beforeResize');
24346        emit('resize');
24347      };
24348      const createObserver = () => {
24349        if (!swiper || swiper.destroyed || !swiper.initialized) return;
24350        observer = new ResizeObserver(entries => {
24351          animationFrame = window.requestAnimationFrame(() => {
24352            const {
24353              width,
24354              height
24355            } = swiper;
24356            let newWidth = width;
24357            let newHeight = height;
24358            entries.forEach(_ref2 => {
24359              let {
24360                contentBoxSize,
24361                contentRect,
24362                target
24363              } = _ref2;
24364              if (target && target !== swiper.el) return;
24365              newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;
24366              newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;
24367            });
24368            if (newWidth !== width || newHeight !== height) {
24369              resizeHandler();
24370            }
24371          });
24372        });
24373        observer.observe(swiper.el);
24374      };
24375      const removeObserver = () => {
24376        if (animationFrame) {
24377          window.cancelAnimationFrame(animationFrame);
24378        }
24379        if (observer && observer.unobserve && swiper.el) {
24380          observer.unobserve(swiper.el);
24381          observer = null;
24382        }
24383      };
24384      const orientationChangeHandler = () => {
24385        if (!swiper || swiper.destroyed || !swiper.initialized) return;
24386        emit('orientationchange');
24387      };
24388      on('init', () => {
24389        if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {
24390          createObserver();
24391          return;
24392        }
24393        window.addEventListener('resize', resizeHandler);
24394        window.addEventListener('orientationchange', orientationChangeHandler);
24395      });
24396      on('destroy', () => {
24397        removeObserver();
24398        window.removeEventListener('resize', resizeHandler);
24399        window.removeEventListener('orientationchange', orientationChangeHandler);
24400      });
24401    }
24402
24403    function Observer(_ref) {
24404      let {
24405        swiper,
24406        extendParams,
24407        on,
24408        emit
24409      } = _ref;
24410      const observers = [];
24411      const window = getWindow();
24412      const attach = function (target, options) {
24413        if (options === void 0) {
24414          options = {};
24415        }
24416        const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
24417        const observer = new ObserverFunc(mutations => {
24418          // The observerUpdate event should only be triggered
24419          // once despite the number of mutations.  Additional
24420          // triggers are redundant and are very costly
24421          if (swiper.__preventObserver__) return;
24422          if (mutations.length === 1) {
24423            emit('observerUpdate', mutations[0]);
24424            return;
24425          }
24426          const observerUpdate = function observerUpdate() {
24427            emit('observerUpdate', mutations[0]);
24428          };
24429          if (window.requestAnimationFrame) {
24430            window.requestAnimationFrame(observerUpdate);
24431          } else {
24432            window.setTimeout(observerUpdate, 0);
24433          }
24434        });
24435        observer.observe(target, {
24436          attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
24437          childList: typeof options.childList === 'undefined' ? true : options.childList,
24438          characterData: typeof options.characterData === 'undefined' ? true : options.characterData
24439        });
24440        observers.push(observer);
24441      };
24442      const init = () => {
24443        if (!swiper.params.observer) return;
24444        if (swiper.params.observeParents) {
24445          const containerParents = elementParents(swiper.el);
24446          for (let i = 0; i < containerParents.length; i += 1) {
24447            attach(containerParents[i]);
24448          }
24449        }
24450        // Observe container
24451        attach(swiper.el, {
24452          childList: swiper.params.observeSlideChildren
24453        });
24454
24455        // Observe wrapper
24456        attach(swiper.wrapperEl, {
24457          attributes: false
24458        });
24459      };
24460      const destroy = () => {
vendor: 6,821 bytes, lines 24461-24648
24461        observers.forEach(observer => {
24462          observer.disconnect();
24463        });
24464        observers.splice(0, observers.length);
24465      };
24466      extendParams({
24467        observer: false,
24468        observeParents: false,
24469        observeSlideChildren: false
24470      });
24471      on('init', init);
24472      on('destroy', destroy);
24473    }
24474
24475    /* eslint-disable no-underscore-dangle */
24476
24477    var eventsEmitter = {
24478      on(events, handler, priority) {
24479        const self = this;
24480        if (!self.eventsListeners || self.destroyed) return self;
24481        if (typeof handler !== 'function') return self;
24482        const method = priority ? 'unshift' : 'push';
24483        events.split(' ').forEach(event => {
24484          if (!self.eventsListeners[event]) self.eventsListeners[event] = [];
24485          self.eventsListeners[event][method](handler);
24486        });
24487        return self;
24488      },
24489      once(events, handler, priority) {
24490        const self = this;
24491        if (!self.eventsListeners || self.destroyed) return self;
24492        if (typeof handler !== 'function') return self;
24493        function onceHandler() {
24494          self.off(events, onceHandler);
24495          if (onceHandler.__emitterProxy) {
24496            delete onceHandler.__emitterProxy;
24497          }
24498          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24499            args[_key] = arguments[_key];
24500          }
24501          handler.apply(self, args);
24502        }
24503        onceHandler.__emitterProxy = handler;
24504        return self.on(events, onceHandler, priority);
24505      },
24506      onAny(handler, priority) {
24507        const self = this;
24508        if (!self.eventsListeners || self.destroyed) return self;
24509        if (typeof handler !== 'function') return self;
24510        const method = priority ? 'unshift' : 'push';
24511        if (self.eventsAnyListeners.indexOf(handler) < 0) {
24512          self.eventsAnyListeners[method](handler);
24513        }
24514        return self;
24515      },
24516      offAny(handler) {
24517        const self = this;
24518        if (!self.eventsListeners || self.destroyed) return self;
24519        if (!self.eventsAnyListeners) return self;
24520        const index = self.eventsAnyListeners.indexOf(handler);
24521        if (index >= 0) {
24522          self.eventsAnyListeners.splice(index, 1);
24523        }
24524        return self;
24525      },
24526      off(events, handler) {
24527        const self = this;
24528        if (!self.eventsListeners || self.destroyed) return self;
24529        if (!self.eventsListeners) return self;
24530        events.split(' ').forEach(event => {
24531          if (typeof handler === 'undefined') {
24532            self.eventsListeners[event] = [];
24533          } else if (self.eventsListeners[event]) {
24534            self.eventsListeners[event].forEach((eventHandler, index) => {
24535              if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {
24536                self.eventsListeners[event].splice(index, 1);
24537              }
24538            });
24539          }
24540        });
24541        return self;
24542      },
24543      emit() {
24544        const self = this;
24545        if (!self.eventsListeners || self.destroyed) return self;
24546        if (!self.eventsListeners) return self;
24547        let events;
24548        let data;
24549        let context;
24550        for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
24551          args[_key2] = arguments[_key2];
24552        }
24553        if (typeof args[0] === 'string' || Array.isArray(args[0])) {
24554          events = args[0];
24555          data = args.slice(1, args.length);
24556          context = self;
24557        } else {
24558          events = args[0].events;
24559          data = args[0].data;
24560          context = args[0].context || self;
24561        }
24562        data.unshift(context);
24563        const eventsArray = Array.isArray(events) ? events : events.split(' ');
24564        eventsArray.forEach(event => {
24565          if (self.eventsAnyListeners && self.eventsAnyListeners.length) {
24566            self.eventsAnyListeners.forEach(eventHandler => {
24567              eventHandler.apply(context, [event, ...data]);
24568            });
24569          }
24570          if (self.eventsListeners && self.eventsListeners[event]) {
24571            self.eventsListeners[event].forEach(eventHandler => {
24572              eventHandler.apply(context, data);
24573            });
24574          }
24575        });
24576        return self;
24577      }
24578    };
24579
24580    function updateSize() {
24581      const swiper = this;
24582      let width;
24583      let height;
24584      const el = swiper.el;
24585      if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
24586        width = swiper.params.width;
24587      } else {
24588        width = el.clientWidth;
24589      }
24590      if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
24591        height = swiper.params.height;
24592      } else {
24593        height = el.clientHeight;
24594      }
24595      if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
24596        return;
24597      }
24598
24599      // Subtract paddings
24600      width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10);
24601      height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10);
24602      if (Number.isNaN(width)) width = 0;
24603      if (Number.isNaN(height)) height = 0;
24604      Object.assign(swiper, {
24605        width,
24606        height,
24607        size: swiper.isHorizontal() ? width : height
24608      });
24609    }
24610
24611    function updateSlides() {
24612      const swiper = this;
24613      function getDirectionLabel(property) {
24614        if (swiper.isHorizontal()) {
24615          return property;
24616        }
24617        // prettier-ignore
24618        return {
24619          'width': 'height',
24620          'margin-top': 'margin-left',
24621          'margin-bottom ': 'margin-right',
24622          'margin-left': 'margin-top',
24623          'margin-right': 'margin-bottom',
24624          'padding-left': 'padding-top',
24625          'padding-right': 'padding-bottom',
24626          'marginRight': 'marginBottom'
24627        }[property];
24628      }
24629      function getDirectionPropertyValue(node, label) {
24630        return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);
24631      }
24632      const params = swiper.params;
24633      const {
24634        wrapperEl,
24635        slidesEl,
24636        size: swiperSize,
24637        rtlTranslate: rtl,
24638        wrongRTL
24639      } = swiper;
24640      const isVirtual = swiper.virtual && params.virtual.enabled;
24641      const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
24642      const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`);
24643      const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;
24644      let snapGrid = [];
24645      const slidesGrid = [];
24646      const slidesSizesGrid = [];
24647      let offsetBefore = params.slidesOffsetBefore;
24648      if (typeof offsetBefore === 'function') {
vendor: 8,004 bytes, lines 24649-24827
24649        offsetBefore = params.slidesOffsetBefore.call(swiper);
24650      }
24651      let offsetAfter = params.slidesOffsetAfter;
24652      if (typeof offsetAfter === 'function') {
24653        offsetAfter = params.slidesOffsetAfter.call(swiper);
24654      }
24655      const previousSnapGridLength = swiper.snapGrid.length;
24656      const previousSlidesGridLength = swiper.slidesGrid.length;
24657      let spaceBetween = params.spaceBetween;
24658      let slidePosition = -offsetBefore;
24659      let prevSlideSize = 0;
24660      let index = 0;
24661      if (typeof swiperSize === 'undefined') {
24662        return;
24663      }
24664      if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
24665        spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
24666      } else if (typeof spaceBetween === 'string') {
24667        spaceBetween = parseFloat(spaceBetween);
24668      }
24669      swiper.virtualSize = -spaceBetween;
24670
24671      // reset margins
24672      slides.forEach(slideEl => {
24673        if (rtl) {
24674          slideEl.style.marginLeft = '';
24675        } else {
24676          slideEl.style.marginRight = '';
24677        }
24678        slideEl.style.marginBottom = '';
24679        slideEl.style.marginTop = '';
24680      });
24681
24682      // reset cssMode offsets
24683      if (params.centeredSlides && params.cssMode) {
24684        setCSSProperty(wrapperEl, '--swiper-centered-offset-before', '');
24685        setCSSProperty(wrapperEl, '--swiper-centered-offset-after', '');
24686      }
24687      const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
24688      if (gridEnabled) {
24689        swiper.grid.initSlides(slidesLength);
24690      }
24691
24692      // Calc slides
24693      let slideSize;
24694      const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {
24695        return typeof params.breakpoints[key].slidesPerView !== 'undefined';
24696      }).length > 0;
24697      for (let i = 0; i < slidesLength; i += 1) {
24698        slideSize = 0;
24699        let slide;
24700        if (slides[i]) slide = slides[i];
24701        if (gridEnabled) {
24702          swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);
24703        }
24704        if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
24705
24706        if (params.slidesPerView === 'auto') {
24707          if (shouldResetSlideSize) {
24708            slides[i].style[getDirectionLabel('width')] = ``;
24709          }
24710          const slideStyles = getComputedStyle(slide);
24711          const currentTransform = slide.style.transform;
24712          const currentWebKitTransform = slide.style.webkitTransform;
24713          if (currentTransform) {
24714            slide.style.transform = 'none';
24715          }
24716          if (currentWebKitTransform) {
24717            slide.style.webkitTransform = 'none';
24718          }
24719          if (params.roundLengths) {
24720            slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true);
24721          } else {
24722            // eslint-disable-next-line
24723            const width = getDirectionPropertyValue(slideStyles, 'width');
24724            const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');
24725            const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');
24726            const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');
24727            const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');
24728            const boxSizing = slideStyles.getPropertyValue('box-sizing');
24729            if (boxSizing && boxSizing === 'border-box') {
24730              slideSize = width + marginLeft + marginRight;
24731            } else {
24732              const {
24733                clientWidth,
24734                offsetWidth
24735              } = slide;
24736              slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
24737            }
24738          }
24739          if (currentTransform) {
24740            slide.style.transform = currentTransform;
24741          }
24742          if (currentWebKitTransform) {
24743            slide.style.webkitTransform = currentWebKitTransform;
24744          }
24745          if (params.roundLengths) slideSize = Math.floor(slideSize);
24746        } else {
24747          slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
24748          if (params.roundLengths) slideSize = Math.floor(slideSize);
24749          if (slides[i]) {
24750            slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;
24751          }
24752        }
24753        if (slides[i]) {
24754          slides[i].swiperSlideSize = slideSize;
24755        }
24756        slidesSizesGrid.push(slideSize);
24757        if (params.centeredSlides) {
24758          slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
24759          if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
24760          if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
24761          if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
24762          if (params.roundLengths) slidePosition = Math.floor(slidePosition);
24763          if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);
24764          slidesGrid.push(slidePosition);
24765        } else {
24766          if (params.roundLengths) slidePosition = Math.floor(slidePosition);
24767          if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);
24768          slidesGrid.push(slidePosition);
24769          slidePosition = slidePosition + slideSize + spaceBetween;
24770        }
24771        swiper.virtualSize += slideSize + spaceBetween;
24772        prevSlideSize = slideSize;
24773        index += 1;
24774      }
24775      swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;
24776      if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {
24777        wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;
24778      }
24779      if (params.setWrapperSize) {
24780        wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
24781      }
24782      if (gridEnabled) {
24783        swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);
24784      }
24785
24786      // Remove last grid elements depending on width
24787      if (!params.centeredSlides) {
24788        const newSlidesGrid = [];
24789        for (let i = 0; i < snapGrid.length; i += 1) {
24790          let slidesGridItem = snapGrid[i];
24791          if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
24792          if (snapGrid[i] <= swiper.virtualSize - swiperSize) {
24793            newSlidesGrid.push(slidesGridItem);
24794          }
24795        }
24796        snapGrid = newSlidesGrid;
24797        if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
24798          snapGrid.push(swiper.virtualSize - swiperSize);
24799        }
24800      }
24801      if (isVirtual && params.loop) {
24802        const size = slidesSizesGrid[0] + spaceBetween;
24803        if (params.slidesPerGroup > 1) {
24804          const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup);
24805          const groupSize = size * params.slidesPerGroup;
24806          for (let i = 0; i < groups; i += 1) {
24807            snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize);
24808          }
24809        }
24810        for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) {
24811          if (params.slidesPerGroup === 1) {
24812            snapGrid.push(snapGrid[snapGrid.length - 1] + size);
24813          }
24814          slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size);
24815          swiper.virtualSize += size;
24816        }
24817      }
24818      if (snapGrid.length === 0) snapGrid = [0];
24819      if (spaceBetween !== 0) {
24820        const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');
24821        slides.filter((_, slideIndex) => {
24822          if (!params.cssMode || params.loop) return true;
24823          if (slideIndex === slides.length - 1) {
24824            return false;
24825          }
24826          return true;
24827        }
vendor: 3,703 bytes, lines 24827-24917
24827).forEach(slideEl => {
24828          slideEl.style[key] = `${spaceBetween}px`;
24829        });
24830      }
24831      if (params.centeredSlides && params.centeredSlidesBounds) {
24832        let allSlidesSize = 0;
24833        slidesSizesGrid.forEach(slideSizeValue => {
24834          allSlidesSize += slideSizeValue + (spaceBetween || 0);
24835        });
24836        allSlidesSize -= spaceBetween;
24837        const maxSnap = allSlidesSize - swiperSize;
24838        snapGrid = snapGrid.map(snap => {
24839          if (snap <= 0) return -offsetBefore;
24840          if (snap > maxSnap) return maxSnap + offsetAfter;
24841          return snap;
24842        });
24843      }
24844      if (params.centerInsufficientSlides) {
24845        let allSlidesSize = 0;
24846        slidesSizesGrid.forEach(slideSizeValue => {
24847          allSlidesSize += slideSizeValue + (spaceBetween || 0);
24848        });
24849        allSlidesSize -= spaceBetween;
24850        if (allSlidesSize < swiperSize) {
24851          const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
24852          snapGrid.forEach((snap, snapIndex) => {
24853            snapGrid[snapIndex] = snap - allSlidesOffset;
24854          });
24855          slidesGrid.forEach((snap, snapIndex) => {
24856            slidesGrid[snapIndex] = snap + allSlidesOffset;
24857          });
24858        }
24859      }
24860      Object.assign(swiper, {
24861        slides,
24862        snapGrid,
24863        slidesGrid,
24864        slidesSizesGrid
24865      });
24866      if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {
24867        setCSSProperty(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);
24868        setCSSProperty(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);
24869        const addToSnapGrid = -swiper.snapGrid[0];
24870        const addToSlidesGrid = -swiper.slidesGrid[0];
24871        swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);
24872        swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);
24873      }
24874      if (slidesLength !== previousSlidesLength) {
24875        swiper.emit('slidesLengthChange');
24876      }
24877      if (snapGrid.length !== previousSnapGridLength) {
24878        if (swiper.params.watchOverflow) swiper.checkOverflow();
24879        swiper.emit('snapGridLengthChange');
24880      }
24881      if (slidesGrid.length !== previousSlidesGridLength) {
24882        swiper.emit('slidesGridLengthChange');
24883      }
24884      if (params.watchSlidesProgress) {
24885        swiper.updateSlidesOffset();
24886      }
24887      if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
24888        const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
24889        const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
24890        if (slidesLength <= params.maxBackfaceHiddenSlides) {
24891          if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass);
24892        } else if (hasClassBackfaceClassAdded) {
24893          swiper.el.classList.remove(backFaceHiddenClass);
24894        }
24895      }
24896    }
24897
24898    function updateAutoHeight(speed) {
24899      const swiper = this;
24900      const activeSlides = [];
24901      const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
24902      let newHeight = 0;
24903      let i;
24904      if (typeof speed === 'number') {
24905        swiper.setTransition(speed);
24906      } else if (speed === true) {
24907        swiper.setTransition(swiper.params.speed);
24908      }
24909      const getSlideByIndex = index => {
24910        if (isVirtual) {
24911          return swiper.slides[swiper.getSlideIndexByData(index)];
24912        }
24913        return swiper.slides[index];
24914      };
24915      // Find slides currently in view
24916      if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
24917        if (swiper.params.centeredSlides) {
vendor: 1,912 bytes, lines 24918-24970
24918          (swiper.visibleSlides || []).forEach(slide => {
24919            activeSlides.push(slide);
24920          });
24921        } else {
24922          for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
24923            const index = swiper.activeIndex + i;
24924            if (index > swiper.slides.length && !isVirtual) break;
24925            activeSlides.push(getSlideByIndex(index));
24926          }
24927        }
24928      } else {
24929        activeSlides.push(getSlideByIndex(swiper.activeIndex));
24930      }
24931
24932      // Find new height from highest slide in view
24933      for (i = 0; i < activeSlides.length; i += 1) {
24934        if (typeof activeSlides[i] !== 'undefined') {
24935          const height = activeSlides[i].offsetHeight;
24936          newHeight = height > newHeight ? height : newHeight;
24937        }
24938      }
24939
24940      // Update Height
24941      if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`;
24942    }
24943
24944    function updateSlidesOffset() {
24945      const swiper = this;
24946      const slides = swiper.slides;
24947      // eslint-disable-next-line
24948      const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0;
24949      for (let i = 0; i < slides.length; i += 1) {
24950        slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment();
24951      }
24952    }
24953
24954    function updateSlidesProgress(translate) {
24955      if (translate === void 0) {
24956        translate = this && this.translate || 0;
24957      }
24958      const swiper = this;
24959      const params = swiper.params;
24960      const {
24961        slides,
24962        rtlTranslate: rtl,
24963        snapGrid
24964      } = swiper;
24965      if (slides.length === 0) return;
24966      if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
24967      let offsetCenter = -translate;
24968      if (rtl) offsetCenter = translate;
24969
24970      // Visible Slides
vendor: 4,583 bytes, lines 24971-25077
24971      slides.forEach(slideEl => {
24972        slideEl.classList.remove(params.slideVisibleClass);
24973      });
24974      swiper.visibleSlidesIndexes = [];
24975      swiper.visibleSlides = [];
24976      let spaceBetween = params.spaceBetween;
24977      if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
24978        spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size;
24979      } else if (typeof spaceBetween === 'string') {
24980        spaceBetween = parseFloat(spaceBetween);
24981      }
24982      for (let i = 0; i < slides.length; i += 1) {
24983        const slide = slides[i];
24984        let slideOffset = slide.swiperSlideOffset;
24985        if (params.cssMode && params.centeredSlides) {
24986          slideOffset -= slides[0].swiperSlideOffset;
24987        }
24988        const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
24989        const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);
24990        const slideBefore = -(offsetCenter - slideOffset);
24991        const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
24992        const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;
24993        if (isVisible) {
24994          swiper.visibleSlides.push(slide);
24995          swiper.visibleSlidesIndexes.push(i);
24996          slides[i].classList.add(params.slideVisibleClass);
24997        }
24998        slide.progress = rtl ? -slideProgress : slideProgress;
24999        slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
25000      }
25001    }
25002
25003    function updateProgress(translate) {
25004      const swiper = this;
25005      if (typeof translate === 'undefined') {
25006        const multiplier = swiper.rtlTranslate ? -1 : 1;
25007        // eslint-disable-next-line
25008        translate = swiper && swiper.translate && swiper.translate * multiplier || 0;
25009      }
25010      const params = swiper.params;
25011      const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
25012      let {
25013        progress,
25014        isBeginning,
25015        isEnd,
25016        progressLoop
25017      } = swiper;
25018      const wasBeginning = isBeginning;
25019      const wasEnd = isEnd;
25020      if (translatesDiff === 0) {
25021        progress = 0;
25022        isBeginning = true;
25023        isEnd = true;
25024      } else {
25025        progress = (translate - swiper.minTranslate()) / translatesDiff;
25026        const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1;
25027        const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1;
25028        isBeginning = isBeginningRounded || progress <= 0;
25029        isEnd = isEndRounded || progress >= 1;
25030        if (isBeginningRounded) progress = 0;
25031        if (isEndRounded) progress = 1;
25032      }
25033      if (params.loop) {
25034        const firstSlideIndex = swiper.getSlideIndexByData(0);
25035        const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1);
25036        const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex];
25037        const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex];
25038        const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1];
25039        const translateAbs = Math.abs(translate);
25040        if (translateAbs >= firstSlideTranslate) {
25041          progressLoop = (translateAbs - firstSlideTranslate) / translateMax;
25042        } else {
25043          progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax;
25044        }
25045        if (progressLoop > 1) progressLoop -= 1;
25046      }
25047      Object.assign(swiper, {
25048        progress,
25049        progressLoop,
25050        isBeginning,
25051        isEnd
25052      });
25053      if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);
25054      if (isBeginning && !wasBeginning) {
25055        swiper.emit('reachBeginning toEdge');
25056      }
25057      if (isEnd && !wasEnd) {
25058        swiper.emit('reachEnd toEdge');
25059      }
25060      if (wasBeginning && !isBeginning || wasEnd && !isEnd) {
25061        swiper.emit('fromEdge');
25062      }
25063      swiper.emit('progress', progress);
25064    }
25065
25066    function updateSlidesClasses() {
25067      const swiper = this;
25068      const {
25069        slides,
25070        params,
25071        slidesEl,
25072        activeIndex
25073      } = swiper;
25074      const isVirtual = swiper.virtual && params.virtual.enabled;
25075      const getFilteredSlide = selector => {
25076        return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
25077      };
vendor: 4,831 bytes, lines 25078-25194
25078      slides.forEach(slideEl => {
25079        slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
25080      });
25081      let activeSlide;
25082      if (isVirtual) {
25083        if (params.loop) {
25084          let slideIndex = activeIndex - swiper.virtual.slidesBefore;
25085          if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex;
25086          if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length;
25087          activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`);
25088        } else {
25089          activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
25090        }
25091      } else {
25092        activeSlide = slides[activeIndex];
25093      }
25094      if (activeSlide) {
25095        // Active classes
25096        activeSlide.classList.add(params.slideActiveClass);
25097
25098        // Next Slide
25099        let nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
25100        if (params.loop && !nextSlide) {
25101          nextSlide = slides[0];
25102        }
25103        if (nextSlide) {
25104          nextSlide.classList.add(params.slideNextClass);
25105        }
25106        // Prev Slide
25107        let prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
25108        if (params.loop && !prevSlide === 0) {
25109          prevSlide = slides[slides.length - 1];
25110        }
25111        if (prevSlide) {
25112          prevSlide.classList.add(params.slidePrevClass);
25113        }
25114      }
25115      swiper.emitSlidesClasses();
25116    }
25117
25118    const processLazyPreloader = (swiper, imageEl) => {
25119      if (!swiper || swiper.destroyed || !swiper.params) return;
25120      const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`;
25121      const slideEl = imageEl.closest(slideSelector());
25122      if (slideEl) {
25123        const lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);
25124        if (lazyEl) lazyEl.remove();
25125      }
25126    };
25127    const unlazy = (swiper, index) => {
25128      if (!swiper.slides[index]) return;
25129      const imageEl = swiper.slides[index].querySelector('[loading="lazy"]');
25130      if (imageEl) imageEl.removeAttribute('loading');
25131    };
25132    const preload = swiper => {
25133      if (!swiper || swiper.destroyed || !swiper.params) return;
25134      let amount = swiper.params.lazyPreloadPrevNext;
25135      const len = swiper.slides.length;
25136      if (!len || !amount || amount < 0) return;
25137      amount = Math.min(amount, len);
25138      const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView);
25139      const activeIndex = swiper.activeIndex;
25140      if (swiper.params.grid && swiper.params.grid.rows > 1) {
25141        const activeColumn = activeIndex;
25142        const preloadColumns = [activeColumn - amount];
25143        preloadColumns.push(...Array.from({
25144          length: amount
25145        }).map((_, i) => {
25146          return activeColumn + slidesPerView + i;
25147        }));
25148        swiper.slides.forEach((slideEl, i) => {
25149          if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i);
25150        });
25151        return;
25152      }
25153      const slideIndexLastInView = activeIndex + slidesPerView - 1;
25154      if (swiper.params.rewind || swiper.params.loop) {
25155        for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) {
25156          const realIndex = (i % len + len) % len;
25157          if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex);
25158        }
25159      } else {
25160        for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) {
25161          if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) {
25162            unlazy(swiper, i);
25163          }
25164        }
25165      }
25166    };
25167
25168    function getActiveIndexByTranslate(swiper) {
25169      const {
25170        slidesGrid,
25171        params
25172      } = swiper;
25173      const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
25174      let activeIndex;
25175      for (let i = 0; i < slidesGrid.length; i += 1) {
25176        if (typeof slidesGrid[i + 1] !== 'undefined') {
25177          if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {
25178            activeIndex = i;
25179          } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {
25180            activeIndex = i + 1;
25181          }
25182        } else if (translate >= slidesGrid[i]) {
25183          activeIndex = i;
25184        }
25185      }
25186      // Normalize slideIndex
25187      if (params.normalizeSlideIndex) {
25188        if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
25189      }
25190      return activeIndex;
25191    }
25192    function updateActiveIndex(newActiveIndex) {
25193      const swiper = this;
25194      const translate = swiper.rtlTranslate ? swiper.translate : -swi
vendor: 25,268 bytes, lines 25194-25939
25194per.translate;
25195      const {
25196        snapGrid,
25197        params,
25198        activeIndex: previousIndex,
25199        realIndex: previousRealIndex,
25200        snapIndex: previousSnapIndex
25201      } = swiper;
25202      let activeIndex = newActiveIndex;
25203      let snapIndex;
25204      const getVirtualRealIndex = aIndex => {
25205        let realIndex = aIndex - swiper.virtual.slidesBefore;
25206        if (realIndex < 0) {
25207          realIndex = swiper.virtual.slides.length + realIndex;
25208        }
25209        if (realIndex >= swiper.virtual.slides.length) {
25210          realIndex -= swiper.virtual.slides.length;
25211        }
25212        return realIndex;
25213      };
25214      if (typeof activeIndex === 'undefined') {
25215        activeIndex = getActiveIndexByTranslate(swiper);
25216      }
25217      if (snapGrid.indexOf(translate) >= 0) {
25218        snapIndex = snapGrid.indexOf(translate);
25219      } else {
25220        const skip = Math.min(params.slidesPerGroupSkip, activeIndex);
25221        snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);
25222      }
25223      if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
25224      if (activeIndex === previousIndex) {
25225        if (snapIndex !== previousSnapIndex) {
25226          swiper.snapIndex = snapIndex;
25227          swiper.emit('snapIndexChange');
25228        }
25229        if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
25230          swiper.realIndex = getVirtualRealIndex(activeIndex);
25231        }
25232        return;
25233      }
25234      // Get real index
25235      let realIndex;
25236      if (swiper.virtual && params.virtual.enabled && params.loop) {
25237        realIndex = getVirtualRealIndex(activeIndex);
25238      } else if (swiper.slides[activeIndex]) {
25239        realIndex = parseInt(swiper.slides[activeIndex].getAttribute('data-swiper-slide-index') || activeIndex, 10);
25240      } else {
25241        realIndex = activeIndex;
25242      }
25243      Object.assign(swiper, {
25244        previousSnapIndex,
25245        snapIndex,
25246        previousRealIndex,
25247        realIndex,
25248        previousIndex,
25249        activeIndex
25250      });
25251      if (swiper.initialized) {
25252        preload(swiper);
25253      }
25254      swiper.emit('activeIndexChange');
25255      swiper.emit('snapIndexChange');
25256      if (previousRealIndex !== realIndex) {
25257        swiper.emit('realIndexChange');
25258      }
25259      if (swiper.initialized || swiper.params.runCallbacksOnInit) {
25260        swiper.emit('slideChange');
25261      }
25262    }
25263
25264    function updateClickedSlide(e) {
25265      const swiper = this;
25266      const params = swiper.params;
25267      const slide = e.closest(`.${params.slideClass}, swiper-slide`);
25268      let slideFound = false;
25269      let slideIndex;
25270      if (slide) {
25271        for (let i = 0; i < swiper.slides.length; i += 1) {
25272          if (swiper.slides[i] === slide) {
25273            slideFound = true;
25274            slideIndex = i;
25275            break;
25276          }
25277        }
25278      }
25279      if (slide && slideFound) {
25280        swiper.clickedSlide = slide;
25281        if (swiper.virtual && swiper.params.virtual.enabled) {
25282          swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10);
25283        } else {
25284          swiper.clickedIndex = slideIndex;
25285        }
25286      } else {
25287        swiper.clickedSlide = undefined;
25288        swiper.clickedIndex = undefined;
25289        return;
25290      }
25291      if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {
25292        swiper.slideToClickedSlide();
25293      }
25294    }
25295
25296    var update = {
25297      updateSize,
25298      updateSlides,
25299      updateAutoHeight,
25300      updateSlidesOffset,
25301      updateSlidesProgress,
25302      updateProgress,
25303      updateSlidesClasses,
25304      updateActiveIndex,
25305      updateClickedSlide
25306    };
25307
25308    function getSwiperTranslate(axis) {
25309      if (axis === void 0) {
25310        axis = this.isHorizontal() ? 'x' : 'y';
25311      }
25312      const swiper = this;
25313      const {
25314        params,
25315        rtlTranslate: rtl,
25316        translate,
25317        wrapperEl
25318      } = swiper;
25319      if (params.virtualTranslate) {
25320        return rtl ? -translate : translate;
25321      }
25322      if (params.cssMode) {
25323        return translate;
25324      }
25325      let currentTranslate = getTranslate(wrapperEl, axis);
25326      currentTranslate += swiper.cssOverflowAdjustment();
25327      if (rtl) currentTranslate = -currentTranslate;
25328      return currentTranslate || 0;
25329    }
25330
25331    function setTranslate(translate, byController) {
25332      const swiper = this;
25333      const {
25334        rtlTranslate: rtl,
25335        params,
25336        wrapperEl,
25337        progress
25338      } = swiper;
25339      let x = 0;
25340      let y = 0;
25341      const z = 0;
25342      if (swiper.isHorizontal()) {
25343        x = rtl ? -translate : translate;
25344      } else {
25345        y = translate;
25346      }
25347      if (params.roundLengths) {
25348        x = Math.floor(x);
25349        y = Math.floor(y);
25350      }
25351      swiper.previousTranslate = swiper.translate;
25352      swiper.translate = swiper.isHorizontal() ? x : y;
25353      if (params.cssMode) {
25354        wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
25355      } else if (!params.virtualTranslate) {
25356        if (swiper.isHorizontal()) {
25357          x -= swiper.cssOverflowAdjustment();
25358        } else {
25359          y -= swiper.cssOverflowAdjustment();
25360        }
25361        wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`;
25362      }
25363
25364      // Check if we need to update progress
25365      let newProgress;
25366      const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
25367      if (translatesDiff === 0) {
25368        newProgress = 0;
25369      } else {
25370        newProgress = (translate - swiper.minTranslate()) / translatesDiff;
25371      }
25372      if (newProgress !== progress) {
25373        swiper.updateProgress(translate);
25374      }
25375      swiper.emit('setTranslate', swiper.translate, byController);
25376    }
25377
25378    function minTranslate() {
25379      return -this.snapGrid[0];
25380    }
25381
25382    function maxTranslate() {
25383      return -this.snapGrid[this.snapGrid.length - 1];
25384    }
25385
25386    function translateTo(translate, speed, runCallbacks, translateBounds, internal) {
25387      if (translate === void 0) {
25388        translate = 0;
25389      }
25390      if (speed === void 0) {
25391        speed = this.params.speed;
25392      }
25393      if (runCallbacks === void 0) {
25394        runCallbacks = true;
25395      }
25396      if (translateBounds === void 0) {
25397        translateBounds = true;
25398      }
25399      const swiper = this;
25400      const {
25401        params,
25402        wrapperEl
25403      } = swiper;
25404      if (swiper.animating && params.preventInteractionOnTransition) {
25405        return false;
25406      }
25407      const minTranslate = swiper.minTranslate();
25408      const maxTranslate = swiper.maxTranslate();
25409      let newTranslate;
25410      if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate;
25411
25412      // Update progress
25413      swiper.updateProgress(newTranslate);
25414      if (params.cssMode) {
25415        const isH = swiper.isHorizontal();
25416        if (speed === 0) {
25417          wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;
25418        } else {
25419          if (!swiper.support.smoothScroll) {
25420            animateCSSModeScroll({
25421              swiper,
25422              targetPosition: -newTranslate,
25423              side: isH ? 'left' : 'top'
25424            });
25425            return true;
25426          }
25427          wrapperEl.scrollTo({
25428            [isH ? 'left' : 'top']: -newTranslate,
25429            behavior: 'smooth'
25430          });
25431        }
25432        return true;
25433      }
25434      if (speed === 0) {
25435        swiper.setTransition(0);
25436        swiper.setTranslate(newTranslate);
25437        if (runCallbacks) {
25438          swiper.emit('beforeTransitionStart', speed, internal);
25439          swiper.emit('transitionEnd');
25440        }
25441      } else {
25442        swiper.setTransition(speed);
25443        swiper.setTranslate(newTranslate);
25444        if (runCallbacks) {
25445          swiper.emit('beforeTransitionStart', speed, internal);
25446          swiper.emit('transitionStart');
25447        }
25448        if (!swiper.animating) {
25449          swiper.animating = true;
25450          if (!swiper.onTranslateToWrapperTransitionEnd) {
25451            swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {
25452              if (!swiper || swiper.destroyed) return;
25453              if (e.target !== this) return;
25454              swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
25455              swiper.onTranslateToWrapperTransitionEnd = null;
25456              delete swiper.onTranslateToWrapperTransitionEnd;
25457              if (runCallbacks) {
25458                swiper.emit('transitionEnd');
25459              }
25460            };
25461          }
25462          swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
25463        }
25464      }
25465      return true;
25466    }
25467
25468    var translate = {
25469      getTranslate: getSwiperTranslate,
25470      setTranslate,
25471      minTranslate,
25472      maxTranslate,
25473      translateTo
25474    };
25475
25476    function setTransition(duration, byController) {
25477      const swiper = this;
25478      if (!swiper.params.cssMode) {
25479        swiper.wrapperEl.style.transitionDuration = `${duration}ms`;
25480      }
25481      swiper.emit('setTransition', duration, byController);
25482    }
25483
25484    function transitionEmit(_ref) {
25485      let {
25486        swiper,
25487        runCallbacks,
25488        direction,
25489        step
25490      } = _ref;
25491      const {
25492        activeIndex,
25493        previousIndex
25494      } = swiper;
25495      let dir = direction;
25496      if (!dir) {
25497        if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';
25498      }
25499      swiper.emit(`transition${step}`);
25500      if (runCallbacks && activeIndex !== previousIndex) {
25501        if (dir === 'reset') {
25502          swiper.emit(`slideResetTransition${step}`);
25503          return;
25504        }
25505        swiper.emit(`slideChangeTransition${step}`);
25506        if (dir === 'next') {
25507          swiper.emit(`slideNextTransition${step}`);
25508        } else {
25509          swiper.emit(`slidePrevTransition${step}`);
25510        }
25511      }
25512    }
25513
25514    function transitionStart(runCallbacks, direction) {
25515      if (runCallbacks === void 0) {
25516        runCallbacks = true;
25517      }
25518      const swiper = this;
25519      const {
25520        params
25521      } = swiper;
25522      if (params.cssMode) return;
25523      if (params.autoHeight) {
25524        swiper.updateAutoHeight();
25525      }
25526      transitionEmit({
25527        swiper,
25528        runCallbacks,
25529        direction,
25530        step: 'Start'
25531      });
25532    }
25533
25534    function transitionEnd(runCallbacks, direction) {
25535      if (runCallbacks === void 0) {
25536        runCallbacks = true;
25537      }
25538      const swiper = this;
25539      const {
25540        params
25541      } = swiper;
25542      swiper.animating = false;
25543      if (params.cssMode) return;
25544      swiper.setTransition(0);
25545      transitionEmit({
25546        swiper,
25547        runCallbacks,
25548        direction,
25549        step: 'End'
25550      });
25551    }
25552
25553    var transition = {
25554      setTransition,
25555      transitionStart,
25556      transitionEnd
25557    };
25558
25559    function slideTo(index, speed, runCallbacks, internal, initial) {
25560      if (index === void 0) {
25561        index = 0;
25562      }
25563      if (speed === void 0) {
25564        speed = this.params.speed;
25565      }
25566      if (runCallbacks === void 0) {
25567        runCallbacks = true;
25568      }
25569      if (typeof index === 'string') {
25570        index = parseInt(index, 10);
25571      }
25572      const swiper = this;
25573      let slideIndex = index;
25574      if (slideIndex < 0) slideIndex = 0;
25575      const {
25576        params,
25577        snapGrid,
25578        slidesGrid,
25579        previousIndex,
25580        activeIndex,
25581        rtlTranslate: rtl,
25582        wrapperEl,
25583        enabled
25584      } = swiper;
25585      if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
25586        return false;
25587      }
25588      const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
25589      let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
25590      if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
25591      const translate = -snapGrid[snapIndex];
25592      // Normalize slideIndex
25593      if (params.normalizeSlideIndex) {
25594        for (let i = 0; i < slidesGrid.length; i += 1) {
25595          const normalizedTranslate = -Math.floor(translate * 100);
25596          const normalizedGrid = Math.floor(slidesGrid[i] * 100);
25597          const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);
25598          if (typeof slidesGrid[i + 1] !== 'undefined') {
25599            if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {
25600              slideIndex = i;
25601            } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {
25602              slideIndex = i + 1;
25603            }
25604          } else if (normalizedTranslate >= normalizedGrid) {
25605            slideIndex = i;
25606          }
25607        }
25608      }
25609      // Directions locks
25610      if (swiper.initialized && slideIndex !== activeIndex) {
25611        if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) {
25612          return false;
25613        }
25614        if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
25615          if ((activeIndex || 0) !== slideIndex) {
25616            return false;
25617          }
25618        }
25619      }
25620      if (slideIndex !== (previousIndex || 0) && runCallbacks) {
25621        swiper.emit('beforeSlideChangeStart');
25622      }
25623
25624      // Update progress
25625      swiper.updateProgress(translate);
25626      let direction;
25627      if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset';
25628
25629      // Update Index
25630      if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
25631        swiper.updateActiveIndex(slideIndex);
25632        // Update Height
25633        if (params.autoHeight) {
25634          swiper.updateAutoHeight();
25635        }
25636        swiper.updateSlidesClasses();
25637        if (params.effect !== 'slide') {
25638          swiper.setTranslate(translate);
25639        }
25640        if (direction !== 'reset') {
25641          swiper.transitionStart(runCallbacks, direction);
25642          swiper.transitionEnd(runCallbacks, direction);
25643        }
25644        return false;
25645      }
25646      if (params.cssMode) {
25647        const isH = swiper.isHorizontal();
25648        const t = rtl ? translate : -translate;
25649        if (speed === 0) {
25650          const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
25651          if (isVirtual) {
25652            swiper.wrapperEl.style.scrollSnapType = 'none';
25653            swiper._immediateVirtual = true;
25654          }
25655          if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) {
25656            swiper._cssModeVirtualInitialSet = true;
25657            requestAnimationFrame(() => {
25658              wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
25659            });
25660          } else {
25661            wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
25662          }
25663          if (isVirtual) {
25664            requestAnimationFrame(() => {
25665              swiper.wrapperEl.style.scrollSnapType = '';
25666              swiper._immediateVirtual = false;
25667            });
25668          }
25669        } else {
25670          if (!swiper.support.smoothScroll) {
25671            animateCSSModeScroll({
25672              swiper,
25673              targetPosition: t,
25674              side: isH ? 'left' : 'top'
25675            });
25676            return true;
25677          }
25678          wrapperEl.scrollTo({
25679            [isH ? 'left' : 'top']: t,
25680            behavior: 'smooth'
25681          });
25682        }
25683        return true;
25684      }
25685      swiper.setTransition(speed);
25686      swiper.setTranslate(translate);
25687      swiper.updateActiveIndex(slideIndex);
25688      swiper.updateSlidesClasses();
25689      swiper.emit('beforeTransitionStart', speed, internal);
25690      swiper.transitionStart(runCallbacks, direction);
25691      if (speed === 0) {
25692        swiper.transitionEnd(runCallbacks, direction);
25693      } else if (!swiper.animating) {
25694        swiper.animating = true;
25695        if (!swiper.onSlideToWrapperTransitionEnd) {
25696          swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {
25697            if (!swiper || swiper.destroyed) return;
25698            if (e.target !== this) return;
25699            swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
25700            swiper.onSlideToWrapperTransitionEnd = null;
25701            delete swiper.onSlideToWrapperTransitionEnd;
25702            swiper.transitionEnd(runCallbacks, direction);
25703          };
25704        }
25705        swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);
25706      }
25707      return true;
25708    }
25709
25710    function slideToLoop(index, speed, runCallbacks, internal) {
25711      if (index === void 0) {
25712        index = 0;
25713      }
25714      if (speed === void 0) {
25715        speed = this.params.speed;
25716      }
25717      if (runCallbacks === void 0) {
25718        runCallbacks = true;
25719      }
25720      if (typeof index === 'string') {
25721        const indexAsNumber = parseInt(index, 10);
25722        index = indexAsNumber;
25723      }
25724      const swiper = this;
25725      let newIndex = index;
25726      if (swiper.params.loop) {
25727        if (swiper.virtual && swiper.params.virtual.enabled) {
25728          // eslint-disable-next-line
25729          newIndex = newIndex + swiper.virtual.slidesBefore;
25730        } else {
25731          newIndex = swiper.getSlideIndexByData(newIndex);
25732        }
25733      }
25734      return swiper.slideTo(newIndex, speed, runCallbacks, internal);
25735    }
25736
25737    /* eslint no-unused-vars: "off" */
25738    function slideNext(speed, runCallbacks, internal) {
25739      if (speed === void 0) {
25740        speed = this.params.speed;
25741      }
25742      if (runCallbacks === void 0) {
25743        runCallbacks = true;
25744      }
25745      const swiper = this;
25746      const {
25747        enabled,
25748        params,
25749        animating
25750      } = swiper;
25751      if (!enabled) return swiper;
25752      let perGroup = params.slidesPerGroup;
25753      if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
25754        perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
25755      }
25756      const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
25757      const isVirtual = swiper.virtual && params.virtual.enabled;
25758      if (params.loop) {
25759        if (animating && !isVirtual && params.loopPreventsSliding) return false;
25760        swiper.loopFix({
25761          direction: 'next'
25762        });
25763        // eslint-disable-next-line
25764        swiper._clientLeft = swiper.wrapperEl.clientLeft;
25765      }
25766      if (params.rewind && swiper.isEnd) {
25767        return swiper.slideTo(0, speed, runCallbacks, internal);
25768      }
25769      return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);
25770    }
25771
25772    /* eslint no-unused-vars: "off" */
25773    function slidePrev(speed, runCallbacks, internal) {
25774      if (speed === void 0) {
25775        speed = this.params.speed;
25776      }
25777      if (runCallbacks === void 0) {
25778        runCallbacks = true;
25779      }
25780      const swiper = this;
25781      const {
25782        params,
25783        snapGrid,
25784        slidesGrid,
25785        rtlTranslate,
25786        enabled,
25787        animating
25788      } = swiper;
25789      if (!enabled) return swiper;
25790      const isVirtual = swiper.virtual && params.virtual.enabled;
25791      if (params.loop) {
25792        if (animating && !isVirtual && params.loopPreventsSliding) return false;
25793        swiper.loopFix({
25794          direction: 'prev'
25795        });
25796        // eslint-disable-next-line
25797        swiper._clientLeft = swiper.wrapperEl.clientLeft;
25798      }
25799      const translate = rtlTranslate ? swiper.translate : -swiper.translate;
25800      function normalize(val) {
25801        if (val < 0) return -Math.floor(Math.abs(val));
25802        return Math.floor(val);
25803      }
25804      const normalizedTranslate = normalize(translate);
25805      const normalizedSnapGrid = snapGrid.map(val => normalize(val));
25806      let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
25807      if (typeof prevSnap === 'undefined' && params.cssMode) {
25808        let prevSnapIndex;
25809        snapGrid.forEach((snap, snapIndex) => {
25810          if (normalizedTranslate >= snap) {
25811            // prevSnap = snap;
25812            prevSnapIndex = snapIndex;
25813          }
25814        });
25815        if (typeof prevSnapIndex !== 'undefined') {
25816          prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
25817        }
25818      }
25819      let prevIndex = 0;
25820      if (typeof prevSnap !== 'undefined') {
25821        prevIndex = slidesGrid.indexOf(prevSnap);
25822        if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;
25823        if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
25824          prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;
25825          prevIndex = Math.max(prevIndex, 0);
25826        }
25827      }
25828      if (params.rewind && swiper.isBeginning) {
25829        const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
25830        return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
25831      }
25832      return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
25833    }
25834
25835    /* eslint no-unused-vars: "off" */
25836    function slideReset(speed, runCallbacks, internal) {
25837      if (speed === void 0) {
25838        speed = this.params.speed;
25839      }
25840      if (runCallbacks === void 0) {
25841        runCallbacks = true;
25842      }
25843      const swiper = this;
25844      return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
25845    }
25846
25847    /* eslint no-unused-vars: "off" */
25848    function slideToClosest(speed, runCallbacks, internal, threshold) {
25849      if (speed === void 0) {
25850        speed = this.params.speed;
25851      }
25852      if (runCallbacks === void 0) {
25853        runCallbacks = true;
25854      }
25855      if (threshold === void 0) {
25856        threshold = 0.5;
25857      }
25858      const swiper = this;
25859      let index = swiper.activeIndex;
25860      const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
25861      const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
25862      const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;
25863      if (translate >= swiper.snapGrid[snapIndex]) {
25864        // The current translate is on or after the current snap index, so the choice
25865        // is between the current index and the one after it.
25866        const currentSnap = swiper.snapGrid[snapIndex];
25867        const nextSnap = swiper.snapGrid[snapIndex + 1];
25868        if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {
25869          index += swiper.params.slidesPerGroup;
25870        }
25871      } else {
25872        // The current translate is before the current snap index, so the choice
25873        // is between the current index and the one before it.
25874        const prevSnap = swiper.snapGrid[snapIndex - 1];
25875        const currentSnap = swiper.snapGrid[snapIndex];
25876        if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {
25877          index -= swiper.params.slidesPerGroup;
25878        }
25879      }
25880      index = Math.max(index, 0);
25881      index = Math.min(index, swiper.slidesGrid.length - 1);
25882      return swiper.slideTo(index, speed, runCallbacks, internal);
25883    }
25884
25885    function slideToClickedSlide() {
25886      const swiper = this;
25887      const {
25888        params,
25889        slidesEl
25890      } = swiper;
25891      const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
25892      let slideToIndex = swiper.clickedIndex;
25893      let realIndex;
25894      const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;
25895      if (params.loop) {
25896        if (swiper.animating) return;
25897        realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
25898        if (params.centeredSlides) {
25899          if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {
25900            swiper.loopFix();
25901            slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
25902            nextTick(() => {
25903              swiper.slideTo(slideToIndex);
25904            });
25905          } else {
25906            swiper.slideTo(slideToIndex);
25907          }
25908        } else if (slideToIndex > swiper.slides.length - slidesPerView) {
25909          swiper.loopFix();
25910          slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0]);
25911          nextTick(() => {
25912            swiper.slideTo(slideToIndex);
25913          });
25914        } else {
25915          swiper.slideTo(slideToIndex);
25916        }
25917      } else {
25918        swiper.slideTo(slideToIndex);
25919      }
25920    }
25921
25922    var slide = {
25923      slideTo,
25924      slideToLoop,
25925      slideNext,
25926      slidePrev,
25927      slideReset,
25928      slideToClosest,
25929      slideToClickedSlide
25930    };
25931
25932    function loopCreate(slideRealIndex) {
25933      const swiper = this;
25934      const {
25935        params,
25936        slidesEl
25937      } = swiper;
25938      if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
25939      const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
25940      slides.forEach((el, index) => {
25941        el.setAttribute('data-swiper-slide-index', index);
25942      });
25943      swiper.loopFix({
25944        slideRealIndex,
25945        direction: params.centeredSlides ? undefined : 'next'
25946      });
25947    }
25948
25949    function loopFix(_temp) {
25950      let {
25951        slideRealIndex,
25952        slideTo = true,
25953        direction,
25954        setTranslate,
25955        activeSlideIndex,
25956        byController,
25957        byMousewheel
25958      } = _temp === void 0 ? {} : _temp;
25959      const swiper = this;
25960      if (!swiper.params.loop) return;
25961      swiper.emit('beforeLoopFix');
25962      const {
25963        slides,
25964        allowSlidePrev,
25965        allowSlideNext,
25966        slidesEl,
25967        params
25968      } = swiper;
25969      swiper.allowSlidePrev = true;
25970      swiper.allowSlideNext = true;
25971      if (swiper.virtual && params.virtual.enabled) {
25972        if (slideTo) {
25973          if (!params.centeredSlides && swiper.snapIndex === 0) {
25974            swiper.slideTo(swiper.virtual.slides.length, 0, false, true);
25975          } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {
25976            swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);
25977          } else if (swiper.snapIndex === swiper.snapGrid.length - 1) {
25978            swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);
25979          }
25980        }
25981        swiper.allowSlidePrev = allowSlidePrev;
25982        swiper.allowSlideNext = allowSlideNext;
25983        swiper.emit('loopFix');
25984        return;
25985      }
25986      const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
25987      let loopedSlides = params.loopedSlides || slidesPerView;
25988      if (loopedSlides % params.slidesPerGroup !== 0) {
25989        loopedSlides += params.slidesPerGroup - loopedSlides % params.slidesPerGroup;
25990      }
25991      swiper.loopedSlides = loopedSlides;
25992      const prependSlidesIndexes = [];
25993      const appendSlidesIndexes = [];
25994      let activeIndex = swiper.activeIndex;
25995      if (typeof activeSlideIndex === 'undefined') {
25996        activeSlideIndex = swiper.getSlideIndex(swiper.slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);
25997      } else {
25998        activeIndex = activeSlideIndex;
25999      }
26000      const isNext = direction === 'next' || !direction;
26001      const isPrev = direction === 'prev' || !direction;
26002      let slidesPrepended = 0;
26003      let slidesAppended = 0;
26004      // prepend last slides before start
26005      if (activeSlideIndex < loopedSlides) {
26006        slidesPrepended = Math.max(loopedSlides - activeSlideIndex, params.slidesPerGroup);
26007        for (let i = 0; i < loopedSlides - activeSlideIndex; i += 1) {
26008          const index = i - Math.floor(i / slides.length) * slides.length;
26009          prependSlidesIndexes.push(slides.length - index - 1);
26010        }
26011      } else if (activeSlideIndex /* + slidesPerView */ > swiper.slides.length - loopedSlides * 2) {
26012        slidesAppended = Math.max(activeSlideIndex - (swiper.slides.length - loopedSlides * 2), params.slidesPerGroup);
26013        for (let i = 0; i < slidesAppended; i += 1) {
26014          const index = i - Math.floor(i / slides.length) * slides.length;
26015          appendSlidesIndexes.push(index);
26016        }
26017      }
26018      if (isPrev) {
26019        prependSlidesIndexes.forEach(index => {
26020          swiper.slides[index].swiperLoopMoveDOM = true;
26021          slidesEl.prepend(swiper.slides[index]);
26022          swiper.slides[index].swiperLoopMoveDOM = false;
26023        });
26024      }
26025      if (isNext) {
26026        appendSlidesIndexes.forEach(index => {
26027          swiper.slides[index].swiperLoopMoveDOM = true;
26028          slidesEl.append(swiper.slides[index]);
26029          swiper.slides[index].swiperLoopMoveDOM = false;
26030        });
26031      }
26032      swiper.recalcSlides();
26033      if (params.slidesPerView === 'auto') {
26034        swiper.updateSlides();
26035      }
26036      if (params.watchSlidesProgress) {
26037        swiper.updateSlidesOffset();
26038      }
26039      if (slideTo) {
26040        if (prependSlidesIndexes.length > 0 && isPrev) {
26041          if (typeof slideRealIndex === 'undefined') {
26042            const currentSlideTranslate = swiper.slidesGrid[activeIndex];
26043            const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended];
26044            const diff = newSlideTranslate - currentSlideTranslate;
26045            if (byMousewheel) {
26046              swiper.setTranslate(swiper.translate - diff);
26047            } else {
26048              swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);
26049              if (setTranslate) {
26050                swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
26051              }
26052            }
26053          } else {
26054            if (setTranslate) {
26055              swiper.slideToLoop(slideRealIndex, 0, false, true);
26056            }
26057          }
26058        } else if (appendSlidesIndexes.length > 0 && isNext) {
26059          if (typeof slideRealIndex === 'undefined') {
26060            const currentSlideTranslate = swiper.slidesGrid[activeIndex];
26061            const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended];
26062            const diff = newSlideTranslate - currentSlideTranslate;
26063            if (byMousewheel) {
26064              swiper.setTranslate(swiper.translate - diff);
26065            } else {
26066              swiper.slideTo(activeIndex - slidesAppended, 0, false, true);
26067              if (setTranslate) {
26068                swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;
26069              }
26070            }
26071          } else {
26072            swiper.slideToLoop(slideRealIndex, 0, false, true);
26073          }
26074        }
26075      }
26076      swiper.allowSlidePrev = allowSlidePrev;
26077      swiper.allowSlideNext = allowSlideNext;
26078      if (swiper.controller && swiper.controller.control && !byController) {
26079        const loopParams = {
26080          slideRealIndex,
26081          slideTo: false,
26082          direction,
26083          setTranslate,
26084          activeSlideIndex,
26085          byController: true
26086        };
26087        if (Array.isArray(swiper.controller.control)) {
26088          swiper.controller.control.forEach(c => {
26089            if (!c.destroyed && c.params.loop) c.loopFix(loopParams);
26090          });
26091        } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) {
26092          swiper.controller.control.loopFix(loopParams);
26093        }
26094      }
26095      swiper.emit('loopFix');
26096    }
26097
26098    function loopDestroy() {
26099      const swiper = this;
26100      const {
26101        params,
26102        slidesEl
26103      } = swiper;
26104      if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;
26105      swiper.recalcSlides();
26106      const newSlidesOrder = [];
vendor: 10,080 bytes, lines 26107-26373
26107      swiper.slides.forEach(slideEl => {
26108        const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex;
26109        newSlidesOrder[index] = slideEl;
26110      });
26111      swiper.slides.forEach(slideEl => {
26112        slideEl.removeAttribute('data-swiper-slide-index');
26113      });
26114      newSlidesOrder.forEach(slideEl => {
26115        slidesEl.append(slideEl);
26116      });
26117      swiper.recalcSlides();
26118      swiper.slideTo(swiper.realIndex, 0);
26119    }
26120
26121    var loop = {
26122      loopCreate,
26123      loopFix,
26124      loopDestroy
26125    };
26126
26127    function setGrabCursor(moving) {
26128      const swiper = this;
26129      if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;
26130      const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;
26131      if (swiper.isElement) {
26132        swiper.__preventObserver__ = true;
26133      }
26134      el.style.cursor = 'move';
26135      el.style.cursor = moving ? 'grabbing' : 'grab';
26136      if (swiper.isElement) {
26137        requestAnimationFrame(() => {
26138          swiper.__preventObserver__ = false;
26139        });
26140      }
26141    }
26142
26143    function unsetGrabCursor() {
26144      const swiper = this;
26145      if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {
26146        return;
26147      }
26148      if (swiper.isElement) {
26149        swiper.__preventObserver__ = true;
26150      }
26151      swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';
26152      if (swiper.isElement) {
26153        requestAnimationFrame(() => {
26154          swiper.__preventObserver__ = false;
26155        });
26156      }
26157    }
26158
26159    var grabCursor = {
26160      setGrabCursor,
26161      unsetGrabCursor
26162    };
26163
26164    // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd
26165    function closestElement(selector, base) {
26166      if (base === void 0) {
26167        base = this;
26168      }
26169      function __closestFrom(el) {
26170        if (!el || el === getDocument() || el === getWindow()) return null;
26171        if (el.assignedSlot) el = el.assignedSlot;
26172        const found = el.closest(selector);
26173        if (!found && !el.getRootNode) {
26174          return null;
26175        }
26176        return found || __closestFrom(el.getRootNode().host);
26177      }
26178      return __closestFrom(base);
26179    }
26180    function onTouchStart(event) {
26181      const swiper = this;
26182      const document = getDocument();
26183      const window = getWindow();
26184      const data = swiper.touchEventsData;
26185      data.evCache.push(event);
26186      const {
26187        params,
26188        touches,
26189        enabled
26190      } = swiper;
26191      if (!enabled) return;
26192      if (!params.simulateTouch && event.pointerType === 'mouse') return;
26193      if (swiper.animating && params.preventInteractionOnTransition) {
26194        return;
26195      }
26196      if (!swiper.animating && params.cssMode && params.loop) {
26197        swiper.loopFix();
26198      }
26199      let e = event;
26200      if (e.originalEvent) e = e.originalEvent;
26201      let targetEl = e.target;
26202      if (params.touchEventsTarget === 'wrapper') {
26203        if (!swiper.wrapperEl.contains(targetEl)) return;
26204      }
26205      if ('which' in e && e.which === 3) return;
26206      if ('button' in e && e.button > 0) return;
26207      if (data.isTouched && data.isMoved) return;
26208
26209      // change target el for shadow root component
26210      const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
26211      // eslint-disable-next-line
26212      const eventPath = event.composedPath ? event.composedPath() : event.path;
26213      if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {
26214        targetEl = eventPath[0];
26215      }
26216      const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
26217      const isTargetShadow = !!(e.target && e.target.shadowRoot);
26218
26219      // use closestElement for shadow root element to get the actual closest for nested shadow root element
26220      if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) {
26221        swiper.allowClick = true;
26222        return;
26223      }
26224      if (params.swipeHandler) {
26225        if (!targetEl.closest(params.swipeHandler)) return;
26226      }
26227      touches.currentX = e.pageX;
26228      touches.currentY = e.pageY;
26229      const startX = touches.currentX;
26230      const startY = touches.currentY;
26231
26232      // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
26233
26234      const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
26235      const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
26236      if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {
26237        if (edgeSwipeDetection === 'prevent') {
26238          event.preventDefault();
26239        } else {
26240          return;
26241        }
26242      }
26243      Object.assign(data, {
26244        isTouched: true,
26245        isMoved: false,
26246        allowTouchCallbacks: true,
26247        isScrolling: undefined,
26248        startMoving: undefined
26249      });
26250      touches.startX = startX;
26251      touches.startY = startY;
26252      data.touchStartTime = now();
26253      swiper.allowClick = true;
26254      swiper.updateSize();
26255      swiper.swipeDirection = undefined;
26256      if (params.threshold > 0) data.allowThresholdMove = false;
26257      let preventDefault = true;
26258      if (targetEl.matches(data.focusableElements)) {
26259        preventDefault = false;
26260        if (targetEl.nodeName === 'SELECT') {
26261          data.isTouched = false;
26262        }
26263      }
26264      if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl) {
26265        document.activeElement.blur();
26266      }
26267      const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;
26268      if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) {
26269        e.preventDefault();
26270      }
26271      if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {
26272        swiper.freeMode.onTouchStart();
26273      }
26274      swiper.emit('touchStart', e);
26275    }
26276
26277    function onTouchMove(event) {
26278      const document = getDocument();
26279      const swiper = this;
26280      const data = swiper.touchEventsData;
26281      const {
26282        params,
26283        touches,
26284        rtlTranslate: rtl,
26285        enabled
26286      } = swiper;
26287      if (!enabled) return;
26288      if (!params.simulateTouch && event.pointerType === 'mouse') return;
26289      let e = event;
26290      if (e.originalEvent) e = e.originalEvent;
26291      if (!data.isTouched) {
26292        if (data.startMoving && data.isScrolling) {
26293          swiper.emit('touchMoveOpposite', e);
26294        }
26295        return;
26296      }
26297      const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
26298      if (pointerIndex >= 0) data.evCache[pointerIndex] = e;
26299      const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;
26300      const pageX = targetTouch.pageX;
26301      const pageY = targetTouch.pageY;
26302      if (e.preventedByNestedSwiper) {
26303        touches.startX = pageX;
26304        touches.startY = pageY;
26305        return;
26306      }
26307      if (!swiper.allowTouchMove) {
26308        if (!e.target.matches(data.focusableElements)) {
26309          swiper.allowClick = false;
26310        }
26311        if (data.isTouched) {
26312          Object.assign(touches, {
26313            startX: pageX,
26314            startY: pageY,
26315            prevX: swiper.touches.currentX,
26316            prevY: swiper.touches.currentY,
26317            currentX: pageX,
26318            currentY: pageY
26319          });
26320          data.touchStartTime = now();
26321        }
26322        return;
26323      }
26324      if (params.touchReleaseOnEdges && !params.loop) {
26325        if (swiper.isVertical()) {
26326          // Vertical
26327          if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
26328            data.isTouched = false;
26329            data.isMoved = false;
26330            return;
26331          }
26332        } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {
26333          return;
26334        }
26335      }
26336      if (document.activeElement) {
26337        if (e.target === document.activeElement && e.target.matches(data.focusableElements)) {
26338          data.isMoved = true;
26339          swiper.allowClick = false;
26340          return;
26341        }
26342      }
26343      if (data.allowTouchCallbacks) {
26344        swiper.emit('touchMove', e);
26345      }
26346      if (e.targetTouches && e.targetTouches.length > 1) return;
26347      touches.currentX = pageX;
26348      touches.currentY = pageY;
26349      const diffX = touches.currentX - touches.startX;
26350      const diffY = touches.currentY - touches.startY;
26351      if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;
26352      if (typeof data.isScrolling === 'undefined') {
26353        let touchAngle;
26354        if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {
26355          data.isScrolling = false;
26356        } else {
26357          // eslint-disable-next-line
26358          if (diffX * diffX + diffY * diffY >= 25) {
26359            touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;
26360            data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;
26361          }
26362        }
26363      }
26364      if (data.isScrolling) {
26365        swiper.emit('touchMoveOpposite', e);
26366      }
26367      if (typeof data.startMoving === 'undefined') {
26368        if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {
26369          data.startMoving = true;
26370        }
26371      }
26372      if (data.isScrolling || swiper.zoom && swiper.params.zoom && swiper.params.zoom.enabled && data.evCache.length > 1) {
26373        data.isTouched = false;
26374        return;
26375      }
26376      if (!data.startMoving) {
26377        return;
26378      }
26379      swiper.allowClick = false;
26380      if (!params.cssMode && e.cancelable) {
26381        e.preventDefault();
26382      }
26383      if (params.touchMoveStopPropagation && !params.nested) {
26384        e.stopPropagation();
26385      }
26386      let diff = swiper.isHorizontal() ? diffX : diffY;
26387      let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY;
26388      if (params.oneWayMovement) {
26389        diff = Math.abs(diff) * (rtl ? 1 : -1);
26390        touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1);
26391      }
26392      touches.diff = diff;
26393      diff *= params.touchRatio;
26394      if (rtl) {
26395        diff = -diff;
26396        touchesDiff = -touchesDiff;
26397      }
26398      const prevTouchesDirection = swiper.touchesDirection;
26399      swiper.swipeDirection = diff > 0 ? 'prev' : 'next';
26400      swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';
26401      const isLoop = swiper.params.loop && !params.cssMode;
26402      if (!data.isMoved) {
26403        if (isLoop) {
26404          swiper.loopFix({
26405            direction: swiper.swipeDirection
26406          });
26407        }
26408        data.startTranslate = swiper.getTranslate();
26409        swiper.setTransition(0);
26410        if (swiper.animating) {
26411          const evt = new window.CustomEvent('transitionend', {
26412            bubbles: true,
26413            cancelable: true
26414          });
26415          swiper.wrapperEl.dispatchEvent(evt);
26416        }
26417        data.allowMomentumBounce = false;
26418        // Grab Cursor
26419        if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
26420          swiper.setGrabCursor(true);
26421        }
26422        swiper.emit('sliderFirstMove', e);
26423      }
26424      let loopFixed;
26425      if (data.isMoved && prevTouchesDirection !== swiper.touchesDirection && isLoop && Math.abs(diff) >= 1) {
26426        // need another loop fix
26427        swiper.loopFix({
26428          direction: swiper.swipeDirection,
26429          setTranslate: true
26430        });
26431        loopFixed = true;
26432      }
26433      swiper.emit('sliderMove', e);
26434      data.isMoved = true;
26435      data.currentTranslate = diff + data.startTranslate;
26436      let disableParentSwiper = true;
26437      let resistanceRatio = params.resistanceRatio;
26438      if (params.touchReleaseOnEdges) {
26439        resistanceRatio = 0;
26440      }
26441      if (diff > 0) {
26442        if (isLoop && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.size / 2 : swiper.minTranslate())) {
26443          swiper.loopFix({
26444            direction: 'prev',
26445            setTranslate: true,
26446            activeSlideIndex: 0
26447          });
26448        }
26449        if (data.currentTranslate > swiper.minTranslate()) {
26450          disableParentSwiper = false;
vendor: 8,574 bytes, lines 26451-26674
26451          if (params.resistance) {
26452            data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;
26453          }
26454        }
26455      } else if (diff < 0) {
26456        if (isLoop && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.size / 2 : swiper.maxTranslate())) {
26457          swiper.loopFix({
26458            direction: 'next',
26459            setTranslate: true,
26460            activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10)))
26461          });
26462        }
26463        if (data.currentTranslate < swiper.maxTranslate()) {
26464          disableParentSwiper = false;
26465          if (params.resistance) {
26466            data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;
26467          }
26468        }
26469      }
26470      if (disableParentSwiper) {
26471        e.preventedByNestedSwiper = true;
26472      }
26473
26474      // Directions locks
26475      if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {
26476        data.currentTranslate = data.startTranslate;
26477      }
26478      if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {
26479        data.currentTranslate = data.startTranslate;
26480      }
26481      if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
26482        data.currentTranslate = data.startTranslate;
26483      }
26484
26485      // Threshold
26486      if (params.threshold > 0) {
26487        if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
26488          if (!data.allowThresholdMove) {
26489            data.allowThresholdMove = true;
26490            touches.startX = touches.currentX;
26491            touches.startY = touches.currentY;
26492            data.currentTranslate = data.startTranslate;
26493            touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;
26494            return;
26495          }
26496        } else {
26497          data.currentTranslate = data.startTranslate;
26498          return;
26499        }
26500      }
26501      if (!params.followFinger || params.cssMode) return;
26502
26503      // Update active index in free mode
26504      if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {
26505        swiper.updateActiveIndex();
26506        swiper.updateSlidesClasses();
26507      }
26508      if (params.freeMode && params.freeMode.enabled && swiper.freeMode) {
26509        swiper.freeMode.onTouchMove();
26510      }
26511      // Update progress
26512      swiper.updateProgress(data.currentTranslate);
26513      // Update translate
26514      swiper.setTranslate(data.currentTranslate);
26515    }
26516
26517    function onTouchEnd(event) {
26518      const swiper = this;
26519      const data = swiper.touchEventsData;
26520      const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === event.pointerId);
26521      if (pointerIndex >= 0) {
26522        data.evCache.splice(pointerIndex, 1);
26523      }
26524      if (['pointercancel', 'pointerout', 'pointerleave'].includes(event.type)) {
26525        const proceed = event.type === 'pointercancel' && (swiper.browser.isSafari || swiper.browser.isWebView);
26526        if (!proceed) {
26527          return;
26528        }
26529      }
26530      const {
26531        params,
26532        touches,
26533        rtlTranslate: rtl,
26534        slidesGrid,
26535        enabled
26536      } = swiper;
26537      if (!enabled) return;
26538      if (!params.simulateTouch && event.pointerType === 'mouse') return;
26539      let e = event;
26540      if (e.originalEvent) e = e.originalEvent;
26541      if (data.allowTouchCallbacks) {
26542        swiper.emit('touchEnd', e);
26543      }
26544      data.allowTouchCallbacks = false;
26545      if (!data.isTouched) {
26546        if (data.isMoved && params.grabCursor) {
26547          swiper.setGrabCursor(false);
26548        }
26549        data.isMoved = false;
26550        data.startMoving = false;
26551        return;
26552      }
26553      // Return Grab Cursor
26554      if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
26555        swiper.setGrabCursor(false);
26556      }
26557
26558      // Time diff
26559      const touchEndTime = now();
26560      const timeDiff = touchEndTime - data.touchStartTime;
26561
26562      // Tap, doubleTap, Click
26563      if (swiper.allowClick) {
26564        const pathTree = e.path || e.composedPath && e.composedPath();
26565        swiper.updateClickedSlide(pathTree && pathTree[0] || e.target);
26566        swiper.emit('tap click', e);
26567        if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {
26568          swiper.emit('doubleTap doubleClick', e);
26569        }
26570      }
26571      data.lastClickTime = now();
26572      nextTick(() => {
26573        if (!swiper.destroyed) swiper.allowClick = true;
26574      });
26575      if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {
26576        data.isTouched = false;
26577        data.isMoved = false;
26578        data.startMoving = false;
26579        return;
26580      }
26581      data.isTouched = false;
26582      data.isMoved = false;
26583      data.startMoving = false;
26584      let currentPos;
26585      if (params.followFinger) {
26586        currentPos = rtl ? swiper.translate : -swiper.translate;
26587      } else {
26588        currentPos = -data.currentTranslate;
26589      }
26590      if (params.cssMode) {
26591        return;
26592      }
26593      if (params.freeMode && params.freeMode.enabled) {
26594        swiper.freeMode.onTouchEnd({
26595          currentPos
26596        });
26597        return;
26598      }
26599
26600      // Find current slide
26601      let stopIndex = 0;
26602      let groupSize = swiper.slidesSizesGrid[0];
26603      for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {
26604        const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
26605        if (typeof slidesGrid[i + increment] !== 'undefined') {
26606          if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {
26607            stopIndex = i;
26608            groupSize = slidesGrid[i + increment] - slidesGrid[i];
26609          }
26610        } else if (currentPos >= slidesGrid[i]) {
26611          stopIndex = i;
26612          groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];
26613        }
26614      }
26615      let rewindFirstIndex = null;
26616      let rewindLastIndex = null;
26617      if (params.rewind) {
26618        if (swiper.isBeginning) {
26619          rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;
26620        } else if (swiper.isEnd) {
26621          rewindFirstIndex = 0;
26622        }
26623      }
26624      // Find current slide size
26625      const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
26626      const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
26627      if (timeDiff > params.longSwipesMs) {
26628        // Long touches
26629        if (!params.longSwipes) {
26630          swiper.slideTo(swiper.activeIndex);
26631          return;
26632        }
26633        if (swiper.swipeDirection === 'next') {
26634          if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);
26635        }
26636        if (swiper.swipeDirection === 'prev') {
26637          if (ratio > 1 - params.longSwipesRatio) {
26638            swiper.slideTo(stopIndex + increment);
26639          } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {
26640            swiper.slideTo(rewindLastIndex);
26641          } else {
26642            swiper.slideTo(stopIndex);
26643          }
26644        }
26645      } else {
26646        // Short swipes
26647        if (!params.shortSwipes) {
26648          swiper.slideTo(swiper.activeIndex);
26649          return;
26650        }
26651        const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);
26652        if (!isNavButtonTarget) {
26653          if (swiper.swipeDirection === 'next') {
26654            swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);
26655          }
26656          if (swiper.swipeDirection === 'prev') {
26657            swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);
26658          }
26659        } else if (e.target === swiper.navigation.nextEl) {
26660          swiper.slideTo(stopIndex + increment);
26661        } else {
26662          swiper.slideTo(stopIndex);
26663        }
26664      }
26665    }
26666
26667    function onResize() {
26668      const swiper = this;
26669      const {
26670        params,
26671        el
26672      } = swiper;
26673      if (el && el.offsetWidth === 0) return;
26674
vendor: 6,167 bytes, lines 26675-26870
26675      // Breakpoints
26676      if (params.breakpoints) {
26677        swiper.setBreakpoint();
26678      }
26679
26680      // Save locks
26681      const {
26682        allowSlideNext,
26683        allowSlidePrev,
26684        snapGrid
26685      } = swiper;
26686      const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
26687
26688      // Disable locks on resize
26689      swiper.allowSlideNext = true;
26690      swiper.allowSlidePrev = true;
26691      swiper.updateSize();
26692      swiper.updateSlides();
26693      swiper.updateSlidesClasses();
26694      const isVirtualLoop = isVirtual && params.loop;
26695      if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {
26696        swiper.slideTo(swiper.slides.length - 1, 0, false, true);
26697      } else {
26698        if (swiper.params.loop && !isVirtual) {
26699          swiper.slideToLoop(swiper.realIndex, 0, false, true);
26700        } else {
26701          swiper.slideTo(swiper.activeIndex, 0, false, true);
26702        }
26703      }
26704      if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
26705        clearTimeout(swiper.autoplay.resizeTimeout);
26706        swiper.autoplay.resizeTimeout = setTimeout(() => {
26707          if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
26708            swiper.autoplay.resume();
26709          }
26710        }, 500);
26711      }
26712      // Return locks after resize
26713      swiper.allowSlidePrev = allowSlidePrev;
26714      swiper.allowSlideNext = allowSlideNext;
26715      if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
26716        swiper.checkOverflow();
26717      }
26718    }
26719
26720    function onClick(e) {
26721      const swiper = this;
26722      if (!swiper.enabled) return;
26723      if (!swiper.allowClick) {
26724        if (swiper.params.preventClicks) e.preventDefault();
26725        if (swiper.params.preventClicksPropagation && swiper.animating) {
26726          e.stopPropagation();
26727          e.stopImmediatePropagation();
26728        }
26729      }
26730    }
26731
26732    function onScroll() {
26733      const swiper = this;
26734      const {
26735        wrapperEl,
26736        rtlTranslate,
26737        enabled
26738      } = swiper;
26739      if (!enabled) return;
26740      swiper.previousTranslate = swiper.translate;
26741      if (swiper.isHorizontal()) {
26742        swiper.translate = -wrapperEl.scrollLeft;
26743      } else {
26744        swiper.translate = -wrapperEl.scrollTop;
26745      }
26746      // eslint-disable-next-line
26747      if (swiper.translate === 0) swiper.translate = 0;
26748      swiper.updateActiveIndex();
26749      swiper.updateSlidesClasses();
26750      let newProgress;
26751      const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();
26752      if (translatesDiff === 0) {
26753        newProgress = 0;
26754      } else {
26755        newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;
26756      }
26757      if (newProgress !== swiper.progress) {
26758        swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);
26759      }
26760      swiper.emit('setTranslate', swiper.translate, false);
26761    }
26762
26763    function onLoad(e) {
26764      const swiper = this;
26765      processLazyPreloader(swiper, e.target);
26766      if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) {
26767        return;
26768      }
26769      swiper.update();
26770    }
26771
26772    let dummyEventAttached = false;
26773    function dummyEventListener() {}
26774    const events = (swiper, method) => {
26775      const document = getDocument();
26776      const {
26777        params,
26778        el,
26779        wrapperEl,
26780        device
26781      } = swiper;
26782      const capture = !!params.nested;
26783      const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
26784      const swiperMethod = method;
26785
26786      // Touch Events
26787      el[domMethod]('pointerdown', swiper.onTouchStart, {
26788        passive: false
26789      });
26790      document[domMethod]('pointermove', swiper.onTouchMove, {
26791        passive: false,
26792        capture
26793      });
26794      document[domMethod]('pointerup', swiper.onTouchEnd, {
26795        passive: true
26796      });
26797      document[domMethod]('pointercancel', swiper.onTouchEnd, {
26798        passive: true
26799      });
26800      document[domMethod]('pointerout', swiper.onTouchEnd, {
26801        passive: true
26802      });
26803      document[domMethod]('pointerleave', swiper.onTouchEnd, {
26804        passive: true
26805      });
26806
26807      // Prevent Links Clicks
26808      if (params.preventClicks || params.preventClicksPropagation) {
26809        el[domMethod]('click', swiper.onClick, true);
26810      }
26811      if (params.cssMode) {
26812        wrapperEl[domMethod]('scroll', swiper.onScroll);
26813      }
26814
26815      // Resize handler
26816      if (params.updateOnWindowResize) {
26817        swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);
26818      } else {
26819        swiper[swiperMethod]('observerUpdate', onResize, true);
26820      }
26821
26822      // Images loader
26823      el[domMethod]('load', swiper.onLoad, {
26824        capture: true
26825      });
26826    };
26827    function attachEvents() {
26828      const swiper = this;
26829      const document = getDocument();
26830      const {
26831        params
26832      } = swiper;
26833      swiper.onTouchStart = onTouchStart.bind(swiper);
26834      swiper.onTouchMove = onTouchMove.bind(swiper);
26835      swiper.onTouchEnd = onTouchEnd.bind(swiper);
26836      if (params.cssMode) {
26837        swiper.onScroll = onScroll.bind(swiper);
26838      }
26839      swiper.onClick = onClick.bind(swiper);
26840      swiper.onLoad = onLoad.bind(swiper);
26841      if (!dummyEventAttached) {
26842        document.addEventListener('touchstart', dummyEventListener);
26843        dummyEventAttached = true;
26844      }
26845      events(swiper, 'on');
26846    }
26847    function detachEvents() {
26848      const swiper = this;
26849      events(swiper, 'off');
26850    }
26851    var events$1 = {
26852      attachEvents,
26853      detachEvents
26854    };
26855
26856    const isGridEnabled = (swiper, params) => {
26857      return swiper.grid && params.grid && params.grid.rows > 1;
26858    };
26859    function setBreakpoint() {
26860      const swiper = this;
26861      const {
26862        realIndex,
26863        initialized,
26864        params,
26865        el
26866      } = swiper;
26867      const breakpoints = params.breakpoints;
26868      if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return;
26869
26870      // Get breakpoint for window width and update parameters
vendor: 4,114 bytes, lines 26871-26973
26871      const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);
26872      if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
26873      const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
26874      const breakpointParams = breakpointOnlyParams || swiper.originalParams;
26875      const wasMultiRow = isGridEnabled(swiper, params);
26876      const isMultiRow = isGridEnabled(swiper, breakpointParams);
26877      const wasEnabled = params.enabled;
26878      if (wasMultiRow && !isMultiRow) {
26879        el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
26880        swiper.emitContainerClasses();
26881      } else if (!wasMultiRow && isMultiRow) {
26882        el.classList.add(`${params.containerModifierClass}grid`);
26883        if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
26884          el.classList.add(`${params.containerModifierClass}grid-column`);
26885        }
26886        swiper.emitContainerClasses();
26887      }
26888
26889      // Toggle navigation, pagination, scrollbar
26890      ['navigation', 'pagination', 'scrollbar'].forEach(prop => {
26891        if (typeof breakpointParams[prop] === 'undefined') return;
26892        const wasModuleEnabled = params[prop] && params[prop].enabled;
26893        const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;
26894        if (wasModuleEnabled && !isModuleEnabled) {
26895          swiper[prop].disable();
26896        }
26897        if (!wasModuleEnabled && isModuleEnabled) {
26898          swiper[prop].enable();
26899        }
26900      });
26901      const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
26902      const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
26903      if (directionChanged && initialized) {
26904        swiper.changeDirection();
26905      }
26906      extend(swiper.params, breakpointParams);
26907      const isEnabled = swiper.params.enabled;
26908      Object.assign(swiper, {
26909        allowTouchMove: swiper.params.allowTouchMove,
26910        allowSlideNext: swiper.params.allowSlideNext,
26911        allowSlidePrev: swiper.params.allowSlidePrev
26912      });
26913      if (wasEnabled && !isEnabled) {
26914        swiper.disable();
26915      } else if (!wasEnabled && isEnabled) {
26916        swiper.enable();
26917      }
26918      swiper.currentBreakpoint = breakpoint;
26919      swiper.emit('_beforeBreakpoint', breakpointParams);
26920      if (needsReLoop && initialized) {
26921        swiper.loopDestroy();
26922        swiper.loopCreate(realIndex);
26923        swiper.updateSlides();
26924      }
26925      swiper.emit('breakpoint', breakpointParams);
26926    }
26927
26928    function getBreakpoint(breakpoints, base, containerEl) {
26929      if (base === void 0) {
26930        base = 'window';
26931      }
26932      if (!breakpoints || base === 'container' && !containerEl) return undefined;
26933      let breakpoint = false;
26934      const window = getWindow();
26935      const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;
26936      const points = Object.keys(breakpoints).map(point => {
26937        if (typeof point === 'string' && point.indexOf('@') === 0) {
26938          const minRatio = parseFloat(point.substr(1));
26939          const value = currentHeight * minRatio;
26940          return {
26941            value,
26942            point
26943          };
26944        }
26945        return {
26946          value: point,
26947          point
26948        };
26949      });
26950      points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));
26951      for (let i = 0; i < points.length; i += 1) {
26952        const {
26953          point,
26954          value
26955        } = points[i];
26956        if (base === 'window') {
26957          if (window.matchMedia(`(min-width: ${value}px)`).matches) {
26958            breakpoint = point;
26959          }
26960        } else if (value <= containerEl.clientWidth) {
26961          breakpoint = point;
26962        }
26963      }
26964      return breakpoint || 'max';
26965    }
26966
26967    var breakpoints = {
26968      setBreakpoint,
26969      getBreakpoint
26970    };
26971
26972    function prepareClasses(entries, prefix) {
26973      const resultClasses = [];
vendor: 3,672 bytes, lines 26974-27105
26974      entries.forEach(item => {
26975        if (typeof item === 'object') {
26976          Object.keys(item).forEach(classNames => {
26977            if (item[classNames]) {
26978              resultClasses.push(prefix + classNames);
26979            }
26980          });
26981        } else if (typeof item === 'string') {
26982          resultClasses.push(prefix + item);
26983        }
26984      });
26985      return resultClasses;
26986    }
26987    function addClasses() {
26988      const swiper = this;
26989      const {
26990        classNames,
26991        params,
26992        rtl,
26993        el,
26994        device
26995      } = swiper;
26996      // prettier-ignore
26997      const suffixes = prepareClasses(['initialized', params.direction, {
26998        'free-mode': swiper.params.freeMode && params.freeMode.enabled
26999      }, {
27000        'autoheight': params.autoHeight
27001      }, {
27002        'rtl': rtl
27003      }, {
27004        'grid': params.grid && params.grid.rows > 1
27005      }, {
27006        'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
27007      }, {
27008        'android': device.android
27009      }, {
27010        'ios': device.ios
27011      }, {
27012        'css-mode': params.cssMode
27013      }, {
27014        'centered': params.cssMode && params.centeredSlides
27015      }, {
27016        'watch-progress': params.watchSlidesProgress
27017      }], params.containerModifierClass);
27018      classNames.push(...suffixes);
27019      el.classList.add(...classNames);
27020      swiper.emitContainerClasses();
27021    }
27022
27023    function removeClasses() {
27024      const swiper = this;
27025      const {
27026        el,
27027        classNames
27028      } = swiper;
27029      el.classList.remove(...classNames);
27030      swiper.emitContainerClasses();
27031    }
27032
27033    var classes = {
27034      addClasses,
27035      removeClasses
27036    };
27037
27038    function checkOverflow() {
27039      const swiper = this;
27040      const {
27041        isLocked: wasLocked,
27042        params
27043      } = swiper;
27044      const {
27045        slidesOffsetBefore
27046      } = params;
27047      if (slidesOffsetBefore) {
27048        const lastSlideIndex = swiper.slides.length - 1;
27049        const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
27050        swiper.isLocked = swiper.size > lastSlideRightEdge;
27051      } else {
27052        swiper.isLocked = swiper.snapGrid.length === 1;
27053      }
27054      if (params.allowSlideNext === true) {
27055        swiper.allowSlideNext = !swiper.isLocked;
27056      }
27057      if (params.allowSlidePrev === true) {
27058        swiper.allowSlidePrev = !swiper.isLocked;
27059      }
27060      if (wasLocked && wasLocked !== swiper.isLocked) {
27061        swiper.isEnd = false;
27062      }
27063      if (wasLocked !== swiper.isLocked) {
27064        swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
27065      }
27066    }
27067    var checkOverflow$1 = {
27068      checkOverflow
27069    };
27070
27071    var defaults = {
27072      init: true,
27073      direction: 'horizontal',
27074      oneWayMovement: false,
27075      touchEventsTarget: 'wrapper',
27076      initialSlide: 0,
27077      speed: 300,
27078      cssMode: false,
27079      updateOnWindowResize: true,
27080      resizeObserver: true,
27081      nested: false,
27082      createElements: false,
27083      enabled: true,
27084      focusableElements: 'input, select, option, textarea, button, video, label',
27085      // Overrides
27086      width: null,
27087      height: null,
27088      //
27089      preventInteractionOnTransition: false,
27090      // ssr
27091      userAgent: null,
27092      url: null,
27093      // To support iOS's swipe-to-go-back gesture (when being used in-app).
27094      edgeSwipeDetection: false,
27095      edgeSwipeThreshold: 20,
27096      // Autoheight
27097      autoHeight: false,
27098      // Set wrapper width
27099      setWrapperSize: false,
27100      // Virtual Translate
27101      virtualTranslate: false,
27102      // Effects
27103      effect: 'slide',
27104      // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
27105
27106      // Breakpoints
27107      breakpoints: undefined,
27108      breakpointsBase: 'window',
27109      // Slides grid
27110      spaceBetween: 0,
27111      slidesPerView: 1,
27112      slidesPerGroup: 1,
27113      slidesPerGroupSkip: 0,
27114      slidesPerGroupAuto: false,
27115      centeredSlides: false,
27116      centeredSlidesBounds: false,
27117      slidesOffsetBefore: 0,
27118      // in px
27119      slidesOffsetAfter: 0,
27120      // in px
27121      normalizeSlideIndex: true,
27122      centerInsufficientSlides: false,
27123      // Disable swiper and hide navigation when container not overflow
27124      watchOverflow: true,
27125      // Round length
27126      roundLengths: false,
27127      // Touches
27128      touchRatio: 1,
27129      touchAngle: 45,
27130      simulateTouch: true,
27131      shortSwipes: true,
27132      longSwipes: true,
27133      longSwipesRatio: 0.5,
27134      longSwipesMs: 300,
27135      followFinger: true,
27136      allowTouchMove: true,
27137      threshold: 5,
27138      touchMoveStopPropagation: false,
27139      touchStartPreventDefault: true,
27140      touchStartForcePreventDefault: false,
27141      touchReleaseOnEdges: false,
27142      // Unique Navigation Elements
27143      uniqueNavElements: true,
27144      // Resistance
27145      resistance: true,
27146      resistanceRatio: 0.85,
27147      // Progress
27148      watchSlidesProgress: false,
27149      // Cursor
27150      grabCursor: false,
27151      // Clicks
27152      preventClicks: true,
27153      preventClicksPropagation: true,
27154      slideToClickedSlide: false,
27155      // loop
27156      loop: false,
27157      loopedSlides: null,
27158      loopPreventsSliding: true,
27159      // rewind
27160      rewind: false,
27161      // Swiping/no swiping
27162      allowSlidePrev: true,
27163      allowSlideNext: true,
27164      swipeHandler: null,
27165      // '.swipe-handler',
27166      noSwiping: true,
27167      noSwipingClass: 'swiper-no-swiping',
27168      noSwipingSelector: null,
27169      // Passive Listeners
27170      passiveListeners: true,
27171      maxBackfaceHiddenSlides: 10,
27172      // NS
27173      containerModifierClass: 'swiper-',
27174      // NEW
27175      slideClass: 'swiper-slide',
27176      slideActiveClass: 'swiper-slide-active',
27177      slideVisibleClass: 'swiper-slide-visible',
27178      slideNextClass: 'swiper-slide-next',
27179      slidePrevClass: 'swiper-slide-prev',
27180      wrapperClass: 'swiper-wrapper',
27181      lazyPreloaderClass: 'swiper-lazy-preloader',
27182      lazyPreloadPrevNext: 0,
27183      // Callbacks
27184      runCallbacksOnInit: true,
27185      // Internals
27186      _emitClasses: false
27187    };
27188
27189    function moduleExtendParams(params, allModulesParams) {
27190      return function extendParams(obj) {
27191        if (obj === void 0) {
27192          obj = {};
27193        }
27194        const moduleParamName = Object.keys(obj)[0];
27195        const moduleParams = obj[moduleParamName];
27196        if (typeof moduleParams !== 'object' || moduleParams === null) {
27197          extend(allModulesParams, obj);
27198          return;
27199        }
27200        if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) {
27201          params[moduleParamName] = {
27202            auto: true
27203          };
27204        }
27205        if (!(moduleParamName in params && 'enabled' in moduleParams)) {
27206          extend(allModulesParams, obj);
27207          return;
27208        }
27209        if (params[moduleParamName] === true) {
27210          params[moduleParamName] = {
27211            enabled: true
27212          };
27213        }
27214        if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {
27215          params[moduleParamName].enabled = true;
27216        }
27217        if (!params[moduleParamName]) params[moduleParamName] = {
27218          enabled: false
27219        };
27220        extend(allModulesParams, obj);
27221      };
27222    }
27223
27224    /* eslint no-param-reassign: "off" */
27225    const prototypes = {
27226      eventsEmitter,
27227      update,
27228      translate,
27229      transition,
27230      slide,
27231      loop,
27232      grabCursor,
27233      events: events$1,
27234      breakpoints,
27235      checkOverflow: checkOverflow$1,
27236      classes
27237    };
27238    const extendedDefaults = {};
27239    class Swiper {
27240      constructor() {
27241        let el;
27242        let params;
27243        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27244          args[_key] = arguments[_key];
27245        }
vendor: 9,712 bytes, lines 27246-27535
27246        if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {
27247          params = args[0];
27248        } else {
27249          [el, params] = args;
27250        }
27251        if (!params) params = {};
27252        params = extend({}, params);
27253        if (el && !params.el) params.el = el;
27254        const document = getDocument();
27255        if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) {
27256          const swipers = [];
27257          document.querySelectorAll(params.el).forEach(containerEl => {
27258            const newParams = extend({}, params, {
27259              el: containerEl
27260            });
27261            swipers.push(new Swiper(newParams));
27262          });
27263          // eslint-disable-next-line no-constructor-return
27264          return swipers;
27265        }
27266
27267        // Swiper Instance
27268        const swiper = this;
27269        swiper.__swiper__ = true;
27270        swiper.support = getSupport();
27271        swiper.device = getDevice({
27272          userAgent: params.userAgent
27273        });
27274        swiper.browser = getBrowser();
27275        swiper.eventsListeners = {};
27276        swiper.eventsAnyListeners = [];
27277        swiper.modules = [...swiper.__modules__];
27278        if (params.modules && Array.isArray(params.modules)) {
27279          swiper.modules.push(...params.modules);
27280        }
27281        const allModulesParams = {};
27282        swiper.modules.forEach(mod => {
27283          mod({
27284            params,
27285            swiper,
27286            extendParams: moduleExtendParams(params, allModulesParams),
27287            on: swiper.on.bind(swiper),
27288            once: swiper.once.bind(swiper),
27289            off: swiper.off.bind(swiper),
27290            emit: swiper.emit.bind(swiper)
27291          });
27292        });
27293
27294        // Extend defaults with modules params
27295        const swiperParams = extend({}, defaults, allModulesParams);
27296
27297        // Extend defaults with passed params
27298        swiper.params = extend({}, swiperParams, extendedDefaults, params);
27299        swiper.originalParams = extend({}, swiper.params);
27300        swiper.passedParams = extend({}, params);
27301
27302        // add event listeners
27303        if (swiper.params && swiper.params.on) {
27304          Object.keys(swiper.params.on).forEach(eventName => {
27305            swiper.on(eventName, swiper.params.on[eventName]);
27306          });
27307        }
27308        if (swiper.params && swiper.params.onAny) {
27309          swiper.onAny(swiper.params.onAny);
27310        }
27311
27312        // Extend Swiper
27313        Object.assign(swiper, {
27314          enabled: swiper.params.enabled,
27315          el,
27316          // Classes
27317          classNames: [],
27318          // Slides
27319          slides: [],
27320          slidesGrid: [],
27321          snapGrid: [],
27322          slidesSizesGrid: [],
27323          // isDirection
27324          isHorizontal() {
27325            return swiper.params.direction === 'horizontal';
27326          },
27327          isVertical() {
27328            return swiper.params.direction === 'vertical';
27329          },
27330          // Indexes
27331          activeIndex: 0,
27332          realIndex: 0,
27333          //
27334          isBeginning: true,
27335          isEnd: false,
27336          // Props
27337          translate: 0,
27338          previousTranslate: 0,
27339          progress: 0,
27340          velocity: 0,
27341          animating: false,
27342          cssOverflowAdjustment() {
27343            // Returns 0 unless `translate` is > 2**23
27344            // Should be subtracted from css values to prevent overflow
27345            return Math.trunc(this.translate / 2 ** 23) * 2 ** 23;
27346          },
27347          // Locks
27348          allowSlideNext: swiper.params.allowSlideNext,
27349          allowSlidePrev: swiper.params.allowSlidePrev,
27350          // Touch Events
27351          touchEventsData: {
27352            isTouched: undefined,
27353            isMoved: undefined,
27354            allowTouchCallbacks: undefined,
27355            touchStartTime: undefined,
27356            isScrolling: undefined,
27357            currentTranslate: undefined,
27358            startTranslate: undefined,
27359            allowThresholdMove: undefined,
27360            // Form elements to match
27361            focusableElements: swiper.params.focusableElements,
27362            // Last click time
27363            lastClickTime: 0,
27364            clickTimeout: undefined,
27365            // Velocities
27366            velocities: [],
27367            allowMomentumBounce: undefined,
27368            startMoving: undefined,
27369            evCache: []
27370          },
27371          // Clicks
27372          allowClick: true,
27373          // Touches
27374          allowTouchMove: swiper.params.allowTouchMove,
27375          touches: {
27376            startX: 0,
27377            startY: 0,
27378            currentX: 0,
27379            currentY: 0,
27380            diff: 0
27381          },
27382          // Images
27383          imagesToLoad: [],
27384          imagesLoaded: 0
27385        });
27386        swiper.emit('_swiper');
27387
27388        // Init
27389        if (swiper.params.init) {
27390          swiper.init();
27391        }
27392
27393        // Return app instance
27394        // eslint-disable-next-line no-constructor-return
27395        return swiper;
27396      }
27397      getSlideIndex(slideEl) {
27398        const {
27399          slidesEl,
27400          params
27401        } = this;
27402        const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
27403        const firstSlideIndex = elementIndex(slides[0]);
27404        return elementIndex(slideEl) - firstSlideIndex;
27405      }
27406      getSlideIndexByData(index) {
27407        return this.getSlideIndex(this.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index)[0]);
27408      }
27409      recalcSlides() {
27410        const swiper = this;
27411        const {
27412          slidesEl,
27413          params
27414        } = swiper;
27415        swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
27416      }
27417      enable() {
27418        const swiper = this;
27419        if (swiper.enabled) return;
27420        swiper.enabled = true;
27421        if (swiper.params.grabCursor) {
27422          swiper.setGrabCursor();
27423        }
27424        swiper.emit('enable');
27425      }
27426      disable() {
27427        const swiper = this;
27428        if (!swiper.enabled) return;
27429        swiper.enabled = false;
27430        if (swiper.params.grabCursor) {
27431          swiper.unsetGrabCursor();
27432        }
27433        swiper.emit('disable');
27434      }
27435      setProgress(progress, speed) {
27436        const swiper = this;
27437        progress = Math.min(Math.max(progress, 0), 1);
27438        const min = swiper.minTranslate();
27439        const max = swiper.maxTranslate();
27440        const current = (max - min) * progress + min;
27441        swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);
27442        swiper.updateActiveIndex();
27443        swiper.updateSlidesClasses();
27444      }
27445      emitContainerClasses() {
27446        const swiper = this;
27447        if (!swiper.params._emitClasses || !swiper.el) return;
27448        const cls = swiper.el.className.split(' ').filter(className => {
27449          return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;
27450        });
27451        swiper.emit('_containerClasses', cls.join(' '));
27452      }
27453      getSlideClasses(slideEl) {
27454        const swiper = this;
27455        if (swiper.destroyed) return '';
27456        return slideEl.className.split(' ').filter(className => {
27457          return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;
27458        }).join(' ');
27459      }
27460      emitSlidesClasses() {
27461        const swiper = this;
27462        if (!swiper.params._emitClasses || !swiper.el) return;
27463        const updates = [];
27464        swiper.slides.forEach(slideEl => {
27465          const classNames = swiper.getSlideClasses(slideEl);
27466          updates.push({
27467            slideEl,
27468            classNames
27469          });
27470          swiper.emit('_slideClass', slideEl, classNames);
27471        });
27472        swiper.emit('_slideClasses', updates);
27473      }
27474      slidesPerViewDynamic(view, exact) {
27475        if (view === void 0) {
27476          view = 'current';
27477        }
27478        if (exact === void 0) {
27479          exact = false;
27480        }
27481        const swiper = this;
27482        const {
27483          params,
27484          slides,
27485          slidesGrid,
27486          slidesSizesGrid,
27487          size: swiperSize,
27488          activeIndex
27489        } = swiper;
27490        let spv = 1;
27491        if (params.centeredSlides) {
27492          let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0;
27493          let breakLoop;
27494          for (let i = activeIndex + 1; i < slides.length; i += 1) {
27495            if (slides[i] && !breakLoop) {
27496              slideSize += slides[i].swiperSlideSize;
27497              spv += 1;
27498              if (slideSize > swiperSize) breakLoop = true;
27499            }
27500          }
27501          for (let i = activeIndex - 1; i >= 0; i -= 1) {
27502            if (slides[i] && !breakLoop) {
27503              slideSize += slides[i].swiperSlideSize;
27504              spv += 1;
27505              if (slideSize > swiperSize) breakLoop = true;
27506            }
27507          }
27508        } else {
27509          // eslint-disable-next-line
27510          if (view === 'current') {
27511            for (let i = activeIndex + 1; i < slides.length; i += 1) {
27512              const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
27513              if (slideInView) {
27514                spv += 1;
27515              }
27516            }
27517          } else {
27518            // previous
27519            for (let i = activeIndex - 1; i >= 0; i -= 1) {
27520              const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
27521              if (slideInView) {
27522                spv += 1;
27523              }
27524            }
27525          }
27526        }
27527        return spv;
27528      }
27529      update() {
27530        const swiper = this;
27531        if (!swiper || swiper.destroyed) return;
27532        const {
27533          snapGrid,
27534          params
27535        } = swiper;
vendor: 2,475 bytes, lines 27536-27594
27536        // Breakpoints
27537        if (params.breakpoints) {
27538          swiper.setBreakpoint();
27539        }
27540        [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => {
27541          if (imageEl.complete) {
27542            processLazyPreloader(swiper, imageEl);
27543          }
27544        });
27545        swiper.updateSize();
27546        swiper.updateSlides();
27547        swiper.updateProgress();
27548        swiper.updateSlidesClasses();
27549        function setTranslate() {
27550          const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;
27551          const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());
27552          swiper.setTranslate(newTranslate);
27553          swiper.updateActiveIndex();
27554          swiper.updateSlidesClasses();
27555        }
27556        let translated;
27557        if (params.freeMode && params.freeMode.enabled && !params.cssMode) {
27558          setTranslate();
27559          if (params.autoHeight) {
27560            swiper.updateAutoHeight();
27561          }
27562        } else {
27563          if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) {
27564            const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides;
27565            translated = swiper.slideTo(slides.length - 1, 0, false, true);
27566          } else {
27567            translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
27568          }
27569          if (!translated) {
27570            setTranslate();
27571          }
27572        }
27573        if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
27574          swiper.checkOverflow();
27575        }
27576        swiper.emit('update');
27577      }
27578      changeDirection(newDirection, needUpdate) {
27579        if (needUpdate === void 0) {
27580          needUpdate = true;
27581        }
27582        const swiper = this;
27583        const currentDirection = swiper.params.direction;
27584        if (!newDirection) {
27585          // eslint-disable-next-line
27586          newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
27587        }
27588        if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
27589          return swiper;
27590        }
27591        swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`);
27592        swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`);
27593        swiper.emitContainerClasses();
27594        swiper.params.direction = newDirection;
vendor: 2,096 bytes, lines 27595-27652
27595        swiper.slides.forEach(slideEl => {
27596          if (newDirection === 'vertical') {
27597            slideEl.style.width = '';
27598          } else {
27599            slideEl.style.height = '';
27600          }
27601        });
27602        swiper.emit('changeDirection');
27603        if (needUpdate) swiper.update();
27604        return swiper;
27605      }
27606      changeLanguageDirection(direction) {
27607        const swiper = this;
27608        if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return;
27609        swiper.rtl = direction === 'rtl';
27610        swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;
27611        if (swiper.rtl) {
27612          swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`);
27613          swiper.el.dir = 'rtl';
27614        } else {
27615          swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`);
27616          swiper.el.dir = 'ltr';
27617        }
27618        swiper.update();
27619      }
27620      mount(element) {
27621        const swiper = this;
27622        if (swiper.mounted) return true;
27623
27624        // Find el
27625        let el = element || swiper.params.el;
27626        if (typeof el === 'string') {
27627          el = document.querySelector(el);
27628        }
27629        if (!el) {
27630          return false;
27631        }
27632        el.swiper = swiper;
27633        if (el.shadowEl) {
27634          swiper.isElement = true;
27635        }
27636        const getWrapperSelector = () => {
27637          return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;
27638        };
27639        const getWrapper = () => {
27640          if (el && el.shadowRoot && el.shadowRoot.querySelector) {
27641            const res = el.shadowRoot.querySelector(getWrapperSelector());
27642            // Children needs to return slot items
27643            return res;
27644          }
27645          return elementChildren(el, getWrapperSelector())[0];
27646        };
27647        // Find Wrapper
27648        let wrapperEl = getWrapper();
27649        if (!wrapperEl && swiper.params.createElements) {
27650          wrapperEl = createElement('div', swiper.params.wrapperClass);
27651          el.append(wrapperEl);
27652          elementChildren(el, `.${swiper.params.slideClass}
27652`).forEach(slideEl => {
27653            wrapperEl.append(slideEl);
27654          });
27655        }
27656        Object.assign(swiper, {
27657          el,
27658          wrapperEl,
27659          slidesEl: swiper.isElement ? el : wrapperEl,
27660          mounted: true,
27661          // RTL
27662          rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl',
27663          rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'),
27664          wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box'
27665        });
27666        return true;
27667      }
27668      init(el) {
27669        const swiper = this;
27670        if (swiper.initialized) return swiper;
27671        const mounted = swiper.mount(el);
27672        if (mounted === false) return swiper;
27673        swiper.emit('beforeInit');
27674
27675        // Set breakpoint
27676        if (swiper.params.breakpoints) {
27677          swiper.setBreakpoint();
27678        }
27679
27680        // Add Classes
27681        swiper.addClasses();
27682
27683        // Update size
27684        swiper.updateSize();
27685
27686        // Update slides
27687        swiper.updateSlides();
27688        if (swiper.params.watchOverflow) {
27689          swiper.checkOverflow();
27690        }
27691
27692        // Set Grab Cursor
27693        if (swiper.params.grabCursor && swiper.enabled) {
27694          swiper.setGrabCursor();
27695        }
27696
27697        // Slide To Initial Slide
27698        if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {
27699          swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true);
27700        } else {
27701          swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
27702        }
27703
27704        // Create loop
27705        if (swiper.params.loop) {
27706          swiper.loopCreate();
27707        }
27708
27709        // Attach events
27710        swiper.attachEvents();
27711        [...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => {
27712          if (imageEl.complete) {
27713            processLazyPreloader(swiper, imageEl);
27714          } else {
27715            imageEl.addEventListener('load', e => {
27716              processLazyPreloader(swiper, e.target);
27717            });
27718          }
27719        });
27720        preload(swiper);
27721
27722        // Init Flag
27723        swiper.initialized = true;
27724        preload(swiper);
27725
27726        // Emit
27727        swiper.emit('init');
27728        swiper.emit('afterInit');
27729        return swiper;
27730      }
27731      destroy(deleteInstance, cleanStyles) {
27732        if (deleteInstance === void 0) {
27733          deleteInstance = true;
27734        }
27735        if (cleanStyles === void 0) {
27736          cleanStyles = true;
27737        }
27738        const swiper = this;
27739        const {
27740          params,
27741          el,
27742          wrapperEl,
27743          slides
27744        } = swiper;
27745        if (typeof swiper.params === 'undefined' || swiper.destroyed) {
27746          return null;
27747        }
27748        swiper.emit('beforeDestroy');
27749
27750        // Init Flag
27751        swiper.initialized = false;
27752
27753        // Detach events
27754        swiper.detachEvents();
27755
27756        // Destroy loop
27757        if (params.loop) {
27758          swiper.loopDestroy();
27759        }
27760
27761        // Cleanup styles
27762        if (cleanStyles) {
27763          swiper.removeClasses();
27764          el.removeAttribute('style');
27765          wrapperEl.removeAttribute('style');
27766          if (slides && slides.length) {
27767            slides.forEach(slideEl => {
27768              slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
27769              slideEl.removeAttribute('style');
27770              slideEl.removeAttribute('data-swiper-slide-index');
27771            });
27772          }
27773        }
27774        swiper.emit('destroy');
27775
27776        // Detach emitter events
27777        Object.keys(swiper.eventsListeners).forEach(eventName => {
27778          swiper.off(eventName);
27779        });
27780        if (deleteInstance !== false) {
27781          swiper.el.swiper = null;
27782          deleteProps(swiper);
27783        }
27784        swiper.destroyed = true;
27785        return null;
27786      }
27787      static extendDefaults(newDefaults) {
27788        extend(extendedDefaults, newDefaults);
27789      }
27790      static get extendedDefaults() {
27791        return extendedDefaults;
27792      }
27793      static get defaults() {
27794        return defaults;
27795      }
27796      static installModule(mod) {
27797        if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];
27798        const modules = Swiper.prototype.__modules__;
27799        if (typeof mod === 'function' && modules.indexOf(mod) < 0) {
27800          modules.push(mod);
27801        }
27802      }
27803      static use(module) {
27804        if (Array.isArray(module)) {
27805          module.forEach(m => Swiper.installModule(m));
27806          return Swiper;
27807        }
27808        Swiper.installModule(module);
27809        return Swiper;
27810      }
27811    }
27812    Object.keys(prototypes).forEach(prototypeGroup => {
27813      Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {
27814        Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];
27815      });
27816    });
27817    Swiper.use([Resize, Observer]);
27818
27819    function Virtual(_ref) {
27820      let {
27821        swiper,
27822        extendParams,
27823        on,
27824        emit
27825      } = _ref;
27826      extendParams({
27827        virtual: {
27828          enabled: false,
27829          slides: [],
27830          cache: true,
27831          renderSlide: null,
27832          renderExternal: null,
27833          renderExternalUpdate: true,
27834          addSlidesBefore: 0,
27835          addSlidesAfter: 0
27836        }
27837      });
27838      let cssModeTimeout;
27839      const document = getDocument();
27840      swiper.virtual = {
27841        cache: {},
27842        from: undefined,
27843        to: undefined,
27844        slides: [],
27845        offset: 0,
27846        slidesGrid: []
27847      };
27848      const tempDOM = document.createElement('div');
vendor: 4,651 bytes, lines 27849-27978
27849      function renderSlide(slide, index) {
27850        const params = swiper.params.virtual;
27851        if (params.cache && swiper.virtual.cache[index]) {
27852          return swiper.virtual.cache[index];
27853        }
27854        // eslint-disable-next-line
27855        let slideEl;
27856        if (params.renderSlide) {
27857          slideEl = params.renderSlide.call(swiper, slide, index);
27858          if (typeof slideEl === 'string') {
27859            tempDOM.innerHTML = slideEl;
27860            slideEl = tempDOM.children[0];
27861          }
27862        } else if (swiper.isElement) {
27863          slideEl = createElement('swiper-slide');
27864        } else {
27865          slideEl = createElement('div', swiper.params.slideClass);
27866        }
27867        slideEl.setAttribute('data-swiper-slide-index', index);
27868        if (!params.renderSlide) {
27869          slideEl.innerHTML = slide;
27870        }
27871        if (params.cache) swiper.virtual.cache[index] = slideEl;
27872        return slideEl;
27873      }
27874      function update(force) {
27875        const {
27876          slidesPerView,
27877          slidesPerGroup,
27878          centeredSlides,
27879          loop: isLoop
27880        } = swiper.params;
27881        const {
27882          addSlidesBefore,
27883          addSlidesAfter
27884        } = swiper.params.virtual;
27885        const {
27886          from: previousFrom,
27887          to: previousTo,
27888          slides,
27889          slidesGrid: previousSlidesGrid,
27890          offset: previousOffset
27891        } = swiper.virtual;
27892        if (!swiper.params.cssMode) {
27893          swiper.updateActiveIndex();
27894        }
27895        const activeIndex = swiper.activeIndex || 0;
27896        let offsetProp;
27897        if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top';
27898        let slidesAfter;
27899        let slidesBefore;
27900        if (centeredSlides) {
27901          slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter;
27902          slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore;
27903        } else {
27904          slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter;
27905          slidesBefore = (isLoop ? slidesPerView : slidesPerGroup) + addSlidesBefore;
27906        }
27907        let from = activeIndex - slidesBefore;
27908        let to = activeIndex + slidesAfter;
27909        if (!isLoop) {
27910          from = Math.max(from, 0);
27911          to = Math.min(to, slides.length - 1);
27912        }
27913        let offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0);
27914        if (isLoop && activeIndex >= slidesBefore) {
27915          from -= slidesBefore;
27916          if (!centeredSlides) offset += swiper.slidesGrid[0];
27917        } else if (isLoop && activeIndex < slidesBefore) {
27918          from = -slidesBefore;
27919          if (centeredSlides) offset += swiper.slidesGrid[0];
27920        }
27921        Object.assign(swiper.virtual, {
27922          from,
27923          to,
27924          offset,
27925          slidesGrid: swiper.slidesGrid,
27926          slidesBefore,
27927          slidesAfter
27928        });
27929        function onRendered() {
27930          swiper.updateSlides();
27931          swiper.updateProgress();
27932          swiper.updateSlidesClasses();
27933          emit('virtualUpdate');
27934        }
27935        if (previousFrom === from && previousTo === to && !force) {
27936          if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) {
27937            swiper.slides.forEach(slideEl => {
27938              slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`;
27939            });
27940          }
27941          swiper.updateProgress();
27942          emit('virtualUpdate');
27943          return;
27944        }
27945        if (swiper.params.virtual.renderExternal) {
27946          swiper.params.virtual.renderExternal.call(swiper, {
27947            offset,
27948            from,
27949            to,
27950            slides: function getSlides() {
27951              const slidesToRender = [];
27952              for (let i = from; i <= to; i += 1) {
27953                slidesToRender.push(slides[i]);
27954              }
27955              return slidesToRender;
27956            }()
27957          });
27958          if (swiper.params.virtual.renderExternalUpdate) {
27959            onRendered();
27960          } else {
27961            emit('virtualUpdate');
27962          }
27963          return;
27964        }
27965        const prependIndexes = [];
27966        const appendIndexes = [];
27967        const getSlideIndex = index => {
27968          let slideIndex = index;
27969          if (index < 0) {
27970            slideIndex = slides.length + index;
27971          } else if (slideIndex >= slides.length) {
27972            // eslint-disable-next-line
27973            slideIndex = slideIndex - slides.length;
27974          }
27975          return slideIndex;
27976        };
27977        if (force) {
27978          swiper.slidesEl.querySelectorAll(`.${swiper.params.slideClass}
27978, swiper-slide`).forEach(slideEl => {
27979            slideEl.remove();
27980          });
27981        } else {
27982          for (let i = previousFrom; i <= previousTo; i += 1) {
27983            if (i < from || i > to) {
27984              const slideIndex = getSlideIndex(i);
27985              swiper.slidesEl.querySelectorAll(`.${swiper.params.slideClass}[data-swiper-slide-index="${slideIndex}"], swiper-slide[data-swiper-slide-index="${slideIndex}"]`).forEach(slideEl => {
27986                slideEl.remove();
27987              });
27988            }
27989          }
27990        }
27991        const loopFrom = isLoop ? -slides.length : 0;
27992        const loopTo = isLoop ? slides.length * 2 : slides.length;
27993        for (let i = loopFrom; i < loopTo; i += 1) {
27994          if (i >= from && i <= to) {
27995            const slideIndex = getSlideIndex(i);
27996            if (typeof previousTo === 'undefined' || force) {
27997              appendIndexes.push(slideIndex);
27998            } else {
27999              if (i > previousTo) appendIndexes.push(slideIndex);
28000              if (i < previousFrom) prependIndexes.push(slideIndex);
28001            }
28002          }
28003        }
28004        appendIndexes.forEach(index => {
28005          swiper.slidesEl.append(renderSlide(slides[index], index));
28006        });
28007        if (isLoop) {
28008          for (let i = prependIndexes.length - 1; i >= 0; i -= 1) {
28009            const index = prependIndexes[i];
28010            swiper.slidesEl.prepend(renderSlide(slides[index], index));
28011          }
28012        } else {
28013          prependIndexes.sort((a, b) => b - a);
28014          prependIndexes.forEach(index => {
28015            swiper.slidesEl.prepend(renderSlide(slides[index], index));
28016          });
28017        }
28018        elementChildren(swiper.slidesEl, '.swiper-slide, swiper-slide').forEach(sli
vendor: 5,366 bytes, lines 28018-28170
28018deEl => {
28019          slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`;
28020        });
28021        onRendered();
28022      }
28023      function appendSlide(slides) {
28024        if (typeof slides === 'object' && 'length' in slides) {
28025          for (let i = 0; i < slides.length; i += 1) {
28026            if (slides[i]) swiper.virtual.slides.push(slides[i]);
28027          }
28028        } else {
28029          swiper.virtual.slides.push(slides);
28030        }
28031        update(true);
28032      }
28033      function prependSlide(slides) {
28034        const activeIndex = swiper.activeIndex;
28035        let newActiveIndex = activeIndex + 1;
28036        let numberOfNewSlides = 1;
28037        if (Array.isArray(slides)) {
28038          for (let i = 0; i < slides.length; i += 1) {
28039            if (slides[i]) swiper.virtual.slides.unshift(slides[i]);
28040          }
28041          newActiveIndex = activeIndex + slides.length;
28042          numberOfNewSlides = slides.length;
28043        } else {
28044          swiper.virtual.slides.unshift(slides);
28045        }
28046        if (swiper.params.virtual.cache) {
28047          const cache = swiper.virtual.cache;
28048          const newCache = {};
28049          Object.keys(cache).forEach(cachedIndex => {
28050            const cachedEl = cache[cachedIndex];
28051            const cachedElIndex = cachedEl.getAttribute('data-swiper-slide-index');
28052            if (cachedElIndex) {
28053              cachedEl.setAttribute('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides);
28054            }
28055            newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = cachedEl;
28056          });
28057          swiper.virtual.cache = newCache;
28058        }
28059        update(true);
28060        swiper.slideTo(newActiveIndex, 0);
28061      }
28062      function removeSlide(slidesIndexes) {
28063        if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return;
28064        let activeIndex = swiper.activeIndex;
28065        if (Array.isArray(slidesIndexes)) {
28066          for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) {
28067            swiper.virtual.slides.splice(slidesIndexes[i], 1);
28068            if (swiper.params.virtual.cache) {
28069              delete swiper.virtual.cache[slidesIndexes[i]];
28070            }
28071            if (slidesIndexes[i] < activeIndex) activeIndex -= 1;
28072            activeIndex = Math.max(activeIndex, 0);
28073          }
28074        } else {
28075          swiper.virtual.slides.splice(slidesIndexes, 1);
28076          if (swiper.params.virtual.cache) {
28077            delete swiper.virtual.cache[slidesIndexes];
28078          }
28079          if (slidesIndexes < activeIndex) activeIndex -= 1;
28080          activeIndex = Math.max(activeIndex, 0);
28081        }
28082        update(true);
28083        swiper.slideTo(activeIndex, 0);
28084      }
28085      function removeAllSlides() {
28086        swiper.virtual.slides = [];
28087        if (swiper.params.virtual.cache) {
28088          swiper.virtual.cache = {};
28089        }
28090        update(true);
28091        swiper.slideTo(0, 0);
28092      }
28093      on('beforeInit', () => {
28094        if (!swiper.params.virtual.enabled) return;
28095        let domSlidesAssigned;
28096        if (typeof swiper.passedParams.virtual.slides === 'undefined') {
28097          const slides = [...swiper.slidesEl.children].filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`));
28098          if (slides && slides.length) {
28099            swiper.virtual.slides = [...slides];
28100            domSlidesAssigned = true;
28101            slides.forEach((slideEl, slideIndex) => {
28102              slideEl.setAttribute('data-swiper-slide-index', slideIndex);
28103              swiper.virtual.cache[slideIndex] = slideEl;
28104              slideEl.remove();
28105            });
28106          }
28107        }
28108        if (!domSlidesAssigned) {
28109          swiper.virtual.slides = swiper.params.virtual.slides;
28110        }
28111        swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`);
28112        swiper.params.watchSlidesProgress = true;
28113        swiper.originalParams.watchSlidesProgress = true;
28114        if (!swiper.params.initialSlide) {
28115          update();
28116        }
28117      });
28118      on('setTranslate', () => {
28119        if (!swiper.params.virtual.enabled) return;
28120        if (swiper.params.cssMode && !swiper._immediateVirtual) {
28121          clearTimeout(cssModeTimeout);
28122          cssModeTimeout = setTimeout(() => {
28123            update();
28124          }, 100);
28125        } else {
28126          update();
28127        }
28128      });
28129      on('init update resize', () => {
28130        if (!swiper.params.virtual.enabled) return;
28131        if (swiper.params.cssMode) {
28132          setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`);
28133        }
28134      });
28135      Object.assign(swiper.virtual, {
28136        appendSlide,
28137        prependSlide,
28138        removeSlide,
28139        removeAllSlides,
28140        update
28141      });
28142    }
28143
28144    /* eslint-disable consistent-return */
28145    function Keyboard(_ref) {
28146      let {
28147        swiper,
28148        extendParams,
28149        on,
28150        emit
28151      } = _ref;
28152      const document = getDocument();
28153      const window = getWindow();
28154      swiper.keyboard = {
28155        enabled: false
28156      };
28157      extendParams({
28158        keyboard: {
28159          enabled: false,
28160          onlyInViewport: true,
28161          pageUpDown: true
28162        }
28163      });
28164      function handle(event) {
28165        if (!swiper.enabled) return;
28166        const {
28167          rtlTranslate: rtl
28168        } = swiper;
28169        let e = event;
28170        if (e.originalEvent) e = e.originalEvent; // jquery fix
vendor: 4,274 bytes, lines 28171-28270
28171        const kc = e.keyCode || e.charCode;
28172        const pageUpDown = swiper.params.keyboard.pageUpDown;
28173        const isPageUp = pageUpDown && kc === 33;
28174        const isPageDown = pageUpDown && kc === 34;
28175        const isArrowLeft = kc === 37;
28176        const isArrowRight = kc === 39;
28177        const isArrowUp = kc === 38;
28178        const isArrowDown = kc === 40;
28179        // Directions locks
28180        if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) {
28181          return false;
28182        }
28183        if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) {
28184          return false;
28185        }
28186        if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
28187          return undefined;
28188        }
28189        if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
28190          return undefined;
28191        }
28192        if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {
28193          let inView = false;
28194          // Check that swiper should be inside of visible area of window
28195          if (elementParents(swiper.el, `.${swiper.params.slideClass}, swiper-slide`).length > 0 && elementParents(swiper.el, `.${swiper.params.slideActiveClass}`).length === 0) {
28196            return undefined;
28197          }
28198          const el = swiper.el;
28199          const swiperWidth = el.clientWidth;
28200          const swiperHeight = el.clientHeight;
28201          const windowWidth = window.innerWidth;
28202          const windowHeight = window.innerHeight;
28203          const swiperOffset = elementOffset(el);
28204          if (rtl) swiperOffset.left -= el.scrollLeft;
28205          const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]];
28206          for (let i = 0; i < swiperCoord.length; i += 1) {
28207            const point = swiperCoord[i];
28208            if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) {
28209              if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line
28210              inView = true;
28211            }
28212          }
28213          if (!inView) return undefined;
28214        }
28215        if (swiper.isHorizontal()) {
28216          if (isPageUp || isPageDown || isArrowLeft || isArrowRight) {
28217            if (e.preventDefault) e.preventDefault();else e.returnValue = false;
28218          }
28219          if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext();
28220          if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev();
28221        } else {
28222          if (isPageUp || isPageDown || isArrowUp || isArrowDown) {
28223            if (e.preventDefault) e.preventDefault();else e.returnValue = false;
28224          }
28225          if (isPageDown || isArrowDown) swiper.slideNext();
28226          if (isPageUp || isArrowUp) swiper.slidePrev();
28227        }
28228        emit('keyPress', kc);
28229        return undefined;
28230      }
28231      function enable() {
28232        if (swiper.keyboard.enabled) return;
28233        document.addEventListener('keydown', handle);
28234        swiper.keyboard.enabled = true;
28235      }
28236      function disable() {
28237        if (!swiper.keyboard.enabled) return;
28238        document.removeEventListener('keydown', handle);
28239        swiper.keyboard.enabled = false;
28240      }
28241      on('init', () => {
28242        if (swiper.params.keyboard.enabled) {
28243          enable();
28244        }
28245      });
28246      on('destroy', () => {
28247        if (swiper.keyboard.enabled) {
28248          disable();
28249        }
28250      });
28251      Object.assign(swiper.keyboard, {
28252        enable,
28253        disable
28254      });
28255    }
28256
28257    /* eslint-disable consistent-return */
28258    function Mousewheel(_ref) {
28259      let {
28260        swiper,
28261        extendParams,
28262        on,
28263        emit
28264      } = _ref;
28265      const window = getWindow();
28266      extendParams({
28267        mousewheel: {
28268          enabled: false,
28269          releaseOnEdges: false,
28270          invert: false,
vendor: 14,825 bytes, lines 28271-28611
28271          forceToAxis: false,
28272          sensitivity: 1,
28273          eventsTarget: 'container',
28274          thresholdDelta: null,
28275          thresholdTime: null,
28276          noMousewheelClass: 'swiper-no-mousewheel'
28277        }
28278      });
28279      swiper.mousewheel = {
28280        enabled: false
28281      };
28282      let timeout;
28283      let lastScrollTime = now();
28284      let lastEventBeforeSnap;
28285      const recentWheelEvents = [];
28286      function normalize(e) {
28287        // Reasonable defaults
28288        const PIXEL_STEP = 10;
28289        const LINE_HEIGHT = 40;
28290        const PAGE_HEIGHT = 800;
28291        let sX = 0;
28292        let sY = 0; // spinX, spinY
28293        let pX = 0;
28294        let pY = 0; // pixelX, pixelY
28295
28296        // Legacy
28297        if ('detail' in e) {
28298          sY = e.detail;
28299        }
28300        if ('wheelDelta' in e) {
28301          sY = -e.wheelDelta / 120;
28302        }
28303        if ('wheelDeltaY' in e) {
28304          sY = -e.wheelDeltaY / 120;
28305        }
28306        if ('wheelDeltaX' in e) {
28307          sX = -e.wheelDeltaX / 120;
28308        }
28309
28310        // side scrolling on FF with DOMMouseScroll
28311        if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) {
28312          sX = sY;
28313          sY = 0;
28314        }
28315        pX = sX * PIXEL_STEP;
28316        pY = sY * PIXEL_STEP;
28317        if ('deltaY' in e) {
28318          pY = e.deltaY;
28319        }
28320        if ('deltaX' in e) {
28321          pX = e.deltaX;
28322        }
28323        if (e.shiftKey && !pX) {
28324          // if user scrolls with shift he wants horizontal scroll
28325          pX = pY;
28326          pY = 0;
28327        }
28328        if ((pX || pY) && e.deltaMode) {
28329          if (e.deltaMode === 1) {
28330            // delta in LINE units
28331            pX *= LINE_HEIGHT;
28332            pY *= LINE_HEIGHT;
28333          } else {
28334            // delta in PAGE units
28335            pX *= PAGE_HEIGHT;
28336            pY *= PAGE_HEIGHT;
28337          }
28338        }
28339
28340        // Fall-back if spin cannot be determined
28341        if (pX && !sX) {
28342          sX = pX < 1 ? -1 : 1;
28343        }
28344        if (pY && !sY) {
28345          sY = pY < 1 ? -1 : 1;
28346        }
28347        return {
28348          spinX: sX,
28349          spinY: sY,
28350          pixelX: pX,
28351          pixelY: pY
28352        };
28353      }
28354      function handleMouseEnter() {
28355        if (!swiper.enabled) return;
28356        swiper.mouseEntered = true;
28357      }
28358      function handleMouseLeave() {
28359        if (!swiper.enabled) return;
28360        swiper.mouseEntered = false;
28361      }
28362      function animateSlider(newEvent) {
28363        if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) {
28364          // Prevent if delta of wheel scroll delta is below configured threshold
28365          return false;
28366        }
28367        if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) {
28368          // Prevent if time between scrolls is below configured threshold
28369          return false;
28370        }
28371
28372        // If the movement is NOT big enough and
28373        // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider):
28374        //   Don't go any further (avoid insignificant scroll movement).
28375        if (newEvent.delta >= 6 && now() - lastScrollTime < 60) {
28376          // Return false as a default
28377          return true;
28378        }
28379        // If user is scrolling towards the end:
28380        //   If the slider hasn't hit the latest slide or
28381        //   if the slider is a loop and
28382        //   if the slider isn't moving right now:
28383        //     Go to next slide and
28384        //     emit a scroll event.
28385        // Else (the user is scrolling towards the beginning) and
28386        // if the slider hasn't hit the first slide or
28387        // if the slider is a loop and
28388        // if the slider isn't moving right now:
28389        //   Go to prev slide and
28390        //   emit a scroll event.
28391        if (newEvent.direction < 0) {
28392          if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) {
28393            swiper.slideNext();
28394            emit('scroll', newEvent.raw);
28395          }
28396        } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) {
28397          swiper.slidePrev();
28398          emit('scroll', newEvent.raw);
28399        }
28400        // If you got here is because an animation has been triggered so store the current time
28401        lastScrollTime = new window.Date().getTime();
28402        // Return false as a default
28403        return false;
28404      }
28405      function releaseScroll(newEvent) {
28406        const params = swiper.params.mousewheel;
28407        if (newEvent.direction < 0) {
28408          if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) {
28409            // Return true to animate scroll on edges
28410            return true;
28411          }
28412        } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) {
28413          // Return true to animate scroll on edges
28414          return true;
28415        }
28416        return false;
28417      }
28418      function handle(event) {
28419        let e = event;
28420        let disableParentSwiper = true;
28421        if (!swiper.enabled) return;
28422
28423        // Ignore event if the target or its parents have the swiper-no-mousewheel class
28424        if (event.target.closest(`.${swiper.params.mousewheel.noMousewheelClass}`)) return;
28425        const params = swiper.params.mousewheel;
28426        if (swiper.params.cssMode) {
28427          e.preventDefault();
28428        }
28429        let targetEl = swiper.el;
28430        if (swiper.params.mousewheel.eventsTarget !== 'container') {
28431          targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget);
28432        }
28433        const targetElContainsTarget = targetEl && targetEl.contains(e.target);
28434        if (!swiper.mouseEntered && !targetElContainsTarget && !params.releaseOnEdges) return true;
28435        if (e.originalEvent) e = e.originalEvent; // jquery fix
28436        let delta = 0;
28437        const rtlFactor = swiper.rtlTranslate ? -1 : 1;
28438        const data = normalize(e);
28439        if (params.forceToAxis) {
28440          if (swiper.isHorizontal()) {
28441            if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true;
28442          } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true;
28443        } else {
28444          delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;
28445        }
28446        if (delta === 0) return true;
28447        if (params.invert) delta = -delta;
28448
28449        // Get the scroll positions
28450        let positions = swiper.getTranslate() + delta * params.sensitivity;
28451        if (positions >= swiper.minTranslate()) positions = swiper.minTranslate();
28452        if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate();
28453
28454        // When loop is true:
28455        //     the disableParentSwiper will be true.
28456        // When loop is false:
28457        //     if the scroll positions is not on edge,
28458        //     then the disableParentSwiper will be true.
28459        //     if the scroll on edge positions,
28460        //     then the disableParentSwiper will be false.
28461        disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate());
28462        if (disableParentSwiper && swiper.params.nested) e.stopPropagation();
28463        if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) {
28464          // Register the new event in a variable which stores the relevant data
28465          const newEvent = {
28466            time: now(),
28467            delta: Math.abs(delta),
28468            direction: Math.sign(delta),
28469            raw: event
28470          };
28471
28472          // Keep the most recent events
28473          if (recentWheelEvents.length >= 2) {
28474            recentWheelEvents.shift(); // only store the last N events
28475          }
28476
28477          const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;
28478          recentWheelEvents.push(newEvent);
28479
28480          // If there is at least one previous recorded event:
28481          //   If direction has changed or
28482          //   if the scroll is quicker than the previous one:
28483          //     Animate the slider.
28484          // Else (this is the first time the wheel is moved):
28485          //     Animate the slider.
28486          if (prevEvent) {
28487            if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) {
28488              animateSlider(newEvent);
28489            }
28490          } else {
28491            animateSlider(newEvent);
28492          }
28493
28494          // If it's time to release the scroll:
28495          //   Return now so you don't hit the preventDefault.
28496          if (releaseScroll(newEvent)) {
28497            return true;
28498          }
28499        } else {
28500          // Freemode or scrollContainer:
28501
28502          // If we recently snapped after a momentum scroll, then ignore wheel events
28503          // to give time for the deceleration to finish. Stop ignoring after 500 msecs
28504          // or if it's a new scroll (larger delta or inverse sign as last event before
28505          // an end-of-momentum snap).
28506          const newEvent = {
28507            time: now(),
28508            delta: Math.abs(delta),
28509            direction: Math.sign(delta)
28510          };
28511          const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction;
28512          if (!ignoreWheelEvents) {
28513            lastEventBeforeSnap = undefined;
28514            let position = swiper.getTranslate() + delta * params.sensitivity;
28515            const wasBeginning = swiper.isBeginning;
28516            const wasEnd = swiper.isEnd;
28517            if (position >= swiper.minTranslate()) position = swiper.minTranslate();
28518            if (position <= swiper.maxTranslate()) position = swiper.maxTranslate();
28519            swiper.setTransition(0);
28520            swiper.setTranslate(position);
28521            swiper.updateProgress();
28522            swiper.updateActiveIndex();
28523            swiper.updateSlidesClasses();
28524            if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) {
28525              swiper.updateSlidesClasses();
28526            }
28527            if (swiper.params.loop) {
28528              swiper.loopFix({
28529                direction: newEvent.direction < 0 ? 'next' : 'prev',
28530                byMousewheel: true
28531              });
28532            }
28533            if (swiper.params.freeMode.sticky) {
28534              // When wheel scrolling starts with sticky (aka snap) enabled, then detect
28535              // the end of a momentum scroll by storing recent (N=15?) wheel events.
28536              // 1. do all N events have decreasing or same (absolute value) delta?
28537              // 2. did all N events arrive in the last M (M=500?) msecs?
28538              // 3. does the earliest event have an (absolute value) delta that's
28539              //    at least P (P=1?) larger than the most recent event's delta?
28540              // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels?
28541              // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration.
28542              // Snap immediately and ignore remaining wheel events in this scroll.
28543              // See comment above for "remaining wheel events in this scroll" determination.
28544              // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event.
28545              clearTimeout(timeout);
28546              timeout = undefined;
28547              if (recentWheelEvents.length >= 15) {
28548                recentWheelEvents.shift(); // only store the last N events
28549              }
28550
28551              const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;
28552              const firstEvent = recentWheelEvents[0];
28553              recentWheelEvents.push(newEvent);
28554              if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) {
28555                // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log.
28556                recentWheelEvents.splice(0);
28557              } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) {
28558                // We're at the end of the deceleration of a momentum scroll, so there's no need
28559                // to wait for more events. Snap ASAP on the next tick.
28560                // Also, because there's some remaining momentum we'll bias the snap in the
28561                // direction of the ongoing scroll because it's better UX for the scroll to snap
28562                // in the same direction as the scroll instead of reversing to snap.  Therefore,
28563                // if it's already scrolled more than 20% in the current direction, keep going.
28564                const snapToThreshold = delta > 0 ? 0.8 : 0.2;
28565                lastEventBeforeSnap = newEvent;
28566                recentWheelEvents.splice(0);
28567                timeout = nextTick(() => {
28568                  swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
28569                }, 0); // no delay; move on next tick
28570              }
28571
28572              if (!timeout) {
28573                // if we get here, then we haven't detected the end of a momentum scroll, so
28574                // we'll consider a scroll "complete" when there haven't been any wheel events
28575                // for 500ms.
28576                timeout = nextTick(() => {
28577                  const snapToThreshold = 0.5;
28578                  lastEventBeforeSnap = newEvent;
28579                  recentWheelEvents.splice(0);
28580                  swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);
28581                }, 500);
28582              }
28583            }
28584
28585            // Emit event
28586            if (!ignoreWheelEvents) emit('scroll', e);
28587
28588            // Stop autoplay
28589            if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop();
28590            // Return page scroll on edge positions
28591            if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true;
28592          }
28593        }
28594        if (e.preventDefault) e.preventDefault();else e.returnValue = false;
28595        return false;
28596      }
28597      function events(method) {
28598        let targetEl = swiper.el;
28599        if (swiper.params.mousewheel.eventsTarget !== 'container') {
28600          targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget);
28601        }
28602        targetEl[method]('mouseenter', handleMouseEnter);
28603        targetEl[method]('mouseleave', handleMouseLeave);
28604        targetEl[method]('wheel', handle);
28605      }
28606      function enable() {
28607        if (swiper.params.cssMode) {
28608          swiper.wrapperEl.removeEventListener('wheel', handle);
28609          return true;
28610        }
28611        if (swiper.mousewheel.enabled) return false;
28612        events('addEventListener');
28613        swiper.mousewheel.enabled = true;
28614        return true;
28615      }
28616      function disable() {
28617        if (swiper.params.cssMode) {
28618          swiper.wrapperEl.addEventListener(event, handle);
28619          return true;
28620        }
28621        if (!swiper.mousewheel.enabled) return false;
28622        events('removeEventListener');
28623        swiper.mousewheel.enabled = false;
28624        return true;
28625      }
28626      on('init', () => {
28627        if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) {
28628          disable();
28629        }
28630        if (swiper.params.mousewheel.enabled) enable();
28631      });
28632      on('destroy', () => {
28633        if (swiper.params.cssMode) {
28634          enable();
28635        }
28636        if (swiper.mousewheel.enabled) disable();
28637      });
28638      Object.assign(swiper.mousewheel, {
28639        enable,
28640        disable
28641      });
28642    }
28643
28644    function createElementIfNotDefined(swiper, originalParams, params, checkProps) {
28645      if (swiper.params.createElements) {
28646        Object.keys(checkProps).forEach(key => {
28647          if (!params[key] && params.auto === true) {
28648            let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];
28649            if (!element) {
28650              element = createElement('div', checkProps[key]);
28651              element.className = checkProps[key];
28652              swiper.el.append(element);
28653            }
28654            params[key] = element;
28655            originalParams[key] = element;
28656          }
28657        });
28658      }
28659      return params;
28660    }
28661
28662    function Navigation(_ref) {
28663      let {
28664        swiper,
28665        extendParams,
28666        on,
28667        emit
28668      } = _ref;
28669      extendParams({
28670        navigation: {
28671          nextEl: null,
28672          prevEl: null,
28673          hideOnClick: false,
28674          disabledClass: 'swiper-button-disabled',
28675          hiddenClass: 'swiper-button-hidden',
28676          lockClass: 'swiper-button-lock',
28677          navigationDisabledClass: 'swiper-navigation-disabled'
28678        }
28679      });
28680      swiper.navigation = {
28681        nextEl: null,
28682        prevEl: null
28683      };
28684      const makeElementsArray = el => {
28685        if (!Array.isArray(el)) el = [el].filter(e => !!e);
28686        return el;
28687      };
28688      function getEl(el) {
28689        let res;
28690        if (el && typeof el === 'string' && swiper.isElement) {
28691          res = swiper.el.shadowRoot.querySelector(el);
28692          if (res) return res;
28693        }
28694        if (el) {
28695          if (typeof el === 'string') res = [...document.querySelectorAll(el)];
28696          if (swiper.params.uniqueNavElements && typeof el === 'string' && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
28697            res = swiper.el.querySelector(el);
28698          }
28699        }
28700        if (el && !res) return el;
28701        // if (Array.isArray(res) && res.length === 1) res = res[0];
28702        return res;
28703      }
28704      function toggleEl(el, disabled) {
28705        const params = swiper.params.navigation;
28706        el = makeElementsArray(el);
28707        el.forEach(subEl => {
28708          if (subEl) {
28709            subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));
28710            if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;
28711            if (swiper.params.watchOverflow && swiper.enabled) {
28712              subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
28713            }
28714          }
28715        });
28716      }
28717      function update() {
28718        // Update Navigation Buttons
28719        const {
28720          nextEl,
28721          prevEl
28722        } = swiper.navigation;
28723        if (swiper.params.loop) {
28724          toggleEl(prevEl, false);
28725          toggleEl(nextEl, false);
28726          return;
28727        }
28728        toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);
28729        toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);
28730      }
28731      function onPrevClick(e) {
28732        e.preventDefault();
28733        if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;
28734        swiper.slidePrev();
28735        emit('navigationPrev');
28736      }
28737      function onNextClick(e) {
28738        e.preventDefault();
28739        if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;
28740        swiper.slideNext();
28741        emit('navigationNext');
28742      }
28743      function init() {
28744        const params = swiper.params.navigation;
28745        swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {
28746          nextEl: 'swiper-button-next',
28747          prevEl: 'swiper-button-prev'
28748        });
28749        if (!(params.nextEl || params.prevEl)) return;
28750        let nextEl = getEl(params.nextEl);
28751        let prevEl = getEl(params.prevEl);
28752        Object.assign(swiper.navigation, {
28753          nextEl,
28754          prevEl
28755        });
28756        nextEl = makeElementsArray(nextEl);
28757        prevEl = makeElementsArray(prevEl);
28758        const initButton = (el, dir) => {
28759          if (el) {
28760            el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
28761          }
28762          if (!swiper.enabled && el) {
28763            el.classList.add(...params.lockClass.split(' '));
28764          }
28765        };
28766        nextEl.forEach(el => initButton(el, 'next'));
28767        prevEl.forEach(el => initButton(el, 'prev'));
28768      }
28769      function destroy() {
28770        let {
28771          nextEl,
28772          prevEl
28773        } = swiper.navigation;
28774        nextEl = makeElementsArray(nextEl);
28775        prevEl = makeElementsArray(prevEl);
28776        const destroyButton = (el, dir) => {
28777          el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
28778          el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));
28779        };
28780        nextEl.forEach(el => destroyButton(el, 'next'));
28781        prevEl.forEach(el => destroyButton(el, 'prev'));
28782      }
28783      on('init', () => {
28784        if (swiper.params.navigation.enabled === false) {
28785          // eslint-disable-next-line
28786          disable();
28787        } else {
28788          init();
28789          update();
28790        }
28791      });
28792      on('toEdge fromEdge lock unlock', () => {
28793        update();
28794      });
28795      on('destroy', () => {
28796        destroy();
28797      });
28798      on('enable disable', () => {
28799        let {
28800          nextEl,
28801          prevEl
28802        } = swiper.navigation;
28803        nextEl = makeElementsArray(nextEl);
28804        prevEl = makeElementsArray(prevEl);
28805        [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.navigation.lockClass));
28806      });
28807      on('click', (_s, e) => {
28808        let {
28809          nextEl,
28810          prevEl
28811        } = swiper.navigation;
28812        nextEl = makeElementsArray(nextEl);
28813        prevEl = makeElementsArray(prevEl);
28814        const targetEl = e.target;
28815        if (swiper.params.navigation.hideOnClick && !prevEl.includes(targetEl) && !nextEl.includes(targetEl)) {
28816          if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
28817          let isHidden;
28818          if (nextEl.length) {
28819            isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);
28820          } else if (prevEl.length) {
28821            isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);
28822          }
28823          if (isHidden === true) {
28824            emit('navigationShow');
28825          } else {
28826            emit('navigationHide');
28827          }
28828          [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));
28829        }
28830      });
28831      const enable = () => {
28832        swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));
28833        init();
28834        update();
28835      };
28836      const disable = () => {
28837        swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));
28838        destroy();
28839      };
28840      Object.assign(swiper.navigation, {
28841        enable,
28842        disable,
28843        update,
28844        init,
28845        destroy
28846      });
28847    }
28848
28849    function classesToSelector(classes) {
28850      if (classes === void 0) {
28851        classes = '';
28852      }
28853      return `.${classes.trim().replace(/([\.:!+\/])/g, '\\$1') // eslint-disable-line
28854  .replace(/ /g, '.')}`;
28855    }
28856
28857    function Pagination(_ref) {
28858      let {
28859        swiper,
28860        extendParams,
28861        on,
28862        emit
28863      } = _ref;
28864      const pfx = 'swiper-pagination';
28865      extendParams({
28866        pagination: {
28867          el: null,
28868          bulletElement: 'span',
28869          clickable: false,
28870          hideOnClick: false,
28871          renderBullet: null,
28872          renderProgressbar: null,
28873          renderFraction: null,
28874          renderCustom: null,
28875          progressbarOpposite: false,
28876          type: 'bullets',
28877          // 'bullets' or 'progressbar' or 'fraction' or 'custom'
28878          dynamicBullets: false,
28879          dynamicMainBullets: 1,
28880          formatFractionCurrent: number => number,
28881          formatFractionTotal: number => number,
28882          bulletClass: `${pfx}-bullet`,
28883          bulletActiveClass: `${pfx}-bullet-active`,
28884          modifierClass: `${pfx}-`,
28885          currentClass: `${pfx}-current`,
28886          totalClass: `${pfx}-total`,
28887          hiddenClass: `${pfx}-hidden`,
28888          progressbarFillClass: `${pfx}-progressbar-fill`,
28889          progressbarOppositeClass: `${pfx}-progressbar-opposite`,
28890          clickableClass: `${pfx}-clickable`,
28891          lockClass: `${pfx}-lock`,
28892          horizontalClass: `${pfx}-horizontal`,
28893          verticalClass: `${pfx}-vertical`,
28894          paginationDisabledClass: `${pfx}-disabled`
28895        }
28896      });
28897      swiper.pagination = {
28898        el: null,
28899        bullets: []
28900      };
28901      let bulletSize;
28902      let dynamicBulletIndex = 0;
28903      const makeElementsArray = el => {
28904        if (!Array.isArray(el)) el = [el].filter(e => !!e);
28905        return el;
28906      };
28907      function isPaginationDisabled() {
28908        return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
28909      }
28910      function setSideBullets(bulletEl, position) {
28911        const {
28912          bulletActiveClass
28913        } = swiper.params.pagination;
28914        if (!bulletEl) return;
28915        bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
28916        if (bulletEl) {
28917          bulletEl.classList.add(`${bulletActiveClass}-${position}`);
28918          bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
28919          if (bulletEl) {
28920            bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);
28921          }
28922        }
28923      }
28924      function onBulletClick(e) {
28925        const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
28926        if (!bulletEl) {
28927          return;
28928        }
28929        e.preventDefault();
28930        const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;
28931        if (swiper.params.loop) {
28932          if (swiper.realIndex === index) return;
28933          const newSlideIndex = swiper.getSlideIndexByData(index);
28934          const currentSlideIndex = swiper.getSlideIndexByData(swiper.realIndex);
28935          if (newSlideIndex > swiper.slides.length - swiper.loopedSlides) {
28936            swiper.loopFix({
28937              direction: newSlideIndex > currentSlideIndex ? 'next' : 'prev',
28938              activeSlideIndex: newSlideIndex,
28939              slideTo: false
28940            });
28941          }
28942          swiper.slideToLoop(index);
28943        } else {
28944          swiper.slideTo(index);
28945        }
28946      }
vendor: 15,640 bytes, lines 28947-29318
28947      function update() {
28948        // Render || Update Pagination bullets/items
28949        const rtl = swiper.rtl;
28950        const params = swiper.params.pagination;
28951        if (isPaginationDisabled()) return;
28952        let el = swiper.pagination.el;
28953        el = makeElementsArray(el);
28954        // Current/Total
28955        let current;
28956        let previousIndex;
28957        const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
28958        const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
28959        if (swiper.params.loop) {
28960          previousIndex = swiper.previousRealIndex || 0;
28961          current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;
28962        } else if (typeof swiper.snapIndex !== 'undefined') {
28963          current = swiper.snapIndex;
28964          previousIndex = swiper.previousSnapIndex;
28965        } else {
28966          previousIndex = swiper.previousIndex || 0;
28967          current = swiper.activeIndex || 0;
28968        }
28969        // Types
28970        if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
28971          const bullets = swiper.pagination.bullets;
28972          let firstIndex;
28973          let lastIndex;
28974          let midIndex;
28975          if (params.dynamicBullets) {
28976            bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true);
28977            el.forEach(subEl => {
28978              subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;
28979            });
28980            if (params.dynamicMainBullets > 1 && previousIndex !== undefined) {
28981              dynamicBulletIndex += current - (previousIndex || 0);
28982              if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
28983                dynamicBulletIndex = params.dynamicMainBullets - 1;
28984              } else if (dynamicBulletIndex < 0) {
28985                dynamicBulletIndex = 0;
28986              }
28987            }
28988            firstIndex = Math.max(current - dynamicBulletIndex, 0);
28989            lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
28990            midIndex = (lastIndex + firstIndex) / 2;
28991          }
28992          bullets.forEach(bulletEl => {
28993            const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat();
28994            bulletEl.classList.remove(...classesToRemove);
28995          });
28996          if (el.length > 1) {
28997            bullets.forEach(bullet => {
28998              const bulletIndex = elementIndex(bullet);
28999              if (bulletIndex === current) {
29000                bullet.classList.add(...params.bulletActiveClass.split(' '));
29001              } else if (swiper.isElement) {
29002                bullet.setAttribute('part', 'bullet');
29003              }
29004              if (params.dynamicBullets) {
29005                if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
29006                  bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));
29007                }
29008                if (bulletIndex === firstIndex) {
29009                  setSideBullets(bullet, 'prev');
29010                }
29011                if (bulletIndex === lastIndex) {
29012                  setSideBullets(bullet, 'next');
29013                }
29014              }
29015            });
29016          } else {
29017            const bullet = bullets[current];
29018            if (bullet) {
29019              bullet.classList.add(...params.bulletActiveClass.split(' '));
29020            }
29021            if (swiper.isElement) {
29022              bullets.forEach((bulletEl, bulletIndex) => {
29023                bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet');
29024              });
29025            }
29026            if (params.dynamicBullets) {
29027              const firstDisplayedBullet = bullets[firstIndex];
29028              const lastDisplayedBullet = bullets[lastIndex];
29029              for (let i = firstIndex; i <= lastIndex; i += 1) {
29030                if (bullets[i]) {
29031                  bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));
29032                }
29033              }
29034              setSideBullets(firstDisplayedBullet, 'prev');
29035              setSideBullets(lastDisplayedBullet, 'next');
29036            }
29037          }
29038          if (params.dynamicBullets) {
29039            const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
29040            const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
29041            const offsetProp = rtl ? 'right' : 'left';
29042            bullets.forEach(bullet => {
29043              bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;
29044            });
29045          }
29046        }
29047        el.forEach((subEl, subElIndex) => {
29048          if (params.type === 'fraction') {
29049            subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {
29050              fractionEl.textContent = params.formatFractionCurrent(current + 1);
29051            });
29052            subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {
29053              totalEl.textContent = params.formatFractionTotal(total);
29054            });
29055          }
29056          if (params.type === 'progressbar') {
29057            let progressbarDirection;
29058            if (params.progressbarOpposite) {
29059              progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
29060            } else {
29061              progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
29062            }
29063            const scale = (current + 1) / total;
29064            let scaleX = 1;
29065            let scaleY = 1;
29066            if (progressbarDirection === 'horizontal') {
29067              scaleX = scale;
29068            } else {
29069              scaleY = scale;
29070            }
29071            subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {
29072              progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;
29073              progressEl.style.transitionDuration = `${swiper.params.speed}ms`;
29074            });
29075          }
29076          if (params.type === 'custom' && params.renderCustom) {
29077            subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
29078            if (subElIndex === 0) emit('paginationRender', subEl);
29079          } else {
29080            if (subElIndex === 0) emit('paginationRender', subEl);
29081            emit('paginationUpdate', subEl);
29082          }
29083          if (swiper.params.watchOverflow && swiper.enabled) {
29084            subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
29085          }
29086        });
29087      }
29088      function render() {
29089        // Render Container
29090        const params = swiper.params.pagination;
29091        if (isPaginationDisabled()) return;
29092        const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
29093        let el = swiper.pagination.el;
29094        el = makeElementsArray(el);
29095        let paginationHTML = '';
29096        if (params.type === 'bullets') {
29097          let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
29098          if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {
29099            numberOfBullets = slidesLength;
29100          }
29101          for (let i = 0; i < numberOfBullets; i += 1) {
29102            if (params.renderBullet) {
29103              paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
29104            } else {
29105              // prettier-ignore
29106              paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`;
29107            }
29108          }
29109        }
29110        if (params.type === 'fraction') {
29111          if (params.renderFraction) {
29112            paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
29113          } else {
29114            paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`;
29115          }
29116        }
29117        if (params.type === 'progressbar') {
29118          if (params.renderProgressbar) {
29119            paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
29120          } else {
29121            paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
29122          }
29123        }
29124        swiper.pagination.bullets = [];
29125        el.forEach(subEl => {
29126          if (params.type !== 'custom') {
29127            subEl.innerHTML = paginationHTML || '';
29128          }
29129          if (params.type === 'bullets') {
29130            swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
29131          }
29132        });
29133        if (params.type !== 'custom') {
29134          emit('paginationRender', el[0]);
29135        }
29136      }
29137      function init() {
29138        swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
29139          el: 'swiper-pagination'
29140        });
29141        const params = swiper.params.pagination;
29142        if (!params.el) return;
29143        let el;
29144        if (typeof params.el === 'string' && swiper.isElement) {
29145          el = swiper.el.shadowRoot.querySelector(params.el);
29146        }
29147        if (!el && typeof params.el === 'string') {
29148          el = [...document.querySelectorAll(params.el)];
29149        }
29150        if (!el) {
29151          el = params.el;
29152        }
29153        if (!el || el.length === 0) return;
29154        if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {
29155          el = [...swiper.el.querySelectorAll(params.el)];
29156          // check if it belongs to another nested Swiper
29157          if (el.length > 1) {
29158            el = el.filter(subEl => {
29159              if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false;
29160              return true;
29161            })[0];
29162          }
29163        }
29164        if (Array.isArray(el) && el.length === 1) el = el[0];
29165        Object.assign(swiper.pagination, {
29166          el
29167        });
29168        el = makeElementsArray(el);
29169        el.forEach(subEl => {
29170          if (params.type === 'bullets' && params.clickable) {
29171            subEl.classList.add(params.clickableClass);
29172          }
29173          subEl.classList.add(params.modifierClass + params.type);
29174          subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
29175          if (params.type === 'bullets' && params.dynamicBullets) {
29176            subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);
29177            dynamicBulletIndex = 0;
29178            if (params.dynamicMainBullets < 1) {
29179              params.dynamicMainBullets = 1;
29180            }
29181          }
29182          if (params.type === 'progressbar' && params.progressbarOpposite) {
29183            subEl.classList.add(params.progressbarOppositeClass);
29184          }
29185          if (params.clickable) {
29186            subEl.addEventListener('click', onBulletClick);
29187          }
29188          if (!swiper.enabled) {
29189            subEl.classList.add(params.lockClass);
29190          }
29191        });
29192      }
29193      function destroy() {
29194        const params = swiper.params.pagination;
29195        if (isPaginationDisabled()) return;
29196        let el = swiper.pagination.el;
29197        if (el) {
29198          el = makeElementsArray(el);
29199          el.forEach(subEl => {
29200            subEl.classList.remove(params.hiddenClass);
29201            subEl.classList.remove(params.modifierClass + params.type);
29202            subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
29203            if (params.clickable) {
29204              subEl.removeEventListener('click', onBulletClick);
29205            }
29206          });
29207        }
29208        if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));
29209      }
29210      on('changeDirection', () => {
29211        if (!swiper.pagination || !swiper.pagination.el) return;
29212        const params = swiper.params.pagination;
29213        let {
29214          el
29215        } = swiper.pagination;
29216        el = makeElementsArray(el);
29217        el.forEach(subEl => {
29218          subEl.classList.remove(params.horizontalClass, params.verticalClass);
29219          subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
29220        });
29221      });
29222      on('init', () => {
29223        if (swiper.params.pagination.enabled === false) {
29224          // eslint-disable-next-line
29225          disable();
29226        } else {
29227          init();
29228          render();
29229          update();
29230        }
29231      });
29232      on('activeIndexChange', () => {
29233        if (typeof swiper.snapIndex === 'undefined') {
29234          update();
29235        }
29236      });
29237      on('snapIndexChange', () => {
29238        update();
29239      });
29240      on('snapGridLengthChange', () => {
29241        render();
29242        update();
29243      });
29244      on('destroy', () => {
29245        destroy();
29246      });
29247      on('enable disable', () => {
29248        let {
29249          el
29250        } = swiper.pagination;
29251        if (el) {
29252          el = makeElementsArray(el);
29253          el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));
29254        }
29255      });
29256      on('lock unlock', () => {
29257        update();
29258      });
29259      on('click', (_s, e) => {
29260        const targetEl = e.target;
29261        let {
29262          el
29263        } = swiper.pagination;
29264        if (!Array.isArray(el)) el = [el].filter(element => !!element);
29265        if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {
29266          if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
29267          const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);
29268          if (isHidden === true) {
29269            emit('paginationShow');
29270          } else {
29271            emit('paginationHide');
29272          }
29273          el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));
29274        }
29275      });
29276      const enable = () => {
29277        swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);
29278        let {
29279          el
29280        } = swiper.pagination;
29281        if (el) {
29282          el = makeElementsArray(el);
29283          el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));
29284        }
29285        init();
29286        render();
29287        update();
29288      };
29289      const disable = () => {
29290        swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);
29291        let {
29292          el
29293        } = swiper.pagination;
29294        if (el) {
29295          el = makeElementsArray(el);
29296          el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));
29297        }
29298        destroy();
29299      };
29300      Object.assign(swiper.pagination, {
29301        enable,
29302        disable,
29303        render,
29304        update,
29305        init,
29306        destroy
29307      });
29308    }
29309
29310    function Scrollbar(_ref) {
29311      let {
29312        swiper,
29313        extendParams,
29314        on,
29315        emit
29316      } = _ref;
29317      const document = getDocument();
29318      let isTouched = false;
vendor: 5,317 bytes, lines 29319-29471
29319      let timeout = null;
29320      let dragTimeout = null;
29321      let dragStartPos;
29322      let dragSize;
29323      let trackSize;
29324      let divider;
29325      extendParams({
29326        scrollbar: {
29327          el: null,
29328          dragSize: 'auto',
29329          hide: false,
29330          draggable: false,
29331          snapOnRelease: true,
29332          lockClass: 'swiper-scrollbar-lock',
29333          dragClass: 'swiper-scrollbar-drag',
29334          scrollbarDisabledClass: 'swiper-scrollbar-disabled',
29335          horizontalClass: `swiper-scrollbar-horizontal`,
29336          verticalClass: `swiper-scrollbar-vertical`
29337        }
29338      });
29339      swiper.scrollbar = {
29340        el: null,
29341        dragEl: null
29342      };
29343      function setTranslate() {
29344        if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
29345        const {
29346          scrollbar,
29347          rtlTranslate: rtl
29348        } = swiper;
29349        const {
29350          dragEl,
29351          el
29352        } = scrollbar;
29353        const params = swiper.params.scrollbar;
29354        const progress = swiper.params.loop ? swiper.progressLoop : swiper.progress;
29355        let newSize = dragSize;
29356        let newPos = (trackSize - dragSize) * progress;
29357        if (rtl) {
29358          newPos = -newPos;
29359          if (newPos > 0) {
29360            newSize = dragSize - newPos;
29361            newPos = 0;
29362          } else if (-newPos + dragSize > trackSize) {
29363            newSize = trackSize + newPos;
29364          }
29365        } else if (newPos < 0) {
29366          newSize = dragSize + newPos;
29367          newPos = 0;
29368        } else if (newPos + dragSize > trackSize) {
29369          newSize = trackSize - newPos;
29370        }
29371        if (swiper.isHorizontal()) {
29372          dragEl.style.transform = `translate3d(${newPos}px, 0, 0)`;
29373          dragEl.style.width = `${newSize}px`;
29374        } else {
29375          dragEl.style.transform = `translate3d(0px, ${newPos}px, 0)`;
29376          dragEl.style.height = `${newSize}px`;
29377        }
29378        if (params.hide) {
29379          clearTimeout(timeout);
29380          el.style.opacity = 1;
29381          timeout = setTimeout(() => {
29382            el.style.opacity = 0;
29383            el.style.transitionDuration = '400ms';
29384          }, 1000);
29385        }
29386      }
29387      function setTransition(duration) {
29388        if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
29389        swiper.scrollbar.dragEl.style.transitionDuration = `${duration}ms`;
29390      }
29391      function updateSize() {
29392        if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
29393        const {
29394          scrollbar
29395        } = swiper;
29396        const {
29397          dragEl,
29398          el
29399        } = scrollbar;
29400        dragEl.style.width = '';
29401        dragEl.style.height = '';
29402        trackSize = swiper.isHorizontal() ? el.offsetWidth : el.offsetHeight;
29403        divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0));
29404        if (swiper.params.scrollbar.dragSize === 'auto') {
29405          dragSize = trackSize * divider;
29406        } else {
29407          dragSize = parseInt(swiper.params.scrollbar.dragSize, 10);
29408        }
29409        if (swiper.isHorizontal()) {
29410          dragEl.style.width = `${dragSize}px`;
29411        } else {
29412          dragEl.style.height = `${dragSize}px`;
29413        }
29414        if (divider >= 1) {
29415          el.style.display = 'none';
29416        } else {
29417          el.style.display = '';
29418        }
29419        if (swiper.params.scrollbar.hide) {
29420          el.style.opacity = 0;
29421        }
29422        if (swiper.params.watchOverflow && swiper.enabled) {
29423          scrollbar.el.classList[swiper.isLocked ? 'add' : 'remove'](swiper.params.scrollbar.lockClass);
29424        }
29425      }
29426      function getPointerPosition(e) {
29427        return swiper.isHorizontal() ? e.clientX : e.clientY;
29428      }
29429      function setDragPosition(e) {
29430        const {
29431          scrollbar,
29432          rtlTranslate: rtl
29433        } = swiper;
29434        const {
29435          el
29436        } = scrollbar;
29437        let positionRatio;
29438        positionRatio = (getPointerPosition(e) - elementOffset(el)[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize);
29439        positionRatio = Math.max(Math.min(positionRatio, 1), 0);
29440        if (rtl) {
29441          positionRatio = 1 - positionRatio;
29442        }
29443        const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio;
29444        swiper.updateProgress(position);
29445        swiper.setTranslate(position);
29446        swiper.updateActiveIndex();
29447        swiper.updateSlidesClasses();
29448      }
29449      function onDragStart(e) {
29450        const params = swiper.params.scrollbar;
29451        const {
29452          scrollbar,
29453          wrapperEl
29454        } = swiper;
29455        const {
29456          el,
29457          dragEl
29458        } = scrollbar;
29459        isTouched = true;
29460        dragStartPos = e.target === dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null;
29461        e.preventDefault();
29462        e.stopPropagation();
29463        wrapperEl.style.transitionDuration = '100ms';
29464        dragEl.style.transitionDuration = '100ms';
29465        setDragPosition(e);
29466        clearTimeout(dragTimeout);
29467        el.style.transitionDuration = '0ms';
29468        if (params.hide) {
29469          el.style.opacity = 1;
29470        }
29471        if (swiper.params.cssMode) {
vendor: 39,713 bytes, lines 29472-30505
29472          swiper.wrapperEl.style['scroll-snap-type'] = 'none';
29473        }
29474        emit('scrollbarDragStart', e);
29475      }
29476      function onDragMove(e) {
29477        const {
29478          scrollbar,
29479          wrapperEl
29480        } = swiper;
29481        const {
29482          el,
29483          dragEl
29484        } = scrollbar;
29485        if (!isTouched) return;
29486        if (e.preventDefault) e.preventDefault();else e.returnValue = false;
29487        setDragPosition(e);
29488        wrapperEl.style.transitionDuration = '0ms';
29489        el.style.transitionDuration = '0ms';
29490        dragEl.style.transitionDuration = '0ms';
29491        emit('scrollbarDragMove', e);
29492      }
29493      function onDragEnd(e) {
29494        const params = swiper.params.scrollbar;
29495        const {
29496          scrollbar,
29497          wrapperEl
29498        } = swiper;
29499        const {
29500          el
29501        } = scrollbar;
29502        if (!isTouched) return;
29503        isTouched = false;
29504        if (swiper.params.cssMode) {
29505          swiper.wrapperEl.style['scroll-snap-type'] = '';
29506          wrapperEl.style.transitionDuration = '';
29507        }
29508        if (params.hide) {
29509          clearTimeout(dragTimeout);
29510          dragTimeout = nextTick(() => {
29511            el.style.opacity = 0;
29512            el.style.transitionDuration = '400ms';
29513          }, 1000);
29514        }
29515        emit('scrollbarDragEnd', e);
29516        if (params.snapOnRelease) {
29517          swiper.slideToClosest();
29518        }
29519      }
29520      function events(method) {
29521        const {
29522          scrollbar,
29523          params
29524        } = swiper;
29525        const el = scrollbar.el;
29526        if (!el) return;
29527        const target = el;
29528        const activeListener = params.passiveListeners ? {
29529          passive: false,
29530          capture: false
29531        } : false;
29532        const passiveListener = params.passiveListeners ? {
29533          passive: true,
29534          capture: false
29535        } : false;
29536        if (!target) return;
29537        const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
29538        target[eventMethod]('pointerdown', onDragStart, activeListener);
29539        document[eventMethod]('pointermove', onDragMove, activeListener);
29540        document[eventMethod]('pointerup', onDragEnd, passiveListener);
29541      }
29542      function enableDraggable() {
29543        if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
29544        events('on');
29545      }
29546      function disableDraggable() {
29547        if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;
29548        events('off');
29549      }
29550      function init() {
29551        const {
29552          scrollbar,
29553          el: swiperEl
29554        } = swiper;
29555        swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, {
29556          el: 'swiper-scrollbar'
29557        });
29558        const params = swiper.params.scrollbar;
29559        if (!params.el) return;
29560        let el;
29561        if (typeof params.el === 'string' && swiper.isElement) {
29562          el = swiper.el.shadowRoot.querySelector(params.el);
29563        }
29564        if (!el && typeof params.el === 'string') {
29565          el = document.querySelectorAll(params.el);
29566        } else if (!el) {
29567          el = params.el;
29568        }
29569        if (swiper.params.uniqueNavElements && typeof params.el === 'string' && el.length > 1 && swiperEl.querySelectorAll(params.el).length === 1) {
29570          el = swiperEl.querySelector(params.el);
29571        }
29572        if (el.length > 0) el = el[0];
29573        el.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
29574        let dragEl;
29575        if (el) {
29576          dragEl = el.querySelector(`.${swiper.params.scrollbar.dragClass}`);
29577          if (!dragEl) {
29578            dragEl = createElement('div', swiper.params.scrollbar.dragClass);
29579            el.append(dragEl);
29580          }
29581        }
29582        Object.assign(scrollbar, {
29583          el,
29584          dragEl
29585        });
29586        if (params.draggable) {
29587          enableDraggable();
29588        }
29589        if (el) {
29590          el.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.scrollbar.lockClass);
29591        }
29592      }
29593      function destroy() {
29594        const params = swiper.params.scrollbar;
29595        const el = swiper.scrollbar.el;
29596        if (el) {
29597          el.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
29598        }
29599        disableDraggable();
29600      }
29601      on('init', () => {
29602        if (swiper.params.scrollbar.enabled === false) {
29603          // eslint-disable-next-line
29604          disable();
29605        } else {
29606          init();
29607          updateSize();
29608          setTranslate();
29609        }
29610      });
29611      on('update resize observerUpdate lock unlock', () => {
29612        updateSize();
29613      });
29614      on('setTranslate', () => {
29615        setTranslate();
29616      });
29617      on('setTransition', (_s, duration) => {
29618        setTransition(duration);
29619      });
29620      on('enable disable', () => {
29621        const {
29622          el
29623        } = swiper.scrollbar;
29624        if (el) {
29625          el.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.scrollbar.lockClass);
29626        }
29627      });
29628      on('destroy', () => {
29629        destroy();
29630      });
29631      const enable = () => {
29632        swiper.el.classList.remove(swiper.params.scrollbar.scrollbarDisabledClass);
29633        if (swiper.scrollbar.el) {
29634          swiper.scrollbar.el.classList.remove(swiper.params.scrollbar.scrollbarDisabledClass);
29635        }
29636        init();
29637        updateSize();
29638        setTranslate();
29639      };
29640      const disable = () => {
29641        swiper.el.classList.add(swiper.params.scrollbar.scrollbarDisabledClass);
29642        if (swiper.scrollbar.el) {
29643          swiper.scrollbar.el.classList.add(swiper.params.scrollbar.scrollbarDisabledClass);
29644        }
29645        destroy();
29646      };
29647      Object.assign(swiper.scrollbar, {
29648        enable,
29649        disable,
29650        updateSize,
29651        setTranslate,
29652        init,
29653        destroy
29654      });
29655    }
29656
29657    function Parallax(_ref) {
29658      let {
29659        swiper,
29660        extendParams,
29661        on
29662      } = _ref;
29663      extendParams({
29664        parallax: {
29665          enabled: false
29666        }
29667      });
29668      const setTransform = (el, progress) => {
29669        const {
29670          rtl
29671        } = swiper;
29672        const rtlFactor = rtl ? -1 : 1;
29673        const p = el.getAttribute('data-swiper-parallax') || '0';
29674        let x = el.getAttribute('data-swiper-parallax-x');
29675        let y = el.getAttribute('data-swiper-parallax-y');
29676        const scale = el.getAttribute('data-swiper-parallax-scale');
29677        const opacity = el.getAttribute('data-swiper-parallax-opacity');
29678        const rotate = el.getAttribute('data-swiper-parallax-rotate');
29679        if (x || y) {
29680          x = x || '0';
29681          y = y || '0';
29682        } else if (swiper.isHorizontal()) {
29683          x = p;
29684          y = '0';
29685        } else {
29686          y = p;
29687          x = '0';
29688        }
29689        if (x.indexOf('%') >= 0) {
29690          x = `${parseInt(x, 10) * progress * rtlFactor}%`;
29691        } else {
29692          x = `${x * progress * rtlFactor}px`;
29693        }
29694        if (y.indexOf('%') >= 0) {
29695          y = `${parseInt(y, 10) * progress}%`;
29696        } else {
29697          y = `${y * progress}px`;
29698        }
29699        if (typeof opacity !== 'undefined' && opacity !== null) {
29700          const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress));
29701          el.style.opacity = currentOpacity;
29702        }
29703        let transform = `translate3d(${x}, ${y}, 0px)`;
29704        if (typeof scale !== 'undefined' && scale !== null) {
29705          const currentScale = scale - (scale - 1) * (1 - Math.abs(progress));
29706          transform += ` scale(${currentScale})`;
29707        }
29708        if (rotate && typeof rotate !== 'undefined' && rotate !== null) {
29709          const currentRotate = rotate * progress * -1;
29710          transform += ` rotate(${currentRotate}deg)`;
29711        }
29712        el.style.transform = transform;
29713      };
29714      const setTranslate = () => {
29715        const {
29716          el,
29717          slides,
29718          progress,
29719          snapGrid
29720        } = swiper;
29721        elementChildren(el, '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').forEach(subEl => {
29722          setTransform(subEl, progress);
29723        });
29724        slides.forEach((slideEl, slideIndex) => {
29725          let slideProgress = slideEl.progress;
29726          if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') {
29727            slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1);
29728          }
29729          slideProgress = Math.min(Math.max(slideProgress, -1), 1);
29730          slideEl.querySelectorAll('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale], [data-swiper-parallax-rotate]').forEach(subEl => {
29731            setTransform(subEl, slideProgress);
29732          });
29733        });
29734      };
29735      const setTransition = function (duration) {
29736        if (duration === void 0) {
29737          duration = swiper.params.speed;
29738        }
29739        const {
29740          el
29741        } = swiper;
29742        el.querySelectorAll('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').forEach(parallaxEl => {
29743          let parallaxDuration = parseInt(parallaxEl.getAttribute('data-swiper-parallax-duration'), 10) || duration;
29744          if (duration === 0) parallaxDuration = 0;
29745          parallaxEl.style.transitionDuration = `${parallaxDuration}ms`;
29746        });
29747      };
29748      on('beforeInit', () => {
29749        if (!swiper.params.parallax.enabled) return;
29750        swiper.params.watchSlidesProgress = true;
29751        swiper.originalParams.watchSlidesProgress = true;
29752      });
29753      on('init', () => {
29754        if (!swiper.params.parallax.enabled) return;
29755        setTranslate();
29756      });
29757      on('setTranslate', () => {
29758        if (!swiper.params.parallax.enabled) return;
29759        setTranslate();
29760      });
29761      on('setTransition', (_swiper, duration) => {
29762        if (!swiper.params.parallax.enabled) return;
29763        setTransition(duration);
29764      });
29765    }
29766
29767    function Zoom(_ref) {
29768      let {
29769        swiper,
29770        extendParams,
29771        on,
29772        emit
29773      } = _ref;
29774      const window = getWindow();
29775      extendParams({
29776        zoom: {
29777          enabled: false,
29778          maxRatio: 3,
29779          minRatio: 1,
29780          toggle: true,
29781          containerClass: 'swiper-zoom-container',
29782          zoomedSlideClass: 'swiper-slide-zoomed'
29783        }
29784      });
29785      swiper.zoom = {
29786        enabled: false
29787      };
29788      let currentScale = 1;
29789      let isScaling = false;
29790      let fakeGestureTouched;
29791      let fakeGestureMoved;
29792      const evCache = [];
29793      const gesture = {
29794        originX: 0,
29795        originY: 0,
29796        slideEl: undefined,
29797        slideWidth: undefined,
29798        slideHeight: undefined,
29799        imageEl: undefined,
29800        imageWrapEl: undefined,
29801        maxRatio: 3
29802      };
29803      const image = {
29804        isTouched: undefined,
29805        isMoved: undefined,
29806        currentX: undefined,
29807        currentY: undefined,
29808        minX: undefined,
29809        minY: undefined,
29810        maxX: undefined,
29811        maxY: undefined,
29812        width: undefined,
29813        height: undefined,
29814        startX: undefined,
29815        startY: undefined,
29816        touchesStart: {},
29817        touchesCurrent: {}
29818      };
29819      const velocity = {
29820        x: undefined,
29821        y: undefined,
29822        prevPositionX: undefined,
29823        prevPositionY: undefined,
29824        prevTime: undefined
29825      };
29826      let scale = 1;
29827      Object.defineProperty(swiper.zoom, 'scale', {
29828        get() {
29829          return scale;
29830        },
29831        set(value) {
29832          if (scale !== value) {
29833            const imageEl = gesture.imageEl;
29834            const slideEl = gesture.slideEl;
29835            emit('zoomChange', value, imageEl, slideEl);
29836          }
29837          scale = value;
29838        }
29839      });
29840      function getDistanceBetweenTouches() {
29841        if (evCache.length < 2) return 1;
29842        const x1 = evCache[0].pageX;
29843        const y1 = evCache[0].pageY;
29844        const x2 = evCache[1].pageX;
29845        const y2 = evCache[1].pageY;
29846        const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);
29847        return distance;
29848      }
29849      function getScaleOrigin() {
29850        if (evCache.length < 2) return {
29851          x: null,
29852          y: null
29853        };
29854        const box = gesture.imageEl.getBoundingClientRect();
29855        return [(evCache[0].pageX + (evCache[1].pageX - evCache[0].pageX) / 2 - box.x) / currentScale, (evCache[0].pageY + (evCache[1].pageY - evCache[0].pageY) / 2 - box.y) / currentScale];
29856      }
29857      function getSlideSelector() {
29858        return swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`;
29859      }
29860      function eventWithinSlide(e) {
29861        const slideSelector = getSlideSelector();
29862        if (e.target.matches(slideSelector)) return true;
29863        if (swiper.slides.filter(slideEl => slideEl.contains(e.target)).length > 0) return true;
29864        return false;
29865      }
29866      function eventWithinZoomContainer(e) {
29867        const selector = `.${swiper.params.zoom.containerClass}`;
29868        if (e.target.matches(selector)) return true;
29869        if ([...swiper.el.querySelectorAll(selector)].filter(containerEl => containerEl.contains(e.target)).length > 0) return true;
29870        return false;
29871      }
29872
29873      // Events
29874      function onGestureStart(e) {
29875        if (e.pointerType === 'mouse') {
29876          evCache.splice(0, evCache.length);
29877        }
29878        if (!eventWithinSlide(e)) return;
29879        const params = swiper.params.zoom;
29880        fakeGestureTouched = false;
29881        fakeGestureMoved = false;
29882        evCache.push(e);
29883        if (evCache.length < 2) {
29884          return;
29885        }
29886        fakeGestureTouched = true;
29887        gesture.scaleStart = getDistanceBetweenTouches();
29888        if (!gesture.slideEl) {
29889          gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
29890          if (!gesture.slideEl) gesture.slideEl = swiper.slides[swiper.activeIndex];
29891          let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`);
29892          if (imageEl) {
29893            imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0];
29894          }
29895          gesture.imageEl = imageEl;
29896          if (imageEl) {
29897            gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0];
29898          } else {
29899            gesture.imageWrapEl = undefined;
29900          }
29901          if (!gesture.imageWrapEl) {
29902            gesture.imageEl = undefined;
29903            return;
29904          }
29905          gesture.maxRatio = gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio;
29906        }
29907        if (gesture.imageEl) {
29908          const [originX, originY] = getScaleOrigin();
29909          gesture.originX = originX;
29910          gesture.originY = originY;
29911          gesture.imageEl.style.transitionDuration = '0ms';
29912        }
29913        isScaling = true;
29914      }
29915      function onGestureChange(e) {
29916        if (!eventWithinSlide(e)) return;
29917        const params = swiper.params.zoom;
29918        const zoom = swiper.zoom;
29919        const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
29920        if (pointerIndex >= 0) evCache[pointerIndex] = e;
29921        if (evCache.length < 2) {
29922          return;
29923        }
29924        fakeGestureMoved = true;
29925        gesture.scaleMove = getDistanceBetweenTouches();
29926        if (!gesture.imageEl) {
29927          return;
29928        }
29929        zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale;
29930        if (zoom.scale > gesture.maxRatio) {
29931          zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5;
29932        }
29933        if (zoom.scale < params.minRatio) {
29934          zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5;
29935        }
29936        gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`;
29937      }
29938      function onGestureEnd(e) {
29939        if (!eventWithinSlide(e)) return;
29940        if (e.pointerType === 'mouse' && e.type === 'pointerout') return;
29941        const params = swiper.params.zoom;
29942        const zoom = swiper.zoom;
29943        const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);
29944        if (pointerIndex >= 0) evCache.splice(pointerIndex, 1);
29945        if (!fakeGestureTouched || !fakeGestureMoved) {
29946          return;
29947        }
29948        fakeGestureTouched = false;
29949        fakeGestureMoved = false;
29950        if (!gesture.imageEl) return;
29951        zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio);
29952        gesture.imageEl.style.transitionDuration = `${swiper.params.speed}ms`;
29953        gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`;
29954        currentScale = zoom.scale;
29955        isScaling = false;
29956        if (zoom.scale > 1 && gesture.slideEl) {
29957          gesture.slideEl.classList.add(`${params.zoomedSlideClass}`);
29958        } else if (zoom.scale <= 1 && gesture.slideEl) {
29959          gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`);
29960        }
29961        if (zoom.scale === 1) {
29962          gesture.originX = 0;
29963          gesture.originY = 0;
29964          gesture.slideEl = undefined;
29965        }
29966      }
29967      function onTouchStart(e) {
29968        const device = swiper.device;
29969        if (!gesture.imageEl) return;
29970        if (image.isTouched) return;
29971        if (device.android && e.cancelable) e.preventDefault();
29972        image.isTouched = true;
29973        const event = evCache.length > 0 ? evCache[0] : e;
29974        image.touchesStart.x = event.pageX;
29975        image.touchesStart.y = event.pageY;
29976      }
29977      function onTouchMove(e) {
29978        if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) return;
29979        const zoom = swiper.zoom;
29980        if (!gesture.imageEl) return;
29981        if (!image.isTouched || !gesture.slideEl) return;
29982        if (!image.isMoved) {
29983          image.width = gesture.imageEl.offsetWidth;
29984          image.height = gesture.imageEl.offsetHeight;
29985          image.startX = getTranslate(gesture.imageWrapEl, 'x') || 0;
29986          image.startY = getTranslate(gesture.imageWrapEl, 'y') || 0;
29987          gesture.slideWidth = gesture.slideEl.offsetWidth;
29988          gesture.slideHeight = gesture.slideEl.offsetHeight;
29989          gesture.imageWrapEl.style.transitionDuration = '0ms';
29990        }
29991        // Define if we need image drag
29992        const scaledWidth = image.width * zoom.scale;
29993        const scaledHeight = image.height * zoom.scale;
29994        if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return;
29995        image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
29996        image.maxX = -image.minX;
29997        image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
29998        image.maxY = -image.minY;
29999        image.touchesCurrent.x = evCache.length > 0 ? evCache[0].pageX : e.pageX;
30000        image.touchesCurrent.y = evCache.length > 0 ? evCache[0].pageY : e.pageY;
30001        const touchesDiff = Math.max(Math.abs(image.touchesCurrent.x - image.touchesStart.x), Math.abs(image.touchesCurrent.y - image.touchesStart.y));
30002        if (touchesDiff > 5) {
30003          swiper.allowClick = false;
30004        }
30005        if (!image.isMoved && !isScaling) {
30006          if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) {
30007            image.isTouched = false;
30008            return;
30009          }
30010          if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) {
30011            image.isTouched = false;
30012            return;
30013          }
30014        }
30015        if (e.cancelable) {
30016          e.preventDefault();
30017        }
30018        e.stopPropagation();
30019        image.isMoved = true;
30020        const scaleRatio = (zoom.scale - currentScale) / (gesture.maxRatio - swiper.params.zoom.minRatio);
30021        const {
30022          originX,
30023          originY
30024        } = gesture;
30025        image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX + scaleRatio * (image.width - originX * 2);
30026        image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY + scaleRatio * (image.height - originY * 2);
30027        if (image.currentX < image.minX) {
30028          image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8;
30029        }
30030        if (image.currentX > image.maxX) {
30031          image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8;
30032        }
30033        if (image.currentY < image.minY) {
30034          image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8;
30035        }
30036        if (image.currentY > image.maxY) {
30037          image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8;
30038        }
30039
30040        // Velocity
30041        if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x;
30042        if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y;
30043        if (!velocity.prevTime) velocity.prevTime = Date.now();
30044        velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2;
30045        velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2;
30046        if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0;
30047        if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0;
30048        velocity.prevPositionX = image.touchesCurrent.x;
30049        velocity.prevPositionY = image.touchesCurrent.y;
30050        velocity.prevTime = Date.now();
30051        gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`;
30052      }
30053      function onTouchEnd() {
30054        const zoom = swiper.zoom;
30055        if (!gesture.imageEl) return;
30056        if (!image.isTouched || !image.isMoved) {
30057          image.isTouched = false;
30058          image.isMoved = false;
30059          return;
30060        }
30061        image.isTouched = false;
30062        image.isMoved = false;
30063        let momentumDurationX = 300;
30064        let momentumDurationY = 300;
30065        const momentumDistanceX = velocity.x * momentumDurationX;
30066        const newPositionX = image.currentX + momentumDistanceX;
30067        const momentumDistanceY = velocity.y * momentumDurationY;
30068        const newPositionY = image.currentY + momentumDistanceY;
30069
30070        // Fix duration
30071        if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x);
30072        if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y);
30073        const momentumDuration = Math.max(momentumDurationX, momentumDurationY);
30074        image.currentX = newPositionX;
30075        image.currentY = newPositionY;
30076        // Define if we need image drag
30077        const scaledWidth = image.width * zoom.scale;
30078        const scaledHeight = image.height * zoom.scale;
30079        image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
30080        image.maxX = -image.minX;
30081        image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
30082        image.maxY = -image.minY;
30083        image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX);
30084        image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY);
30085        gesture.imageWrapEl.style.transitionDuration = `${momentumDuration}ms`;
30086        gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`;
30087      }
30088      function onTransitionEnd() {
30089        const zoom = swiper.zoom;
30090        if (gesture.slideEl && swiper.activeIndex !== swiper.slides.indexOf(gesture.slideEl)) {
30091          if (gesture.imageEl) {
30092            gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)';
30093          }
30094          if (gesture.imageWrapEl) {
30095            gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)';
30096          }
30097          gesture.slideEl.classList.remove(`${swiper.params.zoom.zoomedSlideClass}`);
30098          zoom.scale = 1;
30099          currentScale = 1;
30100          gesture.slideEl = undefined;
30101          gesture.imageEl = undefined;
30102          gesture.imageWrapEl = undefined;
30103          gesture.originX = 0;
30104          gesture.originY = 0;
30105        }
30106      }
30107      function zoomIn(e) {
30108        const zoom = swiper.zoom;
30109        const params = swiper.params.zoom;
30110        if (!gesture.slideEl) {
30111          if (e && e.target) {
30112            gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
30113          }
30114          if (!gesture.slideEl) {
30115            if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
30116              gesture.slideEl = elementChildren(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0];
30117            } else {
30118              gesture.slideEl = swiper.slides[swiper.activeIndex];
30119            }
30120          }
30121          let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`);
30122          if (imageEl) {
30123            imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0];
30124          }
30125          gesture.imageEl = imageEl;
30126          if (imageEl) {
30127            gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0];
30128          } else {
30129            gesture.imageWrapEl = undefined;
30130          }
30131        }
30132        if (!gesture.imageEl || !gesture.imageWrapEl) return;
30133        if (swiper.params.cssMode) {
30134          swiper.wrapperEl.style.overflow = 'hidden';
30135          swiper.wrapperEl.style.touchAction = 'none';
30136        }
30137        gesture.slideEl.classList.add(`${params.zoomedSlideClass}`);
30138        let touchX;
30139        let touchY;
30140        let offsetX;
30141        let offsetY;
30142        let diffX;
30143        let diffY;
30144        let translateX;
30145        let translateY;
30146        let imageWidth;
30147        let imageHeight;
30148        let scaledWidth;
30149        let scaledHeight;
30150        let translateMinX;
30151        let translateMinY;
30152        let translateMaxX;
30153        let translateMaxY;
30154        let slideWidth;
30155        let slideHeight;
30156        if (typeof image.touchesStart.x === 'undefined' && e) {
30157          touchX = e.pageX;
30158          touchY = e.pageY;
30159        } else {
30160          touchX = image.touchesStart.x;
30161          touchY = image.touchesStart.y;
30162        }
30163        const forceZoomRatio = typeof e === 'number' ? e : null;
30164        if (currentScale === 1 && forceZoomRatio) {
30165          touchX = undefined;
30166          touchY = undefined;
30167        }
30168        zoom.scale = forceZoomRatio || gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio;
30169        currentScale = forceZoomRatio || gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio;
30170        if (e && !(currentScale === 1 && forceZoomRatio)) {
30171          slideWidth = gesture.slideEl.offsetWidth;
30172          slideHeight = gesture.slideEl.offsetHeight;
30173          offsetX = elementOffset(gesture.slideEl).left + window.scrollX;
30174          offsetY = elementOffset(gesture.slideEl).top + window.scrollY;
30175          diffX = offsetX + slideWidth / 2 - touchX;
30176          diffY = offsetY + slideHeight / 2 - touchY;
30177          imageWidth = gesture.imageEl.offsetWidth;
30178          imageHeight = gesture.imageEl.offsetHeight;
30179          scaledWidth = imageWidth * zoom.scale;
30180          scaledHeight = imageHeight * zoom.scale;
30181          translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);
30182          translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);
30183          translateMaxX = -translateMinX;
30184          translateMaxY = -translateMinY;
30185          translateX = diffX * zoom.scale;
30186          translateY = diffY * zoom.scale;
30187          if (translateX < translateMinX) {
30188            translateX = translateMinX;
30189          }
30190          if (translateX > translateMaxX) {
30191            translateX = translateMaxX;
30192          }
30193          if (translateY < translateMinY) {
30194            translateY = translateMinY;
30195          }
30196          if (translateY > translateMaxY) {
30197            translateY = translateMaxY;
30198          }
30199        } else {
30200          translateX = 0;
30201          translateY = 0;
30202        }
30203        if (forceZoomRatio && zoom.scale === 1) {
30204          gesture.originX = 0;
30205          gesture.originY = 0;
30206        }
30207        gesture.imageWrapEl.style.transitionDuration = '300ms';
30208        gesture.imageWrapEl.style.transform = `translate3d(${translateX}px, ${translateY}px,0)`;
30209        gesture.imageEl.style.transitionDuration = '300ms';
30210        gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`;
30211      }
30212      function zoomOut() {
30213        const zoom = swiper.zoom;
30214        const params = swiper.params.zoom;
30215        if (!gesture.slideEl) {
30216          if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {
30217            gesture.slideEl = elementChildren(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0];
30218          } else {
30219            gesture.slideEl = swiper.slides[swiper.activeIndex];
30220          }
30221          let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`);
30222          if (imageEl) {
30223            imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0];
30224          }
30225          gesture.imageEl = imageEl;
30226          if (imageEl) {
30227            gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0];
30228          } else {
30229            gesture.imageWrapEl = undefined;
30230          }
30231        }
30232        if (!gesture.imageEl || !gesture.imageWrapEl) return;
30233        if (swiper.params.cssMode) {
30234          swiper.wrapperEl.style.overflow = '';
30235          swiper.wrapperEl.style.touchAction = '';
30236        }
30237        zoom.scale = 1;
30238        currentScale = 1;
30239        gesture.imageWrapEl.style.transitionDuration = '300ms';
30240        gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)';
30241        gesture.imageEl.style.transitionDuration = '300ms';
30242        gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)';
30243        gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`);
30244        gesture.slideEl = undefined;
30245        gesture.originX = 0;
30246        gesture.originY = 0;
30247      }
30248
30249      // Toggle Zoom
30250      function zoomToggle(e) {
30251        const zoom = swiper.zoom;
30252        if (zoom.scale && zoom.scale !== 1) {
30253          // Zoom Out
30254          zoomOut();
30255        } else {
30256          // Zoom In
30257          zoomIn(e);
30258        }
30259      }
30260      function getListeners() {
30261        const passiveListener = swiper.params.passiveListeners ? {
30262          passive: true,
30263          capture: false
30264        } : false;
30265        const activeListenerWithCapture = swiper.params.passiveListeners ? {
30266          passive: false,
30267          capture: true
30268        } : true;
30269        return {
30270          passiveListener,
30271          activeListenerWithCapture
30272        };
30273      }
30274
30275      // Attach/Detach Events
30276      function enable() {
30277        const zoom = swiper.zoom;
30278        if (zoom.enabled) return;
30279        zoom.enabled = true;
30280        const {
30281          passiveListener,
30282          activeListenerWithCapture
30283        } = getListeners();
30284
30285        // Scale image
30286        swiper.wrapperEl.addEventListener('pointerdown', onGestureStart, passiveListener);
30287        swiper.wrapperEl.addEventListener('pointermove', onGestureChange, activeListenerWithCapture);
30288        ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => {
30289          swiper.wrapperEl.addEventListener(eventName, onGestureEnd, passiveListener);
30290        });
30291
30292        // Move image
30293        swiper.wrapperEl.addEventListener('pointermove', onTouchMove, activeListenerWithCapture);
30294      }
30295      function disable() {
30296        const zoom = swiper.zoom;
30297        if (!zoom.enabled) return;
30298        zoom.enabled = false;
30299        const {
30300          passiveListener,
30301          activeListenerWithCapture
30302        } = getListeners();
30303
30304        // Scale image
30305        swiper.wrapperEl.removeEventListener('pointerdown', onGestureStart, passiveListener);
30306        swiper.wrapperEl.removeEventListener('pointermove', onGestureChange, activeListenerWithCapture);
30307        ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => {
30308          swiper.wrapperEl.removeEventListener(eventName, onGestureEnd, passiveListener);
30309        });
30310
30311        // Move image
30312        swiper.wrapperEl.removeEventListener('pointermove', onTouchMove, activeListenerWithCapture);
30313      }
30314      on('init', () => {
30315        if (swiper.params.zoom.enabled) {
30316          enable();
30317        }
30318      });
30319      on('destroy', () => {
30320        disable();
30321      });
30322      on('touchStart', (_s, e) => {
30323        if (!swiper.zoom.enabled) return;
30324        onTouchStart(e);
30325      });
30326      on('touchEnd', (_s, e) => {
30327        if (!swiper.zoom.enabled) return;
30328        onTouchEnd();
30329      });
30330      on('doubleTap', (_s, e) => {
30331        if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {
30332          zoomToggle(e);
30333        }
30334      });
30335      on('transitionEnd', () => {
30336        if (swiper.zoom.enabled && swiper.params.zoom.enabled) {
30337          onTransitionEnd();
30338        }
30339      });
30340      on('slideChange', () => {
30341        if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) {
30342          onTransitionEnd();
30343        }
30344      });
30345      Object.assign(swiper.zoom, {
30346        enable,
30347        disable,
30348        in: zoomIn,
30349        out: zoomOut,
30350        toggle: zoomToggle
30351      });
30352    }
30353
30354    /* eslint no-bitwise: ["error", { "allow": [">>"] }] */
30355    function Controller(_ref) {
30356      let {
30357        swiper,
30358        extendParams,
30359        on
30360      } = _ref;
30361      extendParams({
30362        controller: {
30363          control: undefined,
30364          inverse: false,
30365          by: 'slide' // or 'container'
30366        }
30367      });
30368
30369      swiper.controller = {
30370        control: undefined
30371      };
30372      function LinearSpline(x, y) {
30373        const binarySearch = function search() {
30374          let maxIndex;
30375          let minIndex;
30376          let guess;
30377          return (array, val) => {
30378            minIndex = -1;
30379            maxIndex = array.length;
30380            while (maxIndex - minIndex > 1) {
30381              guess = maxIndex + minIndex >> 1;
30382              if (array[guess] <= val) {
30383                minIndex = guess;
30384              } else {
30385                maxIndex = guess;
30386              }
30387            }
30388            return maxIndex;
30389          };
30390        }();
30391        this.x = x;
30392        this.y = y;
30393        this.lastIndex = x.length - 1;
30394        // Given an x value (x2), return the expected y2 value:
30395        // (x1,y1) is the known point before given value,
30396        // (x3,y3) is the known point after given value.
30397        let i1;
30398        let i3;
30399        this.interpolate = function interpolate(x2) {
30400          if (!x2) return 0;
30401
30402          // Get the indexes of x1 and x3 (the array indexes before and after given x2):
30403          i3 = binarySearch(this.x, x2);
30404          i1 = i3 - 1;
30405
30406          // We have our indexes i1 & i3, so we can calculate already:
30407          // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
30408          return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];
30409        };
30410        return this;
30411      }
30412      function getInterpolateFunction(c) {
30413        swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid);
30414      }
30415      function setTranslate(_t, byController) {
30416        const controlled = swiper.controller.control;
30417        let multiplier;
30418        let controlledTranslate;
30419        const Swiper = swiper.constructor;
30420        function setControlledTranslate(c) {
30421          if (c.destroyed) return;
30422
30423          // this will create an Interpolate function based on the snapGrids
30424          // x is the Grid of the scrolled scroller and y will be the controlled scroller
30425          // it makes sense to create this only once and recall it for the interpolation
30426          // the function does a lot of value caching for performance
30427          const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate;
30428          if (swiper.params.controller.by === 'slide') {
30429            getInterpolateFunction(c);
30430            // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
30431            // but it did not work out
30432            controlledTranslate = -swiper.controller.spline.interpolate(-translate);
30433          }
30434          if (!controlledTranslate || swiper.params.controller.by === 'container') {
30435            multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());
30436            if (Number.isNaN(multiplier) || !Number.isFinite(multiplier)) {
30437              multiplier = 1;
30438            }
30439            controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();
30440          }
30441          if (swiper.params.controller.inverse) {
30442            controlledTranslate = c.maxTranslate() - controlledTranslate;
30443          }
30444          c.updateProgress(controlledTranslate);
30445          c.setTranslate(controlledTranslate, swiper);
30446          c.updateActiveIndex();
30447          c.updateSlidesClasses();
30448        }
30449        if (Array.isArray(controlled)) {
30450          for (let i = 0; i < controlled.length; i += 1) {
30451            if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
30452              setControlledTranslate(controlled[i]);
30453            }
30454          }
30455        } else if (controlled instanceof Swiper && byController !== controlled) {
30456          setControlledTranslate(controlled);
30457        }
30458      }
30459      function setTransition(duration, byController) {
30460        const Swiper = swiper.constructor;
30461        const controlled = swiper.controller.control;
30462        let i;
30463        function setControlledTransition(c) {
30464          if (c.destroyed) return;
30465          c.setTransition(duration, swiper);
30466          if (duration !== 0) {
30467            c.transitionStart();
30468            if (c.params.autoHeight) {
30469              nextTick(() => {
30470                c.updateAutoHeight();
30471              });
30472            }
30473            elementTransitionEnd(c.wrapperEl, () => {
30474              if (!controlled) return;
30475              c.transitionEnd();
30476            });
30477          }
30478        }
30479        if (Array.isArray(controlled)) {
30480          for (i = 0; i < controlled.length; i += 1) {
30481            if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
30482              setControlledTransition(controlled[i]);
30483            }
30484          }
30485        } else if (controlled instanceof Swiper && byController !== controlled) {
30486          setControlledTransition(controlled);
30487        }
30488      }
30489      function removeSpline() {
30490        if (!swiper.controller.control) return;
30491        if (swiper.controller.spline) {
30492          swiper.controller.spline = undefined;
30493          delete swiper.controller.spline;
30494        }
30495      }
30496      on('beforeInit', () => {
30497        if (typeof window !== 'undefined' && (
30498        // eslint-disable-line
30499        typeof swiper.params.controller.control === 'string' || swiper.params.controller.control instanceof HTMLElement)) {
30500          const controlElement = document.querySelector(swiper.params.controller.control);
30501          if (controlElement && controlElement.swiper) {
30502            swiper.controller.control = controlElement.swiper;
30503          } else if (controlElement) {
30504            const onControllerSwiper = e => {
30505              swiper.controller.control = e.detail[0];
30506              swiper.update();
30507              controlElement.removeEventListener('init', onControllerSwiper);
30508            };
30509            controlElement.addEventListener('init', onControllerSwiper);
30510          }
30511          return;
30512        }
30513        swiper.controller.control = swiper.params.controller.control;
30514      });
30515      on('update', () => {
30516        removeSpline();
30517      });
30518      on('resize', () => {
30519        removeSpline();
30520      });
30521      on('observerUpdate', () => {
30522        removeSpline();
30523      });
30524      on('setTranslate', (_s, translate, byController) => {
30525        if (!swiper.controller.control || swiper.controller.control.destroyed) return;
30526        swiper.controller.setTranslate(translate, byController);
30527      });
30528      on('setTransition', (_s, duration, byController) => {
30529        if (!swiper.controller.control || swiper.controller.control.destroyed) return;
30530        swiper.controller.setTransition(duration, byController);
30531      });
30532      Object.assign(swiper.controller, {
30533        setTranslate,
30534        setTransition
30535      });
30536    }
30537
30538    function A11y(_ref) {
30539      let {
30540        swiper,
30541        extendParams,
30542        on
30543      } = _ref;
30544      extendParams({
30545        a11y: {
30546          enabled: true,
30547          notificationClass: 'swiper-notification',
30548          prevSlideMessage: 'Previous slide',
30549          nextSlideMessage: 'Next slide',
30550          firstSlideMessage: 'This is the first slide',
30551          lastSlideMessage: 'This is the last slide',
30552          paginationBulletMessage: 'Go to slide {{index}}',
30553          slideLabelMessage: '{{index}} / {{slidesLength}}',
30554          containerMessage: null,
30555          containerRoleDescriptionMessage: null,
30556          itemRoleDescriptionMessage: null,
30557          slideRole: 'group',
30558          id: null
30559        }
30560      });
30561      swiper.a11y = {
30562        clicked: false
30563      };
30564      let liveRegion = null;
30565      function notify(message) {
30566        const notification = liveRegion;
30567        if (notification.length === 0) return;
30568        notification.innerHTML = '';
30569        notification.innerHTML = message;
30570      }
30571      const makeElementsArray = el => {
30572        if (!Array.isArray(el)) el = [el].filter(e => !!e);
30573        return el;
30574      };
30575      function getRandomNumber(size) {
30576        if (size === void 0) {
30577          size = 16;
30578        }
30579        const randomChar = () => Math.round(16 * Math.random()).toString(16);
30580        return 'x'.repeat(size).replace(/x/g, randomChar);
30581      }
30582      function makeElFocusable(el) {
30583        el = makeElementsArray(el);
30584        el.forEach(subEl => {
30585          subEl.setAttribute('tabIndex', '0');
30586        });
30587      }
30588      function makeElNotFocusable(el) {
30589        el = makeElementsArray(el);
30590        el.forEach(subEl => {
30591          subEl.setAttribute('tabIndex', '-1');
30592        });
30593      }
30594      function addElRole(el, role) {
30595        el = makeElementsArray(el);
30596        el.forEach(subEl => {
30597          subEl.setAttribute('role', role);
30598        });
30599      }
30600      function addElRoleDescription(el, description) {
30601        el = makeElementsArray(el);
30602        el.forEach(subEl => {
30603          subEl.setAttribute('aria-roledescription', description);
30604        });
30605      }
30606      function addElControls(el, controls) {
30607        el = makeElementsArray(el);
30608        el.forEach(subEl => {
30609          subEl.setAttribute('aria-controls', controls);
30610        });
30611      }
30612      function addElLabel(el, label) {
30613        el = makeElementsArray(el);
30614        el.forEach(subEl => {
30615          subEl.setAttribute('aria-label', label);
30616        });
30617      }
30618      function addElId(el, id) {
30619        el = makeElementsArray(el);
30620        el.forEach(subEl => {
30621          subEl.setAttribute('id', id);
30622        });
30623      }
30624      function addElLive(el, live) {
30625        el = makeElementsArray(el);
30626        el.forEach(subEl => {
30627          subEl.setAttribute('aria-live', live);
30628        });
30629      }
30630      function disableEl(el) {
30631        el = makeElementsArray(el);
30632        el.forEach(subEl => {
30633          subEl.setAttribute('aria-disabled', true);
30634        });
30635      }
30636      function enableEl(el) {
30637        el = makeElementsArray(el);
30638        el.forEach(subEl => {
30639          subEl.setAttribute('aria-disabled', false);
30640        });
30641      }
30642      function onEnterOrSpaceKey(e) {
30643        if (e.keyCode !== 13 && e.keyCode !== 32) return;
30644        const params = swiper.params.a11y;
30645        const targetEl = e.target;
30646        if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) {
30647          if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return;
30648        }
30649        if (swiper.navigation && swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl) {
30650          if (!(swiper.isEnd && !swiper.params.loop)) {
30651            swiper.slideNext();
30652          }
30653          if (swiper.isEnd) {
30654            notify(params.lastSlideMessage);
30655          } else {
30656            notify(params.nextSlideMessage);
30657          }
30658        }
30659        if (swiper.navigation && swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl) {
30660          if (!(swiper.isBeginning && !swiper.params.loop)) {
30661            swiper.slidePrev();
30662          }
30663          if (swiper.isBeginning) {
30664            notify(params.firstSlideMessage);
30665          } else {
30666            notify(params.prevSlideMessage);
30667          }
30668        }
30669        if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) {
30670          targetEl.click();
30671        }
30672      }
30673      function updateNavigation() {
30674        if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return;
30675        const {
30676          nextEl,
30677          prevEl
30678        } = swiper.navigation;
30679        if (prevEl) {
30680          if (swiper.isBeginning) {
30681            disableEl(prevEl);
30682            makeElNotFocusable(prevEl);
30683          } else {
30684            enableEl(prevEl);
30685            makeElFocusable(prevEl);
30686          }
30687        }
30688        if (nextEl) {
30689          if (swiper.isEnd) {
30690            disableEl(nextEl);
30691            makeElNotFocusable(nextEl);
30692          } else {
30693            enableEl(nextEl);
30694            makeElFocusable(nextEl);
30695          }
30696        }
30697      }
30698      function hasPagination() {
30699        return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length;
30700      }
30701      function hasClickablePagination() {
30702        return hasPagination() && swiper.params.pagination.clickable;
30703      }
30704      function updatePagination() {
30705        const params = swiper.params.a11y;
30706        if (!hasPagination()) return;
30707        swiper.pagination.bullets.forEach(bulletEl => {
30708          if (swiper.params.pagination.clickable) {
30709            makeElFocusable(bulletEl);
30710            if (!swiper.params.pagination.renderBullet) {
30711              addElRole(bulletEl, 'button');
30712              addElLabel(bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, elementIndex(bulletEl) + 1));
30713            }
30714          }
30715          if (bulletEl.matches(classesToSelector(swiper.params.pagination.bulletActiveClass))) {
30716            bulletEl.setAttribute('aria-current', 'true');
30717          } else {
30718            bulletEl.removeAttribute('aria-current');
30719          }
30720        });
30721      }
30722      const initNavEl = (el, wrapperId, message) => {
30723        makeElFocusable(el);
30724        if (el.tagName !== 'BUTTON') {
30725          addElRole(el, 'button');
30726          el.addEventListener('keydown', onEnterOrSpaceKey);
30727        }
30728        addElLabel(el, message);
30729        addElControls(el, wrapperId);
30730      };
30731      const handlePointerDown = () => {
30732        swiper.a11y.clicked = true;
30733      };
30734      const handlePointerUp = () => {
30735        requestAnimationFrame(() => {
30736          requestAnimationFrame(() => {
30737            if (!swiper.destroyed) {
30738              swiper.a11y.clicked = false;
30739            }
30740          });
30741        });
30742      };
30743      const handleFocus = e => {
30744        if (swiper.a11y.clicked) return;
30745        const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
30746        if (!slideEl || !swiper.slides.includes(slideEl)) return;
30747        const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
30748        const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
30749        if (isActive || isVisible) return;
30750        if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;
30751        if (swiper.isHorizontal()) {
30752          swiper.el.scrollLeft = 0;
30753        } else {
30754          swiper.el.scrollTop = 0;
30755        }
30756        swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
30757      };
30758      const initSlides = () => {
30759        const params = swiper.params.a11y;
30760        if (params.itemRoleDescriptionMessage) {
30761          addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage);
30762        }
30763        if (params.slideRole) {
30764          addElRole(swiper.slides, params.slideRole);
30765        }
30766        const slidesLength = swiper.slides.length;
30767        if (params.slideLabelMessage) {
30768          swiper.slides.forEach((slideEl, index) => {
30769            const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index;
30770            const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength);
30771            addElLabel(slideEl, ariaLabelMessage);
30772          });
30773        }
30774      };
30775      const init = () => {
30776        const params = swiper.params.a11y;
30777        if (swiper.isElement) {
30778          swiper.el.shadowEl.append(liveRegion);
30779        } else {
30780          swiper.el.append(liveRegion);
30781        }
30782
30783        // Container
30784        const containerEl = swiper.el;
30785        if (params.containerRoleDescriptionMessage) {
30786          addElRoleDescription(containerEl, params.containerRoleDescriptionMessage);
30787        }
30788        if (params.containerMessage) {
30789          addElLabel(containerEl, params.containerMessage);
30790        }
30791
30792        // Wrapper
30793        const wrapperEl = swiper.wrapperEl;
30794        const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`;
30795        const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
30796        addElId(wrapperEl, wrapperId);
30797        addElLive(wrapperEl, live);
30798
30799        // Slide
30800        initSlides();
30801
30802        // Navigation
30803        let {
30804          nextEl,
30805          prevEl
30806        } = swiper.navigation ? swiper.navigation : {};
30807        nextEl = makeElementsArray(nextEl);
30808        prevEl = makeElementsArray(prevEl);
30809        if (nextEl) {
30810          nextEl.forEach(el => initNavEl(el, wrapperId, params.nextSlideMessage));
30811        }
30812        if (prevEl) {
30813          prevEl.forEach(el => initNavEl(el, wrapperId, params.prevSlideMessage));
30814        }
30815
30816        // Pagination
30817        if (hasClickablePagination()) {
30818          const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];
30819          paginationEl.forEach(el => {
30820            el.addEventListener('keydown', onEnterOrSpaceKey);
30821          });
30822        }
30823
30824        // Tab focus
30825        swiper.el.addEventListener('focus', handleFocus, true);
30826        swiper.el.addEventListener('pointerdown', handlePointerDown, true);
30827        swiper.el.addEventListener('pointerup', handlePointerUp, true);
30828      };
30829      function destroy() {
30830        if (liveRegion) liveRegion.remove();
30831        let {
30832          nextEl,
30833          prevEl
30834        } = swiper.navigation ? swiper.navigation : {};
30835        nextEl = makeElementsArray(nextEl);
30836        prevEl = makeElementsArray(prevEl);
30837        if (nextEl) {
30838          nextEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));
30839        }
30840        if (prevEl) {
30841          prevEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));
30842        }
30843
30844        // Pagination
30845        if (hasClickablePagination()) {
30846          const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];
30847          paginationEl.forEach(el => {
30848            el.removeEventListener('keydown', onEnterOrSpaceKey);
30849          });
30850        }
30851
30852        // Tab focus
30853        swiper.el.removeEventListener('focus', handleFocus, true);
30854        swiper.el.removeEventListener('pointerdown', handlePointerDown, true);
30855        swiper.el.removeEventListener('pointerup', handlePointerUp, true);
30856      }
30857      on('beforeInit', () => {
30858        liveRegion = createElement('span', swiper.params.a11y.notificationClass);
30859        liveRegion.setAttribute('aria-live', 'assertive');
30860        liveRegion.setAttribute('aria-atomic', 'true');
30861      });
30862      on('afterInit', () => {
30863        if (!swiper.params.a11y.enabled) return;
30864        init();
30865      });
30866      on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => {
30867        if (!swiper.params.a11y.enabled) return;
30868        initSlides();
30869      });
30870      on('fromEdge toEdge afterInit lock unlock', () => {
30871        if (!swiper.params.a11y.enabled) return;
30872        updateNavigation();
30873      });
30874      on('paginationUpdate', () => {
30875        if (!swiper.params.a11y.enabled) return;
30876        updatePagination();
30877      });
30878      on('destroy', () => {
30879        if (!swiper.params.a11y.enabled) return;
30880        destroy();
30881      });
30882    }
30883
30884    function History(_ref) {
30885      let {
30886        swiper,
30887        extendParams,
30888        on
30889      } = _ref;
30890      extendParams({
30891        history: {
30892          enabled: false,
30893          root: '',
30894          replaceState: false,
30895          key: 'slides',
30896          keepQuery: false
30897        }
30898      });
30899      let initialized = false;
vendor: 20,911 bytes, lines 30900-31475
30900      let paths = {};
30901      const slugify = text => {
30902        return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
30903      };
30904      const getPathValues = urlOverride => {
30905        const window = getWindow();
30906        let location;
30907        if (urlOverride) {
30908          location = new URL(urlOverride);
30909        } else {
30910          location = window.location;
30911        }
30912        const pathArray = location.pathname.slice(1).split('/').filter(part => part !== '');
30913        const total = pathArray.length;
30914        const key = pathArray[total - 2];
30915        const value = pathArray[total - 1];
30916        return {
30917          key,
30918          value
30919        };
30920      };
30921      const setHistory = (key, index) => {
30922        const window = getWindow();
30923        if (!initialized || !swiper.params.history.enabled) return;
30924        let location;
30925        if (swiper.params.url) {
30926          location = new URL(swiper.params.url);
30927        } else {
30928          location = window.location;
30929        }
30930        const slide = swiper.slides[index];
30931        let value = slugify(slide.getAttribute('data-history'));
30932        if (swiper.params.history.root.length > 0) {
30933          let root = swiper.params.history.root;
30934          if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1);
30935          value = `${root}/${key ? `${key}/` : ''}${value}`;
30936        } else if (!location.pathname.includes(key)) {
30937          value = `${key ? `${key}/` : ''}${value}`;
30938        }
30939        if (swiper.params.history.keepQuery) {
30940          value += location.search;
30941        }
30942        const currentState = window.history.state;
30943        if (currentState && currentState.value === value) {
30944          return;
30945        }
30946        if (swiper.params.history.replaceState) {
30947          window.history.replaceState({
30948            value
30949          }, null, value);
30950        } else {
30951          window.history.pushState({
30952            value
30953          }, null, value);
30954        }
30955      };
30956      const scrollToSlide = (speed, value, runCallbacks) => {
30957        if (value) {
30958          for (let i = 0, length = swiper.slides.length; i < length; i += 1) {
30959            const slide = swiper.slides[i];
30960            const slideHistory = slugify(slide.getAttribute('data-history'));
30961            if (slideHistory === value) {
30962              const index = swiper.getSlideIndex(slide);
30963              swiper.slideTo(index, speed, runCallbacks);
30964            }
30965          }
30966        } else {
30967          swiper.slideTo(0, speed, runCallbacks);
30968        }
30969      };
30970      const setHistoryPopState = () => {
30971        paths = getPathValues(swiper.params.url);
30972        scrollToSlide(swiper.params.speed, paths.value, false);
30973      };
30974      const init = () => {
30975        const window = getWindow();
30976        if (!swiper.params.history) return;
30977        if (!window.history || !window.history.pushState) {
30978          swiper.params.history.enabled = false;
30979          swiper.params.hashNavigation.enabled = true;
30980          return;
30981        }
30982        initialized = true;
30983        paths = getPathValues(swiper.params.url);
30984        if (!paths.key && !paths.value) {
30985          if (!swiper.params.history.replaceState) {
30986            window.addEventListener('popstate', setHistoryPopState);
30987          }
30988          return;
30989        }
30990        scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit);
30991        if (!swiper.params.history.replaceState) {
30992          window.addEventListener('popstate', setHistoryPopState);
30993        }
30994      };
30995      const destroy = () => {
30996        const window = getWindow();
30997        if (!swiper.params.history.replaceState) {
30998          window.removeEventListener('popstate', setHistoryPopState);
30999        }
31000      };
31001      on('init', () => {
31002        if (swiper.params.history.enabled) {
31003          init();
31004        }
31005      });
31006      on('destroy', () => {
31007        if (swiper.params.history.enabled) {
31008          destroy();
31009        }
31010      });
31011      on('transitionEnd _freeModeNoMomentumRelease', () => {
31012        if (initialized) {
31013          setHistory(swiper.params.history.key, swiper.activeIndex);
31014        }
31015      });
31016      on('slideChange', () => {
31017        if (initialized && swiper.params.cssMode) {
31018          setHistory(swiper.params.history.key, swiper.activeIndex);
31019        }
31020      });
31021    }
31022
31023    function HashNavigation(_ref) {
31024      let {
31025        swiper,
31026        extendParams,
31027        emit,
31028        on
31029      } = _ref;
31030      let initialized = false;
31031      const document = getDocument();
31032      const window = getWindow();
31033      extendParams({
31034        hashNavigation: {
31035          enabled: false,
31036          replaceState: false,
31037          watchState: false,
31038          getSlideIndex(_s, hash) {
31039            if (swiper.virtual && swiper.params.virtual.enabled) {
31040              const slideWithHash = swiper.slides.filter(slideEl => slideEl.getAttribute('data-hash') === hash)[0];
31041              if (!slideWithHash) return 0;
31042              const index = parseInt(slideWithHash.getAttribute('data-swiper-slide-index'), 10);
31043              return index;
31044            }
31045            return swiper.getSlideIndex(elementChildren(swiper.slidesEl, `.${swiper.params.slideClass}[data-hash="${hash}"], swiper-slide[data-hash="${hash}"]`)[0]);
31046          }
31047        }
31048      });
31049      const onHashChange = () => {
31050        emit('hashChange');
31051        const newHash = document.location.hash.replace('#', '');
31052        const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${swiper.activeIndex}"]`) : swiper.slides[swiper.activeIndex];
31053        const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') : '';
31054        if (newHash !== activeSlideHash) {
31055          const newIndex = swiper.params.hashNavigation.getSlideIndex(swiper, newHash);
31056          if (typeof newIndex === 'undefined' || Number.isNaN(newIndex)) return;
31057          swiper.slideTo(newIndex);
31058        }
31059      };
31060      const setHash = () => {
31061        if (!initialized || !swiper.params.hashNavigation.enabled) return;
31062        const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${swiper.activeIndex}"]`) : swiper.slides[swiper.activeIndex];
31063        const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') || activeSlideEl.getAttribute('data-history') : '';
31064        if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) {
31065          window.history.replaceState(null, null, `#${activeSlideHash}` || '');
31066          emit('hashSet');
31067        } else {
31068          document.location.hash = activeSlideHash || '';
31069          emit('hashSet');
31070        }
31071      };
31072      const init = () => {
31073        if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return;
31074        initialized = true;
31075        const hash = document.location.hash.replace('#', '');
31076        if (hash) {
31077          const speed = 0;
31078          const index = swiper.params.hashNavigation.getSlideIndex(swiper, hash);
31079          swiper.slideTo(index || 0, speed, swiper.params.runCallbacksOnInit, true);
31080        }
31081        if (swiper.params.hashNavigation.watchState) {
31082          window.addEventListener('hashchange', onHashChange);
31083        }
31084      };
31085      const destroy = () => {
31086        if (swiper.params.hashNavigation.watchState) {
31087          window.removeEventListener('hashchange', onHashChange);
31088        }
31089      };
31090      on('init', () => {
31091        if (swiper.params.hashNavigation.enabled) {
31092          init();
31093        }
31094      });
31095      on('destroy', () => {
31096        if (swiper.params.hashNavigation.enabled) {
31097          destroy();
31098        }
31099      });
31100      on('transitionEnd _freeModeNoMomentumRelease', () => {
31101        if (initialized) {
31102          setHash();
31103        }
31104      });
31105      on('slideChange', () => {
31106        if (initialized && swiper.params.cssMode) {
31107          setHash();
31108        }
31109      });
31110    }
31111
31112    /* eslint no-underscore-dangle: "off" */
31113    function Autoplay(_ref) {
31114      let {
31115        swiper,
31116        extendParams,
31117        on,
31118        emit,
31119        params
31120      } = _ref;
31121      swiper.autoplay = {
31122        running: false,
31123        paused: false,
31124        timeLeft: 0
31125      };
31126      extendParams({
31127        autoplay: {
31128          enabled: false,
31129          delay: 3000,
31130          waitForTransition: true,
31131          disableOnInteraction: true,
31132          stopOnLastSlide: false,
31133          reverseDirection: false,
31134          pauseOnMouseEnter: false
31135        }
31136      });
31137      let timeout;
31138      let raf;
31139      let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000;
31140      let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000;
31141      let autoplayTimeLeft;
31142      let autoplayStartTime = new Date().getTime;
31143      let wasPaused;
31144      let isTouched;
31145      let pausedByTouch;
31146      let touchStartTimeout;
31147      let slideChanged;
31148      let pausedByInteraction;
31149      function onTransitionEnd(e) {
31150        if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
31151        if (e.target !== swiper.wrapperEl) return;
31152        swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd);
31153        resume();
31154      }
31155      const calcTimeLeft = () => {
31156        if (swiper.destroyed || !swiper.autoplay.running) return;
31157        if (swiper.autoplay.paused) {
31158          wasPaused = true;
31159        } else if (wasPaused) {
31160          autoplayDelayCurrent = autoplayTimeLeft;
31161          wasPaused = false;
31162        }
31163        const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime();
31164        swiper.autoplay.timeLeft = timeLeft;
31165        emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal);
31166        raf = requestAnimationFrame(() => {
31167          calcTimeLeft();
31168        });
31169      };
31170      const getSlideDelay = () => {
31171        let activeSlideEl;
31172        if (swiper.virtual && swiper.params.virtual.enabled) {
31173          activeSlideEl = swiper.slides.filter(slideEl => slideEl.classList.contains('swiper-slide-active'))[0];
31174        } else {
31175          activeSlideEl = swiper.slides[swiper.activeIndex];
31176        }
31177        if (!activeSlideEl) return undefined;
31178        const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10);
31179        return currentSlideDelay;
31180      };
31181      const run = delayForce => {
31182        if (swiper.destroyed || !swiper.autoplay.running) return;
31183        cancelAnimationFrame(raf);
31184        calcTimeLeft();
31185        let delay = typeof delayForce === 'undefined' ? swiper.params.autoplay.delay : delayForce;
31186        autoplayDelayTotal = swiper.params.autoplay.delay;
31187        autoplayDelayCurrent = swiper.params.autoplay.delay;
31188        const currentSlideDelay = getSlideDelay();
31189        if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === 'undefined') {
31190          delay = currentSlideDelay;
31191          autoplayDelayTotal = currentSlideDelay;
31192          autoplayDelayCurrent = currentSlideDelay;
31193        }
31194        autoplayTimeLeft = delay;
31195        const speed = swiper.params.speed;
31196        const proceed = () => {
31197          if (!swiper || swiper.destroyed) return;
31198          if (swiper.params.autoplay.reverseDirection) {
31199            if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) {
31200              swiper.slidePrev(speed, true, true);
31201              emit('autoplay');
31202            } else if (!swiper.params.autoplay.stopOnLastSlide) {
31203              swiper.slideTo(swiper.slides.length - 1, speed, true, true);
31204              emit('autoplay');
31205            }
31206          } else {
31207            if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) {
31208              swiper.slideNext(speed, true, true);
31209              emit('autoplay');
31210            } else if (!swiper.params.autoplay.stopOnLastSlide) {
31211              swiper.slideTo(0, speed, true, true);
31212              emit('autoplay');
31213            }
31214          }
31215          if (swiper.params.cssMode) {
31216            autoplayStartTime = new Date().getTime();
31217            requestAnimationFrame(() => {
31218              run();
31219            });
31220          }
31221        };
31222        if (delay > 0) {
31223          clearTimeout(timeout);
31224          timeout = setTimeout(() => {
31225            proceed();
31226          }, delay);
31227        } else {
31228          requestAnimationFrame(() => {
31229            proceed();
31230          });
31231        }
31232
31233        // eslint-disable-next-line
31234        return delay;
31235      };
31236      const start = () => {
31237        swiper.autoplay.running = true;
31238        run();
31239        emit('autoplayStart');
31240      };
31241      const stop = () => {
31242        swiper.autoplay.running = false;
31243        clearTimeout(timeout);
31244        cancelAnimationFrame(raf);
31245        emit('autoplayStop');
31246      };
31247      const pause = (internal, reset) => {
31248        if (swiper.destroyed || !swiper.autoplay.running) return;
31249        clearTimeout(timeout);
31250        if (!internal) {
31251          pausedByInteraction = true;
31252        }
31253        const proceed = () => {
31254          emit('autoplayPause');
31255          if (swiper.params.autoplay.waitForTransition) {
31256            swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd);
31257          } else {
31258            resume();
31259          }
31260        };
31261        swiper.autoplay.paused = true;
31262        if (reset) {
31263          if (slideChanged) {
31264            autoplayTimeLeft = swiper.params.autoplay.delay;
31265          }
31266          slideChanged = false;
31267          proceed();
31268          return;
31269        }
31270        const delay = autoplayTimeLeft || swiper.params.autoplay.delay;
31271        autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime);
31272        if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return;
31273        if (autoplayTimeLeft < 0) autoplayTimeLeft = 0;
31274        proceed();
31275      };
31276      const resume = () => {
31277        if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return;
31278        autoplayStartTime = new Date().getTime();
31279        if (pausedByInteraction) {
31280          pausedByInteraction = false;
31281          run(autoplayTimeLeft);
31282        } else {
31283          run();
31284        }
31285        swiper.autoplay.paused = false;
31286        emit('autoplayResume');
31287      };
31288      const onVisibilityChange = () => {
31289        if (swiper.destroyed || !swiper.autoplay.running) return;
31290        const document = getDocument();
31291        if (document.visibilityState === 'hidden') {
31292          pausedByInteraction = true;
31293          pause(true);
31294        }
31295        if (document.visibilityState === 'visible') {
31296          resume();
31297        }
31298      };
31299      const onPointerEnter = e => {
31300        if (e.pointerType !== 'mouse') return;
31301        pausedByInteraction = true;
31302        pause(true);
31303      };
31304      const onPointerLeave = e => {
31305        if (e.pointerType !== 'mouse') return;
31306        if (swiper.autoplay.paused) {
31307          resume();
31308        }
31309      };
31310      const attachMouseEvents = () => {
31311        if (swiper.params.autoplay.pauseOnMouseEnter) {
31312          swiper.el.addEventListener('pointerenter', onPointerEnter);
31313          swiper.el.addEventListener('pointerleave', onPointerLeave);
31314        }
31315      };
31316      const detachMouseEvents = () => {
31317        swiper.el.removeEventListener('pointerenter', onPointerEnter);
31318        swiper.el.removeEventListener('pointerleave', onPointerLeave);
31319      };
31320      const attachDocumentEvents = () => {
31321        const document = getDocument();
31322        document.addEventListener('visibilitychange', onVisibilityChange);
31323      };
31324      const detachDocumentEvents = () => {
31325        const document = getDocument();
31326        document.removeEventListener('visibilitychange', onVisibilityChange);
31327      };
31328      on('init', () => {
31329        if (swiper.params.autoplay.enabled) {
31330          attachMouseEvents();
31331          attachDocumentEvents();
31332          autoplayStartTime = new Date().getTime();
31333          start();
31334        }
31335      });
31336      on('destroy', () => {
31337        detachMouseEvents();
31338        detachDocumentEvents();
31339        if (swiper.autoplay.running) {
31340          stop();
31341        }
31342      });
31343      on('beforeTransitionStart', (_s, speed, internal) => {
31344        if (swiper.destroyed || !swiper.autoplay.running) return;
31345        if (internal || !swiper.params.autoplay.disableOnInteraction) {
31346          pause(true, true);
31347        } else {
31348          stop();
31349        }
31350      });
31351      on('sliderFirstMove', () => {
31352        if (swiper.destroyed || !swiper.autoplay.running) return;
31353        if (swiper.params.autoplay.disableOnInteraction) {
31354          stop();
31355          return;
31356        }
31357        isTouched = true;
31358        pausedByTouch = false;
31359        pausedByInteraction = false;
31360        touchStartTimeout = setTimeout(() => {
31361          pausedByInteraction = true;
31362          pausedByTouch = true;
31363          pause(true);
31364        }, 200);
31365      });
31366      on('touchEnd', () => {
31367        if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return;
31368        clearTimeout(touchStartTimeout);
31369        clearTimeout(timeout);
31370        if (swiper.params.autoplay.disableOnInteraction) {
31371          pausedByTouch = false;
31372          isTouched = false;
31373          return;
31374        }
31375        if (pausedByTouch && swiper.params.cssMode) resume();
31376        pausedByTouch = false;
31377        isTouched = false;
31378      });
31379      on('slideChange', () => {
31380        if (swiper.destroyed || !swiper.autoplay.running) return;
31381        slideChanged = true;
31382      });
31383      Object.assign(swiper.autoplay, {
31384        start,
31385        stop,
31386        pause,
31387        resume
31388      });
31389    }
31390
31391    function Thumb(_ref) {
31392      let {
31393        swiper,
31394        extendParams,
31395        on
31396      } = _ref;
31397      extendParams({
31398        thumbs: {
31399          swiper: null,
31400          multipleActiveThumbs: true,
31401          autoScrollOffset: 0,
31402          slideThumbActiveClass: 'swiper-slide-thumb-active',
31403          thumbsContainerClass: 'swiper-thumbs'
31404        }
31405      });
31406      let initialized = false;
31407      let swiperCreated = false;
31408      swiper.thumbs = {
31409        swiper: null
31410      };
31411      function onThumbClick() {
31412        const thumbsSwiper = swiper.thumbs.swiper;
31413        if (!thumbsSwiper || thumbsSwiper.destroyed) return;
31414        const clickedIndex = thumbsSwiper.clickedIndex;
31415        const clickedSlide = thumbsSwiper.clickedSlide;
31416        if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return;
31417        if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;
31418        let slideToIndex;
31419        if (thumbsSwiper.params.loop) {
31420          slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
31421        } else {
31422          slideToIndex = clickedIndex;
31423        }
31424        if (swiper.params.loop) {
31425          swiper.slideToLoop(slideToIndex);
31426        } else {
31427          swiper.slideTo(slideToIndex);
31428        }
31429      }
31430      function init() {
31431        const {
31432          thumbs: thumbsParams
31433        } = swiper.params;
31434        if (initialized) return false;
31435        initialized = true;
31436        const SwiperClass = swiper.constructor;
31437        if (thumbsParams.swiper instanceof SwiperClass) {
31438          swiper.thumbs.swiper = thumbsParams.swiper;
31439          Object.assign(swiper.thumbs.swiper.originalParams, {
31440            watchSlidesProgress: true,
31441            slideToClickedSlide: false
31442          });
31443          Object.assign(swiper.thumbs.swiper.params, {
31444            watchSlidesProgress: true,
31445            slideToClickedSlide: false
31446          });
31447          swiper.thumbs.swiper.update();
31448        } else if (isObject(thumbsParams.swiper)) {
31449          const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper);
31450          Object.assign(thumbsSwiperParams, {
31451            watchSlidesProgress: true,
31452            slideToClickedSlide: false
31453          });
31454          swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams);
31455          swiperCreated = true;
31456        }
31457        swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass);
31458        swiper.thumbs.swiper.on('tap', onThumbClick);
31459        return true;
31460      }
31461      function update(initial) {
31462        const thumbsSwiper = swiper.thumbs.swiper;
31463        if (!thumbsSwiper || thumbsSwiper.destroyed) return;
31464        const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView;
31465
31466        // Activate thumbs
31467        let thumbsToActivate = 1;
31468        const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;
31469        if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {
31470          thumbsToActivate = swiper.params.slidesPerView;
31471        }
31472        if (!swiper.params.thumbs.multipleActiveThumbs) {
31473          thumbsToActivate = 1;
31474        }
31475        thumbsToActivate = Math.floor(thumbsToActivate);
31476        thumbsSwiper.slides.forEach(slideEl => slideEl.classList.remove(thumbActiveClass));
31477        if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {
31478          for (let i = 0; i < thumbsToActivate; i += 1) {
31479            elementChildren(thumbsSwiper.slidesEl, `[data-swiper-slide-index="${swiper.realIndex + i}"]`).forEach(slideEl => {
31480              slideEl.classList.add(thumbActiveClass);
31481            });
31482          }
31483        } else {
31484          for (let i = 0; i < thumbsToActivate; i += 1) {
31485            if (thumbsSwiper.slides[swiper.realIndex + i]) {
31486              thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass);
31487            }
31488          }
31489        }
31490        const autoScrollOffset = swiper.params.thumbs.autoScrollOffset;
31491        const useOffset = autoScrollOffset && !thumbsSwiper.params.loop;
31492        if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {
31493          const currentThumbsIndex = thumbsSwiper.activeIndex;
31494          let newThumbsIndex;
31495          let direction;
31496          if (thumbsSwiper.params.loop) {
31497            const newThumbsSlide = thumbsSwiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') === `${swiper.realIndex}`)[0];
31498            newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide);
31499            direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';
31500          } else {
31501            newThumbsIndex = swiper.realIndex;
31502            direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';
31503          }
31504          if (useOffset) {
31505            newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;
31506          }
31507          if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {
31508            if (thumbsSwiper.params.centeredSlides) {
31509              if (newThumbsIndex > currentThumbsIndex) {
31510                newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;
31511              } else {
31512                newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;
31513              }
31514            } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ;
31515            thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);
31516          }
31517        }
31518      }
31519      on('beforeInit', () => {
31520        const {
31521          thumbs
31522        } = swiper.params;
31523        if (!thumbs || !thumbs.swiper) return;
31524        if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) {
31525          const document = getDocument();
31526          const getThumbsElementAndInit = () => {
31527            const thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper;
31528            if (thumbsElement && thumbsElement.swiper) {
31529              thumbs.swiper = thumbsElement.swiper;
31530              init();
31531              update(true);
31532            } else if (thumbsElement) {
31533              const onThumbsSwiper = e => {
31534                thumbs.swiper = e.detail[0];
31535                thumbsElement.removeEventListener('init', onThumbsSwiper);
31536                init();
31537                update(true);
31538                thumbs.swiper.update();
31539                swiper.update();
31540              };
31541              thumbsElement.addEventListener('init', onThumbsSwiper);
31542            }
31543            return thumbsElement;
31544          };
31545          const watchForThumbsToAppear = () => {
31546            if (swiper.destroyed) return;
31547            const thumbsElement = getThumbsElementAndInit();
31548            if (!thumbsElement) {
31549              requestAnimationFrame(watchForThumbsToAppear);
31550            }
31551          };
31552          requestAnimationFrame(watchForThumbsToAppear);
31553        } else {
31554          init();
31555          update(true);
31556        }
31557      });
31558      on('slideChange update resize observerUpdate', () => {
31559        update();
31560      });
31561      on('setTransition', (_s, duration) => {
31562        const thumbsSwiper = swiper.thumbs.swiper;
31563        if (!thumbsSwiper || thumbsSwiper.destroyed) return;
31564        thumbsSwiper.setTransition(duration);
31565      });
31566      on('beforeDestroy', () => {
31567        const thumbsSwiper = swiper.thumbs.swiper;
31568        if (!thumbsSwiper || thumbsSwiper.destroyed) return;
31569        if (swiperCreated) {
31570          thumbsSwiper.destroy();
31571        }
31572      });
31573      Object.assign(swiper.thumbs, {
31574        init,
31575        update
31576      });
31577    }
31578
31579    function freeMode(_ref) {
31580      let {
31581        swiper,
31582        extendParams,
31583        emit,
31584        once
31585      } = _ref;
31586      extendParams({
31587        freeMode: {
31588          enabled: false,
31589          momentum: true,
31590          momentumRatio: 1,
31591          momentumBounce: true,
31592          momentumBounceRatio: 1,
31593          momentumVelocityRatio: 1,
31594          sticky: false,
31595          minimumVelocity: 0.02
31596        }
31597      });
31598      function onTouchStart() {
31599        if (swiper.params.cssMode) return;
31600        const translate = swiper.getTranslate();
31601        swiper.setTranslate(translate);
31602        swiper.setTransition(0);
31603        swiper.touchEventsData.velocities.length = 0;
31604        swiper.freeMode.onTouchEnd({
31605          currentPos: swiper.rtl ? swiper.translate : -swiper.translate
31606        });
31607      }
31608      function onTouchMove() {
31609        if (swiper.params.cssMode) return;
31610        const {
31611          touchEventsData: data,
31612          touches
31613        } = swiper;
31614        // Velocity
31615        if (data.velocities.length === 0) {
31616          data.velocities.push({
31617            position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],
31618            time: data.touchStartTime
31619          });
31620        }
31621        data.velocities.push({
31622          position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],
31623          time: now()
31624        });
31625      }
31626      function onTouchEnd(_ref2) {
31627        let {
31628          currentPos
31629        } = _ref2;
31630        if (swiper.params.cssMode) return;
31631        const {
31632          params,
31633          wrapperEl,
31634          rtlTranslate: rtl,
31635          snapGrid,
31636          touchEventsData: data
31637        } = swiper;
31638        // Time diff
31639        const touchEndTime = now();
31640        const timeDiff = touchEndTime - data.touchStartTime;
vendor: 28,792 bytes, lines 31641-32420
31641        if (currentPos < -swiper.minTranslate()) {
31642          swiper.slideTo(swiper.activeIndex);
31643          return;
31644        }
31645        if (currentPos > -swiper.maxTranslate()) {
31646          if (swiper.slides.length < snapGrid.length) {
31647            swiper.slideTo(snapGrid.length - 1);
31648          } else {
31649            swiper.slideTo(swiper.slides.length - 1);
31650          }
31651          return;
31652        }
31653        if (params.freeMode.momentum) {
31654          if (data.velocities.length > 1) {
31655            const lastMoveEvent = data.velocities.pop();
31656            const velocityEvent = data.velocities.pop();
31657            const distance = lastMoveEvent.position - velocityEvent.position;
31658            const time = lastMoveEvent.time - velocityEvent.time;
31659            swiper.velocity = distance / time;
31660            swiper.velocity /= 2;
31661            if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {
31662              swiper.velocity = 0;
31663            }
31664            // this implies that the user stopped moving a finger then released.
31665            // There would be no events with distance zero, so the last event is stale.
31666            if (time > 150 || now() - lastMoveEvent.time > 300) {
31667              swiper.velocity = 0;
31668            }
31669          } else {
31670            swiper.velocity = 0;
31671          }
31672          swiper.velocity *= params.freeMode.momentumVelocityRatio;
31673          data.velocities.length = 0;
31674          let momentumDuration = 1000 * params.freeMode.momentumRatio;
31675          const momentumDistance = swiper.velocity * momentumDuration;
31676          let newPosition = swiper.translate + momentumDistance;
31677          if (rtl) newPosition = -newPosition;
31678          let doBounce = false;
31679          let afterBouncePosition;
31680          const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;
31681          let needsLoopFix;
31682          if (newPosition < swiper.maxTranslate()) {
31683            if (params.freeMode.momentumBounce) {
31684              if (newPosition + swiper.maxTranslate() < -bounceAmount) {
31685                newPosition = swiper.maxTranslate() - bounceAmount;
31686              }
31687              afterBouncePosition = swiper.maxTranslate();
31688              doBounce = true;
31689              data.allowMomentumBounce = true;
31690            } else {
31691              newPosition = swiper.maxTranslate();
31692            }
31693            if (params.loop && params.centeredSlides) needsLoopFix = true;
31694          } else if (newPosition > swiper.minTranslate()) {
31695            if (params.freeMode.momentumBounce) {
31696              if (newPosition - swiper.minTranslate() > bounceAmount) {
31697                newPosition = swiper.minTranslate() + bounceAmount;
31698              }
31699              afterBouncePosition = swiper.minTranslate();
31700              doBounce = true;
31701              data.allowMomentumBounce = true;
31702            } else {
31703              newPosition = swiper.minTranslate();
31704            }
31705            if (params.loop && params.centeredSlides) needsLoopFix = true;
31706          } else if (params.freeMode.sticky) {
31707            let nextSlide;
31708            for (let j = 0; j < snapGrid.length; j += 1) {
31709              if (snapGrid[j] > -newPosition) {
31710                nextSlide = j;
31711                break;
31712              }
31713            }
31714            if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {
31715              newPosition = snapGrid[nextSlide];
31716            } else {
31717              newPosition = snapGrid[nextSlide - 1];
31718            }
31719            newPosition = -newPosition;
31720          }
31721          if (needsLoopFix) {
31722            once('transitionEnd', () => {
31723              swiper.loopFix();
31724            });
31725          }
31726          // Fix duration
31727          if (swiper.velocity !== 0) {
31728            if (rtl) {
31729              momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);
31730            } else {
31731              momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);
31732            }
31733            if (params.freeMode.sticky) {
31734              // If freeMode.sticky is active and the user ends a swipe with a slow-velocity
31735              // event, then durations can be 20+ seconds to slide one (or zero!) slides.
31736              // It's easy to see this when simulating touch with mouse events. To fix this,
31737              // limit single-slide swipes to the default slide duration. This also has the
31738              // nice side effect of matching slide speed if the user stopped moving before
31739              // lifting finger or mouse vs. moving slowly before lifting the finger/mouse.
31740              // For faster swipes, also apply limits (albeit higher ones).
31741              const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);
31742              const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];
31743              if (moveDistance < currentSlideSize) {
31744                momentumDuration = params.speed;
31745              } else if (moveDistance < 2 * currentSlideSize) {
31746                momentumDuration = params.speed * 1.5;
31747              } else {
31748                momentumDuration = params.speed * 2.5;
31749              }
31750            }
31751          } else if (params.freeMode.sticky) {
31752            swiper.slideToClosest();
31753            return;
31754          }
31755          if (params.freeMode.momentumBounce && doBounce) {
31756            swiper.updateProgress(afterBouncePosition);
31757            swiper.setTransition(momentumDuration);
31758            swiper.setTranslate(newPosition);
31759            swiper.transitionStart(true, swiper.swipeDirection);
31760            swiper.animating = true;
31761            elementTransitionEnd(wrapperEl, () => {
31762              if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;
31763              emit('momentumBounce');
31764              swiper.setTransition(params.speed);
31765              setTimeout(() => {
31766                swiper.setTranslate(afterBouncePosition);
31767                elementTransitionEnd(wrapperEl, () => {
31768                  if (!swiper || swiper.destroyed) return;
31769                  swiper.transitionEnd();
31770                });
31771              }, 0);
31772            });
31773          } else if (swiper.velocity) {
31774            emit('_freeModeNoMomentumRelease');
31775            swiper.updateProgress(newPosition);
31776            swiper.setTransition(momentumDuration);
31777            swiper.setTranslate(newPosition);
31778            swiper.transitionStart(true, swiper.swipeDirection);
31779            if (!swiper.animating) {
31780              swiper.animating = true;
31781              elementTransitionEnd(wrapperEl, () => {
31782                if (!swiper || swiper.destroyed) return;
31783                swiper.transitionEnd();
31784              });
31785            }
31786          } else {
31787            swiper.updateProgress(newPosition);
31788          }
31789          swiper.updateActiveIndex();
31790          swiper.updateSlidesClasses();
31791        } else if (params.freeMode.sticky) {
31792          swiper.slideToClosest();
31793          return;
31794        } else if (params.freeMode) {
31795          emit('_freeModeNoMomentumRelease');
31796        }
31797        if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {
31798          swiper.updateProgress();
31799          swiper.updateActiveIndex();
31800          swiper.updateSlidesClasses();
31801        }
31802      }
31803      Object.assign(swiper, {
31804        freeMode: {
31805          onTouchStart,
31806          onTouchMove,
31807          onTouchEnd
31808        }
31809      });
31810    }
31811
31812    function Grid(_ref) {
31813      let {
31814        swiper,
31815        extendParams
31816      } = _ref;
31817      extendParams({
31818        grid: {
31819          rows: 1,
31820          fill: 'column'
31821        }
31822      });
31823      let slidesNumberEvenToRows;
31824      let slidesPerRow;
31825      let numFullColumns;
31826      const getSpaceBetween = () => {
31827        let spaceBetween = swiper.params.spaceBetween;
31828        if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
31829          spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size;
31830        } else if (typeof spaceBetween === 'string') {
31831          spaceBetween = parseFloat(spaceBetween);
31832        }
31833        return spaceBetween;
31834      };
31835      const initSlides = slidesLength => {
31836        const {
31837          slidesPerView
31838        } = swiper.params;
31839        const {
31840          rows,
31841          fill
31842        } = swiper.params.grid;
31843        numFullColumns = Math.floor(slidesLength / rows);
31844        if (Math.floor(slidesLength / rows) === slidesLength / rows) {
31845          slidesNumberEvenToRows = slidesLength;
31846        } else {
31847          slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows;
31848        }
31849        if (slidesPerView !== 'auto' && fill === 'row') {
31850          slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows);
31851        }
31852        slidesPerRow = slidesNumberEvenToRows / rows;
31853      };
31854      const updateSlide = (i, slide, slidesLength, getDirectionLabel) => {
31855        const {
31856          slidesPerGroup
31857        } = swiper.params;
31858        const spaceBetween = getSpaceBetween();
31859        const {
31860          rows,
31861          fill
31862        } = swiper.params.grid;
31863        // Set slides order
31864        let newSlideOrderIndex;
31865        let column;
31866        let row;
31867        if (fill === 'row' && slidesPerGroup > 1) {
31868          const groupIndex = Math.floor(i / (slidesPerGroup * rows));
31869          const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex;
31870          const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup);
31871          row = Math.floor(slideIndexInGroup / columnsInGroup);
31872          column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup;
31873          newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows;
31874          slide.style.order = newSlideOrderIndex;
31875        } else if (fill === 'column') {
31876          column = Math.floor(i / rows);
31877          row = i - column * rows;
31878          if (column > numFullColumns || column === numFullColumns && row === rows - 1) {
31879            row += 1;
31880            if (row >= rows) {
31881              row = 0;
31882              column += 1;
31883            }
31884          }
31885        } else {
31886          row = Math.floor(i / slidesPerRow);
31887          column = i - row * slidesPerRow;
31888        }
31889        slide.row = row;
31890        slide.column = column;
31891        slide.style[getDirectionLabel('margin-top')] = row !== 0 ? spaceBetween && `${spaceBetween}px` : '';
31892      };
31893      const updateWrapperSize = (slideSize, snapGrid, getDirectionLabel) => {
31894        const {
31895          centeredSlides,
31896          roundLengths
31897        } = swiper.params;
31898        const spaceBetween = getSpaceBetween();
31899        const {
31900          rows
31901        } = swiper.params.grid;
31902        swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows;
31903        swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween;
31904        swiper.wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;
31905        if (centeredSlides) {
31906          const newSlidesGrid = [];
31907          for (let i = 0; i < snapGrid.length; i += 1) {
31908            let slidesGridItem = snapGrid[i];
31909            if (roundLengths) slidesGridItem = Math.floor(slidesGridItem);
31910            if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);
31911          }
31912          snapGrid.splice(0, snapGrid.length);
31913          snapGrid.push(...newSlidesGrid);
31914        }
31915      };
31916      swiper.grid = {
31917        initSlides,
31918        updateSlide,
31919        updateWrapperSize
31920      };
31921    }
31922
31923    function appendSlide(slides) {
31924      const swiper = this;
31925      const {
31926        params,
31927        slidesEl
31928      } = swiper;
31929      if (params.loop) {
31930        swiper.loopDestroy();
31931      }
31932      const appendElement = slideEl => {
31933        if (typeof slideEl === 'string') {
31934          const tempDOM = document.createElement('div');
31935          tempDOM.innerHTML = slideEl;
31936          slidesEl.append(tempDOM.children[0]);
31937          tempDOM.innerHTML = '';
31938        } else {
31939          slidesEl.append(slideEl);
31940        }
31941      };
31942      if (typeof slides === 'object' && 'length' in slides) {
31943        for (let i = 0; i < slides.length; i += 1) {
31944          if (slides[i]) appendElement(slides[i]);
31945        }
31946      } else {
31947        appendElement(slides);
31948      }
31949      swiper.recalcSlides();
31950      if (params.loop) {
31951        swiper.loopCreate();
31952      }
31953      if (!params.observer || swiper.isElement) {
31954        swiper.update();
31955      }
31956    }
31957
31958    function prependSlide(slides) {
31959      const swiper = this;
31960      const {
31961        params,
31962        activeIndex,
31963        slidesEl
31964      } = swiper;
31965      if (params.loop) {
31966        swiper.loopDestroy();
31967      }
31968      let newActiveIndex = activeIndex + 1;
31969      const prependElement = slideEl => {
31970        if (typeof slideEl === 'string') {
31971          const tempDOM = document.createElement('div');
31972          tempDOM.innerHTML = slideEl;
31973          slidesEl.prepend(tempDOM.children[0]);
31974          tempDOM.innerHTML = '';
31975        } else {
31976          slidesEl.prepend(slideEl);
31977        }
31978      };
31979      if (typeof slides === 'object' && 'length' in slides) {
31980        for (let i = 0; i < slides.length; i += 1) {
31981          if (slides[i]) prependElement(slides[i]);
31982        }
31983        newActiveIndex = activeIndex + slides.length;
31984      } else {
31985        prependElement(slides);
31986      }
31987      swiper.recalcSlides();
31988      if (params.loop) {
31989        swiper.loopCreate();
31990      }
31991      if (!params.observer || swiper.isElement) {
31992        swiper.update();
31993      }
31994      swiper.slideTo(newActiveIndex, 0, false);
31995    }
31996
31997    function addSlide(index, slides) {
31998      const swiper = this;
31999      const {
32000        params,
32001        activeIndex,
32002        slidesEl
32003      } = swiper;
32004      let activeIndexBuffer = activeIndex;
32005      if (params.loop) {
32006        activeIndexBuffer -= swiper.loopedSlides;
32007        swiper.loopDestroy();
32008        swiper.recalcSlides();
32009      }
32010      const baseLength = swiper.slides.length;
32011      if (index <= 0) {
32012        swiper.prependSlide(slides);
32013        return;
32014      }
32015      if (index >= baseLength) {
32016        swiper.appendSlide(slides);
32017        return;
32018      }
32019      let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer;
32020      const slidesBuffer = [];
32021      for (let i = baseLength - 1; i >= index; i -= 1) {
32022        const currentSlide = swiper.slides[i];
32023        currentSlide.remove();
32024        slidesBuffer.unshift(currentSlide);
32025      }
32026      if (typeof slides === 'object' && 'length' in slides) {
32027        for (let i = 0; i < slides.length; i += 1) {
32028          if (slides[i]) slidesEl.append(slides[i]);
32029        }
32030        newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer;
32031      } else {
32032        slidesEl.append(slides);
32033      }
32034      for (let i = 0; i < slidesBuffer.length; i += 1) {
32035        slidesEl.append(slidesBuffer[i]);
32036      }
32037      swiper.recalcSlides();
32038      if (params.loop) {
32039        swiper.loopCreate();
32040      }
32041      if (!params.observer || swiper.isElement) {
32042        swiper.update();
32043      }
32044      if (params.loop) {
32045        swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
32046      } else {
32047        swiper.slideTo(newActiveIndex, 0, false);
32048      }
32049    }
32050
32051    function removeSlide(slidesIndexes) {
32052      const swiper = this;
32053      const {
32054        params,
32055        activeIndex
32056      } = swiper;
32057      let activeIndexBuffer = activeIndex;
32058      if (params.loop) {
32059        activeIndexBuffer -= swiper.loopedSlides;
32060        swiper.loopDestroy();
32061      }
32062      let newActiveIndex = activeIndexBuffer;
32063      let indexToRemove;
32064      if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) {
32065        for (let i = 0; i < slidesIndexes.length; i += 1) {
32066          indexToRemove = slidesIndexes[i];
32067          if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove();
32068          if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
32069        }
32070        newActiveIndex = Math.max(newActiveIndex, 0);
32071      } else {
32072        indexToRemove = slidesIndexes;
32073        if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove();
32074        if (indexToRemove < newActiveIndex) newActiveIndex -= 1;
32075        newActiveIndex = Math.max(newActiveIndex, 0);
32076      }
32077      swiper.recalcSlides();
32078      if (params.loop) {
32079        swiper.loopCreate();
32080      }
32081      if (!params.observer || swiper.isElement) {
32082        swiper.update();
32083      }
32084      if (params.loop) {
32085        swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);
32086      } else {
32087        swiper.slideTo(newActiveIndex, 0, false);
32088      }
32089    }
32090
32091    function removeAllSlides() {
32092      const swiper = this;
32093      const slidesIndexes = [];
32094      for (let i = 0; i < swiper.slides.length; i += 1) {
32095        slidesIndexes.push(i);
32096      }
32097      swiper.removeSlide(slidesIndexes);
32098    }
32099
32100    function Manipulation(_ref) {
32101      let {
32102        swiper
32103      } = _ref;
32104      Object.assign(swiper, {
32105        appendSlide: appendSlide.bind(swiper),
32106        prependSlide: prependSlide.bind(swiper),
32107        addSlide: addSlide.bind(swiper),
32108        removeSlide: removeSlide.bind(swiper),
32109        removeAllSlides: removeAllSlides.bind(swiper)
32110      });
32111    }
32112
32113    function effectInit(params) {
32114      const {
32115        effect,
32116        swiper,
32117        on,
32118        setTranslate,
32119        setTransition,
32120        overwriteParams,
32121        perspective,
32122        recreateShadows,
32123        getEffectParams
32124      } = params;
32125      on('beforeInit', () => {
32126        if (swiper.params.effect !== effect) return;
32127        swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`);
32128        if (perspective && perspective()) {
32129          swiper.classNames.push(`${swiper.params.containerModifierClass}3d`);
32130        }
32131        const overwriteParamsResult = overwriteParams ? overwriteParams() : {};
32132        Object.assign(swiper.params, overwriteParamsResult);
32133        Object.assign(swiper.originalParams, overwriteParamsResult);
32134      });
32135      on('setTranslate', () => {
32136        if (swiper.params.effect !== effect) return;
32137        setTranslate();
32138      });
32139      on('setTransition', (_s, duration) => {
32140        if (swiper.params.effect !== effect) return;
32141        setTransition(duration);
32142      });
32143      on('transitionEnd', () => {
32144        if (swiper.params.effect !== effect) return;
32145        if (recreateShadows) {
32146          if (!getEffectParams || !getEffectParams().slideShadows) return;
32147          // remove shadows
32148          swiper.slides.forEach(slideEl => {
32149            slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => shadowEl.remove());
32150          });
32151          // create new one
32152          recreateShadows();
32153        }
32154      });
32155      let requireUpdateOnVirtual;
32156      on('virtualUpdate', () => {
32157        if (swiper.params.effect !== effect) return;
32158        if (!swiper.slides.length) {
32159          requireUpdateOnVirtual = true;
32160        }
32161        requestAnimationFrame(() => {
32162          if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) {
32163            setTranslate();
32164            requireUpdateOnVirtual = false;
32165          }
32166        });
32167      });
32168    }
32169
32170    function effectTarget(effectParams, slideEl) {
32171      const transformEl = getSlideTransformEl(slideEl);
32172      if (transformEl !== slideEl) {
32173        transformEl.style.backfaceVisibility = 'hidden';
32174        transformEl.style['-webkit-backface-visibility'] = 'hidden';
32175      }
32176      return transformEl;
32177    }
32178
32179    function effectVirtualTransitionEnd(_ref) {
32180      let {
32181        swiper,
32182        duration,
32183        transformElements,
32184        allSlides
32185      } = _ref;
32186      const {
32187        activeIndex
32188      } = swiper;
32189      const getSlide = el => {
32190        if (!el.parentElement) {
32191          // assume shadow root
32192          const slide = swiper.slides.filter(slideEl => slideEl.shadowEl && slideEl.shadowEl === el.parentNode)[0];
32193          return slide;
32194        }
32195        return el.parentElement;
32196      };
32197      if (swiper.params.virtualTranslate && duration !== 0) {
32198        let eventTriggered = false;
32199        let transitionEndTarget;
32200        if (allSlides) {
32201          transitionEndTarget = transformElements;
32202        } else {
32203          transitionEndTarget = transformElements.filter(transformEl => {
32204            const el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl;
32205            return swiper.getSlideIndex(el) === activeIndex;
32206          });
32207        }
32208        transitionEndTarget.forEach(el => {
32209          elementTransitionEnd(el, () => {
32210            if (eventTriggered) return;
32211            if (!swiper || swiper.destroyed) return;
32212            eventTriggered = true;
32213            swiper.animating = false;
32214            const evt = new window.CustomEvent('transitionend', {
32215              bubbles: true,
32216              cancelable: true
32217            });
32218            swiper.wrapperEl.dispatchEvent(evt);
32219          });
32220        });
32221      }
32222    }
32223
32224    function EffectFade(_ref) {
32225      let {
32226        swiper,
32227        extendParams,
32228        on
32229      } = _ref;
32230      extendParams({
32231        fadeEffect: {
32232          crossFade: false
32233        }
32234      });
32235      const setTranslate = () => {
32236        const {
32237          slides
32238        } = swiper;
32239        const params = swiper.params.fadeEffect;
32240        for (let i = 0; i < slides.length; i += 1) {
32241          const slideEl = swiper.slides[i];
32242          const offset = slideEl.swiperSlideOffset;
32243          let tx = -offset;
32244          if (!swiper.params.virtualTranslate) tx -= swiper.translate;
32245          let ty = 0;
32246          if (!swiper.isHorizontal()) {
32247            ty = tx;
32248            tx = 0;
32249          }
32250          const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs(slideEl.progress), 0) : 1 + Math.min(Math.max(slideEl.progress, -1), 0);
32251          const targetEl = effectTarget(params, slideEl);
32252          targetEl.style.opacity = slideOpacity;
32253          targetEl.style.transform = `translate3d(${tx}px, ${ty}px, 0px)`;
32254        }
32255      };
32256      const setTransition = duration => {
32257        const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));
32258        transformElements.forEach(el => {
32259          el.style.transitionDuration = `${duration}ms`;
32260        });
32261        effectVirtualTransitionEnd({
32262          swiper,
32263          duration,
32264          transformElements,
32265          allSlides: true
32266        });
32267      };
32268      effectInit({
32269        effect: 'fade',
32270        swiper,
32271        on,
32272        setTranslate,
32273        setTransition,
32274        overwriteParams: () => ({
32275          slidesPerView: 1,
32276          slidesPerGroup: 1,
32277          watchSlidesProgress: true,
32278          spaceBetween: 0,
32279          virtualTranslate: !swiper.params.cssMode
32280        })
32281      });
32282    }
32283
32284    function EffectCube(_ref) {
32285      let {
32286        swiper,
32287        extendParams,
32288        on
32289      } = _ref;
32290      extendParams({
32291        cubeEffect: {
32292          slideShadows: true,
32293          shadow: true,
32294          shadowOffset: 20,
32295          shadowScale: 0.94
32296        }
32297      });
32298      const createSlideShadows = (slideEl, progress, isHorizontal) => {
32299        let shadowBefore = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top');
32300        let shadowAfter = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom');
32301        if (!shadowBefore) {
32302          shadowBefore = createElement('div', `swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}`);
32303          slideEl.append(shadowBefore);
32304        }
32305        if (!shadowAfter) {
32306          shadowAfter = createElement('div', `swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}`);
32307          slideEl.append(shadowAfter);
32308        }
32309        if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0);
32310        if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0);
32311      };
32312      const recreateShadows = () => {
32313        // create new ones
32314        const isHorizontal = swiper.isHorizontal();
32315        swiper.slides.forEach(slideEl => {
32316          const progress = Math.max(Math.min(slideEl.progress, 1), -1);
32317          createSlideShadows(slideEl, progress, isHorizontal);
32318        });
32319      };
32320      const setTranslate = () => {
32321        const {
32322          el,
32323          wrapperEl,
32324          slides,
32325          width: swiperWidth,
32326          height: swiperHeight,
32327          rtlTranslate: rtl,
32328          size: swiperSize,
32329          browser
32330        } = swiper;
32331        const params = swiper.params.cubeEffect;
32332        const isHorizontal = swiper.isHorizontal();
32333        const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
32334        let wrapperRotate = 0;
32335        let cubeShadowEl;
32336        if (params.shadow) {
32337          if (isHorizontal) {
32338            cubeShadowEl = swiper.slidesEl.querySelector('.swiper-cube-shadow');
32339            if (!cubeShadowEl) {
32340              cubeShadowEl = createElement('div', 'swiper-cube-shadow');
32341              swiper.slidesEl.append(cubeShadowEl);
32342            }
32343            cubeShadowEl.style.height = `${swiperWidth}px`;
32344          } else {
32345            cubeShadowEl = el.querySelector('.swiper-cube-shadow');
32346            if (!cubeShadowEl) {
32347              cubeShadowEl = createElement('div', 'swiper-cube-shadow');
32348              el.append(cubeShadowEl);
32349            }
32350          }
32351        }
32352        for (let i = 0; i < slides.length; i += 1) {
32353          const slideEl = slides[i];
32354          let slideIndex = i;
32355          if (isVirtual) {
32356            slideIndex = parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10);
32357          }
32358          let slideAngle = slideIndex * 90;
32359          let round = Math.floor(slideAngle / 360);
32360          if (rtl) {
32361            slideAngle = -slideAngle;
32362            round = Math.floor(-slideAngle / 360);
32363          }
32364          const progress = Math.max(Math.min(slideEl.progress, 1), -1);
32365          let tx = 0;
32366          let ty = 0;
32367          let tz = 0;
32368          if (slideIndex % 4 === 0) {
32369            tx = -round * 4 * swiperSize;
32370            tz = 0;
32371          } else if ((slideIndex - 1) % 4 === 0) {
32372            tx = 0;
32373            tz = -round * 4 * swiperSize;
32374          } else if ((slideIndex - 2) % 4 === 0) {
32375            tx = swiperSize + round * 4 * swiperSize;
32376            tz = swiperSize;
32377          } else if ((slideIndex - 3) % 4 === 0) {
32378            tx = -swiperSize;
32379            tz = 3 * swiperSize + swiperSize * 4 * round;
32380          }
32381          if (rtl) {
32382            tx = -tx;
32383          }
32384          if (!isHorizontal) {
32385            ty = tx;
32386            tx = 0;
32387          }
32388          const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`;
32389          if (progress <= 1 && progress > -1) {
32390            wrapperRotate = slideIndex * 90 + progress * 90;
32391            if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90;
32392          }
32393          slideEl.style.transform = transform;
32394          if (params.slideShadows) {
32395            createSlideShadows(slideEl, progress, isHorizontal);
32396          }
32397        }
32398        wrapperEl.style.transformOrigin = `50% 50% -${swiperSize / 2}px`;
32399        wrapperEl.style['-webkit-transform-origin'] = `50% 50% -${swiperSize / 2}px`;
32400        if (params.shadow) {
32401          if (isHorizontal) {
32402            cubeShadowEl.style.transform = `translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`;
32403          } else {
32404            const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
32405            const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
32406            const scale1 = params.shadowScale;
32407            const scale2 = params.shadowScale / multiplier;
32408            const offset = params.shadowOffset;
32409            cubeShadowEl.style.transform = `scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`;
32410          }
32411        }
32412        const zFactor = (browser.isSafari || browser.isWebView) && browser.needPerspectiveFix ? -swiperSize / 2 : 0;
32413        wrapperEl.style.transform = `translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`;
32414        wrapperEl.style.setProperty('--swiper-cube-translate-z', `${zFactor}px`);
32415      };
32416      const setTransition = duration => {
32417        const {
32418          el,
32419          slides
32420        } = swiper;
32421        slides.forEach(slideEl => {
32422          slideEl.style.transitionDuration = `${duration}ms`;
32423          slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(subEl => {
32424            subEl.style.transitionDuration = `${duration}ms`;
32425          });
32426        });
32427        if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {
32428          const shadowEl = el.querySelector('.swiper-cube-shadow');
32429          if (shadowEl) shadowEl.style.transitionDuration = `${duration}ms`;
32430        }
32431      };
32432      effectInit({
32433        effect: 'cube',
32434        swiper,
32435        on,
32436        setTranslate,
32437        setTransition,
32438        recreateShadows,
32439        getEffectParams: () => swiper.params.cubeEffect,
32440        perspective: () => true,
32441        overwriteParams: () => ({
32442          slidesPerView: 1,
32443          slidesPerGroup: 1,
32444          watchSlidesProgress: true,
32445          resistanceRatio: 0,
32446          spaceBetween: 0,
32447          centeredSlides: false,
32448          virtualTranslate: true
32449        })
32450      });
32451    }
32452
32453    function createShadow(params, slideEl, side) {
32454      const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}`;
32455      const shadowContainer = getSlideTransformEl(slideEl);
32456      let shadowEl = shadowContainer.querySelector(`.${shadowClass}`);
32457      if (!shadowEl) {
32458        shadowEl = createElement('div', `swiper-slide-shadow${side ? `-${side}` : ''}`);
32459        shadowContainer.append(shadowEl);
32460      }
32461      return shadowEl;
32462    }
32463
32464    function EffectFlip(_ref) {
32465      let {
32466        swiper,
32467        extendParams,
32468        on
32469      } = _ref;
32470      extendParams({
32471        flipEffect: {
32472          slideShadows: true,
32473          limitRotation: true
32474        }
32475      });
32476      const createSlideShadows = (slideEl, progress, params) => {
32477        let shadowBefore = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top');
32478        let shadowAfter = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom');
32479        if (!shadowBefore) {
32480          shadowBefore = createShadow(params, slideEl, swiper.isHorizontal() ? 'left' : 'top');
32481        }
32482        if (!shadowAfter) {
32483          shadowAfter = createShadow(params, slideEl, swiper.isHorizontal() ? 'right' : 'bottom');
32484        }
32485        if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0);
32486        if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0);
32487      };
32488      const recreateShadows = () => {
32489        // Set shadows
32490        const params = swiper.params.flipEffect;
vendor: 15,817 bytes, lines 32491-32885
32491        swiper.slides.forEach(slideEl => {
32492          let progress = slideEl.progress;
32493          if (swiper.params.flipEffect.limitRotation) {
32494            progress = Math.max(Math.min(slideEl.progress, 1), -1);
32495          }
32496          createSlideShadows(slideEl, progress, params);
32497        });
32498      };
32499      const setTranslate = () => {
32500        const {
32501          slides,
32502          rtlTranslate: rtl
32503        } = swiper;
32504        const params = swiper.params.flipEffect;
32505        for (let i = 0; i < slides.length; i += 1) {
32506          const slideEl = slides[i];
32507          let progress = slideEl.progress;
32508          if (swiper.params.flipEffect.limitRotation) {
32509            progress = Math.max(Math.min(slideEl.progress, 1), -1);
32510          }
32511          const offset = slideEl.swiperSlideOffset;
32512          const rotate = -180 * progress;
32513          let rotateY = rotate;
32514          let rotateX = 0;
32515          let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset;
32516          let ty = 0;
32517          if (!swiper.isHorizontal()) {
32518            ty = tx;
32519            tx = 0;
32520            rotateX = -rotateY;
32521            rotateY = 0;
32522          } else if (rtl) {
32523            rotateY = -rotateY;
32524          }
32525          slideEl.style.zIndex = -Math.abs(Math.round(progress)) + slides.length;
32526          if (params.slideShadows) {
32527            createSlideShadows(slideEl, progress, params);
32528          }
32529          const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
32530          const targetEl = effectTarget(params, slideEl);
32531          targetEl.style.transform = transform;
32532        }
32533      };
32534      const setTransition = duration => {
32535        const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));
32536        transformElements.forEach(el => {
32537          el.style.transitionDuration = `${duration}ms`;
32538          el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => {
32539            shadowEl.style.transitionDuration = `${duration}ms`;
32540          });
32541        });
32542        effectVirtualTransitionEnd({
32543          swiper,
32544          duration,
32545          transformElements
32546        });
32547      };
32548      effectInit({
32549        effect: 'flip',
32550        swiper,
32551        on,
32552        setTranslate,
32553        setTransition,
32554        recreateShadows,
32555        getEffectParams: () => swiper.params.flipEffect,
32556        perspective: () => true,
32557        overwriteParams: () => ({
32558          slidesPerView: 1,
32559          slidesPerGroup: 1,
32560          watchSlidesProgress: true,
32561          spaceBetween: 0,
32562          virtualTranslate: !swiper.params.cssMode
32563        })
32564      });
32565    }
32566
32567    function EffectCoverflow(_ref) {
32568      let {
32569        swiper,
32570        extendParams,
32571        on
32572      } = _ref;
32573      extendParams({
32574        coverflowEffect: {
32575          rotate: 50,
32576          stretch: 0,
32577          depth: 100,
32578          scale: 1,
32579          modifier: 1,
32580          slideShadows: true
32581        }
32582      });
32583      const setTranslate = () => {
32584        const {
32585          width: swiperWidth,
32586          height: swiperHeight,
32587          slides,
32588          slidesSizesGrid
32589        } = swiper;
32590        const params = swiper.params.coverflowEffect;
32591        const isHorizontal = swiper.isHorizontal();
32592        const transform = swiper.translate;
32593        const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2;
32594        const rotate = isHorizontal ? params.rotate : -params.rotate;
32595        const translate = params.depth;
32596        // Each slide offset from center
32597        for (let i = 0, length = slides.length; i < length; i += 1) {
32598          const slideEl = slides[i];
32599          const slideSize = slidesSizesGrid[i];
32600          const slideOffset = slideEl.swiperSlideOffset;
32601          const centerOffset = (center - slideOffset - slideSize / 2) / slideSize;
32602          const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier;
32603          let rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
32604          let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier;
32605          // var rotateZ = 0
32606          let translateZ = -translate * Math.abs(offsetMultiplier);
32607          let stretch = params.stretch;
32608          // Allow percentage to make a relative stretch for responsive sliders
32609          if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) {
32610            stretch = parseFloat(params.stretch) / 100 * slideSize;
32611          }
32612          let translateY = isHorizontal ? 0 : stretch * offsetMultiplier;
32613          let translateX = isHorizontal ? stretch * offsetMultiplier : 0;
32614          let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier);
32615
32616          // Fix for ultra small values
32617          if (Math.abs(translateX) < 0.001) translateX = 0;
32618          if (Math.abs(translateY) < 0.001) translateY = 0;
32619          if (Math.abs(translateZ) < 0.001) translateZ = 0;
32620          if (Math.abs(rotateY) < 0.001) rotateY = 0;
32621          if (Math.abs(rotateX) < 0.001) rotateX = 0;
32622          if (Math.abs(scale) < 0.001) scale = 0;
32623          const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px)  rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`;
32624          const targetEl = effectTarget(params, slideEl);
32625          targetEl.style.transform = slideTransform;
32626          slideEl.style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
32627          if (params.slideShadows) {
32628            // Set shadows
32629            let shadowBeforeEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top');
32630            let shadowAfterEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom');
32631            if (!shadowBeforeEl) {
32632              shadowBeforeEl = createShadow(params, slideEl, isHorizontal ? 'left' : 'top');
32633            }
32634            if (!shadowAfterEl) {
32635              shadowAfterEl = createShadow(params, slideEl, isHorizontal ? 'right' : 'bottom');
32636            }
32637            if (shadowBeforeEl) shadowBeforeEl.style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
32638            if (shadowAfterEl) shadowAfterEl.style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
32639          }
32640        }
32641      };
32642      const setTransition = duration => {
32643        const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));
32644        transformElements.forEach(el => {
32645          el.style.transitionDuration = `${duration}ms`;
32646          el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => {
32647            shadowEl.style.transitionDuration = `${duration}ms`;
32648          });
32649        });
32650      };
32651      effectInit({
32652        effect: 'coverflow',
32653        swiper,
32654        on,
32655        setTranslate,
32656        setTransition,
32657        perspective: () => true,
32658        overwriteParams: () => ({
32659          watchSlidesProgress: true
32660        })
32661      });
32662    }
32663
32664    function EffectCreative(_ref) {
32665      let {
32666        swiper,
32667        extendParams,
32668        on
32669      } = _ref;
32670      extendParams({
32671        creativeEffect: {
32672          limitProgress: 1,
32673          shadowPerProgress: false,
32674          progressMultiplier: 1,
32675          perspective: true,
32676          prev: {
32677            translate: [0, 0, 0],
32678            rotate: [0, 0, 0],
32679            opacity: 1,
32680            scale: 1
32681          },
32682          next: {
32683            translate: [0, 0, 0],
32684            rotate: [0, 0, 0],
32685            opacity: 1,
32686            scale: 1
32687          }
32688        }
32689      });
32690      const getTranslateValue = value => {
32691        if (typeof value === 'string') return value;
32692        return `${value}px`;
32693      };
32694      const setTranslate = () => {
32695        const {
32696          slides,
32697          wrapperEl,
32698          slidesSizesGrid
32699        } = swiper;
32700        const params = swiper.params.creativeEffect;
32701        const {
32702          progressMultiplier: multiplier
32703        } = params;
32704        const isCenteredSlides = swiper.params.centeredSlides;
32705        if (isCenteredSlides) {
32706          const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0;
32707          wrapperEl.style.transform = `translateX(calc(50% - ${margin}px))`;
32708        }
32709        for (let i = 0; i < slides.length; i += 1) {
32710          const slideEl = slides[i];
32711          const slideProgress = slideEl.progress;
32712          const progress = Math.min(Math.max(slideEl.progress, -params.limitProgress), params.limitProgress);
32713          let originalProgress = progress;
32714          if (!isCenteredSlides) {
32715            originalProgress = Math.min(Math.max(slideEl.originalProgress, -params.limitProgress), params.limitProgress);
32716          }
32717          const offset = slideEl.swiperSlideOffset;
32718          const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0];
32719          const r = [0, 0, 0];
32720          let custom = false;
32721          if (!swiper.isHorizontal()) {
32722            t[1] = t[0];
32723            t[0] = 0;
32724          }
32725          let data = {
32726            translate: [0, 0, 0],
32727            rotate: [0, 0, 0],
32728            scale: 1,
32729            opacity: 1
32730          };
32731          if (progress < 0) {
32732            data = params.next;
32733            custom = true;
32734          } else if (progress > 0) {
32735            data = params.prev;
32736            custom = true;
32737          }
32738          // set translate
32739          t.forEach((value, index) => {
32740            t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`;
32741          });
32742          // set rotates
32743          r.forEach((value, index) => {
32744            r[index] = data.rotate[index] * Math.abs(progress * multiplier);
32745          });
32746          slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;
32747          const translateString = t.join(', ');
32748          const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`;
32749          const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`;
32750          const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier;
32751          const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`;
32752
32753          // Set shadows
32754          if (custom && data.shadow || !custom) {
32755            let shadowEl = slideEl.querySelector('.swiper-slide-shadow');
32756            if (!shadowEl && data.shadow) {
32757              shadowEl = createShadow(params, slideEl);
32758            }
32759            if (shadowEl) {
32760              const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress;
32761              shadowEl.style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1);
32762            }
32763          }
32764          const targetEl = effectTarget(params, slideEl);
32765          targetEl.style.transform = transform;
32766          targetEl.style.opacity = opacityString;
32767          if (data.origin) {
32768            targetEl.style.transformOrigin = data.origin;
32769          }
32770        }
32771      };
32772      const setTransition = duration => {
32773        const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));
32774        transformElements.forEach(el => {
32775          el.style.transitionDuration = `${duration}ms`;
32776          el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => {
32777            shadowEl.style.transitionDuration = `${duration}ms`;
32778          });
32779        });
32780        effectVirtualTransitionEnd({
32781          swiper,
32782          duration,
32783          transformElements,
32784          allSlides: true
32785        });
32786      };
32787      effectInit({
32788        effect: 'creative',
32789        swiper,
32790        on,
32791        setTranslate,
32792        setTransition,
32793        perspective: () => swiper.params.creativeEffect.perspective,
32794        overwriteParams: () => ({
32795          watchSlidesProgress: true,
32796          virtualTranslate: !swiper.params.cssMode
32797        })
32798      });
32799    }
32800
32801    function EffectCards(_ref) {
32802      let {
32803        swiper,
32804        extendParams,
32805        on
32806      } = _ref;
32807      extendParams({
32808        cardsEffect: {
32809          slideShadows: true,
32810          rotate: true,
32811          perSlideRotate: 2,
32812          perSlideOffset: 8
32813        }
32814      });
32815      const setTranslate = () => {
32816        const {
32817          slides,
32818          activeIndex,
32819          rtlTranslate: rtl
32820        } = swiper;
32821        const params = swiper.params.cardsEffect;
32822        const {
32823          startTranslate,
32824          isTouched
32825        } = swiper.touchEventsData;
32826        const currentTranslate = rtl ? -swiper.translate : swiper.translate;
32827        for (let i = 0; i < slides.length; i += 1) {
32828          const slideEl = slides[i];
32829          const slideProgress = slideEl.progress;
32830          const progress = Math.min(Math.max(slideProgress, -4), 4);
32831          let offset = slideEl.swiperSlideOffset;
32832          if (swiper.params.centeredSlides && !swiper.params.cssMode) {
32833            swiper.wrapperEl.style.transform = `translateX(${swiper.minTranslate()}px)`;
32834          }
32835          if (swiper.params.centeredSlides && swiper.params.cssMode) {
32836            offset -= slides[0].swiperSlideOffset;
32837          }
32838          let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset;
32839          let tY = 0;
32840          const tZ = -100 * Math.abs(progress);
32841          let scale = 1;
32842          let rotate = -params.perSlideRotate * progress;
32843          let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75;
32844          const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i;
32845          const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate;
32846          const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate;
32847          if (isSwipeToNext || isSwipeToPrev) {
32848            const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5;
32849            rotate += -28 * progress * subProgress;
32850            scale += -0.5 * subProgress;
32851            tXAdd += 96 * subProgress;
32852            tY = `${-25 * subProgress * Math.abs(progress)}%`;
32853          }
32854          if (progress < 0) {
32855            // next
32856            tX = `calc(${tX}px ${rtl ? '-' : '+'} (${tXAdd * Math.abs(progress)}%))`;
32857          } else if (progress > 0) {
32858            // prev
32859            tX = `calc(${tX}px ${rtl ? '-' : '+'} (-${tXAdd * Math.abs(progress)}%))`;
32860          } else {
32861            tX = `${tX}px`;
32862          }
32863          if (!swiper.isHorizontal()) {
32864            const prevY = tY;
32865            tY = tX;
32866            tX = prevY;
32867          }
32868          const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`;
32869
32870          /* eslint-disable */
32871          const transform = `
32872        translate3d(${tX}, ${tY}, ${tZ}px)
32873        rotateZ(${params.rotate ? rtl ? -rotate : rotate : 0}deg)
32874        scale(${scaleString})
32875      `;
32876          /* eslint-enable */
32877
32878          if (params.slideShadows) {
32879            // Set shadows
32880            let shadowEl = slideEl.querySelector('.swiper-slide-shadow');
32881            if (!shadowEl) {
32882              shadowEl = createShadow(params, slideEl);
32883            }
32884            if (shadowEl) shadowEl.style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1);
32885          }
32886          slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;
32887          const targetEl = effectTarget(params, slideEl);
32888          targetEl.style.transform = transform;
32889        }
32890      };
32891      const setTransition = duration => {
32892        const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));
32893        transformElements.forEach(el => {
32894          el.style.transitionDuration = `${duration}ms`;
32895          el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => {
32896            shadowEl.style.transitionDuration = `${duration}ms`;
32897          });
32898        });
32899        effectVirtualTransitionEnd({
32900          swiper,
32901          duration,
32902          transformElements
32903        });
32904      };
32905      effectInit({
32906        effect: 'cards',
32907        swiper,
32908        on,
32909        setTranslate,
32910        setTransition,
32911        perspective: () => true,
32912        overwriteParams: () => ({
32913          watchSlidesProgress: true,
32914          virtualTranslate: !swiper.params.cssMode
32915        })
32916      });
32917    }
32918
32919    // Swiper Class
32920    const modules = [Virtual, Keyboard, Mousewheel, Navigation, Pagination, Scrollbar, Parallax, Zoom, Controller, A11y, History, HashNavigation, Autoplay, Thumb, freeMode, Grid, Manipulation, EffectFade, EffectCube, EffectFlip, EffectCoverflow, EffectCreative, EffectCards];
32921    Swiper.use(modules);
32922
32923    return Swiper;
32924
32925}));
32926
32927
32928},{}],195:[function(require,module,exports){
32929(function (setImmediate,clearImmediate){(function (){
32930var nextTick = require('process/browser.js').nextTick;
32931var apply = Function.prototype.apply;
32932var slice = Array.prototype.slice;
32933var immediateIds = {};
32934var nextImmediateId = 0;
32935
32936// DOM APIs, for completeness
32937
32938exports.setTimeout = function() {
32939  return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
32940};
32941exports.setInterval = function() {
32942  return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
32943};
32944exports.clearTimeout =
32945exports.clearInterval = function(timeout) { timeout.close(); };
32946
32947function Timeout(id, clearFn) {
32948  this._id = id;
32949  this._clearFn = clearFn;
32950}
32951Timeout.prototype.unref = Timeout.prototype.ref = function() {};
32952Timeout.prototype.close = function() {
32953  this._clearFn.call(window, this._id);
32954};
32955
32956// Does not start the time, just sets up the members needed.
32957exports.enroll = function(item, msecs) {
32958  clearTimeout(item._idleTimeoutId);
32959  item._idleTimeout = msecs;
32960};
32961
32962exports.unenroll = function(item) {
32963  clearTimeout(item._idleTimeoutId);
32964  item._idleTimeout = -1;
32965};
32966
32967exports._unrefActive = exports.active = function(item) {
32968  clearTimeout(item._idleTimeoutId);
32969
32970  var msecs = item._idleTimeout;
32971  if (msecs >= 0) {
32972    item._idleTimeoutId = setTimeout(function onTimeout() {
32973      if (item._onTimeout)
32974        item._onTimeout();
32975    }, msecs);
32976  }
32977};
32978
32979// That's not how node.js implements it but the exposed api is the same.
32980exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
32981  var id = nextImmediateId++;
32982  var args = arguments.length < 2 ? false : slice.call(arguments, 1);
32983
32984  immediateIds[id] = true;
32985
32986  nextTick(function onNextTick() {
32987    if (immediateIds[id]) {
32988      // fn.call() is faster so we optimize for the common use-case
32989      // @see http://jsperf.com/call-apply-segu
32990      if (args) {
32991        fn.apply(null, args);
32992      } else {
32993        fn.call(null);
32994      }
32995      // Prevent ids from leaking
32996      exports.clearImmediate(id);
32997    }
32998  });
32999
33000  return id;
33001};
33002
33003exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
33004  delete immediateIds[id];
33005};
33006}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
33007},{"process/browser.js":185,"timers":195}],196:[function(require,module,exports){
33008module.exports = function isBuffer(arg) {
33009  return arg && typeof arg === 'object'
33010    && typeof arg.copy === 'function'
33011    && typeof arg.fill === 'function'
33012    && typeof arg.readUInt8 === 'function';
33013}
33014},{}],197:[function(require,module,exports){
33015// Currently in sync with Node.js lib/internal/util/types.js
33016// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
33017
33018'use strict';
33019
33020var isArgumentsObject = require('is-arguments');
33021var isGeneratorFunction = require('is-generator-function');
vendor: 8,574 bytes, lines 33022-33351
33022var whichTypedArray = require('which-typed-array');
33023var isTypedArray = require('is-typed-array');
33024
33025function uncurryThis(f) {
33026  return f.call.bind(f);
33027}
33028
33029var BigIntSupported = typeof BigInt !== 'undefined';
33030var SymbolSupported = typeof Symbol !== 'undefined';
33031
33032var ObjectToString = uncurryThis(Object.prototype.toString);
33033
33034var numberValue = uncurryThis(Number.prototype.valueOf);
33035var stringValue = uncurryThis(String.prototype.valueOf);
33036var booleanValue = uncurryThis(Boolean.prototype.valueOf);
33037
33038if (BigIntSupported) {
33039  var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
33040}
33041
33042if (SymbolSupported) {
33043  var symbolValue = uncurryThis(Symbol.prototype.valueOf);
33044}
33045
33046function checkBoxedPrimitive(value, prototypeValueOf) {
33047  if (typeof value !== 'object') {
33048    return false;
33049  }
33050  try {
33051    prototypeValueOf(value);
33052    return true;
33053  } catch(e) {
33054    return false;
33055  }
33056}
33057
33058exports.isArgumentsObject = isArgumentsObject;
33059exports.isGeneratorFunction = isGeneratorFunction;
33060exports.isTypedArray = isTypedArray;
33061
33062// Taken from here and modified for better browser support
33063// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
33064function isPromise(input) {
33065	return (
33066		(
33067			typeof Promise !== 'undefined' &&
33068			input instanceof Promise
33069		) ||
33070		(
33071			input !== null &&
33072			typeof input === 'object' &&
33073			typeof input.then === 'function' &&
33074			typeof input.catch === 'function'
33075		)
33076	);
33077}
33078exports.isPromise = isPromise;
33079
33080function isArrayBufferView(value) {
33081  if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
33082    return ArrayBuffer.isView(value);
33083  }
33084
33085  return (
33086    isTypedArray(value) ||
33087    isDataView(value)
33088  );
33089}
33090exports.isArrayBufferView = isArrayBufferView;
33091
33092
33093function isUint8Array(value) {
33094  return whichTypedArray(value) === 'Uint8Array';
33095}
33096exports.isUint8Array = isUint8Array;
33097
33098function isUint8ClampedArray(value) {
33099  return whichTypedArray(value) === 'Uint8ClampedArray';
33100}
33101exports.isUint8ClampedArray = isUint8ClampedArray;
33102
33103function isUint16Array(value) {
33104  return whichTypedArray(value) === 'Uint16Array';
33105}
33106exports.isUint16Array = isUint16Array;
33107
33108function isUint32Array(value) {
33109  return whichTypedArray(value) === 'Uint32Array';
33110}
33111exports.isUint32Array = isUint32Array;
33112
33113function isInt8Array(value) {
33114  return whichTypedArray(value) === 'Int8Array';
33115}
33116exports.isInt8Array = isInt8Array;
33117
33118function isInt16Array(value) {
33119  return whichTypedArray(value) === 'Int16Array';
33120}
33121exports.isInt16Array = isInt16Array;
33122
33123function isInt32Array(value) {
33124  return whichTypedArray(value) === 'Int32Array';
33125}
33126exports.isInt32Array = isInt32Array;
33127
33128function isFloat32Array(value) {
33129  return whichTypedArray(value) === 'Float32Array';
33130}
33131exports.isFloat32Array = isFloat32Array;
33132
33133function isFloat64Array(value) {
33134  return whichTypedArray(value) === 'Float64Array';
33135}
33136exports.isFloat64Array = isFloat64Array;
33137
33138function isBigInt64Array(value) {
33139  return whichTypedArray(value) === 'BigInt64Array';
33140}
33141exports.isBigInt64Array = isBigInt64Array;
33142
33143function isBigUint64Array(value) {
33144  return whichTypedArray(value) === 'BigUint64Array';
33145}
33146exports.isBigUint64Array = isBigUint64Array;
33147
33148function isMapToString(value) {
33149  return ObjectToString(value) === '[object Map]';
33150}
33151isMapToString.working = (
33152  typeof Map !== 'undefined' &&
33153  isMapToString(new Map())
33154);
33155
33156function isMap(value) {
33157  if (typeof Map === 'undefined') {
33158    return false;
33159  }
33160
33161  return isMapToString.working
33162    ? isMapToString(value)
33163    : value instanceof Map;
33164}
33165exports.isMap = isMap;
33166
33167function isSetToString(value) {
33168  return ObjectToString(value) === '[object Set]';
33169}
33170isSetToString.working = (
33171  typeof Set !== 'undefined' &&
33172  isSetToString(new Set())
33173);
33174function isSet(value) {
33175  if (typeof Set === 'undefined') {
33176    return false;
33177  }
33178
33179  return isSetToString.working
33180    ? isSetToString(value)
33181    : value instanceof Set;
33182}
33183exports.isSet = isSet;
33184
33185function isWeakMapToString(value) {
33186  return ObjectToString(value) === '[object WeakMap]';
33187}
33188isWeakMapToString.working = (
33189  typeof WeakMap !== 'undefined' &&
33190  isWeakMapToString(new WeakMap())
33191);
33192function isWeakMap(value) {
33193  if (typeof WeakMap === 'undefined') {
33194    return false;
33195  }
33196
33197  return isWeakMapToString.working
33198    ? isWeakMapToString(value)
33199    : value instanceof WeakMap;
33200}
33201exports.isWeakMap = isWeakMap;
33202
33203function isWeakSetToString(value) {
33204  return ObjectToString(value) === '[object WeakSet]';
33205}
33206isWeakSetToString.working = (
33207  typeof WeakSet !== 'undefined' &&
33208  isWeakSetToString(new WeakSet())
33209);
33210function isWeakSet(value) {
33211  return isWeakSetToString(value);
33212}
33213exports.isWeakSet = isWeakSet;
33214
33215function isArrayBufferToString(value) {
33216  return ObjectToString(value) === '[object ArrayBuffer]';
33217}
33218isArrayBufferToString.working = (
33219  typeof ArrayBuffer !== 'undefined' &&
33220  isArrayBufferToString(new ArrayBuffer())
33221);
33222function isArrayBuffer(value) {
33223  if (typeof ArrayBuffer === 'undefined') {
33224    return false;
33225  }
33226
33227  return isArrayBufferToString.working
33228    ? isArrayBufferToString(value)
33229    : value instanceof ArrayBuffer;
33230}
33231exports.isArrayBuffer = isArrayBuffer;
33232
33233function isDataViewToString(value) {
33234  return ObjectToString(value) === '[object DataView]';
33235}
33236isDataViewToString.working = (
33237  typeof ArrayBuffer !== 'undefined' &&
33238  typeof DataView !== 'undefined' &&
33239  isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
33240);
33241function isDataView(value) {
33242  if (typeof DataView === 'undefined') {
33243    return false;
33244  }
33245
33246  return isDataViewToString.working
33247    ? isDataViewToString(value)
33248    : value instanceof DataView;
33249}
33250exports.isDataView = isDataView;
33251
33252// Store a copy of SharedArrayBuffer in case it's deleted elsewhere
33253var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
33254function isSharedArrayBufferToString(value) {
33255  return ObjectToString(value) === '[object SharedArrayBuffer]';
33256}
33257function isSharedArrayBuffer(value) {
33258  if (typeof SharedArrayBufferCopy === 'undefined') {
33259    return false;
33260  }
33261
33262  if (typeof isSharedArrayBufferToString.working === 'undefined') {
33263    isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
33264  }
33265
33266  return isSharedArrayBufferToString.working
33267    ? isSharedArrayBufferToString(value)
33268    : value instanceof SharedArrayBufferCopy;
33269}
33270exports.isSharedArrayBuffer = isSharedArrayBuffer;
33271
33272function isAsyncFunction(value) {
33273  return ObjectToString(value) === '[object AsyncFunction]';
33274}
33275exports.isAsyncFunction = isAsyncFunction;
33276
33277function isMapIterator(value) {
33278  return ObjectToString(value) === '[object Map Iterator]';
33279}
33280exports.isMapIterator = isMapIterator;
33281
33282function isSetIterator(value) {
33283  return ObjectToString(value) === '[object Set Iterator]';
33284}
33285exports.isSetIterator = isSetIterator;
33286
33287function isGeneratorObject(value) {
33288  return ObjectToString(value) === '[object Generator]';
33289}
33290exports.isGeneratorObject = isGeneratorObject;
33291
33292function isWebAssemblyCompiledModule(value) {
33293  return ObjectToString(value) === '[object WebAssembly.Module]';
33294}
33295exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
33296
33297function isNumberObject(value) {
33298  return checkBoxedPrimitive(value, numberValue);
33299}
33300exports.isNumberObject = isNumberObject;
33301
33302function isStringObject(value) {
33303  return checkBoxedPrimitive(value, stringValue);
33304}
33305exports.isStringObject = isStringObject;
33306
33307function isBooleanObject(value) {
33308  return checkBoxedPrimitive(value, booleanValue);
33309}
33310exports.isBooleanObject = isBooleanObject;
33311
33312function isBigIntObject(value) {
33313  return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
33314}
33315exports.isBigIntObject = isBigIntObject;
33316
33317function isSymbolObject(value) {
33318  return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
33319}
33320exports.isSymbolObject = isSymbolObject;
33321
33322function isBoxedPrimitive(value) {
33323  return (
33324    isNumberObject(value) ||
33325    isStringObject(value) ||
33326    isBooleanObject(value) ||
33327    isBigIntObject(value) ||
33328    isSymbolObject(value)
33329  );
33330}
33331exports.isBoxedPrimitive = isBoxedPrimitive;
33332
33333function isAnyArrayBuffer(value) {
33334  return typeof Uint8Array !== 'undefined' && (
33335    isArrayBuffer(value) ||
33336    isSharedArrayBuffer(value)
33337  );
33338}
33339exports.isAnyArrayBuffer = isAnyArrayBuffer;
33340
33341['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
33342  Object.defineProperty(exports, method, {
33343    enumerable: false,
33344    value: function() {
33345      throw new Error(method + ' is not supported in userland');
33346    }
33347  });
33348});
33349
33350},{"is-arguments":166,"is-generator-function":168,"is-typed-array":170,"which-typed-array":200}],198:[function(require,module,exports){
33351(function (process){(function (){
vendor: 12,724 bytes, lines 33351-33818
33351
33352// Copyright Joyent, Inc. and other Node contributors.
33353//
33354// Permission is hereby granted, free of charge, to any person obtaining a
33355// copy of this software and associated documentation files (the
33356// "Software"), to deal in the Software without restriction, including
33357// without limitation the rights to use, copy, modify, merge, publish,
33358// distribute, sublicense, and/or sell copies of the Software, and to permit
33359// persons to whom the Software is furnished to do so, subject to the
33360// following conditions:
33361//
33362// The above copyright notice and this permission notice shall be included
33363// in all copies or substantial portions of the Software.
33364//
33365// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33366// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33367// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
33368// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
33369// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
33370// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
33371// USE OR OTHER DEALINGS IN THE SOFTWARE.
33372
33373var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
33374  function getOwnPropertyDescriptors(obj) {
33375    var keys = Object.keys(obj);
33376    var descriptors = {};
33377    for (var i = 0; i < keys.length; i++) {
33378      descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
33379    }
33380    return descriptors;
33381  };
33382
33383var formatRegExp = /%[sdj%]/g;
33384exports.format = function(f) {
33385  if (!isString(f)) {
33386    var objects = [];
33387    for (var i = 0; i < arguments.length; i++) {
33388      objects.push(inspect(arguments[i]));
33389    }
33390    return objects.join(' ');
33391  }
33392
33393  var i = 1;
33394  var args = arguments;
33395  var len = args.length;
33396  var str = String(f).replace(formatRegExp, function(x) {
33397    if (x === '%%') return '%';
33398    if (i >= len) return x;
33399    switch (x) {
33400      case '%s': return String(args[i++]);
33401      case '%d': return Number(args[i++]);
33402      case '%j':
33403        try {
33404          return JSON.stringify(args[i++]);
33405        } catch (_) {
33406          return '[Circular]';
33407        }
33408      default:
33409        return x;
33410    }
33411  });
33412  for (var x = args[i]; i < len; x = args[++i]) {
33413    if (isNull(x) || !isObject(x)) {
33414      str += ' ' + x;
33415    } else {
33416      str += ' ' + inspect(x);
33417    }
33418  }
33419  return str;
33420};
33421
33422
33423// Mark that a method should not be used.
33424// Returns a modified function which warns once by default.
33425// If --no-deprecation is set, then it is a no-op.
33426exports.deprecate = function(fn, msg) {
33427  if (typeof process !== 'undefined' && process.noDeprecation === true) {
33428    return fn;
33429  }
33430
33431  // Allow for deprecating things in the process of starting up.
33432  if (typeof process === 'undefined') {
33433    return function() {
33434      return exports.deprecate(fn, msg).apply(this, arguments);
33435    };
33436  }
33437
33438  var warned = false;
33439  function deprecated() {
33440    if (!warned) {
33441      if (process.throwDeprecation) {
33442        throw new Error(msg);
33443      } else if (process.traceDeprecation) {
33444        console.trace(msg);
33445      } else {
33446        console.error(msg);
33447      }
33448      warned = true;
33449    }
33450    return fn.apply(this, arguments);
33451  }
33452
33453  return deprecated;
33454};
33455
33456
33457var debugs = {};
33458var debugEnvRegex = /^$/;
33459
33460if (process.env.NODE_DEBUG) {
33461  var debugEnv = process.env.NODE_DEBUG;
33462  debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
33463    .replace(/\*/g, '.*')
33464    .replace(/,/g, '$|^')
33465    .toUpperCase();
33466  debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
33467}
33468exports.debuglog = function(set) {
33469  set = set.toUpperCase();
33470  if (!debugs[set]) {
33471    if (debugEnvRegex.test(set)) {
33472      var pid = process.pid;
33473      debugs[set] = function() {
33474        var msg = exports.format.apply(exports, arguments);
33475        console.error('%s %d: %s', set, pid, msg);
33476      };
33477    } else {
33478      debugs[set] = function() {};
33479    }
33480  }
33481  return debugs[set];
33482};
33483
33484
33485/**
33486 * Echos the value of a value. Trys to print the value out
33487 * in the best way possible given the different types.
33488 *
33489 * @param {Object} obj The object to print out.
33490 * @param {Object} opts Optional options object that alters the output.
33491 */
33492/* legacy: obj, showHidden, depth, colors*/
33493function inspect(obj, opts) {
33494  // default options
33495  var ctx = {
33496    seen: [],
33497    stylize: stylizeNoColor
33498  };
33499  // legacy...
33500  if (arguments.length >= 3) ctx.depth = arguments[2];
33501  if (arguments.length >= 4) ctx.colors = arguments[3];
33502  if (isBoolean(opts)) {
33503    // legacy...
33504    ctx.showHidden = opts;
33505  } else if (opts) {
33506    // got an "options" object
33507    exports._extend(ctx, opts);
33508  }
33509  // set default options
33510  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
33511  if (isUndefined(ctx.depth)) ctx.depth = 2;
33512  if (isUndefined(ctx.colors)) ctx.colors = false;
33513  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
33514  if (ctx.colors) ctx.stylize = stylizeWithColor;
33515  return formatValue(ctx, obj, ctx.depth);
33516}
33517exports.inspect = inspect;
33518
33519
33520// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
33521inspect.colors = {
33522  'bold' : [1, 22],
33523  'italic' : [3, 23],
33524  'underline' : [4, 24],
33525  'inverse' : [7, 27],
33526  'white' : [37, 39],
33527  'grey' : [90, 39],
33528  'black' : [30, 39],
33529  'blue' : [34, 39],
33530  'cyan' : [36, 39],
33531  'green' : [32, 39],
33532  'magenta' : [35, 39],
33533  'red' : [31, 39],
33534  'yellow' : [33, 39]
33535};
33536
33537// Don't use 'blue' not visible on cmd.exe
33538inspect.styles = {
33539  'special': 'cyan',
33540  'number': 'yellow',
33541  'boolean': 'yellow',
33542  'undefined': 'grey',
33543  'null': 'bold',
33544  'string': 'green',
33545  'date': 'magenta',
33546  // "name": intentionally not styling
33547  'regexp': 'red'
33548};
33549
33550
33551function stylizeWithColor(str, styleType) {
33552  var style = inspect.styles[styleType];
33553
33554  if (style) {
33555    return '\u001b[' + inspect.colors[style][0] + 'm' + str +
33556           '\u001b[' + inspect.colors[style][1] + 'm';
33557  } else {
33558    return str;
33559  }
33560}
33561
33562
33563function stylizeNoColor(str, styleType) {
33564  return str;
33565}
33566
33567
33568function arrayToHash(array) {
33569  var hash = {};
33570
33571  array.forEach(function(val, idx) {
33572    hash[val] = true;
33573  });
33574
33575  return hash;
33576}
33577
33578
33579function formatValue(ctx, value, recurseTimes) {
33580  // Provide a hook for user-specified inspect functions.
33581  // Check that value is an object with an inspect function on it
33582  if (ctx.customInspect &&
33583      value &&
33584      isFunction(value.inspect) &&
33585      // Filter out the util module, it's inspect function is special
33586      value.inspect !== exports.inspect &&
33587      // Also filter out any prototype objects using the circular check.
33588      !(value.constructor && value.constructor.prototype === value)) {
33589    var ret = value.inspect(recurseTimes, ctx);
33590    if (!isString(ret)) {
33591      ret = formatValue(ctx, ret, recurseTimes);
33592    }
33593    return ret;
33594  }
33595
33596  // Primitive types cannot have properties
33597  var primitive = formatPrimitive(ctx, value);
33598  if (primitive) {
33599    return primitive;
33600  }
33601
33602  // Look up the keys of the object.
33603  var keys = Object.keys(value);
33604  var visibleKeys = arrayToHash(keys);
33605
33606  if (ctx.showHidden) {
33607    keys = Object.getOwnPropertyNames(value);
33608  }
33609
33610  // IE doesn't make error fields non-enumerable
33611  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
33612  if (isError(value)
33613      && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
33614    return formatError(value);
33615  }
33616
33617  // Some type of object without properties can be shortcutted.
33618  if (keys.length === 0) {
33619    if (isFunction(value)) {
33620      var name = value.name ? ': ' + value.name : '';
33621      return ctx.stylize('[Function' + name + ']', 'special');
33622    }
33623    if (isRegExp(value)) {
33624      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
33625    }
33626    if (isDate(value)) {
33627      return ctx.stylize(Date.prototype.toString.call(value), 'date');
33628    }
33629    if (isError(value)) {
33630      return formatError(value);
33631    }
33632  }
33633
33634  var base = '', array = false, braces = ['{', '}'];
33635
33636  // Make Array say that they are Array
33637  if (isArray(value)) {
33638    array = true;
33639    braces = ['[', ']'];
33640  }
33641
33642  // Make functions say that they are functions
33643  if (isFunction(value)) {
33644    var n = value.name ? ': ' + value.name : '';
33645    base = ' [Function' + n + ']';
33646  }
33647
33648  // Make RegExps say that they are RegExps
33649  if (isRegExp(value)) {
33650    base = ' ' + RegExp.prototype.toString.call(value);
33651  }
33652
33653  // Make dates with properties first say the date
33654  if (isDate(value)) {
33655    base = ' ' + Date.prototype.toUTCString.call(value);
33656  }
33657
33658  // Make error with message first say the error
33659  if (isError(value)) {
33660    base = ' ' + formatError(value);
33661  }
33662
33663  if (keys.length === 0 && (!array || value.length == 0)) {
33664    return braces[0] + base + braces[1];
33665  }
33666
33667  if (recurseTimes < 0) {
33668    if (isRegExp(value)) {
33669      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
33670    } else {
33671      return ctx.stylize('[Object]', 'special');
33672    }
33673  }
33674
33675  ctx.seen.push(value);
33676
33677  var output;
33678  if (array) {
33679    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
33680  } else {
33681    output = keys.map(function(key) {
33682      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
33683    });
33684  }
33685
33686  ctx.seen.pop();
33687
33688  return reduceToSingleString(output, base, braces);
33689}
33690
33691
33692function formatPrimitive(ctx, value) {
33693  if (isUndefined(value))
33694    return ctx.stylize('undefined', 'undefined');
33695  if (isString(value)) {
33696    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
33697                                             .replace(/'/g, "\\'")
33698                                             .replace(/\\"/g, '"') + '\'';
33699    return ctx.stylize(simple, 'string');
33700  }
33701  if (isNumber(value))
33702    return ctx.stylize('' + value, 'number');
33703  if (isBoolean(value))
33704    return ctx.stylize('' + value, 'boolean');
33705  // For some reason typeof null is "object", so special case here.
33706  if (isNull(value))
33707    return ctx.stylize('null', 'null');
33708}
33709
33710
33711function formatError(value) {
33712  return '[' + Error.prototype.toString.call(value) + ']';
33713}
33714
33715
33716function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
33717  var output = [];
33718  for (var i = 0, l = value.length; i < l; ++i) {
33719    if (hasOwnProperty(value, String(i))) {
33720      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
33721          String(i), true));
33722    } else {
33723      output.push('');
33724    }
33725  }
33726  keys.forEach(function(key) {
33727    if (!key.match(/^\d+$/)) {
33728      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
33729          key, true));
33730    }
33731  });
33732  return output;
33733}
33734
33735
33736function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
33737  var name, str, desc;
33738  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
33739  if (desc.get) {
33740    if (desc.set) {
33741      str = ctx.stylize('[Getter/Setter]', 'special');
33742    } else {
33743      str = ctx.stylize('[Getter]', 'special');
33744    }
33745  } else {
33746    if (desc.set) {
33747      str = ctx.stylize('[Setter]', 'special');
33748    }
33749  }
33750  if (!hasOwnProperty(visibleKeys, key)) {
33751    name = '[' + key + ']';
33752  }
33753  if (!str) {
33754    if (ctx.seen.indexOf(desc.value) < 0) {
33755      if (isNull(recurseTimes)) {
33756        str = formatValue(ctx, desc.value, null);
33757      } else {
33758        str = formatValue(ctx, desc.value, recurseTimes - 1);
33759      }
33760      if (str.indexOf('\n') > -1) {
33761        if (array) {
33762          str = str.split('\n').map(function(line) {
33763            return '  ' + line;
33764          }).join('\n').slice(2);
33765        } else {
33766          str = '\n' + str.split('\n').map(function(line) {
33767            return '   ' + line;
33768          }).join('\n');
33769        }
33770      }
33771    } else {
33772      str = ctx.stylize('[Circular]', 'special');
33773    }
33774  }
33775  if (isUndefined(name)) {
33776    if (array && key.match(/^\d+$/)) {
33777      return str;
33778    }
33779    name = JSON.stringify('' + key);
33780    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
33781      name = name.slice(1, -1);
33782      name = ctx.stylize(name, 'name');
33783    } else {
33784      name = name.replace(/'/g, "\\'")
33785                 .replace(/\\"/g, '"')
33786                 .replace(/(^"|"$)/g, "'");
33787      name = ctx.stylize(name, 'string');
33788    }
33789  }
33790
33791  return name + ': ' + str;
33792}
33793
33794
33795function reduceToSingleString(output, base, braces) {
33796  var numLinesEst = 0;
33797  var length = output.reduce(function(prev, cur) {
33798    numLinesEst++;
33799    if (cur.indexOf('\n') >= 0) numLinesEst++;
33800    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
33801  }, 0);
33802
33803  if (length > 60) {
33804    return braces[0] +
33805           (base === '' ? '' : base + '\n ') +
33806           ' ' +
33807           output.join(',\n  ') +
33808           ' ' +
33809           braces[1];
33810  }
33811
33812  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
33813}
33814
33815
33816// NOTE: These type checking functions intentionally don't use `instanceof`
33817// because it is fragile and can be easily faked with `Object.create()`.
33818exports.types = 
vendor: 3,338 bytes, lines 33818-33951
33818require('./support/types');
33819
33820function isArray(ar) {
33821  return Array.isArray(ar);
33822}
33823exports.isArray = isArray;
33824
33825function isBoolean(arg) {
33826  return typeof arg === 'boolean';
33827}
33828exports.isBoolean = isBoolean;
33829
33830function isNull(arg) {
33831  return arg === null;
33832}
33833exports.isNull = isNull;
33834
33835function isNullOrUndefined(arg) {
33836  return arg == null;
33837}
33838exports.isNullOrUndefined = isNullOrUndefined;
33839
33840function isNumber(arg) {
33841  return typeof arg === 'number';
33842}
33843exports.isNumber = isNumber;
33844
33845function isString(arg) {
33846  return typeof arg === 'string';
33847}
33848exports.isString = isString;
33849
33850function isSymbol(arg) {
33851  return typeof arg === 'symbol';
33852}
33853exports.isSymbol = isSymbol;
33854
33855function isUndefined(arg) {
33856  return arg === void 0;
33857}
33858exports.isUndefined = isUndefined;
33859
33860function isRegExp(re) {
33861  return isObject(re) && objectToString(re) === '[object RegExp]';
33862}
33863exports.isRegExp = isRegExp;
33864exports.types.isRegExp = isRegExp;
33865
33866function isObject(arg) {
33867  return typeof arg === 'object' && arg !== null;
33868}
33869exports.isObject = isObject;
33870
33871function isDate(d) {
33872  return isObject(d) && objectToString(d) === '[object Date]';
33873}
33874exports.isDate = isDate;
33875exports.types.isDate = isDate;
33876
33877function isError(e) {
33878  return isObject(e) &&
33879      (objectToString(e) === '[object Error]' || e instanceof Error);
33880}
33881exports.isError = isError;
33882exports.types.isNativeError = isError;
33883
33884function isFunction(arg) {
33885  return typeof arg === 'function';
33886}
33887exports.isFunction = isFunction;
33888
33889function isPrimitive(arg) {
33890  return arg === null ||
33891         typeof arg === 'boolean' ||
33892         typeof arg === 'number' ||
33893         typeof arg === 'string' ||
33894         typeof arg === 'symbol' ||  // ES6 symbol
33895         typeof arg === 'undefined';
33896}
33897exports.isPrimitive = isPrimitive;
33898
33899exports.isBuffer = require('./support/isBuffer');
33900
33901function objectToString(o) {
33902  return Object.prototype.toString.call(o);
33903}
33904
33905
33906function pad(n) {
33907  return n < 10 ? '0' + n.toString(10) : n.toString(10);
33908}
33909
33910
33911var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
33912              'Oct', 'Nov', 'Dec'];
33913
33914// 26 Feb 16:19:34
33915function timestamp() {
33916  var d = new Date();
33917  var time = [pad(d.getHours()),
33918              pad(d.getMinutes()),
33919              pad(d.getSeconds())].join(':');
33920  return [d.getDate(), months[d.getMonth()], time].join(' ');
33921}
33922
33923
33924// log is just a thin wrapper to console.log that prepends a timestamp
33925exports.log = function() {
33926  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
33927};
33928
33929
33930/**
33931 * Inherit the prototype methods from one constructor into another.
33932 *
33933 * The Function.prototype.inherits from lang.js rewritten as a standalone
33934 * function (not on Function.prototype). NOTE: If this file is to be loaded
33935 * during bootstrapping this function needs to be rewritten using some native
33936 * functions as prototype setup using normal JavaScript does not work as
33937 * expected during bootstrapping (see mirror.js in r114903).
33938 *
33939 * @param {function} ctor Constructor function which needs to inherit the
33940 *     prototype.
33941 * @param {function} superCtor Constructor function to inherit prototype from.
33942 */
33943exports.inherits = require('inherits');
33944
33945exports._extend = function(origin, add) {
33946  // Don't do anything if add isn't an object
33947  if (!add || !isObject(add)) return origin;
33948
33949  var keys = Object.keys(add);
33950  var i = keys.length;
33951  while (i--) {
vendor: 3,804 bytes, lines 33952-34069
33952    origin[keys[i]] = add[keys[i]];
33953  }
33954  return origin;
33955};
33956
33957function hasOwnProperty(obj, prop) {
33958  return Object.prototype.hasOwnProperty.call(obj, prop);
33959}
33960
33961var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
33962
33963exports.promisify = function promisify(original) {
33964  if (typeof original !== 'function')
33965    throw new TypeError('The "original" argument must be of type Function');
33966
33967  if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
33968    var fn = original[kCustomPromisifiedSymbol];
33969    if (typeof fn !== 'function') {
33970      throw new TypeError('The "util.promisify.custom" argument must be of type Function');
33971    }
33972    Object.defineProperty(fn, kCustomPromisifiedSymbol, {
33973      value: fn, enumerable: false, writable: false, configurable: true
33974    });
33975    return fn;
33976  }
33977
33978  function fn() {
33979    var promiseResolve, promiseReject;
33980    var promise = new Promise(function (resolve, reject) {
33981      promiseResolve = resolve;
33982      promiseReject = reject;
33983    });
33984
33985    var args = [];
33986    for (var i = 0; i < arguments.length; i++) {
33987      args.push(arguments[i]);
33988    }
33989    args.push(function (err, value) {
33990      if (err) {
33991        promiseReject(err);
33992      } else {
33993        promiseResolve(value);
33994      }
33995    });
33996
33997    try {
33998      original.apply(this, args);
33999    } catch (err) {
34000      promiseReject(err);
34001    }
34002
34003    return promise;
34004  }
34005
34006  Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
34007
34008  if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
34009    value: fn, enumerable: false, writable: false, configurable: true
34010  });
34011  return Object.defineProperties(
34012    fn,
34013    getOwnPropertyDescriptors(original)
34014  );
34015}
34016
34017exports.promisify.custom = kCustomPromisifiedSymbol
34018
34019function callbackifyOnRejected(reason, cb) {
34020  // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
34021  // Because `null` is a special error value in callbacks which means "no error
34022  // occurred", we error-wrap so the callback consumer can distinguish between
34023  // "the promise rejected with null" or "the promise fulfilled with undefined".
34024  if (!reason) {
34025    var newReason = new Error('Promise was rejected with a falsy value');
34026    newReason.reason = reason;
34027    reason = newReason;
34028  }
34029  return cb(reason);
34030}
34031
34032function callbackify(original) {
34033  if (typeof original !== 'function') {
34034    throw new TypeError('The "original" argument must be of type Function');
34035  }
34036
34037  // We DO NOT return the promise as it gives the user a false sense that
34038  // the promise is actually somehow related to the callback's execution
34039  // and that the callback throwing will reject the promise.
34040  function callbackified() {
34041    var args = [];
34042    for (var i = 0; i < arguments.length; i++) {
34043      args.push(arguments[i]);
34044    }
34045
34046    var maybeCb = args.pop();
34047    if (typeof maybeCb !== 'function') {
34048      throw new TypeError('The last argument must be of type Function');
34049    }
34050    var self = this;
34051    var cb = function() {
34052      return maybeCb.apply(self, arguments);
34053    };
34054    // In true node style we process the callback on `nextTick` with all the
34055    // implications (stack, `uncaughtException`, `async_hooks`)
34056    original.apply(this, args)
34057      .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },
34058            function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });
34059  }
34060
34061  Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
34062  Object.defineProperties(callbackified,
34063                          getOwnPropertyDescriptors(original));
34064  return callbackified;
34065}
34066exports.callbackify = callbackify;
34067
34068}).call(this)}).call(this,require('_process'))
34069},{"./support/isBuffer":196,"./support/types":197,"_process":185,"inherits":165}],199:[function(require,module,exports){
vendor: 13,014 bytes, lines 34069-34536
34069
34070(function(self) {
34071  'use strict';
34072
34073  if (self.fetch) {
34074    return
34075  }
34076
34077  var support = {
34078    searchParams: 'URLSearchParams' in self,
34079    iterable: 'Symbol' in self && 'iterator' in Symbol,
34080    blob: 'FileReader' in self && 'Blob' in self && (function() {
34081      try {
34082        new Blob()
34083        return true
34084      } catch(e) {
34085        return false
34086      }
34087    })(),
34088    formData: 'FormData' in self,
34089    arrayBuffer: 'ArrayBuffer' in self
34090  }
34091
34092  if (support.arrayBuffer) {
34093    var viewClasses = [
34094      '[object Int8Array]',
34095      '[object Uint8Array]',
34096      '[object Uint8ClampedArray]',
34097      '[object Int16Array]',
34098      '[object Uint16Array]',
34099      '[object Int32Array]',
34100      '[object Uint32Array]',
34101      '[object Float32Array]',
34102      '[object Float64Array]'
34103    ]
34104
34105    var isDataView = function(obj) {
34106      return obj && DataView.prototype.isPrototypeOf(obj)
34107    }
34108
34109    var isArrayBufferView = ArrayBuffer.isView || function(obj) {
34110      return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
34111    }
34112  }
34113
34114  function normalizeName(name) {
34115    if (typeof name !== 'string') {
34116      name = String(name)
34117    }
34118    if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
34119      throw new TypeError('Invalid character in header field name')
34120    }
34121    return name.toLowerCase()
34122  }
34123
34124  function normalizeValue(value) {
34125    if (typeof value !== 'string') {
34126      value = String(value)
34127    }
34128    return value
34129  }
34130
34131  // Build a destructive iterator for the value list
34132  function iteratorFor(items) {
34133    var iterator = {
34134      next: function() {
34135        var value = items.shift()
34136        return {done: value === undefined, value: value}
34137      }
34138    }
34139
34140    if (support.iterable) {
34141      iterator[Symbol.iterator] = function() {
34142        return iterator
34143      }
34144    }
34145
34146    return iterator
34147  }
34148
34149  function Headers(headers) {
34150    this.map = {}
34151
34152    if (headers instanceof Headers) {
34153      headers.forEach(function(value, name) {
34154        this.append(name, value)
34155      }, this)
34156    } else if (Array.isArray(headers)) {
34157      headers.forEach(function(header) {
34158        this.append(header[0], header[1])
34159      }, this)
34160    } else if (headers) {
34161      Object.getOwnPropertyNames(headers).forEach(function(name) {
34162        this.append(name, headers[name])
34163      }, this)
34164    }
34165  }
34166
34167  Headers.prototype.append = function(name, value) {
34168    name = normalizeName(name)
34169    value = normalizeValue(value)
34170    var oldValue = this.map[name]
34171    this.map[name] = oldValue ? oldValue+','+value : value
34172  }
34173
34174  Headers.prototype['delete'] = function(name) {
34175    delete this.map[normalizeName(name)]
34176  }
34177
34178  Headers.prototype.get = function(name) {
34179    name = normalizeName(name)
34180    return this.has(name) ? this.map[name] : null
34181  }
34182
34183  Headers.prototype.has = function(name) {
34184    return this.map.hasOwnProperty(normalizeName(name))
34185  }
34186
34187  Headers.prototype.set = function(name, value) {
34188    this.map[normalizeName(name)] = normalizeValue(value)
34189  }
34190
34191  Headers.prototype.forEach = function(callback, thisArg) {
34192    for (var name in this.map) {
34193      if (this.map.hasOwnProperty(name)) {
34194        callback.call(thisArg, this.map[name], name, this)
34195      }
34196    }
34197  }
34198
34199  Headers.prototype.keys = function() {
34200    var items = []
34201    this.forEach(function(value, name) { items.push(name) })
34202    return iteratorFor(items)
34203  }
34204
34205  Headers.prototype.values = function() {
34206    var items = []
34207    this.forEach(function(value) { items.push(value) })
34208    return iteratorFor(items)
34209  }
34210
34211  Headers.prototype.entries = function() {
34212    var items = []
34213    this.forEach(function(value, name) { items.push([name, value]) })
34214    return iteratorFor(items)
34215  }
34216
34217  if (support.iterable) {
34218    Headers.prototype[Symbol.iterator] = Headers.prototype.entries
34219  }
34220
34221  function consumed(body) {
34222    if (body.bodyUsed) {
34223      return Promise.reject(new TypeError('Already read'))
34224    }
34225    body.bodyUsed = true
34226  }
34227
34228  function fileReaderReady(reader) {
34229    return new Promise(function(resolve, reject) {
34230      reader.onload = function() {
34231        resolve(reader.result)
34232      }
34233      reader.onerror = function() {
34234        reject(reader.error)
34235      }
34236    })
34237  }
34238
34239  function readBlobAsArrayBuffer(blob) {
34240    var reader = new FileReader()
34241    var promise = fileReaderReady(reader)
34242    reader.readAsArrayBuffer(blob)
34243    return promise
34244  }
34245
34246  function readBlobAsText(blob) {
34247    var reader = new FileReader()
34248    var promise = fileReaderReady(reader)
34249    reader.readAsText(blob)
34250    return promise
34251  }
34252
34253  function readArrayBufferAsText(buf) {
34254    var view = new Uint8Array(buf)
34255    var chars = new Array(view.length)
34256
34257    for (var i = 0; i < view.length; i++) {
34258      chars[i] = String.fromCharCode(view[i])
34259    }
34260    return chars.join('')
34261  }
34262
34263  function bufferClone(buf) {
34264    if (buf.slice) {
34265      return buf.slice(0)
34266    } else {
34267      var view = new Uint8Array(buf.byteLength)
34268      view.set(new Uint8Array(buf))
34269      return view.buffer
34270    }
34271  }
34272
34273  function Body() {
34274    this.bodyUsed = false
34275
34276    this._initBody = function(body) {
34277      this._bodyInit = body
34278      if (!body) {
34279        this._bodyText = ''
34280      } else if (typeof body === 'string') {
34281        this._bodyText = body
34282      } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
34283        this._bodyBlob = body
34284      } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
34285        this._bodyFormData = body
34286      } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
34287        this._bodyText = body.toString()
34288      } else if (support.arrayBuffer && support.blob && isDataView(body)) {
34289        this._bodyArrayBuffer = bufferClone(body.buffer)
34290        // IE 10-11 can't handle a DataView body.
34291        this._bodyInit = new Blob([this._bodyArrayBuffer])
34292      } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
34293        this._bodyArrayBuffer = bufferClone(body)
34294      } else {
34295        throw new Error('unsupported BodyInit type')
34296      }
34297
34298      if (!this.headers.get('content-type')) {
34299        if (typeof body === 'string') {
34300          this.headers.set('content-type', 'text/plain;charset=UTF-8')
34301        } else if (this._bodyBlob && this._bodyBlob.type) {
34302          this.headers.set('content-type', this._bodyBlob.type)
34303        } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
34304          this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
34305        }
34306      }
34307    }
34308
34309    if (support.blob) {
34310      this.blob = function() {
34311        var rejected = consumed(this)
34312        if (rejected) {
34313          return rejected
34314        }
34315
34316        if (this._bodyBlob) {
34317          return Promise.resolve(this._bodyBlob)
34318        } else if (this._bodyArrayBuffer) {
34319          return Promise.resolve(new Blob([this._bodyArrayBuffer]))
34320        } else if (this._bodyFormData) {
34321          throw new Error('could not read FormData body as blob')
34322        } else {
34323          return Promise.resolve(new Blob([this._bodyText]))
34324        }
34325      }
34326
34327      this.arrayBuffer = function() {
34328        if (this._bodyArrayBuffer) {
34329          return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
34330        } else {
34331          return this.blob().then(readBlobAsArrayBuffer)
34332        }
34333      }
34334    }
34335
34336    this.text = function() {
34337      var rejected = consumed(this)
34338      if (rejected) {
34339        return rejected
34340      }
34341
34342      if (this._bodyBlob) {
34343        return readBlobAsText(this._bodyBlob)
34344      } else if (this._bodyArrayBuffer) {
34345        return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
34346      } else if (this._bodyFormData) {
34347        throw new Error('could not read FormData body as text')
34348      } else {
34349        return Promise.resolve(this._bodyText)
34350      }
34351    }
34352
34353    if (support.formData) {
34354      this.formData = function() {
34355        return this.text().then(decode)
34356      }
34357    }
34358
34359    this.json = function() {
34360      return this.text().then(JSON.parse)
34361    }
34362
34363    return this
34364  }
34365
34366  // HTTP methods whose capitalization should be normalized
34367  var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
34368
34369  function normalizeMethod(method) {
34370    var upcased = method.toUpperCase()
34371    return (methods.indexOf(upcased) > -1) ? upcased : method
34372  }
34373
34374  function Request(input, options) {
34375    options = options || {}
34376    var body = options.body
34377
34378    if (input instanceof Request) {
34379      if (input.bodyUsed) {
34380        throw new TypeError('Already read')
34381      }
34382      this.url = input.url
34383      this.credentials = input.credentials
34384      if (!options.headers) {
34385        this.headers = new Headers(input.headers)
34386      }
34387      this.method = input.method
34388      this.mode = input.mode
34389      if (!body && input._bodyInit != null) {
34390        body = input._bodyInit
34391        input.bodyUsed = true
34392      }
34393    } else {
34394      this.url = String(input)
34395    }
34396
34397    this.credentials = options.credentials || this.credentials || 'omit'
34398    if (options.headers || !this.headers) {
34399      this.headers = new Headers(options.headers)
34400    }
34401    this.method = normalizeMethod(options.method || this.method || 'GET')
34402    this.mode = options.mode || this.mode || null
34403    this.referrer = null
34404
34405    if ((this.method === 'GET' || this.method === 'HEAD') && body) {
34406      throw new TypeError('Body not allowed for GET or HEAD requests')
34407    }
34408    this._initBody(body)
34409  }
34410
34411  Request.prototype.clone = function() {
34412    return new Request(this, { body: this._bodyInit })
34413  }
34414
34415  function decode(body) {
34416    var form = new FormData()
34417    body.trim().split('&').forEach(function(bytes) {
34418      if (bytes) {
34419        var split = bytes.split('=')
34420        var name = split.shift().replace(/\+/g, ' ')
34421        var value = split.join('=').replace(/\+/g, ' ')
34422        form.append(decodeURIComponent(name), decodeURIComponent(value))
34423      }
34424    })
34425    return form
34426  }
34427
34428  function parseHeaders(rawHeaders) {
34429    var headers = new Headers()
34430    // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
34431    // https://tools.ietf.org/html/rfc7230#section-3.2
34432    var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ')
34433    preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
34434      var parts = line.split(':')
34435      var key = parts.shift().trim()
34436      if (key) {
34437        var value = parts.join(':').trim()
34438        headers.append(key, value)
34439      }
34440    })
34441    return headers
34442  }
34443
34444  Body.call(Request.prototype)
34445
34446  function Response(bodyInit, options) {
34447    if (!options) {
34448      options = {}
34449    }
34450
34451    this.type = 'default'
34452    this.status = options.status === undefined ? 200 : options.status
34453    this.ok = this.status >= 200 && this.status < 300
34454    this.statusText = 'statusText' in options ? options.statusText : 'OK'
34455    this.headers = new Headers(options.headers)
34456    this.url = options.url || ''
34457    this._initBody(bodyInit)
34458  }
34459
34460  Body.call(Response.prototype)
34461
34462  Response.prototype.clone = function() {
34463    return new Response(this._bodyInit, {
34464      status: this.status,
34465      statusText: this.statusText,
34466      headers: new Headers(this.headers),
34467      url: this.url
34468    })
34469  }
34470
34471  Response.error = function() {
34472    var response = new Response(null, {status: 0, statusText: ''})
34473    response.type = 'error'
34474    return response
34475  }
34476
34477  var redirectStatuses = [301, 302, 303, 307, 308]
34478
34479  Response.redirect = function(url, status) {
34480    if (redirectStatuses.indexOf(status) === -1) {
34481      throw new RangeError('Invalid status code')
34482    }
34483
34484    return new Response(null, {status: status, headers: {location: url}})
34485  }
34486
34487  self.Headers = Headers
34488  self.Request = Request
34489  self.Response = Response
34490
34491  self.fetch = function(input, init) {
34492    return new Promise(function(resolve, reject) {
34493      var request = new Request(input, init)
34494      var xhr = new XMLHttpRequest()
34495
34496      xhr.onload = function() {
34497        var options = {
34498          status: xhr.status,
34499          statusText: xhr.statusText,
34500          headers: parseHeaders(xhr.getAllResponseHeaders() || '')
34501        }
34502        options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')
34503        var body = 'response' in xhr ? xhr.response : xhr.responseText
34504        resolve(new Response(body, options))
34505      }
34506
34507      xhr.onerror = function() {
34508        reject(new TypeError('Network request failed'))
34509      }
34510
34511      xhr.ontimeout = function() {
34512        reject(new TypeError('Network request failed'))
34513      }
34514
34515      xhr.open(request.method, request.url, true)
34516
34517      if (request.credentials === 'include') {
34518        xhr.withCredentials = true
34519      } else if (request.credentials === 'omit') {
34520        xhr.withCredentials = false
34521      }
34522
34523      if ('responseType' in xhr && support.blob) {
34524        xhr.responseType = 'blob'
34525      }
34526
34527      request.headers.forEach(function(value, name) {
34528        xhr.setRequestHeader(name, value)
34529      })
34530
34531      xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
34532    })
34533  }
34534  self.fetch.polyfill = true
34535})(typeof self !== 'undefined' ? self : this);
34536
34537},{}],200:[function(require,module,exports){
34538(function (global){(function (){
34539'use strict';
34540
34541var forEach = require('for-each');
34542var availableTypedArrays = require('available-typed-arrays');
34543var callBind = require('call-bind');
34544var callBound = require('call-bound');
34545var gOPD = require('gopd');
34546var getProto = require('get-proto');
34547
34548var $toString = callBound('Object.prototype.toString');
34549var hasToStringTag = require('has-tostringtag/shams')();
34550
34551var g = typeof globalThis === 'undefined' ? global : globalThis;
34552var typedArrays = availableTypedArrays();
34553
34554var $slice = callBound('String.prototype.slice');
34555
34556/** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
34557var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
34558	for (var i = 0; i < array.length; i += 1) {
34559		if (array[i] === value) {
34560			return i;
34561		}
34562	}
34563	return -1;
34564};
34565
34566/** @typedef {import('./types').Getter} Getter */
34567/** @type {import('./types').Cache} */
34568var cache = { __proto__: null };
34569if (hasToStringTag && gOPD && getProto) {
34570	forEach(typedArrays, function (typedArray) {
34571		var arr = new g[typedArray]();
34572		if (Symbol.toStringTag in arr && getProto) {
34573			var proto = getProto(arr);
34574			// @ts-expect-error TS won't narrow inside a closure
34575			var descriptor = gOPD(proto, Symbol.toStringTag);
34576			if (!descriptor && proto) {
34577				var superProto = getProto(proto);
34578				// @ts-expect-error TS won't narrow inside a closure
34579				descriptor = gOPD(superProto, Symbol.toStringTag);
34580			}
34581			if (descriptor && descriptor.get) {
34582				var bound = callBind(descriptor.get);
34583				cache[
34584					/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
34585				] = bound;
34586			}
34587		}
34588	});
34589} else {
34590	forEach(typedArrays, function (typedArray) {
34591		var arr = new g[typedArray]();
34592		var fn = arr.slice || arr.set;
34593		if (fn) {
34594			var bound = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
34595				// @ts-expect-error TODO FIXME
34596				callBind(fn)
34597			);
34598			cache[
34599				/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
34600			] = bound;
34601		}
34602	});
34603}
34604
34605/** @type {(value: object) => false | import('.').TypedArrayName} */
34606var tryTypedArrays = function tryAllTypedArrays(value) {
34607	/** @type {ReturnType<typeof tryAllTypedArrays>} */ var found = false;
34608	forEach(
34609		/** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */ (cache),
34610		/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
34611		function (getter, typedArray) {
34612			if (!found) {
34613				try {
34614					// @ts-expect-error a throw is fine here
34615					if ('$' + getter(value) === typedArray) {
34616						found = /** @type {import('.').TypedArrayName} */ ($slice(typedArray, 1));
34617					}
34618				} catch (e) { /**/ }
34619			}
34620		}
34621	);
34622	return found;
34623};
34624
34625/** @type {(value: object) => false | import('.').TypedArrayName} */
34626var trySlices = function tryAllSlices(value) {
34627	/** @type {ReturnType<typeof tryAllSlices>} */ var found = false;
34628	forEach(
34629		/** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */(cache),
34630		/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
34631			if (!found) {
34632				try {
34633					// @ts-expect-error a throw is fine here
34634					getter(value);
34635					found = /** @type {import('.').TypedArrayName} */ ($slice(name, 1));
34636				} catch (e) { /**/ }
34637			}
34638		}
34639	);
34640	return found;
34641};
34642
34643/** @type {import('.')} */
34644module.exports = function whichTypedArray(value) {
34645	if (!value || typeof value !== 'object') { return false; }
34646	if (!hasToStringTag) {
34647		/** @type {string} */
34648		var tag = $slice($toString(value), 8, -1);
34649		if ($indexOf(typedArrays, tag) > -1) {
34650			return tag;
34651		}
34652		if (tag !== 'Object') {
34653			return false;
34654		}
34655		// node < 0.6 hits here on real Typed Arrays
34656		return trySlices(value);
34657	}
34658	if (!gOPD) { return null; } // unknown engine
34659	return tryTypedArrays(value);
34660};
34661
34662}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
34663},{"available-typed-arrays":115,"call-bind":123,"call-bound":124,"for-each":149,"get-proto":157,"gopd":159,"has-tostringtag/shams":163}],201:[function(require,module,exports){
34664/*! yt-player. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
34665const EventEmitter = require('events').EventEmitter
34666const loadScript = require('load-script2')
34667
34668const YOUTUBE_IFRAME_API_SRC = 'https://www.youtube.com/iframe_api'
34669
34670const YOUTUBE_STATES = {
34671  '-1': 'unstarted',
34672  0: 'ended',
34673  1: 'playing',
34674  2: 'paused',
34675  3: 'buffering',
34676  5: 'cued'
34677}
34678
34679const YOUTUBE_ERROR = {
34680  // The request contains an invalid parameter value. For example, this error
34681  // occurs if you specify a videoId that does not have 11 characters, or if the
34682  // videoId contains invalid characters, such as exclamation points or asterisks.
34683  INVALID_PARAM: 2,
34684
34685  // The requested content cannot be played in an HTML5 player or another error
34686  // related to the HTML5 player has occurred.
34687  HTML5_ERROR: 5,
34688
34689  // The video requested was not found. This error occurs when a video has been
34690  // removed (for any reason) or has been marked as private.
34691  NOT_FOUND: 100,
34692
34693  // The owner of the requested video does not allow it to be played in embedded
34694  // players.
34695  UNPLAYABLE_1: 101,
34696
34697  // This error is the same as 101. It's just a 101 error in disguise!
34698  UNPLAYABLE_2: 150
34699}
34700
34701const loadIframeAPICallbacks = []
34702
34703/**
34704 * YouTube Player. Exposes a better API, with nicer events.
34705 * @param {HTMLElement|selector} element
34706 */
34707class YouTubePlayer extends EventEmitter {
34708  constructor (element, opts) {
34709    super()
34710
34711    const elem = typeof element === 'string'
34712      ? document.querySelector(element)
34713      : element
34714
34715    if (elem.id) {
34716      this._id = elem.id // use existing element id
34717    } else {
34718      this._id = elem.id = 'ytplayer-' + Math.random().toString(16).slice(2, 8)
34719    }
34720
34721    this._opts = Object.assign({
34722      width: 640,
34723      height: 360,
34724      autoplay: false,
34725      captions: undefined,
34726      controls: true,
34727      keyboard: true,
34728      fullscreen: true,
34729      annotations: true,
34730      modestBranding: false,
34731      related: true,
34732      timeupdateFrequency: 1000,
34733      playsInline: true,
34734      start: 0
34735    }, opts)
34736
34737    this.videoId = null
34738    this.destroyed = false
34739
34740    this._api = null
34741    this._autoplay = false // autoplay the first video?
34742    this._player = null
34743    this._ready = false // is player ready?
34744    this._queue = []
34745
34746    this._interval = null
34747
34748    // Setup listeners for 'timeupdate' events. The YouTube Player does not fire
34749    // 'timeupdate' events, so they are simulated using a setInterval().
34750    this._startInterval = this._startInterval.bind(this)
34751    this._stopInterval = this._stopInterval.bind(this)
34752
34753    this.on('playing', this._startInterval)
34754    this.on('unstarted', this._stopInterval)
34755    this.on('ended', this._stopInterval)
34756    this.on('paused', this._stopInterval)
34757    this.on('buffering', this._stopInterval)
34758
34759    this._loadIframeAPI((err, api) => {
34760      if (err) return this._destroy(new Error('YouTube Iframe API failed to load'))
34761      this._api = api
34762
34763      // If load(videoId, [autoplay, [size]]) was called before Iframe API
34764      // loaded, ensure it gets called again now
34765      if (this.videoId) this.load(this.videoId, this._autoplay, this._start)
34766    })
34767  }
34768
34769  load (videoId, autoplay = false, start = 0) {
34770    if (this.destroyed) return
34771
34772    this.videoId = videoId
34773    this._autoplay = autoplay
34774    this._start = start
34775
34776    // If the Iframe API is not ready yet, do nothing. Once the Iframe API is
34777    // ready, `load(this.videoId)` will be called.
34778    if (!this._api) return
34779
34780    // If there is no player instance, create one.
34781    if (!this._player) {
34782      this._createPlayer(videoId)
34783      return
34784    }
34785
34786    // If the player instance is not ready yet, do nothing. Once the player
34787    // instance is ready, `load(this.videoId)` will be called. This ensures that
34788    // the last call to `load()` is the one that takes effect.
34789    if (!this._ready) return
34790
34791    // If the player instance is ready, load the given `videoId`.
34792    if (autoplay) {
34793      this._player.loadVideoById(videoId, start)
34794    } else {
34795      this._player.cueVideoById(videoId, start)
34796    }
34797  }
34798
34799  play () {
34800    if (this._ready) this._player.playVideo()
34801    else this._queueCommand('play')
34802  }
34803
34804  pause () {
34805    if (this._ready) this._player.pauseVideo()
34806    else this._queueCommand('pause')
34807  }
34808
34809  stop () {
34810    if (this._ready) this._player.stopVideo()
34811    else this._queueCommand('stop')
34812  }
34813
34814  seek (seconds) {
34815    if (this._ready) this._player.seekTo(seconds, true)
34816    else this._queueCommand('seek', seconds)
34817  }
34818
34819  setVolume (volume) {
34820    if (this._ready) this._player.setVolume(volume)
34821    else this._queueCommand('setVolume', volume)
34822  }
34823
34824  getVolume () {
34825    return (this._ready && this._player.getVolume()) || 0
34826  }
34827
34828  mute () {
34829    if (this._ready) this._player.mute()
34830    else this._queueCommand('mute')
34831  }
34832
34833  unMute () {
34834    if (this._ready) this._player.unMute()
34835    else this._queueCommand('unMute')
34836  }
34837
34838  isMuted () {
34839    return (this._ready && this._player.isMuted()) || false
34840  }
34841
34842  setSize (width, height) {
34843    if (this._ready) this._player.setSize(width, height)
34844    else this._queueCommand('setSize', width, height)
34845  }
34846
34847  setPlaybackRate (rate) {
34848    if (this._ready) this._player.setPlaybackRate(rate)
34849    else this._queueCommand('setPlaybackRate', rate)
34850  }
34851
34852  setPlaybackQuality (suggestedQuality) {
34853    if (this._ready) this._player.setPlaybackQuality(suggestedQuality)
34854    else this._queueCommand('setPlaybackQuality', suggestedQuality)
34855  }
34856
34857  getPlaybackRate () {
34858    return (this._ready && this._player.getPlaybackRate()) || 1
34859  }
34860
34861  getAvailablePlaybackRates () {
34862    return (this._ready && this._player.getAvailablePlaybackRates()) || [1]
34863  }
34864
34865  getDuration () {
34866    return (this._ready && this._player.getDuration()) || 0
34867  }
34868
34869  getProgress () {
34870    return (this._ready && this._player.getVideoLoadedFraction()) || 0
34871  }
34872
34873  getState () {
34874    return (this._ready && YOUTUBE_STATES[this._player.getPlayerState()]) || 'unstarted'
34875  }
34876
34877  getCurrentTime () {
34878    return (this._ready && this._player.getCurrentTime()) || 0
34879  }
34880
34881  destroy () {
34882    this._destroy()
34883  }
34884
34885  _destroy (err) {
34886    if (this.destroyed) return
34887    this.destroyed = true
34888
34889    if (this._player) {
34890      this._player.stopVideo && this._player.stopVideo()
34891      this._player.destroy()
34892    }
34893
34894    this.videoId = null
34895
34896    this._id = null
34897    this._opts = null
34898    this._api = null
34899    this._player = null
34900    this._ready = false
34901    this._queue = null
34902
34903    this._stopInterval()
34904
34905    this.removeListener('playing', this._startInterval)
34906    this.removeListener('paused', this._stopInterval)
34907    this.removeListener('buffering', this._stopInterval)
34908    this.removeListener('unstarted', this._stopInterval)
34909    this.removeListener('ended', this._stopInterval)
34910
34911    if (err) this.emit('error', err)
34912  }
34913
34914  _queueCommand (command, ...args) {
34915    if (this.destroyed) return
34916    this._queue.push([command, args])
34917  }
34918
34919  _flushQueue () {
34920    while (this._queue.length) {
34921      const command = this._queue.shift()
34922      this[command[0]].apply(this, command[1])
34923    }
34924  }
34925
34926  _loadIframeAPI (cb) {
34927    // If API is loaded, there is nothing else to do
34928    if (window.YT && typeof window.YT.Player === 'function') {
34929      return cb(null, window.YT)
34930    }
34931
34932    // Otherwise, queue callback until API is loaded
34933    loadIframeAPICallbacks.push(cb)
34934
34935    const scripts = Array.from(document.getElementsByTagName('script'))
34936    const isLoading = scripts.some(script => script.src === YOUTUBE_IFRAME_API_SRC)
34937
34938    // If API <script> tag is not present in the page, inject it. Ensures that
34939    // if user includes a hardcoded <script> tag in HTML for performance, another
34940    // one will not be added
34941    if (!isLoading) {
34942      loadScript(YOUTUBE_IFRAME_API_SRC).catch(err => {
34943        while (loadIframeAPICallbacks.length) {
34944          const loadCb = loadIframeAPICallbacks.shift()
34945          loadCb(err)
34946        }
34947      })
34948    }
34949
34950    const prevOnYouTubeIframeAPIReady = window.onYouTubeIframeAPIReady
34951    window.onYouTubeIframeAPIReady = () => {
34952      if (typeof prevOnYouTubeIframeAPIReady === 'function') {
34953        prevOnYouTubeIframeAPIReady()
34954      }
34955      while (loadIframeAPICallbacks.length) {
34956        const loadCb = loadIframeAPICallbacks.shift()
34957        loadCb(null, window.YT)
34958      }
34959    }
34960  }
34961
34962  _createPlayer (videoId) {
34963    if (this.destroyed) return
34964
34965    const opts = this._opts
34966
34967    this._player = new this._api.Player(this._id, {
34968      width: opts.width,
34969      height: opts.height,
34970      videoId: videoId,
34971
34972      // (Not part of documented API) This parameter controls the hostname that
34973      // videos are loaded from. Set to `'https://www.youtube-nocookie.com'`
34974      // for enhanced privacy.
34975      host: opts.host,
34976
34977      playerVars: {
34978        // This parameter specifies whether the initial video will automatically
34979        // start to play when the player loads. Supported values are 0 or 1. The
34980        // default value is 0.
34981        autoplay: opts.autoplay ? 1 : 0,
34982
34983        // Setting the parameter's value to 1 causes closed captions to be shown
34984        // by default, even if the user has turned captions off. The default
34985        // behavior is based on user preference.
34986        cc_load_policy: opts.captions != null
34987          ? opts.captions !== false ? 1 : 0
34988          : undefined, // default to not setting this option
34989
34990        // Sets the player's interface language. The parameter value is an ISO
34991        // 639-1 two-letter language code or a fully specified locale. For
34992        // example, fr and fr-ca are both valid values. Other language input
34993        // codes, such as IETF language tags (BCP 47) might also be handled
34994        // properly.
34995        hl: (opts.captions != null && opts.captions !== false)
34996          ? opts.captions
34997          : undefined, // default to not setting this option
34998
34999        // This parameter specifies the default language that the player will
35000        // use to display captions. Set the parameter's value to an ISO 639-1
35001        // two-letter language code.
35002        cc_lang_pref: (opts.captions != null && opts.captions !== false)
35003          ? opts.captions
35004          : undefined, // default to not setting this option
35005
35006        // This parameter indicates whether the video player controls are
35007        // displayed. For IFrame embeds that load a Flash player, it also defines
35008        // when the controls display in the player as well as when the player
35009        // will load. Supported values are:
35010        //   - controls=0 – Player controls do not display in the player. For
35011        //                  IFrame embeds, the Flash player loads immediately.
35012        //   - controls=1 – (default) Player controls display in the player. For
35013        //                  IFrame embeds, the controls display immediately and
35014        //                  the Flash player also loads immediately.
35015        //   - controls=2 – Player controls display in the player. For I
35015Frame
35016        //                  embeds, the controls display and the Flash player
35017        //                  loads after the user initiates the video playback.
35018        controls: opts.controls ? 2 : 0,
35019
35020        // Setting the parameter's value to 1 causes the player to not respond to
35021        // keyboard controls. The default value is 0, which means that keyboard
35022        // controls are enabled.
35023        disablekb: opts.keyboard ? 0 : 1,
35024
35025        // Setting the parameter's value to 1 enables the player to be
35026        // controlled via IFrame or JavaScript Player API calls. The default
35027        // value is 0, which means that the player cannot be controlled using
35028        // those APIs.
35029        enablejsapi: 1,
35030
35031        // Setting this parameter to 0 prevents the fullscreen button from
35032        // displaying in the player. The default value is 1, which causes the
35033        // fullscreen button to display.
35034        fs: opts.fullscreen ? 1 : 0,
35035
35036        // Setting the parameter's value to 1 causes video annotations to be
35037        // shown by default, whereas setting to 3 causes video annotations to not
35038        // be shown by default. The default value is 1.
35039        iv_load_policy: opts.annotations ? 1 : 3,
35040
35041        // This parameter lets you use a YouTube player that does not show a
35042        // YouTube logo. Set the parameter value to 1 to prevent the YouTube logo
35043        // from displaying in the control bar. Note that a small YouTube text
35044        // label will still display in the upper-right corner of a paused video
35045        // when the user's mouse pointer hovers over the player.
35046        modestbranding: opts.modestBranding ? 1 : 0,
35047
35048        // This parameter provides an extra security measure for the IFrame API
35049        // and is only supported for IFrame embeds. If you are using the IFrame
35050        // API, which means you are setting the enablejsapi parameter value to 1,
35051        // you should always specify your domain as the origin parameter value.
35052        origin: window.location.origin,
35053
35054        // This parameter controls whether videos play inline or fullscreen in an
35055        // HTML5 player on iOS. Valid values are:
35056        //   - 0: This value causes fullscreen playback. This is currently the
35057        //        default value, though the default is subject to change.
35058        //   - 1: This value causes inline playback for UIWebViews created with
35059        //        the allowsInlineMediaPlayback property set to TRUE.
35060        playsinline: opts.playsInline ? 1 : 0,
35061
35062        // This parameter indicates whether the player should show related
35063        // videos from the same channel (0) or from any channel (1) when
35064        // playback of the video ends. The default value is 1.
35065        rel: opts.related ? 1 : 0,
35066
35067        // (Not part of documented API) Allow html elements with higher z-index
35068        // to be shown on top of the YouTube player.
35069        wmode: 'opaque',
35070
35071        // This parameter causes the player to begin playing the video at the given number
35072        // of seconds from the start of the video. The parameter value is a positive integer.
35073        // Note that similar to the seek function, the player will look for the closest
35074        // keyframe to the time you specify. This means that sometimes the play head may seek
35075        // to just before the requested time, usually no more than around two seconds.
35076        start: opts.start
35077      },
35078      events: {
35079        onReady: () => this._onReady(videoId),
35080        onStateChange: (data) => this._onStateChange(data),
35081        onPlaybackQualityChange: (data) => this._onPlaybackQualityChange(data),
35082        onPlaybackRateChange: (data) => this._onPlaybackRateChange(data),
35083        onError: (data) => this._onError(data)
35084      }
35085    })
35086  }
35087
35088  /**
35089   * This event fires when the player has finished loading and is ready to begin
35090   * receiving API calls.
35091   */
35092  _onReady (videoId) {
35093    if (this.destroyed) return
35094
35095    this._ready = true
35096
35097    // Once the player is ready, always call `load(videoId, [autoplay, [size]])`
35098    // to handle these possible cases:
35099    //
35100    //   1. `load(videoId, true)` was called before the player was ready. Ensure that
35101    //      the selected video starts to play.
35102    //
35103    //   2. `load(videoId, false)` was called before the player was ready. Now the
35104    //      player is ready and there's nothing to do.
35105    //
35106    //   3. `load(videoId, [autoplay])` was called multiple times before the player
35107    //      was ready. Therefore, the player was initialized with the wrong videoId,
35108    //      so load the latest videoId and potentially autoplay it.
35109    this.load(this.videoId, this._autoplay, this._start)
35110
35111    this._flushQueue()
35112  }
35113
35114  /**
35115   * Called when the player's state changes. We emit friendly events so the user
35116   * doesn't need to use YouTube's YT.PlayerState.* event constants.
35117   */
35118  _onStateChange (data) {
35119    if (this.destroyed) return
35120
35121    const state = YOUTUBE_STATES[data.data]
35122
35123    if (state) {
35124      // Send a 'timeupdate' anytime the state changes. When the video halts for any
35125      // reason ('paused', 'buffering', or 'ended') no further 'timeupdate' events
35126      // should fire until the video unhalts.
35127      if (['paused', 'buffering', 'ended'].includes(state)) this._onTimeupdate()
35128
35129      this.emit(state)
35130
35131      // When the video changes ('unstarted' or 'cued') or starts ('playing') then a
35132      // 'timeupdate' should follow afterwards (never before!) to reset the time.
35133      if (['unstarted', 'playing', 'cued'].includes(state)) this._onTimeupdate()
35134    } else {
35135      throw new Error('Unrecognized state change: ' + data)
35136    }
35137  }
35138
35139  /**
35140   * This event fires whenever the video playback quality changes. Possible
35141   * values are: 'small', 'medium', 'large', 'hd720', 'hd1080', 'highres'.
35142   */
35143  _onPlaybackQualityChange (data) {
35144    if (this.destroyed) return
35145    this.emit('playbackQualityChange', data.data)
35146  }
35147
35148  /**
35149   * This event fires whenever the video playback rate changes.
35150   */
35151  _onPlaybackRateChange (data) {
35152    if (this.destroyed) return
35153    this.emit('playbackRateChange', data.data)
35154  }
35155
35156  /**
35157   * This event fires if an error occurs in the player.
35158   */
35159  _onError (data) {
35160    if (this.destroyed) return
35161
35162    const code = Number(data.data)
35163
35164    // The HTML5_ERROR error occurs when the YouTube player needs to switch from
35165    // HTML5 to Flash to show an ad. Ignore it.
35166    if (code === YOUTUBE_ERROR.HTML5_ERROR) return
35167
35168    // The remaining error types occur when the YouTube player cannot play the
35169    // given video. This is not a fatal error. Report it as unplayable so the user
35170    // has an opportunity to play another video.
35171    if (code === YOUTUBE_ERROR.UNPLAYABLE_1 ||
35172        code === YOUTUBE_ERROR.UNPLAYABLE_2 ||
35173        code === YOUTUBE_ERROR.NOT_FOUND ||
35174        code === YOUTUBE_ERROR.INVALID_PARAM) {
35175      return this.emit('unplayable', this.videoId)
35176    }
35177
35178    // Unexpected error, does not match any known type
35179    this._destroy(new Error('YouTube Player Error. Unknown error code: ' + code))
35180  }
35181
35182  /**
35183   * This event fires when the time indicated by the `getCurrentTime()` method
35184   * has been updated.
35185   */
35186  _onTimeupdate () {
35187    this.emit('timeupdate', this.getCurrentTime())
35188  }
35189
35190  _startInterval () {
35191    this._interval = setInterval(() => this._onTimeupdate(), this._opts.timeupdateFrequency)
35192  }
35193
35194  _stopInterval () {
35195    clearInterval(this._interval)
35196    this._interval = null
35197  }
35198}
35199
35200module.exports = YouTubePlayer
35201
35202},{"events":116,"load-script2":174}]},{},[7]);

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.