PageSourceSearch

https://lifespanfitness.com/cdn/shop/t/113/assets/vendor.min.js?v=117897659646656267941732637639

js lifespanfitness.com collected 2026-09-24 18:15:19 UTC 106,541 bytes, 4,041 lines download raw bytes

vendor: 4,070 bytes, lines 1-2
1
2!function(e){var t=function(u,D,f){"use strict";var k,H;if(function(){var e;var t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:true,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:true,ricTimeout:0,throttleDelay:125};H=u.lazySizesConfig||u.lazysizesConfig||{};for(e in t){if(!(e in H)){H[e]=t[e]}}}(),!D||!D.getElementsByClassName){return{init:function(){},cfg:H,noSupport:true}}var O=D.documentElement,i=u.HTMLPictureElement,P="addEventListener",$="getAttribute",q=u[P].bind(u),I=u.setTimeout,U=u.requestAnimationFrame||I,o=u.requestIdleCallback,j=/^picture$/i,r=["load","error","lazyincluded","_lazyloaded"],a={},G=Array.prototype.forEach,J=function(e,t){if(!a[t]){a[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")}return a[t].test(e[$]("class")||"")&&a[t]},K=function(e,t){if(!J(e,t)){e.setAttribute("class",(e[$]("class")||"").trim()+" "+t)}},Q=function(e,t){var a;if(a=J(e,t)){e.setAttribute("class",(e[$]("class")||"").replace(a," "))}},V=function(t,a,e){var i=e?P:"removeEventListener";if(e){V(t,a)}r.forEach(function(e){t[i](e,a)})},X=function(e,t,a,i,r){var n=D.createEvent("Event");if(!a){a={}}a.instance=k;n.initEvent(t,!i,!r);n.detail=a;e.dispatchEvent(n);return n},Y=function(e,t){var a;if(!i&&(a=u.picturefill||H.pf)){if(t&&t.src&&!e[$]("srcset")){e.setAttribute("srcset",t.src)}a({reevaluate:true,elements:[e]})}else if(t&&t.src){e.src=t.src}},Z=function(e,t){return(getComputedStyle(e,null)||{})[t]},s=function(e,t,a){a=a||e.offsetWidth;while(a<H.minSize&&t&&!e._lazysizesWidth){a=t.offsetWidth;t=t.parentNode}return a},ee=function(){var a,i;var t=[];var r=[];var n=t;var s=function(){var e=n;n=t.length?r:t;a=true;i=false;while(e.length){e.shift()()}a=false};var e=function(e,t){if(a&&!t){e.apply(this,arguments)}else{n.push(e);if(!i){i=true;(D.hidden?I:U)(s)}}};e._lsFlush=s;return e}(),te=function(a,e){return e?function(){ee(a)}:function(){var e=this;var t=arguments;ee(function(){a.apply(e,t)})}},ae=function(e){var a;var i=0;var r=H.throttleDelay;var n=H.ricTimeout;var t=function(){a=false;i=f.now();e()};var s=o&&n>49?function(){o(t,{timeout:n});if(n!==H.ricTimeout){n=H.ricTimeout}}:te(function(){I(t)},true);return function(e){var t;if(e=e===true){n=33}if(a){return}a=true;t=r-(f.now()-i);if(t<0){t=0}if(e||t<9){s()}else{I(s,t)}}},ie=function(e){var t,a;var i=99;var r=function(){t=null;e()};var n=function(){var e=f.now()-a;if(e<i){I(n,i-e)}else{(o||r)(r)}};return function(){a=f.now();if(!t){t=I(n,i)}}},e=function(){var v,m,c,h,e;var y,z,g,p,C,b,A;var n=/^img$/i;var d=/^iframe$/i;var E="onscroll"in u&&!/(gle|ing)bot/.test(navigator.userAgent);var _=0;var w=0;var M=0;var N=-1;var L=function(e){M--;if(!e||M<0||!e.target){M=0}};var x=function(e){if(A==null){A=Z(D.body,"visibility")=="hidden"}return A||!(Z(e.parentNode,"visibility")=="hidden"&&Z(e,"visibility")=="hidden")};var W=function(e,t){var a;var i=e;var r=x(e);g-=t;b+=t;p-=t;C+=t;while(r&&(i=i.offsetParent)&&i!=D.body&&i!=O){r=(Z(i,"opacity")||1)>0;if(r&&Z(i,"overflow")!="visible"){a=i.getBoundingClientRect();r=C>a.left&&p<a.right&&b>a.top-1&&g<a.bottom+1}}return r};var t=function(){var e,t,a,i,r,n,s,o,l,u,f,c;var d=k.elements;if((h=H.loadMode)&&M<8&&(e=d.length)){t=0;N++;for(;t<e;t++){if(!d[t]||d[t]._lazyRace){continue}if(!E||k.prematureUnveil&&k.prematureUnveil(d[t])){R(d[t]);continue}if(!(o=d[t][$]("data-expand"))||!(n=o*1)){n=w}if(!u){u=!H.expand||H.expand<1?O.clientHeight>500&&O.clientWidth>500?500:370:H.expand;k._defEx=u;f=u*H.expFactor;c=H.hFac;A=null;if(w<f&&M<1&&N>2&&h>2&&!D.hidden){w=f;N=0}else if(h>1&&N>1&&M<6){w=u}else{w=_}}if(l!==n){y=innerWidth+n*c;z=innerHeight+n;s=n*-1;l=n}a=d[t].getBoundingClientRect();if((b=a.bottom)>=s&&(g=a.top)<=z&&(C=a.right)>=s*c&&(p=a.left)<=y&&(b||C||p||g)&&(H.loadHidden||x(d[t]))&&(m&&M<3&&!o&&(h<3||N<4)||W(d[t],n))){R(d[t]);r=true;if(M>9){break}}else if(!r&&m&&!i&&M<4&&N<4&&h>
22&&(v[0]||H.preloadAfterLoad)&&(v[0]||!o&&(b||C||p||g||d[t][$](H.sizesAttr)!="auto"))){i=v[0]||d[t]}}if(i&&!r){R(i)}}};var a=ae(t);var S=function(e){var t=e.target;if(t._lazyCache){delete t._lazyCache;return}L(e);K(t,H.loadedClass);Q(t,H.loadingClass);V(t,B);X(t,"lazyloaded")};var i=te(S);var B=function(e){i({target:e.target})};var T=function(e,t){var a=e.getAttribute("data-load-mode")||H.iframeLoadMode;if(a==0){e.contentWindow.location.replace(t)}else if(a==1){e.src=t}};var F=function(e){var t;var a=e[$](H.srcsetAttr);if(t=H.customMedia[e[$]("data-media")||e[$]("media")]){e.setAttribute("media",t)}if(a){e.setAttribute("srcset",a)}};var s=te(function(t,e,a,i,r){var n,s,o,l,u,f;if(!(u=X(t,"lazybeforeunveil",e)).defaultPrevented){if(i){if(a){K(t,H.autosizesClass)}else{t.setAttribute("sizes",i)}}s=t[$](H.srcsetAttr);n=t[$](H.srcAttr);if(r){o=t.parentNode;l=o&&j.test(o.nodeName||"")}f=e.firesLoad||"src"in t&&(s||n||l);u={target:t};K(t,H.loadingClass);if(f){clearTimeout(c);c=I(L,2500);V(t,B,true)}if(l){G.call(o.getElementsByTagName("source"),F)}if(s){t.setAttribute("srcset",s)}else if(n&&!l){if(d.test(t.nodeName)){T(t,n)}else{t.src=n}}if(r&&(s||l)){Y(t,{src:n})}}if(t._lazyRace){delete t._lazyRace}Q(t,H.lazyClass);ee(function(){var e=t.complete&&t.naturalWidth>1;if(!f||e){if(e){K(t,H.fastLoadedClass)}S(u);t._lazyCache=true;I(function(){if("_lazyCache"in t){delete t._lazyCache}},9)}if(t.loading=="lazy"){M--}},true)});var R=function(e){if(e._lazyRace){return}var t;var a=n.test(e.nodeName);var i=a&&(e[$](H.sizesAttr)||e[$]("sizes"));var r=i=="auto";if((r||!m)&&a&&(e[$]("src")||e.srcset)&&!e.complete&&!J(e,H.errorClass)&&J(e,H.lazyClass)){return}t=X(e,"lazyunveilread").detail;if(r){re.updateElem(e,true,e.offsetWidth)}e._lazyRace=true;M++;s(e,t,r,i,a)};var r=ie(function(){H.loadMode=3;a()});var o=function(){if(H.loadMode==3){H.loadMode=2}r()};var l=function(){if(m){return}if(f.now()-e<999){I(l,999);return}m=true;H.loadMode=3;a();q("scroll",o,true)};return{_:function(){e=f.now();k.elements=D.getElementsByClassName(H.lazyClass);v=D.getElementsByClassName(H.lazyClass+" "+H.preloadClass);q("scroll",a,true);q("resize",a,true);q("pageshow",function(e){if(e.persisted){var t=D.querySelectorAll("."+H.loadingClass);if(t.length&&t.forEach){U(function(){t.forEach(function(e){if(e.complete){R(e)}})})}}});if(u.MutationObserver){new MutationObserver(a).observe(O,{childList:true,subtree:true,attributes:true})}else{O[P]("DOMNodeInserted",a,true);O[P]("DOMAttrModified",a,true);setInterval(a,999)}q("hashchange",a,true);["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){D[P](e,a,true)});if(/d$|^c/.test(D.readyState)){l()}else{q("load",l);D[P]("DOMContentLoaded",a);I(l,2e4)}if(k.elements.length){t();ee._lsFlush()}else{a()}},checkElems:a,unveil:R,_aLSL:o}}(),re=function(){var a;var n=te(function(e,t,a,i){var r,n,s;e._lazysizesWidth=i;i+="px";e.setAttribute("sizes",i);if(j.test(t.nodeName||"")){r=t.getElementsByTagName("source");for(n=0,s=r.length;n<s;n++){r[n].setAttribute("sizes",i)}}if(!a.detail.dataAttr){Y(e,a.detail)}});var i=function(e,t,a){var i;var r=e.parentNode;if(r){a=s(e,r,a);i=X(e,"lazybeforesizes",{width:a,dataAttr:!!t});if(!i.defaultPrevented){a=i.detail.width;if(a&&a!==e._lazysizesWidth){n(e,r,i,a)}}}};var e=function(){var e;var t=a.length;if(t){e=0;for(;e<t;e++){i(a[e])}}};var t=ie(e);return{_:function(){a=D.getElementsByClassName(H.autosizesClass);q("resize",t)},checkElems:t,updateElem:i}}(),t=function(){if(!t.i&&D.getElementsByClassName){t.i=true;re._();e._()}};return I(function(){H.init&&t()}),k={cfg:H,autoSizer:re,loader:e,init:t,uP:Y,aC:K,rC:Q,hC:J,fire:X,gW:s,rAF:ee}}(e,e.document,Date);e.lazySizes=t,"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:{});
3
4
5
6
7( function( window, factory ) {
8  if ( typeof define == 'function' && define.amd ) {
9    define( 'jquery-bridget/jquery-bridget',[ 'jquery' ], function( jQuery ) {
10      return factory( window, jQuery );
11    });
12  } else if ( typeof module == 'object' && module.exports ) {
13    module.exports = factory(
14      window,
15      require('jquery')
16    );
17  } else {
18    window.jQueryBridget = factory(
19      window,
20      window.jQuery
21    );
22  }
23
24}( window, function factory( window, jQuery ) {
25'use strict';
26
27
28var arraySlice = Array.prototype.slice;
29
30var console = window.console;
31var logError = typeof console == 'undefined' ? function() {} :
32  function( message ) {
33    console.error( message );
34  };
35
36
37function jQueryBridget( namespace, PluginClass, $ ) {
38  $ = $ || jQuery || window.jQuery;
39  if ( !$ ) {
40    return;
41  }
42
43  if ( !PluginClass.prototype.option ) {
44    PluginClass.prototype.option = function( opts ) {
45      if ( !$.isPlainObject( opts ) ){
46        return;
47      }
48      this.options = $.extend( true, this.options, opts );
49    };
50  }
51
52  $.fn[ namespace ] = function( arg0  ) {
53    if ( typeof arg0 == 'string' ) {
54      var args = arraySlice.call( arguments, 1 );
55      return methodCall( this, arg0, args );
56    }
57    plainCall( this, arg0 );
58    return this;
59  };
60
61  function methodCall( $elems, methodName, args ) {
62    var returnValue;
63    var pluginMethodStr = '$().' + namespace + '("' + methodName + '")';
64
65    $elems.each( function( i, elem ) {
66      var instance = $.data( elem, namespace );
67      if ( !instance ) {
68        logError( namespace + ' not initialized. Cannot call methods, i.e. ' +
69          pluginMethodStr );
70        return;
71      }
72
73      var method = instance[ methodName ];
74      if ( !method || methodName.charAt(0) == '_' ) {
75        logError( pluginMethodStr + ' is not a valid method' );
76        return;
77      }
78
79      var value = method.apply( instance, args );
80      returnValue = returnValue === undefined ? value : returnValue;
81    });
82
83    return returnValue !== undefined ? returnValue : $elems;
84  }
85
86  function plainCall( $elems, options ) {
87    $elems.each( function( i, elem ) {
88      var instance = $.data( elem, namespace );
89      if ( instance ) {
90        instance.option( options );
91        instance._init();
92      } else {
93        instance = new PluginClass( elem, options );
94        $.data( elem, namespace, instance );
95      }
96    });
97  }
98
99  updateJQuery( $ );
100
101}
102
103
104function updateJQuery( $ ) {
105  if ( !$ || ( $ && $.bridget ) ) {
106    return;
107  }
108  $.bridget = jQueryBridget;
109}
110
111updateJQuery( jQuery || window.jQuery );
112
113
114return jQueryBridget;
115
116}));
117
118
119
120( function( global, factory ) {
121  if ( typeof define == 'function' && define.amd ) {
122    define( 'ev-emitter/ev-emitter',factory );
123  } else if ( typeof module == 'object' && module.exports ) {
124    module.exports = factory();
125  } else {
126    global.EvEmitter = factory();
127  }
128
129}( typeof window != 'undefined' ? window : this, function() {
130
131
132
133function EvEmitter() {}
134
135var proto = EvEmitter.prototype;
136
137proto.on = function( eventName, listener ) {
138  if ( !eventName || !listener ) {
139    return;
140  }
141  var events = this._events = this._events || {};
142  var listeners = events[ eventName ] = events[ eventName ] || [];
143  if ( listeners.indexOf( listener ) == -1 ) {
144    listeners.push( listener );
145  }
146
147  return this;
148};
149
150proto.once = function( eventName, listener ) {
151  if ( !eventName || !listener ) {
152    return;
153  }
154  this.on( eventName, listener );
155  var onceEvents = this._onceEvents = this._onceEvents || {};
156  var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};
157  onceListeners[ listener ] = true;
158
159  return this;
160};
161
162proto.off = function( eventName, listener ) {
163  var listeners = this._events && this._events[ eventName ];
164  if ( !listeners || !listeners.length ) {
165    return;
166  }
167  var index = listeners.indexOf( listener );
168  if ( index != -1 ) {
169    listeners.splice( index, 1 );
170  }
171
172  return this;
173};
174
175proto.emitEvent = function( eventName, args ) {
176  var listeners = this._events && this._events[ eventName ];
177  if ( !listeners || !listeners.length ) {
178    return;
179  }
180  listeners = listeners.slice(0);
181  args = args || [];
182  var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
183
184  for ( var i=0; i < listeners.length; i++ ) {
185    var listener = listeners[i]
186    var isOnce = onceListeners && onceListeners[ listener ];
187    if ( isOnce ) {
188      this.off( eventName, listener );
189      delete onceListeners[ listener ];
190    }
191    listener.apply( this, args );
192  }
193
194  return this;
195};
196
197proto.allOff = function() {
198  delete this._events;
199  delete this._onceEvents;
200};
201
202return EvEmitter;
203
204}));
205
206
207
208( function( window, factory ) {
209  if ( typeof define == 'function' && define.amd ) {
210    define( 'get-size/get-size',factory );
211  } else if ( typeof module == 'object' && module.exports ) {
212    module.exports = factory();
213  } else {
214    window.getSize = factory();
215  }
216
217})( window, function factory() {
218'use strict';
219
220
221function getStyleSize( value ) {
222  var num = parseFloat( value );
223  var isValid = value.indexOf('%') == -1 && !isNaN( num );
224  return isValid && num;
225}
226
227function noop() {}
228
229var logError = typeof console == 'undefined' ? noop :
230  function( message ) {
231    console.error( message );
232  };
233
234
235var measurements = [
236  'paddingLeft',
237  'paddingRight',
238  'paddingTop',
239  'paddingBottom',
240  'marginLeft',
241  'marginRight',
242  'marginTop',
243  'marginBottom',
244  'borderLeftWidth',
245  'borderRightWidth',
246  'borderTopWidth',
247  'borderBottomWidth'
248];
249
250var measurementsLength = measurements.length;
251
252function getZeroSize() {
253  var size = {
254    width: 0,
255    height: 0,
256    innerWidth: 0,
257    innerHeight: 0,
258    outerWidth: 0,
259    outerHeight: 0
260  };
261  for ( var i=0; i < measurementsLength; i++ ) {
262    var measurement = measurements[i];
263    size[ measurement ] = 0;
264  }
265  return size;
266}
267
268
269function getStyle( elem ) {
270  var style = getComputedStyle( elem );
271  if ( !style ) {
272    logError( 'Style returned ' + style +
273      '. Are you running this code in a hidden iframe on Firefox? ' +
274      'See https://bit.ly/getsizebug1' );
275  }
276  return style;
277}
278
279
280var isSetup = false;
vendor: 5,187 bytes, lines 281-510
281
282var isBoxSizeOuter;
283
284function setup() {
285  if ( isSetup ) {
286    return;
287  }
288  isSetup = true;
289
290
291  var div = document.createElement('div');
292  div.style.width = '200px';
293  div.style.padding = '1px 2px 3px 4px';
294  div.style.borderStyle = 'solid';
295  div.style.borderWidth = '1px 2px 3px 4px';
296  div.style.boxSizing = 'border-box';
297
298  var body = document.body || document.documentElement;
299  body.appendChild( div );
300  var style = getStyle( div );
301  isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;
302  getSize.isBoxSizeOuter = isBoxSizeOuter;
303
304  body.removeChild( div );
305}
306
307
308function getSize( elem ) {
309  setup();
310
311  if ( typeof elem == 'string' ) {
312    elem = document.querySelector( elem );
313  }
314
315  if ( !elem || typeof elem != 'object' || !elem.nodeType ) {
316    return;
317  }
318
319  var style = getStyle( elem );
320
321  if ( style.display == 'none' ) {
322    return getZeroSize();
323  }
324
325  var size = {};
326  size.width = elem.offsetWidth;
327  size.height = elem.offsetHeight;
328
329  var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box';
330
331  for ( var i=0; i < measurementsLength; i++ ) {
332    var measurement = measurements[i];
333    var value = style[ measurement ];
334    var num = parseFloat( value );
335    size[ measurement ] = !isNaN( num ) ? num : 0;
336  }
337
338  var paddingWidth = size.paddingLeft + size.paddingRight;
339  var paddingHeight = size.paddingTop + size.paddingBottom;
340  var marginWidth = size.marginLeft + size.marginRight;
341  var marginHeight = size.marginTop + size.marginBottom;
342  var borderWidth = size.borderLeftWidth + size.borderRightWidth;
343  var borderHeight = size.borderTopWidth + size.borderBottomWidth;
344
345  var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
346
347  var styleWidth = getStyleSize( style.width );
348  if ( styleWidth !== false ) {
349    size.width = styleWidth +
350      ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
351  }
352
353  var styleHeight = getStyleSize( style.height );
354  if ( styleHeight !== false ) {
355    size.height = styleHeight +
356      ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
357  }
358
359  size.innerWidth = size.width - ( paddingWidth + borderWidth );
360  size.innerHeight = size.height - ( paddingHeight + borderHeight );
361
362  size.outerWidth = size.width + marginWidth;
363  size.outerHeight = size.height + marginHeight;
364
365  return size;
366}
367
368return getSize;
369
370});
371
372
373
374( function( window, factory ) {
375  'use strict';
376  if ( typeof define == 'function' && define.amd ) {
377    define( 'desandro-matches-selector/matches-selector',factory );
378  } else if ( typeof module == 'object' && module.exports ) {
379    module.exports = factory();
380  } else {
381    window.matchesSelector = factory();
382  }
383
384}( window, function factory() {
385  'use strict';
386
387  var matchesMethod = ( function() {
388    var ElemProto = window.Element.prototype;
389    if ( ElemProto.matches ) {
390      return 'matches';
391    }
392    if ( ElemProto.matchesSelector ) {
393      return 'matchesSelector';
394    }
395    var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];
396
397    for ( var i=0; i < prefixes.length; i++ ) {
398      var prefix = prefixes[i];
399      var method = prefix + 'MatchesSelector';
400      if ( ElemProto[ method ] ) {
401        return method;
402      }
403    }
404  })();
405
406  return function matchesSelector( elem, selector ) {
407    return elem[ matchesMethod ]( selector );
408  };
409
410}));
411
412
413
414( function( window, factory ) {
415
416  if ( typeof define == 'function' && define.amd ) {
417    define( 'fizzy-ui-utils/utils',[
418      'desandro-matches-selector/matches-selector'
419    ], function( matchesSelector ) {
420      return factory( window, matchesSelector );
421    });
422  } else if ( typeof module == 'object' && module.exports ) {
423    module.exports = factory(
424      window,
425      require('desandro-matches-selector')
426    );
427  } else {
428    window.fizzyUIUtils = factory(
429      window,
430      window.matchesSelector
431    );
432  }
433
434}( window, function factory( window, matchesSelector ) {
435
436
437
438var utils = {};
439
440
441utils.extend = function( a, b ) {
442  for ( var prop in b ) {
443    a[ prop ] = b[ prop ];
444  }
445  return a;
446};
447
448
449utils.modulo = function( num, div ) {
450  return ( ( num % div ) + div ) % div;
451};
452
453
454var arraySlice = Array.prototype.slice;
455
456utils.makeArray = function( obj ) {
457  if ( Array.isArray( obj ) ) {
458    return obj;
459  }
460  if ( obj === null || obj === undefined ) {
461    return [];
462  }
463
464  var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
465  if ( isArrayLike ) {
466    return arraySlice.call( obj );
467  }
468
469  return [ obj ];
470};
471
472
473utils.removeFrom = function( ary, obj ) {
474  var index = ary.indexOf( obj );
475  if ( index != -1 ) {
476    ary.splice( index, 1 );
477  }
478};
479
480
481utils.getParent = function( elem, selector ) {
482  while ( elem.parentNode && elem != document.body ) {
483    elem = elem.parentNode;
484    if ( matchesSelector( elem, selector ) ) {
485      return elem;
486    }
487  }
488};
489
490
491utils.getQueryElement = function( elem ) {
492  if ( typeof elem == 'string' ) {
493    return document.querySelector( elem );
494  }
495  return elem;
496};
497
498
499utils.handleEvent = function( event ) {
500  var method = 'on' + event.type;
501  if ( this[ method ] ) {
502    this[ method ]( event );
503  }
504};
505
506
507utils.filterFindElements = function( elems, selector ) {
508  elems = utils.makeArray( elems );
509  var ffElems = [];
510
511  elems.forEach( function( elem ) {
512    if ( !( elem instanceof HTMLElement ) ) {
513      return;
514    }
515    if ( !selector ) {
516      ffElems.push( elem );
517      return;
518    }
519    if ( matchesSelector( elem, selector ) ) {
520      ffElems.push( elem );
521    }
522    var childElems = elem.querySelectorAll( selector );
523    for ( var i=0; i < childElems.length; i++ ) {
524      ffElems.push( childElems[i] );
525    }
526  });
527
528  return ffElems;
529};
530
531
532utils.debounceMethod = function( _class, methodName, threshold ) {
533  threshold = threshold || 100;
534  var method = _class.prototype[ methodName ];
535  var timeoutName = methodName + 'Timeout';
536
537  _class.prototype[ methodName ] = function() {
538    var timeout = this[ timeoutName ];
539    clearTimeout( timeout );
540
541    var args = arguments;
542    var _this = this;
543    this[ timeoutName ] = setTimeout( function() {
544      method.apply( _this, args );
545      delete _this[ timeoutName ];
546    }, threshold );
547  };
548};
549
550
551utils.docReady = function( callback ) {
552  var readyState = document.readyState;
553  if ( readyState == 'complete' || readyState == 'interactive' ) {
554    setTimeout( callback );
555  } else {
556    document.addEventListener( 'DOMContentLoaded', callback );
557  }
558};
559
560
561utils.toDashed = function( str ) {
562  return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
563    return $1 + '-' + $2;
564  }).toLowerCase();
565};
566
567var console = window.console;
568utils.htmlInit = function( WidgetClass, namespace ) {
569  utils.docReady( function() {
570    var dashedNamespace = utils.toDashed( namespace );
571    var dataAttr = 'data-' + dashedNamespace;
572    var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' );
573    var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace );
574    var elems = utils.makeArray( dataAttrElems )
575      .concat( utils.makeArray( jsDashElems ) );
576    var dataOptionsAttr = dataAttr + '-options';
577    var jQuery = window.jQuery;
578
579    elems.forEach( function( elem ) {
580      var attr = elem.getAttribute( dataAttr ) ||
581        elem.getAttribute( dataOptionsAttr );
582      var options;
583      try {
584        options = attr && JSON.parse( attr );
585      } catch ( error ) {
586        if ( console ) {
587          console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className +
588          ': ' + error );
589        }
590        return;
591      }
592      var instance = new WidgetClass( elem, options );
593      if ( jQuery ) {
594        jQuery.data( elem, namespace, instance );
595      }
596    });
597
598  });
599};
600
601
602return utils;
603
604}));
605
606( function( window, factory ) {
607  if ( typeof define == 'function' && define.amd ) {
608    define( 'flickity/js/cell',[
609      'get-size/get-size',
610    ], function( getSize ) {
611      return factory( window, getSize );
612    } );
613  } else if ( typeof module == 'object' && module.exports ) {
614    module.exports = factory(
615        window,
616        require('get-size')
617    );
618  } else {
619    window.Flickity = window.Flickity || {};
620    window.Flickity.Cell = factory(
621        window,
622        window.getSize
623    );
624  }
625
626}( window, function factory( window, getSize ) {
627
628
629
630function Cell( elem, parent ) {
631  this.element = elem;
632  this.parent = parent;
633
634  this.create();
635}
636
637var proto = Cell.prototype;
638
639proto.create = function() {
640  this.element.style.position = 'absolute';
641  this.element.setAttribute( 'aria-hidden', 'true' );
642  this.x = 0;
643  this.shift = 0;
644  this.element.style[ this.parent.originSide ] = 0;
645};
646
647proto.destroy = function() {
648  this.unselect();
649  this.element.style.position = '';
650  var side = this.parent.originSide;
651  this.element.style[ side ] = '';
652  this.element.style.transform = '';
653  this.element.removeAttribute('aria-hidden');
654};
655
656proto.getSize = function() {
657  this.size = getSize( this.element );
658};
659
660proto.setPosition = function( x ) {
661  this.x = x;
662  this.updateTarget();
663  this.renderPosition( x );
664};
665
666proto.updateTarget = proto.setDefaultTarget = function() {
667  var marginProperty = this.parent.originSide == 'left' ? 'marginLeft' : 'marginRight';
668  this.target = this.x + this.size[ marginProperty ] +
669    this.size.width * this.parent.cellAlign;
670};
671
672proto.renderPosition = function( x ) {
673  var sideOffset = this.parent.originSide === 'left' ? 1 : -1;
674
675  var adjustedX = this.parent.options.percentPosition ?
676    x * sideOffset * ( this.parent.size.innerWidth / this.size.width ) :
677    x * sideOffset;
678
679  this.element.style.transform = 'translateX(' +
680    this.parent.getPositionValue( adjustedX ) + ')';
681};
682
683proto.select = function() {
684  this.element.classList.add('is-selected');
685  this.element.removeAttribute('aria-hidden');
686};
687
688proto.unselect = function() {
689  this.element.classList.remove('is-selected');
690  this.element.setAttribute( 'aria-hidden', 'true' );
691};
692
693proto.wrapShift = function( shift ) {
694  this.shift = shift;
695  this.renderPosition( this.x + this.parent.slideableWidth * shift );
696};
697
698proto.remove = function() {
699  this.element.parentNode.removeChild( this.element );
700};
701
702return Cell;
703
704} ) );
705
706( function( window, factory ) {
707  if ( typeof define == 'function' && define.amd ) {
708    define( 'flickity/js/slide',factory );
709  } else if ( typeof module == 'object' && module.exports ) {
710    module.exports = factory();
711  } else {
712    window.Flickity = window.Flickity || {};
713    window.Flickity.Slide = factory();
714  }
715
716}( window, function factory() {
717'use strict';
718
719function Slide( parent ) {
720  this.parent = parent;
721  this.isOriginLeft = parent.originSide == 'left';
722  this.cells = [];
723  this.outerWidth = 0;
724  this.height = 0;
725}
726
727var proto = Slide.prototype;
728
729proto.addCell = function( cell ) {
730  this.cells.push( cell );
731  this.outerWidth += cell.size.outerWidth;
732  this.height = Math.max( cell.size.outerHeight, this.height );
733  if ( this.cells.length == 1 ) {
734    this.x = cell.x; 
735    var beginMargin = this.isOriginLeft ? 'marginLeft' : 'marginRight';
736    this.firstMargin = cell.size[ beginMargin ];
737  }
738};
739
740proto.updateTarget = function() {
741  var endMargin = this.isOriginLeft ? 'marginRight' : 'marginLeft';
742  var lastCell = this.getLastCell();
743  var lastMargin = lastCell ? lastCell.size[ endMargin ] : 0;
744  var slideWidth = this.outerWidth - ( this.firstMargin + lastMargin );
745  this.target = this.x + this.firstMargin + slideWidth * this.parent.cellAlign;
746};
747
748proto.getLastCell = function() {
749  return this.cells[ this.cells.length - 1 ];
750};
751
752proto.select = function() {
753  this.cells.forEach( function( cell ) {
754    cell.select();
755  } );
756};
757
758proto.unselect = function() {
759  this.cells.forEach( function( cell ) {
760    cell.unselect();
761  } );
762};
763
764proto.getCellElements = function() {
765  return this.cells.map( function( cell ) {
766    return cell.element;
767  } );
768};
769
770return Slide;
771
772} ) );
773
774( function( window, factory ) {
775  if ( typeof define == 'function' && define.amd ) {
776    define( 'flickity/js/animate',[
777      'fizzy-ui-utils/utils',
778    ], function( utils ) {
779      return factory( window, utils );
780    } );
781  } else if ( typeof module == 'object' && module.exports ) {
782    module.exports = factory(
783        window,
784        require('fizzy-ui-utils')
785    );
786  } else {
787    window.Flickity = window.Flickity || {};
788    window.Flickity.animatePrototype = factory(
789        window,
790        window.fizzyUIUtils
791    );
792  }
793
794}( window, function factory( window, utils ) {
795
796
797
798
799var proto = {};
800
801proto.startAnimation = function() {
802  if ( this.isAnimating ) {
803    return;
804  }
805
806  this.isAnimating = true;
807  this.restingFrames = 0;
808  this.animate();
809};
810
811proto.animate = function() {
812  this.applyDragForce();
813  this.applySelectedAttraction();
814
815  var previousX = this.x;
816
817  this.integratePhysics();
818  this.positionSlider();
819  this.settle( previousX );
820  if ( this.isAnimating ) {
821    var _this = this;
822    requestAnimationFrame( function animateFrame() {
823      _this.animate();
824    } );
825  }
826};
827
828proto.positionSlider = function() {
829  var x = this.x;
830  if ( this.options.wrapAround && this.cells.length > 1 ) {
831    x = utils.modulo( x, this.slideableWidth );
832    x -= this.slideableWidth;
833    this.shiftWrapCells( x );
834  }
835
836  this.setTranslateX( x, this.isAnimating );
837  this.dispatchScrollEvent();
838};
839
840proto.setTranslateX = function( x, is3d ) {
841  x += this.cursorPosition;
842  x = this.options.rightToLeft ? -x : x;
843  var translateX = this.getPositionValue( x );
844  this.slider.style.transform = is3d ?
845    'translate3d(' + translateX + ',0,0)' : 'translateX(' + translateX + ')';
846};
847
848proto.dispatchScrollEvent = function() {
849  var firstSlide = this.slides[0];
850  if ( !firstSlide ) {
851    return;
852  }
853  var positionX = -this.x - firstSlide.target;
854  var progress = positionX / this.slidesWidth;
855  this.dispatchEvent( 'scroll', null, [ progress, positionX ] );
856};
857
858proto.positionSliderAtSelected = function() {
859  if ( !this.cells.length ) {
860    return;
861  }
862  this.x = -this.selectedSlide.target;
863  this.velocity = 0; 
864  this.positionSlider();
865};
866
867proto.getPositionValue = function( position ) {
868  if ( this.options.percentPosition ) {
869    return ( Math.round( ( position / this.size.innerWidth ) * 10000 ) * 0.01 ) + '%';
870  } else {
871    return Math.round( position ) + 'px';
872  }
873};
874
875proto.settle = function( previousX ) {
876  var isResting = !this.isPointerDown &&
877      Math.round( this.x * 100 ) == Math.round( previousX * 100 );
878  if ( isResting ) {
879    this.restingFrames++;
880  }
881  if ( this.restingFrames > 2 ) {
882    this.isAnimating = false;
883    delete this.isFreeScrolling;
884    this.positionSlider();
885    this.dispatchEvent( 'settle', null, [ this.selectedIndex ] );
886  }
887};
888
889proto.shiftWrapCells = function( x ) {
890  var beforeGap = this.cursorPosition + x;
891  this._shiftCells( this.beforeShiftCells, beforeGap, -1 );
892  var afterGap = this.size.innerWidth - ( x + this.slideableWidth + this.cursorPosition );
893  this._shiftCells( this.afterShiftCells, afterGap, 1 );
894};
895
896proto._shiftCells = function( cells, gap, shift ) {
897  for ( var i = 0; i < cells.length; i++ ) {
898    var cell = cells[i];
899    var cellShift = gap > 0 ? shift : 0;
900    cell.wrapShift( cellShift );
901    gap -= cell.size.outerWidth;
902  }
903};
904
905proto._unshiftCells = function( cells ) {
906  if ( !cells || !cells.length ) {
907    return;
908  }
909  for ( var i = 0; i < cells.length; i++ ) {
910    cells[i].wrapShift( 0 );
911  }
912};
913
914
915proto.integratePhysics = function() {
916  this.x += this.velocity;
917  this.velocity *= this.getFrictionFactor();
918};
919
920proto.applyForce = function( force ) {
921  this.velocity += force;
922};
923
924proto.getFrictionFactor = function() {
925  return 1 - this.options[ this.isFreeScrolling ? 'freeScrollFriction' : 'friction' ];
926};
927
928proto.getRestingPosition = function() {
929  return this.x + this.velocity / ( 1 - this.getFrictionFactor() );
930};
931
932proto.applyDragForce = function() {
933  if ( !this.isDraggable || !this.isPointerDown ) {
934    return;
935  }
936  var dragVelocity = this.dragX - this.x;
937  var dragForce = dragVelocity - this.velocity;
938  this.applyForce( dragForce );
939};
940
941proto.applySelectedAttraction = function() {
942  var dragDown = this.isDraggable && this.isPointerDown;
943  if ( dragDown || this.isFreeScrolling || !this.slides.length ) {
944    return;
945  }
946  var distance = this.selectedSlide.target * -1 - this.x;
947  var force = distance * this.options.selectedAttraction;
948  this.applyForce( force );
949};
950
951return proto;
952
953} ) );
954
955( function( window, factory ) {
956  if ( typeof define == 'function' && define.amd ) {
957    define( 'flickity/js/flickity',[
958      'ev-emitter/ev-emitter',
959      'get-size/get-size',
960      'fizzy-ui-utils/utils',
961      './cell',
962      './slide',
963      './animate',
964    ], function( EvEmitter, getSize, utils, Cell, Slide, animatePrototype ) {
965      return factory( window, EvEmitter, getSize, utils, Cell, Slide, animatePrototype );
966    } );
967  } else if ( typeof module == 'object' && module.exports ) {
968    module.exports = factory(
969        window,
970        require('ev-emitter'),
971        require('get-size'),
972        require('fizzy-ui-utils'),
973        require('./cell'),
974        require('./slide'),
975        require('./animate')
976    );
977  } else {
978    var _Flickity = window.Flickity;
979
980    window.Flickity = factory(
981        window,
982        window.EvEmitter,
983        window.getSize,
984        window.fizzyUIUtils,
985        _Flickity.Cell,
986        _Flickity.Slide,
987        _Flickity.animatePrototype
988    );
989  }
990
991}( window, function factory( window, EvEmitter, getSize,
992    utils, Cell, Slide, animatePrototype ) {
993
994
995
996var jQuery = window.jQuery;
997var getComputedStyle = window.getComputedStyle;
998var console = window.console;
999
1000function moveElements( elems, toElem ) {
1001  elems = utils.makeArray( elems );
1002  while ( elems.length ) {
1003    toElem.appendChild( elems.shift() );
1004  }
1005}
1006
1007
1008var GUID = 0;
1009var instances = {};
1010
1011function Flickity( element, options ) {
1012  var queryElement = utils.getQueryElement( element );
1013  if ( !queryElement ) {
1014    if ( console ) {
1015      console.error( 'Bad element for Flickity: ' + ( queryElement || element ) );
1016    }
1017    return;
1018  }
1019  this.element = queryElement;
1020  if ( this.element.flickityGUID ) {
1021    var instance = instances[ this.element.flickityGUID ];
1022    if ( instance ) instance.option( options );
1023    return instance;
1024  }
1025
1026  if ( jQuery ) {
1027    this.$element = jQuery( this.element );
1028  }
1029  this.options = utils.extend( {}, this.constructor.defaults );
1030  this.option( options );
1031
1032  this._create();
1033}
1034
1035Flickity.defaults = {
1036  accessibility: true,
1037  cellAlign: 'center',
1038  freeScrollFriction: 0.075, 
1039  friction: 0.28, 
1040  namespaceJQueryEvents: true,
1041  percentPosition: true,
1042  resize: true,
1043  selectedAttraction: 0.025,
1044  setGallerySize: true,
1045};
1046
1047Flickity.createMethods = [];
1048
1049var proto = Flickity.prototype;
1050utils.extend( proto, EvEmitter.prototype );
1051
1052proto._create = function() {
1053  var id = this.guid = ++GUID;
1054  this.element.flickityGUID = id; 
1055  instances[ id ] = this; 
1056  this.selectedIndex = 0;
1057  this.restingFrames = 0;
1058  this.x = 0;
1059  this.velocity = 0;
1060  this.originSide = this.options.rightToLeft ? 'right' : 'left';
1061  this.viewport = document.createElement('div');
1062  this.viewport.className = 'flickity-viewport';
1063  this._createSlider();
1064
1065  if ( this.options.resize || this.options.watchCSS ) {
1066    window.addEventListener( 'resize', this );
1067  }
1068
1069  for ( var eventName in this.options.on ) {
1070    var listener = this.options.on[ eventName ];
1071    this.on( eventName, listener );
1072  }
1073
1074  Flickity.createMethods.forEach( function( method ) {
1075    this[ method ]();
1076  }, this );
1077
1078  if ( this.options.watchCSS ) {
1079    this.watchCSS();
1080  } else {
1081    this.activate();
1082  }
1083
1084};
1085
1086proto.option = function( opts ) {
1087  utils.extend( this.options, opts );
1088};
1089
1090proto.activate = function() {
1091  if ( this.isActive ) {
1092    return;
1093  }
1094  this.isActive = true;
1095  this.element.classList.add('flickity-enabled');
1096  if ( this.options.rightToLeft ) {
1097    this.element.classList.add('flickity-rtl');
1098  }
1099
1100  this.getSize();
1101  var cellElems = this._filterFindCellElements( this.element.children );
1102  moveElements( cellElems, this.slider );
1103  this.viewport.appendChild( this.slider );
1104  this.element.appendChild( this.viewport );
1105  this.reloadCells();
1106
1107  if ( this.options.accessibility ) {
1108    this.element.tabIndex = 0;
1109    this.element.addEventListener( 'keydown', this );
1110  }
1111
1112  this.emitEvent('activate');
1113  this.selectInitialIndex();
1114  this.isInitActivated = true;
1115  this.dispatchEvent('ready');
1116};
1117
1118proto._createSlider = function() {
1119  var slider = document.createElement('div');
1120  slider.className = 'flickity-slider';
1121  slider.style[ this.originSide ] = 0;
1122  this.slider = slider;
1123};
1124
1125proto._filterFindCellElements = function( elems ) {
1126  return utils.filterFindElements( elems, this.options.cellSelector );
1127};
1128
1129proto.reloadCells = function() {
1130  this.cells = this._makeCells( this.slider.children );
1131  this.positionCells();
1132  this._getWrapShiftCells();
1133  this.setGallerySize();
1134};
1135
1136proto._makeCells = function( elems ) {
1137  var cellElems = this._filterFindCellElements( elems );
1138
1139  var cells = cellElems.map( function( cellElem ) {
1140    return new Cell( cellElem, this );
1141  }, this );
1142
1143  return cells;
1144};
1145
1146proto.getLastCell = function() {
1147  return this.cells[ this.cells.length - 1 ];
1148};
1149
1150proto.getLastSlide = function() {
1151  return this.slides[ this.slides.length - 1 ];
1152};
1153
1154proto.positionCells = function() {
1155  this._sizeCells( this.cells );
1156  this._positionCells( 0 );
1157};
1158
1159proto._positionCells = function( index ) {
1160  index = index || 0;
1161  this.maxCellHeight = index ? this.maxCellHeight || 0 : 0;
1162  var cellX = 0;
1163  if ( index > 0 ) {
1164    var startCell = this.cells[ index - 1 ];
1165    cellX = startCell.x + startCell.size.outerWidth;
1166  }
1167  var len = this.cells.length;
1168  for ( var i = index; i < len; i++ ) {
1169    var cell = this.cells[i];
1170    cell.setPosition( cellX );
1171    cellX += cell.size.outerWidth;
1172    this.maxCellHeight = Math.max( cell.size.outerHeight, this.maxCellHeight );
1173  }
1174  this.slideableWidth = cellX;
1175  this.updateSlides();
1176  this._containSlides();
1177  this.slidesWidth = len ? this.getLastSlide().target - this.slides[0].target : 0;
1178};
1179
1180proto._sizeCells = function( cells ) {
1181  cells.forEach( function( cell ) {
1182    cell.getSize();
1183  } );
1184};
1185
1186
1187proto.updateSlides = function() {
1188  this.slides = [];
1189  if ( !this.cells.length ) {
1190    return;
1191  }
1192
1193  var slide = new Slide( this );
1194  this.slides.push( slide );
1195  var isOriginLeft = this.originSide == 'left';
1196  var nextMargin = isOriginLeft ? 'marginRight' : 'marginLeft';
1197
1198  var canCellFit = this._getCanCellFit();
1199
1200  this.cells.forEach( function( cell, i ) {
1201    if ( !slide.cells.length ) {
1202      slide.addCell( cell );
1203      return;
1204    }
1205
1206    var slideWidth = ( slide.outerWidth - slide.firstMargin ) +
1207      ( cell.size.outerWidth - cell.size[ nextMargin ] );
1208
1209    if ( canCellFit.call( this, i, slideWidth ) ) {
1210      slide.addCell( cell );
1211    } else {
1212      slide.updateTarget();
1213
1214      slide = new Slide( this );
1215      this.slides.push( slide );
1216      slide.addCell( cell );
1217    }
1218  }, this );
1219  slide.updateTarget();
1220  this.updateSelectedSlide();
1221};
1222
1223proto._getCanCellFit = function() {
1224  var groupCells = this.options.groupCells;
1225  if ( !groupCells ) {
1226    return function() {
1227      return false;
1228    };
1229  } else if ( typeof groupCells == 'number' ) {
1230    var number = parseInt( groupCells, 10 );
1231    return function( i ) {
1232      return ( i % number ) !== 0;
1233    };
1234  }
1235  var percentMatch = typeof groupCells == 'string' &&
1236    groupCells.match( /^(\d+)%$/ );
1237  var percent = percentMatch ? parseInt( percentMatch[1], 10 ) / 100 : 1;
1238  return function( i, slideWidth ) {
1239    return slideWidth <= ( this.size.innerWidth + 1 ) * percent;
1240  };
1241};
1242
1243proto._init =
1244proto.reposition = function() {
1245  this.positionCells();
1246  this.positionSliderAtSelected();
1247};
1248
1249proto.getSize = function() {
1250  this.size = getSize( this.element );
1251  this.setCellAlign();
1252  this.cursorPosition = this.size.innerWidth * this.cellAlign;
1253};
1254
1255var cellAlignShorthands = {
1256  center: {
1257    left: 0.5,
1258    right: 0.5,
1259  },
1260  left: {
1261    left: 0,
1262    right: 1,
1263  },
1264  right: {
1265    right: 0,
1266    left: 1,
1267  },
1268};
1269
1270proto.setCellAlign = function() {
1271  var shorthand = cellAlignShorthands[ this.options.cellAlign ];
1272  this.cellAlign = shorthand ? shorthand[ this.originSide ] : this.options.cellAlign;
1273};
1274
1275proto.setGallerySize = function() {
1276  if ( this.options.setGallerySize ) {
1277    var height = this.options.adaptiveHeight && this.selectedSlide ?
1278      this.selectedSlide.height : this.maxCellHeight;
1279    this.viewport.style.height = height + 'px';
1280  }
1281};
1282
1283proto._getWrapShiftCells = function() {
1284  if ( !this.options.wrapAround ) {
1285    return;
1286  }
1287  this._unshiftCells( this.beforeShiftCells );
1288  this._unshiftCells( this.afterShiftCells );
1289  var gapX = this.cursorPosition;
1290  var cellIndex = this.cells.length - 1;
1291  this.beforeShiftCells = this._getGapCells( gapX, cellIndex, -1 );
1292  gapX = this.size.innerWidth - this.cursorPosition;
1293  this.afterShiftCells = this._getGapCells( gapX, 0, 1 );
1294};
1295
1296proto._getGapCells = function( gapX, cellIndex, increment ) {
1297  var cells = [];
1298  while ( gapX > 0 ) {
1299    var cell = this.cells[ cellIndex ];
1300    if ( !cell ) {
1301      break;
1302    }
1303    cells.push( cell );
1304    cellIndex += increment;
1305    gapX -= cell.size.outerWidth;
1306  }
1307  return cells;
1308};
1309
1310
1311proto._containSlides = function() {
1312  if ( !this.options.contain || this.options.wrapAround || !this.cells.length ) {
1313    return;
1314  }
1315  var isRightToLeft = this.options.rightToLeft;
1316  var beginMargin = isRightToLeft ? 'marginRight' : 'marginLeft';
1317  var endMargin = isRightToLeft ? 'marginLeft' : 'marginRight';
1318  var contentWidth = this.slideableWidth - this.getLastCell().size[ endMargin ];
1319  var isContentSmaller = contentWidth < this.size.innerWidth;
1320  var beginBound = this.cursorPosition + this.cells[0].size[ beginMargin ];
1321  var endBound = contentWidth - this.size.innerWidth * ( 1 - this.cellAlign );
1322  this.slides.forEach( function( slide ) {
1323    if ( isContentSmaller ) {
1324      slide.target = contentWidth * this.cellAlign;
1325    } else {
1326      slide.target = Math.max( slide.target, beginBound );
1327      slide.target = Math.min( slide.target, endBound );
1328    }
1329  }, this );
1330};
1331
1332
1333proto.dispatchEvent = function( type, event, args ) {
1334  var emitArgs = event ? [ event ].concat( args ) : args;
1335  this.emitEvent( type, emitArgs );
1336
1337  if ( jQuery && this.$element ) {
1338    type += this.options.namespaceJQueryEvents ? '.flickity' : '';
1339    var $event = type;
1340    if ( event ) {
1341      var jQEvent = new jQuery.Event( event );
1342      jQEvent.type = type;
1343      $event = jQEvent;
1344    }
1345    this.$element.trigger( $event, args );
1346  }
1347};
1348
1349
1350proto.select = function( index, isWrap, isInstant ) {
1351  if ( !this.isActive ) {
1352    return;
1353  }
1354  index = parseInt( index, 10 );
1355  this._wrapSelect( index );
1356
1357  if ( this.options.wrapAround || isWrap ) {
1358    index = utils.modulo( index, this.slides.length );
1359  }
1360  if ( !this.slides[ index ] ) {
1361    return;
1362  }
1363  var prevIndex = this.selectedIndex;
1364  this.selectedIndex = index;
1365  this.updateSelectedSlide();
1366  if ( isInstant ) {
1367    this.positionSliderAtSelected();
1368  } else {
1369    this.startAnimation();
1370  }
1371  if ( this.options.adaptiveHeight ) {
1372    this.setGallerySize();
1373  }
1374  this.dispatchEvent( 'select', null, [ index ] );
1375  if ( index != prevIndex ) {
1376    this.dispatchEvent( 'change', null, [ index ] );
1377  }
1378  this.dispatchEvent('cellSelect');
1379};
1380
1381proto._wrapSelect = function( index ) {
1382  var len = this.slides.length;
1383  var isWrapping = this.options.wrapAround && len > 1;
1384  if ( !isWrapping ) {
1385    return index;
1386  }
1387  var wrapIndex = utils.modulo( index, len );
1388  var delta = Math.abs( wrapIndex - this.selectedIndex );
1389  var backWrapDelta = Math.abs( ( wrapIndex + len ) - this.selectedIndex );
1390  var forewardWrapDelta = Math.abs( ( wrapIndex - len ) - this.selectedIndex );
1391  if ( !this.isDragSelect && backWrapDelta < delta ) {
1392    index += len;
1393  } else if ( !this.isDragSelect && forewardWrapDelta < delta ) {
1394    index -= len;
1395  }
1396  if ( index < 0 ) {
1397    this.x -= this.slideableWidth;
1398  } else if ( index >= len ) {
1399    this.x += this.slideableWidth;
1400  }
1401};
1402
1403proto.previous = function( isWrap, isInstant ) {
1404  this.select( this.selectedIndex - 1, isWrap, isInstant );
1405};
1406
1407proto.next = function( isWrap, isInstant ) {
1408  this.select( this.selectedIndex + 1, isWrap, isInstant );
1409};
1410
1411proto.updateSelectedSlide = function() {
1412  var slide = this.slides[ this.selectedIndex ];
1413  if ( !slide ) {
1414    return;
1415  }
1416  this.unselectSelectedSlide();
1417  this.selectedSlide = slide;
1418  slide.select();
1419  this.selectedCells = slide.cells;
1420  this.selectedElements = slide.getCellElements();
1421  this.selectedCell = slide.cells[0];
1422  this.selectedElement = this.selectedElements[0];
1423};
1424
1425proto.unselectSelectedSlide = function() {
1426  if ( this.selectedSlide ) {
1427    this.selectedSlide.unselect();
1428  }
1429};
1430
1431proto.selectInitialIndex = function() {
1432  var initialIndex = this.options.initialIndex;
1433  if ( this.isInitActivated ) {
1434    this.select( this.selectedIndex, false, true );
1435    return;
1436  }
1437  if ( initialIndex && typeof initialIndex == 'string' ) {
1438    var cell = this.queryCell( initialIndex );
1439    if ( cell ) {
1440      this.selectCell( initialIndex, false, true );
1441      return;
1442    }
1443  }
1444
1445  var index = 0;
1446  if ( initialIndex && this.slides[ initialIndex ] ) {
1447    index = initialIndex;
1448  }
1449  this.select( index, false, true );
1450};
1451
1452proto.selectCell = function( value, isWrap, isInstant ) {
1453  var cell = this.queryCell( value );
1454  if ( !cell ) {
1455    return;
1456  }
1457
1458  var index = this.getCellSlideIndex( cell );
1459  this.select( index, isWrap, isInstant );
1460};
1461
1462proto.getCellSlideIndex = function( cell ) {
1463  for ( var i = 0; i < this.slides.length; i++ ) {
1464    var slide = this.slides[i];
1465    var index = slide.cells.indexOf( cell );
1466    if ( index != -1 ) {
1467      return i;
1468    }
1469  }
1470};
1471
1472
1473proto.getCell = function( elem ) {
1474  for ( var i = 0; i < this.cells.length; i++ ) {
1475    var cell = this.cells[i];
1476    if ( cell.element == elem ) {
1477      return cell;
1478    }
1479  }
1480};
1481
1482proto.getCells = function( elems ) {
1483  elems = utils.makeArray( elems );
1484  var cells = [];
1485  elems.forEach( function( elem ) {
1486    var cell = this.getCell( elem );
1487    if ( cell ) {
1488      cells.push( cell );
1489    }
1490  }, this );
1491  return cells;
1492};
1493
1494proto.getCellElements = function() {
1495  return this.cells.map( function( cell ) {
1496    return cell.element;
1497  } );
1498};
1499
1500proto.getParentCell = function( elem ) {
1501  var cell = this.getCell( elem );
1502  if ( cell ) {
1503    return cell;
1504  }
1505  elem = utils.getParent( elem, '.flickity-slider > *' );
1506  return this.getCell( elem );
1507};
1508
1509proto.getAdjacentCellElements = function( adjCount, index ) {
1510  if ( !adjCount ) {
1511    return this.selectedSlide.getCellElements();
1512  }
1513  index = index === undefined ? this.selectedIndex : index;
1514
1515  var len = this.slides.length;
1516  if ( 1 + ( adjCount * 2 ) >= len ) {
1517    return this.getCellElements();
1518  }
1519
1520  var cellElems = [];
1521  for ( var i = index - adjCount; i <= index + adjCount; i++ ) {
1522    var slideIndex = this.options.wrapAround ? utils.modulo( i, len ) : i;
1523    var slide = this.slides[ slideIndex ];
1524    if ( slide ) {
1525      cellElems = cellElems.concat( slide.getCellElements() );
1526    }
1527  }
1528  return cellElems;
1529};
1530
1531proto.queryCell = function( selector ) {
1532  if ( typeof selector == 'number' ) {
1533    return this.cells[ selector ];
1534  }
1535  if ( typeof selector == 'string' ) {
1536    if ( selector.match( /^[#.]?[\d/]/ ) ) {
1537      return;
1538    }
1539    selector = this.element.querySelector( selector );
1540  }
1541  return this.getCell( selector );
1542};
1543
1544
1545proto.uiChange = function() {
1546  this.emitEvent('uiChange');
1547};
1548
1549proto.childUIPointerDown = function( event ) {
1550  if ( event.type != 'touchstart' ) {
1551    event.preventDefault();
1552  }
1553  this.focus();
1554};
1555
1556
1557proto.onresize = function() {
1558  this.watchCSS();
1559  this.resize();
1560};
1561
1562utils.debounceMethod( Flickity, 'onresize', 150 );
1563
1564proto.resize = function() {
1565  if ( !this.isActive || this.isAnimating || this.isDragging ) {
1566    return;
1567  }
1568  this.getSize();
1569  if ( this.options.wrapAround ) {
1570    this.x = utils.modulo( this.x, this.slideableWidth );
1571  }
1572  this.positionCells();
1573  this._getWrapShiftCells();
1574  this.setGallerySize();
1575  this.emitEvent('resize');
1576  var selectedElement = this.selectedElements && this.selectedElements[0];
1577  this.selectCell( selectedElement, false, true );
1578};
1579
1580proto.watchCSS = function() {
1581  var watchOption = this.options.watchCSS;
1582  if ( !watchOption ) {
1583    return;
1584  }
1585
1586  var afterContent = getComputedStyle( this.element, ':after' ).content;
1587  if ( afterContent.indexOf('flickity') != -1 ) {
1588    this.activate();
1589  } else {
1590    this.deactivate();
1591  }
1592};
1593
1594
1595proto.onkeydown = function( event ) {
1596  var isNotFocused = document.activeElement && document.activeElement != this.element;
1597  if ( !this.options.accessibility || isNotFocused ) {
1598    return;
1599  }
1600
1601  var handler = Flickity.keyboardHandlers[ event.keyCode ];
1602  if ( handler ) {
1603    handler.call( this );
1604  }
1605};
1606
1607Flickity.keyboardHandlers = {
1608  37: function() {
1609    var leftMethod = this.options.rightToLeft ? 'next' : 'previous';
1610    this.uiChange();
1611    this[ leftMethod ]();
1612  },
1613  39: function() {
1614    var rightMethod = this.options.rightToLeft ? 'previous' : 'next';
1615    this.uiChange();
1616    this[ rightMethod ]();
1617  },
1618};
1619
1620
1621proto.focus = function() {
1622  var prevScrollY = window.pageYOffset;
1623  this.element.focus({ preventScroll: true });
1624  if ( window.pageYOffset != prevScrollY ) {
1625    window.scrollTo( window.pageXOffset, prevScrollY );
1626  }
1627};
1628
1629
1630proto.deactivate = function() {
1631  if ( !this.isActive ) {
1632    return;
1633  }
1634  this.element.classList.remove('flickity-enabled');
1635  this.element.classList.remove('flickity-rtl');
1636  this.unselectSelectedSlide();
1637  this.cells.forEach( function( cell ) {
1638    cell.destroy();
1639  } );
1640  this.element.removeChild( this.viewport );
1641  moveElements( this.slider.children, this.element );
1642  if ( this.options.accessibility ) {
1643    this.element.removeAttribute('tabIndex');
1644    this.element.removeEventListener( 'keydown', this );
1645  }
1646  this.isActive = false;
1647  this.emitEvent('deactivate');
1648};
1649
1650proto.destroy = function() {
1651  this.deactivate();
1652  window.removeEventListener( 'resize', this );
1653  this.allOff();
1654  this.emitEvent('destroy');
1655  if ( jQuery && this.$element ) {
1656    jQuery.removeData( this.element, 'flickity' );
1657  }
1658  delete this.element.flickityGUID;
1659  delete instances[ this.guid ];
1660};
1661
1662
1663utils.extend( proto, animatePrototype );
1664
1665
1666Flickity.data = function( elem ) {
1667  elem = utils.getQueryElement( elem );
1668  var id = elem && elem.flickityGUID;
1669  return id && instances[ id ];
1670};
1671
1672utils.htmlInit( Flickity, 'flickity' );
1673
1674if ( jQuery && jQuery.bridget ) {
1675  jQuery.bridget( 'flickity', Flickity );
1676}
1677
1678Flickity.setJQuery = function( jq ) {
1679  jQuery = jq;
1680};
1681
1682Flickity.Cell = Cell;
1683Flickity.Slide = Slide;
1684
1685return Flickity;
1686
1687} ) );
1688
1689
1690
1691( function( window, factory ) {
1692  if ( typeof define == 'function' && define.amd ) {
1693    define( 'unipointer/unipointer',[
1694      'ev-emitter/ev-emitter'
1695    ], function( EvEmitter ) {
1696      return factory( window, EvEmitter );
1697    });
1698  } else if ( typeof module == 'object' && module.exports ) {
1699    module.exports = factory(
1700      window,
1701      require('ev-emitter')
1702    );
1703  } else {
1704    window.Unipointer = factory(
1705      window,
1706      window.EvEmitter
1707    );
1708  }
1709
1710}( window, function factory( window, EvEmitter ) {
1711
1712
1713
1714function noop() {}
1715
1716function Unipointer() {}
1717
1718var proto = Unipointer.prototype = Object.create( EvEmitter.prototype );
1719
1720proto.bindStartEvent = function( elem ) {
1721  this._bindStartEvent( elem, true );
1722};
1723
1724proto.unbindStartEvent = function( elem ) {
1725  this._bindStartEvent( elem, false );
1726};
1727
1728proto._bindStartEvent = function( elem, isAdd ) {
1729  isAdd = isAdd === undefined ? true : isAdd;
1730  var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
1731
1732  var startEvent = 'mousedown';
1733  if ( 'ontouchstart' in window ) {
1734    startEvent = 'touchstart';
1735  } else if ( window.PointerEvent ) {
1736    startEvent = 'pointerdown';
1737  }
1738  elem[ bindMethod ]( startEvent, this );
1739};
1740
1741proto.handleEvent = function( event ) {
1742  var method = 'on' + event.type;
1743  if ( this[ method ] ) {
1744    this[ method ]( event );
1745  }
1746};
1747
1748proto.getTouch = function( touches ) {
1749  for ( var i=0; i < touches.length; i++ ) {
1750    var touch = touches[i];
1751    if ( touch.identifier == this.pointerIdentifier ) {
1752      return touch;
1753    }
1754  }
1755};
1756
1757
1758proto.onmousedown = function( event ) {
1759  var button = event.button;
1760  if ( button && ( button !== 0 && button !== 1 ) ) {
1761    return;
1762  }
1763  this._pointerDown( event, event );
1764};
1765
1766proto.ontouchstart = function( event ) {
1767  this._pointerDown( event, event.changedTouches[0] );
1768};
1769
1770proto.onpointerdown = function( event ) {
1771  this._pointerDown( event, event );
1772};
1773
1774proto._pointerDown = function( event, pointer ) {
1775  if ( event.button || this.isPointerDown ) {
1776    return;
1777  }
1778
1779  this.isPointerDown = true;
1780  this.pointerIdentifier = pointer.pointerId !== undefined ?
1781    pointer.pointerId : pointer.identifier;
1782
1783  this.pointerDown( event, pointer );
1784};
1785
1786proto.pointerDown = function( event, pointer ) {
1787  this._bindPostStartEvents( event );
1788  this.emitEvent( 'pointerDown', [ event, pointer ] );
1789};
1790
1791var postStartEvents = {
1792  mousedown: [ 'mousemove', 'mouseup' ],
1793  touchstart: [ 'touchmove', 'touchend', 'touchcancel' ],
1794  pointerdown: [ 'pointermove', 'pointerup', 'pointercancel' ],
1795};
1796
1797proto._bindPostStartEvents = function( event ) {
1798  if ( !event ) {
1799    return;
1800  }
1801  var events = postStartEvents[ event.type ];
1802  events.forEach( function( eventName ) {
1803    window.addEventListener( eventName, this );
1804  }, this );
1805  this._boundPointerEvents = events;
1806};
1807
1808proto._unbindPostStartEvents = function() {
1809  if ( !this._boundPointerEvents ) {
1810    return;
1811  }
1812  this._boundPointerEvents.forEach( function( eventName ) {
1813    window.removeEventListener( eventName, this );
1814  }, this );
1815
1816  delete this._boundPointerEvents;
1817};
1818
1819
1820proto.onmousemove = function( event ) {
1821  this._pointerMove( event, event );
1822};
1823
1824proto.onpointermove = function( event ) {
1825  if ( event.pointerId == this.pointerIdentifier ) {
1826    this._pointerMove( event, event );
1827  }
1828};
1829
1830proto.ontouchmove = function( event ) {
1831  var touch = this.getTouch( event.changedTouches );
1832  if ( touch ) {
1833    this._pointerMove( event, touch );
1834  }
1835};
1836
1837proto._pointerMove = function( event, pointer ) {
1838  this.pointerMove( event, pointer );
1839};
1840
1841proto.pointerMove = function( event, pointer ) {
1842  this.emitEvent( 'pointerMove', [ event, pointer ] );
1843};
1844
1845
1846
1847proto.onmouseup = function( event ) {
1848  this._pointerUp( event, event );
1849};
1850
1851proto.onpointerup = function( event ) {
1852  if ( event.pointerId == this.pointerIdentifier ) {
1853    this._pointerUp( event, event );
1854  }
1855};
1856
1857proto.ontouchend = function( event ) {
1858  var touch = this.getTouch( event.changedTouches );
1859  if ( touch ) {
1860    this._pointerUp( event, touch );
1861  }
1862};
1863
1864proto._pointerUp = function( event, pointer ) {
1865  this._pointerDone();
1866  this.pointerUp( event, pointer );
1867};
1868
1869proto.pointerUp = function( event, pointer ) {
1870  this.emitEvent( 'pointerUp', [ event, pointer ] );
1871};
1872
1873
1874proto._pointerDone = function() {
1875  this._pointerReset();
1876  this._unbindPostStartEvents();
1877  this.pointerDone();
1878};
1879
1880proto._pointerReset = function() {
1881  this.isPointerDown = false;
1882  delete this.pointerIdentifier;
1883};
1884
1885proto.pointerDone = noop;
1886
1887
1888proto.onpointercancel = function( event ) {
1889  if ( event.pointerId == this.pointerIdentifier ) {
1890    this._pointerCancel( event, event );
1891  }
1892};
1893
1894proto.ontouchcancel = function( event ) {
1895  var touch = this.getTouch( event.changedTouches );
1896  if ( touch ) {
1897    this._pointerCancel( event, touch );
1898  }
1899};
1900
1901proto._pointerCancel = function( event, pointer ) {
1902  this._pointerDone();
1903  this.pointerCancel( event, pointer );
1904};
1905
1906proto.pointerCancel = function( event, pointer ) {
1907  this.emitEvent( 'pointerCancel', [ event, pointer ] );
1908};
1909
1910
1911Unipointer.getPointerPoint = function( pointer ) {
1912  return {
1913    x: pointer.pageX,
1914    y: pointer.pageY
1915  };
1916};
1917
1918
1919return Unipointer;
1920
1921}));
1922
1923
1924
1925( function( window, factory ) {
1926
1927  if ( typeof define == 'function' && define.amd ) {
1928    define( 'unidragger/unidragger',[
1929      'unipointer/unipointer'
1930    ], function( Unipointer ) {
1931      return factory( window, Unipointer );
1932    });
1933  } else if ( typeof module == 'object' && module.exports ) {
1934    module.exports = factory(
1935      window,
1936      require('unipointer')
1937    );
1938  } else {
1939    window.Unidragger = factory(
1940      window,
1941      window.Unipointer
1942    );
1943  }
1944
1945}( window, function factory( window, Unipointer ) {
1946
1947
1948
1949
1950function Unidragger() {}
1951
1952var proto = Unidragger.prototype = Object.create( Unipointer.prototype );
1953
1954
1955proto.bindHandles = function() {
1956  this._bindHandles( true );
1957};
1958
1959proto.unbindHandles = function() {
1960  this._bindHandles( false );
1961};
1962
1963proto._bindHandles = function( isAdd ) {
1964  isAdd = isAdd === undefined ? true : isAdd;
1965  var bindMethod = isAdd ? 'addEventListener' : 'removeEventListener';
1966  var touchAction = isAdd ? this._touchActionValue : '';
1967  for ( var i=0; i < this.handles.length; i++ ) {
1968    var handle = this.handles[i];
1969    this._bindStartEvent( handle, isAdd );
1970    handle[ bindMethod ]( 'click', this );
1971    if ( window.PointerEvent ) {
1972      handle.style.touchAction = touchAction;
1973    }
1974  }
1975};
1976
1977proto._touchActionValue = 'none';
1978
1979
1980proto.pointerDown = function( event, pointer ) {
1981  var isOkay = this.okayPointerDown( event );
1982  if ( !isOkay ) {
1983    return;
1984  }
1985  this.pointerDownPointer = {
1986    pageX: pointer.pageX,
1987    pageY: pointer.pageY,
1988  };
1989
1990  event.preventDefault();
1991  this.pointerDownBlur();
1992  this._bindPostStartEvents( event );
1993  this.emitEvent( 'pointerDown', [ event, pointer ] );
1994};
1995
1996var cursorNodes = {
1997  TEXTAREA: true,
1998  INPUT: true,
1999  SELECT: true,
2000  OPTION: true,
2001};
2002
2003var clickTypes = {
2004  radio: true,
2005  checkbox: true,
2006  button: true,
2007  submit: true,
2008  image: true,
2009  file: true,
2010};
2011
2012proto.okayPointerDown = function( event ) {
2013  var isCursorNode = cursorNodes[ event.target.nodeName ];
2014  var isClickType = clickTypes[ event.target.type ];
2015  var isOkay = !isCursorNode || isClickType;
2016  if ( !isOkay ) {
2017    this._pointerReset();
2018  }
2019  return isOkay;
2020};
2021
2022proto.pointerDownBlur = function() {
2023  var focused = document.activeElement;
2024  var canBlur = focused && focused.blur && focused != document.body;
2025  if ( canBlur ) {
2026    focused.blur();
2027  }
2028};
2029
2030
2031proto.pointerMove = function( event, pointer ) {
2032  var moveVector = this._dragPointerMove( event, pointer );
2033  this.emitEvent( 'pointerMove', [ event, pointer, moveVector ] );
2034  this._dragMove( event, pointer, moveVector );
2035};
2036
2037proto._dragPointerMove = function( event, pointer ) {
2038  var moveVector = {
2039    x: pointer.pageX - this.pointerDownPointer.pageX,
2040    y: pointer.pageY - this.pointerDownPointer.pageY
2041  };
2042  if ( !this.isDragging && this.hasDragStarted( moveVector ) ) {
2043    this._dragStart( event, pointer );
2044  }
2045  return moveVector;
2046};
2047
2048proto.hasDragStarted = function( moveVector ) {
2049  return Math.abs( moveVector.x ) > 3 || Math.abs( moveVector.y ) > 3;
2050};
2051
2052
2053proto.pointerUp = function( event, pointer ) {
2054  this.emitEvent( 'pointerUp', [ event, pointer ] );
2055  this._dragPointerUp( event, pointer );
2056};
2057
2058proto._dragPointerUp = function( event, pointer ) {
2059  if ( this.isDragging ) {
2060    this._dragEnd( event, pointer );
2061  } else {
2062    this._staticClick( event, pointer );
2063  }
2064};
2065
2066
2067proto._dragStart = function( event, pointer ) {
2068  this.isDragging = true;
2069  this.isPreventingClicks = true;
2070  this.dragStart( event, pointer );
2071};
2072
2073proto.dragStart = function( event, pointer ) {
2074  this.emitEvent( 'dragStart', [ event, pointer ] );
2075};
2076
2077proto._dragMove = function( event, pointer, moveVector ) {
2078  if ( !this.isDragging ) {
2079    return;
2080  }
2081
2082  this.dragMove( event, pointer, moveVector );
2083};
2084
2085proto.dragMove = function( event, pointer, moveVector ) {
2086  event.preventDefault();
2087  this.emitEvent( 'dragMove', [ event, pointer, moveVector ] );
2088};
2089
2090proto._dragEnd = function( event, pointer ) {
2091  this.isDragging = false;
2092  setTimeout( function() {
2093    delete this.isPreventingClicks;
2094  }.bind( this ) );
2095
2096  this.dragEnd( event, pointer );
2097};
2098
2099proto.dragEnd = function( event, pointer ) {
2100  this.emitEvent( 'dragEnd', [ event, pointer ] );
2101};
2102
2103
2104proto.onclick = function( event ) {
2105  if ( this.isPreventingClicks ) {
2106    event.preventDefault();
2107  }
2108};
2109
2110
2111proto._staticClick = function( event, pointer ) {
2112  if ( this.isIgnoringMouseUp && event.type == 'mouseup' ) {
2113    return;
2114  }
2115
2116  this.staticClick( event, pointer );
2117
2118  if ( event.type != 'mouseup' ) {
2119    this.isIgnoringMouseUp = true;
2120    setTimeout( function() {
2121      delete this.isIgnoringMouseUp;
2122    }.bind( this ), 400 );
2123  }
2124};
2125
2126proto.staticClick = function( event, pointer ) {
2127  this.emitEvent( 'staticClick', [ event, pointer ] );
2128};
2129
2130
2131Unidragger.getPointerPoint = Unipointer.getPointerPoint;
2132
2133
2134return Unidragger;
2135
2136}));
2137
2138( function( window, factory ) {
2139  if ( typeof define == 'function' && define.amd ) {
2140    define( 'flickity/js/drag',[
2141      './flickity',
2142      'unidragger/unidragger',
2143      'fizzy-ui-utils/utils',
2144    ], function( Flickity, Unidragger, utils ) {
2145      return factory( window, Flickity, Unidragger, utils );
2146    } );
2147  } else if ( typeof module == 'object' && module.exports ) {
2148    module.exports = factory(
2149        window,
2150        require('./flickity'),
2151        require('unidragger'),
2152        require('fizzy-ui-utils')
2153    );
2154  } else {
2155    window.Flickity = factory(
2156        window,
2157        window.Flickity,
2158        window.Unidragger,
2159        window.fizzyUIUtils
2160    );
2161  }
2162
2163}( window, function factory( window, Flickity, Unidragger, utils ) {
2164
2165
2166
2167
2168utils.extend( Flickity.defaults, {
2169  draggable: '>1',
2170  dragThreshold: 3,
2171} );
2172
2173
2174Flickity.createMethods.push('_createDrag');
2175
2176
2177var proto = Flickity.prototype;
2178utils.extend( proto, Unidragger.prototype );
2179proto._touchActionValue = 'pan-y';
2180
2181
2182proto._createDrag = function() {
2183  this.on( 'activate', this.onActivateDrag );
2184  this.on( 'uiChange', this._uiChangeDrag );
2185  this.on( 'deactivate', this.onDeactivateDrag );
2186  this.on( 'cellChange', this.updateDraggable );
2187};
2188
2189proto.onActivateDrag = function() {
2190  this.handles = [ this.viewport ];
2191  this.bindHandles();
2192  this.updateDraggable();
2193};
2194
2195proto.onDeactivateDrag = function() {
2196  this.unbindHandles();
2197  this.element.classList.remove('is-draggable');
2198};
2199
2200proto.updateDraggable = function() {
2201  if ( this.options.draggable == '>1' ) {
2202    this.isDraggable = this.slides.length > 1;
2203  } else {
2204    this.isDraggable = this.options.draggable;
2205  }
2206  if ( this.isDraggable ) {
2207    this.element.classList.add('is-draggable');
2208  } else {
2209    this.element.classList.remove('is-draggable');
2210  }
2211};
2212
2213proto.bindDrag = function() {
2214  this.options.draggable = true;
2215  this.updateDraggable();
2216};
2217
2218proto.unbindDrag = function() {
2219  this.options.draggable = false;
2220  this.updateDraggable();
2221};
2222
2223proto._uiChangeDrag = function() {
2224  delete this.isFreeScrolling;
2225};
2226
2227
2228proto.pointerDown = function( event, pointer ) {
2229  if ( !this.isDraggable ) {
2230    this._pointerDownDefault( event, pointer );
2231    return;
2232  }
2233  var isOkay = this.okayPointerDown( event );
2234  if ( !isOkay ) {
2235    return;
2236  }
2237
2238  this._pointerDownPreventDefault( event );
2239  this.pointerDownFocus( event );
2240  if ( document.activeElement != this.element ) {
2241    this.pointerDownBlur();
2242  }
2243
2244  this.dragX = this.x;
2245  this.viewport.classList.add('is-pointer-down');
2246  this.pointerDownScroll = getScrollPosition();
2247  window.addEventListener( 'scroll', this );
2248
2249  this._pointerDownDefault( event, pointer );
2250};
2251
2252proto._pointerDownDefault = function( event, pointer ) {
2253  this.pointerDownPointer = {
2254    pageX: pointer.pageX,
2255    pageY: pointer.pageY,
2256  };
2257  this._bindPostStartEvents( event );
2258  this.dispatchEvent( 'pointerDown', event, [ pointer ] );
2259};
2260
2261var focusNodes = {
2262  INPUT: true,
2263  TEXTAREA: true,
2264  SELECT: true,
2265};
2266
2267proto.pointerDownFocus = function( event ) {
2268  var isFocusNode = focusNodes[ event.target.nodeName ];
2269  if ( !isFocusNode ) {
2270    this.focus();
2271  }
2272};
2273
2274proto._pointerDownPreventDefault = function( event ) {
2275  var isTouchStart = event.type == 'touchstart';
2276  var isTouchPointer = event.pointerType == 'touch';
2277  var isFocusNode = focusNodes[ event.target.nodeName ];
2278  if ( !isTouchStart && !isTouchPointer && !isFocusNode ) {
2279    event.preventDefault();
2280  }
2281};
2282
2283
2284proto.hasDragStarted = function( moveVector ) {
2285  return Math.abs( moveVector.x ) > this.options.dragThreshold;
2286};
2287
2288
2289proto.pointerUp = function( event, pointer ) {
2290  delete this.isTouchScrolling;
2291  this.viewport.classList.remove('is-pointer-down');
2292  this.dispatchEvent( 'pointerUp', event, [ pointer ] );
2293  this._dragPointerUp( event, pointer );
2294};
2295
2296proto.pointerDone = function() {
2297  window.removeEventListener( 'scroll', this );
2298  delete this.pointerDownScroll;
2299};
2300
2301
2302proto.dragStart = function( event, pointer ) {
2303  if ( !this.isDraggable ) {
2304    return;
2305  }
2306  this.dragStartPosition = this.x;
2307  this.startAnimation();
2308  window.removeEventListener( 'scroll', this );
2309  this.dispatchEvent( 'dragStart', event, [ pointer ] );
2310};
2311
2312proto.pointerMove = function( event, pointer ) {
2313  var moveVector = this._dragPointerMove( event, pointer );
2314  this.dispatchEvent( 'pointerMove', event, [ pointer, moveVector ] );
2315  this._dragMove( event, pointer, moveVector );
2316};
2317
2318proto.dragMove = function( event, pointer, moveVector ) {
2319  if ( !this.isDraggable ) {
2320    return;
2321  }
2322  event.preventDefault();
2323
2324  this.previousDragX = this.dragX;
2325  var direction = this.options.rightToLeft ? -1 : 1;
2326  if ( this.options.wrapAround ) {
2327    moveVector.x %= this.slideableWidth;
2328  }
2329  var dragX = this.dragStartPosition + moveVector.x * direction;
2330
2331  if ( !this.options.wrapAround && this.slides.length ) {
2332    var originBound = Math.max( -this.slides[0].target, this.dragStartPosition );
2333    dragX = dragX > originBound ? ( dragX + originBound ) * 0.5 : dragX;
2334    var endBound = Math.min( -this.getLastSlide().target, this.dragStartPosition );
2335    dragX = dragX < endBound ? ( dragX + endBound ) * 0.5 : dragX;
2336  }
2337
2338  this.dragX = dragX;
2339
2340  this.dragMoveTime = new Date();
2341  this.dispatchEvent( 'dragMove', event, [ pointer, moveVector ] );
2342};
2343
2344proto.dragEnd = function( event, pointer ) {
2345  if ( !this.isDraggable ) {
2346    return;
2347  }
2348  if ( this.options.freeScroll ) {
2349    this.isFreeScrolling = true;
2350  }
2351  var index = this.dragEndRestingSelect();
2352
2353  if ( this.options.freeScroll && !this.options.wrapAround ) {
2354    var restingX = this.getRestingPosition();
2355    this.isFreeScrolling = -restingX > this.slides[0].target &&
2356      -restingX < this.getLastSlide().target;
2357  } else if ( !this.options.freeScroll && index == this.selectedIndex ) {
2358    index += this.dragEndBoostSelect();
2359  }
2360  delete this.previousDragX;
2361  this.isDragSelect = this.options.wrapAround;
2362  this.select( index );
2363  delete this.isDragSelect;
2364  this.dispatchEvent( 'dragEnd', event, [ pointer ] );
2365};
2366
2367proto.dragEndRestingSelect = function() {
2368  var restingX = this.getRestingPosition();
2369  var distance = Math.abs( this.getSlideDistance( -restingX, this.selectedIndex ) );
2370  var positiveResting = this._getClosestResting( restingX, distance, 1 );
2371  var negativeResting = this._getClosestResting( restingX, distance, -1 );
2372  var index = positiveResting.distance < negativeResting.distance ?
2373    positiveResting.index : negativeResting.index;
2374  return index;
2375};
2376
2377proto._getClosestResting = function( restingX, distance, increment ) {
2378  var index = this.selectedIndex;
2379  var minDistance = Infinity;
2380  var condition = this.options.contain && !this.options.wrapAround ?
2381    function( dist, minDist ) {
2382      return dist <= minDist;
2383    } : function( dist, minDist ) {
2384      return dist < minDist;
2385    };
2386  while ( condition( distance, minDistance ) ) {
2387    index += increment;
2388    minDistance = distance;
2389    distance = this.getSlideDistance( -restingX, index );
2390    if ( distance === null ) {
2391      break;
2392    }
2393    distance = Math.abs( distance );
2394  }
2395  return {
2396    distance: minDistance,
2397    index: index - increment,
2398  };
2399};
2400
2401proto.getSlideDistance = function( x, index ) {
2402  var len = this.slides.length;
2403  var isWrapAround = this.options.wrapAround && len > 1;
2404  var slideIndex = isWrapAround ? utils.modulo( index, len ) : index;
2405  var slide = this.slides[ slideIndex ];
2406  if ( !slide ) {
2407    return null;
2408  }
2409  var wrap = isWrapAround ? this.slideableWidth * Math.floor( index/len ) : 0;
2410  return x - ( slide.target + wrap );
2411};
2412
2413proto.dragEndBoostSelect = function() {
2414  if ( this.previousDragX === undefined || !this.dragMoveTime ||
2415    new Date() - this.dragMoveTime > 100 ) {
2416    return 0;
2417  }
2418
2419  var distance = this.getSlideDistance( -this.dragX, this.selectedIndex );
2420  var delta = this.previousDragX - this.dragX;
2421  if ( distance > 0 && delta > 0 ) {
2422    return 1;
2423  } else if ( distance < 0 && delta < 0 ) {
2424    return -1;
2425  }
2426  return 0;
2427};
2428
2429
2430proto.staticClick = function( event, pointer ) {
2431  var clickedCell = this.getParentCell( event.target );
2432  var cellElem = clickedCell && clickedCell.element;
2433  var cellIndex = clickedCell && this.cells.indexOf( clickedCell );
2434  this.dispatchEvent( 'staticClick', event, [ pointer, cellElem, cellIndex ] );
2435};
2436
2437
2438proto.onscroll = function() {
2439  var scroll = getScrollPosition();
2440  var scrollMoveX = this.pointerDownScroll.x - scroll.x;
2441  var scrollMoveY = this.pointerDownScroll.y - scroll.y;
2442  if ( Math.abs( scrollMoveX ) > 3 || Math.abs( scrollMoveY ) > 3 ) {
2443    this._pointerDone();
2444  }
2445};
2446
2447
2448function getScrollPosition() {
2449  return {
2450    x: window.pageXOffset,
2451    y: window.pageYOffset,
2452  };
2453}
2454
2455
2456return Flickity;
2457
2458} ) );
2459
2460( function( window, factory ) {
2461  if ( typeof define == 'function' && define.amd ) {
2462    define( 'flickity/js/prev-next-button',[
2463      './flickity',
2464      'unipointer/unipointer',
2465      'fizzy-ui-utils/utils',
2466    ], function( Flickity, Unipointer, utils ) {
2467      return factory( window, Flickity, Unipointer, utils );
2468    } );
2469  } else if ( typeof module == 'object' && module.exports ) {
2470    module.exports = factory(
2471        window,
2472        require('./flickity'),
2473        require('unipointer'),
2474        require('fizzy-ui-utils')
2475    );
2476  } else {
2477    factory(
2478        window,
2479        window.Flickity,
2480        window.Unipointer,
2481        window.fizzyUIUtils
2482    );
2483  }
2484
2485}( window, function factory( window, Flickity, Unipointer, utils ) {
2486'use strict';
2487
2488var svgURI = 'http://www.w3.org/2000/svg';
2489
2490
2491function PrevNextButton( direction, parent ) {
2492  this.direction = direction;
2493  this.parent = parent;
2494  this._create();
2495}
2496
2497PrevNextButton.prototype = Object.create( Unipointer.prototype );
2498
2499PrevNextButton.prototype._create = function() {
2500  this.isEnabled = true;
2501  this.isPrevious = this.direction == -1;
2502  var leftDirection = this.parent.options.rightToLeft ? 1 : -1;
2503  this.isLeft = this.direction == leftDirection;
2504
2505  var element = this.element = document.createElement('button');
2506  element.className = 'flickity-button flickity-prev-next-button';
2507  element.className += this.isPrevious ? ' previous' : ' next';
2508  element.setAttribute( 'type', 'button' );
2509  this.disable();
2510
2511  element.setAttribute( 'aria-label', this.isPrevious ? 'Previous' : 'Next' );
2512
2513  var svg = this.createSVG();
2514  element.appendChild( svg );
2515  this.parent.on( 'select', this.update.bind( this ) );
2516  this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );
2517};
2518
2519PrevNextButton.prototype.activate = function() {
2520  this.bindStartEvent( this.element );
2521  this.element.addEventListener( 'click', this );
2522  this.parent.element.appendChild( this.element );
2523};
2524
2525PrevNextButton.prototype.deactivate = function() {
2526  this.parent.element.removeChild( this.element );
2527  this.unbindStartEvent( this.element );
2528  this.element.removeEventListener( 'click', this );
2529};
2530
2531PrevNextButton.prototype.createSVG = function() {
2532  var svg = document.createElementNS( svgURI, 'svg' );
2533  svg.setAttribute( 'class', 'flickity-button-icon' );
2534  svg.setAttribute( 'viewBox', '0 0 100 100' );
2535  var path = document.createElementNS( svgURI, 'path' );
2536  var pathMovements = getArrowMovements( this.parent.options.arrowShape );
2537  path.setAttribute( 'd', pathMovements );
2538  path.setAttribute( 'class', 'arrow' );
2539  if ( !this.isLeft ) {
2540    path.setAttribute( 'transform', 'translate(100, 100) rotate(180) ' );
2541  }
2542  svg.appendChild( path );
2543  return svg;
2544};
2545
2546function getArrowMovements( shape ) {
2547  if ( typeof shape == 'string' ) {
2548    return shape;
2549  }
2550  return 'M ' + shape.x0 + ',50' +
2551    ' L ' + shape.x1 + ',' + ( shape.y1 + 50 ) +
2552    ' L ' + shape.x2 + ',' + ( shape.y2 + 50 ) +
2553    ' L ' + shape.x3 + ',50 ' +
2554    ' L ' + shape.x2 + ',' + ( 50 - shape.y2 ) +
2555    ' L ' + shape.x1 + ',' + ( 50 - shape.y1 ) +
2556    ' Z';
2557}
2558
2559PrevNextButton.prototype.handleEvent = utils.handleEvent;
2560
2561PrevNextButton.prototype.onclick = function() {
2562  if ( !this.isEnabled ) {
2563    return;
2564  }
2565  this.parent.uiChange();
2566  var method = this.isPrevious ? 'previous' : 'next';
2567  this.parent[ method ]();
2568};
2569
2570
2571PrevNextButton.prototype.enable = function() {
2572  if ( this.isEnabled ) {
2573    return;
2574  }
2575  this.element.disabled = false;
2576  this.isEnabled = true;
2577};
2578
2579PrevNextButton.prototype.disable = function() {
2580  if ( !this.isEnabled ) {
2581    return;
2582  }
2583  this.element.disabled = true;
2584  this.isEnabled = false;
2585};
2586
2587PrevNextButton.prototype.update = function() {
2588  var slides = this.parent.slides;
2589  if ( this.parent.options.wrapAround && slides.length > 1 ) {
2590    this.enable();
2591    return;
2592  }
2593  var lastIndex = slides.length ? slides.length - 1 : 0;
2594  var boundIndex = this.isPrevious ? 0 : lastIndex;
2595  var method = this.parent.selectedIndex == boundIndex ? 'disable' : 'enable';
2596  this[ method ]();
2597};
2598
2599PrevNextButton.prototype.destroy = function() {
2600  this.deactivate();
2601  this.allOff();
2602};
2603
2604
2605utils.extend( Flickity.defaults, {
2606  prevNextButtons: true,
2607  arrowShape: {
2608    x0: 10,
2609    x1: 60, y1: 50,
2610    x2: 70, y2: 40,
2611    x3: 30,
2612  },
2613} );
2614
2615Flickity.createMethods.push('_createPrevNextButtons');
2616var proto = Flickity.prototype;
2617
2618proto._createPrevNextButtons = function() {
2619  if ( !this.options.prevNextButtons ) {
2620    return;
2621  }
2622
2623  this.prevButton = new PrevNextButton( -1, this );
2624  this.nextButton = new PrevNextButton( 1, this );
2625
2626  this.on( 'activate', this.activatePrevNextButtons );
2627};
2628
2629proto.activatePrevNextButtons = function() {
2630  this.prevButton.activate();
2631  this.nextButton.activate();
2632  this.on( 'deactivate', this.deactivatePrevNextButtons );
2633};
2634
2635proto.deactivatePrevNextButtons = function() {
2636  this.prevButton.deactivate();
2637  this.nextButton.deactivate();
2638  this.off( 'deactivate', this.deactivatePrevNextButtons );
2639};
2640
2641
2642Flickity.PrevNextButton = PrevNextButton;
2643
2644return Flickity;
2645
2646} ) );
2647
2648( function( window, factory ) {
2649  if ( typeof define == 'function' && define.amd ) {
2650    define( 'flickity/js/page-dots',[
2651      './flickity',
2652      'unipointer/unipointer',
2653      'fizzy-ui-utils/utils',
2654    ], function( Flickity, Unipointer, utils ) {
2655      return factory( window, Flickity, Unipointer, utils );
2656    } );
2657  } else if ( typeof module == 'object' && module.exports ) {
2658    module.exports = factory(
2659        window,
2660        require('./flickity'),
2661        require('unipointer'),
2662        require('fizzy-ui-utils')
2663    );
2664  } else {
2665    factory(
2666        window,
2667        window.Flickity,
2668        window.Unipointer,
2669        window.fizzyUIUtils
2670    );
2671  }
2672
2673}( window, function factory( window, Flickity, Unipointer, utils ) {
2674
2675
2676
2677
2678function PageDots( parent ) {
2679  this.parent = parent;
2680  this._create();
2681}
2682
2683PageDots.prototype = Object.create( Unipointer.prototype );
2684
2685PageDots.prototype._create = function() {
2686  this.holder = document.createElement('ol');
2687  this.holder.className = 'flickity-page-dots';
2688  this.dots = [];
2689  this.handleClick = this.onClick.bind( this );
2690  this.on( 'pointerDown', this.parent.childUIPointerDown.bind( this.parent ) );
2691};
2692
2693PageDots.prototype.activate = function() {
2694  this.setDots();
2695  this.holder.addEventListener( 'click', this.handleClick );
2696  this.bindStartEvent( this.holder );
2697  this.parent.element.appendChild( this.holder );
2698};
2699
2700PageDots.prototype.deactivate = function() {
2701  this.holder.removeEventListener( 'click', this.handleClick );
2702  this.unbindStartEvent( this.holder );
2703  this.parent.element.removeChild( this.holder );
2704};
2705
2706PageDots.prototype.setDots = function() {
2707  var delta = this.parent.slides.length - this.dots.length;
2708  if ( delta > 0 ) {
2709    this.addDots( delta );
2710  } else if ( delta < 0 ) {
2711    this.removeDots( -delta );
2712  }
2713};
2714
2715PageDots.prototype.addDots = function( count ) {
2716  var fragment = document.createDocumentFragment();
2717  var newDots = [];
2718  var length = this.dots.length;
2719  var max = length + count;
2720
2721  for ( var i = length; i < max; i++ ) {
2722    var dot = document.createElement('li');
2723    dot.className = 'dot';
2724    dot.setAttribute( 'aria-label', 'Page dot ' + ( i + 1 ) );
2725    fragment.appendChild( dot );
2726    newDots.push( dot );
2727  }
2728
2729  this.holder.appendChild( fragment );
2730  this.dots = this.dots.concat( newDots );
2731};
2732
2733PageDots.prototype.removeDots = function( count ) {
2734  var removeDots = this.dots.splice( this.dots.length - count, count );
2735  removeDots.forEach( function( dot ) {
2736    this.holder.removeChild( dot );
2737  }, this );
2738};
2739
2740PageDots.prototype.updateSelected = function() {
2741  if ( this.selectedDot ) {
2742    this.selectedDot.className = 'dot';
2743    this.selectedDot.removeAttribute('aria-current');
2744  }
2745  if ( !this.dots.length ) {
2746    return;
2747  }
2748  this.selectedDot = this.dots[ this.parent.selectedIndex ];
2749  this.selectedDot.className = 'dot is-selected';
2750  this.selectedDot.setAttribute( 'aria-current', 'step' );
2751};
2752
2753PageDots.prototype.onTap = 
2754PageDots.prototype.onClick = function( event ) {
2755  var target = event.target;
2756  if ( target.nodeName != 'LI' ) {
2757    return;
2758  }
2759
2760  this.parent.uiChange();
2761  var index = this.dots.indexOf( target );
2762  this.parent.select( index );
2763};
2764
2765PageDots.prototype.destroy = function() {
2766  this.deactivate();
2767  this.allOff();
2768};
2769
2770Flickity.PageDots = PageDots;
2771
2772
2773utils.extend( Flickity.defaults, {
2774  pageDots: true,
2775} );
2776
2777Flickity.createMethods.push('_createPageDots');
2778
2779var proto = Flickity.prototype;
2780
2781proto._createPageDots = function() {
2782  if ( !this.options.pageDots ) {
2783    return;
2784  }
2785  this.pageDots = new PageDots( this );
2786  this.on( 'activate', this.activatePageDots );
2787  this.on( 'select', this.updateSelectedPageDots );
2788  this.on( 'cellChange', this.updatePageDots );
2789  this.on( 'resize', this.updatePageDots );
2790  this.on( 'deactivate', this.deactivatePageDots );
2791};
2792
2793proto.activatePageDots = function() {
2794  this.pageDots.activate();
2795};
2796
2797proto.updateSelectedPageDots = function() {
2798  this.pageDots.updateSelected();
2799};
2800
2801proto.updatePageDots = function() {
2802  this.pageDots.setDots();
2803};
2804
2805proto.deactivatePageDots = function() {
2806  this.pageDots.deactivate();
2807};
2808
2809
2810Flickity.PageDots = PageDots;
2811
2812return Flickity;
2813
2814} ) );
2815
2816( function( window, factory ) {
2817  if ( typeof define == 'function' && define.amd ) {
2818    define( 'flickity/js/player',[
2819      'ev-emitter/ev-emitter',
2820      'fizzy-ui-utils/utils',
2821      './flickity',
2822    ], function( EvEmitter, utils, Flickity ) {
2823      return factory( EvEmitter, utils, Flickity );
2824    } );
2825  } else if ( typeof module == 'object' && module.exports ) {
2826    module.exports = factory(
2827        require('ev-emitter'),
2828        require('fizzy-ui-utils'),
2829        require('./flickity')
2830    );
2831  } else {
2832    factory(
2833        window.EvEmitter,
2834        window.fizzyUIUtils,
2835        window.Flickity
2836    );
2837  }
2838
2839}( window, function factory( EvEmitter, utils, Flickity ) {
2840
2841
2842
2843
2844function Player( parent ) {
2845  this.parent = parent;
2846  this.state = 'stopped';
2847  this.onVisibilityChange = this.visibilityChange.bind( this );
2848  this.onVisibilityPlay = this.visibilityPlay.bind( this );
2849}
2850
2851Player.prototype = Object.create( EvEmitter.prototype );
2852
2853Player.prototype.play = function() {
2854  if ( this.state == 'playing' ) {
2855    return;
2856  }
2857  var isPageHidden = document.hidden;
2858  if ( isPageHidden ) {
2859    document.addEventListener( 'visibilitychange', this.onVisibilityPlay );
2860    return;
2861  }
2862
2863  this.state = 'playing';
2864  document.addEventListener( 'visibilitychange', this.onVisibilityChange );
2865  this.tick();
2866};
2867
2868Player.prototype.tick = function() {
2869  if ( this.state != 'playing' ) {
2870    return;
2871  }
2872
2873  var time = this.parent.options.autoPlay;
2874  time = typeof time == 'number' ? time : 3000;
2875  var _this = this;
2876  this.clear();
2877  this.timeout = setTimeout( function() {
2878    _this.parent.next( true );
2879    _this.tick();
2880  }, time );
2881};
2882
2883Player.prototype.stop = function() {
2884  this.state = 'stopped';
2885  this.clear();
2886  document.removeEventListener( 'visibilitychange', this.onVisibilityChange );
2887};
2888
2889Player.prototype.clear = function() {
2890  clearTimeout( this.timeout );
2891};
2892
2893Player.prototype.pause = function() {
2894  if ( this.state == 'playing' ) {
2895    this.state = 'paused';
2896    this.clear();
2897  }
2898};
2899
2900Player.prototype.unpause = function() {
2901  if ( this.state == 'paused' ) {
2902    this.play();
2903  }
2904};
2905
2906Player.prototype.visibilityChange = function() {
2907  var isPageHidden = document.hidden;
2908  this[ isPageHidden ? 'pause' : 'unpause' ]();
2909};
2910
2911Player.prototype.visibilityPlay = function() {
2912  this.play();
2913  document.removeEventListener( 'visibilitychange', this.onVisibilityPlay );
2914};
2915
2916
2917utils.extend( Flickity.defaults, {
2918  pauseAutoPlayOnHover: true,
2919} );
2920
2921Flickity.createMethods.push('_createPlayer');
2922var proto = Flickity.prototype;
2923
2924proto._createPlayer = function() {
2925  this.player = new Player( this );
2926
2927  this.on( 'activate', this.activatePlayer );
2928  this.on( 'uiChange', this.stopPlayer );
2929  this.on( 'pointerDown', this.stopPlayer );
2930  this.on( 'deactivate', this.deactivatePlayer );
2931};
2932
2933proto.activatePlayer = function() {
2934  if ( !this.options.autoPlay ) {
2935    return;
2936  }
2937  this.player.play();
2938  this.element.addEventListener( 'mouseenter', this );
2939};
2940
2941
2942proto.playPlayer = function() {
2943  this.player.play();
2944};
2945
2946proto.stopPlayer = function() {
2947  this.player.stop();
2948};
2949
2950proto.pausePlayer = function() {
2951  this.player.pause();
2952};
2953
2954proto.unpausePlayer = function() {
2955  this.player.unpause();
2956};
2957
2958proto.deactivatePlayer = function() {
2959  this.player.stop();
2960  this.element.removeEventListener( 'mouseenter', this );
2961};
2962
2963
2964proto.onmouseenter = function() {
2965  if ( !this.options.pauseAutoPlayOnHover ) {
2966    return;
2967  }
2968  this.player.pause();
2969  this.element.addEventListener( 'mouseleave', this );
2970};
2971
2972proto.onmouseleave = function() {
2973  this.player.unpause();
2974  this.element.removeEventListener( 'mouseleave', this );
2975};
2976
2977
2978Flickity.Player = Player;
2979
2980return Flickity;
2981
2982} ) );
2983
2984( function( window, factory ) {
2985  if ( typeof define == 'function' && define.amd ) {
2986    define( 'flickity/js/add-remove-cell',[
2987      './flickity',
2988      'fizzy-ui-utils/utils',
2989    ], function( Flickity, utils ) {
2990      return factory( window, Flickity, utils );
2991    } );
2992  } else if ( typeof module == 'object' && module.exports ) {
2993    module.exports = factory(
2994        window,
2995        require('./flickity'),
2996        require('fizzy-ui-utils')
2997    );
2998  } else {
2999    factory(
3000        window,
3001        window.Flickity,
3002        window.fizzyUIUtils
3003    );
3004  }
3005
3006}( window, function factory( window, Flickity, utils ) {
3007
3008
3009
3010function getCellsFragment( cells ) {
3011  var fragment = document.createDocumentFragment();
3012  cells.forEach( function( cell ) {
3013    fragment.appendChild( cell.element );
3014  } );
3015  return fragment;
3016}
3017
3018
3019var proto = Flickity.prototype;
3020
3021proto.insert = function( elems, index ) {
3022  var cells = this._makeCells( elems );
3023  if ( !cells || !cells.length ) {
3024    return;
3025  }
3026  var len = this.cells.length;
3027  index = index === undefined ? len : index;
3028  var fragment = getCellsFragment( cells );
3029  var isAppend = index == len;
3030  if ( isAppend ) {
3031    this.slider.appendChild( fragment );
3032  } else {
3033    var insertCellElement = this.cells[ index ].element;
3034    this.slider.insertBefore( fragment, insertCellElement );
3035  }
3036  if ( index === 0 ) {
3037    this.cells = cells.concat( this.cells );
3038  } else if ( isAppend ) {
3039    this.cells = this.cells.concat( cells );
3040  } else {
3041    var endCells = this.cells.splice( index, len - index );
3042    this.cells = this.cells.concat( cells ).concat( endCells );
3043  }
3044
3045  this._sizeCells( cells );
3046  this.cellChange( index, true );
3047};
3048
3049proto.append = function( elems ) {
3050  this.insert( elems, this.cells.length );
3051};
3052
3053proto.prepend = function( elems ) {
3054  this.insert( elems, 0 );
3055};
3056
3057proto.remove = function( elems ) {
3058  var cells = this.getCells( elems );
3059  if ( !cells || !cells.length ) {
3060    return;
3061  }
3062
3063  var minCellIndex = this.cells.length - 1;
3064  cells.forEach( function( cell ) {
3065    cell.remove();
3066    var index = this.cells.indexOf( cell );
3067    minCellIndex = Math.min( index, minCellIndex );
3068    utils.removeFrom( this.cells, cell );
3069  }, this );
3070
3071  this.cellChange( minCellIndex, true );
3072};
3073
3074proto.cellSizeChange = function( elem ) {
3075  var cell = this.getCell( elem );
3076  if ( !cell ) {
3077    return;
3078  }
3079  cell.getSize();
3080
3081  var index = this.cells.indexOf( cell );
3082  this.cellChange( index );
3083};
3084
3085proto.cellChange = function( changedCellIndex, isPositioningSlider ) {
3086  var prevSelectedElem = this.selectedElement;
3087  this._positionCells( changedCellIndex );
3088  this._getWrapShiftCells();
3089  this.setGallerySize();
3090  var cell = this.getCell( prevSelectedElem );
3091  if ( cell ) {
3092    this.selectedIndex = this.getCellSlideIndex( cell );
3093  }
3094  this.selectedIndex = Math.min( this.slides.length - 1, this.selectedIndex );
3095
3096  this.emitEvent( 'cellChange', [ changedCellIndex ] );
3097  this.select( this.selectedIndex );
3098  if ( isPositioningSlider ) {
3099    this.positionSliderAtSelected();
3100  }
3101};
3102
3103
3104return Flickity;
3105
3106} ) );
3107
3108( function( window, factory ) {
3109  if ( typeof define == 'function' && define.amd ) {
3110    define( 'flickity/js/lazyload',[
3111      './flickity',
3112      'fizzy-ui-utils/utils',
3113    ], function( Flickity, utils ) {
3114      return factory( window, Flickity, utils );
3115    } );
3116  } else if ( typeof module == 'object' && module.exports ) {
3117    module.exports = factory(
3118        window,
3119        require('./flickity'),
3120        require('fizzy-ui-utils')
3121    );
3122  } else {
3123    factory(
3124        window,
3125        window.Flickity,
3126        window.fizzyUIUtils
3127    );
3128  }
3129
3130}( window, function factory( window, Flickity, utils ) {
3131'use strict';
3132
3133Flickity.createMethods.push('_createLazyload');
3134var proto = Flickity.prototype;
3135
3136proto._createLazyload = function() {
3137  this.on( 'select', this.lazyLoad );
3138};
3139
3140proto.lazyLoad = function() {
3141  var lazyLoad = this.options.lazyLoad;
3142  if ( !lazyLoad ) {
3143    return;
3144  }
3145  var adjCount = typeof lazyLoad == 'number' ? lazyLoad : 0;
3146  var cellElems = this.getAdjacentCellElements( adjCount );
3147  var lazyImages = [];
3148  cellElems.forEach( function( cellElem ) {
3149    var lazyCellImages = getCellLazyImages( cellElem );
3150    lazyImages = lazyImages.concat( lazyCellImages );
3151  } );
3152  lazyImages.forEach( function( img ) {
3153    new LazyLoader( img, this );
3154  }, this );
3155};
3156
3157function getCellLazyImages( cellElem ) {
3158  if ( cellElem.nodeName == 'IMG' ) {
3159    var lazyloadAttr = cellElem.getAttribute('data-flickity-lazyload');
3160    var srcAttr = cellElem.getAttribute('data-flickity-lazyload-src');
3161    var srcsetAttr = cellElem.getAttribute('data-flickity-lazyload-srcset');
3162    if ( lazyloadAttr || srcAttr || srcsetAttr ) {
3163      return [ cellElem ];
3164    }
3165  }
3166  var lazySelector = 'img[data-flickity-lazyload], ' +
3167    'img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]';
3168  var imgs = cellElem.querySelectorAll( lazySelector );
3169  return utils.makeArray( imgs );
3170}
3171
3172
3173function LazyLoader( img, flickity ) {
3174  this.img = img;
3175  this.flickity = flickity;
3176  this.load();
3177}
3178
3179LazyLoader.prototype.handleEvent = utils.handleEvent;
3180
3181LazyLoader.prototype.load = function() {
3182  this.img.addEventListener( 'load', this );
3183  this.img.addEventListener( 'error', this );
3184  var src = this.img.getAttribute('data-flickity-lazyload') ||
3185    this.img.getAttribute('data-flickity-lazyload-src');
3186  var srcset = this.img.getAttribute('data-flickity-lazyload-srcset');
3187  this.img.src = src;
3188  if ( srcset ) {
3189    this.img.setAttribute( 'srcset', srcset );
3190  }
3191  this.img.removeAttribute('data-flickity-lazyload');
3192  this.img.removeAttribute('data-flickity-lazyload-src');
3193  this.img.removeAttribute('data-flickity-lazyload-srcset');
3194};
3195
3196LazyLoader.prototype.onload = function( event ) {
3197  this.complete( event, 'flickity-lazyloaded' );
3198};
3199
3200LazyLoader.prototype.onerror = function( event ) {
3201  this.complete( event, 'flickity-lazyerror' );
3202};
3203
3204LazyLoader.prototype.complete = function( event, className ) {
3205  this.img.removeEventListener( 'load', this );
3206  this.img.removeEventListener( 'error', this );
3207
3208  var cell = this.flickity.getParentCell( this.img );
3209  var cellElem = cell && cell.element;
3210  this.flickity.cellSizeChange( cellElem );
3211
3212  this.img.classList.add( className );
3213  this.flickity.dispatchEvent( 'lazyLoad', event, cellElem );
3214};
3215
3216
3217Flickity.LazyLoader = LazyLoader;
3218
3219return Flickity;
3220
3221} ) );
3222
3223
3224( function( window, factory ) {
3225  if ( typeof define == 'function' && define.amd ) {
3226    define( 'flickity/js/index',[
3227      './flickity',
3228      './drag',
3229      './prev-next-button',
3230      './page-dots',
3231      './player',
3232      './add-remove-cell',
3233      './lazyload',
3234    ], factory );
3235  } else if ( typeof module == 'object' && module.exports ) {
3236    module.exports = factory(
3237        require('./flickity'),
3238        require('./drag'),
3239        require('./prev-next-button'),
3240        require('./page-dots'),
3241        require('./player'),
3242        require('./add-remove-cell'),
3243        require('./lazyload')
3244    );
3245  }
3246
3247} )( window, function factory( Flickity ) {
3248  return Flickity;
3249} );
3250
3251
3252
3253( function( window, factory ) {
3254  if ( typeof define == 'function' && define.amd ) {
3255    define( 'flickity-as-nav-for/as-nav-for',[
3256      'flickity/js/index',
3257      'fizzy-ui-utils/utils'
3258    ], factory );
3259  } else if ( typeof module == 'object' && module.exports ) {
3260    module.exports = factory(
3261      require('flickity'),
3262      require('fizzy-ui-utils')
3263    );
3264  } else {
3265    window.Flickity = factory(
3266      window.Flickity,
3267      window.fizzyUIUtils
3268    );
3269  }
3270
3271}( window, function factory( Flickity, utils ) {
3272
3273
3274
3275
3276
3277Flickity.createMethods.push('_createAsNavFor');
3278
3279var proto = Flickity.prototype;
3280
3281proto._createAsNavFor = function() {
3282  this.on( 'activate', this.activateAsNavFor );
3283  this.on( 'deactivate', this.deactivateAsNavFor );
3284  this.on( 'destroy', this.destroyAsNavFor );
3285
3286  var asNavForOption = this.options.asNavFor;
3287  if ( !asNavForOption ) {
3288    return;
3289  }
3290  var _this = this;
3291  setTimeout( function initNavCompanion() {
3292    _this.setNavCompanion( asNavForOption );
3293  });
3294};
3295
3296proto.setNavCompanion = function( elem ) {
3297  elem = utils.getQueryElement( elem );
3298  var companion = Flickity.data( elem );
3299  if ( !companion || companion == this ) {
3300    return;
3301  }
3302
3303  this.navCompanion = companion;
3304  var _this = this;
3305  this.onNavCompanionSelect = function() {
3306    _this.navCompanionSelect();
3307  };
3308  companion.on( 'select', this.onNavCompanionSelect );
3309  this.on( 'staticClick', this.onNavStaticClick );
3310
3311  this.navCompanionSelect( true );
3312};
3313
3314proto.navCompanionSelect = function( isInstant ) {
3315  var companionCells = this.navCompanion && this.navCompanion.selectedCells;
3316  if ( !companionCells ) {
3317    return;
3318  }
3319  var selectedCell = companionCells[0];
3320  var firstIndex = this.navCompanion.cells.indexOf( selectedCell );
3321  var lastIndex = firstIndex + companionCells.length - 1;
3322  var selectIndex = Math.floor( lerp( firstIndex, lastIndex,
3323    this.navCompanion.cellAlign ) );
3324  this.selectCell( selectIndex, false, isInstant );
3325  this.removeNavSelectedElements();
3326  if ( selectIndex >= this.cells.length ) {
3327    return;
3328  }
3329
3330  var selectedCells = this.cells.slice( firstIndex, lastIndex + 1 );
3331  this.navSelectedElements = selectedCells.map( function( cell ) {
3332    return cell.element;
3333  });
3334  this.changeNavSelectedClass('add');
3335};
3336
3337function lerp( a, b, t ) {
3338  return ( b - a ) * t + a;
3339}
3340
3341proto.changeNavSelectedClass = function( method ) {
vendor: 4,280 bytes, lines 3342-3536
3342  this.navSelectedElements.forEach( function( navElem ) {
3343    navElem.classList[ method ]('is-nav-selected');
3344  });
3345};
3346
3347proto.activateAsNavFor = function() {
3348  this.navCompanionSelect( true );
3349};
3350
3351proto.removeNavSelectedElements = function() {
3352  if ( !this.navSelectedElements ) {
3353    return;
3354  }
3355  this.changeNavSelectedClass('remove');
3356  delete this.navSelectedElements;
3357};
3358
3359proto.onNavStaticClick = function( event, pointer, cellElement, cellIndex ) {
3360  if ( typeof cellIndex == 'number' ) {
3361    this.navCompanion.selectCell( cellIndex );
3362  }
3363};
3364
3365proto.deactivateAsNavFor = function() {
3366  this.removeNavSelectedElements();
3367};
3368
3369proto.destroyAsNavFor = function() {
3370  if ( !this.navCompanion ) {
3371    return;
3372  }
3373  this.navCompanion.off( 'select', this.onNavCompanionSelect );
3374  this.off( 'staticClick', this.onNavStaticClick );
3375  delete this.navCompanion;
3376};
3377
3378
3379return Flickity;
3380
3381}));
3382
3383
3384( function( window, factory ) { 'use strict';
3385
3386
3387  if ( typeof define == 'function' && define.amd ) {
3388    define( 'imagesloaded/imagesloaded',[
3389      'ev-emitter/ev-emitter'
3390    ], function( EvEmitter ) {
3391      return factory( window, EvEmitter );
3392    });
3393  } else if ( typeof module == 'object' && module.exports ) {
3394    module.exports = factory(
3395      window,
3396      require('ev-emitter')
3397    );
3398  } else {
3399    window.imagesLoaded = factory(
3400      window,
3401      window.EvEmitter
3402    );
3403  }
3404
3405})( typeof window !== 'undefined' ? window : this,
3406
3407
3408function factory( window, EvEmitter ) {
3409
3410
3411
3412var $ = window.jQuery;
3413var console = window.console;
3414
3415
3416function extend( a, b ) {
3417  for ( var prop in b ) {
3418    a[ prop ] = b[ prop ];
3419  }
3420  return a;
3421}
3422
3423var arraySlice = Array.prototype.slice;
3424
3425function makeArray( obj ) {
3426  if ( Array.isArray( obj ) ) {
3427    return obj;
3428  }
3429
3430  var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
3431  if ( isArrayLike ) {
3432    return arraySlice.call( obj );
3433  }
3434
3435  return [ obj ];
3436}
3437
3438
3439function ImagesLoaded( elem, options, onAlways ) {
3440  if ( !( this instanceof ImagesLoaded ) ) {
3441    return new ImagesLoaded( elem, options, onAlways );
3442  }
3443  var queryElem = elem;
3444  if ( typeof elem == 'string' ) {
3445    queryElem = document.querySelectorAll( elem );
3446  }
3447  if ( !queryElem ) {
3448    console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) );
3449    return;
3450  }
3451
3452  this.elements = makeArray( queryElem );
3453  this.options = extend( {}, this.options );
3454  if ( typeof options == 'function' ) {
3455    onAlways = options;
3456  } else {
3457    extend( this.options, options );
3458  }
3459
3460  if ( onAlways ) {
3461    this.on( 'always', onAlways );
3462  }
3463
3464  this.getImages();
3465
3466  if ( $ ) {
3467    this.jqDeferred = new $.Deferred();
3468  }
3469
3470  setTimeout( this.check.bind( this ) );
3471}
3472
3473ImagesLoaded.prototype = Object.create( EvEmitter.prototype );
3474
3475ImagesLoaded.prototype.options = {};
3476
3477ImagesLoaded.prototype.getImages = function() {
3478  this.images = [];
3479
3480  this.elements.forEach( this.addElementImages, this );
3481};
3482
3483ImagesLoaded.prototype.addElementImages = function( elem ) {
3484  if ( elem.nodeName == 'IMG' ) {
3485    this.addImage( elem );
3486  }
3487  if ( this.options.background === true ) {
3488    this.addElementBackgroundImages( elem );
3489  }
3490
3491  var nodeType = elem.nodeType;
3492  if ( !nodeType || !elementNodeTypes[ nodeType ] ) {
3493    return;
3494  }
3495  var childImgs = elem.querySelectorAll('img');
3496  for ( var i=0; i < childImgs.length; i++ ) {
3497    var img = childImgs[i];
3498    this.addImage( img );
3499  }
3500
3501  if ( typeof this.options.background == 'string' ) {
3502    var children = elem.querySelectorAll( this.options.background );
3503    for ( i=0; i < children.length; i++ ) {
3504      var child = children[i];
3505      this.addElementBackgroundImages( child );
3506    }
3507  }
3508};
3509
3510var elementNodeTypes = {
3511  1: true,
3512  9: true,
3513  11: true
3514};
3515
3516ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) {
3517  var style = getComputedStyle( elem );
3518  if ( !style ) {
3519    return;
3520  }
3521  var reURL = /url\((['"])?(.*?)\1\)/gi;
3522  var matches = reURL.exec( style.backgroundImage );
3523  while ( matches !== null ) {
3524    var url = matches && matches[2];
3525    if ( url ) {
3526      this.addBackground( url, elem );
3527    }
3528    matches = reURL.exec( style.backgroundImage );
3529  }
3530};
3531
3532ImagesLoaded.prototype.addImage = function( img ) {
3533  var loadingImage = new LoadingImage( img );
3534  this.images.push( loadingImage );
3535};
3536
3537ImagesLoaded.prototype.addBackground = function( url, elem ) {
3538  var background = new Background( url, elem );
3539  this.images.push( background );
3540};
3541
3542ImagesLoaded.prototype.check = function() {
3543  var _this = this;
3544  this.progressedCount = 0;
3545  this.hasAnyBroken = false;
3546  if ( !this.images.length ) {
3547    this.complete();
3548    return;
3549  }
3550
3551  function onProgress( image, elem, message ) {
3552    setTimeout( function() {
3553      _this.progress( image, elem, message );
3554    });
3555  }
3556
3557  this.images.forEach( function( loadingImage ) {
3558    loadingImage.once( 'progress', onProgress );
3559    loadingImage.check();
3560  });
3561};
3562
3563ImagesLoaded.prototype.progress = function( image, elem, message ) {
3564  this.progressedCount++;
3565  this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;
3566  this.emitEvent( 'progress', [ this, image, elem ] );
3567  if ( this.jqDeferred && this.jqDeferred.notify ) {
3568    this.jqDeferred.notify( this, image );
3569  }
3570  if ( this.progressedCount == this.images.length ) {
3571    this.complete();
3572  }
3573
3574  if ( this.options.debug && console ) {
3575    console.log( 'progress: ' + message, image, elem );
3576  }
3577};
3578
3579ImagesLoaded.prototype.complete = function() {
3580  var eventName = this.hasAnyBroken ? 'fail' : 'done';
3581  this.isComplete = true;
3582  this.emitEvent( eventName, [ this ] );
3583  this.emitEvent( 'always', [ this ] );
3584  if ( this.jqDeferred ) {
3585    var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';
3586    this.jqDeferred[ jqMethod ]( this );
3587  }
3588};
3589
3590
3591function LoadingImage( img ) {
3592  this.img = img;
3593}
3594
3595LoadingImage.prototype = Object.create( EvEmitter.prototype );
3596
3597LoadingImage.prototype.check = function() {
3598  var isComplete = this.getIsImageComplete();
3599  if ( isComplete ) {
3600    this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
3601    return;
3602  }
3603
3604  this.proxyImage = new Image();
3605  this.proxyImage.addEventListener( 'load', this );
3606  this.proxyImage.addEventListener( 'error', this );
3607  this.img.addEventListener( 'load', this );
3608  this.img.addEventListener( 'error', this );
3609  this.proxyImage.src = this.img.src;
3610};
3611
3612LoadingImage.prototype.getIsImageComplete = function() {
3613  return this.img.complete && this.img.naturalWidth;
3614};
3615
3616LoadingImage.prototype.confirm = function( isLoaded, message ) {
3617  this.isLoaded = isLoaded;
3618  this.emitEvent( 'progress', [ this, this.img, message ] );
3619};
3620
3621
3622LoadingImage.prototype.handleEvent = function( event ) {
3623  var method = 'on' + event.type;
3624  if ( this[ method ] ) {
3625    this[ method ]( event );
3626  }
3627};
3628
3629LoadingImage.prototype.onload = function() {
3630  this.confirm( true, 'onload' );
3631  this.unbindEvents();
3632};
3633
3634LoadingImage.prototype.onerror = function() {
3635  this.confirm( false, 'onerror' );
3636  this.unbindEvents();
3637};
3638
3639LoadingImage.prototype.unbindEvents = function() {
3640  this.proxyImage.removeEventListener( 'load', this );
3641  this.proxyImage.removeEventListener( 'error', this );
3642  this.img.removeEventListener( 'load', this );
3643  this.img.removeEventListener( 'error', this );
3644};
3645
3646
3647function Background( url, element ) {
3648  this.url = url;
3649  this.element = element;
3650  this.img = new Image();
3651}
3652
3653Background.prototype = Object.create( LoadingImage.prototype );
3654
3655Background.prototype.check = function() {
3656  this.img.addEventListener( 'load', this );
3657  this.img.addEventListener( 'error', this );
3658  this.img.src = this.url;
3659  var isComplete = this.getIsImageComplete();
3660  if ( isComplete ) {
3661    this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
3662    this.unbindEvents();
3663  }
3664};
3665
3666Background.prototype.unbindEvents = function() {
3667  this.img.removeEventListener( 'load', this );
3668  this.img.removeEventListener( 'error', this );
3669};
3670
3671Background.prototype.confirm = function( isLoaded, message ) {
3672  this.isLoaded = isLoaded;
3673  this.emitEvent( 'progress', [ this, this.element, message ] );
3674};
3675
3676
3677ImagesLoaded.makeJQueryPlugin = function( jQuery ) {
3678  jQuery = jQuery || window.jQuery;
3679  if ( !jQuery ) {
3680    return;
3681  }
3682  $ = jQuery;
3683  $.fn.imagesLoaded = function( options, callback ) {
3684    var instance = new ImagesLoaded( this, options, callback );
3685    return instance.jqDeferred.promise( $(this) );
3686  };
3687};
3688ImagesLoaded.makeJQueryPlugin();
3689
3690
3691return ImagesLoaded;
3692
3693});
3694
3695
3696
3697( function( window, factory ) {
3698  if ( typeof define == 'function' && define.amd ) {
3699    define( [
3700      'flickity/js/index',
3701      'imagesloaded/imagesloaded'
3702    ], function( Flickity, imagesLoaded ) {
3703      return factory( window, Flickity, imagesLoaded );
3704    });
3705  } else if ( typeof module == 'object' && module.exports ) {
3706    module.exports = factory(
3707      window,
3708      require('flickity'),
3709      require('imagesloaded')
3710    );
3711  } else {
3712    window.Flickity = factory(
3713      window,
3714      window.Flickity,
3715      window.imagesLoaded
3716    );
3717  }
3718
3719}( window, function factory( window, Flickity, imagesLoaded ) {
3720'use strict';
3721
3722Flickity.createMethods.push('_createImagesLoaded');
3723
3724var proto = Flickity.prototype;
3725
3726proto._createImagesLoaded = function() {
3727  this.on( 'activate', this.imagesLoaded );
3728};
3729
3730proto.imagesLoaded = function() {
3731  if ( !this.options.imagesLoaded ) {
3732    return;
3733  }
3734  var _this = this;
3735  function onImagesLoadedProgress( instance, image ) {
3736    var cell = _this.getParentCell( image.img );
3737    _this.cellSizeChange( cell && cell.element );
3738    if ( !_this.options.freeScroll ) {
3739      _this.positionSliderAtSelected();
3740    }
3741  }
3742  imagesLoaded( this.slider ).on( 'progress', onImagesLoadedProgress );
3743};
3744
3745return Flickity;
3746
3747}));
3748
3749
3750
3751( function( window, factory ) {
3752  if ( typeof define == 'function' && define.amd ) {
3753    define( [
3754      'flickity/js/index',
3755      'fizzy-ui-utils/utils',
3756    ], factory );
3757  } else if ( typeof module == 'object' && module.exports ) {
3758    module.exports = factory(
3759      require('flickity'),
3760      require('fizzy-ui-utils')
3761    );
3762  } else {
3763    factory(
3764      window.Flickity,
3765      window.fizzyUIUtils
3766    );
3767  }
3768
3769}( this, function factory( Flickity, utils ) {
3770
3771
3772var Slide = Flickity.Slide;
3773
3774var slideUpdateTarget = Slide.prototype.updateTarget;
3775Slide.prototype.updateTarget = function() {
3776  slideUpdateTarget.apply( this, arguments );
3777  if ( !this.parent.options.fade ) {
3778    return;
3779  }
3780  var slideTargetX = this.target - this.x;
3781  var firstCellX = this.cells[0].x;
3782  this.cells.forEach( function( cell ) {
3783    var targetX = cell.x - firstCellX - slideTargetX;
3784    cell.renderPosition( targetX );
3785  });
3786};
3787
3788Slide.prototype.setOpacity = function( alpha ) {
3789  this.cells.forEach( function( cell ) {
3790    cell.element.style.opacity = alpha;
3791  });
3792};
3793
3794
3795var proto = Flickity.prototype;
3796
3797Flickity.createMethods.push('_createFade');
3798
3799proto._createFade = function() {
3800  this.fadeIndex = this.selectedIndex;
3801  this.prevSelectedIndex = this.selectedIndex;
3802  this.on( 'select', this.onSelectFade );
3803  this.on( 'dragEnd', this.onDragEndFade );
3804  this.on( 'settle', this.onSettleFade );
3805  this.on( 'activate', this.onActivateFade );
3806  this.on( 'deactivate', this.onDeactivateFade );
3807};
3808
3809var updateSlides = proto.updateSlides;
3810proto.updateSlides = function() {
3811  updateSlides.apply( this, arguments );
3812  if ( !this.options.fade ) {
3813    return;
3814  }
3815  this.slides.forEach( function( slide, i ) {
3816    var alpha = i == this.selectedIndex ? 1 : 0;
3817    slide.setOpacity( alpha );
3818  }, this );
3819};
3820
3821
3822proto.onSelectFade = function() {
3823  this.fadeIndex = Math.min( this.prevSelectedIndex, this.slides.length - 1 );
3824  this.prevSelectedIndex = this.selectedIndex;
3825};
3826
3827proto.onSettleFade = function() {
3828  delete this.didDragEnd;
3829  if ( !this.options.fade ) {
3830    return;
3831  }
3832  this.selectedSlide.setOpacity( 1 );
3833  var fadedSlide = this.slides[ this.fadeIndex ];
3834  if ( fadedSlide && this.fadeIndex != this.selectedIndex ) {
3835    this.slides[ this.fadeIndex ].setOpacity( 0 );
3836  }
3837};
3838
3839proto.onDragEndFade = function() {
3840  this.didDragEnd = true;
3841};
3842
3843proto.onActivateFade = function() {
3844  if ( this.options.fade ) {
3845    this.element.classList.add('is-fade');
3846  }
3847};
3848
3849proto.onDeactivateFade = function() {
3850  if ( !this.options.fade ) {
3851    return;
3852  }
3853  this.element.classList.remove('is-fade');
3854  this.slides.forEach( function( slide ) {
3855    slide.setOpacity('');
3856  });
3857};
3858
3859
3860var positionSlider = proto.positionSlider;
3861proto.positionSlider = function() {
3862  if ( !this.options.fade ) {
3863    positionSlider.apply( this, arguments );
3864    return;
3865  }
3866
3867  this.fadeSlides();
3868  this.dispatchScrollEvent();
3869};
3870
3871var positionSliderAtSelected = proto.positionSliderAtSelected;
3872proto.positionSliderAtSelected = function() {
3873  if ( this.options.fade ) {
3874    this.setTranslateX( 0 );
3875  }
3876  positionSliderAtSelected.apply( this, arguments );
3877};
3878
3879proto.fadeSlides = function() {
3880  if ( this.slides.length < 2 ) {
3881    return;
3882  }
3883  var indexes = this.getFadeIndexes();
3884  var fadeSlideA = this.slides[ indexes.a ];
3885  var fadeSlideB = this.slides[ indexes.b ];
3886  var distance = this.wrapDifference( fadeSlideA.target, fadeSlideB.target );
3887  var progress = this.wrapDifference( fadeSlideA.target, -this.x );
3888  progress = progress / distance;
3889
3890  fadeSlideA.setOpacity( 1 - progress );
3891  fadeSlideB.setOpacity( progress );
3892
3893  var fadeHideIndex = indexes.a;
3894  if ( this.isDragging ) {
3895    fadeHideIndex = progress > 0.5 ? indexes.a : indexes.b;
3896  }
3897  var isNewHideIndex = this.fadeHideIndex != undefined &&
3898    this.fadeHideIndex != fadeHideIndex &&
3899    this.fadeHideIndex != indexes.a &&
3900    this.fadeHideIndex != indexes.b;
3901  if ( isNewHideIndex ) {
3902    this.slides[ this.fadeHideIndex ].setOpacity( 0 );
3903  }
3904  this.fadeHideIndex = fadeHideIndex;
3905};
3906
3907proto.getFadeIndexes = function() {
3908  if ( !this.isDragging && !this.didDragEnd ) {
3909    return {
3910      a: this.fadeIndex,
3911      b: this.selectedIndex,
3912    };
3913  }
3914  if ( this.options.wrapAround ) {
3915    return this.getFadeDragWrapIndexes();
3916  } else {
3917    return this.getFadeDragLimitIndexes();
3918  }
3919};
3920
3921proto.getFadeDragWrapIndexes = function() {
3922  var distances = this.slides.map( function( slide, i ) {
3923    return this.getSlideDistance( -this.x, i );
3924  }, this );
3925  var absDistances = distances.map( function( distance ) {
3926    return Math.abs( distance );
3927  });
3928  var minDistance = Math.min.apply( Math, absDistances );
3929  var closestIndex = absDistances.indexOf( minDistance );
3930  var distance = distances[ closestIndex ];
3931  var len = this.slides.length;
3932
3933  var delta = distance >= 0 ? 1 : -1;
3934  return {
3935    a: closestIndex,
3936    b: utils.modulo( closestIndex + delta, len ),
3937  };
3938};
3939
3940proto.getFadeDragLimitIndexes = function() {
3941  var dragIndex = 0;
3942  for ( var i=0; i < this.slides.length - 1; i++ ) {
3943    var slide = this.slides[i];
3944    if ( -this.x < slide.target ) {
3945      break;
3946    }
3947    dragIndex = i;
3948  }
3949  return {
3950    a: dragIndex,
3951    b: dragIndex + 1,
3952  };
3953};
3954
3955proto.wrapDifference = function( a, b ) {
3956  var diff = b - a;
3957
3958  if ( !this.options.wrapAround ) {
3959    return diff;
3960  }
3961
3962  var diffPlus = diff + this.slideableWidth;
3963  var diffMinus = diff - this.slideableWidth;
3964  if ( Math.abs( diffPlus ) < Math.abs( diff ) ) {
3965    diff = diffPlus;
3966  }
3967  if ( Math.abs( diffMinus ) < Math.abs( diff ) ) {
3968    diff = diffMinus;
3969  }
3970  return diff;
3971};
3972
3973
3974var _getWrapShiftCells = proto._getWrapShiftCells;
3975proto._getWrapShiftCells = function() {
3976  if ( !this.options.fade ) {
3977    _getWrapShiftCells.apply( this, arguments );
3978  }
3979};
3980
3981var shiftWrapCells = proto.shiftWrapCells;
3982proto.shiftWrapCells = function() {
3983  if ( !this.options.fade ) {
3984    shiftWrapCells.apply( this, arguments );
3985  }
3986};
3987
3988return Flickity;
3989
3990}));
3991
3992function formatMoney(cents, format) {
3993  if (typeof cents === 'string') {
3994    cents = cents.replace('.', '');
3995  }
3996  let value = '';
3997  const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
3998  const formatString = format || moneyFormat;
3999
4000  function formatWithDelimiters(
4001    number,
4002    precision = 2,
4003    thousands = ',',
4004    decimal = '.'
4005  ) {
4006    if (isNaN(number) || number == null) {
4007      return 0;
4008    }
4009
4010    number = (number / 100.0).toFixed(precision);
4011
4012    const parts = number.split('.');
4013    const dollarsAmount = parts[0].replace(
4014      /(\d)(?=(\d\d\d)+(?!\d))/g,
4015      `$1${thousands}`
4016    );
4017    const centsAmount = parts[1] ? decimal + parts[1] : '';
4018
4019    return dollarsAmount + centsAmount;
4020  }
4021
4022  switch (formatString.match(placeholderRegex)[1]) {
4023    case 'amount':
4024      value = formatWithDelimiters(cents, 2);
4025      break;
4026    case 'amount_no_decimals':
4027      value = formatWithDelimiters(cents, 0);
4028      break;
4029    case 'amount_with_comma_separator':
4030      value = formatWithDelimiters(cents, 2, '.', ',');
4031      break;
4032    case 'amount_no_decimals_with_comma_separator':
4033      value = formatWithDelimiters(cents, 0, '.', ',');
4034      break;
4035    case "amount_with_apostrophe_separator":
4036      value = formatWithDelimiters(cents, 2, "'", ".");
4037      break;
4038  }
4039
4040  return formatString.replace(placeholderRegex, value);
4041}

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.