PageSourceSearch

https://www.chatou.fr/wp-content/themes/chatou/assets/legacy/js/3dd7579842997b00c08e4008fca0c916.js

js chatou.fr collected 2026-10-02 09:56:12 UTC 477,230 bytes, 10,945 lines download raw bytes

vendor: 30,132 bytes, lines 1-997
1
2var breakpoint_small, breakpoint_large, jqueryValidateConf, owl_options_int;
3(function ($) {
4breakpoint_small = 767;
5breakpoint_large = 1279;
6jqueryValidateConf = {
7highlight: function(element, errorClass, validClass){
8$(element).parents('.form-entry').addClass(errorClass).removeClass(validClass);
9},
10unhighlight: function(element, errorClass, validClass){
11$(element).parents('.form-entry').addClass(validClass).removeClass(errorClass);
12},
13showErrors: function(errorMap, errorList) {
14$(".form-errors-summary").html("Your form contains "
15+ this.numberOfInvalids()
16+ " errors, see details below.");
17this.defaultShowErrors();
18}
19}
20}(jQuery));
21;(function($, window, document, undefined) {
22function Owl(element, options) {
23this.settings = null;
24this.options = $.extend({}, Owl.Defaults, options);
25this.$element = $(element);
26this._handlers = {};
27this._plugins = {};
28this._supress = {};
29this._current = null;
30this._speed = null;
31this._coordinates = [];
32this._breakpoint = null;
33this._width = null;
34this._items = [];
35this._clones = [];
36this._mergers = [];
37this._widths = [];
38this._invalidated = {};
39this._pipe = [];
40this._drag = {
41time: null,
42target: null,
43pointer: null,
44stage: {
45start: null,
46current: null
47},
48direction: null
49};
50this._states = {
51current: {},
52tags: {
53'initializing': [ 'busy' ],
54'animating': [ 'busy' ],
55'dragging': [ 'interacting' ]
56}
57};
58$.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) {
59this._handlers[handler] = $.proxy(this[handler], this);
60}, this));
61$.each(Owl.Plugins, $.proxy(function(key, plugin) {
62this._plugins[key.charAt(0).toLowerCase() + key.slice(1)]
63= new plugin(this);
64}, this));
65$.each(Owl.Workers, $.proxy(function(priority, worker) {
66this._pipe.push({
67'filter': worker.filter,
68'run': $.proxy(worker.run, this)
69});
70}, this));
71this.setup();
72this.initialize();
73}
74Owl.Defaults = {
75items: 3,
76loop: false,
77center: false,
78rewind: false,
79mouseDrag: true,
80touchDrag: true,
81pullDrag: true,
82freeDrag: false,
83margin: 0,
84stagePadding: 0,
85merge: false,
86mergeFit: true,
87autoWidth: false,
88startPosition: 0,
89rtl: false,
90smartSpeed: 250,
91fluidSpeed: false,
92dragEndSpeed: false,
93responsive: {},
94responsiveRefreshRate: 200,
95responsiveBaseElement: window,
96fallbackEasing: 'swing',
97info: false,
98nestedItemSelector: false,
99itemElement: 'div',
100stageElement: 'div',
101refreshClass: 'owl-refresh',
102loadedClass: 'owl-loaded',
103loadingClass: 'owl-loading',
104rtlClass: 'owl-rtl',
105responsiveClass: 'owl-responsive',
106dragClass: 'owl-drag',
107itemClass: 'owl-item',
108stageClass: 'owl-stage',
109stageOuterClass: 'owl-stage-outer',
110grabClass: 'owl-grab'
111};
112Owl.Width = {
113Default: 'default',
114Inner: 'inner',
115Outer: 'outer'
116};
117Owl.Type = {
118Event: 'event',
119State: 'state'
120};
121Owl.Plugins = {};
122Owl.Workers = [ {
123filter: [ 'width', 'settings' ],
124run: function() {
125this._width = this.$element.width();
126}
127}, {
128filter: [ 'width', 'items', 'settings' ],
129run: function(cache) {
130cache.current = this._items && this._items[this.relative(this._current)];
131}
132}, {
133filter: [ 'items', 'settings' ],
134run: function() {
135this.$stage.children('.cloned').remove();
136}
137}, {
138filter: [ 'width', 'items', 'settings' ],
139run: function(cache) {
140var margin = this.settings.margin || '',
141grid = !this.settings.autoWidth,
142rtl = this.settings.rtl,
143css = {
144'width': 'auto',
145'margin-left': rtl ? margin : '',
146'margin-right': rtl ? '' : margin
147};
148!grid && this.$stage.children().css(css);
149cache.css = css;
150}
151}, {
152filter: [ 'width', 'items', 'settings' ],
153run: function(cache) {
154var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
155merge = null,
156iterator = this._items.length,
157grid = !this.settings.autoWidth,
158widths = [];
159cache.items = {
160merge: false,
161width: width
162};
163while (iterator--) {
164merge = this._mergers[iterator];
165merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
166cache.items.merge = merge > 1 || cache.items.merge;
167widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
168}
169this._widths = widths;
170}
171}, {
172filter: [ 'items', 'settings' ],
173run: function() {
174var clones = [],
175items = this._items,
176settings = this.settings,
177view = Math.max(settings.items * 2, 4),
178size = Math.ceil(items.length / 2) * 2,
179repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0,
180append = '',
181prepend = '';
182repeat /= 2;
183while (repeat--) {
184clones.push(this.normalize(clones.length / 2, true));
185append = append + items[clones[clones.length - 1]][0].outerHTML;
186clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true));
187prepend = items[clones[clones.length - 1]][0].outerHTML + prepend;
188}
189this._clones = clones;
190$(append).addClass('cloned').appendTo(this.$stage);
191$(prepend).addClass('cloned').prependTo(this.$stage);
192}
193}, {
194filter: [ 'width', 'items', 'settings' ],
195run: function() {
196var rtl = this.settings.rtl ? 1 : -1,
197size = this._clones.length + this._items.length,
198iterator = -1,
199previous = 0,
200current = 0,
201coordinates = [];
202while (++iterator < size) {
203previous = coordinates[iterator - 1] || 0;
204current = this._widths[this.relative(iterator)] + this.settings.margin;
205coordinates.push(previous + current * rtl);
206}
207this._coordinates = coordinates;
208}
209}, {
210filter: [ 'width', 'items', 'settings' ],
211run: function() {
212var padding = this.settings.stagePadding,
213coordinates = this._coordinates,
214css = {
215'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2,
216'padding-left': padding || '',
217'padding-right': padding || ''
218};
219this.$stage.css(css);
220}
221}, {
222filter: [ 'width', 'items', 'settings' ],
223run: function(cache) {
224var iterator = this._coordinates.length,
225grid = !this.settings.autoWidth,
226items = this.$stage.children();
227if (grid && cache.items.merge) {
228while (iterator--) {
229cache.css.width = this._widths[this.relative(iterator)];
230items.eq(iterator).css(cache.css);
231}
232} else if (grid) {
233cache.css.width = cache.items.width;
234items.css(cache.css);
235}
236}
237}, {
238filter: [ 'items' ],
239run: function() {
240this._coordinates.length < 1 && this.$stage.removeAttr('style');
241}
242}, {
243filter: [ 'width', 'items', 'settings' ],
244run: function(cache) {
245cache.current = cache.current ? this.$stage.children().index(cache.current) : 0;
246cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current));
247this.reset(cache.current);
248}
249}, {
250filter: [ 'position' ],
251run: function() {
252this.animate(this.coordinates(this._current));
253}
254}, {
255filter: [ 'width', 'position', 'items', 'settings' ],
256run: function() {
257var rtl = this.settings.rtl ? 1 : -1,
258padding = this.settings.stagePadding * 2,
259begin = this.coordinates(this.current()) + padding,
260end = begin + this.width() * rtl,
261inner, outer, matches = [], i, n;
262for (i = 0, n = this._coordinates.length; i < n; i++) {
263inner = this._coordinates[i - 1] || 0;
264outer = Math.abs(this._coordinates[i]) + padding * rtl;
265if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
266|| (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
267matches.push(i);
268}
269}
270this.$stage.children('.active').removeClass('active');
271this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active');
272if (this.settings.center) {
273this.$stage.children('.center').removeClass('center');
274this.$stage.children().eq(this.current()).addClass('center');
275}
276}
277} ];
278Owl.prototype.initialize = function() {
279this.enter('initializing');
280this.trigger('initialize');
281this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
282if (this.settings.autoWidth && !this.is('pre-loading')) {
283var imgs, nestedSelector, width;
284imgs = this.$element.find('img');
285nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
286width = this.$element.children(nestedSelector).width();
287if (imgs.length && width <= 0) {
288this.preloadAutoWidthImages(imgs);
289}
290}
291this.$element.addClass(this.options.loadingClass);
292this.$stage = $('<' + this.settings.stageElement + ' class="' + this.settings.stageClass + '"/>')
293.wrap('<div class="' + this.settings.stageOuterClass + '"/>');
294this.$element.append(this.$stage.parent());
295this.replace(this.$element.children().not(this.$stage.parent()));
296if (this.$element.is(':visible')) {
297this.refresh();
298} else {
299this.invalidate('width');
300}
301this.$element
302.removeClass(this.options.loadingClass)
303.addClass(this.options.loadedClass);
304this.registerEventHandlers();
305this.leave('initializing');
306this.trigger('initialized');
307};
308Owl.prototype.setup = function() {
309var viewport = this.viewport(),
310overwrites = this.options.responsive,
311match = -1,
312settings = null;
313if (!overwrites) {
314settings = $.extend({}, this.options);
315} else {
316$.each(overwrites, function(breakpoint) {
317if (breakpoint <= viewport && breakpoint > match) {
318match = Number(breakpoint);
319}
320});
321settings = $.extend({}, this.options, overwrites[match]);
322if (typeof settings.stagePadding === 'function') {
323settings.stagePadding = settings.stagePadding();
324}
325delete settings.responsive;
326if (settings.responsiveClass) {
327this.$element.attr('class',
328this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match)
329);
330}
331}
332this.trigger('change', { property: { name: 'settings', value: settings } });
333this._breakpoint = match;
334this.settings = settings;
335this.invalidate('settings');
336this.trigger('changed', { property: { name: 'settings', value: this.settings } });
337};
338Owl.prototype.optionsLogic = function() {
339if (this.settings.autoWidth) {
340this.settings.stagePadding = false;
341this.settings.merge = false;
342}
343};
344Owl.prototype.prepare = function(item) {
345var event = this.trigger('prepare', { content: item });
346if (!event.data) {
347event.data = $('<' + this.settings.itemElement + '/>')
348.addClass(this.options.itemClass).append(item)
349}
350this.trigger('prepared', { content: event.data });
351return event.data;
352};
353Owl.prototype.update = function() {
354var i = 0,
355n = this._pipe.length,
356filter = $.proxy(function(p) { return this[p] }, this._invalidated),
357cache = {};
358while (i < n) {
359if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
360this._pipe[i].run(cache);
361}
362i++;
363}
364this._invalidated = {};
365!this.is('valid') && this.enter('valid');
366};
367Owl.prototype.width = function(dimension) {
368dimension = dimension || Owl.Width.Default;
369switch (dimension) {
370case Owl.Width.Inner:
371case Owl.Width.Outer:
372return this._width;
373default:
374return this._width - this.settings.stagePadding * 2 + this.settings.margin;
375}
376};
377Owl.prototype.refresh = function() {
378this.enter('refreshing');
379this.trigger('refresh');
380this.setup();
381this.optionsLogic();
382this.$element.addClass(this.options.refreshClass);
383this.update();
384this.$element.removeClass(this.options.refreshClass);
385this.leave('refreshing');
386this.trigger('refreshed');
387};
388Owl.prototype.onThrottledResize = function() {
389window.clearTimeout(this.resizeTimer);
390this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate);
391};
392Owl.prototype.onResize = function() {
393if (!this._items.length) {
394return false;
395}
396if (this._width === this.$element.width()) {
397return false;
398}
399if (!this.$element.is(':visible')) {
400return false;
401}
402this.enter('resizing');
403if (this.trigger('resize').isDefaultPrevented()) {
404this.leave('resizing');
405return false;
406}
407this.invalidate('width');
408this.refresh();
409this.leave('resizing');
410this.trigger('resized');
411};
412Owl.prototype.registerEventHandlers = function() {
413if ($.support.transition) {
414this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
415}
416if (this.settings.responsive !== false) {
417this.on(window, 'resize', this._handlers.onThrottledResize);
418}
419if (this.settings.mouseDrag) {
420this.$element.addClass(this.options.dragClass);
421this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this));
422this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false });
423}
424if (this.settings.touchDrag){
425this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this));
426this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this));
427}
428};
429Owl.prototype.onDragStart = function(event) {
430var stage = null;
431if (event.which === 3) {
432return;
433}
434if ($.support.transform) {
435stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(',');
436stage = {
437x: stage[stage.length === 16 ? 12 : 4],
438y: stage[stage.length === 16 ? 13 : 5]
439};
440} else {
441stage = this.$stage.position();
442stage = {
443x: this.settings.rtl ?
444stage.left + this.$stage.width() - this.width() + this.settings.margin :
445stage.left,
446y: stage.top
447};
448}
449if (this.is('animating')) {
450$.support.transform ? this.animate(stage.x) : this.$stage.stop()
451this.invalidate('position');
452}
453this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown');
454this.speed(0);
455this._drag.time = new Date().getTime();
456this._drag.target = $(event.target);
457this._drag.stage.start = stage;
458this._drag.stage.current = stage;
459this._drag.pointer = this.pointer(event);
460$(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this));
461$(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) {
462var delta = this.difference(this._drag.pointer, this.pointer(event));
463$(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this));
464if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) {
465return;
466}
467event.preventDefault();
468this.enter('dragging');
469this.trigger('drag');
470}, this));
471};
472Owl.prototype.onDragMove = function(event) {
473var minimum = null,
474maximum = null,
475pull = null,
476delta = this.difference(this._drag.pointer, this.pointer(event)),
477stage = this.difference(this._drag.stage.start, delta);
478if (!this.is('dragging')) {
479return;
480}
481event.preventDefault();
482if (this.settings.loop) {
483minimum = this.coordinates(this.minimum());
484maximum = this.coordinates(this.maximum() + 1) - minimum;
485stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum;
486} else {
487minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
488maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
489pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0;
490stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull);
491}
492this._drag.stage.current = stage;
493this.animate(stage.x);
494};
495Owl.prototype.onDragEnd = function(event) {
496var delta = this.difference(this._drag.pointer, this.pointer(event)),
497stage = this._drag.stage.current,
498direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right';
499$(document).off('.owl.core');
500this.$element.removeClass(this.options.grabClass);
501if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) {
502this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
503this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction));
504this.invalidate('position');
505this.update();
506this._drag.direction = direction;
507if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) {
508this._drag.target.one('click.owl.core', function() { return false; });
509}
510}
511if (!this.is('dragging')) {
512return;
513}
514this.leave('dragging');
515this.trigger('dragged');
516};
517Owl.prototype.closest = function(coordinate, direction) {
518var position = -1,
519pull = 30,
520width = this.width(),
521coordinates = this.coordinates();
522if (!this.settings.freeDrag) {
523$.each(coordinates, $.proxy(function(index, value) {
524if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) {
525position = index;
526} else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) {
527position = index + 1;
528} else if (this.op(coordinate, '<', value)
529&& this.op(coordinate, '>', coordinates[index + 1] || value - width)) {
530position = direction === 'left' ? index + 1 : index;
531}
532return position === -1;
533}, this));
534}
535if (!this.settings.loop) {
536if (this.op(coordinate, '>', coordinates[this.minimum()])) {
537position = coordinate = this.minimum();
538} else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
539position = coordinate = this.maximum();
540}
541}
542return position;
543};
544Owl.prototype.animate = function(coordinate) {
545var animate = this.speed() > 0;
546this.is('animating') && this.onTransitionEnd();
547if (animate) {
548this.enter('animating');
549this.trigger('translate');
550}
551if ($.support.transform3d && $.support.transition) {
552this.$stage.css({
553transform: 'translate3d(' + coordinate + 'px,0px,0px)',
554transition: (this.speed() / 1000) + 's'
555});
556} else if (animate) {
557this.$stage.animate({
558left: coordinate + 'px'
559}, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
560} else {
561this.$stage.css({
562left: coordinate + 'px'
563});
564}
565};
566Owl.prototype.is = function(state) {
567return this._states.current[state] && this._states.current[state] > 0;
568};
569Owl.prototype.current = function(position) {
570if (position === undefined) {
571return this._current;
572}
573if (this._items.length === 0) {
574return undefined;
575}
576position = this.normalize(position);
577if (this._current !== position) {
578var event = this.trigger('change', { property: { name: 'position', value: position } });
579if (event.data !== undefined) {
580position = this.normalize(event.data);
581}
582this._current = position;
583this.invalidate('position');
584this.trigger('changed', { property: { name: 'position', value: this._current } });
585}
586return this._current;
587};
588Owl.prototype.invalidate = function(part) {
589if ($.type(part) === 'string') {
590this._invalidated[part] = true;
591this.is('valid') && this.leave('valid');
592}
593return $.map(this._invalidated, function(v, i) { return i });
594};
595Owl.prototype.reset = function(position) {
596position = this.normalize(position);
597if (position === undefined) {
598return;
599}
600this._speed = 0;
601this._current = position;
602this.suppress([ 'translate', 'translated' ]);
603this.animate(this.coordinates(position));
604this.release([ 'translate', 'translated' ]);
605};
606Owl.prototype.normalize = function(position, relative) {
607var n = this._items.length,
608m = relative ? 0 : this._clones.length;
609if (!this.isNumeric(position) || n < 1) {
610position = undefined;
611} else if (position < 0 || position >= n + m) {
612position = ((position - m / 2) % n + n) % n + m / 2;
613}
614return position;
615};
616Owl.prototype.relative = function(position) {
617position -= this._clones.length / 2;
618return this.normalize(position, true);
619};
620Owl.prototype.maximum = function(relative) {
621var settings = this.settings,
622maximum = this._coordinates.length,
623iterator,
624reciprocalItemsWidth,
625elementWidth;
626if (settings.loop) {
627maximum = this._clones.length / 2 + this._items.length - 1;
628} else if (settings.autoWidth || settings.merge) {
629iterator = this._items.length;
630reciprocalItemsWidth = this._items[--iterator].width();
631elementWidth = this.$element.width();
632while (iterator--) {
633reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin;
634if (reciprocalItemsWidth > elementWidth) {
635break;
636}
637}
638maximum = iterator + 1;
639} else if (settings.center) {
640maximum = this._items.length - 1;
641} else {
642maximum = this._items.length - settings.items;
643}
644if (relative) {
645maximum -= this._clones.length / 2;
646}
647return Math.max(maximum, 0);
648};
649Owl.prototype.minimum = function(relative) {
650return relative ? 0 : this._clones.length / 2;
651};
652Owl.prototype.items = function(position) {
653if (position === undefined) {
654return this._items.slice();
655}
656position = this.normalize(position, true);
657return this._items[position];
658};
659Owl.prototype.mergers = function(position) {
660if (position === undefined) {
661return this._mergers.slice();
662}
663position = this.normalize(position, true);
664return this._mergers[position];
665};
666Owl.prototype.clones = function(position) {
667var odd = this._clones.length / 2,
668even = odd + this._items.length,
669map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
670if (position === undefined) {
671return $.map(this._clones, function(v, i) { return map(i) });
672}
673return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
674};
675Owl.prototype.speed = function(speed) {
676if (speed !== undefined) {
677this._speed = speed;
678}
679return this._speed;
680};
681Owl.prototype.coordinates = function(position) {
682var multiplier = 1,
683newPosition = position - 1,
684coordinate;
685if (position === undefined) {
686return $.map(this._coordinates, $.proxy(function(coordinate, index) {
687return this.coordinates(index);
688}, this));
689}
690if (this.settings.center) {
691if (this.settings.rtl) {
692multiplier = -1;
693newPosition = position + 1;
694}
695coordinate = this._coordinates[position];
696coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier;
697} else {
698coordinate = this._coordinates[newPosition] || 0;
699}
700coordinate = Math.ceil(coordinate);
701return coordinate;
702};
703Owl.prototype.duration = function(from, to, factor) {
704if (factor === 0) {
705return 0;
706}
707return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
708};
709Owl.prototype.to = function(position, speed) {
710var current = this.current(),
711revert = null,
712distance = position - this.relative(current),
713direction = (distance > 0) - (distance < 0),
714items = this._items.length,
715minimum = this.minimum(),
716maximum = this.maximum();
717if (this.settings.loop) {
718if (!this.settings.rewind && Math.abs(distance) > items / 2) {
719distance += direction * -1 * items;
720}
721position = current + distance;
722revert = ((position - minimum) % items + items) % items + minimum;
723if (revert !== position && revert - distance <= maximum && revert - distance > 0) {
724current = revert - distance;
725position = revert;
726this.reset(current);
727}
728} else if (this.settings.rewind) {
729maximum += 1;
730position = (position % maximum + maximum) % maximum;
731} else {
732position = Math.max(minimum, Math.min(maximum, position));
733}
734this.speed(this.duration(current, position, speed));
735this.current(position);
736if (this.$element.is(':visible')) {
737this.update();
738}
739};
740Owl.prototype.next = function(speed) {
741speed = speed || false;
742this.to(this.relative(this.current()) + 1, speed);
743};
744Owl.prototype.prev = function(speed) {
745speed = speed || false;
746this.to(this.relative(this.current()) - 1, speed);
747};
748Owl.prototype.onTransitionEnd = function(event) {
749if (event !== undefined) {
750event.stopPropagation();
751if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
752return false;
753}
754}
755this.leave('animating');
756this.trigger('translated');
757};
758Owl.prototype.viewport = function() {
759var width;
760if (this.options.responsiveBaseElement !== window) {
761width = $(this.options.responsiveBaseElement).width();
762} else if (window.innerWidth) {
763width = window.innerWidth;
764} else if (document.documentElement && document.documentElement.clientWidth) {
765width = document.documentElement.clientWidth;
766} else {
767throw 'Can not detect viewport width.';
768}
769return width;
770};
771Owl.prototype.replace = function(content) {
772this.$stage.empty();
773this._items = [];
774if (content) {
775content = (content instanceof jQuery) ? content : $(content);
776}
777if (this.settings.nestedItemSelector) {
778content = content.find('.' + this.settings.nestedItemSelector);
779}
780content.filter(function() {
781return this.nodeType === 1;
782}).each($.proxy(function(index, item) {
783item = this.prepare(item);
784this.$stage.append(item);
785this._items.push(item);
786this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
787}, this));
788this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
789this.invalidate('items');
790};
791Owl.prototype.add = function(content, position) {
792var current = this.relative(this._current);
793position = position === undefined ? this._items.length : this.normalize(position, true);
794content = content instanceof jQuery ? content : $(content);
795this.trigger('add', { content: content, position: position });
796content = this.prepare(content);
797if (this._items.length === 0 || position === this._items.length) {
798this._items.length === 0 && this.$stage.append(content);
799this._items.length !== 0 && this._items[position - 1].after(content);
800this._items.push(content);
801this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
802} else {
803this._items[position].before(content);
804this._items.splice(position, 0, content);
805this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
806}
807this._items[current] && this.reset(this._items[current].index());
808this.invalidate('items');
809this.trigger('added', { content: content, position: position });
810};
811Owl.prototype.remove = function(position) {
812position = this.normalize(position, true);
813if (position === undefined) {
814return;
815}
816this.trigger('remove', { content: this._items[position], position: position });
817this._items[position].remove();
818this._items.splice(position, 1);
819this._mergers.splice(position, 1);
820this.invalidate('items');
821this.trigger('removed', { content: null, position: position });
822};
823Owl.prototype.preloadAutoWidthImages = function(images) {
824images.each($.proxy(function(i, element) {
825this.enter('pre-loading');
826element = $(element);
827$(new Image()).one('load', $.proxy(function(e) {
828element.attr('src', e.target.src);
829element.css('opacity', 1);
830this.leave('pre-loading');
831!this.is('pre-loading') && !this.is('initializing') && this.refresh();
832}, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina'));
833}, this));
834};
835Owl.prototype.destroy = function() {
836this.$element.off('.owl.core');
837this.$stage.off('.owl.core');
838$(document).off('.owl.core');
839if (this.settings.responsive !== false) {
840window.clearTimeout(this.resizeTimer);
841this.off(window, 'resize', this._handlers.onThrottledResize);
842}
843for (var i in this._plugins) {
844this._plugins[i].destroy();
845}
846this.$stage.children('.cloned').remove();
847this.$stage.unwrap();
848this.$stage.children().contents().unwrap();
849this.$stage.children().unwrap();
850this.$element
851.removeClass(this.options.refreshClass)
852.removeClass(this.options.loadingClass)
853.removeClass(this.options.loadedClass)
854.removeClass(this.options.rtlClass)
855.removeClass(this.options.dragClass)
856.removeClass(this.options.grabClass)
857.attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), ''))
858.removeData('owl.carousel');
859};
860Owl.prototype.op = function(a, o, b) {
861var rtl = this.settings.rtl;
862switch (o) {
863case '<':
864return rtl ? a > b : a < b;
865case '>':
866return rtl ? a < b : a > b;
867case '>=':
868return rtl ? a <= b : a >= b;
869case '<=':
870return rtl ? a >= b : a <= b;
871default:
872break;
873}
874};
875Owl.prototype.on = function(element, event, listener, capture) {
876if (element.addEventListener) {
877element.addEventListener(event, listener, capture);
878} else if (element.attachEvent) {
879element.attachEvent('on' + event, listener);
880}
881};
882Owl.prototype.off = function(element, event, listener, capture) {
883if (element.removeEventListener) {
884element.removeEventListener(event, listener, capture);
885} else if (element.detachEvent) {
886element.detachEvent('on' + event, listener);
887}
888};
889Owl.prototype.trigger = function(name, data, namespace, state, enter) {
890var status = {
891item: { count: this._items.length, index: this.current() }
892}, handler = $.camelCase(
893$.grep([ 'on', name, namespace ], function(v) { return v })
894.join('-').toLowerCase()
895), event = $.Event(
896[ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
897$.extend({ relatedTarget: this }, status, data)
898);
899if (!this._supress[name]) {
900$.each(this._plugins, function(name, plugin) {
901if (plugin.onTrigger) {
902plugin.onTrigger(event);
903}
904});
905this.register({ type: Owl.Type.Event, name: name });
906this.$element.trigger(event);
907if (this.settings && typeof this.settings[handler] === 'function') {
908this.settings[handler].call(this, event);
909}
910}
911return event;
912};
913Owl.prototype.enter = function(name) {
914$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
915if (this._states.current[name] === undefined) {
916this._states.current[name] = 0;
917}
918this._states.current[name]++;
919}, this));
920};
921Owl.prototype.leave = function(name) {
922$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
923this._states.current[name]--;
924}, this));
925};
926Owl.prototype.register = function(object) {
927if (object.type === Owl.Type.Event) {
928if (!$.event.special[object.name]) {
929$.event.special[object.name] = {};
930}
931if (!$.event.special[object.name].owl) {
932var _default = $.event.special[object.name]._default;
933$.event.special[object.name]._default = function(e) {
934if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) {
935return _default.apply(this, arguments);
936}
937return e.namespace && e.namespace.indexOf('owl') > -1;
938};
939$.event.special[object.name].owl = true;
940}
941} else if (object.type === Owl.Type.State) {
942if (!this._states.tags[object.name]) {
943this._states.tags[object.name] = object.tags;
944} else {
945this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags);
946}
947this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) {
948return $.inArray(tag, this._states.tags[object.name]) === i;
949}, this));
950}
951};
952Owl.prototype.suppress = function(events) {
953$.each(events, $.proxy(function(index, event) {
954this._supress[event] = true;
955}, this));
956};
957Owl.prototype.release = function(events) {
958$.each(events, $.proxy(function(index, event) {
959delete this._supress[event];
960}, this));
961};
962Owl.prototype.pointer = function(event) {
963var result = { x: null, y: null };
964event = event.originalEvent || event || window.event;
965event = event.touches && event.touches.length ?
966event.touches[0] : event.changedTouches && event.changedTouches.length ?
967event.changedTouches[0] : event;
968if (event.pageX) {
969result.x = event.pageX;
970result.y = event.pageY;
971} else {
972result.x = event.clientX;
973result.y = event.clientY;
974}
975return result;
976};
977Owl.prototype.isNumeric = function(number) {
978return !isNaN(parseFloat(number));
979};
980Owl.prototype.difference = function(first, second) {
981return {
982x: first.x - second.x,
983y: first.y - second.y
984};
985};
986$.fn.owlCarousel = function(option) {
987var args = Array.prototype.slice.call(arguments, 1);
988return this.each(function() {
989var $this = $(this),
990data = $this.data('owl.carousel');
991if (!data) {
992data = new Owl(this, typeof option == 'object' && option);
993$this.data('owl.carousel', data);
994$.each([
995'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove'
996], function(i, event) {
997data.register({ type: Owl.Type.Event, name: event });
998data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) {
999if (e.namespace && e.relatedTarget !== this) {
1000this.suppress([ event ]);
1001data[event].apply(this, [].slice.call(arguments, 1));
1002this.release([ event ]);
1003}
1004}, data));
1005});
1006}
1007if (typeof option == 'string' && option.charAt(0) !== '_') {
1008data[option].apply(data, args);
1009}
1010});
1011};
1012$.fn.owlCarousel.Constructor = Owl;
1013})(window.Zepto || window.jQuery, window, document);
1014(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(e,s){var n,o,a,r=e.nodeName.toLowerCase();return"area"===r?(n=e.parentNode,o=n.name,e.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']")[0],!!a&&i(a)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!e.disabled:"a"===r?e.href||s:s)&&i(e)}function i(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}function s(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=o(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function o(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(i,"mouseout",function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",a)}function a(){t.datepicker._isDisabledDatepicker(u.inline?u.dpDiv.parent()[0]:u.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function r(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}t.ui=t.ui||{},t.extend(t.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({scrollParent:function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id
vendor: 4,237 bytes, line 1014
1014)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])},focusable:function(i){return e(i,!isNaN(t.attr(i,"tabindex")))},tabbable:function(i){var s=t.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&e(i,!n)}}),t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(i){return arguments.length?e.call(this,t.camelCase(i)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.fn.extend({focus:function(e){return function(i,s){return"number"==typeof i?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),s&&s.call(e)},i)}):e.apply(this,arguments)}}(t.fn.focus),disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(e){if(void 0!==e)return this.css("zIndex",e);if(this.length)for(var i,s,n=t(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}};var l=0,h=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r,l={},h=e.split(".")[0];return e=e.split(".")[1],n=h+"-"+e,s||(s=i,i=t.Widget),t.expr[":"][n.toLowerCase()]=function(e){return!!t.data(e,n)},t[h]=t[h]||{},o=t[h][e],a=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new a(t,e)},t.extend(a,o,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),r=new i,r.options=t.widget.extend({},r.options),t.each(s,function(e,s){return t.isFunction(s)?(l[e]=function(){var t=function(){return i.prototype[e].apply(this,arguments)},n=function(t){return i.prototype[e].apply(this,t)};return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(l[e]=s,void 0)}),a.prototype=t.widget.extend(r,{widgetEventPrefix:o?r.widgetEventPrefix||e:e},l,{constructor:a,namespace:h,widgetName:e,widgetFullName:n}),o?(t.each(o._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,a,i._proto)}),delete o._childConstructors):i._childConstructors.push(a),t.widget.bridge(e,a),a},t.widget.extend=function(e){for(var i,s,n=h.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=h.call(arguments,1
vendor: 20,746 bytes, line 1014
1014),r=this;return o?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!e),e&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.delegate(c,h,r):i.bind(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(i).undelegate(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget;var c=!1;t(document).mouseup(function(){c=!1}),t.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!c){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),c=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),c=!1,!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function e(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var n,o,a=Math.max,r=Math.abs,l=Math.round,h=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=t.extend({},n);var p,g,m,_,v,b,y=t(n.of),w=t.position.getWithinInfo(n.within),k=t.position.getScrollInfo(w),x=(n.collision||"flip").split(" "),C={};return b=s(y),y[0].preventDefault&&(n.at="left top"),g=b.width,m=b.height,_=b.offset,v=t.extend({},_),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=h.test(i[0])?i.concat(["center"]):c.test(i[0])?["center"].concat(i):["center","center"]),i[0]=h.test(i[0])?i[0]:"center",i[1]=c.test(i[1])?i[1]:"center",t=u.exec(i[0]),e=u.exec(i[1]),C[this]=[t?t[0]:0,e?e[0]:0],n[this]=[d.exec(i[0])[0],d.exec(i[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===n.at[0]?v.left+=g:"center"===n.at[0]&&(v.left+=g/2),"bottom"===n.at[1]?v.top+=m:"center"===n.at[1]&&(v.top+=m/2),p=e(C.at,g,m),v.left+=p[0],v.top+=p[1],this.each(function(){var s,h,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=u+f+i(this,"marginRight")+k.width,T=d+b+i(this,"marginBottom")+k.height,I=t.extend({},v),M=e(C.my,c.outerWidth(),c.outerHeight());"right"===n.my[0]?I.left-=u:"center"===n.my[0]&&(I.left-=u/2),"bottom"===n.my[1]?I.top-=d:"center"===n.my[1]&&(I.top-=d/2),I.left+=M[0],I.top+=M[1],o||(I.left=l(I.left),I.top=l(I.top)),s={marginLeft:f,marginTop:b},t.each(["left","top"],function(e,i){t.ui.position[x[e]]&&t.ui.position[x[e]][i](I,{targetWidth:g,targetHeight:m,elemWidth:u,elemHeight:d,collisionPosition:s,collisionWidth:D,collisionHeight:T,offset:[p[0]+M[0],p[1]+M[1]],my:n.my,at:n.at,within:w,elem:c})}),n.using&&(h=function(t){var e=_.left-I.left,i=e+g-u,s=_.top-I.top,o=s+m-d,l={target:{element:y,left:_.left,top:_.top,width:g,height:m},element:{element:c,left:I.left,top:I.top,width:u,height:d},horizontal:0>i?"left":e>0?"right":"center",vertical:0>o?"top":s>0?"bottom":"middle"};u>g&&g>r(e+i)&&(l.horizontal="center"),d>m&&m>r(s+o)&&(l.vertical="middle"),l.important=a(r(e),r(i))>a(r(s),r(o))?"horizontal":"vertical",n.using.call(this,t,l)}),c.offset(t.extend(I,{using:h}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,o=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-o-n;e.collisionWidth>o?l>0&&0>=h?(i=t.left+l+e.collisionWidth-o-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+o-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=a(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,o=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-o-n;e.collisionHeight>o?l>0&&0>=h?(i=t.top+l+e.collisionHeight-o-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+o-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=a(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,a=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-a-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-a-o,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>r(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,a=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-a-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-a-o,(0>s||r(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>r(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,s,n,a,r=document.getElementsByTagName("body")[0],l=document.createElement("div");e=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(a in s)e.style[a]=s[a];e.appendChild(l),i=r||document.documentElement,i.insertBefore(e,i.firstChild),l.style.cssText="position: absolute; left: 10.7432222px;",n=t(l).offset().left,o=n>10&&11>n,e.innerHTML="",i.removeChild(e)}()}(),t.ui.position,t.widget("ui.menu",{version:"1.11.4",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&t(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(e,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){t.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var e=t(this);e.data("ui-menu-submenu-carat")&&e.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",n=String.fromCharCode(e.keyCode),o=!1,clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(t):this.select(t))},refresh:function(){var e,i,s=this,n=this.options.icons.submenu,o=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),o.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.parent(),s=t("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),e=o.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);s._isDivider(e)&&e.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){"icons"===t&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(e.submenu),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!e).attr("aria-disabled",e),this._super(t,e)},focus:function(t,e){var i,s;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",t,{item:this.active}))},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","fal
1014se").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).text()))})}}),t.widget("ui.autocomplete",{version:"1.11.4",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;
1015this.isMultiLine=o?!0:a?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value(
vendor: 10,452 bytes, line 1015
1015)},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];t(e.target).closest(".ui-menu-item").length||this._delay(function(){var e=this;this.document.one("mousedown",function(s){s.target===e.element[0]||s.target===i||t.contains(i,s.target)||e.close()})})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=t("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").text(i.label).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete,t.extend(t.ui,{datepicker:{version:"1.11.4"}});var u;t.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return r(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?o(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.click(function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var a,l,h,c,u,d=this._dialogInst;return d||(this.uuid+=1,a="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+a+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),r(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(l=document.documentElement.clientWidth,h=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+c,h/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("
1015keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),u===n&&(u=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,a,l,h=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):h?"all"===i?t.extend({},h.settings):this._get(h,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),h&&(this._curInst===h&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),a=this._getMinMaxDate(h,"min"),l=this._getMinMaxDate(h,"max"),r(h.settings,n),null!==a&&void 0!==n.dateFormat&&void 0===n.minDate&&(h.settings.minDate=this._formatDate(h,a)),null!==l&&void 0!==n.dateFormat&&void 0===n.maxDate&&(h.settings.maxDate=this._formatDate(h,l)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),h),this._autoSize(h),this._setDate(h,o),this._updateAlternate(h),this._updateDatepicker(h)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0}
vendor: 18,854 bytes, lines 1015-1016
1015,_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var i,n,o,a,l,h,c;i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(i,"beforeShow"),o=n?n.apply(e,[e,i]):{},o!==!1&&(r(i.settings,o),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),a=!1,t(e).parents().each(function(){return a|="fixed"===t(this).css("position"),!a}),l={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),l=t.datepicker._checkOffset(i,l,a),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":a?"fixed":"absolute",display:"none",left:l.left+"px",top:l.top+"px"}),i.inline||(h=t.datepicker._get(i,"showAnim"),c=t.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[h]?i.dpDiv.show(h,t.datepicker._get(i,"showOptions"),c):i.dpDiv[h||"show"](h?c:null),t.datepicker._shouldFocusInput(i)&&i.input.focus(),t.datepicker._curInst=i))}},_updateDatepicker:function(e){this.maxRows=4,u=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],o=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&a.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",o*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.focus(),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,l=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),h=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>l&&l>n?Math.abs(i.left+n-l):0),i.top-=Math.min(i.top,i.top+o>h&&h>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).each(function(){t(this).val(n)}))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,l=0,h=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof h?h:(new Date).getFullYear()%100+parseInt(h,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(l).match(o);if(!a)throw"Missing number at position "+l;return l+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(l,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],l+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+l},x=function(){if(i.charAt(l)!==e.charAt(n))throw"Unexpected literal at position "+l;l++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>l&&(a=i.substr(l),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,l=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},h=function(t,e,i){var s=""+e;if(l(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return l(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||l("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=h("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=h("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=h("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=l("y")?e.getFullYear():(10>e.getYear()%100?"0":"")+e.getYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":l("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),l=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,h=l.exec(i);h;){switch(h[2]||"d"){case"d":case"D":r+=parseInt(h[1],10);break;case"w":case"W":r+=7*parseInt(h[1],10);break;case"m":case"M":a+=parseInt(h[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(h[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}h=l.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,l,h,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,T,I,M,P,S,N,H,A,z,O,E,W,F,L,R=new Date,Y=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),B=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),X=this._get(t,"stepMonths"),$=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(t,"min"),Q=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),Q)for(e=this._daylightSavingAdjust(new Date(Q.getFullYear(),Q.getMonth()-U[0]*U[1]+1,Q.getDate())),e=J&&J>e?J:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-X,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(B?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(B?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+X,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(B?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(B?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:Y,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,l=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",h=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(B?l:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(B?"":l)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),T=" ui-corner-all",I="",$){if(I+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:I+=" ui-datepicker-group-first",T=" ui-corner-"+(B?"right":"left");
1016break;case U[1]-1:I+=" ui-datepicker-group-last",T=" ui-corner-"+(B?"left":"right");break;default:I+=" ui-datepicker-group-middle",T=""}I+="'>"}for(I+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+T+"'>"+(/all|left/.test(T)&&0===k?B?o:s:"")+(/all|right/.test(T)&&0===k?B?s:o:"")+this._generateMonthYearHeader(t,Z,te,J,Q,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",M=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)P=(w+c)%7,M+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[P]+"'>"+p[P]+"</span></th>";for(I+=M+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),N=(this._getFirstDayOfMonth(te,Z)-c+7)%7,H=Math.ceil((N+S)/7),A=$?this.maxRows>H?this.maxRows:H:H,this.maxRows=A,z=this._daylightSavingAdjust(new Date(te,Z,1-N)),O=0;A>O;O++){for(I+="<tr>",E=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(z)+"</td>":"",w=0;7>w;w++)W=m?m.apply(t.input?t.input[0]:null,[z]):[!0,""],F=z.getMonth()!==Z,L=F&&!v||!W[0]||J&&J>z||Q&&z>Q,E+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(z.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===z.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+W[1]+(z.getTime()===G.getTime()?" "+this._currentClass:"")+(z.getTime()===Y.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!W[2]?"":" title='"+W[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+z.getMonth()+"' data-year='"+z.getFullYear()+"'")+">"+(F&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+z.getDate()+"</span>":"<a class='ui-state-default"+(z.getTime()===Y.getTime()?" ui-state-highlight":"")+(z.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+z.getDate()+"</a>")+"</td>",z.setDate(z.getDate()+1),z=this._daylightSavingAdjust(z);I+=E+"</tr>"}Z++,Z>11&&(Z=0,te++),I+="</tbody></table>"+($?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=I}y+=x}return y+=h,t._keyEvent=!1,y}
vendor: 4,693 bytes, lines 1016-1025
1016,_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var l,h,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(l=s&&s.getFullYear()===i,h=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!l||c>=s.getMonth())&&(!h||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.drawYear+("Y"===i?e:0),n=t.drawMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,l=this._get(t,"yearRange");return l&&(i=l.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).mousedown(t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new n,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.11.4",t.datepicker});
1017(function ($) {
1018$.fn.customSelect = function(opts) {
1019if(opts == undefined){
1020opts = {}
1021}
1022var el = this;
1023var settings;
1024var container;
1025settings = $.extend({
1026customArrow: false
1027}, opts);
1028function getOptionTextFromValue(select, value){
1029var option = select.find('option[value="'+value+'"]');
1030return option.text();
1031}
1032for (var i = 0; i <= el.length - 1; i++) {
1033$(el[i]).wrap('<div class="customSelectContain" />');
1034$(el[i]).addClass('silencedSelect');
1035container = $(el[i]).parent('.customSelectContain');
1036container.append('<div class="customSelect"><span class="customSelectInner"></span></div>');
1037if (settings.customArrow) {
1038container.find('.customSelect').append('<div class="customArrow"></div>');
1039} else {
1040container.find('.customSelect').addClass('arrowed');
1041}
1042if($(el[i]).find('option[selected]').length){
1043container.find('.customSelectInner').html($(el[i]).find('option[selected]').text());
1044}else{
1045container.find('.customSelectInner').html($(el[i]).find('option:eq(0)').text());
1046}
1047$(el[i]).on('change ', function(e) {
1048var text = getOptionTextFromValue($(this), $(this).val())
1049$(this).parent('.customSelectContain').find('.customSelectInner').html(text);
1050}).on('click', function(){
1051$(this).parent('.customSelectContain').toggleClass('opened');
1052}).on('focus', function(){
1053$(this).parent('.customSelectContain').addClass('focused');
1054}).on('blur',function(){
1055$(this).parent('.customSelectContain').removeClass('focused');
1056$(this).parent('.customSelectContain').removeClass('opened');
1057});
1058$(el[i]).on('keyup keypress', function(e) {
1059if((e.keyCode >= 48 && e.keyCode <= 90) || (e.keyCode <=40 && e.keyCode >= 37) ){
1060var text = getOptionTextFromValue($(this), $(this).val())
1061$(this).parent('.customSelectContain').find('.customSelectInner').html(text);
1062}else if(e.keyCode == 32){
1063if(! $(this).parent('.customSelectContain').hasClass('opened')){
1064$(this).trigger('click');
1065}
1066}
1067}).on('focus', function(){
1068$(this).parent('.customSelectContain').addClass('focused');
1069}).on('blur',function(){
1070$(this).parent('.customSelectContain').removeClass('focused');
1071$(this).parent('.customSelectContain').removeClass('opened');
1072});
1073};
1074}
1075}(jQuery));
1076( function( factory ) {
1077if ( typeof define === "function" && define.amd ) {
1078define( [ "../widgets/datepicker" ], factory );
1079} else {
1080factory( jQuery.datepicker );
1081}
1082}( function( datepicker ) {
1083datepicker.regional.fr = {
1084closeText: "Fermer",
1085prevText: "Précédent",
1086nextText: "Suivant",
1087currentText: "Aujourd'hui",
1088monthNames: [ "janvier", "février", "mars", "avril", "mai", "juin",
1089"juillet", "août", "septembre", "octobre", "novembre", "décembre" ],
1090monthNamesShort: [ "janv.", "févr.", "mars", "avr.", "mai", "juin",
1091"juil.", "août", "sept.", "oct.", "nov.", "déc." ],
1092dayNames: [ "dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi" ],
1093dayNamesShort: [ "dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam." ],
1094dayNamesMin: [ "D","L","M","M","J","V","S" ],
1095weekHeader: "Sem.",
1096dateFormat: "dd/mm/yy",
1097firstDay: 1,
1098isRTL: false,
1099showMonthAfterYear: false,
1100yearSuffix: "" };
1101datepicker.setDefaults( datepicker.regional.fr );
1102return datepicker.regional.fr;
1103} ) );
1104(function( factory ) {
1105if ( typeof define === "function" && define.amd ) {
1106define( ["jquery"], factory );
1107} else if (typeof module === "object" && module.exports) {
1108module.exports = factory( require( "jquery" ) );
1109} else {
1110factory( jQuery );
1111}
1112}(function( $ ) {
1113$.extend( $.fn, {
1114validate: function( options ) {
1115if ( !this.length ) {
1116if ( options && options.debug && window.console ) {
1117console.warn( "Nothing selected, can't validate, returning nothing." );
1118}
1119return;
1120}
1121var validator = $.data( this[ 0 ], "validator" );
1122if ( validator ) {
1123return validator;
1124}
1125this.attr( "novalidate", "novalidate" );
1126validator = new $.validator( options, this[ 0 ] );
1127$.data( this[ 0 ], "validator", validator );
1128if ( validator.settings.onsubmit ) {
1129this.on( "click.validate", ":submit", function( event ) {
1130if ( validator.settings.submitHandler ) {
1131validator.submitButton = event.target;
1132}
1133if ( $( this ).hasClass( "cancel" ) ) {
1134validator.cancelSubmit = true;
1135}
1136if ( $( this ).attr( "formnovalidate" ) !== undefined ) {
1137validator.cancelSubmit = true;
1138}
1139} );
1140this.on( "submit.validate", function( event ) {
1141if ( validator.settings.debug ) {
1142event.preventDefault();
1143}
1144function handle() {
1145var hidden, result;
1146if ( validator.settings.submitHandler ) {
1147if ( validator.submitButton ) {
1148hidden = $( "<input type='hidden'/>" )
1149.attr( "name", validator.submitButton.name )
1150.val( $( validator.submitButton ).val() )
1151.appendTo( validator.currentForm );
1152}
1153result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
1154if ( validator.submitButton ) {
1155hidden.remove();
1156}
1157if ( result !== undefined ) {
1158return result;
1159}
1160return false;
1161}
1162return true;
1163}
1164if ( validator.cancelSubmit ) {
1165validator.cancelSubmit = false;
1166return handle();
1167}
1168if ( validator.form() ) {
1169if ( validator.pendingRequest ) {
1170validator.formSubmitted = true;
1171return false;
1172}
1173return handle();
1174} else {
1175validator.focusInvalid();
1176return false;
1177}
1178} );
1179}
1180return validator;
1181},
1182valid: function() {
1183var valid, validator, errorList;
1184if ( $( this[ 0 ] ).is( "form" ) ) {
1185valid = this.validate().form();
1186} else {
1187errorList = [];
1188valid = true;
1189validator = $( this[ 0 ].form ).validate();
1190this.each( function() {
1191valid = validator.element( this ) && valid;
1192if ( !valid ) {
1193errorList = errorList.concat( validator.errorList );
1194}
1195} );
1196validator.errorList = errorList;
1197}
1198return valid;
1199},
1200rules: function( command, argument ) {
1201if ( !this.length ) {
1202return;
1203}
1204var element = this[ 0 ],
1205settings, staticRules, existingRules, data, param, filtered;
1206if ( command ) {
1207settings = $.data( element.form, "validator" ).settings;
1208staticRules = settings.rules;
1209existingRules = $.validator.staticRules( element );
1210switch ( command ) {
1211case "add":
1212$.extend( existingRules, $.validator.normalizeRule( argument ) );
1213delete existingRules.messages;
1214staticRules[ element.name ] = existingRules;
1215if ( argument.messages ) {
1216settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
1217}
1218break;
1219case "remove":
1220if ( !argument ) {
1221delete staticRules[ element.name ];
1222return existingRules;
1223}
1224filtered = {};
1225$.each( argument.split( /\s/ ), function( index, method ) {
1226filtered[ method ] = existingRules[ method ];
1227delete existingRules[ method ];
1228if ( method === "required" ) {
1229$( element ).removeAttr( "aria-required" );
1230}
1231} );
1232return filtered;
1233}
1234}
1235data = $.validator.normalizeRules(
1236$.extend(
1237{},
1238$.validator.classRules( element ),
1239$.validator.attributeRules( element ),
1240$.validator.dataRules( element ),
1241$.validator.staticRules( element )
1242), element );
1243if ( data.required ) {
1244param = data.required;
1245delete data.required;
1246data = $.extend( { required: param }, data );
1247$( element ).attr( "aria-required", "true" );
1248}
1249if ( data.remote ) {
1250param = data.remote;
1251delete data.remote;
1252data = $.extend( data, { remote: param } );
1253}
1254return data;
1255}
1256} );
1257$.extend( $.expr[ ":" ], {
1258blank: function( a ) {
1259return !$.trim( "" + $( a ).val() );
1260},
1261filled: function( a ) {
1262var val = $( a ).val();
1263return val !== null && !!$.trim( "" + val );
1264},
1265unchecked: function( a ) {
1266return !$( a ).prop( "checked" );
1267}
1268} );
1269$.validator = function( options, form ) {
1270this.settings = $.extend( true, {}, $.validator.defaults, options );
1271this.currentForm = form;
1272this.init();
1273};
1274$.validator.format = function( source, params ) {
1275if ( arguments.length === 1 ) {
1276return function() {
1277var args = $.makeArray( arguments );
1278args.unshift( source );
1279return $.validator.format.apply( this, args );
1280};
1281}
1282if ( params === undefined ) {
1283return source;
1284}
1285if ( arguments.length > 2 && params.constructor !== Array  ) {
1286params = $.makeArray( arguments ).slice( 1 );
1287}
1288if ( params.constructor !== Array ) {
1289params = [ params ];
1290}
1291$.each( params, function( i, n ) {
1292source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
1293return n;
1294} );
1295} );
1296return source;
1297};
1298$.extend( $.validator, {
1299defaults: {
1300messages: {},
1301groups: {},
1302rules: {},
1303errorClass: "error",
1304pendingClass: "pending",
1305validClass: "valid",
1306errorElement: "label",
1307focusCleanup: false,
1308focusInvalid: true,
1309errorContainer: $( [] ),
1310errorLabelContainer: $( [] ),
1311onsubmit: true,
1312ignore: ":hidden",
1313ignoreTitle: false,
1314onfocusin: function( element ) {
1315this.lastActive = element;
1316if ( this.settings.focusCleanup ) {
1317if ( this.settings.unhighlight ) {
1318this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
1319}
1320this.hideThese( this.errorsFor( element ) );
1321}
1322},
1323onfocusout: function( element ) {
1324if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
1325this.element( element );
1326}
1327},
1328onkeyup: function( element, event ) {
1329var excludedKeys = [
133016, 17, 18, 20, 35, 36, 37,
133138, 39, 40, 45, 144, 225
1332];
1333if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
1334return;
1335} else if ( element.name in this.submitted || element.name in this.invalid ) {
vendor: 4,596 bytes, lines 1336-1460
1336this.element( element );
1337}
1338},
1339onclick: function( element ) {
1340if ( element.name in this.submitted ) {
1341this.element( element );
1342} else if ( element.parentNode.name in this.submitted ) {
1343this.element( element.parentNode );
1344}
1345},
1346highlight: function( element, errorClass, validClass ) {
1347if ( element.type === "radio" ) {
1348this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
1349} else {
1350$( element ).addClass( errorClass ).removeClass( validClass );
1351}
1352},
1353unhighlight: function( element, errorClass, validClass ) {
1354if ( element.type === "radio" ) {
1355this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
1356} else {
1357$( element ).removeClass( errorClass ).addClass( validClass );
1358}
1359}
1360},
1361setDefaults: function( settings ) {
1362$.extend( $.validator.defaults, settings );
1363},
1364messages: {
1365required: "This field is required.",
1366remote: "Please fix this field.",
1367email: "Please enter a valid email address.",
1368url: "Please enter a valid URL.",
1369date: "Please enter a valid date.",
1370dateISO: "Please enter a valid date ( ISO ).",
1371number: "Please enter a valid number.",
1372digits: "Please enter only digits.",
1373equalTo: "Please enter the same value again.",
1374maxlength: $.validator.format( "Please enter no more than {0} characters." ),
1375minlength: $.validator.format( "Please enter at least {0} characters." ),
1376rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
1377range: $.validator.format( "Please enter a value between {0} and {1}." ),
1378max: $.validator.format( "Please enter a value less than or equal to {0}." ),
1379min: $.validator.format( "Please enter a value greater than or equal to {0}." ),
1380step: $.validator.format( "Please enter a multiple of {0}." )
1381},
1382autoCreateRanges: false,
1383prototype: {
1384init: function() {
1385this.labelContainer = $( this.settings.errorLabelContainer );
1386this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
1387this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
1388this.submitted = {};
1389this.valueCache = {};
1390this.pendingRequest = 0;
1391this.pending = {};
1392this.invalid = {};
1393this.reset();
1394var groups = ( this.groups = {} ),
1395rules;
1396$.each( this.settings.groups, function( key, value ) {
1397if ( typeof value === "string" ) {
1398value = value.split( /\s/ );
1399}
1400$.each( value, function( index, name ) {
1401groups[ name ] = key;
1402} );
1403} );
1404rules = this.settings.rules;
1405$.each( rules, function( key, value ) {
1406rules[ key ] = $.validator.normalizeRule( value );
1407} );
1408function delegate( event ) {
1409var validator = $.data( this.form, "validator" ),
1410eventType = "on" + event.type.replace( /^validate/, "" ),
1411settings = validator.settings;
1412if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) {
1413settings[ eventType ].call( validator, this, event );
1414}
1415}
1416$( this.currentForm )
1417.on( "focusin.validate focusout.validate keyup.validate",
1418":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
1419"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
1420"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
1421"[type='radio'], [type='checkbox'], [contenteditable]", delegate )
1422.on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
1423if ( this.settings.invalidHandler ) {
1424$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
1425}
1426$( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" );
1427},
1428form: function() {
1429this.checkForm();
1430$.extend( this.submitted, this.errorMap );
1431this.invalid = $.extend( {}, this.errorMap );
1432if ( !this.valid() ) {
1433$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
1434}
1435this.showErrors();
1436return this.valid();
1437},
1438checkForm: function() {
1439this.prepareForm();
1440for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
1441this.check( elements[ i ] );
1442}
1443return this.valid();
1444},
1445element: function( element ) {
1446var cleanElement = this.clean( element ),
1447checkElement = this.validationTargetFor( cleanElement ),
1448v = this,
1449result = true,
1450rs, group;
1451if ( checkElement === undefined ) {
1452delete this.invalid[ cleanElement.name ];
1453} else {
1454this.prepareElement( checkElement );
1455this.currentElements = $( checkElement );
1456group = this.groups[ checkElement.name ];
1457if ( group ) {
1458$.each( this.groups, function( name, testgroup ) {
1459if ( testgroup === group && name !== checkElement.name ) {
1460cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) );
1461if ( cleanElement && cleanElement.name in v.invalid ) {
1462v.currentElements.push( cleanElement );
1463result = result && v.check( cleanElement );
1464}
1465}
1466} );
1467}
1468rs = this.check( checkElement ) !== false;
1469result = result && rs;
1470if ( rs ) {
1471this.invalid[ checkElement.name ] = false;
1472} else {
1473this.invalid[ checkElement.name ] = true;
1474}
1475if ( !this.numberOfInvalids() ) {
1476this.toHide = this.toHide.add( this.containers );
1477}
1478this.showErrors();
1479$( element ).attr( "aria-invalid", !rs );
1480}
1481return result;
1482},
1483showErrors: function( errors ) {
1484if ( errors ) {
1485var validator = this;
1486$.extend( this.errorMap, errors );
1487this.errorList = $.map( this.errorMap, function( message, name ) {
1488return {
1489message: message,
1490element: validator.findByName( name )[ 0 ]
1491};
1492} );
1493this.successList = $.grep( this.successList, function( element ) {
1494return !( element.name in errors );
1495} );
1496}
1497if ( this.settings.showErrors ) {
1498this.settings.showErrors.call( this, this.errorMap, this.errorList );
1499} else {
1500this.defaultShowErrors();
1501}
1502},
1503resetForm: function() {
1504if ( $.fn.resetForm ) {
1505$( this.currentForm ).resetForm();
1506}
1507this.invalid = {};
1508this.submitted = {};
1509this.prepareForm();
1510this.hideErrors();
1511var elements = this.elements()
1512.removeData( "previousValue" )
1513.removeAttr( "aria-invalid" );
1514this.resetElements( elements );
1515},
1516resetElements: function( elements ) {
1517var i;
1518if ( this.settings.unhighlight ) {
1519for ( i = 0; elements[ i ]; i++ ) {
1520this.settings.unhighlight.call( this, elements[ i ],
1521this.settings.errorClass, "" );
1522this.findByName( elements[ i ].name ).removeClass( this.settings.validClass );
1523}
1524} else {
1525elements
1526.removeClass( this.settings.errorClass )
1527.removeClass( this.settings.validClass );
1528}
1529},
1530numberOfInvalids: function() {
1531return this.objectLength( this.invalid );
1532},
1533objectLength: function( obj ) {
1534var count = 0,
1535i;
1536for ( i in obj ) {
1537if ( obj[ i ] ) {
1538count++;
1539}
1540}
1541return count;
1542},
1543hideErrors: function() {
1544this.hideThese( this.toHide );
1545},
1546hideThese: function( errors ) {
1547errors.not( this.containers ).text( "" );
1548this.addWrapper( errors ).hide();
1549},
1550valid: function() {
1551return this.size() === 0;
1552},
1553size: function() {
1554return this.errorList.length;
1555},
1556focusInvalid: function() {
1557if ( this.settings.focusInvalid ) {
1558try {
1559$( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
1560.filter( ":visible" )
1561.focus()
1562.trigger( "focusin" );
1563} catch ( e ) {
1564}
1565}
1566},
1567findLastActive: function() {
1568var lastActive = this.lastActive;
1569return lastActive && $.grep( this.errorList, function( n ) {
1570return n.element.name === lastActive.name;
1571} ).length === 1 && lastActive;
1572},
1573elements: function() {
1574var validator = this,
1575rulesCache = {};
1576return $( this.currentForm )
1577.find( "input, select, textarea, [contenteditable]" )
1578.not( ":submit, :reset, :image, :disabled" )
1579.not( this.settings.ignore )
1580.filter( function() {
1581var name = this.name || $( this ).attr( "name" ); // For contenteditable
1582if ( !name && validator.settings.debug && window.console ) {
1583console.error( "%o has no name assigned", this );
1584}
1585if ( this.hasAttribute( "contenteditable" ) ) {
1586this.form = $( this ).closest( "form" )[ 0 ];
1587}
1588if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
1589return false;
1590}
1591rulesCache[ name ] = true;
1592return true;
1593} );
1594},
1595clean: function( selector ) {
1596return $( selector )[ 0 ];
1597},
1598errors: function() {
1599var errorClass = this.settings.errorClass.split( " " ).join( "." );
1600return $( this.settings.errorElement + "." + errorClass, this.errorContext );
1601},
1602resetInternals: function() {
1603this.successList = [];
1604this.errorList = [];
1605this.errorMap = {};
1606this.toShow = $( [] );
1607this.toHide = $( [] );
1608},
1609reset: function() {
1610this.resetInternals();
1611this.currentElements = $( [] );
1612},
1613prepareForm: function() {
1614this.reset();
1615this.toHide = this.errors().add( this.containers );
1616},
1617prepareElement: function( element ) {
1618this.reset();
1619this.toHide = this.errorsFor( element );
1620},
1621elementValue: function( element ) {
1622var $element = $( element ),
1623type = element.type,
1624val, idx;
1625if ( type === "radio" || type === "checkbox" ) {
1626return this.findByName( element.name ).filter( ":checked" ).val();
1627} else if ( type === "number" && typeof element.validity !== "undefined" ) {
1628return element.validity.badInput ? "NaN" : $element.val();
1629}
1630if ( element.hasAttribute( "contenteditable" ) ) {
1631val = $element.text();
1632} else {
1633val = $element.val();
1634}
1635if ( type === "file" ) {
1636if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) {
1637return val.substr( 12 );
1638}
1639idx = val.lastIndexOf( "/" );
1640if ( idx >= 0 ) {
1641return val.substr( idx + 1 );
1642}
1643idx = val.lastIndexOf( "\\" );
1644if ( idx >= 0 ) {
1645return val.substr( idx + 1 );
1646}
1647return val;
1648}
1649if ( typeof val === "string" ) {
1650return val.replace( /\r/g, "" );
1651}
1652return val;
1653},
1654check: function( element ) {
1655element = this.validationTargetFor( this.clean( element ) );
1656var rules = $( element ).rules(),
1657rulesCount = $.map( rules, function( n, i ) {
1658return i;
1659} ).length,
1660dependencyMismatch = false,
1661val = this.elementValue( element ),
1662result, method, rule;
1663if ( typeof rules.normalizer === "function" ) {
1664val = rules.normalizer.call( element, val );
1665if ( typeof val !== "string" ) {
1666throw new TypeError( "The normalizer should return a string value." );
1667}
1668delete rules.normalizer;
1669}
1670for ( method in rules ) {
1671rule = { method: method, parameters: rules[ method ] };
1672try {
1673result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
1674if ( result === "dependency-mismatch" && rulesCount === 1 ) {
1675dependencyMismatch = true;
1676continue;
1677}
1678dependencyMismatch = false;
1679if ( result === "pending" ) {
1680this.toHide = this.toHide.not( this.errorsFor( element ) );
1681return;
1682}
1683if ( !result ) {
1684this.formatAndAdd( element, rule );
1685return false;
1686}
1687} catch ( e ) {
1688if ( this.settings.debug && window.console ) {
1689console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
1690}
1691if ( e instanceof TypeError ) {
1692e.message += ".  Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
1693}
1694throw e;
1695}
1696}
1697if ( dependencyMismatch ) {
1698return;
1699}
1700if ( this.objectLength( rules ) ) {
1701this.successList.push( element );
1702}
1703return true;
1704},
1705customDataMessage: function( element, method ) {
1706return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
1707method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
1708},
1709customMessage: function( name, method ) {
1710var m = this.settings.messages[ name ];
1711return m && ( m.constructor === String ? m : m[ method ] );
1712},
1713findDefined: function() {
1714for ( var i = 0; i < arguments.length; i++ ) {
1715if ( arguments[ i ] !== undefined ) {
1716return arguments[ i ];
1717}
1718}
1719return undefined;
1720},
1721defaultMessage: function( element, rule ) {
1722var message = this.findDefined(
1723this.customMessage( element.name, rule.method ),
1724this.customDataMessage( element, rule.method ),
1725!this.settings.ignoreTitle && element.title || undefined,
1726$.validator.messages[ rule.method ],
1727"<strong>Warning: No message defined for " + element.name + "</strong>"
1728),
1729theregex = /\$?\{(\d+)\}/g;
1730if ( typeof message === "function" ) {
1731message = message.call( this, rule.parameters, element );
1732} else if ( theregex.test( message ) ) {
1733message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
1734}
1735return message;
1736},
1737formatAndAdd: function( element, rule ) {
1738var message = this.defaultMessage( element, rule );
1739this.errorList.push( {
1740message: message,
1741element: element,
1742method: rule.method
1743} );
1744this.errorMap[ element.name ] = message;
1745this.submitted[ element.name ] = message;
1746},
1747addWrapper: function( toToggle ) {
1748if ( this.settings.wrapper ) {
1749toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
1750}
1751return toToggle;
1752},
1753defaultShowErrors: function() {
1754var i, elements, error;
1755for ( i = 0; this.errorList[ i ]; i++ ) {
1756error = this.errorList[ i ];
1757if ( this.settings.highlight ) {
1758this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
1759}
1760this.showLabel( error.element, error.message );
1761}
1762if ( this.errorList.length ) {
1763this.toShow = this.toShow.add( this.containers );
1764}
1765if ( this.settings.success ) {
1766for ( i = 0; this.successList[ i ]; i++ ) {
1767this.showLabel( this.successList[ i ] );
1768}
1769}
1770if ( this.settings.unhighlight ) {
1771for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
1772this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
1773}
1774}
1775this.toHide = this.toHide.not( this.toShow );
1776this.hideErrors();
1777this.addWrapper( this.toShow ).show();
1778},
1779validElements: function() {
1780return this.currentElements.not( this.invalidElements() );
1781},
1782invalidElements: function() {
1783return $( this.errorList ).map( function() {
1784return this.element;
1785} );
1786},
1787showLabel: function( element, message ) {
1788var place, group, errorID, v,
1789error = this.errorsFor( element ),
1790elementID = this.idOrName( element ),
1791describedBy = $( element ).attr( "aria-describedby" );
1792if ( error.length ) {
1793error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
1794error.html( message );
1795} else {
1796error = $( "<" + this.settings.errorElement + ">" )
1797.attr( "id", elementID + "-error" )
1798.addClass( this.settings.errorClass )
1799.html( message || "" );
1800place = error;
1801if ( this.settings.wrapper ) {
1802place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
1803}
1804if ( this.labelContainer.length ) {
1805this.labelContainer.append( place );
1806} else if ( this.settings.errorPlacement ) {
1807this.settings.errorPlacement( place, $( element ) );
1808} else {
1809place.insertAfter( element );
1810}
1811if ( error.is( "label" ) ) {
1812error.attr( "for", elementID );
1813} else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) {
1814errorID = error.attr( "id" );
1815if ( !describedBy ) {
1816describedBy = errorID;
1817} else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) {
1818describedBy += " " + errorID;
1819}
1820$( element ).attr( "aria-describedby", describedBy );
1821group = this.groups[ element.name ];
1822if ( group ) {
1823v = this;
1824$.each( v.groups, function( name, testgroup ) {
1825if ( testgroup === group ) {
1826$( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm )
1827.attr( "aria-describedby", error.attr( "id" ) );
1828}
1829} );
1830}
1831}
1832}
1833if ( !message && this.settings.success ) {
1834error.text( "" );
1835if ( typeof this.settings.success === "string" ) {
1836error.addClass( this.settings.success );
1837} else {
1838this.settings.success( error, element );
1839}
1840}
1841this.toShow = this.toShow.add( error );
1842},
1843errorsFor: function( element ) {
1844var name = this.escapeCssMeta( this.idOrName( element ) ),
1845describer = $( element ).attr( "aria-describedby" ),
1846selector = "label[for='" + name + "'], label[for='" + name + "'] *";
1847if ( describer ) {
1848selector = selector + ", #" + this.escapeCssMeta( describer )
1849.replace( /\s+/g, ", #" );
1850}
1851return this
1852.errors()
1853.filter( selector );
1854},
1855escapeCssMeta: function( string ) {
1856return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
1857},
1858idOrName: function( element ) {
1859return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.i
vendor: 7,244 bytes, lines 1859-2115
1859d || element.name );
1860},
1861validationTargetFor: function( element ) {
1862if ( this.checkable( element ) ) {
1863element = this.findByName( element.name );
1864}
1865return $( element ).not( this.settings.ignore )[ 0 ];
1866},
1867checkable: function( element ) {
1868return ( /radio|checkbox/i ).test( element.type );
1869},
1870findByName: function( name ) {
1871return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" );
1872},
1873getLength: function( value, element ) {
1874switch ( element.nodeName.toLowerCase() ) {
1875case "select":
1876return $( "option:selected", element ).length;
1877case "input":
1878if ( this.checkable( element ) ) {
1879return this.findByName( element.name ).filter( ":checked" ).length;
1880}
1881}
1882return value.length;
1883},
1884depend: function( param, element ) {
1885return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true;
1886},
1887dependTypes: {
1888"boolean": function( param ) {
1889return param;
1890},
1891"string": function( param, element ) {
1892return !!$( param, element.form ).length;
1893},
1894"function": function( param, element ) {
1895return param( element );
1896}
1897},
1898optional: function( element ) {
1899var val = this.elementValue( element );
1900return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
1901},
1902startRequest: function( element ) {
1903if ( !this.pending[ element.name ] ) {
1904this.pendingRequest++;
1905$( element ).addClass( this.settings.pendingClass );
1906this.pending[ element.name ] = true;
1907}
1908},
1909stopRequest: function( element, valid ) {
1910this.pendingRequest--;
1911if ( this.pendingRequest < 0 ) {
1912this.pendingRequest = 0;
1913}
1914delete this.pending[ element.name ];
1915$( element ).removeClass( this.settings.pendingClass );
1916if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
1917$( this.currentForm ).submit();
1918this.formSubmitted = false;
1919} else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
1920$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
1921this.formSubmitted = false;
1922}
1923},
1924previousValue: function( element, method ) {
1925return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
1926old: null,
1927valid: true,
1928message: this.defaultMessage( element, { method: method } )
1929} );
1930},
1931destroy: function() {
1932this.resetForm();
1933$( this.currentForm )
1934.off( ".validate" )
1935.removeData( "validator" )
1936.find( ".validate-equalTo-blur" )
1937.off( ".validate-equalTo" )
1938.removeClass( "validate-equalTo-blur" );
1939}
1940},
1941classRuleSettings: {
1942required: { required: true },
1943email: { email: true },
1944url: { url: true },
1945date: { date: true },
1946dateISO: { dateISO: true },
1947number: { number: true },
1948digits: { digits: true },
1949creditcard: { creditcard: true }
1950},
1951addClassRules: function( className, rules ) {
1952if ( className.constructor === String ) {
1953this.classRuleSettings[ className ] = rules;
1954} else {
1955$.extend( this.classRuleSettings, className );
1956}
1957},
1958classRules: function( element ) {
1959var rules = {},
1960classes = $( element ).attr( "class" );
1961if ( classes ) {
1962$.each( classes.split( " " ), function() {
1963if ( this in $.validator.classRuleSettings ) {
1964$.extend( rules, $.validator.classRuleSettings[ this ] );
1965}
1966} );
1967}
1968return rules;
1969},
1970normalizeAttributeRule: function( rules, type, method, value ) {
1971if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
1972value = Number( value );
1973if ( isNaN( value ) ) {
1974value = undefined;
1975}
1976}
1977if ( value || value === 0 ) {
1978rules[ method ] = value;
1979} else if ( type === method && type !== "range" ) {
1980rules[ method ] = true;
1981}
1982},
1983attributeRules: function( element ) {
1984var rules = {},
1985$element = $( element ),
1986type = element.getAttribute( "type" ),
1987method, value;
1988for ( method in $.validator.methods ) {
1989if ( method === "required" ) {
1990value = element.getAttribute( method );
1991if ( value === "" ) {
1992value = true;
1993}
1994value = !!value;
1995} else {
1996value = $element.attr( method );
1997}
1998this.normalizeAttributeRule( rules, type, method, value );
1999}
2000if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
2001delete rules.maxlength;
2002}
2003return rules;
2004},
2005dataRules: function( element ) {
2006var rules = {},
2007$element = $( element ),
2008type = element.getAttribute( "type" ),
2009method, value;
2010for ( method in $.validator.methods ) {
2011value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
2012this.normalizeAttributeRule( rules, type, method, value );
2013}
2014return rules;
2015},
2016staticRules: function( element ) {
2017var rules = {},
2018validator = $.data( element.form, "validator" );
2019if ( validator.settings.rules ) {
2020rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
2021}
2022return rules;
2023},
2024normalizeRules: function( rules, element ) {
2025$.each( rules, function( prop, val ) {
2026if ( val === false ) {
2027delete rules[ prop ];
2028return;
2029}
2030if ( val.param || val.depends ) {
2031var keepRule = true;
2032switch ( typeof val.depends ) {
2033case "string":
2034keepRule = !!$( val.depends, element.form ).length;
2035break;
2036case "function":
2037keepRule = val.depends.call( element, element );
2038break;
2039}
2040if ( keepRule ) {
2041rules[ prop ] = val.param !== undefined ? val.param : true;
2042} else {
2043$.data( element.form, "validator" ).resetElements( $( element ) );
2044delete rules[ prop ];
2045}
2046}
2047} );
2048$.each( rules, function( rule, parameter ) {
2049rules[ rule ] = $.isFunction( parameter ) && rule !== "normalizer" ? parameter( element ) : parameter;
2050} );
2051$.each( [ "minlength", "maxlength" ], function() {
2052if ( rules[ this ] ) {
2053rules[ this ] = Number( rules[ this ] );
2054}
2055} );
2056$.each( [ "rangelength", "range" ], function() {
2057var parts;
2058if ( rules[ this ] ) {
2059if ( $.isArray( rules[ this ] ) ) {
2060rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
2061} else if ( typeof rules[ this ] === "string" ) {
2062parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
2063rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ];
2064}
2065}
2066} );
2067if ( $.validator.autoCreateRanges ) {
2068if ( rules.min != null && rules.max != null ) {
2069rules.range = [ rules.min, rules.max ];
2070delete rules.min;
2071delete rules.max;
2072}
2073if ( rules.minlength != null && rules.maxlength != null ) {
2074rules.rangelength = [ rules.minlength, rules.maxlength ];
2075delete rules.minlength;
2076delete rules.maxlength;
2077}
2078}
2079return rules;
2080},
2081normalizeRule: function( data ) {
2082if ( typeof data === "string" ) {
2083var transformed = {};
2084$.each( data.split( /\s/ ), function() {
2085transformed[ this ] = true;
2086} );
2087data = transformed;
2088}
2089return data;
2090},
2091addMethod: function( name, method, message ) {
2092$.validator.methods[ name ] = method;
2093$.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
2094if ( method.length < 3 ) {
2095$.validator.addClassRules( name, $.validator.normalizeRule( name ) );
2096}
2097},
2098methods: {
2099required: function( value, element, param ) {
2100if ( !this.depend( param, element ) ) {
2101return "dependency-mismatch";
2102}
2103if ( element.nodeName.toLowerCase() === "select" ) {
2104var val = $( element ).val();
2105return val && val.length > 0;
2106}
2107if ( this.checkable( element ) ) {
2108return this.getLength( value, element ) > 0;
2109}
2110return value.length > 0;
2111},
2112email: function( value, element ) {
2113return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
2114},
2115url: function( value, element ) {
2116return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
2117},
2118date: function( value, element ) {
2119return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
2120},
2121dateISO: function( value, element ) {
2122return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
2123},
2124number: function( value, element ) {
2125return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
2126},
2127digits: function( value, element ) {
2128return this.optional( element ) || /^\d+$/.test( value );
2129},
2130minlength: function( value, element, param ) {
2131var length = $.isArray( value ) ? value.length : this.getLength( value, element );
2132return this.optional( element ) || length >= param;
2133},
2134maxlength: function( value, element, param ) {
2135var length = $.isArray( value ) ? value.length : this.getLength( value, element );
2136return this.optional( element ) || length <= param;
2137},
2138rangelength: function( value, element, param ) {
2139var length = $.isArray( value ) ? value.length : this.getLength( value, element );
2140return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
2141},
2142min: function( value, element, param ) {
2143return this.optional( element ) || value >= param;
2144},
2145max: function( value, element, param ) {
2146return this.optional( element ) || value <= param;
2147},
2148range: function( value, element, param ) {
2149return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
2150},
2151step: function( value, element, param ) {
2152var type = $( element ).attr( "type" ),
2153errorMessage = "Step attribute on input type " + type + " is not supported.",
2154supportedTypes = [ "text", "number", "range" ],
2155re = new RegExp( "\\b" + type + "\\b" ),
2156notSupported = type && !re.test( supportedTypes.join() );
2157if ( notSupported ) {
2158throw new Error( errorMessage );
2159}
2160return this.optional( element ) || ( value % param === 0 );
2161},
2162equalTo: function( value, element, param ) {
2163var target = $( param );
2164if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) {
2165target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() {
2166$( element ).valid();
2167} );
2168}
2169return value === target.val();
2170},
2171remote: function( value, element, param, method ) {
2172if ( this.optional( element ) ) {
2173return "dependency-mismatch";
2174}
2175method = typeof method === "string" && method || "remote";
2176var previous = this.previousValue( element, method ),
2177validator, data, optionDataString;
2178if ( !this.settings.messages[ element.name ] ) {
2179this.settings.messages[ element.name ] = {};
2180}
2181previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ];
2182this.settings.messages[ element.name ][ method ] = previous.message;
2183param = typeof param === "string" && { url: param } || param;
2184optionDataString = $.param( $.extend( { data: value }, param.data ) );
2185if ( previous.old === optionDataString ) {
2186return previous.valid;
2187}
2188previous.old = optionDataString;
2189validator = this;
2190this.startRequest( element );
2191data = {};
2192data[ element.name ] = value;
2193$.ajax( $.extend( true, {
2194mode: "abort",
2195port: "validate" + element.name,
2196dataType: "json",
2197data: data,
2198context: validator.currentForm,
2199success: function( response ) {
2200var valid = response === true || response === "true",
2201errors, message, submitted;
2202validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
2203if ( valid ) {
2204submitted = validator.formSubmitted;
2205validator.resetInternals();
2206validator.toHide = validator.errorsFor( element );
2207validator.formSubmitted = submitted;
2208validator.successList.push( element );
2209validator.invalid[ element.name ] = false;
2210validator.showErrors();
2211} else {
2212errors = {};
2213message = response || validator.defaultMessage( element, { method: method, parameters: value } );
2214errors[ element.name ] = previous.message = message;
2215validator.invalid[ element.name ] = true;
2216validator.showErrors( errors );
2217}
2218previous.valid = valid;
2219validator.stopRequest( element, valid );
2220}
2221}, param ) );
2222return "pending";
2223}
2224}
2225} );
2226var pendingRequests = {},
2227ajax;
2228if ( $.ajaxPrefilter ) {
2229$.ajaxPrefilter( function( settings, _, xhr ) {
2230var port = settings.port;
2231if ( settings.mode === "abort" ) {
2232if ( pendingRequests[ port ] ) {
2233pendingRequests[ port ].abort();
2234}
2235pendingRequests[ port ] = xhr;
2236}
2237} );
2238} else {
2239ajax = $.ajax;
2240$.ajax = function( settings ) {
2241var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
2242port = ( "port" in settings ? settings : $.ajaxSettings ).port;
2243if ( mode === "abort" ) {
2244if ( pendingRequests[ port ] ) {
2245pendingRequests[ port ].abort();
2246}
2247pendingRequests[ port ] = ajax.apply( this, arguments );
2248return pendingRequests[ port ];
2249}
2250return ajax.apply( this, arguments );
2251};
2252}
2253}));
2254(function( factory ) {
2255if ( typeof define === "function" && define.amd ) {
2256define( ["jquery", "../jquery.validate"], factory );
2257} else if (typeof module === "object" && module.exports) {
2258module.exports = factory( require( "jquery" ) );
2259} else {
2260factory( jQuery );
2261}
2262}(function( $ ) {
2263$.extend( $.validator.messages, {
2264required: "Ce champ est obligatoire.",
2265remote: "Veuillez corriger ce champ.",
2266email: "Veuillez fournir une adresse électronique valide.",
2267url: "Veuillez fournir une adresse URL valide.",
2268date: "Veuillez fournir une date valide.",
2269dateISO: "Veuillez fournir une date valide (ISO).",
2270number: "Veuillez fournir un numéro valide.",
2271digits: "Veuillez fournir seulement des chiffres.",
2272creditcard: "Veuillez fournir un numéro de carte de crédit valide.",
2273equalTo: "Veuillez fournir encore la même valeur.",
2274extension: "Veuillez fournir une valeur avec une extension valide.",
2275maxlength: $.validator.format( "Veuillez fournir au plus {0} caractères." ),
2276minlength: $.validator.format( "Veuillez fournir au moins {0} caractères." ),
2277rangelength: $.validator.format( "Veuillez fournir une valeur qui contient entre {0} et {1} caractères." ),
2278range: $.validator.format( "Veuillez fournir une valeur entre {0} et {1}." ),
2279max: $.validator.format( "Veuillez fournir une valeur inférieure ou égale à {0}." ),
2280min: $.validator.format( "Veuillez fournir une valeur supérieure ou égale à {0}." ),
2281maxWords: $.validator.format( "Veuillez fournir au plus {0} mots." ),
2282minWords: $.validator.format( "Veuillez fournir au moins {0} mots." ),
2283rangeWords: $.validator.format( "Veuillez fournir entre {0} et {1} mots." ),
2284letterswithbasicpunc: "Veuillez fournir seulement des lettres et des signes de ponctuation.",
2285alphanumeric: "Veuillez fournir seulement des lettres, nombres, espaces et soulignages.",
2286lettersonly: "Veuillez fournir seulement des lettres.",
2287nowhitespace: "Veuillez ne pas inscrire d'espaces blancs.",
2288ziprange: "Veuillez fournir un code postal entre 902xx-xxxx et 905-xx-xxxx.",
2289integer: "Veuillez fournir un nombre non décimal qui est positif ou négatif.",
2290vinUS: "Veuillez fournir un numéro d'identification du véhicule (VIN).",
2291dateITA: "Veuillez fournir une date valide.",
2292time: "Veuillez fournir une heure valide entre 00:00 et 23:59.",
2293phoneUS: "Veuillez fournir un numéro de téléphone valide.",
2294phoneUK: "Veuillez fournir un numéro de téléphone valide.",
2295mobileUK: "Veuillez fournir un numéro de téléphone mobile valide.",
2296strippedminlength: $.validator.format( "Veuillez fournir au moins {0} caractères." ),
2297email2: "Veuillez fournir une adresse électronique valide.",
2298url2: "Veuillez fournir une adresse URL valide.",
2299creditcardtypes: "Veuillez fournir un numéro de carte de crédit valide.",
2300ipv4: "Veuillez fournir une adresse IP v4 valide.",
2301ipv6: "Veuillez fournir une adresse IP v6 valide.",
2302require_from_group: "Veuillez fournir au moins {0} de ces champs.",
2303nifES: "Veuillez fournir un numéro NIF valide.",
2304nieES: "Veuillez fournir un numéro NIE valide.",
2305cifES: "Veuillez fournir un numéro CIF valide.",
2306postalCodeCA: "Veuillez fournir un code postal valide."
2307} );
2308}));
2309window['debugCustom'] = true;
2310function cl(p, fct){
2311if(p == undefined || !debugCustom){return false;}
2312if(fct == undefined){fct = 'log';}
2313if(console && (fct && console[fct])){
2314console[fct](p);
2315}
2316}
2317function dot(){
2318(function ($) {
2319$('[data-dot]').each(function(){
2320var lines = $(this).attr('data-dot');
2321if(lines == ''){
2322$(this).dotdotdot({wrap: 'word', watch: true});
2323}else{
2324var height = $(this).css('line-height');
2325height = lines * parseInt(height);
2326height += 2; // Pour être sur de passer tous les arrondis (1 suffit pas)
2327$(this).dotdotdot({wrap: 'word', watch: true, height: height});
2328}
2329});
2330}(jQuery));
2331}
2332(function ($) {
2333$(document).ready(function(){
2334dot();
2335})
2336}(jQuery));
2337var environment, environmentChanged, windowWidth, windowHeight;
2338function viewport() {
2339var e = window, a = 'inner';
2340if (!('innerWidth' in window )) {
2341a = 'client';
2342e = document.documentElement || document.body;
2343}
2344return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
2345}
2346environment = 'desktop';
2347environmentChanged = false;
2348windowWidth = viewport().width; // This should match your media query
2349windowHeight = viewport().height; // This should match your media query
2350function testEnvironment() {
2351var currentEnvironment = environment;
2352windowWidth = viewport().width;
2353windowHeight = viewport().height;
2354if (windowWidth <= breakpoint_large && windowWidth > breakpoint_small) {
2355environment = 'tablette';
2356} else if (windowWidth <= breakpoint_small) {
2357environment = 'mobile';
2358} else {
2359environment = 'desktop';
2360}
2361if (currentEnvironment != environment) {
2362environmentChanged = true;
2363} else {
2364environmentChanged = false;
2365}
2366}
2367(function ($) {
2368$(document).ready(function() {
2369testEnvironment();
2370});
2371$(window).resize(function(){
2372testEnvironment();
2373});
2374}(jQuery));
2375!function(t,e){function n(t,e,n){var r=t.children(),o=!1;t.empty();for(var i=0,d=r.length;d>i;i++){var l=r.eq(i);if(t.append(l),n&&t.append(n),a(t,e)){l.remove(),o=!0;break}n&&n.detach()}return o}function r(e,n,i,d,l){var s=!1,c="a, table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style",u="script, .dotdotdot-keep";return e.contents().detach().each(function(){var h=this,f=t(h);if("undefined"==typeof h)return!0;if(f.is(u))e.append(f);else{if(s)return!0;e.append(f),!l||f.is(d.after)||f.find(d.after).length||e[e.is(c)?"after":"append"](l),a(i,d)&&(s=3==h.nodeType?o(f,n,i,d,l):r(f,n,i,d,l)),s||l&&l.detach()}}),n.addClass("is-truncated"),s}function o(e,n,r,o,d){var c=e[0];if(!c)return!1;var h=s(c),f=-1!==h.indexOf(" ")?" ":" ",p="letter"==o.wrap?"":f,g=h.split(p),v=-1,w=-1,b=0,y=g.length-1;for(o.fallbackToLetter&&0==b&&0==y&&(p="",g=h.split(p),y=g.length-1);y>=b&&(0!=b||0!=y);){var m=Math.floor((b+y)/2);if(m==w)break;w=m,l(c,g.slice(0,w+1).join(p)+o.ellipsis),r.children().each(function(){t(this).toggle().toggle()}),a(r,o)?(y=w,o.fallbackToLetter&&0==b&&0==y&&(p="",g=g[0].split(p),v=-1,w=-1,b=0,y=g.length-1)):(v=w,b=w)}if(-1==v||1==g.length&&0==g[0].length){var x=e.parent();e.detach();var C=d&&d.closest(x).length?d.length:0;x.contents().length>C?c=u(x.contents().eq(-1-C),n):(c=u(x,n,!0),C||x.detach()),c&&(h=i(s(c),o),l(c,h),C&&d&&t(c).parent().append(d))}else h=i(g.slice(0,v+1).join(p),o),l(c,h);return!0}function a(t,e){return t.innerHeight()>e.maxHeight}function i(e,n){for(;t.inArray(e.slice(-1),n.lastCharacter.remove)>-1;)e=e.slice(0,-1);return t.inArray(e.slice(-1),n.lastCharacter.noEllipsis)<0&&(e+=n.ellipsis),e}function d(t){return{width:t.innerWidth(),height:t.innerHeight()}}function l(t,e){t.innerText?t.innerText=e:t.nodeValue?t.nodeValue=e:t.textContent&&(t.textContent=e)}function s(t){return t.innerText?t.innerText:t.nodeValue?t.nodeValue:t.textContent?t.textContent:""}function c(t){do t=t.previousSibling;while(t&&1!==t.nodeType&&3!==t.nodeType);return t}function u(e,n,r){var o,a=e&&e[0];if(a){if(!r){if(3===a.nodeType)return a;
2375if(t.trim(e.text()))return u(e.contents().last(),n)}for(o=c(a);!o;){if(e=e.parent(),e.is(n)||!e.length)return!1;o=c(e[0])}if(o)return u(t(o),n)}return!1}function h(e,n){return e?"string"==typeof e?(e=t(e,n),e.length?e:!1):e.jquery?e:!1:!1}function f(t){for(var e=t.innerHeight(),n=["paddingTop","paddingBottom"],r=0,o=n.length;o>r;r++){var a=parseInt(t.css(n[r]),10);isNaN(a)&&(a=0),e-=a}return e}if(!t.fn.dotdotdot){t.fn.dotdotdot=function(e){if(0==this.length)return t.fn.dotdotdot.debug('No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){t(this).dotdotdot(e)});var o=this,i=o.contents();o.data("dotdotdot")&&o.trigger("destroy.dot"),o.data("dotdotdot-style",o.attr("style")||""),o.css("word-wrap","break-word"),"nowrap"===o.css("white-space")&&o.css("white-space","normal"),o.bind_events=function(){return o.bind("update.dot",function(e,d){switch(o.removeClass("is-truncated"),e.preventDefault(),e.stopPropagation(),typeof l.height){case"number":l.maxHeight=l.height;break;case"function":l.maxHeight=l.height.call(o[0]);break;default:l.maxHeight=f(o)}l.maxHeight+=l.tolerance,"undefined"!=typeof d&&(("string"==typeof d||"nodeType"in d&&1===d.nodeType)&&(d=t("<div />").append(d).contents()),d instanceof t&&(i=d)),g=o.wrapInner('<div class="dotdotdot" />').children(),g.contents().detach().end().append(i.clone(!0)).find("br").replaceWith("  <br />  ").end().css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var c=!1,u=!1;return s.afterElement&&(c=s.afterElement.clone(!0),c.show(),s.afterElement.detach()),a(g,l)&&(u="children"==l.wrap?n(g,l,c):r(g,o,g,l,c)),g.replaceWith(g.contents()),g=null,t.isFunction(l.callback)&&l.callback.call(o[0],u,i),s.isTruncated=u,u}).bind("isTruncated.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],s.isTruncated),s.isTruncated}).bind("originalContent.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],i),i}).bind("destroy.dot",function(t){t.preventDefault(),t.stopPropagation(),o.unwatch().unbind_events().contents().detach().end().append(i).attr("style",o.data("dotdotdot-style")||"").removeClass("is-truncated").data("dotdotdot",!1)}),o},o.unbind_events=function(){return o.unbind(".dot"),o},o.watch=function(){if(o.unwatch(),"window"==l.watch){var e=t(window),n=e.width(),r=e.height();e.bind("resize.dot"+s.dotId,function(){n==e.width()&&r==e.height()&&l.windowResizeFix||(n=e.width(),r=e.height(),u&&clearInterval(u),u=setTimeout(function(){o.trigger("update.dot")},100))})}else c=d(o),u=setInterval(function(){if(o.is(":visible")){var t=d(o);c.width==t.width&&c.height==t.height||(o.trigger("update.dot"),c=t)}},500);return o},o.unwatch=function(){return t(window).unbind("resize.dot"+s.dotId),u&&clearInterval(u),o};var l=t.extend(!0,{},t.fn.dotdotdot.defaults,e),s={},c={},u=null,g=null;return l.lastCharacter.remove instanceof Array||(l.lastCharacter.remove=t.fn.dotdotdot.defaultArrays.lastCharacter.remove),l.lastCharacter.noEllipsis instanceof Array||(l.lastCharacter.noEllipsis=t.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis),s.afterElement=h(l.after,o),s.isTruncated=!1,s.dotId=p++,o.data("dotdotdot",!0).bind_events().trigger("update.dot"),l.watch&&o.watch(),o},t.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbackToLetter:!0,lastCharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0},t.fn.dotdotdot.defaultArrays={lastCharacter:{remove:[" "," ",",",";",".","!","?"],noEllipsis:[]}},t.fn.dotdotdot.debug=function(t){};var p=1,g=t.fn.html;t.fn.html=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?this.trigger("update",[n]):g.apply(this,arguments)};var v=t.fn.text;t.fn.text=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?(n=t("<div />").text(n).html(),this.trigger("update",[n])):v.apply(this,arguments)}}}(jQuery),jQuery(document).ready(function(t){t(".dot-ellipsis").each(function(){var e=t(this).hasClass("dot-resize-update"),n=t(this).hasClass("dot-timer-update"),r=0,o=t(this).attr("class").split(/\s+/);t.each(o,function(t,e){var n=e.match(/^dot-height-(\d+)$/);null!==n&&(r=Number(n[1]))});var a=new Object;n&&(a.watch=!0),e&&(a.watch="window"),r>0&&(a.height=r),t(this).dotdotdot(a)})}),jQuery(window).load(function(){jQuery(".dot-ellipsis.dot-load-update").trigger("update.dot")});
2376! function(t, e) { "function" == typeof define && define.amd ? define("jquery-bridget/jquery-bridget", ["jquery"], function(i) { return e(t, i) }) : "object" == typeof module && module.exports ? module.exports = e(t, require("jquery")) : t.jQueryBridget = e(t, t.jQuery) }(window, function(t, e) { "use strict";
2377function i(i, r, a) {
2378function h(t, e, n) { var o, r = "$()." + i + '("' + e + '")'; return t.each(function(t, h) { var u = a.data(h, i); if (!u) return void s(i + " not initialized. Cannot call methods, i.e. " + r); var d = u[e]; if (!d || "_" == e.charAt(0)) return void s(r + " is not a valid method"); var l = d.apply(u, n);
2379o = void 0 === o ? l : o }), void 0 !== o ? o : t }
2380function u(t, e) { t.each(function(t, n) { var o = a.data(n, i);
2381o ? (o.option(e), o._init()) : (o = new r(n, e), a.data(n, i, o)) }) }
2382a = a || e || t.jQuery, a && (r.prototype.option || (r.prototype.option = function(t) { a.isPlainObject(t) && (this.options = a.extend(!0, this.options, t)) }), a.fn[i] = function(t) { if ("string" == typeof t) { var e = o.call(arguments, 1); return h(this, t, e) } return u(this, t), this }, n(a)) }
2383function n(t) {!t || t && t.bridget || (t.bridget = i) } var o = Array.prototype.slice,
2384r = t.console,
2385s = "undefined" == typeof r ? function() {} : function(t) { r.error(t) }; return n(e || t.jQuery), i }),
2386function(t, e) { "function" == typeof define && define.amd ? define("ev-emitter/ev-emitter", e) : "object" == typeof module && module.exports ? module.exports = e() : t.EvEmitter = e() }("undefined" != typeof window ? window : this, function() {
2387function t() {} var e = t.prototype; return e.on = function(t, e) { if (t && e) { var i = this._events = this._events || {},
2388n = i[t] = i[t] || []; return -1 == n.indexOf(e) && n.push(e), this } }, e.once = function(t, e) { if (t && e) { this.on(t, e); var i = this._onceEvents = this._onceEvents || {},
2389n = i[t] = i[t] || {}; return n[e] = !0, this } }, e.off = function(t, e) { var i = this._events && this._events[t]; if (i && i.length) { var n = i.indexOf(e); return -1 != n && i.splice(n, 1), this } }, e.emitEvent = function(t, e) { var i = this._events && this._events[t]; if (i && i.length) { var n = 0,
2390o = i[n];
2391e = e || []; for (var r = this._onceEvents && this._onceEvents[t]; o;) { var s = r && r[o];
2392s && (this.off(t, o), delete r[o]), o.apply(this, e), n += s ? 0 : 1, o = i[n] } return this } }, t }),
2393function(t, e) { "use strict"; "function" == typeof define && define.amd ? define("get-size/get-size", [], function() { return e() }) : "object" == typeof module && module.exports ? module.exports = e() : t.getSize = e() }(window, function() { "use strict";
2394function t(t) { var e = parseFloat(t),
2395i = -1 == t.indexOf("%") && !isNaN(e); return i && e }
2396function e() {}
2397function i() { for (var t = { width: 0, height: 0, innerWidth: 0, innerHeight: 0, outerWidth: 0, outerHeight: 0 }, e = 0; u > e;
vendor: 20,766 bytes, lines 2397-2546
2397 e++) { var i = h[e];
2398t[i] = 0 } return t }
2399function n(t) { var e = getComputedStyle(t); return e || a("Style returned " + e + ". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"), e }
2400function o() { if (!d) { d = !0; var e = document.createElement("div");
2401e.style.width = "200px", e.style.padding = "1px 2px 3px 4px", e.style.borderStyle = "solid", e.style.borderWidth = "1px 2px 3px 4px", e.style.boxSizing = "border-box"; var i = document.body || document.documentElement;
2402i.appendChild(e); var o = n(e);
2403r.isBoxSizeOuter = s = 200 == t(o.width), i.removeChild(e) } }
2404function r(e) { if (o(), "string" == typeof e && (e = document.querySelector(e)), e && "object" == typeof e && e.nodeType) { var r = n(e); if ("none" == r.display) return i(); var a = {};
2405a.width = e.offsetWidth, a.height = e.offsetHeight; for (var d = a.isBorderBox = "border-box" == r.boxSizing, l = 0; u > l; l++) { var c = h[l],
2406f = r[c],
2407m = parseFloat(f);
2408a[c] = isNaN(m) ? 0 : m } var p = a.paddingLeft + a.paddingRight,
2409g = a.paddingTop + a.paddingBottom,
2410y = a.marginLeft + a.marginRight,
2411v = a.marginTop + a.marginBottom,
2412_ = a.borderLeftWidth + a.borderRightWidth,
2413z = a.borderTopWidth + a.borderBottomWidth,
2414E = d && s,
2415b = t(r.width);
2416b !== !1 && (a.width = b + (E ? 0 : p + _)); var x = t(r.height); return x !== !1 && (a.height = x + (E ? 0 : g + z)), a.innerWidth = a.width - (p + _), a.innerHeight = a.height - (g + z), a.outerWidth = a.width + y, a.outerHeight = a.height + v, a } } var s, a = "undefined" == typeof console ? e : function(t) { console.error(t) },
2417h = ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "marginLeft", "marginRight", "marginTop", "marginBottom", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth"],
2418u = h.length,
2419d = !1; return r }),
2420function(t, e) { "use strict"; "function" == typeof define && define.amd ? define("desandro-matches-selector/matches-selector", e) : "object" == typeof module && module.exports ? module.exports = e() : t.matchesSelector = e() }(window, function() { "use strict"; var t = function() { var t = window.Element.prototype; if (t.matches) return "matches"; if (t.matchesSelector) return "matchesSelector"; for (var e = ["webkit", "moz", "ms", "o"], i = 0; i < e.length; i++) { var n = e[i],
2421o = n + "MatchesSelector"; if (t[o]) return o } }(); return function(e, i) { return e[t](i) } }),
2422function(t, e) { "function" == typeof define && define.amd ? define("fizzy-ui-utils/utils", ["desandro-matches-selector/matches-selector"], function(i) { return e(t, i) }) : "object" == typeof module && module.exports ? module.exports = e(t, require("desandro-matches-selector")) : t.fizzyUIUtils = e(t, t.matchesSelector) }(window, function(t, e) { var i = {};
2423i.extend = function(t, e) { for (var i in e) t[i] = e[i]; return t }, i.modulo = function(t, e) { return (t % e + e) % e }, i.makeArray = function(t) { var e = []; if (Array.isArray(t)) e = t;
2424else if (t && "object" == typeof t && "number" == typeof t.length)
2425for (var i = 0; i < t.length; i++) e.push(t[i]);
2426else e.push(t); return e }, i.removeFrom = function(t, e) { var i = t.indexOf(e); - 1 != i && t.splice(i, 1) }, i.getParent = function(t, i) { for (; t != document.body;)
2427if (t = t.parentNode, e(t, i)) return t }, i.getQueryElement = function(t) { return "string" == typeof t ? document.querySelector(t) : t }, i.handleEvent = function(t) { var e = "on" + t.type;
2428this[e] && this[e](t) }, i.filterFindElements = function(t, n) { t = i.makeArray(t); var o = []; return t.forEach(function(t) { if (t instanceof HTMLElement) { if (!n) return void o.push(t);
2429e(t, n) && o.push(t); for (var i = t.querySelectorAll(n), r = 0; r < i.length; r++) o.push(i[r]) } }), o }, i.debounceMethod = function(t, e, i) { var n = t.prototype[e],
2430o = e + "Timeout";
2431t.prototype[e] = function() { var t = this[o];
2432t && clearTimeout(t); var e = arguments,
2433r = this;
2434this[o] = setTimeout(function() { n.apply(r, e), delete r[o] }, i || 100) } }, i.docReady = function(t) { var e = document.readyState; "complete" == e || "interactive" == e ? setTimeout(t) : document.addEventListener("DOMContentLoaded", t) }, i.toDashed = function(t) { return t.replace(/(.)([A-Z])/g, function(t, e, i) { return e + "-" + i }).toLowerCase() }; var n = t.console; return i.htmlInit = function(e, o) { i.docReady(function() { var r = i.toDashed(o),
2435s = "data-" + r,
2436a = document.querySelectorAll("[" + s + "]"),
2437h = document.querySelectorAll(".js-" + r),
2438u = i.makeArray(a).concat(i.makeArray(h)),
2439d = s + "-options",
2440l = t.jQuery;
2441u.forEach(function(t) { var i, r = t.getAttribute(s) || t.getAttribute(d); try { i = r && JSON.parse(r) } catch (a) { return void(n && n.error("Error parsing " + s + " on " + t.className + ": " + a)) } var h = new e(t, i);
2442l && l.data(t, o, h) }) }) }, i }),
2443function(t, e) { "function" == typeof define && define.amd ? define("outlayer/item", ["ev-emitter/ev-emitter", "get-size/get-size"], e) : "object" == typeof module && module.exports ? module.exports = e(require("ev-emitter"), require("get-size")) : (t.Outlayer = {}, t.Outlayer.Item = e(t.EvEmitter, t.getSize)) }(window, function(t, e) { "use strict";
2444function i(t) { for (var e in t) return !1; return e = null, !0 }
2445function n(t, e) { t && (this.element = t, this.layout = e, this.position = { x: 0, y: 0 }, this._create()) }
2446function o(t) { return t.replace(/([A-Z])/g, function(t) { return "-" + t.toLowerCase() }) } var r = document.documentElement.style,
2447s = "string" == typeof r.transition ? "transition" : "WebkitTransition",
2448a = "string" == typeof r.transform ? "transform" : "WebkitTransform",
2449h = { WebkitTransition: "webkitTransitionEnd", transition: "transitionend" }[s],
2450u = { transform: a, transition: s, transitionDuration: s + "Duration", transitionProperty: s + "Property", transitionDelay: s + "Delay" },
2451d = n.prototype = Object.create(t.prototype);
2452d.constructor = n, d._create = function() { this._transn = { ingProperties: {}, clean: {}, onEnd: {} }, this.css({ position: "absolute" }) }, d.handleEvent = function(t) { var e = "on" + t.type;
2453this[e] && this[e](t) }, d.getSize = function() { this.size = e(this.element) }, d.css = function(t) { var e = this.element.style; for (var i in t) { var n = u[i] || i;
2454e[n] = t[i] } }, d.getPosition = function() { var t = getComputedStyle(this.element),
2455e = this.layout._getOption("originLeft"),
2456i = this.layout._getOption("originTop"),
2457n = t[e ? "left" : "right"],
2458o = t[i ? "top" : "bottom"],
2459r = this.layout.size,
2460s = -1 != n.indexOf("%") ? parseFloat(n) / 100 * r.width : parseInt(n, 10),
2461a = -1 != o.indexOf("%") ? parseFloat(o) / 100 * r.height : parseInt(o, 10);
2462s = isNaN(s) ? 0 : s, a = isNaN(a) ? 0 : a, s -= e ? r.paddingLeft : r.paddingRight, a -= i ? r.paddingTop : r.paddingBottom, this.position.x = s, this.position.y = a }, d.layoutPosition = function() { var t = this.layout.size,
2463e = {},
2464i = this.layout._getOption("originLeft"),
2465n = this.layout._getOption("originTop"),
2466o = i ? "paddingLeft" : "paddingRight",
2467r = i ? "left" : "right",
2468s = i ? "right" : "left",
2469a = this.position.x + t[o];
2470e[r] = this.getXValue(a), e[s] = ""; var h = n ? "paddingTop" : "paddingBottom",
2471u = n ? "top" : "bottom",
2472d = n ? "bottom" : "top",
2473l = this.position.y + t[h];
2474e[u] = this.getYValue(l), e[d] = "", this.css(e), this.emitEvent("layout", [this]) }, d.getXValue = function(t) { var e = this.layout._getOption("horizontal"); return this.layout.options.percentPosition && !e ? t / this.layout.size.width * 100 + "%" : t + "px" }, d.getYValue = function(t) { var e = this.layout._getOption("horizontal"); return this.layout.options.percentPosition && e ? t / this.layout.size.height * 100 + "%" : t + "px" }, d._transitionTo = function(t, e) { this.getPosition(); var i = this.position.x,
2475n = this.position.y,
2476o = parseInt(t, 10),
2477r = parseInt(e, 10),
2478s = o === this.position.x && r === this.position.y; if (this.setPosition(t, e), s && !this.isTransitioning) return void this.layoutPosition(); var a = t - i,
2479h = e - n,
2480u = {};
2481u.transform = this.getTranslate(a, h), this.transition({ to: u, onTransitionEnd: { transform: this.layoutPosition }, isCleaning: !0 }) }, d.getTranslate = function(t, e) { var i = this.layout._getOption("originLeft"),
2482n = this.layout._getOption("originTop"); return t = i ? t : -t, e = n ? e : -e, "translate3d(" + t + "px, " + e + "px, 0)" }, d.goTo = function(t, e) { this.setPosition(t, e), this.layoutPosition() }, d.moveTo = d._transitionTo, d.setPosition = function(t, e) { this.position.x = parseInt(t, 10), this.position.y = parseInt(e, 10) }, d._nonTransition = function(t) { this.css(t.to), t.isCleaning && this._removeStyles(t.to); for (var e in t.onTransitionEnd) t.onTransitionEnd[e].call(this) }, d.transition = function(t) { if (!parseFloat(this.layout.options.transitionDuration)) return void this._nonTransition(t); var e = this._transn; for (var i in t.onTransitionEnd) e.onEnd[i] = t.onTransitionEnd[i]; for (i in t.to) e.ingProperties[i] = !0, t.isCleaning && (e.clean[i] = !0); if (t.from) { this.css(t.from); var n = this.element.offsetHeight;
2483n = null }
2484this.enableTransition(t.to), this.css(t.to), this.isTransitioning = !0 }; var l = "opacity," + o(a);
2485d.enableTransition = function() { if (!this.isTransitioning) { var t = this.layout.options.transitionDuration;
2486t = "number" == typeof t ? t + "ms" : t, this.css({ transitionProperty: l, transitionDuration: t, transitionDelay: this.staggerDelay || 0 }), this.element.addEventListener(h, this, !1) } }, d.onwebkitTransitionEnd = function(t) { this.ontransitionend(t) }, d.onotransitionend = function(t) { this.ontransitionend(t) }; var c = { "-webkit-transform": "transform" };
2487d.ontransitionend = function(t) { if (t.target === this.element) { var e = this._transn,
2488n = c[t.propertyName] || t.propertyName; if (delete e.ingProperties[n], i(e.ingProperties) && this.disableTransition(), n in e.clean && (this.element.style[t.propertyName] = "", delete e.clean[n]), n in e.onEnd) { var o = e.onEnd[n];
2489o.call(this), delete e.onEnd[n] }
2490this.emitEvent("transitionEnd", [this]) } }, d.disableTransition = function() { this.removeTransitionStyles(), this.element.removeEventListener(h, this, !1), this.isTransitioning = !1 }, d._removeStyles = function(t) { var e = {}; for (var i in t) e[i] = "";
2491this.css(e) }; var f = { transitionProperty: "", transitionDuration: "", transitionDelay: "" }; return d.removeTransitionStyles = function() { this.css(f) }, d.stagger = function(t) { t = isNaN(t) ? 0 : t, this.staggerDelay = t + "ms" }, d.removeElem = function() { this.element.parentNode.removeChild(this.element), this.css({ display: "" }), this.emitEvent("remove", [this]) }, d.remove = function() { return s && parseFloat(this.layout.options.transitionDuration) ? (this.once("transitionEnd", function() { this.removeElem() }), void this.hide()) : void this.removeElem() }, d.reveal = function() { delete this.isHidden, this.css({ display: "" }); var t = this.layout.options,
2492e = {},
2493i = this.getHideRevealTransitionEndProperty("visibleStyle");
2494e[i] = this.onRevealTransitionEnd, this.transition({ from: t.hiddenStyle, to: t.visibleStyle, isCleaning: !0, onTransitionEnd: e }) }, d.onRevealTransitionEnd = function() { this.isHidden || this.emitEvent("reveal") }, d.getHideRevealTransitionEndProperty = function(t) { var e = this.layout.options[t]; if (e.opacity) return "opacity"; for (var i in e) return i }, d.hide = function() { this.isHidden = !0, this.css({ display: "" }); var t = this.layout.options,
2495e = {},
2496i = this.getHideRevealTransitionEndProperty("hiddenStyle");
2497e[i] = this.onHideTransitionEnd, this.transition({ from: t.visibleStyle, to: t.hiddenStyle, isCleaning: !0, onTransitionEnd: e }) }, d.onHideTransitionEnd = function() { this.isHidden && (this.css({ display: "none" }), this.emitEvent("hide")) }, d.destroy = function() { this.css({ position: "", left: "", right: "", top: "", bottom: "", transition: "", transform: "" }) }, n }),
2498function(t, e) { "use strict"; "function" == typeof define && define.amd ? define("outlayer/outlayer", ["ev-emitter/ev-emitter", "get-size/get-size", "fizzy-ui-utils/utils", "./item"], function(i, n, o, r) { return e(t, i, n, o, r) }) : "object" == typeof module && module.exports ? module.exports = e(t, require("ev-emitter"), require("get-size"), require("fizzy-ui-utils"), require("./item")) : t.Outlayer = e(t, t.EvEmitter, t.getSize, t.fizzyUIUtils, t.Outlayer.Item) }(window, function(t, e, i, n, o) { "use strict";
2499function r(t, e) { var i = n.getQueryElement(t); if (!i) return void(h && h.error("Bad element for " + this.constructor.namespace + ": " + (i || t)));
2500this.element = i, u && (this.$element = u(this.element)), this.options = n.extend({}, this.constructor.defaults), this.option(e); var o = ++l;
2501this.element.outlayerGUID = o, c[o] = this, this._create(); var r = this._getOption("initLayout");
2502r && this.layout() }
2503function s(t) {
2504function e() { t.apply(this, arguments) } return e.prototype = Object.create(t.prototype), e.prototype.constructor = e, e }
2505function a(t) { if ("number" == typeof t) return t; var e = t.match(/(^\d*\.?\d*)(\w*)/),
2506i = e && e[1],
2507n = e && e[2]; if (!i.length) return 0;
2508i = parseFloat(i); var o = m[n] || 1; return i * o } var h = t.console,
2509u = t.jQuery,
2510d = function() {},
2511l = 0,
2512c = {};
2513r.namespace = "outlayer", r.Item = o, r.defaults = { containerStyle: { position: "relative" }, initLayout: !0, originLeft: !0, originTop: !0, resize: !0, resizeContainer: !0, transitionDuration: "0.4s", hiddenStyle: { opacity: 0, transform: "scale(0.001)" }, visibleStyle: { opacity: 1, transform: "scale(1)" } }; var f = r.prototype;
2514n.extend(f, e.prototype), f.option = function(t) { n.extend(this.options, t) }, f._getOption = function(t) { var e = this.constructor.compatOptions[t]; return e && void 0 !== this.options[e] ? this.options[e] : this.options[t] }, r.compatOptions = { initLayout: "isInitLayout", horizontal: "isHorizontal", layoutInstant: "isLayoutInstant", originLeft: "isOriginLeft", originTop: "isOriginTop", resize: "isResizeBound", resizeContainer: "isResizingContainer" }, f._create = function() { this.reloadItems(), this.stamps = [], this.stamp(this.options.stamp), n.extend(this.element.style, this.options.containerStyle); var t = this._getOption("resize");
2515t && this.bindResize() }, f.reloadItems = function() { this.items = this._itemize(this.element.children) }, f._itemize = function(t) { for (var e = this._filterFindItemElements(t), i = this.constructor.Item, n = [], o = 0; o < e.length; o++) { var r = e[o],
2516s = new i(r, this);
2517n.push(s) } return n }, f._filterFindItemElements = function(t) { return n.filterFindElements(t, this.options.itemSelector) }, f.getItemElements = function() { return this.items.map(function(t) { return t.element }) }, f.layout = function() { this._resetLayout(), this._manageStamps(); var t = this._getOption("layoutInstant"),
2518e = void 0 !== t ? t : !this._isLayoutInited;
2519this.layoutItems(this.items, e), this._isLayoutInited = !0 }, f._init = f.layout, f._resetLayout = function() { this.getSize() }, f.getSize = function() { this.size = i(this.element) }, f._getMeasurement = function(t, e) { var n, o = this.options[t];
2520o ? ("string" == typeof o ? n = this.element.querySelector(o) : o instanceof HTMLElement && (n = o), this[t] = n ? i(n)[e] : o) : this[t] = 0 }, f.layoutItems = function(t, e) { t = this._getItemsForLayout(t), this._layoutItems(t, e), this._postLayout() }, f._getItemsForLayout = function(t) { return t.filter(function(t) { return !t.isIgnored }) }, f._layoutItems = function(t, e) { if (this._emitCompleteOnItems("layout", t), t && t.length) { var i = [];
2521t.forEach(function(t) { var n = this._getItemLayoutPosition(t);
2522n.item = t, n.isInstant = e || t.isLayoutInstant, i.push(n) }, this), this._processLayoutQueue(i) } }, f._getItemLayoutPosition = function() { return { x: 0, y: 0 } }, f._processLayoutQueue = function(t) { this.updateStagger(), t.forEach(function(t, e) { this._positionItem(t.item, t.x, t.y, t.isInstant, e) }, this) }, f.updateStagger = function() { var t = this.options.stagger; return null === t || void 0 === t ? void(this.stagger = 0) : (this.stagger = a(t), this.stagger) }, f._positionItem = function(t, e, i, n, o) { n ? t.goTo(e, i) : (t.stagger(o * this.stagger), t.moveTo(e, i)) }, f._postLayout = function() { this.resizeContainer() }, f.resizeContainer = function() { var t = this._getOption("resizeContainer"); if (t) { var e = this._getContainerSize();
2523e && (this._setContainerMeasure(e.width, !0), this._setContainerMeasure(e.height, !1)) } }, f._getContainerSize = d, f._setContainerMeasure = function(t, e) { if (void 0 !== t) { var i = this.size;
2524i.isBorderBox && (t += e ? i.paddingLeft + i.paddingRight + i.borderLeftWidth + i.borderRightWidth : i.paddingBottom + i.paddingTop + i.borderTopWidth + i.borderBottomWidth), t = Math.max(t, 0), this.element.style[e ? "width" : "height"] = t + "px" } }, f._emitCompleteOnItems = function(t, e) {
2525function i() { o.dispatchEvent(t + "Complete", null, [e]) }
2526function n() { s++, s == r && i() } var o = this,
2527r = e.length; if (!e || !r) return void i(); var s = 0;
2528e.forEach(function(e) { e.once(t, n) }) }, f.dispatchEvent = function(t, e, i) { var n = e ? [e].concat(i) : i; if (this.emitEvent(t, n), u)
2529if (this.$element = this.$element || u(this.element), e) { var o = u.Event(e);
2530o.type = t, this.$element.trigger(o, i) } else this.$element.trigger(t, i) }, f.ignore = function(t) { var e = this.getItem(t);
2531e && (e.isIgnored = !0) }, f.unignore = function(t) { var e = this.getItem(t);
2532e && delete e.isIgnored }, f.stamp = function(t) { t = this._find(t), t && (this.stamps = this.stamps.concat(t), t.forEach(this.ignore, this)) }, f.unstamp = function(t) { t = this._find(t), t && t.forEach(function(t) { n.removeFrom(this.stamps, t), this.unignore(t) }, this) }, f._find = function(t) { return t ? ("string" == typeof t && (t = this.element.querySelectorAll(t)), t = n.makeArray(t)) : void 0 }, f._manageStamps = function() { this.stamps && this.stamps.length && (this._getBoundingRect(), this.stamps.forEach(this._manageStamp, this)) }, f._getBoundingRect = function() { var t = this.element.getBoundingClientRect(),
2533e = this.size;
2534this._boundingRect = { left: t.left + e.paddingLeft + e.borderLeftWidth, top: t.top + e.paddingTop + e.borderTopWidth, right: t.right - (e.paddingRight + e.borderRightWidth), bottom: t.bottom - (e.paddingBottom + e.borderBottomWidth) } }, f._manageStamp = d, f._getElementOffset = function(t) { var e = t.getBoundingClientRect(),
2535n = this._boundingRect,
2536o = i(t),
2537r = { left: e.left - n.left - o.marginLeft, top: e.top - n.top - o.marginTop, right: n.right - e.right - o.marginRight, bottom: n.bottom - e.bottom - o.marginBottom }; return r }, f.handleEvent = n.handleEvent, f.bindResize = function() { t.addEventListener("resize", this), this.isResizeBound = !0 }, f.unbindResize = function() { t.removeEventListener("resize", this), this.isResizeBound = !1 }, f.onresize = function() { this.resize() }, n.debounceMethod(r, "onresize", 100), f.resize = function() { this.isResizeBound && this.needsResizeLayout() && this.layout() }, f.needsResizeLayout = function() { var t = i(this.element),
2538e = this.size && t; return e && t.innerWidth !== this.size.innerWidth }, f.addItems = function(t) { var e = this._itemize(t); return e.length && (this.items = this.items.concat(e)), e }, f.appended = function(t) { var e = this.addItems(t);
2539e.length && (this.layoutItems(e, !0), this.reveal(e)) }, f.prepended = function(t) { var e = this._itemize(t); if (e.length) { var i = this.items.slice(0);
2540this.items = e.concat(i), this._resetLayout(), this._manageStamps(), this.layoutItems(e, !0), this.reveal(e), this.layoutItems(i) } }, f.reveal = function(t) { if (this._emitCompleteOnItems("reveal", t), t && t.length) { var e = this.updateStagger();
2541t.forEach(function(t, i) { t.stagger(i * e), t.reveal() }) } }, f.hide = function(t) { if (this._emitCompleteOnItems("hide", t), t && t.length) { var e = this.updateStagger();
2542t.forEach(function(t, i) { t.stagger(i * e), t.hide() }) } }, f.revealItemElements = function(t) { var e = this.getItems(t);
2543this.reveal(e) }, f.hideItemElements = function(t) { var e = this.getItems(t);
2544this.hide(e) }, f.getItem = function(t) { for (var e = 0; e < this.items.length; e++) { var i = this.items[e]; if (i.element == t) return i } }, f.getItems = function(t) { t = n.makeArray(t); var e = []; return t.forEach(function(t) { var i = this.getItem(t);
2545i && e.push(i) }, this), e }, f.remove = function(t) { var e = this.getItems(t);
2546this._emitCompleteOnItems("remove", e), e && e.length && e.forEach(function(t) { t.remove(), n.removeFrom(this.items, t) }, this) }, f.destroy = function() { var t = this.element.style;
2547t.height = "", t.position = "", t.width = "", this.items.forEach(function(t) { t.destroy() }), this.unbindResize(); var e = this.element.outlayerGUID;
2548delete c[e], delete this.element.outlayerGUID, u && u.removeData(this.element, this.constructor.namespace) }, r.data = function(t) { t = n.getQueryElement(t); var e = t && t.outlayerGUID; return e && c[e] }, r.create = function(t, e) { var i = s(r); return i.defaults = n.extend({}, r.defaults), n.extend(i.defaults, e), i.compatOptions = n.extend({}, r.compatOptions), i.namespace = t, i.data = r.data, i.Item = s(o), n.htmlInit(i, t), u && u.bridget && u.bridget(t, i), i }; var m = { ms: 1, s: 1e3 }; return r.Item = o, r }),
2549function(t, e) { "function" == typeof define && define.amd ? define(["outlayer/outlayer", "get-size/get-size"], e) : "object" == typeof module && module.exports ? module.exports = e(require("outlayer"), require("get-size")) : t.Masonry = e(t.Outlayer, t.getSize) }(window, function(t, e) { var i = t.create("masonry");
2550i.compatOptions.fitWidth = "isFitWidth"; var n = i.prototype; return n._resetLayout = function() { this.getSize(), this._getMeasurement("columnWidth", "outerWidth"), this._getMeasurement("gutter", "outerWidth"), this.measureColumns(), this.colYs = []; for (var t = 0; t < this.cols; t++) this.colYs.push(0);
2551this.maxY = 0, this.horizontalColIndex = 0 }, n.measureColumns = function() { if (this.getContainerWidth(), !this.columnWidth) { var t = this.items[0],
2552i = t && t.element;
2553this.columnWidth = i && e(i).outerWidth || this.containerWidth } var n = this.columnWidth += this.gutter,
2554o = this.containerWidth + this.gutter,
2555r = o / n,
2556s = n - o % n,
2557a = s && 1 > s ? "round" : "floor";
2558r = Math[a](r), this.cols = Math.max(r, 1) }, n.getContainerWidth = function() { var t = this._getOption("fitWidth"),
2559i = t ? this.element.parentNode : this.element,
2560n = e(i);
2561this.containerWidth = n && n.innerWidth }, n._getItemLayoutPosition = function(t) { t.getSize(); var e = t.size.outerWidth % this.columnWidth,
2562i = e && 1 > e ? "round" : "ceil",
2563n = Math[i](t.size.outerWidth / this.columnWidth);
2564n = Math.min(n, this.cols); for (var o = this.options.horizontalOrder ? "_getHorizontalColPosition" : "_getTopColPosition", r = this[o](n, t), s = { x: this.columnWidth * r.col, y: r.y }, a = r.y + t.size.outerHeight, h = n + r.col, u = r.col; h > u; u++) this.colYs[u] = a; return s }, n._getTopColPosition = function(t) { var e = this._getTopColGroup(t),
2565i = Math.min.apply(Math, e); return { col: e.indexOf(i), y: i } }, n._getTopColGroup = function(t) { if (2 > t) return this.colYs; for (var e = [], i = this.cols + 1 - t, n = 0; i > n; n++) e[n] = this._getColGroupY(n, t); return e }, n._getColGroupY = function(t, e) { if (2 > e) return this.colYs[t]; var i = this.colYs.slice(t, t + e); return Math.max.apply(Math, i) }, n._getHorizontalColPosition = function(t, e) { var i = this.horizontalColIndex % this.cols,
2566n = t > 1 && i + t > this.cols;
2567i = n ? 0 : i; var o = e.size.outerWidth && e.size.outerHeight; return this.horizontalColIndex = o ? i + t : this.horizontalColIndex, { col: i, y: this._getColGroupY(i, t) } }, n._manageStamp = function(t) { var i = e(t),
2568n = this._getElementOffset(t),
2569o = this._getOption("originLeft"),
2570r = o ? n.left : n.right,
2571s = r + i.outerWidth,
2572a = Math.floor(r / this.columnWidth);
2573a = Math.max(0, a); var h = Math.floor(s / this.columnWidth);
2574h -= s % this.columnWidth ? 0 : 1, h = Math.min(this.cols - 1, h); for (var u = this._getOption("originTop"), d = (u ? n.top : n.bottom) + i.outerHeight, l = a; h >= l; l++) this.colYs[l] = Math.max(d, this.colYs[l]) }, n._getContainerSize = function() { this.maxY = Math.max.apply(Math, this.colYs); var t = { height: this.maxY }; return this._getOption("fitWidth") && (t.width = this._getContainerFitWidth()), t }, n._getContainerFitWidth = function() { for (var t = 0, e = this.cols; --e && 0 === this.colYs[e];) t++; return (this.cols - t) * this.columnWidth - this.gutter }, n.needsResizeLayout = function() { var t = this.containerWidth; return this.getContainerWidth(), t != this.containerWidth }, i });
2575function getSources(source, conf){
2576conf.source_tous = source; // Table for category 'tous'
2577source.forEach(function(element, index) {
2578var category = element.category;
2579if(!conf['source_'+category]){
2580conf['source_'+category] = [];
2581}
2582conf['source_'+category].push(element);
2583}, this);
2584}
2585function majItems(category, conf){
2586var source = conf['source_'+category] !== undefined ? conf['source_'+category] : [],
2587clones = [];
2588source.forEach(function(element, index) {
2589var item_category = element.category; // Get element category
2590var $template;
2591if(conf['$template_'+item_category]){
2592$template = conf['$template_'+item_category]; // Get element template*
2593}else{
2594console.log('ERROR: Le template pour la catégorie ['+item_category+'] est introuvable');
2595}
2596var clone_html = setTemplateInfos(element, item_category, $template, conf); // Set informations from source element inside the cloned template
2597if(element.is_Big){
2598clones.unshift(clone_html);
2599}else{
2600clones.push(clone_html);
2601}
2602}, this);
2603addToSlider(conf, clones);
2604}
2605function setTemplateInfos(infos, category, $template, conf){
2606var $new_template = $template.clone();
2607if(infos.picture != undefined && infos.picture != '' && conf.hasPicture_class != undefined){
2608$new_template.addClass(conf.hasPicture_class);
2609}
2610if(infos.ville != undefined && infos.ville != '' && conf.hasVille_class != undefined){
2611$new_template.addClass(conf.hasVille_class);
2612$new_template.find('.seu-lead').attr('data-dot', 3);
2613}
2614if(infos.is_Big && conf.is_Big_Class != undefined){
2615$new_template.addClass(conf.is_Big_Class);
2616}
2617var clone = $new_template[0].outerHTML;
2618for(var info in infos){
2619var toReplace = '__'+info+'__';
2620toReplace = new RegExp(toReplace, "g");
2621clone = clone.replace(toReplace, infos[info]);
2622}
2623return clone;
2624}
2625function addToSlider(conf, elements){
2626var nodeStringToAdd = '<div class="'+conf.pages_class+'">';
2627var itemSeparator = 8;
2628if(elements[0].indexOf('seu-big') != -1){
2629itemSeparator = 7;
2630nodeStringToAdd = '<div class="'+conf.pages_class + ' '+conf.is_Big_Class+'">';
2631}
2632if(environment == 'tablette'){
2633itemSeparator = 4;
2634}else if(environment == 'mobile'){
2635itemSeparator = 1;
2636}
2637elements.forEach(function(element, index) {
2638if(index%itemSeparator == 0 && index > 0){
2639nodeStringToAdd += '</div><div class="'+conf.pages_class+'">';
2640}
2641nodeStringToAdd += element;
2642}, this);
2643nodeStringToAdd += '</div>';
2644conf.$slider.html(nodeStringToAdd);
2645}
2646function removeAllItems(conf){
2647conf.$slider.find('.'+conf.pages_class).remove();
2648}
2649function buildSlider(conf){
2650conf.$slider.addClass('owl-carousel').owlCarousel({
2651margin : 20,
2652items: 1,
2653smartSpeed: 800,
2654onInitialized: function(e){
2655manageNavigationDisplay(e, conf.$prev, conf.$next);
2656attachCustomNavEvents(conf.$slider, conf.$prev, conf.$next);
2657},
2658onTranslate : function(e){
2659manageNavigationDisplay(e, conf.$prev, conf.$next);
2660}
2661});
2662}
2663function destroySlider(conf){
2664conf.$slider.trigger('destroy.owl.carousel');
2665}
2666(function (root, factory) {
2667if (typeof define === 'function' && define.amd) {
2668define(factory);
2669} else if (typeof exports === 'object') {
2670module.exports = factory();
2671} else {
2672root.ScrollMagic = factory();
2673}
2674}(this, function () {
2675"use strict";
2676var ScrollMagic = function () {
2677_util.log(2, '(COMPATIBILITY NOTICE) -> As of ScrollMagic 2.0.0 you need to use \'new ScrollMagic.Controller()\' to create a new controller instance. Use \'new ScrollMagic.Scene()\' to instance a scene.');
2678};
2679ScrollMagic.version = "2.0.5";
2680window.addEventListener("mousewheel", function () {});
2681var PIN_SPACER_ATTRIBUTE = "data-scrollmagic-pin-spacer";
2682ScrollMagic.Controller = function (options) {
2683var
2684NAMESPACE = 'ScrollMagic.Controller',
2685SCROLL_DIRECTION_FORWARD = 'FORWARD',
2686SCROLL_DIRECTION_REVERSE = 'REVERSE',
2687SCROLL_DIRECTION_PAUSED = 'PAUSED',
2688DEFAULT_OPTIONS = CONTROLLER_OPTIONS.defaults;
2689var
2690Controller = this,
2691_options = _util.extend({}, DEFAULT_OPTIONS, options),
2692_sceneObjects = [],
2693_updateScenesOnNextCycle = false,
2694_scrollPos = 0,
2695_scrollDirection = SCROLL_DIRECTION_PAUSED,
2696_isDocument = true,
2697_viewPortSize = 0,
2698_enabled = true,
2699_updateTimeout, _refreshTimeout;
2700var construct = function () {
2701for (var key in _options) {
2702if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
2703log(2, "WARNING: Unknown option \"" + key + "\"");
2704delete _options[key];
2705}
2706}
2707_options.container = _util.get.elements(_options.container)[0];
2708if (!_options.container) {
2709log(1, "ERROR creating object " + NAMESPACE + ": No valid scroll container supplied");
2710throw NAMESPACE + " init failed."; // cancel
2711}
2712_isDocument = _options.container === window || _options.container === document.body || !document.body.contains(_options.container);
2713if (_isDocument) {
2714_options.container = window;
2715}
2716_viewPortSize = getViewportSize();
2717_options.container.addEventListener("resize", onChange);
2718_options.container.addEventListener("scroll", onChange);
2719_options.refreshInterval = parseInt(_options.refreshInterval) || DEFAULT_OPTIONS.refreshInterval;
2720scheduleRefresh();
2721log(3, "added new " + NAMESPACE + " controller (v" + ScrollMagic.version + ")");
2722};
2723var scheduleRefresh = function () {
2724if (_options.refreshInterval > 0) {
2725_refreshTimeout = window.setTimeout(refresh, _options.refreshInterval);
2726}
2727};
2728var getScrollPos = function () {
2729return _options.vertical ? _util.get.scrollTop(_options.container) : _util.get.scrollLeft(_options.container);
2730};
2731var getViewportSize = function () {
2732return _options.vertical ? _util.get.height(_options.container) : _util.get.width(_options.container);
2733};
2734var setScrollPos = this._setScrollPos = function (pos) {
2735if (_options.vertical) {
2736if (_isDocument) {
2737window.scrollTo(_util.get.scrollLeft(), pos);
2738} else {
2739_options.container.scrollTop = pos;
2740}
2741} else {
2742if (_isDocument) {
2743window.scrollTo(pos, _util.get.scrollTop());
2744} else {
2745_options.container.scrollLeft = pos;
2746}
2747}
2748};
2749var updateScenes = function () {
2750if (_enabled && _updateScenesOnNextCycle) {
2751var scenesToUpdate = _util.type.Array(_updateScenesOnNextCycle) ? _updateScenesOnNextCycle : _sceneObjects.slice(0);
2752_updateScenesOnNextCycle = false;
2753var oldScrollPos = _scrollPos;
2754_scrollPos = Controller.scrollPos();
2755var deltaScroll = _scrollPos - oldScrollPos;
2756if (deltaScroll !== 0) { // scroll position changed?
2757_scrollDirection = (deltaScroll > 0) ? SCROLL_DIRECTION_FORWARD : SCROLL_DIRECTION_REVERSE;
2758}
2759if (_scrollDirection === SCROLL_DIRECTION_REVERSE) {
2760scenesToUpdate.reverse();
2761}
2762scenesToUpdate.forEach(function (scene, index) {
2763log(3, "updating Scene " + (index + 1) + "/" + scenesToUpdate.length + " (" + _sceneObjects.length + " total)");
2764scene.update(true);
2765});
2766if (scenesToUpdate.length === 0 && _options.loglevel >= 3) {
2767log(3, "updating 0 Scenes (nothing added to controller)");
2768}
2769}
2770};
2771var debounceUpdate = function () {
2772_updateTimeout = _util.rAF(updateScenes);
2773};
2774var onChange = function (e) {
2775log(3, "event fired causing an update:", e.type);
2776if (e.type == "resize") {
2777_viewPortSize = getViewportSize();
2778_scrollDirection = SCROLL_DIRECTION_PAUSED;
2779}
2780if (_updateScenesOnNextCycle !== true) {
2781_updateScenesOnNextCycle = true;
2782debounceUpdate();
2783}
2784};
2785var refresh = function () {
2786if (!_isDocument) {
2787if (_viewPortSize != getViewportSize()) {
2788var resizeEvent;
2789try {
2790resizeEvent = new Event('resize', {
2791bubbles: false,
2792cancelable: false
2793});
2794} catch (e) { // stupid IE
2795resizeEvent = document.createEvent("Event");
2796resizeEvent.initEvent("resize", false, false);
2797}
2798_options.container.dispatchEvent(resizeEvent);
2799}
2800}
2801_sceneObjects.forEach(function (scene, index) { // refresh all scenes
2802scene.refresh();
2803});
2804scheduleRefresh();
2805};
2806var log = this._log = function (loglevel, output) {
2807if (_options.loglevel >= loglevel) {
2808Array.prototype.splice.call(arguments, 1, 0, "(" + NAMESPACE + ") ->");
2809_util.log.apply(window, arguments);
2810}
2811};
2812this._options = _options;
2813var sortScenes = function (ScenesArray) {
2814if (ScenesArray.length <= 1) {
2815return ScenesArray;
2816} else {
2817var scenes = ScenesArray.slice(0);
2818scenes.sort(function (a, b) {
2819return a.scrollOffset() > b.scrollOffset() ? 1 : -1;
2820});
2821return scenes;
2822}
2823};
2824this.addScene = function (newScene) {
2825if (_util.type.Array(newScene)) {
2826newScene.forEach(function (scene, index) {
2827Controller.addScene(scene);
2828});
2829} else if (newScene instanceof ScrollMagic.Scene) {
2830if (newScene.controller() !== Controller) {
2831newScene.addTo(Controller);
2832} else if (_sceneObjects.indexOf(newScene) < 0) {
2833_sceneObjects.push(newScene); // add to array
2834_sceneObjects = sortScenes(_sceneObjects); // sort
2835newScene.on("shift.controller_sort", function () { // resort whenever scene moves
2836_sceneObjects = sortScenes(_sceneObjects);
2837});
2838for (var key in _options.globalSceneOptions) {
2839if (newScene[key]) {
2840newScene[key].call(newScene, _options.globalSceneOptions[key]);
2841}
2842}
2843log(3, "adding Scene (now " + _sceneObjects.length + " total)");
2844}
2845} else {
2846log(1, "ERROR: invalid argument supplied for '.addScene()'");
2847}
2848return Controller;
2849};
2850this.removeScene = function (Scene) {
2851if (_util.type.Array(Scene)) {
2852Scene.forEach(function (scene, index) {
2853Controller.removeScene(scene);
2854});
2855} else {
2856var index = _sceneObjects.indexOf(Scene);
2857if (index > -1) {
2858Scene.off("shift.controller_sort");
2859_sceneObjects.splice(index, 1);
2860log(3, "removing Scene (now " + _sceneObjects.length + " left)");
2861Scene.remove();
2862}
2863}
2864return Controller;
2865};
2866this.updateScene = function (Scene, immediately) {
2867if (_util.type.Array(Scene)) {
2868Scene.forEach(function (scene, index) {
2869Controller.updateScene(scene, immediately);
2870});
2871} else {
2872if (immediately) {
2873Scene.update(true);
2874} else if (_updateScenesOnNextCycle !== true && Scene instanceof ScrollMagic.Scene) { // if _updateScenesOnNextCycle is true, all connected scenes are already scheduled for update
2875_updateScenesOnNextCycle = _updateScenesOnNextCycle || [];
2876if (_updateScenesOnNextCycle.indexOf(Scene) == -1) {
2877_updateScenesOnNextCycle.push(Scene);
2878}
2879_updateScenesOnNextCycle = sortScenes(_updateScenesOnNextCycle); // sort
2880debounceUpdate();
2881}
2882}
2883return Controller;
2884};
2885this.update = function (immediately) {
2886onChange({
2887type: "resize"
2888}); // will update size and set _updateScenesOnNextCycle to true
2889if (immediately) {
2890updateScenes();
2891}
2892return Controller;
2893};
2894this.scrollTo = function (scrollTarget, additionalParameter) {
2895if (_util.type.Number(scrollTarget)) { // excecute
2896setScrollPos.call(_options.container, scrollTarget, additionalParameter);
2897} else if (scrollTarget instanceof ScrollMagic.Scene) { // scroll to scene
2898if (scrollTarget.controller() === Controller) { // check if the controller is associated with this scene
2899Controller.scrollTo(scrollTarget.scrollOffset(), additionalParameter);
2900} else {
2901log(2, "scrollTo(): The supplied scene does not belong to this controller. Scroll cancelled.", scrollTarget);
2902}
2903} else if (_util.type.Function(scrollTarget)) { // assign new scroll function
2904setScrollPos = scrollTarget;
2905} else { // scroll to element
2906var elem = _util.get.elements(scrollTarget)[0];
2907if (elem) {
2908while (elem.parentNode.hasAttribute(PIN_SPACER_ATTRIBUTE)) {
2909elem = elem.parentNode;
2910}
2911var
2912param = _options.vertical ? "top" : "left",
2913containerOffset = _util.get.offset(_options.container),
2914elementOffset = _util.get.offset(elem);
2915if (!_isDocument) { // container is not the document root, so substract scroll Position to get correct trigger element position relative to scrollcontent
2916containerOffset[param] -= Controller.scrollPos();
2917}
2918Controller.scrollTo(elementOffset[param] - containerOffset[param], additionalParameter);
2919} else {
2920log(2, "scrollTo(): The supplied argument is invalid. Scroll cancelled.", scrollTarget);
2921}
2922}
2923return Controller;
2924};
2925this.scrollPos = function (scrollPosMethod) {
2926if (!arguments.length) { // get
2927return getScrollPos.call(Controller);
2928} else { // set
2929if (_util.type.Function(scrollPosMethod)) {
2930getScrollPos = scrollPosMethod;
2931} else {
2932log(2, "Provided value for method 'scrollPos' is not a function. To change the current scroll position use 'scrollTo()'.");
2933}
2934}
2935return Controller;
2936};
2937this.info = function (about) {
2938var values = {
2939size: _viewPortSize,
2940vertical: _options.vertical,
2941scrollPos: _scrollPos,
2942scrollDirection: _scrollDirection,
2943container: _options.container,
2944isDocument: _isDocument
2945};
2946if (!arguments.length) { // get all as an object
2947return values;
2948} else if (values[about] !== undefined) {
2949return values[about];
2950} else {
2951log(1, "ERROR: option \"" + about + "\" is not available");
2952return;
2953}
2954};
2955this.loglevel = function (newLoglevel) {
2956if (!arguments.length) { // get
2957return _options.loglevel;
2958} else if (_options.loglevel != newLoglevel) { // set
2959_options.loglevel = newLoglevel;
2960}
2961return Controller;
2962};
2963this.enabled = function (newState) {
2964if (!arguments.length) { // get
2965return _enabled;
2966} else if (_enabled != newState) { // set
2967_enabled = !! newState;
2968Controller.updateScene(_sceneObjects, true);
2969}
2970return Controller;
2971};
2972this.destroy = function (resetScenes) {
2973window.clearTimeout(_refreshTimeout);
2974var i = _sceneObjects.length;
2975while (i--) {
2976_sceneObjects[i].destroy(resetScenes);
2977}
2978_options.container.removeEventListener("resize", onChange);
2979_options.container.removeEventListener("scroll", onChange);
2980_util.cAF(_updateTimeout);
2981log(3, "destroyed " + NAMESPACE + " (reset: " + (resetScenes ? "true" : "false") + ")");
2982return null;
2983};
2984construct();
2985return Controller;
2986};
2987var CONTROLLER_OPTIONS = {
2988defaults: {
2989container: window,
2990vertical: true,
2991globalSceneOptions: {},
2992loglevel: 2,
2993refreshInterval: 100
2994}
2995};
2996ScrollMagic.Controller.addOption = function (name, defaultValue) {
2997CONTROLLER_OPTIONS.defaults[name] = defaultValue;
2998};
2999ScrollMagic.Controller.extend = function (extension) {
3000var oldClass = this;
3001ScrollMagic.Controller = function () {
3002oldClass.apply(this, arguments);
3003this.$super = _util.extend({}, this); // copy parent state
3004return extension.apply(this, arguments) || this;
3005};
3006_util.extend(ScrollMagic.Controller, oldClass); // copy properties
3007ScrollMagic.Controller.prototype = oldClass.prototype; // copy prototype
3008ScrollMagic.Controller.prototype.constructor = ScrollMagic.Controller; // restore constructor
3009};
3010ScrollMagic.Scene = function (options) {
3011var
3012NAMESPACE = 'ScrollMagic.Scene',
3013SCENE_STATE_BEFORE = 'BEFORE',
3014SCENE_STATE_DURING = 'DURING',
3015SCENE_STATE_AFTER = 'AFTER',
3016DEFAULT_OPTIONS = SCENE_OPTIONS.defaults;
3017var
3018Scene = this,
3019_options = _util.extend({}, DEFAULT_OPTIONS, options),
3020_state = SCENE_STATE_BEFORE,
3021_progress = 0,
3022_scrollOffset = {
3023start: 0,
3024end: 0
3025},
3026_triggerPos = 0,
3027_enabled = true,
3028_durationUpdateMethod, _controller;
3029var construct = function () {
3030for (var key in _options) { // check supplied options
3031if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
3032log(2, "WARNING: Unknown option \"" + key + "\"");
3033delete _options[key];
3034}
3035}
3036for (var optionName in DEFAULT_OPTIONS) {
3037addSceneOption(optionName);
3038}
3039validateOption();
3040};
3041var _listeners = {};
3042this.on = function (names, callback) {
3043if (_util.type.Function(callback)) {
3044names = names.trim().split(' ');
3045names.forEach(function (fullname) {
3046var
3047nameparts = fullname.split('.'),
3048eventname = nameparts[0],
3049namespace = nameparts[1];
3050if (eventname != "*") { // disallow wildcards
3051if (!_listeners[eventname]) {
3052_listeners[eventname] = [];
3053}
3054_listeners[eventname].push({
3055namespace: namespace || '',
3056callback: callback
3057});
3058}
3059});
3060} else {
3061log(1, "ERROR when calling '.on()': Supplied callback for '" + names + "' is not a valid function!");
3062}
3063return Scene;
3064};
3065this.off = function (names, callback) {
3066if (!names) {
3067log(1, "ERROR: Invalid event name supplied.");
3068return Scene;
3069}
3070names = names.trim().split(' ');
3071names.forEach(function (fullname, key) {
3072var
3073nameparts = fullname.split('.'),
3074eventname = nameparts[0],
3075namespace = nameparts[1] || '',
3076removeList = eventname === '*' ? Object.keys(_listeners) : [eventname];
3077removeList.forEach(function (remove) {
3078var
3079list = _listeners[remove] || [],
3080i = list.length;
3081while (i--) {
3082var listener = list[i];
3083if (listener && (namespace === listener.namespace || namespace === '*') && (!callback || callback == listener.callback)) {
3084list.splice(i, 1);
3085}
3086}
3087if (!list.length) {
3088delete _listeners[remove];
3089}
3090});
3091});
3092return Scene;
3093};
3094this.trigger = function (name, vars) {
3095if (name) {
3096var
3097nameparts = name.trim().split('.'),
3098eventname = nameparts[0],
3099namespace = nameparts[1],
3100listeners = _listeners[eventname];
3101log(3, 'event fired:', eventname, vars ? "->" : '', vars || '');
3102if (listeners) {
3103listeners.forEach(function (listener, key) {
3104if (!namespace || namespace === listener.namespace) {
3105listener.callback.call(Scene, new ScrollMagic.Event(eventname, listener.namespace, Scene, vars));
3106}
3107});
3108}
3109} else {
3110log(1, "ERROR: Invalid event name supplied.");
3111}
3112return Scene;
3113};
3114Scene.on("change.internal", function (e) {
3115if (e.what !== "loglevel" && e.what !== "tweenChanges") { // no need for a scene update scene with these options...
3116if (e.what === "triggerElement") {
3117updateTriggerElementPosition();
3118} else if (e.what === "reverse") { // the only property left that may have an impact on the current scene state. Everything else is handled by the shift event.
3119Scene.update();
3120}
3121}
3122}).on("shift.internal", function (e) {
3123updateScrollOffset();
3124Scene.update(); // update scene to reflect new position
3125});
3126var log = this._log = function (loglevel, output) {
3127if (_options.loglevel >= loglevel) {
3128Array.prototype.splice.call(arguments, 1, 0, "(" + NAMESPACE + ") ->");
3129_util.log.apply(window, arguments);
3130}
3131};
3132this.addTo = function (controller) {
3133if (!(controller instanceof ScrollMagic.Controller)) {
3134log(1, "ERROR: supplied argument of 'addTo()' is not a valid ScrollMagic Controller");
3135} else if (_controller != controller) {
3136if (_controller) { // was associated to a different controller before, so remove it...
3137_controller.removeScene(Scene);
3138}
3139_controller = controller;
3140validateOption();
3141updateDuration(true);
3142updateTriggerElementPosition(true);
3143updateScrollOffset();
3144_controller.info("container").addEventListener('resize', onContainerResize);
3145controller.addScene(Scene);
3146Scene.trigger("add", {
3147controller: _controller
3148});
3149log(3, "added " + NAMESPACE + " to controller");
3150Scene.update();
3151}
3152return Scene;
3153};
3154this.enabled = function (newState) {
3155if (!arguments.length) { // get
3156return _enabled;
3157} else if (_enabled != newState) { // set
3158_enabled = !! newState;
3159Scene.update(true);
3160}
3161return Scene;
3162};
3163this.remove = function () {
3164if (_controller) {
3165_controller.info("container").removeEventListener('resize', onContainerResize);
3166var tmpParent = _controller;
3167_controller = undefined;
3168tmpParent.removeScene(Scene);
3169Scene.trigger("remove");
3170log(3, "removed " + NAMESPACE + " from controller");
3171}
3172return Scene;
3173};
3174this.destroy = function (reset) {
3175Scene.trigger("destroy", {
3176reset: reset
3177});
3178Scene.remove();
3179Scene.off("*.*");
3180log(3, "destroyed " + NAMESPACE + " (reset: " + (reset ? "true" : "false") + ")");
3181return null;
3182};
3183this.update = function (immediately) {
3184if (_controller) {
3185if (immediately) {
3186if (_controller.enabled() && _enabled) {
3187var
3188scrollPos = _controller.info("scrollPos"),
3189newProgress;
3190if (_options.duration > 0) {
3191newProgress = (scrollPos - _scrollOffset.start) / (_scrollOffset.end - _scrollOffset.start);
3192} else {
3193newProgress = scrollPos >= _scrollOffset.start ? 1 : 0;
3194}
3195Scene.trigger("update", {
3196startPos: _scrollOffset.start,
3197endPos: _scrollOffset.end,
3198scrollPos: scrollPos
3199});
3200Scene.progress(newProgress);
3201} else if (_pin && _state === SCENE_STATE_DURING) {
3202updatePinState(true); // unpin in position
3203}
3204} else {
3205_controller.updateScene(Scene, false);
3206}
3207}
3208return Scene;
3209};
3210this.refresh = function () {
3211updateDuration();
3212updateTriggerElementPosition();
3213return Scene;
3214};
3215this.progress = function (progress) {
3216if (!arguments.length) { // get
3217return _progress;
3218} else { // set
3219var
3220doUpdate = false,
3221oldState = _state,
3222scrollDirection = _controller ? _controller.info("scrollDirection") : 'PAUSED',
3223reverseOrForward = _options.reverse || progress >= _progress;
3224if (_options.duration === 0) {
3225doUpdate = _progress != progress;
3226_progress = progress < 1 && reverseOrForward ? 0 : 1;
3227_state = _progress === 0 ? SCENE_STATE_BEFORE : SCENE_STATE_DURING;
3228} else {
3229if (progress < 0 && _state !== SCENE_STATE_BEFORE && reverseOrForward) {
3230_progress = 0;
3231_state = SCENE_STATE_BEFORE;
3232doUpdate = true;
3233} else if (progress >= 0 && progress < 1 && reverseOrForward) {
3234_progress = progress;
3235_state = SCENE_STATE_DURING;
3236doUpdate = true;
3237} else if (progress >= 1 && _state !== SCENE_STATE_AFTER) {
3238_progress = 1;
3239_state = SCENE_STATE_AFTER;
3240doUpdate = true;
3241} else if (_state === SCENE_STATE_DURING && !reverseOrForward) {
3242updatePinState(); // in case we scrolled backwards mid-scene and reverse is disabled => update the pin position, so it doesn't move back as well.
3243}
3244}
3245if (doUpdate) {
3246var
3247eventVars = {
3248progress: _progress,
3249state: _state,
3250scrollDirection: scrollDirection
3251},
3252stateChanged = _state != oldState;
3253var trigger = function (eventName) { // tmp helper to simplify code
3254Scene.trigger(eventName, eventVars);
3255};
3256if (stateChanged) { // enter events
3257if (oldState !== SCENE_STATE_DURING) {
3258trigger("enter");
3259trigger(oldState === SCENE_STATE_BEFORE ? "start" : "end");
3260}
3261}
3262trigger("progress");
3263if (stateChanged) { // leave events
3264if (_state !== SCENE_STATE_DURING) {
3265trigger(_state === SCENE_STATE_BEFORE ? "start" : "end");
3266trigger("leave");
3267}
3268}
3269}
3270return Scene;
3271}
3272};
3273var updateScrollOffset = function () {
3274_scrollOffset = {
3275start: _triggerPos + _options.offset
3276};
3277if (_controller && _options.triggerElement) {
3278_scrollOffset.start -= _controller.info("size") * _options.triggerHook;
3279}
3280_scrollOffset.end = _scrollOffset.start + _options.duration;
3281};
3282var updateDuration = function (suppressEvents) {
3283if (_durationUpdateMethod) {
3284var varname = "duration";
3285if (changeOption(varname, _durationUpdateMethod.call(Scene)) && !suppressEvents) { // set
3286Scene.trigger("change", {
3287what: varname,
3288newval: _options[varname]
3289});
3290Scene.trigger("shift", {
3291reason: varname
3292});
3293}
3294}
3295};
3296var updateTriggerElementPosition = function (suppressEvents) {
3297var
3298elementPos = 0,
3299telem = _options.triggerElement;
3300if (_controller && telem) {
3301var
3302controllerInfo = _controller.info(),
3303containerOffset = _util.get.offset(controllerInfo.container),
3304param = controllerInfo.vertical ? "top" : "left"; // which param is of interest ?
3305while (telem.parentNode.hasAttribute(PIN_SPACER_ATTRIBUTE)) {
3306telem = telem.parentNode;
3307}
3308var elementOffset = _util.get.offset(telem);
3309if (!controllerInfo.isDocument) { // container is not the document root, so substract scroll Position to get correct trigger element position relative to scrollcontent
3310containerOffset[param] -= _controller.scrollPos();
3311}
3312elementPos = elementOffset[param] - containerOffset[param];
3313}
3314var changed = elementPos != _triggerPos;
3315_triggerPos = elementPos;
3316if (changed && !suppressEvents) {
3317Scene.trigger("shift", {
3318reason: "triggerElementPosition"
3319});
3320}
3321};
3322var onContainerResize = function (e) {
3323if (_options.triggerHook > 0) {
3324Scene.trigger("shift", {
3325reason: "containerResize"
3326});
3327}
3328};
3329var _validate = _util.extend(SCENE_OPTIONS.validate, {
3330duration: function (val) {
3331if (_util.type.String(val) && val.match(/^(\.|\d)*\d+%$/)) {
3332var perc = parseFloat(val) / 100;
3333val = function () {
3334return _controller ? _controller.info("size") * perc : 0;
3335};
3336}
3337if (_util.type.Function(val)) {
3338_durationUpdateMethod = val;
3339try {
3340val = parseFloat(_durationUpdateMethod());
3341} catch (e) {
3342val = -1; // will cause error below
3343}
3344}
3345val = parseFloat(val);
3346if (!_util.type.Number(val) || val < 0) {
3347if (_durationUpdateMethod) {
3348_durationUpdateMethod = undefined;
3349throw ["Invalid return value of supplied function for option \"duration\":", val];
3350} else {
3351throw ["Invalid value for option \"duration\":", val];
3352}
3353}
3354return val;
3355}
3356});
3357var validateOption = function (check) {
3358check = arguments.length ? [check] : Object.keys(_validate);
3359check.forEach(function (optionName, key) {
3360var value;
3361if (_validate[optionName]) { // there is a validation method for this option
3362try { // validate value
3363value = _validate[optionName](_options[optionName]);
3364} catch (e) { // validation failed -> reset to default
3365value = DEFAULT_OPTIONS[optionName];
3366var logMSG = _util.type.String(e) ? [e] : e;
3367if (_util.type.Array(logMSG)) {
3368logMSG[0] = "ERROR: " + logMSG[0];
3369logMSG.unshift(1); // loglevel 1 for error msg
3370log.apply(this, logMSG);
3371} else {
3372log(1, "ERROR: Problem executing validation callback for option '" + optionName + "':", e.message);
3373}
3374} finally {
3375_options[optionName] = value;
3376}
3377}
3378});
3379};
3380var changeOption = function (varname, newval) {
3381var
3382changed = false,
3383oldval = _options[varname];
3384if (_options[varname] != newval) {
3385_options[varname] = newval;
3386validateOption(varname); // resets to default if necessary
3387changed = oldval != _options[varname];
3388}
3389return changed;
3390};
3391var addSceneOption = function (optionName) {
3392if (!Scene[optionName]) {
3393Scene[optionName] = function (newVal) {
3394if (!arguments.length) { // get
3395return _options[optionName];
3396} else {
3397if (optionName === "duration") { // new duration is set, so any previously set function must be unset
3398_durationUpdateMethod = undefined;
3399}
3400if (changeOption(optionName, newVal)) { // set
3401Scene.trigger("change", {
3402what: optionName,
3403newval: _options[optionName]
3404});
3405if (SCENE_OPTIONS.shifts.indexOf(optionName) > -1) {
3406Scene.trigger("shift", {
3407reason: optionName
3408});
3409}
3410}
3411}
3412return Scene;
3413};
3414}
3415};
3416this.controller = function () {
3417return _controller;
3418};
3419this.state = function () {
3420return _state;
3421};
3422this.scrollOffset = function () {
3423return _scrollOffset.start;
3424};
3425this.triggerPosition = function () {
3426var pos = _options.offset; // the offset is the basis
3427if (_controller) {
3428if (_options.triggerElement) {
3429pos += _triggerPos;
3430} else {
3431pos += _controller.info("size") * Scene.triggerHook();
3432}
3433}
3434return pos;
3435};
3436var
3437_pin, _pinOptions;
3438Scene.on("shift.internal", function (e) {
3439var durationChanged = e.reason === "duration";
3440if ((_state === SCENE_STATE_AFTER && durationChanged) || (_state === SCENE_STATE_DURING && _options.duration === 0)) {
3441updatePinState();
3442}
3443if (durationChanged) {
3444updatePinDimensions();
3445}
3446}).on("progress.internal", function (e) {
3447updatePinState();
3448}).on("add.internal", function (e) {
3449updatePinDimensions();
3450}).on("destroy.internal", function (e) {
3451Scene.removePin(e.reset);
3452});
3453var updatePinState = function (forceUnpin) {
3454if (_pin && _controller) {
3455var
3456containerInfo = _controller.info(),
3457pinTarget = _pinOptions.spacer.firstChild; // may be pin element or another spacer, if cascading pins
3458if (!forceUnpin && _state === SCENE_STATE_DURING) { // during scene or if duration is 0 and we are past the trigger
3459if (_util.css(pinTarget, "position") != "fixed") {
3460_util.css(pinTarget, {
3461"position": "fixed"
3462});
3463updatePinDimensions();
3464}
3465var
3466fixedPos = _util.get.offset(_pinOptions.spacer, true),
3467scrollDistance = _options.reverse || _options.duration === 0 ? containerInfo.scrollPos - _scrollOffset.start // quicker
3468: Math.round(_progress * _options.duration * 10) / 10; // if no reverse and during pin the position needs to be recalculated using the progress
3469fixedPos[containerInfo.vertical ? "top" : "left"] += scrollDistance;
3470_util.css(_pinOptions.spacer.firstChild, {
3471top: fixedPos.top,
3472left: fixedPos.left
3473});
3474} else {
3475var
3476newCSS = {
3477position: _pinOptions.inFlow ? "relative" : "absolute",
3478top: 0,
3479left: 0
3480},
3481change = _util.css(pinTarget, "position") != newCSS.position;
3482if (!_pinOptions.pushFollowers) {
3483newCSS[containerInfo.vertical ? "top" : "left"] = _options.duration * _progress;
3484} else if (_options.duration > 0) { // only concerns scenes with duration
3485if (_state === SCENE_STATE_AFTER && parseFloat(_util.css(_pinOptions.spacer, "padding-top")) === 0) {
3486change = true; // if in after state but havent updated spacer yet (jumped past pin)
3487} else if (_state === SCENE_STATE_BEFORE && parseFloat(_util.css(_pinOptions.spacer, "padding-bottom")) === 0) { // before
3488change = true; // jumped past fixed state upward direction
3489}
3490}
3491_util.css(pinTarget, newCSS);
3492if (change) {
3493updatePinDimensions();
3494}
3495}
3496}
3497};
3498var updatePinDimensions = function () {
3499if (_pin && _controller && _pinOptions.inFlow) { // no spacerresize, if original position is absolute
3500var
3501after = (_state === SCENE_STATE_AFTER),
3502before = (_state === SCENE_STATE_BEFORE),
3503during = (_state === SCENE_STATE_DURING),
3504vertical = _controller.info("vertical"),
3505pinTarget = _pinOptions.spacer.firstChild,
3506marginCollapse = _util.isMarginCollapseType(_util.css(_pinOptions.spacer, "display")),
3507css = {};
3508if (_pinOptions.relSize.width || _pinOptions.relSize.autoFullWidth) {
3509if (during) {
3510_util.css(_pin, {
3511"width": _util.get.width(_pinOptions.spacer)
3512});
3513} else {
3514_util.css(_pin, {
3515"width": "100%"
3516});
3517}
3518} else {
3519css["min-width"] = _util.get.width(vertical ? _pin : pinTarget, true, true);
3520css.width = during ? css["min-width"] : "auto";
3521}
3522if (_pinOptions.relSize.height) {
3523if (during) {
3524_util.css(_pin, {
3525"height": _util.get.height(_pinOptions.spacer) - (_pinOptions.pushFollowers ? _options.duration : 0)
3526});
3527} else {
3528_util.css(_pin, {
3529"height": "100%"
3530});
3531}
3532} else {
3533css["min-height"] = _util.get.height(vertical ? pinTarget : _pin, true, !marginCollapse); // needed for cascading pins
3534css.height = during ? css["min-height"] : "auto";
3535}
3536if (_pinOptions.pushFollowers) {
3537css["padding" + (vertical ? "Top" : "Left")] = _options.duration * _progress;
3538css["padding" + (vertical ? "Bottom" : "Right")] = _options.duration * (1 - _progress);
3539}
3540_util.css(_pinOptions.spacer, css);
3541}
3542};
3543var updatePinInContainer = function () {
3544if (_controller && _pin && _state === SCENE_STATE_DURING && !_controller.info("isDocument")) {
3545updatePinState();
3546}
3547};
3548var updateRelativePinSpacer = function () {
3549if (_controller && _pin && // well, duh
3550_state === SCENE_STATE_DURING && // element in pinned state?
3551( // is width or height relatively sized, but not in relation to body? then we need to recalc.
3552((_pinOptions.relSize.width || _pinOptions.relSize.autoFullWidth) && _util.get.width(window) != _util.get.width(_pinOptions.spacer.parentNode)) || (_pinOptions.relSize.height && _util.get.height(window) != _util.get.height(_pinOptions.spacer.parentNode)))) {
3553updatePinDimensions();
3554}
3555};
3556var onMousewheelOverPin = function (e) {
3557if (_controller && _pin && _state === SCENE_STATE_DURING && !_controller.info("isDocument")) { // in pin 
3557state
3558e.preventDefault();
3559_controller._setScrollPos(_controller.info("scrollPos") - ((e.wheelDelta || e[_controller.info("vertical") ? "wheelDeltaY" : "wheelDeltaX"]) / 3 || -e.detail * 30));
3560}
3561};
3562this.setPin = function (element, settings) {
3563var
3564defaultSettings = {
3565pushFollowers: true,
3566spacerClass: "scrollmagic-pin-spacer"
3567};
3568settings = _util.extend({}, defaultSettings, settings);
3569element = _util.get.elements(element)[0];
3570if (!element) {
3571log(1, "ERROR calling method 'setPin()': Invalid pin element supplied.");
3572return Scene; // cancel
3573} else if (_util.css(element, "position") === "fixed") {
3574log(1, "ERROR calling method 'setPin()': Pin does not work with elements that are positioned 'fixed'.");
3575return Scene; // cancel
3576}
3577if (_pin) { // preexisting pin?
3578if (_pin === element) {
3579return Scene; // cancel
3580} else {
3581Scene.removePin();
3582}
3583}
3584_pin = element;
3585var
3586parentDisplay = _pin.parentNode.style.display,
3587boundsParams = ["top", "left", "bottom", "right", "margin", "marginLeft", "marginRight", "marginTop", "marginBottom"];
3588_pin.parentNode.style.display = 'none'; // hack start to force css to return stylesheet values instead of calculated px values.
3589var
3590inFlow = _util.css(_pin, "position") != "absolute",
3591pinCSS = _util.css(_pin, boundsParams.concat(["display"])),
3592sizeCSS = _util.css(_pin, ["width", "height"]);
3593_pin.parentNode.style.display = parentDisplay; // hack end.
3594if (!inFlow && settings.pushFollowers) {
3595log(2, "WARNING: If the pinned element is positioned absolutely pushFollowers will be disabled.");
3596settings.pushFollowers = false;
3597}
3598window.setTimeout(function () { // wait until all finished, because with responsive duration it will only be set after scene is added to controller
3599if (_pin && _options.duration === 0 && settings.pushFollowers) {
3600log(2, "WARNING: pushFollowers =", true, "has no effect, when scene duration is 0.");
3601}
3602}, 0);
3603var
3604spacer = _pin.parentNode.insertBefore(document.createElement('div'), _pin),
3605spacerCSS = _util.extend(pinCSS, {
3606position: inFlow ? "relative" : "absolute",
3607boxSizing: "content-box",
3608mozBoxSizing: "content-box",
3609webkitBoxSizing: "content-box"
3610});
3611if (!inFlow) { // copy size if positioned absolutely, to work for bottom/right positioned elements.
3612_util.extend(spacerCSS, _util.css(_pin, ["width", "height"]));
3613}
3614_util.css(spacer, spacerCSS);
3615spacer.setAttribute(PIN_SPACER_ATTRIBUTE, "");
3616_util.addClass(spacer, settings.spacerClass);
3617_pinOptions = {
3618spacer: spacer,
3619relSize: { // save if size is defined using % values. if so, handle spacer resize differently...
3620width: sizeCSS.width.slice(-1) === "%",
3621height: sizeCSS.height.slice(-1) === "%",
3622autoFullWidth: sizeCSS.width === "auto" && inFlow && _util.isMarginCollapseType(pinCSS.display)
3623},
3624pushFollowers: settings.pushFollowers,
3625inFlow: inFlow,
3626};
3627if (!_pin.___origStyle) {
3628_pin.___origStyle = {};
3629var
3630pinInlineCSS = _pin.style,
3631copyStyles = boundsParams.concat(["width", "height", "position", "boxSizing", "mozBoxSizing", "webkitBoxSizing"]);
3632copyStyles.forEach(function (val) {
3633_pin.___origStyle[val] = pinInlineCSS[val] || "";
3634});
3635}
3636if (_pinOptions.relSize.width) {
3637_util.css(spacer, {
3638width: sizeCSS.width
3639});
3640}
3641if (_pinOptions.relSize.height) {
3642_util.css(spacer, {
3643height: sizeCSS.height
3644});
3645}
3646spacer.appendChild(_pin);
3647_util.css(_pin, {
3648position: inFlow ? "relative" : "absolute",
3649margin: "auto",
3650top: "auto",
3651left: "auto",
3652bottom: "auto",
3653right: "auto"
3654});
3655if (_pinOptions.relSize.width || _pinOptions.relSize.autoFullWidth) {
3656_util.css(_pin, {
3657boxSizing: "border-box",
3658mozBoxSizing: "border-box",
3659webkitBoxSizing: "border-box"
3660});
3661}
3662window.addEventListener('scroll', updatePinInContainer);
3663window.addEventListener('resize', updatePinInContainer);
3664window.addEventListener('resize', updateRelativePinSpacer);
3665_pin.addEventListener("mousewheel", onMousewheelOverPin);
3666_pin.addEventListener("DOMMouseScroll", onMousewheelOverPin);
3667log(3, "added pin");
3668updatePinState();
3669return Scene;
3670};
3671this.removePin = function (reset) {
3672if (_pin) {
3673if (_state === SCENE_STATE_DURING) {
3674updatePinState(true); // force unpin at position
3675}
3676if (reset || !_controller) { // if there's no controller no progress was made anyway...
3677var pinTarget = _pinOptions.spacer.firstChild; // usually the pin element, but may be another spacer (cascaded pins)...
3678if (pinTarget.hasAttribute(PIN_SPACER_ATTRIBUTE)) { // copy margins to child spacer
3679var
3680style = _pinOptions.spacer.style,
3681values = ["margin", "marginLeft", "marginRight", "marginTop", "marginBottom"];
3682margins = {};
3683values.forEach(function (val) {
3684margins[val] = style[val] || "";
3685});
3686_util.css(pinTarget, margins);
3687}
3688_pinOptions.spacer.parentNode.insertBefore(pinTarget, _pinOptions.spacer);
3689_pinOptions.spacer.parentNode.removeChild(_pinOptions.spacer);
3690if (!_pin.parentNode.hasAttribute(PIN_SPACER_ATTRIBUTE)) { // if it's the last pin for this element -> restore inline styles
3691_util.css(_pin, _pin.___origStyle);
3692delete _pin.___origStyle;
3693}
3694}
3695window.removeEventListener('scroll', updatePinInContainer);
3696window.removeEventListener('resize', updatePinInContainer);
3697window.removeEventListener('resize', updateRelativePinSpacer);
3698_pin.removeEventListener("mousewheel", onMousewheelOverPin);
3699_pin.removeEventListener("DOMMouseScroll", onMousewheelOverPin);
3700_pin = undefined;
3701log(3, "removed pin (reset: " + (reset ? "true" : "false") + ")");
3702}
3703return Scene;
3704};
3705var
3706_cssClasses, _cssClassElems = [];
3707Scene.on("destroy.internal", function (e) {
3708Scene.removeClassToggle(e.reset);
3709});
3710this.setClassToggle = function (element, classes) {
3711var elems = _util.get.elements(element);
3712if (elems.length === 0 || !_util.type.String(classes)) {
3713log(1, "ERROR calling method 'setClassToggle()': Invalid " + (elems.length === 0 ? "element" : "classes") + " supplied.");
3714return Scene;
3715}
3716if (_cssClassElems.length > 0) {
3717Scene.removeClassToggle();
3718}
3719_cssClasses = classes;
3720_cssClassElems = elems;
3721Scene.on("enter.internal_class leave.internal_class", function (e) {
3722var toggle = e.type === "enter" ? _util.addClass : _util.removeClass;
3723_cssClassElems.forEach(function (elem, key) {
3724toggle(elem, _cssClasses);
3725});
3726});
3727return Scene;
3728};
3729this.removeClassToggle = function (reset) {
3730if (reset) {
3731_cssClassElems.forEach(function (elem, key) {
3732_util.removeClass(elem, _cssClasses);
3733});
3734}
3735Scene.off("start.internal_class end.internal_class");
3736_cssClasses = undefined;
3737_cssClassElems = [];
3738return Scene;
3739};
3740construct();
3741return Scene;
3742};
3743var SCENE_OPTIONS = {
3744defaults: {
3745duration: 0,
3746offset: 0,
3747triggerElement: undefined,
3748triggerHook: 0.5,
3749reverse: true,
3750loglevel: 2
3751},
3752validate: {
3753offset: function (val) {
3754val = parseFloat(val);
3755if (!_util.type.Number(val)) {
3756throw ["Invalid value for option \"offset\":", val];
3757}
3758return val;
3759},
3760triggerElement: function (val) {
3761val = val || undefined;
3762if (val) {
3763var elem = _util.get.elements(val)[0];
3764if (elem) {
3765val = elem;
3766} else {
3767throw ["Element defined in option \"triggerElement\" was not found:", val];
3768}
3769}
3770return val;
3771},
3772triggerHook: function (val) {
3773var translate = {
3774"onCenter": 0.5,
3775"onEnter": 1,
3776"onLeave": 0
3777};
3778if (_util.type.Number(val)) {
3779val = Math.max(0, Math.min(parseFloat(val), 1)); //  make sure its betweeen 0 and 1
3780} else if (val in translate) {
3781val = translate[val];
3782} else {
3783throw ["Invalid value for option \"triggerHook\": ", val];
3784}
3785return val;
3786},
3787reverse: function (val) {
3788return !!val; // force boolean
3789},
3790loglevel: function (val) {
3791val = parseInt(val);
3792if (!_util.type.Number(val) || val < 0 || val > 3) {
3793throw ["Invalid value for option \"loglevel\":", val];
3794}
3795return val;
3796}
3797},
3798shifts: ["duration", "offset", "triggerHook"],
3799};
3800ScrollMagic.Scene.addOption = function (name, defaultValue, validationCallback, shifts) {
3801if (!(name in SCENE_OPTIONS.defaults)) {
3802SCENE_OPTIONS.defaults[name] = defaultValue;
3803SCENE_OPTIONS.validate[name] = validationCallback;
3804if (shifts) {
3805SCENE_OPTIONS.shifts.push(name);
3806}
3807} else {
3808ScrollMagic._util.log(1, "[static] ScrollMagic.Scene -> Cannot add Scene option '" + name + "', because it already exists.");
3809}
3810};
3811ScrollMagic.Scene.extend = function (extension) {
3812var oldClass = this;
3813ScrollMagic.Scene = function () {
3814oldClass.apply(this, arguments);
3815this.$super = _util.extend({}, this); // copy parent state
3816return extension.apply(this, arguments) || this;
3817};
3818_util.extend(ScrollMagic.Scene, oldClass); // copy properties
3819ScrollMagic.Scene.prototype = oldClass.prototype; // copy prototype
3820ScrollMagic.Scene.prototype.constructor = ScrollMagic.Scene; // restore constructor
3821};
3822ScrollMagic.Event = function (type, namespace, target, vars) {
3823vars = vars || {};
3824for (var key in vars) {
3825this[key] = vars[key];
3826}
3827this.type = type;
3828this.target = this.currentTarget = target;
3829this.namespace = namespace || '';
3830this.timeStamp = this.timestamp = Date.now();
3831return this;
3832};
3833var _util = ScrollMagic._util = (function (window) {
3834var U = {},
3835i;
3836var floatval = function (number) {
3837return parseFloat(number) || 0;
3838};
3839var _getComputedStyle = function (elem) {
3840return elem.currentStyle ? elem.currentStyle : window.getComputedStyle(elem);
3841};
3842var _dimension = function (which, elem, outer, includeMargin) {
3843elem = (elem === document) ? window : elem;
3844if (elem === window) {
3845includeMargin = false;
3846} else if (!_type.DomElement(elem)) {
3847return 0;
3848}
3849which = which.charAt(0).toUpperCase() + which.substr(1).toLowerCase();
3850var dimension = (outer ? elem['offset' + which] || elem['outer' + which] : elem['client' + which] || elem['inner' + which]) || 0;
3851if (outer && includeMargin) {
3852var style = _getComputedStyle(elem);
3853dimension += which === 'Height' ? floatval(style.marginTop) + floatval(style.marginBottom) : floatval(style.marginLeft) + floatval(style.marginRight);
3854}
3855return dimension;
3856};
3857var _camelCase = function (str) {
3858return str.replace(/^[^a-z]+([a-z])/g, '$1').replace(/-([a-z])/g, function (g) {
3859return g[1].toUpperCase();
3860});
3861};
3862U.extend = function (obj) {
3863obj = obj || {};
3864for (i = 1; i < arguments.length; i++) {
3865if (!arguments[i]) {
3866continue;
3867}
3868for (var key in arguments[i]) {
3869if (arguments[i].hasOwnProperty(key)) {
3870obj[key] = arguments[i][key];
3871}
3872}
3873}
3874return obj;
3875};
3876U.isMarginCollapseType = function (str) {
3877return ["block", "flex", "list-item", "table", "-webkit-box"].indexOf(str) > -1;
3878};
3879var
3880lastTime = 0,
3881vendors = ['ms', 'moz', 'webkit', 'o'];
3882var _requestAnimationFrame = window.requestAnimationFrame;
3883var _cancelAnimationFrame = window.cancelAnimationFrame;
3884for (i = 0; !_requestAnimationFrame && i < vendors.length; ++i) {
3885_requestAnimationFrame = window[vendors[i] + 'RequestAnimationFrame'];
3886_cancelAnimationFrame = window[vendors[i] + 'CancelAnimationFrame'] || window[vendors[i] + 'CancelRequestAnimationFrame'];
3887}
3888if (!_requestAnimationFrame) {
3889_requestAnimationFrame = function (callback) {
3890var
3891currTime = new Date().getTime(),
3892timeToCall = Math.max(0, 16 - (currTime - lastTime)),
3893id = window.setTimeout(function () {
3894callback(currTime + timeToCall);
3895}, timeToCall);
3896lastTime = currTime + timeToCall;
3897return id;
3898};
3899}
3900if (!_cancelAnimationFrame) {
3901_cancelAnimationFrame = function (id) {
3902window.clearTimeout(id);
3903};
3904}
3905U.rAF = _requestAnimationFrame.bind(window);
3906U.cAF = _cancelAnimationFrame.bind(window);
3907var
3908loglevels = ["error", "warn", "log"],
3909console = window.console || {};
3910console.log = console.log ||
3911function () {}; // no console log, well - do nothing then...
3912for (i = 0; i < loglevels.length; i++) {
3913var method = loglevels[i];
3914if (!console[method]) {
3915console[method] = console.log; // prefer .log over nothing
3916}
3917}
3918U.log = function (loglevel) {
3919if (loglevel > loglevels.length || loglevel <= 0) loglevel = loglevels.length;
3920var now = new Date(),
3921time = ("0" + now.getHours()).slice(-2) + ":" + ("0" + now.getMinutes()).slice(-2) + ":" + ("0" + now.getSeconds()).slice(-2) + ":" + ("00" + now.getMilliseconds()).slice(-3),
3922method = loglevels[loglevel - 1],
3923args = Array.prototype.splice.call(arguments, 1),
3924func = Function.prototype.bind.call(console[method], console);
3925args.unshift(time);
3926func.apply(console, args);
3927};
3928var _type = U.type = function (v) {
3929return Object.prototype.toString.call(v).replace(/^\[object (.+)\]$/, "$1").toLowerCase();
3930};
3931_type.String = function (v) {
3932return _type(v) === 'string';
3933};
3934_type.Function = function (v) {
3935return _type(v) === 'function';
3936};
3937_type.Array = function (v) {
3938return Array.isArray(v);
3939};
3940_type.Number = function (v) {
3941return !_type.Array(v) && (v - parseFloat(v) + 1) >= 0;
3942};
3943_type.DomElement = function (o) {
3944return (
3945typeof HTMLElement === "object" ? o instanceof HTMLElement : //DOM2
3946o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string");
3947};
3948var _get = U.get = {};
3949_get.elements = function (selector) {
3950var arr = [];
3951if (_type.String(selector)) {
3952try {
3953selector = document.querySelectorAll(selector);
3954} catch (e) { // invalid selector
3955return arr;
3956}
3957}
3958if (_type(selector) === 'nodelist' || _type.Array(selector)) {
3959for (var i = 0, ref = arr.length = selector.length; i < ref; i++) { // list of elements
3960var elem = selector[i];
3961arr[i] = _type.DomElement(elem) ? elem : _get.elements(elem); // if not an element, try to resolve recursively
3962}
3963} else if (_type.DomElement(selector) || selector === document || selector === window) {
3964arr = [selector]; // only the element
3965}
3966return arr;
3967};
3968_get.scrollTop = function (elem) {
3969return (elem && typeof elem.scrollTop === 'number') ? elem.scrollTop : window.pageYOffset || 0;
3970};
3971_get.scrollLeft = function (elem) {
3972return (elem && typeof elem.scrollLeft === 'number') ? elem.scrollLeft : window.pageXOffset || 0;
3973};
3974_get.width = function (elem, outer, includeMargin) {
3975return _dimension('width', elem, outer, includeMargin);
3976};
3977_get.height = function (elem, outer, includeMargin) {
3978return _dimension('height', elem, outer, includeMargin);
3979};
3980_get.offset = function (elem, relativeToViewport) {
3981var offset = {
3982top: 0,
3983left: 0
3984};
3985if (elem && elem.getBoundingClientRect) { // check if available
3986var rect = elem.getBoundingClientRect();
3987offset.top = rect.top;
3988offset.left = rect.left;
3989if (!relativeToViewport) { // clientRect is by default relative to viewport...
3990offset.top += _get.scrollTop();
3991offset.left += _get.scrollLeft();
3992}
3993}
3994return offset;
3995};
3996U.addClass = function (elem, classname) {
3997if (classname) {
3998if (elem.classList) elem.classList.add(classname);
3999else elem.className += ' ' + classname;
4000}
4001};
4002U.removeClass = function (elem, classname) {
4003if (classname) {
4004if (elem.classList) elem.classList.remove(classname);
4005else elem.className = elem.className.replace(new RegExp('(^|\\b)' + classname.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
4006}
4007};
4008U.css = function (elem, options) {
4009if (_type.String(options)) {
4010return _getComputedStyle(elem)[_camelCase(options)];
4011} else if (_type.Array(options)) {
4012var
4013obj = {},
4014style = _getComputedStyle(elem);
4015options.forEach(function (option, key) {
4016obj[option] = style[_camelCase(option)];
4017});
4018return obj;
4019} else {
4020for (var option in options) {
4021var val = options[option];
4022if (val == parseFloat(val)) { // assume pixel for seemingly numerical values
4023val += 'px';
4024}
4025elem.style[_camelCase(option)] = val;
4026}
4027}
4028};
4029return U;
4030}(window || {}));
4031ScrollMagic.Scene.prototype.addIndicators = function () {
4032ScrollMagic._util.log(1, '(ScrollMagic.Scene) -> ERROR calling addIndicators() due to missing Plugin \'debug.addIndicators\'. Please make sure to include plugins/debug.addIndicators.js');
4033return this;
4034}
4035ScrollMagic.Scene.prototype.removeIndicators = function () {
4036ScrollMagic._util.log(1, '(ScrollMagic.Scene) -> ERROR calling removeIndicators() due to missing Plugin \'debug.addIndicators\'. Please make sure to include plugins/debug.addIndicators.js');
4037return this;
4038}
4039ScrollMagic.Scene.prototype.setTween = function () {
4040ScrollMagic._util.log(1, '(ScrollMagic.Scene) -> ERROR calling setTween() due to missing Plugin \'animation.gsap\'. Please make sure to include plugins/animation.gsap.js');
4041return this;
4042}
4043ScrollMagic.Scene.prototype.removeTween = function () {
4044ScrollMagic._util.log(1, '(ScrollMagic.Scene) -> ERROR calling removeTween() due to missing Plugin \'animation.gsap\'. Please make sure to include plugins/animation.gsap.js');
4045return this;
4046}
4047ScrollMagic.Scene.prototype.setVelocity = function () {
4048ScrollMagic._util.log(1, '(ScrollMagic.Scene) -> ERROR calling setVelocity() due to missing Plugin \'animation.velocity\'. Please make sure to include plugins/animation.velocity.js');
4049return this;
4050}
4051ScrollMagic.Scene.prototype.removeVelocity = function () {
4052ScrollMagic._util.log(1, '(ScrollMagic.Scene) -> ERROR calling removeVelocity() due to missing Plugin \'animation.velocity\'. Please make sure to include plugins/animation.velocity.js');
4053return this;
4054}
4055return ScrollMagic;
4056}));
4057;(function ($) {
4058function slideMenu(element, parameters){
4059var slidemenu = this;
4060slidemenu.parameters = parameters;
4061slidemenu.element = $(element);
4062slidemenu.offsetTop = slidemenu.element.position().top;
4063slidemenu.panels = slidemenu.element.find('[data-sl-panel]');
4064slidemenu.init();
4065}
4066slideMenu.prototype = {
4067init: function(){
4068slidemenu = this;
4069slidemenu.element.wrap('<div class="sl-wrapper"></div>');
4070slidemenu.panels.each(function(){
4071$(this).css('top','0px');
4072})
4073if (slidemenu.parameters.sidyCompatible) {
4074$('.sidy__panel').css('overflow', 'hidden');
4075};
4076slidemenu.element.find('a[data-sl-target]').on('click', function(e){
4077var id = $(this).attr('data-sl-target');
4078if ($('[data-sl-panel="'+id+'"]').length) {
4079e.preventDefault();
4080slidemenu.openPanel(e, id, 'no options');
4081}
4082})
4083slidemenu.element.find('[data-sl-close]').on('click', function(e){
4084var id = $(this).attr('data-sl-close');
4085if ($('[data-sl-panel="'+id+'"]').length) {
4086e.preventDefault();
4087slidemenu.closePanel(e, id, 'no options');
4088}else{
4089console.log('slideMenu error: no panel with id'+ id+' (closing)');
4090}
4091});
4092},
4093openPanel: function(event, panelId, options){
4094slidemenu = this;
4095event.stopPropagation();
4096event.preventDefault();
4097var $panel = $('[data-sl-panel="'+panelId+'"]');
4098$panel.addClass('opened');
4099},
4100closePanel: function(event, panelId, options){
4101slidemenu = this;
4102event.stopPropagation();
4103event.preventDefault();
4104var $panel = $('[data-sl-panel="'+panelId+'"]');
4105$panel.removeClass('opened');
4106}
4107}
4108$.fn.slideMenu=function(options){
4109var defaults = {
4110sidyCompatible: true
4111};
4112var parameters = $.extend(defaults, options);
4113return this.each(function(){
4114var el = this;
4115this.offsetTop = $(this).offset().top;
4116if ( !$.data( this, "plugin_slideMenu" ) ) {
4117$.data( this, "plugin_slideMenu", new slideMenu(this, parameters));
4118}
4119})
4120};
4121})(jQuery);
4122function manageNavigationDisplay(e, $prev, $next){ // Ne fonctionne pas avec loop: true
4123if(e.item.index == 0){
4124$prev.addClass('disabled');
4125}else{
4126$prev.removeClass('disabled');
4127}
4128if(e.item.index == (e.item.count - 1)){
4129$next.addClass('disabled');
4130}else{
4131$next.removeClass('disabled');
4132}
4133}
4134function updatePagination(e, $prev, $next){
4135var prev_index, next_index, total_count;
4136if(e.item.index == 0){
4137prev_index = e.item.count - 1;
4138}else{
4139prev_index = e.item.index;
4140}
4141if(e.item.index == (e.item.count - 1)){
4142next_index = 1;
4143}else{
4144next_index = e.item.index + 2;
4145}
4146total_count = e.item.count;
4147$prev.find('.owl-current-page').html(prev_index);
4148$next.find('.owl-current-page').html(next_index);
4149$prev.find('.owl-total-page').html(total_count);
4150$next.find('.owl-total-page').html(total_count);
4151}
4152function updateSliderText($slider, $title, $description, $link, index){
4153var $currentSlide = $slider.find('.owl-item:eq('+index+') li');
4154$title.text($currentSlide.attr('data-title'));
4155$description.text($currentSlide.attr('data-description'));
4156$link.attr('href', $currentSlide.attr('data-link'));
4157}
4158function attachCustomNavEvents($slider, $prev, $next){
4159$prev.add($next).off('click');
4160$prev.on('click', function(){
4161$slider.trigger('stop.owl.autoplay');
4162$slider.trigger('prev.owl.carousel');
4163});
4164$next.on('click', function(){
4165$slider.trigger('stop.owl.autoplay');
4166$slider.trigger('next.owl.carousel');
4167});
4168}
4169function attachCustomPlayEvents($slider, $play){
4170$play.on('click', function(){
4171if($play.hasClass('pause')){
4172$slider.trigger('stop.owl.autoplay');
4173$play.removeClass('pause').addClass('play');
4174}else{
4175$slider.trigger('play.owl.autoplay');
4176$play.removeClass('play').addClass('pause');
4177}
4178});
4179}
4180function fixRestartAutoplayAfterNavigationClick($slider, $prev, $next, $dots, $play){
4181$next.add($prev).add($dots.find('.owl-dot')).on('click', function() {
4182setTimeout(function() {
4183$slider.trigger('play.owl.autoplay', [1000]);
4184$slider.trigger('stop.owl.autoplay');
4185$play.removeClass('pause');
4186}, 500);
4187});
4188}
4189(function ($) {
4190var parentToFit = '#banner',
4191video = '#banner-video';
4192$.fn.videoCover = function(video, parentToFit){
4193function applyVideoRatio(video, parentToFit){
4194var parentWidth, parentHeight, ratio, widthToApply, ratioedHeight;
4195parentWidth = $(parentToFit).width();
4196parentHeight = $(parentToFit).height();
4197ratio = $(video)[0].videoWidth / $(video)[0].videoHeight;
4198widthToApply = parentWidth;
4199ratioedHeight = widthToApply / ratio;
4200if(ratioedHeight < parentHeight){
4201var heightToApply = parentHeight;
4202widthToApply = parentHeight * ratio;
4203if(widthToApply < parentWidth){
4204console.log('Unkwown error, check the math');
4205}
4206}
4207$(video).width(widthToApply);
4208}
4209$(video)[0].addEventListener('loadeddata', function() {
4210applyVideoRatio(video, parentToFit);
4211}, false);
4212$(window).resize(function(){
4213applyVideoRatio(video, parentToFit);
4214});
4215}
4216}(jQuery));
4217;(function (factory) {
4218if (typeof define === 'function' && define.amd) {
4219define(['jquery'], factory);
4220} else if (typeof exports === 'object') {
4221module.exports = factory(require('jquery'));
4222} else {
4223factory(jQuery);
4224}
4225}(function ($) {
4226var eventNamespace = 'waitForImages';
4227$.waitForImages = {
4228hasImageProperties: [
4229'backgroundImage',
4230'listStyleImage',
4231'borderImage',
4232'borderCornerImage',
4233'cursor'
4234],
4235hasImageAttributes: ['srcset']
4236};
4237$.expr[':']['has-src'] = function (obj) {
4238return $(obj).is('img[src][src!=""]');
4239};
4240$.expr[':'].uncached = function (obj) {
4241if (!$(obj).is(':has-src')) {
4242return false;
4243}
4244return !obj.complete;
4245};
4246$.fn.waitForImages = function () {
4247var allImgsLength = 0;
4248var allImgsLoaded = 0;
4249var deferred = $.Deferred();
4250var finishedCallback;
4251var eachCallback;
4252var waitForAll;
4253if ($.isPlainObject(arguments[0])) {
4254waitForAll = arguments[0].waitForAll;
4255eachCallback = arguments[0].each;
4256finishedCallback = arguments[0].finished;
4257} else {
4258if (arguments.length === 1 && $.type(arguments[0]) === 'boolean') {
4259waitForAll = arguments[0];
4260} else {
4261finishedCallback = arguments[0];
4262eachCallback = arguments[1];
4263waitForAll = arguments[2];
4264}
4265}
4266finishedCallback = finishedCallback || $.noop;
4267eachCallback = eachCallback || $.noop;
4268waitForAll = !! waitForAll;
4269if (!$.isFunction(finishedCallback) || !$.isFunction(eachCallback)) {
4270throw new TypeError('An invalid callback was supplied.');
4271}
4272this.each(function () {
4273var obj = $(this);
4274var allImgs = [];
4275var hasImgProperties = $.waitForImages.hasImageProperties || [];
4276var hasImageAttributes = $.waitForImages.hasImageAttributes || [];
4277var matchUrl = /url\(\s*(['"]?)(.*?)\1\s*\)/g;
4278if (waitForAll) {
4279obj.find('*').addBack().each(function () {
4280var element = $(this);
4281if (element.is('img:has-src') &&
4282!element.is('[srcset]')) {
4283allImgs.push({
4284src: element.attr('src'),
4285element: element[0]
4286});
4287}
4288$.each(hasImgProperties, function (i, property) {
4289var propertyValue = element.css(property);
4290var match;
4291if (!propertyValue) {
4292return true;
4293}
4294while (match = matchUrl.exec(propertyValue)) {
4295allImgs.push({
4296src: match[2],
4297element: element[0]
4298});
4299}
4300});
4301$.each(hasImageAttributes, function (i, attribute) {
4302var attributeValue = element.attr(attribute);
4303var attributeValues;
4304if (!attributeValue) {
4305return true;
4306}
4307allImgs.push({
4308src: element.attr('src'),
4309srcset: element.attr('srcset'),
4310element: element[0]
4311});
4312});
4313});
4314} else {
4315obj.find('img:has-src')
4316.each(function () {
4317allImgs.push({
4318src: this.src,
4319element: this
4320});
4321});
4322}
4323allImgsLength = allImgs.length;
4324allImgsLoaded = 0;
4325if (allImgsLength === 0) {
4326finishedCallback.call(obj[0]);
4327deferred.resolveWith(obj[0]);
4328}
4329$.each(allImgs, function (i, img) {
4330var image = new Image();
4331var events =
4332'load.' + eventNamespace + ' error.' + eventNamespace;
4333$(image).one(events, function me (event) {
4334var eachArguments = [
4335allImgsLoaded,
4336allImgsLength,
4337event.type == 'load'
4338];
4339allImgsLoaded++;
4340eachCallback.apply(img.element, eachArguments);
4341deferred.notifyWith(img.element, eachArguments);
4342$(this).off(events, me);
4343if (allImgsLoaded == allImgsLength) {
4344finishedCallback.call(obj[0]);
4345deferred.resolveWith(obj[0]);
4346return false;
4347}
4348});
4349if (img.srcset) {
4350image.srcset = img.srcset;
4351}
4352image.src = img.src;
4353});
4354});
4355return deferred.promise();
4356};
4357}));
4358;(function($, window, document, undefined) {
4359var Animate = function(scope) {
4360this.core = scope;
4361this.core.options = $.extend({}, Animate.Defaults, this.core.options);
4362this.swapping = true;
4363this.previous = undefined;
4364this.next = undefined;
4365this.handlers = {
4366'change.owl.carousel': $.proxy(function(e) {
4367if (e.namespace && e.property.name == 'position') {
4368this.previous = this.core.current();
4369this.next = e.property.value;
4370}
4371}, this),
4372'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
4373if (e.namespace) {
4374this.swapping = e.type == 'translated';
4375}
4376}, this),
4377'translate.owl.carousel': $.proxy(function(e) {
4378if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
4379this.swap();
4380}
4381}, this)
4382};
4383this.core.$element.on(this.handlers);
4384};
4385Animate.Defaults = {
4386animateOut: false,
4387animateIn: false
4388};
4389Animate.prototype.swap = function() {
4390$.support.animation = (function() {
4391var animationEnd = (function() {
4392var element = document.body || document.documentElement,
4393animEndEventNames = {
4394WebkitAnimation : 'webkitAnimationEnd',
4395MozAnimation    : 'animationend',
4396OAnimation      : 'oAnimationEnd oanimationend',
4397animation       : 'animationend'
4398}, name;
4399for (name in animEndEventNames) {
4400if (element.style[name] !== undefined) return animEndEventNames[name];
4401}
4402}());
4403return animationEnd ? { end: animationEnd } : false;
4404})();
4405if (this.core.settings.items !== 1) {
4406return;
4407}
vendor: 13,596 bytes, lines 4408-4860
4408if (!$.support.animation || !$.support.transition) {
4409return;
4410}
4411this.core.speed(0);
4412var left,
4413clear = $.proxy(this.clear, this),
4414previous = this.core.$stage.children().eq(this.previous),
4415next = this.core.$stage.children().eq(this.next),
4416incoming = this.core.settings.animateIn,
4417outgoing = this.core.settings.animateOut;
4418if (this.core.current() === this.previous) {
4419return;
4420}
4421if (outgoing) {
4422left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
4423previous.one($.support.animation.end, clear)
4424.css( { 'left': left + 'px' } )
4425.addClass('animated owl-animated-out')
4426.addClass(outgoing);
4427}
4428if (incoming) {
4429next.one($.support.animation.end, clear)
4430.addClass('animated owl-animated-in')
4431.addClass(incoming);
4432}
4433};
4434Animate.prototype.clear = function(e) {
4435$(e.target).css( { 'left': '' } )
4436.removeClass('animated owl-animated-out owl-animated-in')
4437.removeClass(this.core.settings.animateIn)
4438.removeClass(this.core.settings.animateOut);
4439this.core.onTransitionEnd();
4440};
4441Animate.prototype.destroy = function() {
4442var handler, property;
4443for (handler in this.handlers) {
4444this.core.$element.off(handler, this.handlers[handler]);
4445}
4446for (property in Object.getOwnPropertyNames(this)) {
4447typeof this[property] != 'function' && (this[property] = null);
4448}
4449};
4450$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
4451})(window.Zepto || window.jQuery, window, document);
4452;(function($, window, document, undefined) {
4453var AutoHeight = function(carousel) {
4454this._core = carousel;
4455this._handlers = {
4456'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) {
4457if (e.namespace && this._core.settings.autoHeight) {
4458this.update();
4459}
4460}, this),
4461'changed.owl.carousel': $.proxy(function(e) {
4462if (e.namespace && this._core.settings.autoHeight && e.property.name == 'position'){
4463this.update();
4464}
4465}, this),
4466'loaded.owl.lazy': $.proxy(function(e) {
4467if (e.namespace && this._core.settings.autoHeight
4468&& e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) {
4469this.update();
4470}
4471}, this)
4472};
4473this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
4474this._core.$element.on(this._handlers);
4475};
4476AutoHeight.Defaults = {
4477autoHeight: false,
4478autoHeightClass: 'owl-height'
4479};
4480AutoHeight.prototype.update = function() {
4481var start = this._core._current,
4482end = start + this._core.settings.items,
4483visible = this._core.$stage.children().toArray().slice(start, end),
4484heights = [],
4485maxheight = 0;
4486$.each(visible, function(index, item) {
4487heights.push($(item).height());
4488});
4489maxheight = Math.max.apply(null, heights);
4490this._core.$stage.parent()
4491.height(maxheight)
4492.addClass(this._core.settings.autoHeightClass);
4493};
4494AutoHeight.prototype.destroy = function() {
4495var handler, property;
4496for (handler in this._handlers) {
4497this._core.$element.off(handler, this._handlers[handler]);
4498}
4499for (property in Object.getOwnPropertyNames(this)) {
4500typeof this[property] != 'function' && (this[property] = null);
4501}
4502};
4503$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
4504})(window.Zepto || window.jQuery, window, document);
4505;(function($, window, document, undefined) {
4506var Autoplay = function(carousel) {
4507this._core = carousel;
4508this._timeout = null;
4509this._paused = false;
4510this._handlers = {
4511'changed.owl.carousel': $.proxy(function(e) {
4512if (e.namespace && e.property.name === 'settings') {
4513if (this._core.settings.autoplay) {
4514this.play();
4515} else {
4516this.stop();
4517}
4518} else if (e.namespace && e.property.name === 'position') {
4519if (this._core.settings.autoplay) {
4520this._setAutoPlayInterval();
4521}
4522}
4523}, this),
4524'initialized.owl.carousel': $.proxy(function(e) {
4525if (e.namespace && this._core.settings.autoplay) {
4526this.play();
4527}
4528}, this),
4529'play.owl.autoplay': $.proxy(function(e, t, s) {
4530if (e.namespace) {
4531this.play(t, s);
4532}
4533}, this),
4534'stop.owl.autoplay': $.proxy(function(e) {
4535if (e.namespace) {
4536this.stop();
4537}
4538}, this),
4539'mouseover.owl.autoplay': $.proxy(function() {
4540if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
4541this.pause();
4542}
4543}, this),
4544'mouseleave.owl.autoplay': $.proxy(function() {
4545if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
4546this.play();
4547}
4548}, this),
4549'touchstart.owl.core': $.proxy(function() {
4550if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
4551this.pause();
4552}
4553}, this),
4554'touchend.owl.core': $.proxy(function() {
4555if (this._core.settings.autoplayHoverPause) {
4556this.play();
4557}
4558}, this)
4559};
4560this._core.$element.on(this._handlers);
4561this._core.options = $.extend({}, Autoplay.Defaults, this._core.options);
4562};
4563Autoplay.Defaults = {
4564autoplay: false,
4565autoplayTimeout: 5000,
4566autoplayHoverPause: false,
4567autoplaySpeed: false
4568};
4569Autoplay.prototype.play = function(timeout, speed) {
4570this._paused = false;
4571if (this._core.is('rotating')) {
4572return;
4573}
4574this._core.enter('rotating');
4575this._setAutoPlayInterval();
4576};
4577Autoplay.prototype._getNextTimeout = function(timeout, speed) {
4578if ( this._timeout ) {
4579window.clearTimeout(this._timeout);
4580}
4581return window.setTimeout($.proxy(function() {
4582if (this._paused || this._core.is('busy') || this._core.is('interacting') || document.hidden) {
4583return;
4584}
4585this._core.next(speed || this._core.settings.autoplaySpeed);
4586}, this), timeout || this._core.settings.autoplayTimeout);
4587};
4588Autoplay.prototype._setAutoPlayInterval = function() {
4589this._timeout = this._getNextTimeout();
4590};
4591Autoplay.prototype.stop = function() {
4592if (!this._core.is('rotating')) {
4593return;
4594}
4595window.clearTimeout(this._timeout);
4596this._core.leave('rotating');
4597};
4598Autoplay.prototype.pause = function() {
4599if (!this._core.is('rotating')) {
4600return;
4601}
4602this._paused = true;
4603};
4604Autoplay.prototype.destroy = function() {
4605var handler, property;
4606this.stop();
4607for (handler in this._handlers) {
4608this._core.$element.off(handler, this._handlers[handler]);
4609}
4610for (property in Object.getOwnPropertyNames(this)) {
4611typeof this[property] != 'function' && (this[property] = null);
4612}
4613};
4614$.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
4615})(window.Zepto || window.jQuery, window, document);
4616;(function($, window, document, undefined) {
4617var AutoRefresh = function(carousel) {
4618this._core = carousel;
4619this._interval = null;
4620this._visible = null;
4621this._handlers = {
4622'initialized.owl.carousel': $.proxy(function(e) {
4623if (e.namespace && this._core.settings.autoRefresh) {
4624this.watch();
4625}
4626}, this)
4627};
4628this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options);
4629this._core.$element.on(this._handlers);
4630};
4631AutoRefresh.Defaults = {
4632autoRefresh: true,
4633autoRefreshInterval: 500
4634};
4635AutoRefresh.prototype.watch = function() {
4636if (this._interval) {
4637return;
4638}
4639this._visible = this._core.$element.is(':visible');
4640this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval);
4641};
4642AutoRefresh.prototype.refresh = function() {
4643if (this._core.$element.is(':visible') === this._visible) {
4644return;
4645}
4646this._visible = !this._visible;
4647this._core.$element.toggleClass('owl-hidden', !this._visible);
4648this._visible && (this._core.invalidate('width') && this._core.refresh());
4649};
4650AutoRefresh.prototype.destroy = function() {
4651var handler, property;
4652window.clearInterval(this._interval);
4653for (handler in this._handlers) {
4654this._core.$element.off(handler, this._handlers[handler]);
4655}
4656for (property in Object.getOwnPropertyNames(this)) {
4657typeof this[property] != 'function' && (this[property] = null);
4658}
4659};
4660$.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh;
4661})(window.Zepto || window.jQuery, window, document);
4662;(function($, window, document, undefined) {
4663'use strict';
4664var Hash = function(carousel) {
4665this._core = carousel;
4666this._hashes = {};
4667this.$element = this._core.$element;
4668this._handlers = {
4669'initialized.owl.carousel': $.proxy(function(e) {
4670if (e.namespace && this._core.settings.startPosition === 'URLHash') {
4671$(window).trigger('hashchange.owl.navigation');
4672}
4673}, this),
4674'prepared.owl.carousel': $.proxy(function(e) {
4675if (e.namespace) {
4676var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash');
4677if (!hash) {
4678return;
4679}
4680this._hashes[hash] = e.content;
4681}
4682}, this),
4683'changed.owl.carousel': $.proxy(function(e) {
4684if (e.namespace && e.property.name === 'position') {
4685var current = this._core.items(this._core.relative(this._core.current())),
4686hash = $.map(this._hashes, function(item, hash) {
4687return item === current ? hash : null;
4688}).join();
4689if (!hash || window.location.hash.slice(1) === hash) {
4690return;
4691}
4692window.location.hash = hash;
4693}
4694}, this)
4695};
4696this._core.options = $.extend({}, Hash.Defaults, this._core.options);
4697this.$element.on(this._handlers);
4698$(window).on('hashchange.owl.navigation', $.proxy(function(e) {
4699var hash = window.location.hash.substring(1),
4700items = this._core.$stage.children(),
4701position = this._hashes[hash] && items.index(this._hashes[hash]);
4702if (position === undefined || position === this._core.current()) {
4703return;
4704}
4705this._core.to(this._core.relative(position), false, true);
4706}, this));
4707};
4708Hash.Defaults = {
4709URLhashListener: false
4710};
4711Hash.prototype.destroy = function() {
4712var handler, property;
4713$(window).off('hashchange.owl.navigation');
4714for (handler in this._handlers) {
4715this._core.$element.off(handler, this._handlers[handler]);
4716}
4717for (property in Object.getOwnPropertyNames(this)) {
4718typeof this[property] != 'function' && (this[property] = null);
4719}
4720};
4721$.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
4722})(window.Zepto || window.jQuery, window, document);
4723;(function($, window, document, undefined) {
4724'use strict';
4725var Navigation = function(carousel) {
4726this._core = carousel;
4727this._initialized = false;
4728this._pages = [];
4729this._controls = {};
4730this._templates = [];
4731this.$element = this._core.$element;
4732this._overrides = {
4733next: this._core.next,
4734prev: this._core.prev,
4735to: this._core.to
4736};
4737this._handlers = {
4738'prepared.owl.carousel': $.proxy(function(e) {
4739if (e.namespace && this._core.settings.dotsData) {
4740this._templates.push('<div class="' + this._core.settings.dotClass + '">' +
4741$(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>');
4742}
4743}, this),
4744'added.owl.carousel': $.proxy(function(e) {
4745if (e.namespace && this._core.settings.dotsData) {
4746this._templates.splice(e.position, 0, this._templates.pop());
4747}
4748}, this),
4749'remove.owl.carousel': $.proxy(function(e) {
4750if (e.namespace && this._core.settings.dotsData) {
4751this._templates.splice(e.position, 1);
4752}
4753}, this),
4754'changed.owl.carousel': $.proxy(function(e) {
4755if (e.namespace && e.property.name == 'position') {
4756this.draw();
4757}
4758}, this),
4759'initialized.owl.carousel': $.proxy(function(e) {
4760if (e.namespace && !this._initialized) {
4761this._core.trigger('initialize', null, 'navigation');
4762this.initialize();
4763this.update();
4764this.draw();
4765this._initialized = true;
4766this._core.trigger('initialized', null, 'navigation');
4767}
4768}, this),
4769'refreshed.owl.carousel': $.proxy(function(e) {
4770if (e.namespace && this._initialized) {
4771this._core.trigger('refresh', null, 'navigation');
4772this.update();
4773this.draw();
4774this._core.trigger('refreshed', null, 'navigation');
4775}
4776}, this)
4777};
4778this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
4779this.$element.on(this._handlers);
4780};
4781Navigation.Defaults = {
4782nav: false,
4783navText: [ 'prev', 'next' ],
4784navSpeed: false,
4785navElement: 'div',
4786navContainer: false,
4787navContainerClass: 'owl-nav',
4788navClass: [ 'owl-prev', 'owl-next' ],
4789slideBy: 1,
4790dotClass: 'owl-dot',
4791dotsClass: 'owl-dots',
4792dots: true,
4793dotsEach: false,
4794dotsData: false,
4795dotsSpeed: false,
4796dotsContainer: false
4797};
4798Navigation.prototype.initialize = function() {
4799var override,
4800settings = this._core.settings;
4801this._controls.$relative = (settings.navContainer ? $(settings.navContainer)
4802: $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled');
4803this._controls.$previous = $('<' + settings.navElement + '>')
4804.addClass(settings.navClass[0])
4805.html(settings.navText[0])
4806.prependTo(this._controls.$relative)
4807.on('click', $.proxy(function(e) {
4808this.prev(settings.navSpeed);
4809}, this));
4810this._controls.$next = $('<' + settings.navElement + '>')
4811.addClass(settings.navClass[1])
4812.html(settings.navText[1])
4813.appendTo(this._controls.$relative)
4814.on('click', $.proxy(function(e) {
4815this.next(settings.navSpeed);
4816}, this));
4817if (!settings.dotsData) {
4818this._templates = [ $('<div>')
4819.addClass(settings.dotClass)
4820.append($('<span>'))
4821.prop('outerHTML') ];
4822}
4823this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer)
4824: $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled');
4825this._controls.$absolute.on('click', 'div', $.proxy(function(e) {
4826var index = $(e.target).parent().is(this._controls.$absolute)
4827? $(e.target).index() : $(e.target).parent().index();
4828e.preventDefault();
4829this.to(index, settings.dotsSpeed);
4830}, this));
4831for (override in this._overrides) {
4832this._core[override] = $.proxy(this[override], this);
4833}
4834};
4835Navigation.prototype.destroy = function() {
4836var handler, control, property, override;
4837for (handler in this._handlers) {
4838this.$element.off(handler, this._handlers[handler]);
4839}
4840for (control in this._controls) {
4841this._controls[control].remove();
4842}
4843for (override in this.overides) {
4844this._core[override] = this._overrides[override];
4845}
4846for (property in Object.getOwnPropertyNames(this)) {
4847typeof this[property] != 'function' && (this[property] = null);
4848}
4849};
4850Navigation.prototype.update = function() {
4851var i, j, k,
4852lower = this._core.clones().length / 2,
4853upper = lower + this._core.items().length,
4854maximum = this._core.maximum(true),
4855settings = this._core.settings,
4856size = settings.center || settings.autoWidth || settings.dotsData
4857? 1 : settings.dotsEach || settings.items;
4858if (settings.slideBy !== 'page') {
4859settings.slideBy = Math.min(settings.slideBy, settings.items);
4860}
vendor: 6,118 bytes, lines 4861-5046
4861if (settings.dots || settings.slideBy == 'page') {
4862this._pages = [];
4863for (i = lower, j = 0, k = 0; i < upper; i++) {
4864if (j >= size || j === 0) {
4865this._pages.push({
4866start: Math.min(maximum, i - lower),
4867end: i - lower + size - 1
4868});
4869if (Math.min(maximum, i - lower) === maximum) {
4870break;
4871}
4872j = 0, ++k;
4873}
4874j += this._core.mergers(this._core.relative(i));
4875}
4876}
4877};
4878Navigation.prototype.draw = function() {
4879var difference,
4880settings = this._core.settings,
4881disabled = this._core.items().length <= settings.items,
4882index = this._core.relative(this._core.current()),
4883loop = settings.loop || settings.rewind;
4884this._controls.$relative.toggleClass('disabled', !settings.nav || disabled);
4885if (settings.nav) {
4886this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true));
4887this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true));
4888}
4889this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled);
4890if (settings.dots) {
4891difference = this._pages.length - this._controls.$absolute.children().length;
4892if (settings.dotsData && difference !== 0) {
4893this._controls.$absolute.html(this._templates.join(''));
4894} else if (difference > 0) {
4895this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0]));
4896} else if (difference < 0) {
4897this._controls.$absolute.children().slice(difference).remove();
4898}
4899this._controls.$absolute.find('.active').removeClass('active');
4900this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active');
4901}
4902};
4903Navigation.prototype.onTrigger = function(event) {
4904var settings = this._core.settings;
4905event.page = {
4906index: $.inArray(this.current(), this._pages),
4907count: this._pages.length,
4908size: settings && (settings.center || settings.autoWidth || settings.dotsData
4909? 1 : settings.dotsEach || settings.items)
4910};
4911};
4912Navigation.prototype.current = function() {
4913var current = this._core.relative(this._core.current());
4914return $.grep(this._pages, $.proxy(function(page, index) {
4915return page.start <= current && page.end >= current;
4916}, this)).pop();
4917};
4918Navigation.prototype.getPosition = function(successor) {
4919var position, length,
4920settings = this._core.settings;
4921if (settings.slideBy == 'page') {
4922position = $.inArray(this.current(), this._pages);
4923length = this._pages.length;
4924successor ? ++position : --position;
4925position = this._pages[((position % length) + length) % length].start;
4926} else {
4927position = this._core.relative(this._core.current());
4928length = this._core.items().length;
4929successor ? position += settings.slideBy : position -= settings.slideBy;
4930}
4931return position;
4932};
4933Navigation.prototype.next = function(speed) {
4934$.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
4935};
4936Navigation.prototype.prev = function(speed) {
4937$.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
4938};
4939Navigation.prototype.to = function(position, speed, standard) {
4940var length;
4941if (!standard && this._pages.length) {
4942length = this._pages.length;
4943$.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
4944} else {
4945$.proxy(this._overrides.to, this._core)(position, speed);
4946}
4947};
4948$.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
4949})(window.Zepto || window.jQuery, window, document);
4950;(function($, window, document, undefined) {
4951var Video = function(carousel) {
4952this._core = carousel;
4953this._videos = {};
4954this._playing = null;
4955this._handlers = {
4956'initialized.owl.carousel': $.proxy(function(e) {
4957if (e.namespace) {
4958this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] });
4959}
4960}, this),
4961'resize.owl.carousel': $.proxy(function(e) {
4962if (e.namespace && this._core.settings.video && this.isInFullScreen()) {
4963e.preventDefault();
4964}
4965}, this),
4966'refreshed.owl.carousel': $.proxy(function(e) {
4967if (e.namespace && this._core.is('resizing')) {
4968this._core.$stage.find('.cloned .owl-video-frame').remove();
4969}
4970}, this),
4971'changed.owl.carousel': $.proxy(function(e) {
4972if (e.namespace && e.property.name === 'position' && this._playing) {
4973this.stop();
4974}
4975}, this),
4976'prepared.owl.carousel': $.proxy(function(e) {
4977if (!e.namespace) {
4978return;
4979}
4980var $element = $(e.content).find('.owl-video');
4981if ($element.length) {
4982$element.css('display', 'none');
4983this.fetch($element, $(e.content));
4984}
4985}, this)
4986};
4987this._core.options = $.extend({}, Video.Defaults, this._core.options);
4988this._core.$element.on(this._handlers);
4989this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
4990this.play(e);
4991}, this));
4992};
4993Video.Defaults = {
4994video: false,
4995videoHeight: false,
4996videoWidth: false
4997};
4998Video.prototype.fetch = function(target, item) {
4999var type = (function() {
5000if (target.attr('data-vimeo-id')) {
5001return 'vimeo';
5002} else if (target.attr('data-vzaar-id')) {
5003return 'vzaar'
5004} else {
5005return 'youtube';
5006}
5007})(),
5008id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'),
5009width = target.attr('data-width') || this._core.settings.videoWidth,
5010height = target.attr('data-height') || this._core.settings.videoHeight,
5011url = target.attr('href');
5012if (url) {
5013id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
5014if (id[3].indexOf('youtu') > -1) {
5015type = 'youtube';
5016} else if (id[3].indexOf('vimeo') > -1) {
5017type = 'vimeo';
5018} else if (id[3].indexOf('vzaar') > -1) {
5019type = 'vzaar';
5020} else {
5021throw new Error('Video URL not supported.');
5022}
5023id = id[6];
5024} else {
5025throw new Error('Missing video URL.');
5026}
5027this._videos[url] = {
5028type: type,
5029id: id,
5030width: width,
5031height: height
5032};
5033item.attr('data-video', url);
5034this.thumbnail(target, this._videos[url]);
5035};
5036Video.prototype.thumbnail = function(target, video) {
5037var tnLink,
5038icon,
5039path,
5040dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '',
5041customTn = target.find('img'),
5042srcType = 'src',
5043lazyClass = '',
5044settings = this._core.settings,
5045create = function(path) {
5046icon = '<div class="owl-video-play-icon"></div>';
5047if (settings.lazyLoad) {
5048tnLink = '<div class="owl-video-tn ' + lazyClass + '" ' + srcType + '="' + path + '"></div>';
5049} else {
5050tnLink = '<div class="owl-video-tn" style="opacity:1;background-image:url(' + path + ')"></div>';
5051}
5052target.after(tnLink);
5053target.after(icon);
5054};
5055target.wrap('<div class="owl-video-wrapper"' + dimensions + '></div>');
5056if (this._core.settings.lazyLoad) {
5057srcType = 'data-src';
5058lazyClass = 'owl-lazy';
5059}
5060if (customTn.length) {
5061create(customTn.attr(srcType));
5062customTn.remove();
5063return false;
5064}
5065if (video.type === 'youtube') {
5066path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
5067create(path);
5068} else if (video.type === 'vimeo') {
5069$.ajax({
5070type: 'GET',
5071url: '//vimeo.com/api/v2/video/' + video.id + '.json',
5072jsonp: 'callback',
5073dataType: 'jsonp',
5074success: function(data) {
5075path = data[0].thumbnail_large;
5076create(path);
5077}
5078});
5079} else if (video.type === 'vzaar') {
5080$.ajax({
5081type: 'GET',
5082url: '//vzaar.com/api/videos/' + video.id + '.json',
5083jsonp: 'callback',
5084dataType: 'jsonp',
5085success: function(data) {
5086path = data.framegrab_url;
5087create(path);
5088}
5089});
5090}
5091};
5092Video.prototype.stop = function() {
5093this._core.trigger('stop', null, 'video');
5094this._playing.find('.owl-video-frame').remove();
5095this._playing.removeClass('owl-video-playing');
5096this._playing = null;
5097this._core.leave('playing');
5098this._core.trigger('stopped', null, 'video');
5099};
5100Video.prototype.play = function(event) {
5101var target = $(event.target),
5102item = target.closest('.' + this._core.settings.itemClass),
5103video = this._videos[item.attr('data-video')],
5104width = video.width || '100%',
5105height = video.height || this._core.$stage.height(),
5106html;
5107if (this._playing) {
5108return;
5109}
5110this._core.enter('playing');
5111this._core.trigger('play', null, 'video');
5112item = this._core.items(this._core.relative(item.index()));
5113this._core.reset(item.index());
5114if (video.type === 'youtube') {
5115html = '<iframe width="' + width + '" height="' + height + '" src="//www.youtube.com/embed/' +
5116video.id + '?autoplay=1&rel=0&v=' + video.id + '" frameborder="0" allowfullscreen></iframe>';
5117} else if (video.type === 'vimeo') {
5118html = '<iframe src="//player.vimeo.com/video/' + video.id +
5119'?autoplay=1" width="' + width + '" height="' + height +
5120'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
5121} else if (video.type === 'vzaar') {
5122html = '<iframe frameborder="0"' + 'height="' + height + '"' + 'width="' + width +
5123'" allowfullscreen mozallowfullscreen webkitAllowFullScreen ' +
5124'src="//view.vzaar.com/' + video.id + '/player?autoplay=true"></iframe>';
5125}
5126$('<div class="owl-video-frame">' + html + '</div>').insertAfter(item.find('.owl-video'));
5127this._playing = item.addClass('owl-video-playing');
5128};
5129Video.prototype.isInFullScreen = function() {
5130var element = document.fullscreenElement || document.mozFullScreenElement ||
5131document.webkitFullscreenElement;
5132return element && $(element).parent().hasClass('owl-video-frame');
5133};
5134Video.prototype.destroy = function() {
5135var handler, property;
5136this._core.$element.off('click.owl.video');
5137for (handler in this._handlers) {
5138this._core.$element.off(handler, this._handlers[handler]);
5139}
5140for (property in Object.getOwnPropertyNames(this)) {
5141typeof this[property] != 'function' && (this[property] = null);
5142}
5143};
5144$.fn.owlCarousel.Constructor.Plugins.Video = Video;
5145})(window.Zepto || window.jQuery, window, document);
5146(function(root, factory) {
5147if (typeof define === 'function' && define.amd) {
5148define('sifter', factory);
5149} else if (typeof exports === 'object') {
5150module.exports = factory();
5151} else {
5152root.Sifter = factory();
5153}
5154}(this, function() {
5155var Sifter = function(items, settings) {
5156this.items = items;
5157this.settings = settings || {diacritics: true};
5158};
5159Sifter.prototype.tokenize = function(query) {
5160query = trim(String(query || '').toLowerCase());
5161if (!query || !query.length) return [];
5162var i, n, regex, letter;
5163var tokens = [];
5164var words = query.split(/ +/);
5165for (i = 0, n = words.length; i < n; i++) {
5166regex = escape_regex(words[i]);
5167if (this.settings.diacritics) {
5168for (letter in DIACRITICS) {
5169if (DIACRITICS.hasOwnProperty(letter)) {
5170regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);
5171}
5172}
5173}
5174tokens.push({
5175string : words[i],
5176regex  : new RegExp(regex, 'i')
5177});
5178}
5179return tokens;
5180};
5181Sifter.prototype.iterator = function(object, callback) {
5182var iterator;
5183if (is_array(object)) {
5184iterator = Array.prototype.forEach || function(callback) {
5185for (var i = 0, n = this.length; i < n; i++) {
5186callback(this[i], i, this);
5187}
5188};
5189} else {
5190iterator = function(callback) {
5191for (var key in this) {
5192if (this.hasOwnProperty(key)) {
5193callback(this[key], key, this);
5194}
5195}
5196};
5197}
5198iterator.apply(object, [callback]);
5199};
5200Sifter.prototype.getScoreFunction = function(search, options) {
5201var self, fields, tokens, token_count, nesting;
5202self        = this;
5203search      = self.prepareSearch(search, options);
5204tokens      = search.tokens;
5205fields      = search.options.fields;
5206token_count = tokens.length;
5207nesting     = search.options.nesting;
5208var scoreValue = function(value, token) {
5209var score, pos;
5210if (!value) return 0;
5211value = String(value || '');
5212pos = value.search(token.regex);
5213if (pos === -1) return 0;
5214score = token.string.length / value.length;
vendor: 20,436 bytes, lines 5215-5933
5215if (pos === 0) score += 0.5;
5216return score;
5217};
5218var scoreObject = (function() {
5219var field_count = fields.length;
5220if (!field_count) {
5221return function() { return 0; };
5222}
5223if (field_count === 1) {
5224return function(token, data) {
5225return scoreValue(getattr(data, fields[0], nesting), token);
5226};
5227}
5228return function(token, data) {
5229for (var i = 0, sum = 0; i < field_count; i++) {
5230sum += scoreValue(getattr(data, fields[i], nesting), token);
5231}
5232return sum / field_count;
5233};
5234})();
5235if (!token_count) {
5236return function() { return 0; };
5237}
5238if (token_count === 1) {
5239return function(data) {
5240return scoreObject(tokens[0], data);
5241};
5242}
5243if (search.options.conjunction === 'and') {
5244return function(data) {
5245var score;
5246for (var i = 0, sum = 0; i < token_count; i++) {
5247score = scoreObject(tokens[i], data);
5248if (score <= 0) return 0;
5249sum += score;
5250}
5251return sum / token_count;
5252};
5253} else {
5254return function(data) {
5255for (var i = 0, sum = 0; i < token_count; i++) {
5256sum += scoreObject(tokens[i], data);
5257}
5258return sum / token_count;
5259};
5260}
5261};
5262Sifter.prototype.getSortFunction = function(search, options) {
5263var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
5264self   = this;
5265search = self.prepareSearch(search, options);
5266sort   = (!search.query && options.sort_empty) || options.sort;
5267get_field = function(name, result) {
5268if (name === '$score') return result.score;
5269return getattr(self.items[result.id], name, options.nesting);
5270};
5271fields = [];
5272if (sort) {
5273for (i = 0, n = sort.length; i < n; i++) {
5274if (search.query || sort[i].field !== '$score') {
5275fields.push(sort[i]);
5276}
5277}
5278}
5279if (search.query) {
5280implicit_score = true;
5281for (i = 0, n = fields.length; i < n; i++) {
5282if (fields[i].field === '$score') {
5283implicit_score = false;
5284break;
5285}
5286}
5287if (implicit_score) {
5288fields.unshift({field: '$score', direction: 'desc'});
5289}
5290} else {
5291for (i = 0, n = fields.length; i < n; i++) {
5292if (fields[i].field === '$score') {
5293fields.splice(i, 1);
5294break;
5295}
5296}
5297}
5298multipliers = [];
5299for (i = 0, n = fields.length; i < n; i++) {
5300multipliers.push(fields[i].direction === 'desc' ? -1 : 1);
5301}
5302fields_count = fields.length;
5303if (!fields_count) {
5304return null;
5305} else if (fields_count === 1) {
5306field = fields[0].field;
5307multiplier = multipliers[0];
5308return function(a, b) {
5309return multiplier * cmp(
5310get_field(field, a),
5311get_field(field, b)
5312);
5313};
5314} else {
5315return function(a, b) {
5316var i, result, a_value, b_value, field;
5317for (i = 0; i < fields_count; i++) {
5318field = fields[i].field;
5319result = multipliers[i] * cmp(
5320get_field(field, a),
5321get_field(field, b)
5322);
5323if (result) return result;
5324}
5325return 0;
5326};
5327}
5328};
5329Sifter.prototype.prepareSearch = function(query, options) {
5330if (typeof query === 'object') return query;
5331options = extend({}, options);
5332var option_fields     = options.fields;
5333var option_sort       = options.sort;
5334var option_sort_empty = options.sort_empty;
5335if (option_fields && !is_array(option_fields)) options.fields = [option_fields];
5336if (option_sort && !is_array(option_sort)) options.sort = [option_sort];
5337if (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty];
5338return {
5339options : options,
5340query   : String(query || '').toLowerCase(),
5341tokens  : this.tokenize(query),
5342total   : 0,
5343items   : []
5344};
5345};
5346Sifter.prototype.search = function(query, options) {
5347var self = this, value, score, search, calculateScore;
5348var fn_sort;
5349var fn_score;
5350search  = this.prepareSearch(query, options);
5351options = search.options;
5352query   = search.query;
5353fn_score = options.score || self.getScoreFunction(search);
5354if (query.length) {
5355self.iterator(self.items, function(item, id) {
5356score = fn_score(item);
5357if (options.filter === false || score > 0) {
5358search.items.push({'score': score, 'id': id});
5359}
5360});
5361} else {
5362self.iterator(self.items, function(item, id) {
5363search.items.push({'score': 1, 'id': id});
5364});
5365}
5366fn_sort = self.getSortFunction(search, options);
5367if (fn_sort) search.items.sort(fn_sort);
5368search.total = search.items.length;
5369if (typeof options.limit === 'number') {
5370search.items = search.items.slice(0, options.limit);
5371}
5372return search;
5373};
5374var cmp = function(a, b) {
5375if (typeof a === 'number' && typeof b === 'number') {
5376return a > b ? 1 : (a < b ? -1 : 0);
5377}
5378a = asciifold(String(a || ''));
5379b = asciifold(String(b || ''));
5380if (a > b) return 1;
5381if (b > a) return -1;
5382return 0;
5383};
5384var extend = function(a, b) {
5385var i, n, k, object;
5386for (i = 1, n = arguments.length; i < n; i++) {
5387object = arguments[i];
5388if (!object) continue;
5389for (k in object) {
5390if (object.hasOwnProperty(k)) {
5391a[k] = object[k];
5392}
5393}
5394}
5395return a;
5396};
5397var getattr = function(obj, name, nesting) {
5398if (!obj || !name) return;
5399if (!nesting) return obj[name];
5400var names = name.split(".");
5401while(names.length && (obj = obj[names.shift()]));
5402return obj;
5403};
5404var trim = function(str) {
5405return (str + '').replace(/^\s+|\s+$|/g, '');
5406};
5407var escape_regex = function(str) {
5408return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
5409};
5410var is_array = Array.isArray || (typeof $ !== 'undefined' && $.isArray) || function(object) {
5411return Object.prototype.toString.call(object) === '[object Array]';
5412};
5413var DIACRITICS = {
5414'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',
5415'b': '[b␢βΒB฿𐌁ᛒ]',
5416'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',
5417'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',
5418'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',
5419'f': '[fƑƒḞḟ]',
5420'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',
5421'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',
5422'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',
5423'j': '[jȷĴĵɈɉʝɟʲ]',
5424'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',
5425'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',
5426'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',
5427'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',
5428'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',
5429'q': '[qꝖꝗʠɊɋꝘꝙq̃]',
5430'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',
5431's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',
5432't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',
5433'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',
5434'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',
5435'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',
5436'x': '[xẌẍẊẋχ]',
5437'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',
5438'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'
5439};
5440var asciifold = (function() {
5441var i, n, k, chunk;
5442var foreignletters = '';
5443var lookup = {};
5444for (k in DIACRITICS) {
5445if (DIACRITICS.hasOwnProperty(k)) {
5446chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);
5447foreignletters += chunk;
5448for (i = 0, n = chunk.length; i < n; i++) {
5449lookup[chunk.charAt(i)] = k;
5450}
5451}
5452}
5453var regexp = new RegExp('[' +  foreignletters + ']', 'g');
5454return function(str) {
5455return str.replace(regexp, function(foreignletter) {
5456return lookup[foreignletter];
5457}).toLowerCase();
5458};
5459})();
5460return Sifter;
5461}));
5462(function(root, factory) {
5463if (typeof define === 'function' && define.amd) {
5464define('microplugin', factory);
5465} else if (typeof exports === 'object') {
5466module.exports = factory();
5467} else {
5468root.MicroPlugin = factory();
5469}
5470}(this, function() {
5471var MicroPlugin = {};
5472MicroPlugin.mixin = function(Interface) {
5473Interface.plugins = {};
5474Interface.prototype.initializePlugins = function(plugins) {
5475var i, n, key;
5476var self  = this;
5477var queue = [];
5478self.plugins = {
5479names     : [],
5480settings  : {},
5481requested : {},
5482loaded    : {}
5483};
5484if (utils.isArray(plugins)) {
5485for (i = 0, n = plugins.length; i < n; i++) {
5486if (typeof plugins[i] === 'string') {
5487queue.push(plugins[i]);
5488} else {
5489self.plugins.settings[plugins[i].name] = plugins[i].options;
5490queue.push(plugins[i].name);
5491}
5492}
5493} else if (plugins) {
5494for (key in plugins) {
5495if (plugins.hasOwnProperty(key)) {
5496self.plugins.settings[key] = plugins[key];
5497queue.push(key);
5498}
5499}
5500}
5501while (queue.length) {
5502self.require(queue.shift());
5503}
5504};
5505Interface.prototype.loadPlugin = function(name) {
5506var self    = this;
5507var plugins = self.plugins;
5508var plugin  = Interface.plugins[name];
5509if (!Interface.plugins.hasOwnProperty(name)) {
5510throw new Error('Unable to find "' +  name + '" plugin');
5511}
5512plugins.requested[name] = true;
5513plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);
5514plugins.names.push(name);
5515};
5516Interface.prototype.require = function(name) {
5517var self = this;
5518var plugins = self.plugins;
5519if (!self.plugins.loaded.hasOwnProperty(name)) {
5520if (plugins.requested[name]) {
5521throw new Error('Plugin has circular dependency ("' + name + '")');
5522}
5523self.loadPlugin(name);
5524}
5525return plugins.loaded[name];
5526};
5527Interface.define = function(name, fn) {
5528Interface.plugins[name] = {
5529'name' : name,
5530'fn'   : fn
5531};
5532};
5533};
5534var utils = {
5535isArray: Array.isArray || function(vArg) {
5536return Object.prototype.toString.call(vArg) === '[object Array]';
5537}
5538};
5539return MicroPlugin;
5540}));
5541(function(root, factory) {
5542if (typeof define === 'function' && define.amd) {
5543define('selectize', ['jquery','sifter','microplugin'], factory);
5544} else if (typeof exports === 'object') {
5545module.exports = factory(require('jquery'), require('sifter'), require('microplugin'));
5546} else {
5547root.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);
5548}
5549}(this, function($, Sifter, MicroPlugin) {
5550'use strict';
5551var highlight = function($element, pattern) {
5552if (typeof pattern === 'string' && !pattern.length) return;
5553var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;
5554var highlight = function(node) {
5555var skip = 0;
5556if (node.nodeType === 3) {
5557var pos = node.data.search(regex);
5558if (pos >= 0 && node.data.length > 0) {
5559var match = node.data.match(regex);
5560var spannode = document.createElement('span');
5561spannode.className = 'highlight';
5562var middlebit = node.splitText(pos);
5563var endbit = middlebit.splitText(match[0].length);
5564var middleclone = middlebit.cloneNode(true);
5565spannode.appendChild(middleclone);
5566middlebit.parentNode.replaceChild(spannode, middlebit);
5567skip = 1;
5568}
5569} else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
5570for (var i = 0; i < node.childNodes.length; ++i) {
5571i += highlight(node.childNodes[i]);
5572}
5573}
5574return skip;
5575};
5576return $element.each(function() {
5577highlight(this);
5578});
5579};
5580$.fn.removeHighlight = function() {
5581return this.find("span.highlight").each(function() {
5582this.parentNode.firstChild.nodeName;
5583var parent = this.parentNode;
5584parent.replaceChild(this.firstChild, this);
5585parent.normalize();
5586}).end();
5587};
5588var MicroEvent = function() {};
5589MicroEvent.prototype = {
5590on: function(event, fct){
5591this._events = this._events || {};
5592this._events[event] = this._events[event] || [];
5593this._events[event].push(fct);
5594},
5595off: function(event, fct){
5596var n = arguments.length;
5597if (n === 0) return delete this._events;
5598if (n === 1) return delete this._events[event];
5599this._events = this._events || {};
5600if (event in this._events === false) return;
5601this._events[event].splice(this._events[event].indexOf(fct), 1);
5602},
5603trigger: function(event){
5604this._events = this._events || {};
5605if (event in this._events === false) return;
5606for (var i = 0; i < this._events[event].length; i++){
5607this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));
5608}
5609}
5610};
5611MicroEvent.mixin = function(destObject){
5612var props = ['on', 'off', 'trigger'];
5613for (var i = 0; i < props.length; i++){
5614destObject.prototype[props[i]] = MicroEvent.prototype[props[i]];
5615}
5616};
5617var IS_MAC        = /Mac/.test(navigator.userAgent);
5618var KEY_A         = 65;
5619var KEY_COMMA     = 188;
5620var KEY_RETURN    = 13;
5621var KEY_ESC       = 27;
5622var KEY_LEFT      = 37;
5623var KEY_UP        = 38;
5624var KEY_P         = 80;
5625var KEY_RIGHT     = 39;
5626var KEY_DOWN      = 40;
5627var KEY_N         = 78;
5628var KEY_BACKSPACE = 8;
5629var KEY_DELETE    = 46;
5630var KEY_SHIFT     = 16;
5631var KEY_CMD       = IS_MAC ? 91 : 17;
5632var KEY_CTRL      = IS_MAC ? 18 : 17;
5633var KEY_TAB       = 9;
5634var TAG_SELECT    = 1;
5635var TAG_INPUT     = 2;
5636var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;
5637var isset = function(object) {
5638return typeof object !== 'undefined';
5639};
5640var hash_key = function(value) {
5641if (typeof value === 'undefined' || value === null) return null;
5642if (typeof value === 'boolean') return value ? '1' : '0';
5643return value + '';
5644};
5645var escape_html = function(str) {
5646return (str + '')
5647.replace(/&/g, '&amp;')
5648.replace(/</g, '&lt;')
5649.replace(/>/g, '&gt;')
5650.replace(/"/g, '&quot;');
5651};
5652var escape_replace = function(str) {
5653return (str + '').replace(/\$/g, '$$$$');
5654};
5655var hook = {};
5656hook.before = function(self, method, fn) {
5657var original = self[method];
5658self[method] = function() {
5659fn.apply(self, arguments);
5660return original.apply(self, arguments);
5661};
5662};
5663hook.after = function(self, method, fn) {
5664var original = self[method];
5665self[method] = function() {
5666var result = original.apply(self, arguments);
5667fn.apply(self, arguments);
5668return result;
5669};
5670};
5671var once = function(fn) {
5672var called = false;
5673return function() {
5674if (called) return;
5675called = true;
5676fn.apply(this, arguments);
5677};
5678};
5679var debounce = function(fn, delay) {
5680var timeout;
5681return function() {
5682var self = this;
5683var args = arguments;
5684window.clearTimeout(timeout);
5685timeout = window.setTimeout(function() {
5686fn.apply(self, args);
5687}, delay);
5688};
5689};
5690var debounce_events = function(self, types, fn) {
5691var type;
5692var trigger = self.trigger;
5693var event_args = {};
5694self.trigger = function() {
5695var type = arguments[0];
5696if (types.indexOf(type) !== -1) {
5697event_args[type] = arguments;
5698} else {
5699return trigger.apply(self, arguments);
5700}
5701};
5702fn.apply(self, []);
5703self.trigger = trigger;
5704for (type in event_args) {
5705if (event_args.hasOwnProperty(type)) {
5706trigger.apply(self, event_args[type]);
5707}
5708}
5709};
5710var watchChildEvent = function($parent, event, selector, fn) {
5711$parent.on(event, selector, function(e) {
5712var child = e.target;
5713while (child && child.parentNode !== $parent[0]) {
5714child = child.parentNode;
5715}
5716e.currentTarget = child;
5717return fn.apply(this, [e]);
5718});
5719};
5720var getSelection = function(input) {
5721var result = {};
5722if ('selectionStart' in input) {
5723result.start = input.selectionStart;
5724result.length = input.selectionEnd - result.start;
5725} else if (document.selection) {
5726input.focus();
5727var sel = document.selection.createRange();
5728var selLen = document.selection.createRange().text.length;
5729sel.moveStart('character', -input.value.length);
5730result.start = sel.text.length - selLen;
5731result.length = selLen;
5732}
5733return result;
5734};
5735var transferStyles = function($from, $to, properties) {
5736var i, n, styles = {};
5737if (properties) {
5738for (i = 0, n = properties.length; i < n; i++) {
5739styles[properties[i]] = $from.css(properties[i]);
5740}
5741} else {
5742styles = $from.css();
5743}
5744$to.css(styles);
5745};
5746var measureString = function(str, $parent) {
5747if (!str) {
5748return 0;
5749}
5750var $test = $('<test>').css({
5751position: 'absolute',
5752top: -99999,
5753left: -99999,
5754width: 'auto',
5755padding: 0,
5756whiteSpace: 'pre'
5757}).text(str).appendTo('body');
5758transferStyles($parent, $test, [
5759'letterSpacing',
5760'fontSize',
5761'fontFamily',
5762'fontWeight',
5763'textTransform'
5764]);
5765var width = $test.width();
5766$test.remove();
5767return width;
5768};
5769var autoGrow = function($input) {
5770var currentWidth = null;
5771var update = function(e, options) {
5772var value, keyCode, printable, placeholder, width;
5773var shift, character, selection;
5774e = e || window.event || {};
5775options = options || {};
5776if (e.metaKey || e.altKey) return;
5777if (!options.force && $input.data('grow') === false) return;
5778value = $input.val();
5779if (e.type && e.type.toLowerCase() === 'keydown') {
5780keyCode = e.keyCode;
5781printable = (
5782(keyCode >= 97 && keyCode <= 122) || // a-z
5783(keyCode >= 65 && keyCode <= 90)  || // A-Z
5784(keyCode >= 48 && keyCode <= 57)  || // 0-9
5785keyCode === 32 // space
5786);
5787if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
5788selection = getSelection($input[0]);
5789if (selection.length) {
5790value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
5791} else if (keyCode === KEY_BACKSPACE && selection.start) {
5792value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
5793} else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
5794value = value.substring(0, selection.start) + value.substring(selection.start + 1);
5795}
5796} else if (printable) {
5797shift = e.shiftKey;
5798character = String.fromCharCode(e.keyCode);
5799if (shift) character = character.toUpperCase();
5800else character = character.toLowerCase();
5801value += character;
5802}
5803}
5804placeholder = $input.attr('placeholder');
5805if (!value && placeholder) {
5806value = placeholder;
5807}
5808width = measureString(value, $input) + 4;
5809if (width !== currentWidth) {
5810currentWidth = width;
5811$input.width(width);
5812$input.triggerHandler('resize');
5813}
5814};
5815$input.on('keydown keyup update blur', update);
5816update();
5817};
5818var domToString = function(d) {
5819var tmp = document.createElement('div');
5820tmp.appendChild(d.cloneNode(true));
5821return tmp.innerHTML;
5822};
5823var logError = function(message, options){
5824if(!options) options = {};
5825var component = "Selectize";
5826console.error(component + ": " + message)
5827if(options.explanation){
5828if(console.group) console.group();
5829console.error(options.explanation);
5830if(console.group) console.groupEnd();
5831}
5832}
5833var Selectize = function($input, settings) {
5834var key, i, n, dir, input, self = this;
5835input = $input[0];
5836input.selectize = self;
5837var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
5838dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
5839dir = dir || $input.parents('[dir]:first').attr('dir') || '';
5840$.extend(self, {
5841order            : 0,
5842settings         : settings,
5843$input           : $input,
5844tabIndex         : $input.attr('tabindex') || '',
5845tagType          : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,
5846rtl              : /rtl/i.test(dir),
5847eventNS          : '.selectize' + (++Selectize.count),
5848highlightedValue : null,
5849isOpen           : false,
5850isDisabled       : false,
5851isRequired       : $input.is('[required]'),
5852isInvalid        : false,
5853isLocked         : false,
5854isFocused        : false,
5855isInputHidden    : false,
5856isSetup          : false,
5857isShiftDown      : false,
5858isCmdDown        : false,
5859isCtrlDown       : false,
5860ignoreFocus      : false,
5861ignoreBlur       : false,
5862ignoreHover      : false,
5863hasOptions       : false,
5864currentResults   : null,
5865lastValue        : '',
5866caretPos         : 0,
5867loading          : 0,
5868loadedSearches   : {},
5869$activeOption    : null,
5870$activeItems     : [],
5871optgroups        : {},
5872options          : {},
5873userOptions      : {},
5874items            : [],
5875renderCache      : {},
5876onSearchChange   : settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)
5877});
5878self.sifter = new Sifter(this.options, {diacritics: settings.diacritics});
5879if (self.settings.options) {
5880for (i = 0, n = self.settings.options.length; i < n; i++) {
5881self.registerOption(self.settings.options[i]);
5882}
5883delete self.settings.options;
5884}
5885if (self.settings.optgroups) {
5886for (i = 0, n = self.settings.optgroups.length; i < n; i++) {
5887self.registerOptionGroup(self.settings.optgroups[i]);
5888}
5889delete self.settings.optgroups;
5890}
5891self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');
5892if (typeof self.settings.hideSelected !== 'boolean') {
5893self.settings.hideSelected = self.settings.mode === 'multi';
5894}
5895self.initializePlugins(self.settings.plugins);
5896self.setupCallbacks();
5897self.setupTemplates();
5898self.setup();
5899};
5900MicroEvent.mixin(Selectize);
5901if(typeof MicroPlugin !== "undefined"){
5902MicroPlugin.mixin(Selectize);
5903}else{
5904logError("Dependency MicroPlugin is missing",
5905{explanation:
5906"Make sure you either: (1) are using the \"standalone\" "+
5907"version of Selectize, or (2) require MicroPlugin before you "+
5908"load Selectize."}
5909);
5910}
5911$.extend(Selectize.prototype, {
5912setup: function() {
5913var self      = this;
5914var settings  = self.settings;
5915var eventNS   = self.eventNS;
5916var $window   = $(window);
5917var $document = $(document);
5918var $input    = self.$input;
5919var $wrapper;
5920var $control;
5921var $control_input;
5922var $dropdown;
5923var $dropdown_content;
5924var $dropdown_parent;
5925var inputMode;
5926var timeout_blur;
5927var timeout_focus;
5928var classes;
5929var classes_plugins;
5930var inputId;
5931inputMode         = self.settings.mode;
5932classes           = $input.attr('class') || '';
5933$wrapper          = $('<div>
vendor: 41,603 bytes, lines 5933-7357
5933').addClass(settings.wrapperClass).addClass(classes).addClass(inputMode);
5934$control          = $('<div>').addClass(settings.inputClass).addClass('items').appendTo($wrapper);
5935$control_input    = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);
5936$dropdown_parent  = $(settings.dropdownParent || $wrapper);
5937$dropdown         = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);
5938$dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);
5939if(inputId = $input.attr('id')) {
5940$control_input.attr('id', inputId + '-selectized');
5941$("label[for='"+inputId+"']").attr('for', inputId + '-selectized');
5942}
5943if(self.settings.copyClassesToDropdown) {
5944$dropdown.addClass(classes);
5945}
5946$wrapper.css({
5947width: $input[0].style.width
5948});
5949if (self.plugins.names.length) {
5950classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
5951$wrapper.addClass(classes_plugins);
5952$dropdown.addClass(classes_plugins);
5953}
5954if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {
5955$input.attr('multiple', 'multiple');
5956}
5957if (self.settings.placeholder) {
5958$control_input.attr('placeholder', settings.placeholder);
5959}
5960if (!self.settings.splitOn && self.settings.delimiter) {
5961var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
5962self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
5963}
5964if ($input.attr('autocorrect')) {
5965$control_input.attr('autocorrect', $input.attr('autocorrect'));
5966}
5967if ($input.attr('autocapitalize')) {
5968$control_input.attr('autocapitalize', $input.attr('autocapitalize'));
5969}
5970self.$wrapper          = $wrapper;
5971self.$control          = $control;
5972self.$control_input    = $control_input;
5973self.$dropdown         = $dropdown;
5974self.$dropdown_content = $dropdown_content;
5975$dropdown.on('mouseenter', '[data-selectable]', function() { return self.onOptionHover.apply(self, arguments); });
5976$dropdown.on('mousedown click', '[data-selectable]', function() { return self.onOptionSelect.apply(self, arguments); });
5977watchChildEvent($control, 'mousedown', '*:not(input)', function() { return self.onItemSelect.apply(self, arguments); });
5978autoGrow($control_input);
5979$control.on({
5980mousedown : function() { return self.onMouseDown.apply(self, arguments); },
5981click     : function() { return self.onClick.apply(self, arguments); }
5982});
5983$control_input.on({
5984mousedown : function(e) { e.stopPropagation(); },
5985keydown   : function() { return self.onKeyDown.apply(self, arguments); },
5986keyup     : function() { return self.onKeyUp.apply(self, arguments); },
5987keypress  : function() { return self.onKeyPress.apply(self, arguments); },
5988resize    : function() { self.positionDropdown.apply(self, []); },
5989blur      : function() { return self.onBlur.apply(self, arguments); },
5990focus     : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); },
5991paste     : function() { return self.onPaste.apply(self, arguments); }
5992});
5993$document.on('keydown' + eventNS, function(e) {
5994self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
5995self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
5996self.isShiftDown = e.shiftKey;
5997});
5998$document.on('keyup' + eventNS, function(e) {
5999if (e.keyCode === KEY_CTRL) self.isCtrlDown = false;
6000if (e.keyCode === KEY_SHIFT) self.isShiftDown = false;
6001if (e.keyCode === KEY_CMD) self.isCmdDown = false;
6002});
6003$document.on('mousedown' + eventNS, function(e) {
6004if (self.isFocused) {
6005if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {
6006return false;
6007}
6008if (!self.$control.has(e.target).length && e.target !== self.$control[0]) {
6009self.blur(e.target);
6010}
6011}
6012});
6013$window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function() {
6014if (self.isOpen) {
6015self.positionDropdown.apply(self, arguments);
6016}
6017});
6018$window.on('mousemove' + eventNS, function() {
6019self.ignoreHover = false;
6020});
6021this.revertSettings = {
6022$children : $input.children().detach(),
6023tabindex  : $input.attr('tabindex')
6024};
6025$input.attr('tabindex', -1).hide().after(self.$wrapper);
6026if ($.isArray(settings.items)) {
6027self.setValue(settings.items);
6028delete settings.items;
6029}
6030if (SUPPORTS_VALIDITY_API) {
6031$input.on('invalid' + eventNS, function(e) {
6032e.preventDefault();
6033self.isInvalid = true;
6034self.refreshState();
6035});
6036}
6037self.updateOriginalInput();
6038self.refreshItems();
6039self.refreshState();
6040self.updatePlaceholder();
6041self.isSetup = true;
6042if ($input.is(':disabled')) {
6043self.disable();
6044}
6045self.on('change', this.onChange);
6046$input.data('selectize', self);
6047$input.addClass('selectized');
6048self.trigger('initialize');
6049if (settings.preload === true) {
6050self.onSearchChange('');
6051}
6052},
6053setupTemplates: function() {
6054var self = this;
6055var field_label = self.settings.labelField;
6056var field_optgroup = self.settings.optgroupLabelField;
6057var templates = {
6058'optgroup': function(data) {
6059return '<div class="optgroup">' + data.html + '</div>';
6060},
6061'optgroup_header': function(data, escape) {
6062return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>';
6063},
6064'option': function(data, escape) {
6065return '<div class="option">' + escape(data[field_label]) + '</div>';
6066},
6067'item': function(data, escape) {
6068return '<div class="item">' + escape(data[field_label]) + '</div>';
6069},
6070'option_create': function(data, escape) {
6071return '<div class="create">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';
6072}
6073};
6074self.settings.render = $.extend({}, templates, self.settings.render);
6075},
6076setupCallbacks: function() {
6077var key, fn, callbacks = {
6078'initialize'      : 'onInitialize',
6079'change'          : 'onChange',
6080'item_add'        : 'onItemAdd',
6081'item_remove'     : 'onItemRemove',
6082'clear'           : 'onClear',
6083'option_add'      : 'onOptionAdd',
6084'option_remove'   : 'onOptionRemove',
6085'option_clear'    : 'onOptionClear',
6086'optgroup_add'    : 'onOptionGroupAdd',
6087'optgroup_remove' : 'onOptionGroupRemove',
6088'optgroup_clear'  : 'onOptionGroupClear',
6089'dropdown_open'   : 'onDropdownOpen',
6090'dropdown_close'  : 'onDropdownClose',
6091'type'            : 'onType',
6092'load'            : 'onLoad',
6093'focus'           : 'onFocus',
6094'blur'            : 'onBlur'
6095};
6096for (key in callbacks) {
6097if (callbacks.hasOwnProperty(key)) {
6098fn = this.settings[callbacks[key]];
6099if (fn) this.on(key, fn);
6100}
6101}
6102},
6103onClick: function(e) {
6104var self = this;
6105if (!self.isFocused) {
6106self.focus();
6107e.preventDefault();
6108}
6109},
6110onMouseDown: function(e) {
6111var self = this;
6112var defaultPrevented = e.isDefaultPrevented();
6113var $target = $(e.target);
6114if (self.isFocused) {
6115if (e.target !== self.$control_input[0]) {
6116if (self.settings.mode === 'single') {
6117self.isOpen ? self.close() : self.open();
6118} else if (!defaultPrevented) {
6119self.setActiveItem(null);
6120}
6121return false;
6122}
6123} else {
6124if (!defaultPrevented) {
6125window.setTimeout(function() {
6126self.focus();
6127}, 0);
6128}
6129}
6130},
6131onChange: function() {
6132this.$input.trigger('change');
6133},
6134onPaste: function(e) {
6135var self = this;
6136if (self.isFull() || self.isInputHidden || self.isLocked) {
6137e.preventDefault();
6138return;
6139}
6140if (self.settings.splitOn) {
6141setTimeout(function() {
6142var pastedText = self.$control_input.val();
6143if(!pastedText.match(self.settings.splitOn)){ return }
6144var splitInput = $.trim(pastedText).split(self.settings.splitOn);
6145for (var i = 0, n = splitInput.length; i < n; i++) {
6146self.createItem(splitInput[i]);
6147}
6148}, 0);
6149}
6150},
6151onKeyPress: function(e) {
6152if (this.isLocked) return e && e.preventDefault();
6153var character = String.fromCharCode(e.keyCode || e.which);
6154if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {
6155this.createItem();
6156e.preventDefault();
6157return false;
6158}
6159},
6160onKeyDown: function(e) {
6161var isInput = e.target === this.$control_input[0];
6162var self = this;
6163if (self.isLocked) {
6164if (e.keyCode !== KEY_TAB) {
6165e.preventDefault();
6166}
6167return;
6168}
6169switch (e.keyCode) {
6170case KEY_A:
6171if (self.isCmdDown) {
6172self.selectAll();
6173return;
6174}
6175break;
6176case KEY_ESC:
6177if (self.isOpen) {
6178e.preventDefault();
6179e.stopPropagation();
6180self.close();
6181}
6182return;
6183case KEY_N:
6184if (!e.ctrlKey || e.altKey) break;
6185case KEY_DOWN:
6186if (!self.isOpen && self.hasOptions) {
6187self.open();
6188} else if (self.$activeOption) {
6189self.ignoreHover = true;
6190var $next = self.getAdjacentOption(self.$activeOption, 1);
6191if ($next.length) self.setActiveOption($next, true, true);
6192}
6193e.preventDefault();
6194return;
6195case KEY_P:
6196if (!e.ctrlKey || e.altKey) break;
6197case KEY_UP:
6198if (self.$activeOption) {
6199self.ignoreHover = true;
6200var $prev = self.getAdjacentOption(self.$activeOption, -1);
6201if ($prev.length) self.setActiveOption($prev, true, true);
6202}
6203e.preventDefault();
6204return;
6205case KEY_RETURN:
6206if (self.isOpen && self.$activeOption) {
6207self.onOptionSelect({currentTarget: self.$activeOption});
6208e.preventDefault();
6209}
6210return;
6211case KEY_LEFT:
6212self.advanceSelection(-1, e);
6213return;
6214case KEY_RIGHT:
6215self.advanceSelection(1, e);
6216return;
6217case KEY_TAB:
6218if (self.settings.selectOnTab && self.isOpen && self.$activeOption) {
6219self.onOptionSelect({currentTarget: self.$activeOption});
6220if (!self.isFull()) {
6221e.preventDefault();
6222}
6223}
6224if (self.settings.create && self.createItem()) {
6225e.preventDefault();
6226}
6227return;
6228case KEY_BACKSPACE:
6229case KEY_DELETE:
6230self.deleteSelection(e);
6231return;
6232}
6233if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
6234e.preventDefault();
6235return;
6236}
6237},
6238onKeyUp: function(e) {
6239var self = this;
6240if (self.isLocked) return e && e.preventDefault();
6241var value = self.$control_input.val() || '';
6242if (self.lastValue !== value) {
6243self.lastValue = value;
6244self.onSearchChange(value);
6245self.refreshOptions();
6246self.trigger('type', value);
6247}
6248},
6249onSearchChange: function(value) {
6250var self = this;
6251var fn = self.settings.load;
6252if (!fn) return;
6253if (self.loadedSearches.hasOwnProperty(value)) return;
6254self.loadedSearches[value] = true;
6255self.load(function(callback) {
6256fn.apply(self, [value, callback]);
6257});
6258},
6259onFocus: function(e) {
6260var self = this;
6261var wasFocused = self.isFocused;
6262if (self.isDisabled) {
6263self.blur();
6264e && e.preventDefault();
6265return false;
6266}
6267if (self.ignoreFocus) return;
6268self.isFocused = true;
6269if (self.settings.preload === 'focus') self.onSearchChange('');
6270if (!wasFocused) self.trigger('focus');
6271if (!self.$activeItems.length) {
6272self.showInput();
6273self.setActiveItem(null);
6274self.refreshOptions(!!self.settings.openOnFocus);
6275}
6276self.refreshState();
6277},
6278onBlur: function(e, dest) {
6279var self = this;
6280if (!self.isFocused) return;
6281self.isFocused = false;
6282if (self.ignoreFocus) {
6283return;
6284} else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {
6285self.ignoreBlur = true;
6286self.onFocus(e);
6287return;
6288}
6289var deactivate = function() {
6290self.close();
6291self.setTextboxValue('');
6292self.setActiveItem(null);
6293self.setActiveOption(null);
6294self.setCaret(self.items.length);
6295self.refreshState();
6296dest && dest.focus && dest.focus();
6297self.ignoreFocus = false;
6298self.trigger('blur');
6299};
6300self.ignoreFocus = true;
6301if (self.settings.create && self.settings.createOnBlur) {
6302self.createItem(null, false, deactivate);
6303} else {
6304deactivate();
6305}
6306},
6307onOptionHover: function(e) {
6308if (this.ignoreHover) return;
6309this.setActiveOption(e.currentTarget, false);
6310},
6311onOptionSelect: function(e) {
6312var value, $target, $option, self = this;
6313if (e.preventDefault) {
6314e.preventDefault();
6315e.stopPropagation();
6316}
6317$target = $(e.currentTarget);
6318if ($target.hasClass('create')) {
6319self.createItem(null, function() {
6320if (self.settings.closeAfterSelect) {
6321self.close();
6322}
6323});
6324} else {
6325value = $target.attr('data-value');
6326if (typeof value !== 'undefined') {
6327self.lastQuery = null;
6328self.setTextboxValue('');
6329self.addItem(value);
6330if (self.settings.closeAfterSelect) {
6331self.close();
6332} else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
6333self.setActiveOption(self.getOption(value));
6334}
6335}
6336}
6337},
6338onItemSelect: function(e) {
6339var self = this;
6340if (self.isLocked) return;
6341if (self.settings.mode === 'multi') {
6342e.preventDefault();
6343self.setActiveItem(e.currentTarget, e);
6344}
6345},
6346load: function(fn) {
6347var self = this;
6348var $wrapper = self.$wrapper.addClass(self.settings.loadingClass);
6349self.loading++;
6350fn.apply(self, [function(results) {
6351self.loading = Math.max(self.loading - 1, 0);
6352if (results && results.length) {
6353self.addOption(results);
6354self.refreshOptions(self.isFocused && !self.isInputHidden);
6355}
6356if (!self.loading) {
6357$wrapper.removeClass(self.settings.loadingClass);
6358}
6359self.trigger('load', results);
6360}]);
6361},
6362setTextboxValue: function(value) {
6363var $input = this.$control_input;
6364var changed = $input.val() !== value;
6365if (changed) {
6366$input.val(value).triggerHandler('update');
6367this.lastValue = value;
6368}
6369},
6370getValue: function() {
6371if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {
6372return this.items;
6373} else {
6374return this.items.join(this.settings.delimiter);
6375}
6376},
6377setValue: function(value, silent) {
6378var events = silent ? [] : ['change'];
6379debounce_events(this, events, function() {
6380this.clear(silent);
6381this.addItems(value, silent);
6382});
6383},
6384setActiveItem: function($item, e) {
6385var self = this;
6386var eventName;
6387var i, idx, begin, end, item, swap;
6388var $last;
6389if (self.settings.mode === 'single') return;
6390$item = $($item);
6391if (!$item.length) {
6392$(self.$activeItems).removeClass('active');
6393self.$activeItems = [];
6394if (self.isFocused) {
6395self.showInput();
6396}
6397return;
6398}
6399eventName = e && e.type.toLowerCase();
6400if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {
6401$last = self.$control.children('.active:last');
6402begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);
6403end   = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);
6404if (begin > end) {
6405swap  = begin;
6406begin = end;
6407end   = swap;
6408}
6409for (i = begin; i <= end; i++) {
6410item = self.$control[0].childNodes[i];
6411if (self.$activeItems.indexOf(item) === -1) {
6412$(item).addClass('active');
6413self.$activeItems.push(item);
6414}
6415}
6416e.preventDefault();
6417} else if ((eventName === 'mousedown' && self.isCtrlDown) || (eventName === 'keydown' && this.isShiftDown)) {
6418if ($item.hasClass('active')) {
6419idx = self.$activeItems.indexOf($item[0]);
6420self.$activeItems.splice(idx, 1);
6421$item.removeClass('active');
6422} else {
6423self.$activeItems.push($item.addClass('active')[0]);
6424}
6425} else {
6426$(self.$activeItems).removeClass('active');
6427self.$activeItems = [$item.addClass('active')[0]];
6428}
6429self.hideInput();
6430if (!this.isFocused) {
6431self.focus();
6432}
6433},
6434setActiveOption: function($option, scroll, animate) {
6435var height_menu, height_item, y;
6436var scroll_top, scroll_bottom;
6437var self = this;
6438if (self.$activeOption) self.$activeOption.removeClass('active');
6439self.$activeOption = null;
6440$option = $($option);
6441if (!$option.length) return;
6442self.$activeOption = $option.addClass('active');
6443if (scroll || !isset(scroll)) {
6444height_menu   = self.$dropdown_content.height();
6445height_item   = self.$activeOption.outerHeight(true);
6446scroll        = self.$dropdown_content.scrollTop() || 0;
6447y             = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;
6448scroll_top    = y;
6449scroll_bottom = y - height_menu + height_item;
6450if (y + height_item > height_menu + scroll) {
6451self.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);
6452} else if (y < scroll) {
6453self.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);
6454}
6455}
6456},
6457selectAll: function() {
6458var self = this;
6459if (self.settings.mode === 'single') return;
6460self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));
6461if (self.$activeItems.length) {
6462self.hideInput();
6463self.close();
6464}
6465self.focus();
6466},
6467hideInput: function() {
6468var self = this;
6469self.setTextboxValue('');
6470self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000});
6471self.isInputHidden = true;
6472},
6473showInput: function() {
6474this.$control_input.css({opacity: 1, position: 'relative', left: 0});
6475this.isInputHidden = false;
6476},
6477focus: function() {
6478var self = this;
6479if (self.isDisabled) return;
6480self.ignoreFocus = true;
6481self.$control_input[0].focus();
6482window.setTimeout(function() {
6483self.ignoreFocus = false;
6484self.onFocus();
6485}, 0);
6486},
6487blur: function(dest) {
6488this.$control_input[0].blur();
6489this.onBlur(null, dest);
6490},
6491getScoreFunction: function(query) {
6492return this.sifter.getScoreFunction(query, this.getSearchOptions());
6493},
6494getSearchOptions: function() {
6495var settings = this.settings;
6496var sort = settings.sortField;
6497if (typeof sort === 'string') {
6498sort = [{field: sort}];
6499}
6500return {
6501fields      : settings.searchField,
6502conjunction : settings.searchConjunction,
6503sort        : sort
6504};
6505},
6506search: function(query) {
6507var i, value, score, result, calculateScore;
6508var self     = this;
6509var settings = self.settings;
6510var options  = this.getSearchOptions();
6511if (settings.score) {
6512calculateScore = self.settings.score.apply(this, [query]);
6513if (typeof calculateScore !== 'function') {
6514throw new Error('Selectize "score" setting must be a function that returns a function');
6515}
6516}
6517if (query !== self.lastQuery) {
6518self.lastQuery = query;
6519result = self.sifter.search(query, $.extend(options, {score: calculateScore}));
6520self.currentResults = result;
6521} else {
6522result = $.extend(true, {}, self.currentResults);
6523}
6524if (settings.hideSelected) {
6525for (i = result.items.length - 1; i >= 0; i--) {
6526if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {
6527result.items.splice(i, 1);
6528}
6529}
6530}
6531return result;
6532},
6533refreshOptions: function(triggerDropdown) {
6534var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
6535var $active, $active_before, $create;
6536if (typeof triggerDropdown === 'undefined') {
6537triggerDropdown = true;
6538}
6539var self              = this;
6540var query             = $.trim(self.$control_input.val());
6541var results           = self.search(query);
6542var $dropdown_content = self.$dropdown_content;
6543var active_before     = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));
6544n = results.items.length;
6545if (typeof self.settings.maxOptions === 'number') {
6546n = Math.min(n, self.settings.maxOptions);
6547}
6548groups = {};
6549groups_order = [];
6550for (i = 0; i < n; i++) {
6551option      = self.options[results.items[i].id];
6552option_html = self.render('option', option);
6553optgroup    = option[self.settings.optgroupField] || '';
6554optgroups   = $.isArray(optgroup) ? optgroup : [optgroup];
6555for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
6556optgroup = optgroups[j];
6557if (!self.optgroups.hasOwnProperty(optgroup)) {
6558optgroup = '';
6559}
6560if (!groups.hasOwnProperty(optgroup)) {
6561groups[optgroup] = document.createDocumentFragment();
6562groups_order.push(optgroup);
6563}
6564groups[optgroup].appendChild(option_html);
6565}
6566}
6567if (this.settings.lockOptgroupOrder) {
6568groups_order.sort(function(a, b) {
6569var a_order = self.optgroups[a].$order || 0;
6570var b_order = self.optgroups[b].$order || 0;
6571return a_order - b_order;
6572});
6573}
6574html = document.createDocumentFragment();
6575for (i = 0, n = groups_order.length; i < n; i++) {
6576optgroup = groups_order[i];
6577if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
6578html_children = document.createDocumentFragment();
6579html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
6580html_children.appendChild(groups[optgroup]);
6581html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {
6582html: domToString(html_children),
6583dom:  html_children
6584})));
6585} else {
6586html.appendChild(groups[optgroup]);
6587}
6588}
6589$dropdown_content.html(html);
6590if (self.settings.highlight && results.query.length && results.tokens.length) {
6591$dropdown_content.removeHighlight();
6592for (i = 0, n = results.tokens.length; i < n; i++) {
6593highlight($dropdown_content, results.tokens[i].regex);
6594}
6595}
6596if (!self.settings.hideSelected) {
6597for (i = 0, n = self.items.length; i < n; i++) {
6598self.getOption(self.items[i]).addClass('selected');
6599}
6600}
6601has_create_option = self.canCreate(query);
6602if (has_create_option) {
6603$dropdown_content.prepend(self.render('option_create', {input: query}));
6604$create = $($dropdown_content[0].childNodes[0]);
6605}
6606self.hasOptions = results.items.length > 0 || has_create_option;
6607if (self.hasOptions) {
6608if (results.items.length > 0) {
6609$active_before = active_before && self.getOption(active_before);
6610if ($active_before && $active_before.length) {
6611$active = $active_before;
6612} else if (self.settings.mode === 'single' && self.items.length) {
6613$active = self.getOption(self.items[0]);
6614}
6615if (!$active || !$active.length) {
6616if ($create && !self.settings.addPrecedence) {
6617$active = self.getAdjacentOption($create, 1);
6618} else {
6619$active = $dropdown_content.find('[data-selectable]:first');
6620}
6621}
6622} else {
6623$active = $create;
6624}
6625self.setActiveOption($active);
6626if (triggerDropdown && !self.isOpen) { self.open(); }
6627} else {
6628self.setActiveOption(null);
6629if (triggerDropdown && self.isOpen) { self.close(); }
6630}
6631},
6632addOption: function(data) {
6633var i, n, value, self = this;
6634if ($.isArray(data)) {
6635for (i = 0, n = data.length; i < n; i++) {
6636self.addOption(data[i]);
6637}
6638return;
6639}
6640if (value = self.registerOption(data)) {
6641self.userOptions[value] = true;
6642self.lastQuery = null;
6643self.trigger('option_add', value, data);
6644}
6645},
6646registerOption: function(data) {
6647var key = hash_key(data[this.settings.valueField]);
6648if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;
6649data.$order = data.$order || ++this.order;
6650this.options[key] = data;
6651return key;
6652},
6653registerOptionGroup: function(data) {
6654var key = hash_key(data[this.settings.optgroupValueField]);
6655if (!key) return false;
6656data.$order = data.$order || ++this.order;
6657this.optgroups[key] = data;
6658return key;
6659},
6660addOptionGroup: function(id, data) {
6661data[this.settings.optgroupValueField] = id;
6662if (id = this.registerOptionGroup(data)) {
6663this.trigger('optgroup_add', id, data);
6664}
6665},
6666removeOptionGroup: function(id) {
6667if (this.optgroups.hasOwnProperty(id)) {
6668delete this.optgroups[id];
6669this.renderCache = {};
6670this.trigger('optgroup_remove', id);
6671}
6672},
6673clearOptionGroups: function() {
6674this.optgroups = {};
6675this.renderCache = {};
6676this.trigger('optgroup_clear');
6677},
6678updateOption: function(value, data) {
6679var self = this;
6680var $item, $item_new;
6681var value_new, index_item, cache_items, cache_options, order_old;
6682value     = hash_key(value);
6683value_new = hash_key(data[self.settings.valueField]);
6684if (value === null) return;
6685if (!self.options.hasOwnProperty(value)) return;
6686if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
6687order_old = self.options[value].$order;
6688if (value_new !== value) {
6689delete self.options[value];
6690index_item = self.items.indexOf(value);
6691if (index_item !== -1) {
6692self.items.splice(index_item, 1, value_new);
6693}
6694}
6695data.$order = data.$order || order_old;
6696self.options[value_new] = data;
6697cache_items = self.renderCache['item'];
6698cache_options = self.renderCache['option'];
6699if (cache_items) {
6700delete cache_items[value];
6701delete cache_items[value_new];
6702}
6703if (cache_options) {
6704delete cache_options[value];
6705delete cache_options[value_new];
6706}
6707if (self.items.indexOf(value_new) !== -1) {
6708$item = self.getItem(value);
6709$item_new = $(self.render('item', data));
6710if ($item.hasClass('active')) $item_new.addClass('active');
6711$item.replaceWith($item_new);
6712}
6713self.lastQuery = null;
6714if (self.isOpen) {
6715self.refreshOptions(false);
6716}
6717},
6718removeOption: function(value, silent) {
6719var self = this;
6720value = hash_key(value);
6721var cache_items = self.renderCache['item'];
6722var cache_options = self.renderCache['option'];
6723if (cache_items) delete cache_items[value];
6724if (cache_options) delete cache_options[value];
6725delete self.userOptions[value];
6726delete self.options[value];
6727self.lastQuery = null;
6728self.trigger('option_remove', value);
6729self.removeItem(value, silent);
6730},
6731clearOptions: function() {
6732var self = this;
6733self.loadedSearches = {};
6734self.userOptions = {};
6735self.renderCache = {};
6736self.options = self.sifter.items = {};
6737self.lastQuery = null;
6738self.trigger('option_clear');
6739self.clear();
6740},
6741getOption: function(value) {
6742return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
6743},
6744getAdjacentOption: function($option, direction) {
6745var $options = this.$dropdown.find('[data-selectable]');
6746var index    = $options.index($option) + direction;
6747return index >= 0 && index < $options.length ? $options.eq(index) : $();
6748},
6749getElementWithValue: function(value, $els) {
6750value = hash_key(value);
6751if (typeof value !== 'undefined' && value !== null) {
6752for (var i = 0, n = $els.length; i < n; i++) {
6753if ($els[i].getAttribute('data-value') === value) {
6754return $($els[i]);
6755}
6756}
6757}
6758return $();
6759},
6760getItem: function(value) {
6761return this.getElementWithValue(value, this.$control.children());
6762},
6763addItems: function(values, silent) {
6764var items = $.isArray(values) ? values : [values];
6765for (var i = 0, n = items.length; i < n; i++) {
6766this.isPending = (i < n - 1);
6767this.addItem(items[i], silent);
6768}
6769},
6770addItem: function(value, silent) {
6771var events = silent ? [] : ['change'];
6772debounce_events(this, events, function() {
6773var $item, $option, $options;
6774var self = this;
6775var inputMode = self.settings.mode;
6776var i, active, value_next, wasFull;
6777value = hash_key(value);
6778if (self.items.indexOf(value) !== -1) {
6779if (inputMode === 'single') self.close();
6780return;
6781}
6782if (!self.options.hasOwnProperty(value)) return;
6783if (inputMode === 'single') self.clear(silent);
6784if (inputMode === 'multi' && self.isFull()) return;
6785$item = $(self.render('item', self.options[value]));
6786wasFull = self.isFull();
6787self.items.splice(self.caretPos, 0, value);
6788self.insertAtCaret($item);
6789if (!self.isPending || (!wasFull && self.isFull())) {
6790self.refreshState();
6791}
6792if (self.isSetup) {
6793$options = self.$dropdown_content.find('[data-selectable]');
6794if (!self.isPending) {
6795$option = self.getOption(value);
6796value_next = self.getAdjacentOption($option, 1).attr('data-value');
6797self.refreshOptions(self.isFocused && inputMode !== 'single');
6798if (value_next) {
6799self.setActiveOption(self.getOption(value_next));
6800}
6801}
6802if (!$options.length || self.isFull()) {
6803self.close();
6804} else {
6805self.positionDropdown();
6806}
6807self.updatePlaceholder();
6808self.trigger('item_add', value, $item);
6809self.updateOriginalInput({silent: silent});
6810}
6811});
6812},
6813removeItem: function(value, silent) {
6814var self = this;
6815var $item, i, idx;
6816$item = (value instanceof $) ? value : self.getItem(value);
6817value = hash_key($item.attr('data-value'));
6818i = self.items.indexOf(value);
6819if (i !== -1) {
6820$item.remove();
6821if ($item.hasClass('active')) {
6822idx = self.$activeItems.indexOf($item[0]);
6823self.$activeItems.splice(idx, 1);
6824}
6825self.items.splice(i, 1);
6826self.lastQuery = null;
6827if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
6828self.removeOption(value, silent);
6829}
6830if (i < self.caretPos) {
6831self.setCaret(self.caretPos - 1);
6832}
6833self.refreshState();
6834self.updatePlaceholder();
6835self.updateOriginalInput({silent: silent});
6836self.positionDropdown();
6837self.trigger('item_remove', value, $item);
6838}
6839},
6840createItem: function(input, triggerDropdown) {
6841var self  = this;
6842var caret = self.caretPos;
6843input = input || $.trim(self.$control_input.val() || '');
6844var callback = arguments[arguments.length - 1];
6845if (typeof callback !== 'function') callback = function() {};
6846if (typeof triggerDropdown !== 'boolean') {
6847triggerDropdown = true;
6848}
6849if (!self.canCreate(input)) {
6850callback();
6851return false;
6852}
6853self.lock();
6854var setup = (typeof self.settings.create === 'function') ? this.settings.create : function(input) {
6855var data = {};
6856data[self.settings.labelField] = input;
6857data[self.settings.valueField] = input;
6858return data;
6859};
6860var create = once(function(data) {
6861self.unlock();
6862if (!data || typeof data !== 'object') return callback();
6863var value = hash_key(data[self.settings.valueField]);
6864if (typeof value !== 'string') return callback();
6865self.setTextboxValue('');
6866self.addOption(data);
6867self.setCaret(caret);
6868self.addItem(value);
6869self.refreshOptions(triggerDropdown && self.settings.mode !== 'single');
6870callback(data);
6871});
6872var output = setup.apply(this, [input, create]);
6873if (typeof output !== 'undefined') {
6874create(output);
6875}
6876return true;
6877},
6878refreshItems: function() {
6879this.lastQuery = null;
6880if (this.isSetup) {
6881this.addItem(this.items);
6882}
6883this.refreshState();
6884this.updateOriginalInput();
6885},
6886refreshState: function() {
6887this.refreshValidityState();
6888this.refreshClasses();
6889},
6890refreshValidityState: function() {
6891if (!this.isRequired) return false;
6892var invalid = !this.items.length;
6893this.isInvalid = invalid;
6894this.$control_input.prop('required', invalid);
6895this.$input.prop('required', !invalid);
6896},
6897refreshClasses: function() {
6898var self     = this;
6899var isFull   = self.isFull();
6900var isLocked = self.isLocked;
6901self.$wrapper
6902.toggleClass('rtl', self.rtl);
6903self.$control
6904.toggleClass('focus', self.isFocused)
6905.toggleClass('disabled', self.isDisabled)
6906.toggleClass('required', self.isRequired)
6907.toggleClass('invalid', self.isInvalid)
6908.toggleClass('locked', isLocked)
6909.toggleClass('full', isFull).toggleClass('not-full', !isFull)
6910.toggleClass('input-active', self.isFocused && !self.isInputHidden)
6911.toggleClass('dropdown-active', self.isOpen)
6912.toggleClass('has-options', !$.isEmptyObject(self.options))
6913.toggleClass('has-items', self.items.length > 0);
6914self.$control_input.data('grow', !isFull && !isLocked);
6915},
6916isFull: function() {
6917return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;
6918},
6919updateOriginalInput: function(opts) {
6920var i, n, options, label, self = this;
6921opts = opts || {};
6922if (self.tagType === TAG_SELECT) {
6923options = [];
6924for (i = 0, n = self.items.length; i < n; i++) {
6925label = self.options[self.items[i]][self.settings.labelField] || '';
6926options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>');
6927}
6928if (!options.length && !this.$input.attr('multiple')) {
6929options.push('<option value="" selected="selected"></option>');
6930}
6931self.$input.html(options.join(''));
6932} else {
6933self.$input.val(self.getValue());
6934self.$input.attr('value',self.$input.val());
6935}
6936if (self.isSetup) {
6937if (!opts.silent) {
6938self.trigger('change', self.$input.val());
6939}
6940}
6941},
6942updatePlaceholder: function() {
6943if (!this.settings.placeholder) return;
6944var $input = this.$control_input;
6945if (this.items.length) {
6946$input.removeAttr('placeholder');
6947} else {
6948$input.attr('placeholder', this.settings.placeholder);
6949}
6950$input.triggerHandler('update', {force: true});
6951},
6952open: function() {
6953var self = this;
6954if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;
6955self.focus();
6956self.isOpen = true;
6957self.refreshState();
6958self.$dropdown.css({visibility: 'hidden', display: 'block'});
6959self.positionDropdown();
6960self.$dropdown.css({visibility: 'visible'});
6961self.trigger('dropdown_open', self.$dropdown);
6962},
6963close: function() {
6964var self = this;
6965var trigger = self.isOpen;
6966if (self.settings.mode === 'single' && self.items.length) {
6967self.hideInput();
6968self.$control_input.blur(); // close keyboard on iOS
6969}
6970self.isOpen = false;
6971self.$dropdown.hide();
6972self.setActiveOption(null);
6973self.refreshState();
6974if (trigger) self.trigger('dropdown_close', self.$dropdown);
6975},
6976positionDropdown: function() {
6977var $control = this.$control;
6978var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();
6979offset.top += $control.outerHeight(true);
6980this.$dropdown.css({
6981width : $control.outerWidth(),
6982top   : offset.top,
6983left  : offset.left
6984});
6985},
6986clear: function(silent) {
6987var self = this;
6988if (!self.items.length) return;
6989self.$control.children(':not(input)').remove();
6990self.items = [];
6991self.lastQuery = null;
6992self.setCaret(0);
6993self.setActiveItem(null);
6994self.updatePlaceholder();
6995self.updateOriginalInput({silent: silent});
6996self.refreshState();
6997self.showInput();
6998self.trigger('clear');
6999},
7000insertAtCaret: function($el) {
7001var caret = Math.min(this.caretPos, this.items.length);
7002if (caret === 0) {
7003this.$control.prepend($el);
7004} else {
7005$(this.$control[0].childNodes[caret]).before($el);
7006}
7007this.setCaret(caret + 1);
7008},
7009deleteSelection: function(e) {
7010var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
7011var self = this;
7012direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
7013selection = getSelection(self.$control_input[0]);
7014if (self.$activeOption && !self.settings.hideSelected) {
7015option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');
7016}
7017values = [];
7018if (self.$activeItems.length) {
7019$tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));
7020caret = self.$control.children(':not(input)').index($tail);
7021if (direction > 0) { caret++; }
7022for (i = 0, n = self.$activeItems.length; i < n; i++) {
7023values.push($(self.$activeItems[i]).attr('data-value'));
7024}
7025if (e) {
7026e.preventDefault();
7027e.stopPropagation();
7028}
7029} else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
7030if (direction < 0 && selection.start === 0 && selection.length === 0) {
7031values.push(self.items[self.caretPos - 1]);
7032} else if (direction > 0 && selection.start === self.$control_input.val().length) {
7033values.push(self.items[self.caretPos]);
7034}
7035}
7036if (!values.length || (typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false)) {
7037return false;
7038}
7039if (typeof caret !== 'undefined') {
7040self.setCaret(caret);
7041}
7042while (values.length) {
7043self.removeItem(values.pop());
7044}
7045self.showInput();
7046self.positionDropdown();
7047self.refreshOptions(true);
7048if (option_select) {
7049$option_select = self.getOption(option_select);
7050if ($option_select.length) {
7051self.setActiveOption($option_select);
7052}
7053}
7054return true;
7055},
7056advanceSelection: function(direction, e) {
7057var tail, selection, idx, valueLength, cursorAtEdge, $tail;
7058var self = this;
7059if (direction === 0) return;
7060if (self.rtl) direction *= -1;
7061tail = direction > 0 ? 'last' : 'first';
7062selection = getSelection(self.$control_input[0]);
7063if (self.isFocused && !self.isInputHidden) {
7064valueLength = self.$control_input.val().length;
7065cursorAtEdge = direction < 0
7066? selection.start === 0 && selection.length === 0
7067: selection.start === valueLength;
7068if (cursorAtEdge && !valueLength) {
7069self.advanceCaret(direction, e);
7070}
7071} else {
7072$tail = self.$control.children('.active:' + tail);
7073if ($tail.length) {
7074idx = self.$control.children(':not(input)').index($tail);
7075self.setActiveItem(null);
7076self.setCaret(direction > 0 ? idx + 1 : idx);
7077}
7078}
7079},
7080advanceCaret: function(direction, e) {
7081var self = this, fn, $adj;
7082if (direction === 0) return;
7083fn = direction > 0 ? 'next' : 'prev';
7084if (self.isShiftDown) {
7085$adj = self.$control_input[fn]();
7086if ($adj.length) {
7087self.hideInput();
7088self.setActiveItem($adj);
7089e && e.preventDefault();
7090}
7091} else {
7092self.setCaret(self.caretPos + direction);
7093}
7094},
7095setCaret: function(i) {
7096var self = this;
7097if (self.settings.mode === 'single') {
7098i = self.items.length;
7099} else {
7100i = Math.max(0, Math.min(self.items.length, i));
7101}
7102if(!self.isPending) {
7103var j, n, fn, $children, $child;
7104$children = self.$control.children(':not(input)');
7105for (j = 0, n = $children.length; j < n; j++) {
7106$child = $($children[j]).detach();
7107if (j <  i) {
7108self.$control_input.before($child);
7109} else {
7110self.$control.append($child);
7111}
7112}
7113}
7114self.caretPos = i;
7115},
7116lock: function() {
7117this.close();
7118this.isLocked = true;
7119this.refreshState();
7120},
7121unlock: function() {
7122this.isLocked = false;
7123this.refreshState();
7124},
7125disable: function() {
7126var self = this;
7127self.$input.prop('disabled', true);
7128self.$control_input.prop('disabled', true).prop('tabindex', -1);
7129self.isDisabled = true;
7130self.lock();
7131},
7132enable: function() {
7133var self = this;
7134self.$input.prop('disabled', false);
7135self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);
7136self.isDisabled = false;
7137self.unlock();
7138},
7139destroy: function() {
7140var self = this;
7141var eventNS = self.eventNS;
7142var revertSettings = self.revertSettings;
7143self.trigger('destroy');
7144self.off();
7145self.$wrapper.remove();
7146self.$dropdown.remove();
7147self.$input
7148.html('')
7149.append(revertSettings.$children)
7150.removeAttr('tabindex')
7151.removeClass('selectized')
7152.attr({tabindex: revertSettings.tabindex})
7153.show();
7154self.$control_input.removeData('grow');
7155self.$input.removeData('selectize');
7156$(window).off(eventNS);
7157$(document).off(eventNS);
7158$(document.body).off(eventNS);
7159delete self.$input[0].selectize;
7160},
7161render: function(templateName, data) {
7162var value, id, label;
7163var html = '';
7164var cache = false;
7165var self = this;
7166var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
7167if (templateName === 'option' || templateName === 'item') {
7168value = hash_key(data[self.settings.valueField]);
7169cache = !!value;
7170}
7171if (cache) {
7172if (!isset(self.renderCache[templateName])) {
7173self.renderCache[templateName] = {};
7174}
7175if (self.renderCache[templateName].hasOwnProperty(value)) {
7176return self.renderCache[templateName][value];
7177}
7178}
7179html = $(self.settings.render[templateName].apply(this, [data, escape_html]));
7180if (templateName === 'option' || templateName === 'option_create') {
7181html.attr('data-selectable', '');
7182}
7183else if (templateName === 'optgroup') {
7184id = data[self.settings.optgroupValueField] || '';
7185html.attr('data-group', id);
7186}
7187if (templateName === 'option' || templateName === 'item') {
7188html.attr('data-value', value || '');
7189}
7190if (cache) {
7191self.renderCache[templateName][value] = html[0];
7192}
7193return html[0];
7194},
7195clearCache: function(templateName) {
7196var self = this;
7197if (typeof templateName === 'undefined') {
7198self.renderCache = {};
7199} else {
7200delete self.renderCache[templateName];
7201}
7202},
7203canCreate: function(input) {
7204var self = this;
7205if (!self.settings.create) return false;
7206var filter = self.settings.createFilter;
7207return input.length
7208&& (typeof filter !== 'function' || filter.apply(self, [input]))
7209&& (typeof filter !== 'string' || new RegExp(filter).test(input))
7210&& (!(filter instanceof RegExp) || filter.test(input));
7211}
7212});
7213Selectize.count = 0;
7214Selectize.defaults = {
7215options: [],
7216optgroups: [],
7217plugins: [],
7218delimiter: ',',
7219splitOn: null, // regexp or string for splitting up values from a paste command
7220persist: true,
7221diacritics: true,
7222create: false,
7223createOnBlur: false,
7224createFilter: null,
7225highlight: true,
7226openOnFocus: true,
7227maxOptions: 1000,
7228maxItems: null,
7229hideSelected: null,
7230addPrecedence: false,
7231selectOnTab: false,
7232preload: false,
7233allowEmptyOption: false,
7234closeAfterSelect: false,
7235scrollDuration: 60,
7236loadThrottle: 300,
7237loadingClass: 'loading',
7238dataAttr: 'data-data',
7239optgroupField: 'optgroup',
7240valueField: 'value',
7241labelField: 'text',
7242optgroupLabelField: 'label',
7243optgroupValueField: 'value',
7244lockOptgroupOrder: false,
7245sortField: '$order',
7246searchField: ['text'],
7247searchConjunction: 'and',
7248mode: null,
7249wrapperClass: 'selectize-control',
7250inputClass: 'selectize-input',
7251dropdownClass: 'selectize-dropdown',
7252dropdownContentClass: 'selectize-dropdown-content',
7253dropdownParent: null,
7254copyClassesToDropdown: true,
7255render: {
7256}
7257};
7258$.fn.selectize = function(settings_user) {
7259var defaults             = $.fn.selectize.defaults;
7260var settings             = $.extend({}, defaults, settings_user);
7261var attr_data            = settings.dataAttr;
7262var field_label          = settings.labelField;
7263var field_value          = settings.valueField;
7264var field_optgroup       = settings.optgroupField;
7265var field_optgroup_label = settings.optgroupLabelField;
7266var field_optgroup_value = settings.optgroupValueField;
7267var init_textbox = function($input, settings_element) {
7268var i, n, values, option;
7269var data_raw = $input.attr(attr_data);
7270if (!data_raw) {
7271var value = $.trim($input.val() || '');
7272if (!settings.allowEmptyOption && !value.length) return;
7273values = value.split(settings.delimiter);
7274for (i = 0, n = values.length; i < n; i++) {
7275option = {};
7276option[field_label] = values[i];
7277option[field_value] = values[i];
7278settings_element.options.push(option);
7279}
7280settings_element.items = values;
7281} else {
7282settings_element.options = JSON.parse(data_raw);
7283for (i = 0, n = settings_element.options.length; i < n; i++) {
7284settings_element.items.push(settings_element.options[i][field_value]);
7285}
7286}
7287};
7288var init_select = function($input, settings_element) {
7289var i, n, tagName, $children, order = 0;
7290var options = settings_element.options;
7291var optionsMap = {};
7292var readData = function($el) {
7293var data = attr_data && $el.attr(attr_data);
7294if (typeof data === 'string' && data.length) {
7295return JSON.parse(data);
7296}
7297return null;
7298};
7299var addOption = function($option, group) {
7300$option = $($option);
7301var value = hash_key($option.val());
7302if (!value && !settings.allowEmptyOption) return;
7303if (optionsMap.hasOwnProperty(value)) {
7304if (group) {
7305var arr = optionsMap[value][field_optgroup];
7306if (!arr) {
7307optionsMap[value][field_optgroup] = group;
7308} else if (!$.isArray(arr)) {
7309optionsMap[value][field_optgroup] = [arr, group];
7310} else {
7311arr.push(group);
7312}
7313}
7314return;
7315}
7316var option             = readData($option) || {};
7317option[field_label]    = option[field_label] || $option.text();
7318option[field_value]    = option[field_value] || value;
7319option[field_optgroup] = option[field_optgroup] || group;
7320optionsMap[value] = option;
7321options.push(option);
7322if ($option.is(':selected')) {
7323settings_element.items.push(value);
7324}
7325};
7326var addGroup = function($optgroup) {
7327var i, n, id, optgroup, $options;
7328$optgroup = $($optgroup);
7329id = $optgroup.attr('label');
7330if (id) {
7331optgroup = readData($optgroup) || {};
7332optgroup[field_optgroup_label] = id;
7333optgroup[field_optgroup_value] = id;
7334settings_element.optgroups.push(optgroup);
7335}
7336$options = $('option', $optgroup);
7337for (i = 0, n = $options.length; i < n; i++) {
7338addOption($options[i], id);
7339}
7340};
7341settings_element.maxItems = $input.attr('multiple') ? null : 1;
7342$children = $input.children();
7343for (i = 0, n = $children.length; i < n; i++) {
7344tagName = $children[i].tagName.toLowerCase();
7345if (tagName === 'optgroup') {
7346addGroup($children[i]);
7347} else if (tagName === 'option') {
7348addOption($children[i]);
7349}
7350}
7351};
7352return this.each(function() {
7353if (this.selectize) return;
7354var instance;
7355var $input = $(this);
7356var tag_name = this.tagName.toLowerCase();
7357var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');
7358if (!placeholder && !settings.allowEmptyOption) {
7359placeholder = $input.children('option[value=""]').text();
7360}
7361var settings_element = {
7362'placeholder' : placeholder,
7363'options'     : [],
7364'optgroups'   : [],
7365'items'       : []
7366};
7367if (tag_name === 'select') {
7368init_select($input, settings_element);
7369} else {
7370init_textbox($input, settings_element);
7371}
7372instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));
7373});
7374};
7375$.fn.selectize.defaults = Selectize.defaults;
7376$.fn.selectize.support = {
7377validity: SUPPORTS_VALIDITY_API
7378};
7379Selectize.define('drag_drop', function(options) {
7380if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');
7381if (this.settings.mode !== 'multi') return;
7382var self = this;
7383self.lock = (function() {
7384var original = self.lock;
7385return function() {
7386var sortable = self.$control.data('sortable');
7387if (sortable) sortable.disable();
7388return original.apply(self, arguments);
7389};
7390})();
7391self.unlock = (function() {
7392var original = self.unlock;
7393return function() {
7394var sortable = self.$control.data('sortable');
7395if (sortable) sortable.enable();
7396return original.apply(self, arguments);
7397};
7398})();
7399self.setup = (function() {
7400var original = self.setup;
7401return function() {
7402original.apply(this, arguments);
7403var $control = self.$control.sortable({
7404items: '[data-value]',
7405forcePlaceholderSize: true,
7406disabled: self.isLocked,
7407start: function(e, ui) {
7408ui.placeholder.css('width', ui.helper.css('width'));
7409$control.css({overflow: 'visible'});
7410},
7411stop: function() {
7412$control.css({overflow: 'hidden'});
7413var active = self.$activeItems ? self.$activeItems.slice() : null;
7414var values = [];
7415$control.children('[data-value]').each(function() {
7416values.push($(this).attr('data-value'));
7417});
7418self.setValue(values);
7419self.setActiveItem(active);
7420}
7421});
7422};
7423})();
7424});
7425Selectize.define('dropdown_header', function(options) {
7426var self = this;
7427options = $.extend({
7428title         : 'Untitled',
7429headerClass   : 'selectize-dropdown-header',
7430titleRowClass : 'selectize-dropdown-header-title',
7431labelClass    : 'selectize-dropdown-header-label',
7432closeClass    : 'selectize-dropdown-header-close',
7433html: function(data) {
7434return (
7435'<div class="' + data.headerClass + '">' +
7436'<div class="' + data.titleRowClass + '">' +
7437'<span class="' + data.labelClass + '">' + data.title + '</span>' +
7438'<a href="javascript:void(0)" class="' + data.closeClass + '">&times;</a>' +
7439'</div>' +
7440'</div>'
7441);
7442}
7443}, options);
7444self.setup = (function() {
7445var original = self.setup;
7446return function() {
7447original.apply(self, arguments);
7448self.$dropdown_header = $(options.html(options));
7449self.$dropdown.prepend(self.$dropdown_header);
7450};
7451})();
7452});
7453Selectize.define('optgroup_columns', function(options) {
7454var self = this;
7455options = $.extend({
7456equalizeWidth  : true,
7457equalizeHeight : true
7458}, options);
7459this.getAdjacentOption = function($option, direction) {
7460var $options = $option.closest('[data-group]').find('[data-selectable]');
7461var index    = $options.index($option) + direction;
7462return index >= 0 && index < $options.length ? $options.eq(index) : $();
7463};
7464this.onKeyDown = (function() {
7465var original = self.onKeyDown;
7466return function(e) {
7467var index, $option, $options, $optgroup;
7468if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {
7469self.ignoreHover = true;
7470$optgroup = this.$activeOption.closest('[data-group]');
7471index = $optgroup.find('[data-selectable]').index(this.$activeOption);
7472if(e.keyCode === KEY_LEFT) {
7473$optgroup = $optgroup.prev('[data-group]');
7474} else {
7475$optgroup = $optgroup.next('[data-group]');
7476}
7477$options = $optgroup.find('[data-selectable]');
7478$option  = $options.eq(Math.min($options.length - 1, index));
7479if ($option.length) {
7480this.setActiveOption($option);
7481}
7482return;
7483}
7484return original.apply(this, arguments);
7485};
7486})();
7487var getScrollbarWidth = function() {
7488var div;
7489var width = getScrollbarWidth.width;
7490var doc = document;
7491if (typeof width === 'undefined') {
7492div = doc.createElement('div');
7493div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>';
7494div = div.firstChild;
7495doc.body.appendChild(div);
7496width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;
7497doc.body.removeChild(div);
7498}
7499return width;
7500};
7501var equalizeSizes = function() {
7502var i, n, height_max, width, width_last, width_parent, $optgroups;
7503$optgroups = $('[data-group]', self.$dropdown_content);
7504n = $optgroups.length;
7505if (!n || !self.$dropdown_content.width()) return;
7506if (options.equalizeHeight) {
7507height_max = 0;
7508for (i = 0; i < n; i++) {
7509height_max = Math.max(height_max, $optgroups.eq(i).height());
7510}
7511$optgroups.css({height: height_max});
7512}
7513if (options.equalizeWidth) {
7514width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();
7515width = Math.round(width_parent / n);
7516$optgroups.css({width: width});
7517if (n > 1) {
7518width_last = width_parent - width * (n - 1);
7519$optgroups.eq(n - 1).css({width: width_last});
7520}
7521}
7522};
7523if (options.equalizeHeight || options.equalizeWidth) {
7524hook.after(this, 'positionDropdown', equalizeSizes);
7525hook.after(this, 'refreshOptions', equalizeSizes);
7526}
7527});
7528Selectize.define('remove_button', function(options) {
7529options = $.extend({
7530label     : '&times;',
7531title     : 'Remove',
7532className : 'remove',
7533append    : true
7534}, options);
7535var singleClose = function(thisRef, options) {
7536options.className = 'remove-single';
7537var self = thisRef;
7538var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
7539var append = function(html_container, html_element) {
7540return html_container + html_element;
7541};
7542thisRef.setup = (function() {
7543var original = self.setup;
7544return function() {
7545if (options.append) {
7546var id = $(self.$input.context).attr('id');
7547var selectizer = $('#'+id);
7548var render_item = self.settings.render.item;
7549self.settings.render.item = function(data) {
7550return append(render_item.apply(thisRef, arguments), html);
7551};
7552}
7553original.apply(thisRef, arguments);
7554thisRef.$control.on('click', '.' + options.className, function(e) {
7555e.preventDefault();
7556if (self.isLocked) return;
7557self.clear();
7558});
7559};
7560})();
7561};
7562var multiClose = function(thisRef, options) {
7563var self = thisRef;
7564var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
7565var append = function(html_container, html_element) {
7566var pos = html_container.search(/(<\/[^>]+>\s*)$/);
7567return html_container.substring(0, pos) + html_element + html_container.substring(pos);
7568};
7569thisRef.setup = (function() {
7570var original = self.setup;
7571return function() {
7572if (options.append) {
7573var render_item = self.settings.render.item;
7574self.settings.render.item = function(data) {
7575return append(render_item.apply(thisRef, arguments), html);
7576};
7577}
7578original.apply(thisRef, arguments);
7579thisRef.$control.on('click', '.' + options.className, function(e) {
7580e.preventDefault();
7581if (self.isLocked) return;
7582var $item = $(e.currentTarget).parent();
7583self.setActiveItem($item);
7584if (self.deleteSelection()) {
7585self.setCaret(self.items.length);
7586}
7587});
7588};
7589})();
7590};
7591if (this.settings.mode === 'single') {
7592singleClose(this, options);
7593return;
7594} else {
7595multiClose(this, options);
7596}
7597});
7598Selectize.define('restore_on_backspace', function(options) {
7599var self = this;
7600options.text = options.text || function(option) {
7601return option[this.settings.labelField];
7602};
7603this.onKeyDown = (function() {
7604var original = self.onKeyDown;
7605return function(e) {
7606var index, option;
7607if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {
7608index = this.caretPos - 1;
7609if (index >= 0 && index < this.items.length) {
7610option = this.options[this.items[index]];
7611if (this.deleteSelection(e)) {
7612this.setTextboxValue(options.text.apply(this, [option]));
7613this.refreshOptions(true);
7614}
7615e.preventDefault();
7616return;
7617}
7618}
7619return original.apply(this, arguments);
7620};
7621})();
7622});
7623return Selectize;
7624}));
7625!function(a,b){"function"==typeof define&&define.amd?define(["jquery","sifter","microplugin"],b):"object"==typeof exports?module.exports=b(require("jquery"),require("sifter"),require("microplugin")):a.Selectize=b(a.jQuery,a.Sifter,a.MicroPlugin)}(this,function(a,b,c){"use strict";var d=function(a,b){if("string"!=typeof b||b.length){var c="string"==typeof b?new RegExp(b,"i"):b,d=function(a){var b=0;if(3===a.nodeType){var e=a.data.search(c);if(e>=0&&a.data.length>0){var f=a.data.match(c),g=document.createElement("span");g.className="highlight";var h=a.splitText(e),i=(h.splitText(f[0].length),h.cloneNode(!0));g.appendChild(i),h.parentNode.replaceChild(g,h),b=1}}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName))for(var j=0;j<a.childNodes.length;++j)j+=d(a.childNodes[j]);return b};return a.each(function(){d(this)})}};a.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;var a=this.parentNode;a.replaceChild(this.firstChild,this),a.normalize()}).end()};var e=function(){};e.prototype={on:function(a,b){this._events=this._events||{},this._events[a]=this._events[a]||[],this._events[a].push(b)},off:function(a,b){var c=arguments.length;return 0===c?delete this._events:1===c?delete this._events[a]:(this._events=this._events||{},void(a in this._events!=!1&&this._events[a].splice(this._events[a].indexOf(b),1)))}
7625,trigger:function(a){if(this._events=this._events||{},a in this._events!=!1)for(var b=0;b<this._events[a].length;b++)this._events[a][b].apply(this,Array.prototype.slice.call(arguments,1))}},e.mixin=function(a){for(var b=["on","off","trigger"],c=0;c<b.length;c++)a.prototype[b[c]]=e.prototype[b[c]]};var f=/Mac/.test(navigator.userAgent),g=65,h=13,i=27,j=37,k=38,l=80,m=39,n=40,o=78,p=8,q=46,r=16,s=f?91:17,t=f?18:17,u=9,v=1,w=2,x=!/android/i.test(window.navigator.userAgent)&&!!document.createElement("input").validity,y=function(a){return"undefined"!=typeof a},z=function(a){return"undefined"==typeof a||null===a?null:"boolean"==typeof a?a?"1":"0":a+""},A=function(a){return(a+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},B={};B.before=function(a,b,c){var d=a[b];a[b]=function(){return c.apply(a,arguments),d.apply(a,arguments)}},B.after=function(a,b,c){var d=a[b];a[b]=function(){var b=d.apply(a,arguments);return c.apply(a,arguments),b}};var C=function(a){var b=!1;return function(){b||(b=!0,a.apply(this,arguments))}},D=function(a,b){var c;return function(){var d=this,e=arguments;window.clearTimeout(c),c=window.setTimeout(function(){a.apply(d,e)},b)}},E=function(a,b,c){var d,e=a.trigger,f={};a.trigger=function(){var c=arguments[0];return b.indexOf(c)===-1?e.apply(a,arguments):void(f[c]=arguments)},c.apply(a,[]),a.trigger=e;for(d in f)f.hasOwnProperty(d)&&e.apply(a,f[d])},F=function(a,b,c,d){a.on(b,c,function(b){for(var c=b.target;c&&c.parentNode!==a[0];)c=c.parentNode;return b.currentTarget=c,d.apply(this,[b])})},G=function(a){var b={};if("selectionStart"in a)b.start=a.selectionStart,b.length=a.selectionEnd-b.start;else if(document.selection){a.focus();var c=document.selection.createRange(),d=document.selection.createRange().text.length;c.moveStart("character",-a.value.length),b.start=c.text.length-d,b.length=d}return b},H=function(a,b,c){var d,e,f={};if(c)for(d=0,e=c.length;d<e;d++)f[c[d]]=a.css(c[d]);else f=a.css();b.css(f)},I=function(b,c){if(!b)return 0;var d=a("<test>").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(b).appendTo("body");H(c,d,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]);var e=d.width();return d.remove(),e},J=function(a){var b=null,c=function(c,d){var e,f,g,h,i,j,k,l;c=c||window.event||{},d=d||{},c.metaKey||c.altKey||(d.force||a.data("grow")!==!1)&&(e=a.val(),c.type&&"keydown"===c.type.toLowerCase()&&(f=c.keyCode,g=f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||32===f,f===q||f===p?(l=G(a[0]),l.length?e=e.substring(0,l.start)+e.substring(l.start+l.length):f===p&&l.start?e=e.substring(0,l.start-1)+e.substring(l.start+1):f===q&&"undefined"!=typeof l.start&&(e=e.substring(0,l.start)+e.substring(l.start+1))):g&&(j=c.shiftKey,k=String.fromCharCode(c.keyCode),k=j?k.toUpperCase():k.toLowerCase(),e+=k)),h=a.attr("placeholder"),!e&&h&&(e=h),i=I(e,a)+4,i!==b&&(b=i,a.width(i),a.triggerHandler("resize")))};a.on("keydown keyup update blur",c),c()},K=function(a){var b=document.createElement("div");return b.appendChild(a.cloneNode(!0)),b.innerHTML},L=function(a,b){b||(b={});var c="Selectize";console.error(c+": "+a),b.explanation&&(console.group&&console.group(),console.error(b.explanation),console.group&&console.groupEnd())},M=function(c,d){var e,f,g,h,i=this;h=c[0],h.selectize=i;var j=window.getComputedStyle&&window.getComputedStyle(h,null);if(g=j?j.getPropertyValue("direction"):h.currentStyle&&h.currentStyle.direction,g=g||c.parents("[dir]:first").attr("dir")||"",a.extend(i,{order:0,settings:d,$input:c,tabIndex:c.attr("tabindex")||"",tagType:"select"===h.tagName.toLowerCase()?v:w,rtl:/rtl/i.test(g),eventNS:".selectize"+ ++M.count,highlightedValue:null,isOpen:!1,isDisabled:!1,isRequired:c.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreBlur:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:null===d.loadThrottle?i.onSearchChange:D(i.onSearchChange,d.loadThrottle)}),i.sifter=new b(this.options,{diacritics:d.diacritics}),i.settings.options){for(e=0,f=i.settings.options.length;e<f;e++)i.registerOption(i.settings.options[e]);delete i.settings.options}if(i.settings.optgroups){for(e=0,f=i.settings.optgroups.length;e<f;e++)i.registerOptionGroup(i.settings.optgroups[e]);delete i.settings.optgroups}i.settings.mode=i.settings.mode||(1===i.settings.maxItems?"single":"multi"),"boolean"!=typeof i.settings.hideSelected&&(i.settings.hideSelected="multi"===i.settings.mode),i.initializePlugins(i.settings.plugins),i.setupCallbacks(),i.setupTemplates(),i.setup()};return e.mixin(M),"undefined"!=typeof c?c.mixin(M):L("Dependency MicroPlugin is missing",{explanation:'Make sure you either: (1) are using the "standalone" version of Selectize, or (2) require MicroPlugin before you load Selectize.'}),a.extend(M.prototype,{setup:function(){var b,c,d,e,g,h,i,j,k,l,m=this,n=m.settings,o=m.eventNS,p=a(window),q=a(document),u=m.$input;if(i=m.settings.mode,j=u.attr("class")||"",b=a("<div>").addClass(n.wrapperClass).addClass(j).addClass(i),c=a("<div>").addClass(n.inputClass).addClass("items").appendTo(b),d=a('<input type="text" autocomplete="off" />').appendTo(c).attr("tabindex",u.is(":disabled")?"-1":m.tabIndex),h=a(n.dropdownParent||b),e=a("<div>").addClass(n.dropdownClass).addClass(i).hide().appendTo(h),g=a("<div>").addClass(n.dropdownContentClass).appendTo(e),(l=u.attr("id"))&&(d.attr("id",l+"-selectized"),a("label[for='"+l+"']").attr("for",l+"-selectized")),m.settings.copyClassesToDropdown&&e.addClass(j),b.css({width:u[0].style.width}),m.plugins.names.length&&(k="plugin-"+m.plugins.names.join(" plugin-"),b.addClass(k),e.addClass(k)),(null===n.maxItems||n.maxItems>1)&&m.tagType===v&&u.attr("multiple","multiple"),m.settings.placeholder&&d.attr("placeholder",n.placeholder),!m.settings.splitOn&&m.settings.delimiter){var w=m.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");m.settings.splitOn=new RegExp("\\s*"+w+"+\\s*")}u.attr("autocorrect")&&d.attr("autocorrect",u.attr("autocorrect")),u.attr("autocapitalize")&&d.attr("autocapitalize",u.attr("autocapitalize")),m.$wrapper=b,m.$control=c,m.$control_input=d,m.$dropdown=e,m.$dropdown_content=g,e.on("mouseenter","[data-selectable]",function(){return m.onOptionHover.apply(m,arguments)}),e.on("mousedown click","[data-selectable]",function(){return m.onOptionSelect.apply(m,arguments)}),F(c,"mousedown","*:not(input)",function(){return m.onItemSelect.apply(m,arguments)}),J(d),c.on({mousedown:function(){return m.onMouseDown.apply(m,arguments)},click:function(){return m.onClick.apply(m,arguments)}}),d.on({mousedown:function(a){a.stopPropagation()},keydown:function(){return m.onKeyDown.apply(m,arguments)},keyup:function(){return m.onKeyUp.apply(m,arguments)},keypress:function(){return m.onKeyPress.apply(m,arguments)},resize:function(){m.positionDropdown.apply(m,[])},blur:function(){return m.onBlur.apply(m,arguments)}
7625,focus:function(){return m.ignoreBlur=!1,m.onFocus.apply(m,arguments)},paste:function(){return m.onPaste.apply(m,arguments)}}),q.on("keydown"+o,function(a){m.isCmdDown=a[f?"metaKey":"ctrlKey"],m.isCtrlDown=a[f?"altKey":"ctrlKey"],m.isShiftDown=a.shiftKey}),q.on("keyup"+o,function(a){a.keyCode===t&&(m.isCtrlDown=!1),a.keyCode===r&&(m.isShiftDown=!1),a.keyCode===s&&(m.isCmdDown=!1)}),q.on("mousedown"+o,function(a){if(m.isFocused){if(a.target===m.$dropdown[0]||a.target.parentNode===m.$dropdown[0])return!1;m.$control.has(a.target).length||a.target===m.$control[0]||m.blur(a.target)}}),p.on(["scroll"+o,"resize"+o].join(" "),function(){m.isOpen&&m.positionDropdown.apply(m,arguments)}),p.on("mousemove"+o,function(){m.ignoreHover=!1}),this.revertSettings={$children:u.children().detach(),tabindex:u.attr("tabindex")},u.attr("tabindex",-1).hide().after(m.$wrapper),a.isArray(n.items)&&(m.setValue(n.items),delete n.items),x&&u.on("invalid"+o,function(a){a.preventDefault(),m.isInvalid=!0,m.refreshState()}),m.updateOriginalInput(),m.refreshItems(),m.refreshState(),m.updatePlaceholder(),m.isSetup=!0,u.is(":disabled")&&m.disable(),m.on("change",this.onChange),u.data("selectize",m),u.addClass("selectized"),m.trigger("initialize"),n.preload===!0&&m.onSearchChange("")},setupTemplates:function(){var b=this,c=b.settings.labelField,d=b.settings.optgroupLabelField,e={optgroup:function(a){return'<div class="optgroup">'+a.html+"</div>"},optgroup_header:function(a,b){return'<div class="optgroup-header">'+b(a[d])+"</div>"},option:function(a,b){return'<div class="option">'+b(a[c])+"</div>"},item:function(a,b){return'<div class="item">'+b(a[c])+"</div>"},option_create:function(a,b){return'<div class="create">Add <strong>'+b(a.input)+"</strong>&hellip;</div>"}};b.settings.render=a.extend({},e,b.settings.render)},setupCallbacks:function(){var a,b,c={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(a in c)c.hasOwnProperty(a)&&(b=this.settings[c[a]],b&&this.on(a,b))},onClick:function(a){var b=this;b.isFocused||(b.focus(),a.preventDefault())},onMouseDown:function(b){var c=this,d=b.isDefaultPrevented();a(b.target);if(c.isFocused){if(b.target!==c.$control_input[0])return"single"===c.settings.mode?c.isOpen?c.close():c.open():d||c.setActiveItem(null),!1}else d||window.setTimeout(function(){c.focus()},0)},onChange:function(){this.$input.trigger("change")},onPaste:function(b){var c=this;return c.isFull()||c.isInputHidden||c.isLocked?void b.preventDefault():void(c.settings.splitOn&&setTimeout(function(){var b=c.$control_input.val();if(b.match(c.settings.splitOn))for(var d=a.trim(b).split(c.settings.splitOn),e=0,f=d.length;e<f;e++)c.createItem(d[e])},0))},onKeyPress:function(a){if(this.isLocked)return a&&a.preventDefault();var b=String.fromCharCode(a.keyCode||a.which);return this.settings.create&&"multi"===this.settings.mode&&b===this.settings.delimiter?(this.createItem(),a.preventDefault(),!1):void 0},onKeyDown:function(a){var b=(a.target===this.$control_input[0],this);if(b.isLocked)return void(a.keyCode!==u&&a.preventDefault());switch(a.keyCode){case g:if(b.isCmdDown)return void b.selectAll();break;case i:return void(b.isOpen&&(a.preventDefault(),a.stopPropagation(),b.close()));case o:if(!a.ctrlKey||a.altKey)break;case n:if(!b.isOpen&&b.hasOptions)b.open();else if(b.$activeOption){b.ignoreHover=!0;var c=b.getAdjacentOption(b.$activeOption,1);
7625c.length&&b.setActiveOption(c,!0,!0)}return void a.preventDefault();case l:if(!a.ctrlKey||a.altKey)break;case k:if(b.$activeOption){b.ignoreHover=!0;var d=b.getAdjacentOption(b.$activeOption,-1);d.length&&b.setActiveOption(d,!0,!0)}return void a.preventDefault();case h:return void(b.isOpen&&b.$activeOption&&(b.onOptionSelect({currentTarget:b.$activeOption}),a.preventDefault()));case j:return void b.advanceSelection(-1,a);case m:return void b.advanceSelection(1,a);case u:return b.settings.selectOnTab&&b.isOpen&&b.$activeOption&&(b.onOptionSelect({currentTarget:b.$activeOption}),b.isFull()||a.preventDefault()),void(b.settings.create&&b.createItem()&&a.preventDefault());case p:case q:return void b.deleteSelection(a)}return!b.isFull()&&!b.isInputHidden||(f?a.metaKey:a.ctrlKey)?void 0:void a.preventDefault()},onKeyUp:function(a){var b=this;if(b.isLocked)return a&&a.preventDefault();var c=b.$control_input.val()||"";b.lastValue!==c&&(b.lastValue=c,b.onSearchChange(c),b.refreshOptions(),b.trigger("type",c))},onSearchChange:function(a){var b=this,c=b.settings.load;c&&(b.loadedSearches.hasOwnProperty(a)||(b.loadedSearches[a]=!0,b.load(function(d){c.apply(b,[a,d])})))},onFocus:function(a){var b=this,c=b.isFocused;return b.isDisabled?(b.blur(),a&&a.preventDefault(),!1):void(b.ignoreFocus||(b.isFocused=!0,"focus"===b.settings.preload&&b.onSearchChange(""),c||b.trigger("focus"),b.$activeItems.length||(b.showInput(),b.setActiveItem(null),b.refreshOptions(!!b.settings.openOnFocus)),b.refreshState()))},onBlur:function(a,b){var c=this;if(c.isFocused&&(c.isFocused=!1,!c.ignoreFocus)){if(!c.ignoreBlur&&document.activeElement===c.$dropdown_content[0])return c.ignoreBlur=!0,void c.onFocus(a);var d=function(){c.close(),c.setTextboxValue(""),c.setActiveItem(null),c.setActiveOption(null),c.setCaret(c.items.length),c.refreshState(),b&&b.focus&&b.focus(),c.ignoreFocus=!1,c.trigger("blur")};c.ignoreFocus=!0,c.settings.create&&c.settings.createOnBlur?c.createItem(null,!1,d):d()}},onOptionHover:function(a){this.ignoreHover||this.setActiveOption(a.currentTarget,!1)},onOptionSelect:function(b){var c,d,e=this;b.preventDefault&&(b.preventDefault(),b.stopPropagation()),d=a(b.currentTarget),d.hasClass("create")?e.createItem(null,function(){e.settings.closeAfterSelect&&e.close()}):(c=d.attr("data-value"),"undefined"!=typeof c&&(e.lastQuery=null,e.setTextboxValue(""),e.addItem(c),e.settings.closeAfterSelect?e.close():!e.settings.hideSelected&&b.type&&/mouse/.test(b.type)&&e.setActiveOption(e.getOption(c))))},onItemSelect:function(a){var b=this;b.isLocked||"multi"===b.settings.mode&&(a.preventDefault(),b.setActiveItem(a.currentTarget,a))},load:function(a){var b=this,c=b.$wrapper.addClass(b.settings.loadingClass);b.loading++,a.apply(b,[function(a){b.loading=Math.max(b.loading-1,0),a&&a.length&&(b.addOption(a),b.refreshOptions(b.isFocused&&!b.isInputHidden)),b.loading||c.removeClass(b.settings.loadingClass),b.trigger("load",a)}])},setTextboxValue:function(a){var b=this.$control_input,c=b.val()!==a;c&&(b.val(a).triggerHandler("update"),this.lastValue=a)},getValue:function(){return this.tagType===v&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(a,b){var c=b?[]:["change"];E(this,c,function(){this.clear(b),this.addItems(a,b)})},setActiveItem:function(b,c){var d,e,f,g,h,i,j,k,l=this;if("single"!==l.settings.mode){if(b=a(b),!b.length)return a(l.$activeItems).removeClass("active"),l.$activeItems=[],void(l.isFocused&&l.showInput());if(d=c&&c.type.toLowerCase(),"mousedown"===d&&l.isShiftDown&&l.$activeItems.length){for(k=l.$control.children(".active:last"),g=Array.prototype.indexOf.apply(l.$control[0].childNodes,[k[0]]),h=Array.prototype.indexOf.apply(l.$control[0].childNodes,[b[0]]),g>h&&(j=g,g=h,h=j),e=g;e<=h;e++)i=l.$control[0].childNodes[e],l.$activeItems.indexOf(i)===-1&&(a(i).addClass("active"),l.$activeItems.push(i));c.preventDefault()}else"mousedown"===d&&l.isCtrlDown||"keydown"===d&&this.isShiftDown?b.hasClass("active")?(f=l.$activeItems.indexOf(b[0]),l.$activeItems.splice(f,1),b.removeClass("active")):l.$activeItems.push(b.addClass("active")[0]):(a(l.$activeItems).removeClass("active"),l.$activeItems=[b.addClass("active")[0]]);l.hideInput(),this.isFocused||l.focus()}}
vendor: 1,323 bytes, line 7625
7625,setActiveOption:function(b,c,d){var e,f,g,h,i,j=this;j.$activeOption&&j.$activeOption.removeClass("active"),j.$activeOption=null,b=a(b),b.length&&(j.$activeOption=b.addClass("active"),!c&&y(c)||(e=j.$dropdown_content.height(),f=j.$activeOption.outerHeight(!0),c=j.$dropdown_content.scrollTop()||0,g=j.$activeOption.offset().top-j.$dropdown_content.offset().top+c,h=g,i=g-e+f,g+f>e+c?j.$dropdown_content.stop().animate({scrollTop:i},d?j.settings.scrollDuration:0):g<c&&j.$dropdown_content.stop().animate({scrollTop:h},d?j.settings.scrollDuration:0)))},selectAll:function(){var a=this;"single"!==a.settings.mode&&(a.$activeItems=Array.prototype.slice.apply(a.$control.children(":not(input)").addClass("active")),a.$activeItems.length&&(a.hideInput(),a.close()),a.focus())},hideInput:function(){var a=this;a.setTextboxValue(""),a.$control_input.css({opacity:0,position:"absolute",left:a.rtl?1e4:-1e4}),a.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var a=this;a.isDisabled||(a.ignoreFocus=!0,a.$control_input[0].focus(),window.setTimeout(function(){a.ignoreFocus=!1,a.onFocus()},0))},blur:function(a){this.$control_input[0].blur(),this.onBlur(null,a)},getScoreFunction:function(a){return this.sifter.getScoreFunction(a,this.get
7625SearchOptions())},getSearchOptions:function(){var a=this.settings,b=a.sortField;return"string"==typeof b&&(b=[{field:b}]),{fields:a.searchField,conjunction:a.searchConjunction,sort:b}},search:function(b){var c,d,e,f=this,g=f.settings,h=this.getSearchOptions();if(g.score&&(e=f.settings.score.apply(this,[b]),"function"!=typeof e))throw new Error('Selectize "score" setting must be a function that returns a function');if(b!==f.lastQuery?(f.lastQuery=b,d=f.sifter.search(b,a.extend(h,{score:e})),f.currentResults=d):d=a.extend(!0,{},f.currentResults),g.hideSelected)for(c=d.items.length-1;c>=0;c--)f.items.indexOf(z(d.items[c].id))!==-1&&d.items.splice(c,1);return d},refreshOptions:function(b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;"undefined"==typeof b&&(b=!0);var t=this,u=a.trim(t.$control_input.val()),v=t.search(u),w=t.$dropdown_content,x=t.$activeOption&&z(t.$activeOption.attr("data-value"));for(g=v.items.length,"number"==typeof t.settings.maxOptions&&(g=Math.min(g,t.settings.maxOptions)),h={},i=[],c=0;c<g;c++)for(j=t.options[v.items[c].id],k=t.render("option",j),l=j[t.settings.optgroupField]||"",m=a.isArray(l)?l:[l],e=0,f=m&&m.length;e<f;e++)l=m[e],t.optgroups.hasOwnProperty(l)||(l=""),h.hasOwnProperty(l)||(h[l]=document.createDocumentFragment(),i.push(l)),h[l].appendChild(k);for(this.settings.lockOptgroupOrder&&i.sort(function(a,b){var c=t.optgroups[a].$order||0,d=t.optgroups[b].$order||0;return c-d}),n=document.createDocumentFragment(),c=0,g=i.length;c<g;c++)l=i[c],t.optgroups.hasOwnProperty(l)&&h[l].childNodes.length?(o=document.createDocumentFragment(),o.appendChild(t.render("optgroup_header",t.optgroups[l])),o.appendChild(h[l]),n.appendChild(t.render("optgroup",a.extend({},t.optgroups[l],{html:K(o),dom:o})))):n.appendChild(h[l]);if(w.html(n),t.settings.highlight&&v.query.length&&v.tokens.length)for(w.removeHighlight(),c=0,g=v.tokens.length;c<g;c++)d(w,v.tokens[c].regex);if(!t.settings.hideSelected)for(c=0,g=t.items.length;c<g;c++)t.getOption(t.items[c]).addClass("selected");p=t.canCreate(u),p&&(w.prepend(t.render("option_create",{input:u})),s=a(w[0].childNodes[0])),t.hasOptions=v.items.length>0||p,t.hasOptions?(v.items.length>0?(r=x&&t.getOption(x),r&&r.length?q=r:"single"===t.settings.mode&&t.items.length&&(q=t.getOption(t.items[0])),q&&q.length||(q=s&&!t.settings.addPrecedence?t.getAdjacentOption(s,1):w.find("[data-selectable]:first"))):q=s,t.setActiveOption(q),b&&!t.isOpen&&t.open()):(t.setActiveOption(null),b&&t.isOpen&&t.close())},addOption:function(b){var c,d,e,f=this;if(a.isArray(b))for(c=0,d=b.length;c<d;c++)f.addOption(b[c]);else(e=f.registerOption(b))&&(f.userOptions[e]=!0,f.lastQuery=null,f.trigger("option_add",e,b))},registerOption:function(a){var b=z(a[this.settings.valueField]);return"undefined"!=typeof b&&null!==b&&!this.options.hasOwnProperty(b)&&(a.$order=a.$order||++this.order,this.options[b]=a,b)},registerOptionGroup:function(a){var b=z(a[this.settings.optgroupValueField]);return!!b&&(a.$order=a.$order||++this.order,this.optgroups[b]=a,b)},addOptionGroup:function(a,b){b[this.settings.optgroupValueField]=a,(a=this.registerOptionGroup(b))&&this.trigger("optgroup_add",a,b)},removeOptionGroup:function(a){this.optgroups.hasOwnProperty(a)&&(delete this.optgroups[a],this.renderCache={},this.trigger("optgroup_remove",a))},clearOptionGroups:function(){this.optgroups={},this.renderCache={},this.trigger("optgroup_clear")},updateOption:function(b,c){var d,e,f,g,h,i,j,k=this;if(b=z(b),f=z(c[k.settings.valueField]),null!==b&&k.options.hasOwnProperty(b)){if("string"!=typeof f)throw new Error("Value must be set in option data");j=k.options[b].$order,f!==b&&(delete k.options[b],g=k.items.indexOf(b),g!==-1&&k.items.splice(g,1,f)),c.$order=c.$order||j,k.options[f]=c,h=k.renderCache.item,i=k.renderCache.option,h&&(delete h[b],delete h[f]),i&&(delete i[b],delete i[f]),k.items.indexOf(f)!==-1&&(d=k.getItem(b),e=a(k.render("item",c)),d.hasClass("active")&&e.addClass("active"),d.replaceWith(e)),k.lastQuery=null,k.isOpen&&k.refreshOptions(!1)}},removeOption:function(a,b){var c=this;a=z(a);var d=c.renderCache.item,e=c.renderCache.option;d&&delete d[a],e&&delete e[a],delete c.userOptions[a],delete c.options[a],c.lastQuery=null,c.trigger("option_remove",a),c.removeItem(a,b)},clearOptions:function(){var a=this;a.loadedSearches={},a.userOptions={},a.renderCache={},a.options=a.sifter.items={},a.lastQuery=null,a.trigger("option_clear"),a.clear()},getOption:function(a){return this.getElementWithValue(a,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(b,c){var d=this.$dropdown.find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},getElementWithValue:function(b,c){if(b=z(b),"undefined"!=typeof b&&null!==b)for(var d=0,e=c.length;d<e;d++)if(c[d].getAttribute("data-value")===b)return a(c[d]);return a()},getItem:function(a){return this.getElementWithValue(a,this.$control.children())},addItems:function(b,c){for(var d=a.isArray(b)?b:[b],e=0,f=d.length;e<f;e++)this.isPending=e<f-1,this.addItem(d[e],c)},addItem:function(b,c){var d=c?[]:["change"];E(this,d,function(){var d,e,f,g,h,i=this,j=i.settings.mode;return b=z(b),i.items.indexOf(b)!==-1?void("single"===j&&i.close()):void(i.options.hasOwnProperty(b)&&("single"===j&&i.clear(c),"multi"===j&&i.isFull()||(d=a(i.render("item",i.options[b])),h=i.isFull(),i.items.splice(i.caretPos,0,b),i.insertAtCaret(d
vendor: 12,870 bytes, lines 7625-7626
7625),(!i.isPending||!h&&i.isFull())&&i.refreshState(),i.isSetup&&(f=i.$dropdown_content.find("[data-selectable]"),i.isPending||(e=i.getOption(b),g=i.getAdjacentOption(e,1).attr("data-value"),i.refreshOptions(i.isFocused&&"single"!==j),g&&i.setActiveOption(i.getOption(g))),!f.length||i.isFull()?i.close():i.positionDropdown(),i.updatePlaceholder(),i.trigger("item_add",b,d),i.updateOriginalInput({silent:c})))))})},removeItem:function(b,c){var d,e,f,g=this;d=b instanceof a?b:g.getItem(b),b=z(d.attr("data-value")),e=g.items.indexOf(b),e!==-1&&(d.remove(),d.hasClass("active")&&(f=g.$activeItems.indexOf(d[0]),g.$activeItems.splice(f,1)),g.items.splice(e,1),g.lastQuery=null,!g.settings.persist&&g.userOptions.hasOwnProperty(b)&&g.removeOption(b,c),e<g.caretPos&&g.setCaret(g.caretPos-1),g.refreshState(),g.updatePlaceholder(),g.updateOriginalInput({silent:c}),g.positionDropdown(),g.trigger("item_remove",b,d))},createItem:function(b,c){var d=this,e=d.caretPos;b=b||a.trim(d.$control_input.val()||"");var f=arguments[arguments.length-1];if("function"!=typeof f&&(f=function(){}),"boolean"!=typeof c&&(c=!0),!d.canCreate(b))return f(),!1;d.lock();var g="function"==typeof d.settings.create?this.settings.create:function(a){var b={};return b[d.settings.labelField]=a,b[d.settings.valueField]=a,b},h=C(function(a){if(d.unlock(),!a||"object"!=typeof a)return f();var b=z(a[d.settings.valueField]);return"string"!=typeof b?f():(d.setTextboxValue(""),d.addOption(a),d.setCaret(e),d.addItem(b),d.refreshOptions(c&&"single"!==d.settings.mode),void f(a))}),i=g.apply(this,[b,h]);return"undefined"!=typeof i&&h(i),!0},refreshItems:function(){this.lastQuery=null,this.isSetup&&this.addItem(this.items),this.refreshState(),this.updateOriginalInput()},refreshState:function(){this.refreshValidityState(),this.refreshClasses()},refreshValidityState:function(){if(!this.isRequired)return!1;var a=!this.items.length;this.isInvalid=a,this.$control_input.prop("required",a),this.$input.prop("required",!a)},refreshClasses:function(){var b=this,c=b.isFull(),d=b.isLocked;b.$wrapper.toggleClass("rtl",b.rtl),b.$control.toggleClass("focus",b.isFocused).toggleClass("disabled",b.isDisabled).toggleClass("required",b.isRequired).toggleClass("invalid",b.isInvalid).toggleClass("locked",d).toggleClass("full",c).toggleClass("not-full",!c).toggleClass("input-active",b.isFocused&&!b.isInputHidden).toggleClass("dropdown-active",b.isOpen).toggleClass("has-options",!a.isEmptyObject(b.options)).toggleClass("has-items",b.items.length>0),b.$control_input.data("grow",!c&&!d)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(a){var b,c,d,e,f=this;if(a=a||{},f.tagType===v){for(d=[],b=0,c=f.items.length;b<c;b++)e=f.options[f.items[b]][f.settings.labelField]||"",d.push('<option value="'+A(f.items[b])+'" selected="selected">'+A(e)+"</option>");d.length||this.$input.attr("multiple")||d.push('<option value="" selected="selected"></option>'),f.$input.html(d.join(""))}else f.$input.val(f.getValue()),f.$input.attr("value",f.$input.val());f.isSetup&&(a.silent||f.trigger("change",f.$input.val()))},updatePlaceholder:function(){if(this.settings.placeholder){var a=this.$control_input;this.items.length?a.removeAttr("placeholder"):a.attr("placeholder",this.settings.placeholder),a.triggerHandler("update",{force:!0})}},open:function(){var a=this;a.isLocked||a.isOpen||"multi"===a.settings.mode&&a.isFull()||(a.focus(),a.isOpen=!0,a.refreshState(),a.$dropdown.css({visibility:"hidden",display:"block"}),a.positionDropdown(),a.$dropdown.css({visibility:"visible"}),a.trigger("dropdown_open",a.$dropdown))},close:function(){var a=this,b=a.isOpen;"single"===a.settings.mode&&a.items.length&&(a.hideInput(),a.$control_input.blur()),a.isOpen=!1,a.$dropdown.hide(),a.setActiveOption(null),a.refreshState(),b&&a.trigger("dropdown_close",a.$dropdown)},positionDropdown:function(){var a=this.$control,b="body"===this.settings.dropdownParent?a.offset():a.position();b.top+=a.outerHeight(!0),this.$dropdown.css({width:a.outerWidth(),top:b.top,left:b.left})},clear:function(a){var b=this;b.items.length&&(b.$control.children(":not(input)").remove(),b.items=[],b.lastQuery=null,b.setCaret(0),b.setActiveItem(null),b.updatePlaceholder(),b.updateOriginalInput({silent:a}),b.refreshState(),b.showInput(),b.trigger("clear"))},insertAtCaret:function(b){var c=Math.min(this.caretPos,this.items.length);0===c?this.$control.prepend(b):a(this.$control[0].childNodes[c]).before(b),this.setCaret(c+1)},deleteSelection:function(b){var c,d,e,f,g,h,i,j,k,l=this;if(e=b&&b.keyCode===p?-1:1,f=G(l.$control_input[0]),l.$activeOption&&!l.settings.hideSelected&&(i=l.getAdjacentOption(l.$activeOption,-1).attr("data-value")),g=[],l.$activeItems.length){for(k=l.$control.children(".active:"+(e>0?"last":"first")),h=l.$control.children(":not(input)").index(k),e>0&&h++,c=0,d=l.$activeItems.length;c<d;c++)g.push(a(l.$activeItems[c]).attr("data-value"));b&&(b.preventDefault(),b.stopPropagation())}else(l.isFocused||"single"===l.settings.mode)&&l.items.length&&(e<0&&0===f.start&&0===f.length?g.push(l.items[l.caretPos-1]):e>0&&f.start===l.$control_input.val().length&&g.push(l.items[l.caretPos]));if(!g.length||"function"==typeof l.settings.onDelete&&l.settings.onDelete.apply(l,[g])===!1)return!1;for("undefined"!=typeof h&&l.setCaret(h);g.length;)l.removeItem(g.pop());return l.showInput(),l.positionDropdown(),l.refreshOptions(!0),i&&(j=l.getOption(i),j.length&&l.setActiveOption(j)),!0},advanceSelection:function(a,b){var c,d,e,f,g,h,i=this;0!==a&&(i.rtl&&(a*=-1),c=a>0?"last":"first",d=G(i.$control_input[0]),i.isFocused&&!i.isInputHidden?(f=i.$control_input.val().length,g=a<0?0===d.start&&0===d.length:d.start===f,g&&!f&&i.advanceCaret(a,b)):(h=i.$control.children(".active:"+c),h.length&&(e=i.$control.children(":not(input)").index(h),i.setActiveItem(null),i.setCaret(a>0?e+1:e))))},advanceCaret:function(a,b){var c,d,e=this;0!==a&&(c=a>0?"next":"prev",e.isShiftDown?(d=e.$control_input[c](),d.length&&(e.hideInput(),e.setActiveItem(d),b&&b.preventDefault())):e.setCaret(e.caretPos+a))},setCaret:function(b){var c=this;if(b="single"===c.settings.mode?c.items.length:Math.max(0,Math.min(c.items.length,b)),!c.isPending){var d,e,f,g;for(f=c.$control.children(":not(input)"),d=0,e=f.length;d<e;d++)g=a(f[d]).detach(),d<b?c.$control_input.before(g):c.$control.append(g)}c.caretPos=b},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var a=this;a.$input.prop("disabled",!0),a.$control_input.prop("disabled",!0).prop("tabindex",-1),a.isDisabled=!0,a.lock()},enable:function(){var a=this;a.$input.prop("disabled",!1),a.$control_input.prop("disabled",!1).prop("tabindex",a.tabIndex),a.isDisabled=!1,a.unlock()},destroy:function(){var b=this,c=b.eventNS,d=b.revertSettings;b.trigger("destroy"),b.off(),b.$wrapper.remove(),b.$dropdown.remove(),b.$input.html("").append(d.$children).removeAttr("tabindex").removeClass("selectized").attr({tabindex:d.tabindex}).show(),b.$control_input.removeData("grow"),b.$input.removeData("selectize"),a(window).off(c),a(document).off(c),a(document.body).off(c),delete b.$input[0].selectize},render:function(b,c){var d,e,f="",g=!1,h=this;return"option"!==b&&"item"!==b||(d=z(c[h.settings.valueField]),g=!!d),g&&(y(h.renderCache[b])||(h.renderCache[b]={}),h.renderCache[b].hasOwnProperty(d))?h.renderCache[b][d]:(f=a(h.settings.render[b].apply(this,[c,A])),"option"===b||"option_create"===b?f.attr("data-selectable",""):"optgroup"===b&&(e=c[h.settings.optgroupValueField]||"",f.attr("data-group",e)),"option"!==b&&"item"!==b||f.attr("data-value",d||""),g&&(h.renderCache[b][d]=f[0]),f[0])},clearCache:function(a){var b=this;"undefined"==typeof a?b.renderCache={}:delete b.renderCache[a]},canCreate:function(a){var b=this;if(!b.settings.create)return!1;var c=b.settings.createFilter;return a.length&&("function"!=typeof c||c.apply(b,[a]))&&("string"!=typeof c||new RegExp(c).test(a))&&(!(c instanceof RegExp)||c.test(a))}}),M.count=0,M.defaults={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:!1,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,selectOnTab:!1,preload:!1,allowEmptyOption:!1,closeAfterSelect:!1,scrollDuration:60,loadThrottle:300,loadingClass:"loading",dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",
7626dropdownParent:null,copyClassesToDropdown:!0,render:{}},a.fn.selectize=function(b){var c=a.fn.selectize.defaults,d=a.extend({},c,b),e=d.dataAttr,f=d.labelField,g=d.valueField,h=d.optgroupField,i=d.optgroupLabelField,j=d.optgroupValueField,k=function(b,c){var h,i,j,k,l=b.attr(e);if(l)for(c.options=JSON.parse(l),h=0,i=c.options.length;h<i;h++)c.items.push(c.options[h][g]);else{var m=a.trim(b.val()||"");if(!d.allowEmptyOption&&!m.length)return;for(j=m.split(d.delimiter),h=0,i=j.length;h<i;h++)k={},k[f]=j[h],k[g]=j[h],c.options.push(k);c.items=j}},l=function(b,c){var k,l,m,n,o=c.options,p={},q=function(a){var b=e&&a.attr(e);return"string"==typeof b&&b.length?JSON.parse(b):null},r=function(b,e){b=a(b);var i=z(b.val());if(i||d.allowEmptyOption)if(p.hasOwnProperty(i)){if(e){var j=p[i][h];j?a.isArray(j)?j.push(e):p[i][h]=[j,e]:p[i][h]=e}}else{var k=q(b)||{};k[f]=k[f]||b.text(),k[g]=k[g]||i,k[h]=k[h]||e,p[i]=k,o.push(k),b.is(":selected")&&c.items.push(i)}},s=function(b){var d,e,f,g,h;for(b=a(b),f=b.attr("label"),f&&(g=q(b)||{},g[i]=f,g[j]=f,c.optgroups.push(g)),h=a("option",b),d=0,e=h.length;d<e;d++)r(h[d],f)};for(c.maxItems=b.attr("multiple")?null:1,n=b.children(),k=0,l=n.length;k<l;k++)m=n[k].tagName.toLowerCase(),"optgroup"===m?s(n[k]):"option"===m&&r(n[k])};return this.each(function(){if(!this.selectize){var e,f=a(this),g=this.tagName.toLowerCase(),h=f.attr("placeholder")||f.attr("data-placeholder");h||d.allowEmptyOption||(h=f.children('option[value=""]').text());var i={placeholder:h,options:[],optgroups:[],items:[]};"select"===g?l(f,i):k(f,i),e=new M(f,a.extend(!0,{},c,i,b))}})},a.fn.selectize.defaults=M.defaults,a.fn.selectize.support={validity:x},M.define("drag_drop",function(b){if(!a.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var c=this;c.lock=function(){var a=c.lock;return function(){var b=c.$control.data("sortable");return b&&b.disable(),a.apply(c,arguments)}}(),c.unlock=function(){var a=c.unlock;return function(){var b=c.$control.data("sortable");return b&&b.enable(),a.apply(c,arguments)}}(),c.setup=function(){var b=c.setup;return function(){b.apply(this,arguments);var d=c.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:c.isLocked,start:function(a,b){b.placeholder.css("width",b.helper.css("width")),d.css({overflow:"visible"})},stop:function(){d.css({overflow:"hidden"});var b=c.$activeItems?c.$activeItems.slice():null,e=[];d.children("[data-value]").each(function(){e.push(a(this).attr("data-value"))}),c.setValue(e),c.setActiveItem(b)}})}}()}}),M.define("dropdown_header",function(b){var c=this;b=a.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(a){return'<div class="'+a.headerClass+'"><div class="'+a.titleRowClass+'"><span class="'+a.labelClass+'">'+a.title+'</span><a href="javascript:void(0)" class="'+a.closeClass+'">&times;</a></div></div>'}},b),c.setup=function(){var d=c.setup;return function(){d.apply(c,arguments),c.$dropdown_header=a(b.html(b)),c.$dropdown.prepend(c.$dropdown_header)}}()}),M.define("optgroup_columns",function(b){var c=this;b=a.extend({equalizeWidth:!0,equalizeHeight:!0},b),this.getAdjacentOption=function(b,c){var d=b.closest("[data-group]").find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},this.onKeyDown=function(){var a=c.onKeyDown;return function(b){var d,e,f,g;return!this.isOpen||b.keyCode!==j&&b.keyCode!==m?a.apply(this,arguments):(c.ignoreHover=!0,g=this.$activeOption.closest("[data-group]"),d=g.find("[data-selectable]").index(this.$activeOption),g=b.keyCode===j?g.prev("[data-group]"):g.next("[data-group]"),f=g.find("[data-selectable]"),e=f.eq(Math.min(f.length-1,d)),void(e.length&&this.setActiveOption(e)))}}();var d=function(){var a,b=d.width,c=document;return"undefined"==typeof b&&(a=c.createElement("div"),a.innerHTML='<div style="width:50px;height:50px;position:absolute;
7626left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>',a=a.firstChild,c.body.appendChild(a),b=d.width=a.offsetWidth-a.clientWidth,c.body.removeChild(a)),b},e=function(){var e,f,g,h,i,j,k;if(k=a("[data-group]",c.$dropdown_content),f=k.length,f&&c.$dropdown_content.width()){if(b.equalizeHeight){for(g=0,e=0;e<f;e++)g=Math.max(g,k.eq(e).height());k.css({height:g})}b.equalizeWidth&&(j=c.$dropdown_content.innerWidth()-d(),h=Math.round(j/f),k.css({width:h}),f>1&&(i=j-h*(f-1),k.eq(f-1).css({width:i})))}};(b.equalizeHeight||b.equalizeWidth)&&(B.after(this,"positionDropdown",e),B.after(this,"refreshOptions",e))}),M.define("remove_button",function(b){b=a.extend({label:"&times;",title:"Remove",className:"remove",append:!0},b);var c=function(b,c){c.className="remove-single";var d=b,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+A(c.title)+'">'+c.label+"</a>",f=function(a,b){return a+b};b.setup=function(){var g=d.setup;return function(){if(c.append){var h=a(d.$input.context).attr("id"),i=(a("#"+h),d.settings.render.item);d.settings.render.item=function(a){return f(i.apply(b,arguments),e)}}g.apply(b,arguments),b.$control.on("click","."+c.className,function(a){a.preventDefault(),d.isLocked||d.clear()})}}()},d=function(b,c){var d=b,e='<a href="javascript:void(0)" class="'+c.className+'" tabindex="-1" title="'+A(c.title)+'">'+c.label+"</a>",f=function(a,b){var c=a.search(/(<\/[^>]+>\s*)$/);return a.substring(0,c)+b+a.substring(c)};b.setup=function(){var g=d.setup;return function(){if(c.append){var h=d.settings.render.item;d.settings.render.item=function(a){return f(h.apply(b,arguments),e)}}g.apply(b,arguments),b.$control.on("click","."+c.className,function(b){if(b.preventDefault(),!d.isLocked){var c=a(b.currentTarget).parent();d.setActiveItem(c),d.deleteSelection()&&d.setCaret(d.items.length)}})}}()};return"single"===this.settings.mode?void c(this,b):void d(this,b)}),M.define("restore_on_backspace",function(a){var b=this;a.text=a.text||function(a){return a[this.settings.labelField]},this.onKeyDown=function(){var c=b.onKeyDown;return function(b){var d,e;return b.keyCode===p&&""===this.$control_input.val()&&!this.$activeItems.length&&(d=this.caretPos-1,d>=0&&d<this.items.length)?(e=this.options[this.items[d]],this.deleteSelection(b)&&(this.setTextboxValue(a.text.apply(this,[e])),this.refreshOptions(!0)),void b.preventDefault()):c.apply(this,arguments)}}()}),M});
7627(function( factory ) {
7628if( typeof define === 'function' && define.amd ) {
7629define( [ 'shoestring' ], factory );
7630} else if (typeof module === 'object' && module.exports) {
7631module.exports = factory();
7632} else {
7633factory();
7634}
7635}(function () {
7636var win = typeof window !== "undefined" ? window : this;
7637var doc = win.document;
7638function shoestring( prim, sec ){
7639var pType = typeof( prim ),
7640ret = [],
7641sel;
7642if( !prim ){
7643return new Shoestring( ret );
7644}
7645if( prim.call ){
7646return shoestring.ready( prim );
7647}
7648if( prim.constructor === Shoestring && !sec ){
7649return prim;
7650}
7651if( pType === "string" && prim.indexOf( "<" ) === 0 ){
7652var dfrag = doc.createElement( "div" );
7653dfrag.innerHTML = prim;
7654return shoestring( dfrag ).children().each(function(){
7655dfrag.removeChild( this );
7656});
7657}
7658if( pType === "string" ){
7659if( sec ){
7660return shoestring( sec ).find( prim );
7661}
7662sel = doc.querySelectorAll( prim );
7663return new Shoestring( sel, prim );
7664}
7665if( Object.prototype.toString.call( pType ) === '[object Array]' ||
7666(win.NodeList && prim instanceof win.NodeList) ){
7667return new Shoestring( prim, prim );
7668}
7669if( prim.constructor === Array ){
7670return new Shoestring( prim, prim );
7671}
7672return new Shoestring( [prim], prim );
7673}
7674var Shoestring = function( ret, prim ) {
7675this.length = 0;
7676this.selector = prim;
7677shoestring.merge(this, ret);
7678};
7679Shoestring.prototype.reverse = [].reverse;
7680shoestring.fn = Shoestring.prototype;
7681shoestring.Shoestring = Shoestring;
7682shoestring.extend = function( first, second ){
7683for( var i in second ){
7684if( second.hasOwnProperty( i ) ){
7685first[ i ] = second[ i ];
7686}
7687}
7688return first;
7689};
7690shoestring.merge = function( first, second ) {
7691var len, j, i;
7692len = +second.length,
7693j = 0,
7694i = first.length;
7695for ( ; j < len; j++ ) {
7696first[ i++ ] = second[ j ];
7697}
7698first.length = i;
7699return first;
7700};
7701win.shoestring = shoestring;
7702shoestring.fn.each = function( callback ){
7703return shoestring.each( this, callback );
7704};
7705shoestring.each = function( collection, callback ) {
7706var val;
7707for( var i = 0, il = collection.length; i < il; i++ ){
7708val = callback.call( collection[i], i, collection[i] );
7709if( val === false ){
7710break;
7711}
7712}
7713return collection;
7714};
7715shoestring.inArray = function( needle, haystack ){
7716var isin = -1;
7717for( var i = 0, il = haystack.length; i < il; i++ ){
7718if( haystack.hasOwnProperty( i ) && haystack[ i ] === needle ){
7719isin = i;
7720}
7721}
7722return isin;
7723};
7724shoestring.ready = function( fn ){
7725if( ready && fn ){
7726fn.call( doc );
7727}
7728else if( fn ){
7729readyQueue.push( fn );
7730}
7731else {
7732runReady();
7733}
7734return [doc];
7735};
7736shoestring.fn.ready = function( fn ){
7737shoestring.ready( fn );
7738return this;
7739};
7740var ready = false,
7741readyQueue = [],
7742runReady = function(){
7743if( !ready ){
7744while( readyQueue.length ){
7745readyQueue.shift().call( doc );
7746}
7747ready = true;
7748}
7749};
7750if( !win.addEventListener ){
7751win.addEventListener = function( evt, cb ){
7752return win.attachEvent( "on" + evt, cb );
7753};
7754}
7755if (doc.attachEvent ? doc.readyState === "complete" : doc.readyState !== "loading") {
7756runReady();
7757}	else {
7758if( !doc.addEventListener ){
7759doc.attachEvent( "DOMContentLoaded", runReady );
7760doc.attachEvent( "onreadystatechange", runReady );
7761} else {
7762doc.addEventListener( "DOMContentLoaded", runReady, false );
7763doc.addEventListener( "readystatechange", runReady, false );
7764}
7765win.addEventListener( "load", runReady, false );
7766}
7767shoestring.fn.is = function( selector ){
7768var ret = false, self = this, parents, check;
7769if( typeof selector !== "string" ){
7770if( selector.length && selector[0] ){
7771check = selector;
7772} else {
7773check = [selector];
7774}
7775return _checkElements(this, check);
7776}
7777parents = this.parent();
7778if( !parents.length ){
7779parents = shoestring( doc );
7780}
7781parents.each(function( i, e ) {
7782var children;
7783children = e.querySelectorAll( selector );
7784ret = _checkElements( self, children );
7785});
7786return ret;
7787};
7788function _checkElements(needles, haystack){
7789var ret = false;
7790needles.each(function() {
7791var j = 0;
7792while( j < haystack.length ){
7793if( this === haystack[j] ){
7794ret = true;
7795}
7796j++;
7797}
7798});
7799return ret;
7800}
7801shoestring.fn.data = function( name, value ){
7802if( name !== undefined ){
7803if( value !== undefined ){
7804return this.each(function(){
7805if( !this.shoestringData ){
7806this.shoestringData = {};
7807}
7808this.shoestringData[ name ] = value;
7809});
7810}
7811else {
7812if( this[ 0 ] ) {
7813if( this[ 0 ].shoestringData ) {
7814return this[ 0 ].shoestringData[ name ];
7815}
7816}
7817}
7818}
7819else {
7820return this[ 0 ] ? this[ 0 ].shoestringData || {} : undefined;
7821}
7822};
7823shoestring.fn.removeData = function( name ){
7824return this.each(function(){
7825if( name !== undefined && this.shoestringData ){
7826this.shoestringData[ name ] = undefined;
7827delete this.shoestringData[ name ];
7828}	else {
7829this[ 0 ].shoestringData = {};
7830}
7831});
7832};
7833shoestring.fn.addClass = function( className ){
7834var classes = className.replace(/^\s+|\s+$/g, '').split( " " );
7835return this.each(function(){
7836for( var i = 0, il = classes.length; i < il; i++ ){
7837if( this.className !== undefined &&
7838(this.className === "" ||
7839!this.className.match( new RegExp( "(^|\\s)" + classes[ i ] + "($|\\s)"))) ){
7840this.className += " " + classes[ i ];
7841}
7842}
7843});
7844};
7845shoestring.fn.add = function( selector ){
7846var ret = [];
7847this.each(function(){
7848ret.push( this );
7849});
7850shoestring( selector ).each(function(){
7851ret.push( this );
7852});
7853return shoestring( ret );
7854};
7855shoestring.fn.append = function( fragment ){
7856if( typeof( fragment ) === "string" || fragment.nodeType !== undefined ){
7857fragment = shoestring( fragment );
7858}
7859return this.each(function( i ){
7860for( var j = 0, jl = fragment.length; j < jl; j++ ){
7861this.appendChild( i > 0 ? fragment[ j ].cloneNode( true ) : fragment[ j ] );
7862}
7863});
7864};
7865shoestring.fn.appendTo = function( selector ){
7866return this.each(function(){
7867shoestring( selector ).append( this );
7868});
7869};
7870shoestring.fn.attr = function( name, value ){
7871var nameStr = typeof( name ) === "string";
7872if( value !== undefined || !nameStr ){
7873return this.each(function(){
7874if( nameStr ){
7875this.setAttribute( name, value );
7876}	else {
7877for( var i in name ){
7878if( name.hasOwnProperty( i ) ){
7879this.setAttribute( i, name[ i ] );
7880}
7881}
7882}
7883});
7884} else {
7885return this[ 0 ] ? this[ 0 ].getAttribute( name ) : undefined;
7886}
7887};
7888shoestring.fn.before = function( fragment ){
7889if( typeof( fragment ) === "string" || fragment.nodeType !== undefined ){
7890fragment = shoestring( fragment );
7891}
7892return this.each(function( i ){
7893for( var j = 0, jl = fragment.length; j < jl; j++ ){
7894this.parentNode.insertBefore( i > 0 ? fragment[ j ].cloneNode( true ) : fragment[ j ], this );
7895}
7896});
7897};
7898shoestring.fn.children = function(){
7899var ret = [],
7900childs,
7901j;
7902this.each(function(){
7903childs = this.children;
7904j = -1;
7905while( j++ < childs.length-1 ){
7906if( shoestring.inArray(  childs[ j ], ret ) === -1 ){
7907ret.push( childs[ j ] );
7908}
7909}
7910});
7911return shoestring(ret);
7912};
7913shoestring.fn.closest = function( selector ){
7914var ret = [];
7915if( !selector ){
7916return shoestring( ret );
7917}
7918this.each(function(){
7919var element, $self = shoestring( element = this );
7920if( $self.is(selector) ){
7921ret.push( this );
7922return;
7923}
7924while( element.parentElement ) {
7925if( shoestring(element.parentElement).is(selector) ){
7926ret.push( element.parentElement );
7927break;
7928}
7929element = element.parentElement;
7930}
7931});
7932return shoestring( ret );
7933};
7934shoestring.cssExceptions = {
7935'float': [ 'cssFloat', 'styleFloat' ] // styleFloat is IE8
7936};
7937(function () {
7938function getComputedStylePixel(element, property, fontSize) {
7939element.document; // Internet Explorer sometimes struggles to read currentStyle until the element's document is accessed.
7940var
7941value = element.currentStyle[property].match(/([\d\.]+)(%|cm|em|in|mm|pc|pt|)/) || [0, 0, ''],
7942size = value[1],
7943suffix = value[2],
7944rootSize;
7945fontSize = !fontSize ? fontSize : /%|em/.test(suffix) && element.parentElement ? getComputedStylePixel(element.parentElement, 'fontSize', null) : 16;
7946rootSize = property === 'fontSize' ? fontSize : /width/i.test(property) ? element.clientWidth : element.clientHeight;
7947return suffix === '%' ? size / 100 * rootSize :
7948suffix === 'cm' ? size * 0.3937 * 96 :
7949suffix === 'em' ? size * fontSize :
7950suffix === 'in' ? size * 96 :
7951suffix === 'mm' ? size * 0.3937 * 96 / 10 :
7952suffix === 'pc' ? size * 12 * 96 / 72 :
7953suffix === 'pt' ? size * 96 / 72 :
7954size;
7955}
7956function setShortStyleProperty(style, property) {
7957var
7958borderSuffix = property === 'border' ? 'Width' : '',
7959t = property + 'Top' + borderSuffix,
7960r = property + 'Right' + borderSuffix,
7961b = property + 'Bottom' + borderSuffix,
7962l = property + 'Left' + borderSuffix;
7963style[property] = (style[t] === style[r] && style[t] === style[b] && style[t] === style[l] ? [ style[t] ] :
7964style[t] === style[b] && style[l] === style[r] ? [ style[t], style[r] ] :
7965style[l] === style[r] ? [ style[t], style[r], style[b] ] :
7966[ style[t], style[r], style[b], style[l] ]).join(' ');
7967}
7968function CSSStyleDeclaration(element) {
7969var
7970style = this,
7971currentStyle = element.currentStyle,
7972fontSize = getComputedStylePixel(element, 'fontSize'),
7973unCamelCase = function (match) {
7974return '-' + match.toLowerCase();
7975},
7976property;
7977for (property in currentStyle) {
7978Array.prototype.push.call(style, property === 'styleFloat' ? 'float' : property.replace(/[A-Z]/, unCamelCase));
7979if (property === 'width') {
7980style[property] = element.offsetWidth + 'px';
7981} else if (property === 'height') {
7982style[property] = element.offsetHeight + 'px';
7983} else if (property === 'styleFloat') {
7984style.float = currentStyle[property];
7985} else if (/margin.|padding.|border.+W/.test(property) && style[property] !== 'auto') {
7986style[property] = Math.round(getComputedStylePixel(element, property, fontSize)) + 'px';
7987} else if (/^outline/.test(property)) {
7988try {
7989style[property] = currentStyle[property];
7990} catch (error) {
7991style.outlineColor = currentStyle.color;
7992style.outlineStyle = style.outlineStyle || 'none';
7993style.outlineWidth = style.outlineWidth || '0px';
7994style.outline = [style.outlineColor, style.outlineWidth, style.outlineStyle].join(' ');
7995}
7996} else {
7997style[property] = currentStyle[property];
7998}
7999}
8000setShortStyleProperty(style, 'margin');
8001setShortStyleProperty(style, 'padding');
8002setShortStyleProperty(style, 'border');
8003style.fontSize = Math.round(fontSize) + 'px';
8004}
8005CSSStyleDeclaration.prototype = {
8006constructor: CSSStyleDeclaration,
8007getPropertyPriority: function () {
8008throw new Error('NotSupportedError: DOM Exception 9');
8009},
8010getPropertyValue: function (property) {
8011return this[property.replace(/-\w/g, function (match) {
8012return match[1].toUpperCase();
8013})];
8014},
8015item: function (index) {
8016return this[index];
8017},
8018removeProperty: function () {
8019throw new Error('NoModificationAllowedError: DOM Exception 7');
8020},
8021setProperty: function () {
8022throw new Error('NoModificationAllowedError: DOM Exception 7');
8023},
8024getPropertyCSSValue: function () {
8025throw new Error('NotSupportedError: DOM Exception 9');
8026}
8027};
8028if( !win.getComputedStyle ) {
8029win.getComputedStyle = function (element) {
8030return new CSSStyleDeclaration(element);
8031};
8032if ( win.Window ) {
8033win.Window.prototype.getComputedStyle = win.getComputedStyle;
8034}
8035}
8036})();
8037(function() {
8038var cssExceptions = shoestring.cssExceptions;
8039function convertPropertyName( str ) {
8040return str.replace( /\-([A-Za-z])/g, function ( match, character ) {
8041return character.toUpperCase();
8042});
8043}
8044function _getStyle( element, property ) {
8045return win.getComputedStyle( element, null ).getPropertyValue( property );
8046}
8047var vendorPrefixes = [ '', '-webkit-', '-ms-', '-moz-', '-o-', '-khtml-' ];
8048shoestring._getStyle = function( element, property ) {
8049var convert, value, j, k;
8050if( cssExceptions[ property ] ) {
8051for( j = 0, k = cssExceptions[ property ].length; j < k; j++ ) {
vendor: 10,292 bytes, lines 8052-8493
8052value = _getStyle( element, cssExceptions[ property ][ j ] );
8053if( value ) {
8054return value;
8055}
8056}
8057}
8058for( j = 0, k = vendorPrefixes.length; j < k; j++ ) {
8059convert = convertPropertyName( vendorPrefixes[ j ] + property );
8060value = _getStyle( element, convert );
8061if( convert !== property ) {
8062value = value || _getStyle( element, property );
8063}
8064if( vendorPrefixes[ j ] ) {
8065value = value || _getStyle( element, vendorPrefixes[ j ] + property );
8066}
8067if( value ) {
8068return value;
8069}
8070}
8071return undefined;
8072};
8073})();
8074(function() {
8075var cssExceptions = shoestring.cssExceptions;
8076function convertPropertyName( str ) {
8077return str.replace( /\-([A-Za-z])/g, function ( match, character ) {
8078return character.toUpperCase();
8079});
8080}
8081shoestring._setStyle = function( element, property, value ) {
8082var convertedProperty = convertPropertyName(property);
8083element.style[ property ] = value;
8084if( convertedProperty !== property ) {
8085element.style[ convertedProperty ] = value;
8086}
8087if( cssExceptions[ property ] ) {
8088for( var j = 0, k = cssExceptions[ property ].length; j<k; j++ ) {
8089element.style[ cssExceptions[ property ][ j ] ] = value;
8090}
8091}
8092};
8093})();
8094shoestring.fn.css = function( property, value ){
8095if( !this[0] ){
8096return;
8097}
8098if( typeof property === "object" ) {
8099return this.each(function() {
8100for( var key in property ) {
8101if( property.hasOwnProperty( key ) ) {
8102shoestring._setStyle( this, key, property[key] );
8103}
8104}
8105});
8106}	else {
8107if( value !== undefined ){
8108return this.each(function(){
8109shoestring._setStyle( this, property, value );
8110});
8111}
8112return shoestring._getStyle( this[0], property );
8113}
8114};
8115shoestring.fn.eq = function( index ){
8116if( this[index] ){
8117return shoestring( this[index] );
8118}
8119return shoestring([]);
8120};
8121shoestring.fn.filter = function( selector ){
8122var ret = [];
8123this.each(function( index ){
8124var wsel;
8125if( typeof selector === 'function' ) {
8126if( selector.call( this, index ) !== false ) {
8127ret.push( this );
8128}
8129} else {
8130if( !this.parentNode ){
8131var context = shoestring( doc.createDocumentFragment() );
8132context[ 0 ].appendChild( this );
8133wsel = shoestring( selector, context );
8134} else {
8135wsel = shoestring( selector, this.parentNode );
8136}
8137if( shoestring.inArray( this, wsel ) > -1 ){
8138ret.push( this );
8139}
8140}
8141});
8142return shoestring( ret );
8143};
8144shoestring.fn.find = function( selector ){
8145var ret = [],
8146finds;
8147this.each(function(){
8148finds = this.querySelectorAll( selector );
8149for( var i = 0, il = finds.length; i < il; i++ ){
8150ret = ret.concat( finds[i] );
8151}
8152});
8153return shoestring( ret );
8154};
8155shoestring.fn.first = function(){
8156return this.eq( 0 );
8157};
8158shoestring.fn.get = function( index ){
8159if( index === undefined ){
8160var elements = [];
8161for( var i = 0; i < this.length; i++ ){
8162elements.push( this[ i ] );
8163}
8164return elements;
8165} else {
8166return this[ index ];
8167}
8168};
8169var set = function( html ){
8170if( typeof html === "string" || typeof html === "number" ){
8171return this.each(function(){
8172this.innerHTML = "" + html;
8173});
8174} else {
8175var h = "";
8176if( typeof html.length !== "undefined" ){
8177for( var i = 0, l = html.length; i < l; i++ ){
8178h += html[i].outerHTML;
8179}
8180} else {
8181h = html.outerHTML;
8182}
8183return this.each(function(){
8184this.innerHTML = h;
8185});
8186}
8187};
8188shoestring.fn.html = function( html ){
8189if( typeof html !== "undefined" ){
8190return set.call( this, html );
8191} else { // get
8192var pile = "";
8193this.each(function(){
8194pile += this.innerHTML;
8195});
8196return pile;
8197}
8198};
8199(function() {
8200function _getIndex( set, test ) {
8201var i, result, element;
8202for( i = result = 0; i < set.length; i++ ) {
8203element = set.item ? set.item(i) : set[i];
8204if( test(element) ){
8205return result;
8206}
8207if( element.nodeType === 1 ){
8208result++;
8209}
8210}
8211return -1;
8212}
8213shoestring.fn.index = function( selector ){
8214var self, children;
8215self = this;
8216if( selector === undefined ){
8217children = ( ( this[ 0 ] && this[0].parentNode ) || doc.documentElement).childNodes;
8218return _getIndex(children, function( element ) {
8219return self[0] === element;
8220});
8221} else {
8222return _getIndex(self, function( element ) {
8223return element === (shoestring( selector, element.parentNode )[ 0 ]);
8224});
8225}
8226};
8227})();
8228shoestring.fn.insertBefore = function( selector ){
8229return this.each(function(){
8230shoestring( selector ).before( this );
8231});
8232};
8233shoestring.fn.last = function(){
8234return this.eq( this.length - 1 );
8235};
8236shoestring.fn.next = function(){
8237var result = [];
8238this.each(function() {
8239var children, item, found;
8240children = shoestring( this.parentNode )[0].childNodes;
8241for( var i = 0; i < children.length; i++ ){
8242item = children.item( i );
8243if( found && item.nodeType === 1 ){
8244result.push( item );
8245break;
8246}
8247if( item === this ){
8248found = true;
8249}
8250}
8251});
8252return shoestring( result );
8253};
8254shoestring.fn.not = function( selector ){
8255var ret = [];
8256this.each(function(){
8257var found = shoestring( selector, this.parentNode );
8258if( shoestring.inArray(this, found) === -1 ){
8259ret.push( this );
8260}
8261});
8262return shoestring( ret );
8263};
8264shoestring.fn.parent = function(){
8265var ret = [],
8266parent;
8267this.each(function(){
8268parent = (this === doc.documentElement ? doc : this.parentNode);
8269if( parent && parent.nodeType !== 11 ){
8270ret.push( parent );
8271}
8272});
8273return shoestring(ret);
8274};
8275shoestring.fn.prepend = function( fragment ){
8276if( typeof( fragment ) === "string" || fragment.nodeType !== undefined ){
8277fragment = shoestring( fragment );
8278}
8279return this.each(function( i ){
8280for( var j = 0, jl = fragment.length; j < jl; j++ ){
8281var insertEl = i > 0 ? fragment[ j ].cloneNode( true ) : fragment[ j ];
8282if ( this.firstChild ){
8283this.insertBefore( insertEl, this.firstChild );
8284} else {
8285this.appendChild( insertEl );
8286}
8287}
8288});
8289};
8290shoestring.fn.prev = function(){
8291var result = [];
8292this.each(function() {
8293var children, item, found;
8294children = shoestring( this.parentNode )[0].childNodes;
8295for( var i = children.length -1; i >= 0; i-- ){
8296item = children.item( i );
8297if( found && item.nodeType === 1 ){
8298result.push( item );
8299break;
8300}
8301if( item === this ){
8302found = true;
8303}
8304}
8305});
8306return shoestring( result );
8307};
8308shoestring.fn.prevAll = function(){
8309var result = [];
8310this.each(function() {
8311var $previous = shoestring( this ).prev();
8312while( $previous.length ){
8313result.push( $previous[0] );
8314$previous = $previous.prev();
8315}
8316});
8317return shoestring( result );
8318};
8319shoestring.fn.removeAttr = function( name ){
8320return this.each(function(){
8321this.removeAttribute( name );
8322});
8323};
8324shoestring.fn.removeClass = function( cname ){
8325var classes = cname.replace(/^\s+|\s+$/g, '').split( " " );
8326return this.each(function(){
8327var newClassName, regex;
8328for( var i = 0, il = classes.length; i < il; i++ ){
8329if( this.className !== undefined ){
8330regex = new RegExp( "(^|\\s)" + classes[ i ] + "($|\\s)", "gmi" );
8331newClassName = this.className.replace( regex, " " );
8332this.className = newClassName.replace(/^\s+|\s+$/g, '');
8333}
8334}
8335});
8336};
8337shoestring.fn.remove = function(){
8338return this.each(function(){
8339if( this.parentNode ) {
8340this.parentNode.removeChild( this );
8341}
8342});
8343};
8344shoestring.fn.replaceWith = function( fragment ){
8345if( typeof( fragment ) === "string" ){
8346fragment = shoestring( fragment );
8347}
8348var ret = [];
8349if( fragment.length > 1 ){
8350fragment = fragment.reverse();
8351}
8352this.each(function( i ){
8353var clone = this.cloneNode( true ),
8354insertEl;
8355ret.push( clone );
8356if( !this.parentNode ){ return; }
8357if( fragment.length === 1 ){
8358insertEl = i > 0 ? fragment[ 0 ].cloneNode( true ) : fragment[ 0 ];
8359this.parentNode.replaceChild( insertEl, this );
8360} else {
8361for( var j = 0, jl = fragment.length; j < jl; j++ ){
8362insertEl = i > 0 ? fragment[ j ].cloneNode( true ) : fragment[ j ];
8363this.parentNode.insertBefore( insertEl, this.nextSibling );
8364}
8365this.parentNode.removeChild( this );
8366}
8367});
8368return shoestring( ret );
8369};
8370shoestring.fn.siblings = function(){
8371if( !this.length ) {
8372return shoestring( [] );
8373}
8374var sibs = [], el = this[ 0 ].parentNode.firstChild;
8375do {
8376if( el.nodeType === 1 && el !== this[ 0 ] ) {
8377sibs.push( el );
8378}
8379el = el.nextSibling;
8380} while( el );
8381return shoestring( sibs );
8382};
8383var getText = function( elem ){
8384var node,
8385ret = "",
8386i = 0,
8387nodeType = elem.nodeType;
8388if ( !nodeType ) {
8389while ( (node = elem[i++]) ) {
8390ret += getText( node );
8391}
8392} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
8393if ( typeof elem.textContent === "string" ) {
8394return elem.textContent;
8395} else {
8396for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
8397ret += getText( elem );
8398}
8399}
8400} else if ( nodeType === 3 || nodeType === 4 ) {
8401return elem.nodeValue;
8402}
8403return ret;
8404};
8405shoestring.fn.text = function() {
8406return getText( this );
8407};
8408shoestring.fn.val = function( value ){
8409var el;
8410if( value !== undefined ){
8411return this.each(function(){
8412if( this.tagName === "SELECT" ){
8413var optionSet, option,
8414options = this.options,
8415values = [],
8416i = options.length,
8417newIndex;
8418values[0] = value;
8419while ( i-- ) {
8420option = options[ i ];
8421if ( (option.selected = shoestring.inArray( option.value, values ) >= 0) ) {
8422optionSet = true;
8423newIndex = i;
8424}
8425}
8426if ( !optionSet ) {
8427this.selectedIndex = -1;
8428} else {
8429this.selectedIndex = newIndex;
8430}
8431} else {
8432this.value = value;
8433}
8434});
8435} else {
8436el = this[0];
8437if( el.tagName === "SELECT" ){
8438if( el.selectedIndex < 0 ){ return ""; }
8439return el.options[ el.selectedIndex ].value;
8440} else {
8441return el.value;
8442}
8443}
8444};
8445shoestring._dimension = function( set, name, value ){
8446var offsetName;
8447if( value === undefined ){
8448offsetName = name.replace(/^[a-z]/, function( letter ) {
8449return letter.toUpperCase();
8450});
8451return set[ 0 ][ "offset" + offsetName ];
8452} else {
8453value = typeof value === "string" ? value : value + "px";
8454return set.each(function(){
8455this.style[ name ] = value;
8456});
8457}
8458};
8459shoestring.fn.width = function( value ){
8460return shoestring._dimension( this, "width", value );
8461};
8462shoestring.fn.wrapInner = function( html ){
8463return this.each(function(){
8464var inH = this.innerHTML;
8465this.innerHTML = "";
8466shoestring( this ).append( shoestring( html ).html( inH ) );
8467});
8468};
8469function initEventCache( el, evt ) {
8470if ( !el.shoestringData ) {
8471el.shoestringData = {};
8472}
8473if ( !el.shoestringData.events ) {
8474el.shoestringData.events = {};
8475}
8476if ( !el.shoestringData.loop ) {
8477el.shoestringData.loop = {};
8478}
8479if ( !el.shoestringData.events[ evt ] ) {
8480el.shoestringData.events[ evt ] = [];
8481}
8482}
8483function addToEventCache( el, evt, eventInfo ) {
8484var obj = {};
8485obj.isCustomEvent = eventInfo.isCustomEvent;
8486obj.callback = eventInfo.callfunc;
8487obj.originalCallback = eventInfo.originalCallback;
8488obj.namespace = eventInfo.namespace;
8489el.shoestringData.events[ evt ].push( obj );
8490if( eventInfo.customEventLoop ) {
8491el.shoestringData.loop[ evt ] = eventInfo.customEventLoop;
8492}
8493}
8494function reorderEvents( node, eventName ) {
8495if( node.addEventListener || !node.shoestringData || !node.shoestringData.events ) {
8496return;
8497}
8498var otherEvents = node.shoestringData.events[ eventName ] || [];
8499for( var j = otherEvents.length - 1; j >= 0; j-- ) {
8500if( !otherEvents[ j ].isCustomEvent ) {
8501node.detachEvent( "on" + eventName, otherEvents[ j ].callback );
8502node.attachEvent( "on" + eventName, otherEvents[ j ].callback );
8503}
8504}
8505}
8506shoestring.fn.bind = function( evt, data, originalCallback ){
8507if( typeof data === "function" ){
8508originalCallback = data;
8509data = null;
8510}
8511var evts = evt.split( " " ),
8512docEl = doc.documentElement;
8513function encasedCallback( e, namespace, triggeredElement ){
8514var result;
8515if( e._namespace && e._namespace !== namespace ) {
8516return;
8517}
8518e.data = data;
8519e.namespace = e._namespace;
8520var returnTrue = function(){
8521return true;
8522};
8523e.isDefaultPrevented = function(){
8524return false;
8525};
8526var originalPreventDefault = e.preventDefault;
8527var preventDefaultConstructor = function(){
8528if( originalPreventDefault ) {
8529return function(){
8530e.isDefaultPrevented = returnTrue;
8531originalPreventDefault.call(e);
8532};
8533} else {
8534return function(){
8535e.isDefaultPrevented = returnTrue;
8536e.returnValue = false;
8537};
8538}
8539};
8540e.target = triggeredElement || e.target || e.srcElement;
8541e.preventDefault = preventDefaultConstructor();
8542e.stopPropagation = e.stopPropagation || function () {
8543e.cancelBubble = true;
8544};
8545result = originalCallback.apply(this, [ e ].concat( e._args ) );
8546if( result === false ){
8547e.preventDefault();
8548e.stopPropagation();
8549}
8550return result;
8551}
8552function propChange( originalEvent, boundElement, namespace ) {
8553var lastEventInfo = doc.documentElement[ originalEvent.propertyName ],
8554triggeredElement = lastEventInfo.el;
8555var boundCheckElement = boundElement;
8556if( boundElement === doc && triggeredElement !== doc ) {
8557boundCheckElement = doc.documentElement;
8558}
8559if( triggeredElement !== undefined &&
8560shoestring( triggeredElement ).closest( boundCheckElement ).length ) {
8561originalEvent._namespace = lastEventInfo._namespace;
8562originalEvent._args = lastEventInfo._args;
8563encasedCallback.call( boundElement, originalEvent, namespace, triggeredElement );
8564}
8565}
8566return this.each(function(){
8567var domEventCallback,
8568customEventCallback,
8569customEventLoop,
8570oEl = this;
8571for( var i = 0, il = evts.length; i < il; i++ ){
8572var split = evts[ i ].split( "." ),
8573evt = split[ 0 ],
8574namespace = split.length > 0 ? split[ 1 ] : null;
8575domEventCallback = function( originalEvent ) {
8576if( oEl.ssEventTrigger ) {
8577originalEvent._namespace = oEl.ssEventTrigger._namespace;
8578originalEvent._args = oEl.ssEventTrigger._args;
8579oEl.ssEventTrigger = null;
8580}
8581return encasedCallback.call( oEl, originalEvent, namespace );
8582};
8583customEventCallback = null;
8584customEventLoop = null;
8585initEventCache( this, evt );
8586if( "addEventListener" in this ){
8587this.addEventListener( evt, domEventCallback, false );
8588} else if( this.attachEvent ){
8589if( this[ "on" + evt ] !== undefined ) {
8590this.attachEvent( "on" + evt, domEventCallback );
8591} else {
8592customEventCallback = (function() {
8593var eventName = evt;
8594return function( e ) {
8595if( e.propertyName === eventName ) {
8596propChange( e, oEl, namespace );
8597}
8598};
8599})();
8600if( this.shoestringData.events[ evt ].length === 0 ) {
8601customEventLoop = (function() {
8602var eventName = evt;
8603return function( e ) {
8604if( !oEl.shoestringData || !oEl.shoestringData.events ) {
8605return;
8606}
8607var events = oEl.shoestringData.events[ eventName ];
8608if( !events ) {
8609return;
8610}
8611for( var j = 0, k = events.length; j < k; j++ ) {
8612events[ j ].callback( e );
8613}
8614};
8615})();
8616docEl.attachEvent( "onpropertychange", customEventLoop );
8617}
8618}
8619}
8620addToEventCache( this, evt, {
8621callfunc: customEventCallback || domEventCallback,
8622isCustomEvent: !!customEventCallback,
8623customEventLoop: customEventLoop,
8624originalCallback: originalCallback,
8625namespace: namespace
8626});
8627if( !customEventCallback ) {
8628reorderEvents( oEl, evt );
8629}
8630}
8631});
8632};
8633shoestring.fn.on = shoestring.fn.bind;
8634shoestring.fn.unbind = function( event, callback ){
8635var evts = event ? event.split( " " ) : [];
8636return this.each(function(){
8637if( !this.shoestringData || !this.shoestringData.events ) {
8638return;
8639}
8640if( !evts.length ) {
8641unbindAll.call( this );
8642} else {
8643var split, evt, namespace;
8644for( var i = 0, il = evts.length; i < il; i++ ){
8645split = evts[ i ].split( "." ),
8646evt = split[ 0 ],
8647namespace = split.length > 0 ? split[ 1 ] : null;
8648if( evt ) {
8649unbind.call( this, evt, namespace, callback );
8650} else {
8651unbindAll.call( this, namespace, callback );
8652}
8653}
8654}
8655});
8656};
8657function unbind( evt, namespace, callback ) {
8658var bound = this.shoestringData.events[ evt ];
8659if( !(bound && bound.length) ) {
8660return;
8661}
8662var matched = [], j, jl;
8663for( j = 0, jl = bound.length; j < jl; j++ ) {
8664if( !namespace || namespace === bound[ j ].namespace ) {
8665if( callback === undefined || callback === bound[ j ].originalCallback ) {
8666if( "removeEventListener" in win ){
8667this.removeEventListener( evt, bound[ j ].callback, false );
8668} else if( this.detachEvent ){
8669this.detachEvent( "on" + evt, bound[ j ].callback );
8670if( bound.length === 1 && this.shoestringData.loop && this.shoestringData.loop[ evt ] ) {
8671doc.documentElement.detachEvent( "onpropertychange", this.shoestringData.loop[ evt ] );
8672}
8673}
8674matched.push( j );
8675}
8676}
8677}
8678for( j = 0, jl = matched.length; j < jl; j++ ) {
8679this.shoestringData.events[ evt ].splice( j, 1 );
8680}
8681}
8682function unbindAll( namespace, callback ) {
8683for( var evtKey in this.shoestringData.events ) {
8684unbind.call( this, evtKey, namespace, callback );
8685}
8686}
8687shoestring.fn.off = shoestring.fn.unbind;
8688shoestring.fn.one = function( event, callback ){
8689var evts = event.split( " " );
8690return this.each(function(){
8691var thisevt, cbs = {},	$t = shoestring( this );
8692for( var i = 0, il = evts.length; i < il; i++ ){
8693thisevt = evts[ i ];
8694cbs[ thisevt ] = function( e ){
8695var $t = shoestring( this );
8696for( var j in cbs ) {
8697$t.unbind( j, cbs[ j ] );
8698}
8699return callback.apply( this, [ e ].concat( e._args ) );
8700};
8701$t.bind( thisevt, cbs[ thisevt ] );
8702}
8703});
8704};
8705shoestring.fn.triggerHandler = function( event, args ){
8706var e = event.split( " " )[ 0 ],
8707el = this[ 0 ],
8708ret;
8709if( doc.createEvent && el.shoestringData && el.shoestringData.events && el.shoestringData.events[ e ] ){
8710var bindings = el.shoestringData.events[ e ];
8711for (var i in bindings ){
8712if( bindings.hasOwnProperty( i ) ){
8713event = doc.createEvent( "Event" );
8714event.initEvent( e, true, true );
8715event._args = args;
8716args.unshift( event );
8717ret = bindings[ i ].originalCallback.apply( event.target, args );
8718}
8719}
8720}
8721return ret;
8722};
8723shoestring.fn.trigger = function( event, args ){
8724var evts = event.split( " " );
8725return this.each(function(){
8726var split, evt, namespace;
8727for( var i = 0, il = evts.length; i < il; i++ ){
8728split = evts[ i ].split( "." ),
8729evt = split[ 0 ],
8730namespace = split.length > 0 ? split[ 1 ] : null;
8731if( evt === "click" ){
8732if( this.tagName === "INPUT" && this.type === "checkbox" && this.click ){
8733this.click();
8734return false;
8735}
8736}
8737if( doc.createEvent ){
8738var event = doc.createEvent( "Event" );
8739event.initEvent( evt, true, true );
8740event._args = args;
8741event._namespace = namespace;
8742this.dispatchEvent( event );
8743} else if ( doc.createEventObject ) {
8744if( ( "" + this[ evt ] ).indexOf( "function" ) > -1 ) {
8745this.ssEventTrigger = {
8746_namespace: namespace,
8747_args: args
8748};
8749this[ evt ]();
8750} else {
8751doc.documentElement[ evt ] = {
8752"el": this,
8753_namespace: namespace,
8754_args: args
8755};
8756}
8757}
8758}
8759});
8760};
8761return shoestring;
8762}));
8763(function (factory) {
8764if (typeof define === 'function' && define.amd) {
8765define(['shoestring'], factory);
8766} else if (typeof module === 'object' && module.exports) {
8767module.exports = function( root, shoestring ) {
8768if ( shoestring === undefined ) {
8769if ( typeof window !== 'undefined' ) {
8770shoestring = require('shoestring');
8771} else {
8772shoestring = require('shoestring')(root);
8773}
8774}
8775factory(shoestring);
8776return shoestring;
8777};
8778} else {
8779factory(shoestring);
8780}
8781}(function ($) {
8782var Tablesaw, win = typeof window !== "undefined" ? window : this;
8783if( typeof Tablesaw === "undefined" ) {
8784Tablesaw = {
8785i18n: {
8786modes: [ 'Stack', 'Swipe', 'Toggle' ],
8787columns: 'Col<span class=\"a11y-sm\">umn</span>s',
8788columnBtnText: 'Columns',
8789columnsDialogError: 'No eligible columns.',
8790sort: 'Sort'
8791},
8792mustard: ( 'querySelector' in document ) &&
8793( 'head' in document ) &&
8794( !window.blackberry || window.WebKitPoint ) &&
8795!window.operamini
8796};
8797}
8798if( !Tablesaw.config ) {
8799Tablesaw.config = {};
8800}
8801if( Tablesaw.mustard ) {
8802$( document.documentElement ).addClass( 'tablesaw-enhanced' );
8803}
8804(function() {
8805var pluginName = "tablesaw",
8806classes = {
8807toolbar: "tablesaw-bar"
8808},
8809events = {
8810create: "tablesawcreate",
8811destroy: "tablesawdestroy",
8812refresh: "tablesawrefresh"
8813},
8814defaultMode = "stack",
8815initSelector = "table[data-tablesaw-mode],table[data-tablesaw-sortable]";
8816var Table = function( element ) {
8817if( !element ) {
8818throw new Error( "Tablesaw requires an element." );
8819}
8820this.table = element;
8821this.$table = $( element );
8822this.mode = this.$table.attr( "data-tablesaw-mode" ) || defaultMode;
8823this.init();
8824};
8825Table.prototype.init = function() {
8826if ( !this.$table.attr( "id" ) ) {
8827this.$table.attr( "id", pluginName + "-" + Math.round( Math.random() * 10000 ) );
8828}
8829this.createToolbar();
8830var colstart = this._initCells();
8831this.$table.trigger( events.create, [ this, colstart ] );
8832};
8833Table.prototype._initCells = function() {
8834var colstart,
8835thrs = this.table.querySelectorAll( "thead tr" ),
8836self = this;
8837$( thrs ).each( function(){
8838var coltally = 0;
8839var children = $( this ).children();
8840var columnlookup = [];
8841children.each( function(){
8842var span = parseInt( this.getAttribute( "colspan" ), 10 );
8843columnlookup[coltally] = this;
8844colstart = coltally + 1;
8845if( span ){
8846for( var k = 0; k < span - 1; k++ ){
8847coltally++;
8848columnlookup[coltally] = this;
8849}
8850}
8851this.cells = [];
8852coltally++;
8853});
8854self.$table.find("tr").not( thrs[0]).each( function() {
8855var cellcoltally = 0;
8856$(this).children().each(function () {
8857var span = parseInt( this.getAttribute( "colspan" ), 10 );
8858columnlookup[cellcoltally].cells.push(this);
8859if (span) {
8860cellcoltally += span;
8861} else {
8862cellcoltally++;
8863}
8864});
8865});
8866});
8867return colstart;
8868};
8869Table.prototype.refresh = function() {
8870this._initCells();
8871this.$table.trigger( events.refresh );
8872};
8873Table.prototype.createToolbar = function() {
8874var $toolbar = this.$table.prev().filter( '.' + classes.toolbar );
8875if( !$toolbar.length ) {
8876$toolbar = $( '<div>' )
8877.addClass( classes.toolbar )
8878.insertBefore( this.$table );
8879}
8880this.$toolbar = $toolbar;
8881if( this.mode ) {
8882this.$toolbar.addClass( 'tablesaw-mode-' + this.mode );
8883}
8884};
8885Table.prototype.destroy = function() {
8886this.$table.prev().filter( '.' + classes.toolbar ).each(function() {
8887this.className = this.className.replace( /\btablesaw-mode\-\w*\b/gi, '' );
8888});
8889var tableId = this.$table.attr( 'id' );
8890$( document ).off( "." + tableId );
8891$( window ).off( "." + tableId );
8892this.$table.trigger( events.destroy, [ this ] );
8893this.$table.removeData( pluginName );
8894};
8895$.fn[ pluginName ] = function() {
8896return this.each( function() {
8897var $t = $( this );
8898if( $t.data( pluginName ) ){
8899return;
8900}
8901var table = new Table( this );
8902$t.data( pluginName, table );
8903});
8904};
8905$( document ).on( "enhance.tablesaw", function( e ) {
8906if( Tablesaw.mustard ) {
8907$( e.target ).find( initSelector )[ pluginName ]();
8908}
8909});
8910}());
8911;(function(){
8912var classes = {
8913stackTable: 'tablesaw-stack',
8914cellLabels: 'tablesaw-cell-label',
8915cellContentLabels: 'tablesaw-cell-content'
8916};
8917var data = {
8918obj: 'tablesaw-stack'
8919};
8920var attrs = {
8921labelless: 'data-tablesaw-no-labels',
8922hideempty: 'data-tablesaw-hide-empty'
8923};
8924var Stack = function( element ) {
8925this.$table = $( element );
8926this.labelless = this.$table.is( '[' + attrs.labelless + ']' );
8927this.hideempty = this.$table.is( '[' + attrs.hideempty + ']' );
8928if( !this.labelless ) {
8929this.allHeaders = this.$table.find( "th" );
8930}
8931this.$table.data( data.obj, this );
8932};
8933Stack.prototype.init = function( colstart ) {
8934this.$table.addClass( classes.stackTable );
8935if( this.labelless ) {
8936return;
8937}
8938var reverseHeaders = $( this.allHeaders );
8939var hideempty = this.hideempty;
8940reverseHeaders.each(function(){
8941var $t = $( this ),
8942$cells = $( this.cells ).filter(function() {
8943return !$( this ).parent().is( "[" + attrs.labelless + "]" ) && ( !hideempty || !$( this ).is( ":empty" ) );
8944}),
8945hierarchyClass = $cells.not( this ).filter( "thead th" ).length && " tablesaw-cell-label-top",
8946$sortableButton = $t.find( ".tablesaw-sortable-btn" ),
8947html = $sortableButton.length ? $sortableButton.html() : $t.html();
8948if( html !== "" ){
8949if( hierarchyClass ){
8950var iteration = parseInt( $( this ).attr( "colspan" ), 10 ),
8951filter = "";
8952if( iteration ){
8953filter = "td:nth-child("+ iteration +"n + " + ( colstart ) +")";
8954}
8955$cells.filter( filter ).prepend( "<b class='" + classes.cellLabels + hierarchyClass + "'>" + html + "</b>"  );
8956} else {
8957$cells.wrapInner( "<span class='" + classes.cellContentLabels + "'></span>" );
8958$cells.prepend( "<b class='" + classes.cellLabels + "'>" + html + "</b>"  );
8959}
8960}
8961});
8962};
8963Stack.prototype.destroy = function() {
8964this.$table.removeClass( classes.stackTable );
8965this.$table.find( '.' + classes.cellLabels ).remove();
8966this.$table.find( '.' + classes.cellContentLabels ).each(function() {
8967$( this ).replaceWith( this.childNodes );
8968});
8969};
8970$( document ).on( "tablesawcreate", function( e, tablesaw, colstart ){
8971if( tablesaw.mode === 'stack' ){
8972var table = new Stack( tablesaw.table );
8973table.init( colstart );
8974}
8975} );
8976$( document ).on( "tablesawdestroy", function( e, tablesaw ){
8977if( tablesaw.mode === 'stack' ){
8978$( tablesaw.table ).data( data.obj ).destroy();
8979}
8980} );
8981}());
8982;(function() {
8983var pluginName = "tablesawbtn",
8984methods = {
8985_create: function(){
8986return $( this ).each(function() {
8987$( this )
8988.trigger( "beforecreate." + pluginName )
8989[ pluginName ]( "_init" )
8990.trigger( "create." + pluginName );
8991});
8992},
8993_init: function(){
8994var oEl = $( this ),
8995sel = this.getElementsByTagName( "select" )[ 0 ];
8996if( sel ) {
8997$( this )
8998.addClass( "btn-select" )
8999[ pluginName ]( "_select", sel );
9000}
9001return oEl;
9002},
9003_select: function( sel ) {
9004var update = function( oEl, sel ) {
9005var opts = $( sel ).find( "option" );
9006var label = document.createElement( "span" );
9007var el;
9008var children;
9009var found = false;
9010label.setAttribute( "aria-hidden", "true" );
9011label.innerHTML = "&#160;";
9012opts.each(function() {
9013var opt = this;
9014if( opt.selected ) {
9015label.innerHTML = opt.text;
9016}
9017});
9018children = oEl.childNodes;
9019if( opts.length > 0 ){
9020for( var i = 0, l = children.length; i < l; i++ ) {
9021el = children[ i ];
9022if( el && el.nodeName.toUpperCase() === "SPAN" ) {
9023oEl.replaceChild( label, el );
9024found = true;
9025}
9026}
9027if( !found ) {
9028oEl.insertBefore( label, oEl.firstChild );
9029}
9030}
9031};
9032update( this, sel );
9033$( this ).on( "change refresh", function() {
9034update( this, sel );
9035});
9036}
9037};
9038$.fn[ pluginName ] = function( arrg, a, b, c ) {
9039return this.each(function() {
9040if( arrg && typeof( arrg ) === "string" ){
9041return $.fn[ pluginName ].prototype[ arrg ].call( this, a, b, c );
9042}
9043if( $( this ).data( pluginName + "active" ) ){
9044return $( this );
9045}
9046$( this ).data( pluginName + "active", true );
9047$.fn[ pluginName ].prototype._create.call( this );
9048});
9049};
9050$.extend( $.fn[ pluginName ].prototype, methods );
9051}());
9052;(function(){
9053var ColumnToggle = function( element ) {
9054this.$table = $( element );
9055if( !this.$table.length ) {
9056return;
9057}
9058this.classes = {
9059columnToggleTable: 'tablesaw-columntoggle',
9060columnBtnContain: 'tablesaw-columntoggle-btnwrap tablesaw-advance',
9061columnBtn: 'tablesaw-columntoggle-btn tablesaw-nav-btn down',
9062popup: 'tablesaw-columntoggle-popup',
9063priorityPrefix: 'tablesaw-priority-',
9064toolbar: 'tablesaw-bar'
9065};
9066this.headers = this.$table.find( "tr" ).eq( 0 ).find( "th" );
9067this.$table.data( 'tablesaw-coltoggle', this );
9068};
9069ColumnToggle.prototype.init = function() {
9070if( !this.$table.length ) {
9071return;
9072}
9073var tableId,
9074id,
9075$menuButton,
9076$popup,
9077$menu,
9078$btnContain,
9079self = this;
9080this.$table.addClass( this.classes.columnToggleTable );
9081tableId = this.$table.attr( "id" );
9082id = tableId + "-popup";
9083$btnContain = $( "<div class='" + this.classes.columnBtnContain + "'></div>" );
9084$menuButton = $( "<a href='#" + id + "' class='btn btn-micro " + this.classes.columnBtn +"' data-popup-link>" +
9085"<span>" + Tablesaw.i18n.columnBtnText + "</span></a>" );
9086$popup = $( "<div class='dialog-table-coltoggle " + this.classes.popup + "' id='" + id + "'></div>" );
9087$menu = $( "<div class='btn-group'></div>" );
9088var hasNonPersistentHeaders = false;
9089$( this.headers ).not( "td" ).each( function() {
9090var $this = $( this ),
9091priority = $this.attr("data-tablesaw-priority"),
9092$cells = self.$getCells( this );
9093if( priority && priority !== "persist" ) {
9094$cells.addClass( self.classes.priorityPrefix + priority );
9095$("<label><input type='checkbox' checked>" + $this.text() + "</label>" )
9096.appendTo( $menu )
9097.children( 0 )
9098.data( "tablesaw-header", this );
9099hasNonPersistentHeaders = true;
9100}
9101});
9102if( !hasNonPersistentHeaders ) {
9103$menu.append( '<label>' + Tablesaw.i18n.columnsDialogError + '</label>' );
9104}
9105$menu.appendTo( $popup );
9106$menu.find( 'input[type="checkbox"]' ).on( "change", function(e) {
9107var checked = e.target.checked;
9108var $cells = self.$getCellsFromCheckbox( e.target );
9109$cells[ !checked ? "addClass" : "removeClass" ]( "tablesaw-cell-hidden" );
9110$cells[ checked ? "addClass" : "removeClass" ]( "tablesaw-cell-visible" );
9111self.$table.trigger( 'tablesawcolumns' );
9112});
9113$menuButton.appendTo( $btnContain );
9114$btnContain.appendTo( this.$table.prev().filter( '.' + this.classes.toolbar ) );
9115function closePopup( event ) {
9116if( event && $( event.target ).closest( "." + self.classes.popup ).length ) {
9117return;
9118}
9119$( document ).off( 'click.' + tableId );
9120$menuButton.removeClass( 'up' ).addClass( 'down' );
9121$btnContain.removeClass( 'visible' );
9122}
9123var closeTimeout;
9124function openPopup() {
9125$btnContain.addClass( 'visible' );
9126$menuButton.removeClass( 'down' ).addClass( 'up' );
9127$( document ).off( 'click.' + tableId, closePopup );
9128window.clearTimeout( closeTimeout );
9129closeTimeout = window.setTimeout(function() {
9130$( document ).one( 'click.' + tableId, closePopup );
9131}, 15 );
9132}
9133$menuButton.on( "click.tablesaw", function( event ) {
9134event.preventDefault();
9135if( !$btnContain.is( ".visible" ) ) {
9136openPopup();
9137} else {
9138closePopup();
9139}
9140});
9141$popup.appendTo( $btnContain );
9142this.$menu = $menu;
9143$(window).on( "resize." + tableId, function(){
9144self.refreshToggle();
9145});
9146this.refreshToggle();
9147};
9148ColumnToggle.prototype.$getCells = function( th ) {
9149return $( th ).add( th.cells );
9150};
9151ColumnToggle.prototype.$getCellsFromCheckbox = function( checkbox ) {
9152var th = $( checkbox ).data( "tablesaw-header" );
9153return this.$getCells( th );
9154};
9155ColumnToggle.prototype.refreshToggle = function() {
9156var self = this;
9157this.$menu.find( "input" ).each( function() {
9158this.checked = self.$getCellsFromCheckbox( this ).eq( 0 ).css( "display" ) === "table-cell";
9159});
9160};
9161ColumnToggle.prototype.refreshPriority = function(){
9162var self = this;
9163$(this.headers).not( "td" ).each( function() {
9164var $this = $( this ),
9165priority = $this.attr("data-tablesaw-priority"),
9166$cells = $this.add( this.cells );
9167if( priority && priority !== "persist" ) {
9168$cells.addClass( self.classes.priorityPrefix + priority );
9169}
9170});
9171};
9172ColumnToggle.prototype.destroy = function() {
9173this.$table.removeClass( this.classes.columnToggleTable );
9174this.$table.find( 'th, td' ).each(function() {
9175var $cell = $( this );
9176$cell.removeClass( 'tablesaw-cell-hidden' )
9177.removeClass( 'tablesaw-cell-visible' );
9178this.className = this.className.replace( /\bui\-table\-priority\-\d\b/g, '' );
9179});
9180};
9181$( document ).on( "tablesawcreate", function( e, tablesaw ){
9182if( tablesaw.mode === 'columntoggle' ){
9183var table = new ColumnToggle( tablesaw.table );
9184table.init();
9185}
9186} );
9187$( document ).on( "tablesawdestroy", function( e, tablesaw ){
9188if( tablesaw.mode === 'columntoggle' ){
9189$( tablesaw.table ).data( 'tablesaw-coltoggle' ).destroy();
9190}
9191} );
9192}());
9193;(function() {
9194function getSortValue( cell ) {
9195var text = [];
9196$( cell.childNodes ).each(function() {
9197var $el = $( this );
9198if( $el.is( 'input, select' ) ) {
9199text.push( $el.val() );
9200} else if( $el.is( '.tablesaw-cell-label' ) ) {
9201} else {
9202text.push( ( $el.text() || '' ).replace(/^\s+|\s+$/g, '') );
9203}
9204});
9205return text.join( '' );
9206}
9207var pluginName = "tablesaw-sortable",
9208initSelector = "table[data-" + pluginName + "]",
9209sortableSwitchSelector = "[data-" + pluginName + "-switch]",
9210attrs = {
9211defaultCol: "data-tablesaw-sortable-default-col",
9212numericCol: "data-tablesaw-sortable-numeric"
9213},
9214classes = {
9215head: pluginName + "-head",
9216ascend: pluginName + "-ascending",
9217descend: pluginName + "-descending",
9218switcher: pluginName + "-switch",
9219tableToolbar: 'tablesaw-toolbar',
9220sortButton: pluginName + "-btn"
9221},
9222methods = {
9223_create: function( o ){
9224return $( this ).each(function() {
9225var init = $( this ).data( pluginName + "-init" );
9226if( init ) {
9227return false;
9228}
9229$( this )
9230.data( pluginName + "-init", true )
9231.trigger( "beforecreate." + pluginName )
9232[ pluginName ]( "_init" , o )
9233.trigger( "create." + pluginName );
9234});
9235},
9236_init: function(){
9237var el = $( this ),
9238heads,
9239$switcher;
9240var addClassToTable = function(){
9241el.addClass( pluginName );
9242},
9243addClassToHeads = function( h ){
9244$.each( h , function( i , v ){
9245$( v ).addClass( classes.head );
9246});
9247},
9248makeHeadsActionable = function( h , fn ){
9249$.each( h , function( i , v ){
9250var b = $( "<button class='" + classes.sortButton + "'/>" );
9251b.on( "click" , { col: v } , fn );
9252$( v ).wrapInner( b );
9253b.append( "<span class='tablesaw-sortable-arrow'>" );
9254});
9255},
9256clearOthers = function( sibs ){
9257$.each( sibs , function( i , v ){
9258var col = $( v );
9259col.removeAttr( attrs.defaultCol );
9260col.removeClass( classes.ascend );
9261col.removeClass( classes.descend );
9262});
9263},
9264headsOnAction = function( e ){
9265if( $( e.target ).is( 'a[href]' ) ) {
9266return;
9267}
9268e.stopPropagation();
9269var head = $( this ).parent(),
9270v = e.data.col,
9271newSortValue = heads.index( head[0] );
9272clearOthers( head.siblings() );
9273if( head.is( "." + classes.descend ) ){
9274el[ pluginName ]( "sortBy" , v , true);
9275newSortValue += '_asc';
9276} else {
9277el[ pluginName ]( "sortBy" , v );
9278newSortValue += '_desc';
9279}
9280if( $switcher ) {
9281$switcher.find( 'select' ).val( newSortValue ).trigger( 'refresh' );
9282}
9283e.preventDefault();
9284},
9285handleDefault = function( heads ){
9286$.each( heads , function( idx , el ){
9287var $el = $( el );
9288if( $el.is( "[" + attrs.defaultCol + "]" ) ){
9289if( !$el.is( "." + classes.descend ) ) {
9290$el.addClass( classes.ascend );
9291}
9292}
9293});
9294},
9295addSwitcher = function( heads ){
9296$switcher = $( '<div>' ).addClass( classes.switcher ).addClass( classes.tableToolbar );
9297var html = [ '<label>' + Tablesaw.i18n.sort + ':' ];
9298html.push( '<span class="btn"><select>' );
9299heads.each(function( j ) {
9300var $t = $( this );
9301var isDefaultCol = $t.is( "[" + attrs.defaultCol + "]" );
9302var isDescending = $t.is( "." + classes.descend );
9303var hasNumericAttribute = $t.is( '[data-sortable-numeric]' );
9304var numericCount = 0;
9305var numericCountMax = 5;
9306$( this.cells.slice( 0, numericCountMax ) ).each(function() {
9307if( !isNaN( parseInt( getSortValue( this ), 10 ) ) ) {
9308numericCount++;
9309}
9310});
9311var isNumeric = numericCount === numericCountMax;
9312if( !hasNumericAttribute ) {
9313$t.attr( "data-sortable-numeric", isNumeric ? "" : "false" );
9314}
9315html.push( '<option' + ( isDefaultCol && !isDescending ? ' selected' : '' ) + ' value="' + j + '_asc">' + $t.text() + ' ' + ( isNumeric ? '&#x2191;' : '(A-Z)' ) + '</option>' );
9316html.push( '<option' + ( isDefaultCol && isDescending ? ' selected' : '' ) + ' value="' + j + '_desc">' + $t.text() + ' ' + ( isNumeric ? '&#x2193;' : '(Z-A)' ) + '</option>' );
9317});
9318html.push( '</select></span></label>' );
9319$switcher.html( html.join('') );
9320var $toolbar = el.prev().filter( '.tablesaw-bar' ),
9321$firstChild = $toolbar.children().eq( 0 );
9322if( $firstChild.length ) {
9323$switcher.insertBefore( $firstChild );
9324} else {
9325$switcher.appendTo( $toolbar );
9326}
9327$switcher.find( '.btn' ).tablesawbtn();
9328$switcher.find( 'select' ).on( 'change', function() {
9329var val = $( this ).val().split( '_' ),
9330head = heads.eq( val[ 0 ] );
9331clearOthers( head.siblings() );
9332el[ pluginName ]( 'sortBy', head.get( 0 ), val[ 1 ] === 'asc' );
9333});
9334};
9335addClassToTable();
9336heads = el.find( "thead th[data-" + pluginName + "-col]" );
9337addClassToHeads( heads );
9338makeHeadsActionable( heads , headsOnAction );
9339handleDefault( heads );
9340if( el.is( sortableSwitchSelector ) ) {
9341addSwitcher( heads, el.find('tbody tr:nth-child(-n+3)') );
9342}
9343},
9344getColumnNumber: function( col ){
9345return $( col ).prevAll().length;
9346},
9347getTableRows: function(){
9348return $( this ).find( "tbody tr" );
9349},
9350sortRows: function( rows , colNum , ascending, col ){
9351var cells, fn, sorted;
9352var getCells = function( rows ){
9353var cells = [];
9354$.each( rows , function( i , r ){
9355var element = $( r ).children().get( colNum );
9356cells.push({
9357element: element,
9358cell: getSortValue( element ),
9359rowNum: i
9360});
9361});
9362return cells;
9363},
9364getSortFxn = function( ascending, forceNumeric ){
9365var fn,
9366regex = /[^\-\+\d\.]/g;
9367if( ascending ){
9368fn = function( a , b ){
9369if( forceNumeric ) {
9370return parseFloat( a.cell.replace( regex, '' ) ) - parseFloat( b.cell.replace( regex, '' ) );
9371} else {
9372return a.cell.toLowerCase() > b.cell.toLowerCase() ? 1 : -1;
9373}
9374};
9375} else {
9376fn = function( a , b ){
9377if( forceNumeric ) {
9378return parseFloat( b.cell.replace( regex, '' ) ) - parseFloat( a.cell.replace( regex, '' ) );
9379} else {
9380return a.cell.toLowerCase() < b.cell.toLowerCase() ? 1 : -1;
9381}
9382};
9383}
9384return fn;
9385},
9386applyToRows = function( sorted , rows ){
9387var newRows = [], i, l, cur;
9388for( i = 0, l = sorted.length ; i < l ; i++ ){
9389cur = sorted[ i ].rowNum;
9390newRows.push( rows[cur] );
9391}
9392return newRows;
9393};
9394cells = getCells( rows );
9395var customFn = $( col ).data( 'tablesaw-sort' );
9396fn = ( customFn && typeof customFn === "function" ? customFn( ascending ) : false ) ||
9397getSortFxn( ascending, $( col ).is( '[data-sortable-numeric]' ) && !$( col ).is( '[data-sortable-numeric="false"]' ) );
9398sorted = cells.sort( fn );
9399rows = applyToRows( sorted , rows );
9400return rows;
9401},
9402replaceTableRows: function( rows ){
9403var el = $( this ),
9404body = el.find( "tbody" );
9405for( var j = 0, k = rows.length; j < k; j++ ) {
9406body.append( rows[ j ] );
9407}
9408},
9409makeColDefault: function( col , a ){
9410var c = $( col );
9411c.attr( attrs.defaultCol , "true" );
9412if( a ){
9413c.removeClass( classes.descend );
9414c.addClass( classes.ascend );
9415} else {
9416c.removeClass( classes.ascend );
9417c.addClass( classes.descend );
9418}
9419},
9420sortBy: function( col , ascending ){
9421var el = $( this ), colNum, rows;
9422colNum = el[ pluginName ]( "getColumnNumber" , col );
9423rows = el[ pluginName ]( "getTableRows" );
9424rows = el[ pluginName ]( "sortRows" , rows , colNum , ascending, col );
9425el[ pluginName ]( "replaceTableRows" , rows );
9426el[ pluginName ]( "makeColDefault" , col , ascending );
9427el.trigger( "tablesaw-sorted" );
9428}
9429};
9430$.fn[ pluginName ] = function( arrg ) {
9431var args = Array.prototype.slice.call( arguments , 1),
9432returnVal;
9433if( arrg && typeof( arrg ) === "string" ){
9434returnVal = $.fn[ pluginName ].prototype[ arrg ].apply( this[0], args );
9435return (typeof returnVal !== "undefined")? returnVal:$(this);
9436}
9437if( !$( this ).data( pluginName + "-active" ) ){
9438$( this ).data( pluginName + "-active", true );
9439$.fn[ pluginName ].prototype._create.call( this , arrg );
9440}
9441return $(this);
9442};
9443$.extend( $.fn[ pluginName ].prototype, methods );
9444$( document ).on( "tablesawcreate", function( e, Tablesaw ) {
9445if( Tablesaw.$table.is( initSelector ) ) {
9446Tablesaw.$table[ pluginName ]();
9447}
9448});
9449}());
9450;(function(){
9451$.extend( Tablesaw.config, {
9452swipe: {
9453horizontalThreshold: 15,
9454verticalThreshold: 30
9455}
9456});
9457function sumStyles( $el, props ) {
9458var total = 0;
9459for( var j = 0, k = props.length; j < k; j++ ) {
9460total += parseInt( $el.css( props[ j ] ) || 0, 10 );
9461}
9462return total;
9463}
9464function outerWidth( el ) {
9465var $el = $( el );
9466return $el.width() + sumStyles( $el, [ "border-left-width", "border-right-width" ] );
9467}
9468var classes = {
9469toolbar: "tablesaw-bar",
9470hideBtn: "disabled",
9471persistWidths: "tablesaw-fix-persist",
9472allColumnsVisible: 'tablesaw-all-cols-visible'
9473};
9474var attrs = {
9475disableTouchEvents: "data-tablesaw-no-touch"
9476};
9477function createSwipeTable( $table ){
9478var $btns = $( "<div class='tablesaw-advance'></div>" ),
9479$prevBtn = $( "<a href='#' class='tablesaw-nav-btn btn btn-micro left' title='Previous Column'></a>" ).appendTo( $btns ),
9480$nextBtn = $( "<a href='#' class='tablesaw-nav-btn btn btn-micro right' title='Next Column'></a>" ).appendTo( $btns ),
9481$headerCells = $table.find( "thead th" ),
9482$headerCellsNoPersist = $headerCells.not( '[data-tablesaw-priority="persist"]' ),
9483headerWidths = [],
9484$head = $( document.head || 'head' ),
9485tableId = $table.attr( 'id' );
9486if( !$headerCells.length ) {
9487throw new Error( "tablesaw swipe: no header cells found. Are you using <th> inside of <thead>?" );
9488}
9489$table.addClass( "tablesaw-swipe" );
9490$headerCells.each(function() {
9491var width = outerWidth( this );
9492headerWidths.push( width );
9493});
9494$btns.appendTo( $table.prev().filter( '.tablesaw-bar' ) );
9495if( !tableId ) {
9496tableId = 'tableswipe-' + Math.round( Math.random() * 10000 );
9497$table.attr( 'id', tableId );
9498}
9499function $getCells( headerCell ) {
9500return $( headerCell.cells ).add( headerCell );
9501}
9502function showColumn( headerCell ) {
9503$getCells( headerCell ).removeClass( 'tablesaw-cell-hidden' );
9504}
9505function hideColumn( headerCell ) {
9506$getCells( headerCell ).addClass( 'tablesaw-cell-hidden' );
9507}
9508function persistColumn( headerCell ) {
9509$getCells( headerCell ).addClass( 'tablesaw-cell-persist' );
9510}
9511function isPersistent( headerCell ) {
9512return $( headerCell ).is( '[data-tablesaw-priority="persist"]' );
9513}
9514function unmaintainWidths() {
9515$table.removeClass( classes.persistWidths );
9516$( '#' + tableId + '-persist' ).remove();
9517}
9518function maintainWidths() {
9519var prefix = '#' + tableId + '.tablesaw-swipe ',
9520styles = [],
9521tableWidth = $table.width(),
9522hash = [],
9523newHash;
9524$headerCells.each(function( index ) {
9525var width;
9526if( isPersistent( this ) ) {
9527width = outerWidth( this );
9528if( width < tableWidth * 0.75 ) {
9529hash.push( index + '-' + width );
9530styles.push( prefix + ' .tablesaw-cell-persist:nth-child(' + ( index + 1 ) + ') { width: ' + width + 'px; }' );
9531}
9532}
9533});
9534newHash = hash.join( '_' );
9535$table.addClass( classes.persistWidths );
9536var $style = $( '#' + tableId + '-persist' );
9537if( !$style.length || $style.data( 'tablesaw-hash' ) !== newHash ) {
9538$style.remove();
9539if( styles.length ) {
9540$( '<style>' + styles.join( "\n" ) + '</style>' )
9541.attr( 'id', tableId + '-persist' )
9542.data( 'tablesaw-hash', newHash )
9543.appendTo( $head );
9544}
9545}
9546}
9547function getNext(){
9548var next = [],
9549checkFound;
9550$headerCellsNoPersist.each(function( i ) {
9551var $t = $( this ),
9552isHidden = $t.css( "display" ) === "none" || $t.is( ".tablesaw-cell-hidden" );
9553if( !isHidden && !checkFound ) {
9554checkFound = true;
9555next[ 0 ] = i;
9556} else if( isHidden && checkFound ) {
9557next[ 1 ] = i;
9558return false;
9559}
9560});
9561return next;
9562}
9563function getPrev(){
9564var next = getNext();
9565return [ next[ 1 ] - 1 , next[ 0 ] - 1 ];
9566}
9567function nextpair( fwd ){
9568return fwd ? getNext() : getPrev();
9569}
9570function canAdvance( pair ){
9571return pair[ 1 ] > -1 && pair[ 1 ] < $headerCellsNoPersist.length;
9572}
9573function matchesMedia() {
9574var matchMedia = $table.attr( "data-tablesaw-swipe-media" );
9575return !matchMedia || ( "matchMedia" in win ) && win.matchMedia( matchMedia ).matches;
9576}
9577function fakeBreakpoints() {
9578if( !matchesMedia() ) {
9579return;
9580}
9581var	containerWidth = $table.parent().width(),
9582persist = [],
9583sum = 0,
9584sums = [],
9585visibleNonPersistantCount = $headerCells.length;
9586$headerCells.each(function( index ) {
9587var $t = $( this ),
9588isPersist = $t.is( '[data-tablesaw-priority="persist"]' );
9589persist.push( isPersist );
9590sum += headerWidths[ index ];
9591sums.push( sum );
9592if( isPersist || sum > containerWidth ) {
9593visibleNonPersistantCount--;
9594}
9595});
9596var needsNonPersistentColumn = visibleNonPersistantCount === 0;
9597$headerCells.each(function( index ) {
9598if( persist[ index ] ) {
9599persistColumn( this );
9600return;
9601}
9602if( sums[ index ] <= containerWidth || needsNonPersistentColumn ) {
9603needsNonPersistentColumn = false;
9604showColumn( this );
9605} else {
9606hideColumn( this );
9607}
9608});
9609unmaintainWidths();
9610$table.trigger( 'tablesawcolumns' );
9611}
9612function advance( fwd ){
9613var pair = nextpair( fwd );
9614if( canAdvance( pair ) ){
9615if( isNaN( pair[ 0 ] ) ){
9616if( fwd ){
9617pair[0] = 0;
9618}
9619else {
9620pair[0] = $headerCellsNoPersist.length - 1;
9621}
9622}
9623maintainWidths();
9624hideColumn( $headerCellsNoPersist.get( pair[ 0 ] ) );
9625showColumn( $headerCellsNoPersist.get( pair[ 1 ] ) );
9626$table.trigger( 'tablesawcolumns' );
9627}
9628}
9629$prevBtn.add( $nextBtn ).on( "click", function( e ){
9630advance( !!$( e.target ).closest( $nextBtn ).length );
9631e.preventDefault();
9632});
9633function getCoord( event, key ) {
9634return ( event.touches || event.originalEvent.touches )[ 0 ][ key ];
9635}
9636if( !$table.is( "[" + attrs.disableTouchEvents + "]" ) ) {
9637$table
9638.on( "touchstart.swipetoggle", function( e ){
9639var originX = getCoord( e, 'pageX' ),
9640originY = getCoord( e, 'pageY' ),
9641x,
9642y;
9643$( win ).off( "resize", fakeBreakpoints );
9644$( this )
9645.on( "touchmove", function( e ){
9646x = getCoord( e, 'pageX' );
9647y = getCoord( e, 'pageY' );
9648var cfg = Tablesaw.config.swipe;
9649if( Math.abs( x - originX ) > cfg.horizontalThreshold && Math.abs( y - originY ) < cfg.verticalThreshold ) {
9650e.preventDefault();
9651}
9652})
9653.on( "touchend.swipetoggle", function(){
9654var cfg = Tablesaw.config.swipe;
9655if( Math.abs( y - originY ) < cfg.verticalThreshold ) {
9656if( x - originX < -1 * cfg.horizontalThreshold ){
9657advance( true );
9658}
9659if( x - originX > cfg.horizontalThreshold ){
9660advance( false );
9661}
9662}
9663window.setTimeout(function() {
9664$( win ).on( "resize", fakeBreakpoints );
9665}, 300);
9666$( this ).off( "touchmove touchend" );
9667});
9668});
9669}
9670$table
9671.on( "tablesawcolumns.swipetoggle", function(){
9672var canGoPrev = canAdvance( getPrev() );
9673var canGoNext = canAdvance( getNext() );
9674$prevBtn[ canGoPrev ? "removeClass" : "addClass" ]( classes.hideBtn );
9675$nextBtn[ canGoNext ? "removeClass" : "addClass" ]( classes.hideBtn );
9676$prevBtn.closest( "." + classes.toolbar )[ !canGoPrev && !canGoNext ? 'addClass' : 'removeClass' ]( classes.allColumnsVisible );
9677})
9678.on( "tablesawnext.swipetoggle", function(){
9679advance( true );
9680} )
9681.on( "tablesawprev.swipetoggle", function(){
9682advance( false );
9683} )
9684.on( "tablesawdestroy.swipetoggle", function(){
9685var $t = $( this );
9686$t.removeClass( 'tablesaw-swipe' );
9687$t.prev().filter( '.tablesaw-bar' ).find( '.tablesaw-advance' ).remove();
9688$( win ).off( "resize", fakeBreakpoints );
9689$t.off( ".swipetoggle" );
9690})
9691.on( "tablesawrefresh", function() {
9692headerWidths = [];
9693$headerCells.each(function() {
9694var width = outerWidth( this );
9695headerWidths.push( width );
9696});
9697fakeBreakpoints();
9698});
9699fakeBreakpoints();
9700$( win ).on( "resize", fakeBreakpoints );
9701}
9702$( document ).on( "tablesawcreate", function( e, tablesaw ){
9703if( tablesaw.mode === 'swipe' ){
9704createSwipeTable( tablesaw.$table );
9705}
9706} );
9707}());
9708;(function(){
9709var MiniMap = {
9710attr: {
9711init: 'data-tablesaw-minimap'
9712}
9713};
9714function createMiniMap( $table ){
9715var $btns = $( '<div class="tablesaw-advance minimap">' ),
9716$dotNav = $( '<ul class="tablesaw-advance-dots">' ).appendTo( $btns ),
9717hideDot = 'tablesaw-advance-dots-hide',
9718$headerCells = $table.find( 'thead th' );
9719$headerCells.each(function(){
9720$dotNav.append( '<li><i></i></li>' );
9721});
9722$btns.appendTo( $table.prev().filter( '.tablesaw-bar' ) );
9723function showMinimap( $table ) {
9724var mq = $table.attr( MiniMap.attr.init );
9725return !mq || win.matchMedia && win.matchMedia( mq ).matches;
9726}
9727function showHideNav(){
9728if( !showMinimap( $table ) ) {
9729$btns.css( "display", "none" );
9730return;
9731}
9732$btns.css( "display", "block" );
9733var dots = $dotNav.find( "li" ).removeClass( hideDot );
9734$table.find( "thead th" ).each(function(i){
9735if( $( this ).css( "display" ) === "none" ){
9736dots.eq( i ).addClass( hideDot );
9737}
9738}
9738);
9739}
9740showHideNav();
9741$( win ).on( "resize", showHideNav );
9742$table
9743.on( "tablesawcolumns.minimap", function(){
9744showHideNav();
9745})
9746.on( "tablesawdestroy.minimap", function(){
9747var $t = $( this );
9748$t.prev().filter( '.tablesaw-bar' ).find( '.tablesaw-advance' ).remove();
9749$( win ).off( "resize", showHideNav );
9750$t.off( ".minimap" );
9751});
9752}
9753$( document ).on( "tablesawcreate", function( e, tablesaw ){
9754if( ( tablesaw.mode === 'swipe' || tablesaw.mode === 'columntoggle' ) && tablesaw.$table.is( '[ ' + MiniMap.attr.init + ']' ) ){
9755createMiniMap( tablesaw.$table );
9756}
9757} );
9758}());
9759;(function() {
9760var S = {
9761selectors: {
9762init: 'table[data-tablesaw-mode-switch]'
9763},
9764attributes: {
9765excludeMode: 'data-tablesaw-mode-exclude'
9766},
9767classes: {
9768main: 'tablesaw-modeswitch',
9769toolbar: 'tablesaw-toolbar'
9770},
9771modes: [ 'stack', 'swipe', 'columntoggle' ],
9772init: function( table ) {
9773var $table = $( table ),
9774ignoreMode = $table.attr( S.attributes.excludeMode ),
9775$toolbar = $table.prev().filter( '.tablesaw-bar' ),
9776modeVal = '',
9777$switcher = $( '<div>' ).addClass( S.classes.main + ' ' + S.classes.toolbar );
9778var html = [ '<label>' + Tablesaw.i18n.columns + ':' ],
9779dataMode = $table.attr( 'data-tablesaw-mode' ),
9780isSelected;
9781html.push( '<span class="btn"><select>' );
9782for( var j=0, k = S.modes.length; j<k; j++ ) {
9783if( ignoreMode && ignoreMode.toLowerCase() === S.modes[ j ] ) {
9784continue;
9785}
9786isSelected = dataMode === S.modes[ j ];
9787if( isSelected ) {
9788modeVal = S.modes[ j ];
9789}
9790html.push( '<option' +
9791( isSelected ? ' selected' : '' ) +
9792' value="' + S.modes[ j ] + '">' + Tablesaw.i18n.modes[ j ] + '</option>' );
9793}
9794html.push( '</select></span></label>' );
9795$switcher.html( html.join( '' ) );
9796var $otherToolbarItems = $toolbar.find( '.tablesaw-advance' ).eq( 0 );
9797if( $otherToolbarItems.length ) {
9798$switcher.insertBefore( $otherToolbarItems );
9799} else {
9800$switcher.appendTo( $toolbar );
9801}
9802$switcher.find( '.btn' ).tablesawbtn();
9803$switcher.find( 'select' ).on( 'change', S.onModeChange );
9804},
9805onModeChange: function() {
9806var $t = $( this ),
9807$switcher = $t.closest( '.' + S.classes.main ),
9808$table = $t.closest( '.tablesaw-bar' ).next().eq( 0 ),
9809val = $t.val();
9810$switcher.remove();
9811$table.data( 'tablesaw' ).destroy();
9812$table.attr( 'data-tablesaw-mode', val );
9813$table.tablesaw();
9814}
9815};
9816$( win.document ).on( "tablesawcreate", function( e, Tablesaw ) {
9817if( Tablesaw.$table.is( S.selectors.init ) ) {
9818S.init( Tablesaw.table );
9819}
9820});
9821})();
9822}));
9823(function ($) {
9824gaProperty = $('[data-site-id]'); // Récupérer le code GA (généré par le CMS, soit dans l'html soit en js)
9825$('#cookies .agree-button').on('click', function(){
9826document.cookie = 'hasConsent=true; '+ getCookieExpireDate() +' ; path=/';
9827$('#cookies').remove();
9828});
9829var disableStr = 'ga-disable-' + gaProperty;
9830if (document.cookie.indexOf('hasConsent=false') > -1)
9831window[disableStr] = true;
9832function getCookieExpireDate()
9833{
9834var cookieTimeout = 34214400000;
9835var date = new Date();
9836date.setTime(date.getTime()+cookieTimeout);
9837var expires = "; expires="+date.toGMTString();
9838return expires;
9839}
9840function askConsent()
9841{
9842$('#cookies').show();
9843}
9844function getCookie(NomDuCookie)
9845{
9846if (document.cookie.length > 0)
9847{
9848begin = document.cookie.indexOf(NomDuCookie+"=");
9849if (begin != -1)
9850{
9851begin += NomDuCookie.length+1;
9852end = document.cookie.indexOf(";", begin);
9853if (end == -1)
9854end = document.cookie.length;
9855return unescape(document.cookie.substring(begin, end));
9856}
9857}
9858return null;
9859}
9860var consentCookie =  getCookie('hasConsent');
9861if (consentCookie == null)
9862{
9863var referrer_host = document.referrer.split('/')[2];
9864if ( referrer_host != document.location.hostname )
9865{
9866window[disableStr] = true;
9867window[disableStr] = true;
9868$(document).ready( function() {
9869askConsent();
9870});
9871}
9872else
9873document.cookie = 'hasConsent=true; '+ getCookieExpireDate() +' ; path=/';
9874}
9875}(jQuery));
9876(function ($) {
9877var debugOpen = [68,69,66,85,71,79,80,69,78];
9878var debugClose = [68,69,66,85,71,67,76,79,83,69];
9879var open = 0;
9880var close = 0;
9881$debug_window = $('#debug-master');
9882$(document).ready(function(){
9883if(localStorage.getItem('debugOpened')){
9884$debug_window.show();
9885}
9886$debug_window.find('.close').on('click', function(){
9887$debug_window.hide();
9888});
9889$(document).keydown(function (e) {
9890if (e.keyCode === debugOpen[open++]) {
9891if (open === debugOpen.length) {
9892$debug_window.show();
9893localStorage.setItem('debugOpened', true);
9894open = 0;
9895return false;
9896}
9897}
9898else {
9899open = 0;
9900}
9901if (e.keyCode === debugClose[close++]) {
9902if (close === debugClose.length) {
9903$debug_window.hide();
9904localStorage.removeItem('debugOpened');
9905close = 0;
9906return false;
9907}
9908}
9909else {
9910close = 0;
9911}
9912});
9913});
9914}(jQuery));
9915(function ($) {
9916var site_progress = 0;
9917var $loader = $('#loader');
9918$('body').waitForImages({
9919finished: function() {
9920},
9921each: function(loaded, count, success) { // Incrémente une variable site_progress en fonction du nombre d'image/vidéo du site chargée
9922if(site_progress < 100){ // Comportement à chaque actualisation de la variable
9923site_progress += 80 / count;
9924$loader.find('.loaded').html(Math.floor(site_progress));
9925}
9926},
9927waitForAll: true
9928});
9929$(window).load(function(){ // Comportement une fois le site complètement chargé
9930site_progress = 100;
9931$loader.find('.loaded').html('100%');
9932setTimeout(function(){
9933$loader.fadeOut();
9934}, 500);
9935});
9936}(jQuery));
9937(function ($) {
9938$(document).ready( function() {
9939$( '#skipnavigation ul li a' ).focus( function() {
9940$( '#skipnavigation' ).removeClass( 'sr-only' );
9941}).blur( function() {
9942$( '#skipnavigation' ).addClass( 'sr-only' );
9943});
9944});
9945}(jQuery));
9946(function ($) {
9947$(document).ready(function(){
9948$('.user-alert-banner .close').on('click', function(){
9949$('.user-alert-banner').slideUp();
9950sessionStorage.setItem('user_alert', true);
9951});
9952if(sessionStorage.getItem('user_alert')){
9953$('.user-alert-banner').hide();
9954}else{
9955$('.user-alert-banner').show();
9956}
9957});
9958}(jQuery));
9959(function ($) {
9960(function(){
9961$(document).ready(function(){
9962$('.toCustomSelect, .form-select').customSelect();
9963});
9964}(jQuery));
9965}(jQuery));
9966(function($){
9967$(document).ready(function(){
9968if($('input[type="date"]').length || $('input[data-type="date"]').length){
9969$('input[type="date"], input[data-type="date"]').datepicker($.datepicker.regional[ "fr" ]);
9970}
9971});
9972}(jQuery));
9973(function ($) {
9974function majSelectedFacet(){
9975$('.block-facetapi').removeClass('active');
9976$('.block-facetapi').each(function(index, element){
9977if($(element).find('.facetapi-active').length){
9978$(element).addClass('active');
9979}
9980});
9981}
9982if($('#facets').length){
9983$('.toggle-facets').on('click', function(){
9984$(this).parents('.block-facetapi').find('.facetapi-facetapi-links').slideToggle();
9985majSelectedFacet();
9986});
9987}
9988$(document).ready(function(){
9989majSelectedFacet();
9990$('body').on('click', function(e){
9991})
9992});
9993}(jQuery));
9994(function ($) {
9995var $form = $('#multipleStepsForm'),
9996$formContent = $form.find('.formContent'),
9997$btnPrevious = $( '#formPager .formPreviousStep' ),
9998$btnNext = $('#formPager .formNextStep'),
9999$btnSend = $('#formPager .formSendStep'),
10000$overview = $('#formOverview'),
10001$tabs = $form.find('a[data-toggle="tab"]'),
10002formControlClass = 'form-control',
10003formLabelClass = 'form-label',
10004formGroupClass = 'form-group',
10005formCurrentStep = 1,
10006formStepsCount = $form.attr('data-step-count'),
10007updateStep = true;
10008function displayStep(step){ // Affiche la step + toggle les éléments graphiques, n'effectue aucune vérif
10009$('div[data-step]').hide();
10010$('div[data-step="'+step+'"]').show();
10011$tabs.removeClass('completed current');
10012$tabs.each(function(element, index){
10013if($(this).attr('data-step') <= (step- 1) ){
10014$(this).addClass('completed');
10015}
10016if($(this).attr('data-step') == step ){
10017$(this).addClass('current');
10018}
10019});
10020var purcentage = Math.floor(step / formStepsCount*100);
10021$('.webform-progressbar-number .flexbox').html(purcentage + '%');
10022if( step == 1 ){
10023$btnPrevious.hide();
10024$btnSend.hide();
10025}else{
10026$btnPrevious.show();
10027}
10028if( step == formStepsCount ){
10029formGenerateOverview();
10030$btnNext.hide();
10031$btnSend.show();
10032$form.addClass('preview');
10033}else{
10034$btnNext.show();
10035$btnSend.hide();
10036$form.removeClass('preview');
10037}
10038}
10039function formNextStep(){ // Navigation via boutons next
10040if( setStep( formCurrentStep + 1 ) ){
10041formCurrentStep++;
10042updateStep = false;
10043displayStep(formCurrentStep);
10044updateStep = true;
10045}
10046}
10047function formPreviousStep(){ // Navigation via boutons prev
10048if( setStep( formCurrentStep - 1 ) ){
10049formCurrentStep--;
10050updateStep = false;
10051displayStep(formCurrentStep);
10052updateStep = true;
10053}
10054}
10055function formAnyStep(step){ // Navigation via tunnel de conversion
10056if(updateStep){ // Evite la multiplication du script si on est déjà en train de valider
10057if(step > formCurrentStep){ // Si on va vers l'avant on boucle sur toutes les étapes intermédiaire, on test la validation
10058for(var i=formCurrentStep+1; i <= step; i++){
10059if(setStep(i)){
10060formCurrentStep = i;
10061if(formCurrentStep == step){ // Pour la dernière occurence, on test la validation + on display
10062displayStep(formCurrentStep);
10063}
10064}else{
10065displayStep(formCurrentStep);  // Si erreur, on display l'étape avec l'erreur
10066break;
10067}
10068}
10069}else if(step < formCurrentStep){ // Si on retourne en arriere, pas de validation on go direct
10070formCurrentStep = step;
10071displayStep(formCurrentStep);
10072}
10073}
10074}
10075function formGenerateOverview() // Génère le récapitulatif
10076{
10077$overview.html( 'Génération en cours...' );
10078var overviewHtml = '';
10079var currentStep = 0;
10080var toDisplay = {};
10081$('.tab-pane').each(function(index, element){ // Ajout des étapes comme des objets
10082if(index < ($('.tab-pane').length -1) ){
10083var current_step = $(element).attr('data-step');
10084current_step = $( '#formSteps a[data-step="' + current_step + '"]' ).data( 'step-name' );
10085toDisplay[current_step] = {};
10086var labels = $(element).find('.'+formLabelClass);
10087labels.each(function(index, label){ // Ajout des labels comme un tableau de values (pour les checkboxes notamment)
10088var name, value;
10089name = $(label).text();
10090name = name.replace( '*', '' );
10091var $inputs = $(label).parents('.'+formGroupClass).find('input[type!="hidden"], textarea, select');
10092toDisplay[current_step][name] = [];
10093$inputs.each(function(index, input){ // Ajout des Inputs avec exception pour radio/checkbox/select
10094var inputCompleted = false;
10095if( $(input).attr('type') == 'radio' | $(input).attr('type') == 'checkbox'){
10096if( input.checked ){
10097value = $(input).next('label.option').text();
10098inputCompleted = true;
10099}
10100}else if( $(input).attr('type') == 'select' ){
10101if( $(input).val() ){
10102value = $(input).find('option:selected').text();
10103inputCompleted = true;
10104}
10105}else if( $(input).attr('type') == 'file' ){
10106if( $(input).val() ){
10107value = $(input).val();
10108value = value.replace(/^.*[\\\/]/, '');
10109inputCompleted = true;
10110}
10111}else if( $(input).val() ){
10112value = $(input).val();
10113inputCompleted = true;
10114}
10115if( inputCompleted ){ // Si l'input est rempli on ajoute sa value au tableau labels
10116toDisplay[current_step][name].push(value);
10117}
10118});
10119});
10120}
10121});
10122for(var display_step in toDisplay){ // Boucle sur les étapes
10123var labels = toDisplay[display_step];
10124var fieldHtml = '';
10125for(var display_label in labels){ // Boucle sur les labels
10126var inputs = labels[display_label];
10127if(inputs.length > 0){ // S'il y a des valeurs d'input, on génère le label et ses values
10128fieldHtml += '<div class="form-group"><div class="form-label"><label>'+ display_label +'</label></div>';
10129for(var key in inputs){ // Boucle sur les inputs
10130value = inputs[key];
10131fieldHtml += '<div class="form-field">'+ value +'</div>';
10132}
10133fieldHtml += '</div>';
10134}
10135}
10136if(fieldHtml != ''){ // Si un couple de label/values est présent, on génère le titre de section + les couples label/values
10137overviewHtml += '<h2 class="webform-page">'+ display_step +'</h2>' + fieldHtml;
10138}
10139}
10140$overview.html( overviewHtml);
10141}
10142function setStep( step ) // Test la validation de (step -1) pour pouvoir aller à (step), return boolean
10143{
10144var stepToValidate = step - 1;
10145stepContainer = $('div.tab-pane[data-step="' + stepToValidate + '"]');
10146stepInputs = $(stepContainer).find('.'+formControlClass);
10147if( step > formCurrentStep ){
10148isStepValid = true;
10149stepInputs.each( function( index, input ) {
10150try{
10151if(!$(input).valid()){
10152isStepValid = false;
10153}
10154}
10155catch( err ) { }
10156});
10157if( !isStepValid ){
10158return false;
10159}
10160}
10161return true;
10162}
10163$(document).ready( function() {
10164if($form.length){
10165$('div[data-step]').hide();
10166$('div[data-step=1]').show();
10167$btnPrevious.find('button').on( 'click', function( e ) { // Etape précédente
10168e.preventDefault();
10169formPreviousStep();
10170});
10171$btnNext.find('button').on( 'click', function( e ) { // Etape suivante
10172e.preventDefault();
10173formNextStep();
10174});
10175$tabs.on( 'click', function (e) { // Navigation via tunnel de conversion
10176e.preventDefault();
10177step = $(this).data( 'step' );
10178formAnyStep(step);
10179});
10180}
10181});
10182}(jQuery));
10183(function ($) {
10184var result = $("#password-strength");
10185function checkStrength(password){
10186var strength = 0
10187if (password.length == 0) {
10188result.removeClass()
10189return ''
10190}
10191if (password.length < 9) {
10192result.removeClass()
10193result.addClass('normal')
10194return 'Normal'
10195}
10196if (password.length > 9) strength += 1
10197if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))  strength += 1
10198if (password.match(/([!,%,&,@,#,$,^,*,?,_,~])/))  strength += 1
10199if (password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,",%,&,@,#,$,^,*,?,_,~])/)) strength += 1
10200if (strength < 2) {
10201result.removeClass()
10202result.addClass('medium')
10203return 'Medium'
10204} else if (strength == 2 ) {
10205result.removeClass()
10206result.addClass('strong')
10207return 'Strong'
10208} else {
10209result.removeClass()
10210result.addClass('vstrong')
10211return 'Very Strong'
10212}
10213}
10214jQuery(document).ready(function($) {
10215if ($('.toPasswordStrength').length) {
10216$('.toPasswordStrength').keyup(function(){
10217checkStrength($('.toPasswordStrength').val());
10218});
10219}
10220});
10221}(jQuery));
10222(function ($) {
10223$(document).ready(function() {
10224$('.webform-client-form.toValidate').validate({
10225lang: 'fr',
10226errorElement: 'span',
10227errorPlacement : function(error, element){
10228error.appendTo( element.parents('.form-field') );
10229},
10230ignore: []
10231});
10232$('input[type="date"], input[data-type="date"]').datepicker($.datepicker.regional[ "fr" ]);
10233});
10234}(jQuery));
10235(function ($) {
10236owl_options_int = {
10237items: 1,
10238nav: false,
10239smartSpeed: 1000,
10240mouseDrag: false
10241}
10242$(document).ready(function(){
10243if($('#slider--cms .slider-int').length){
10244$('#slider--cms .slider-int .slider').addClass('owl-carousel');
10245var sliders_int = $('#slider--cms .slider-int');
10246sliders_int.each(function(index, element){
10247var $slider = $(element).find('.owl-carousel');
10248var $prev = $(element).find('.owl-prev');
10249var $next = $(element).find('.owl-next');
10250addons_int = {
10251onInitialized: function(e){
10252manageNavigationDisplay(e, $prev, $next);
10253attachCustomNavEvents($slider, $prev, $next);
10254updatePagination(e, $prev, $next);
10255},
10256onTranslate : function(e){
10257manageNavigationDisplay(e, $prev, $next);
10258updatePagination(e, $prev, $next);
10259}
10260};
10261var config_slider = $.extend(owl_options_int, addons_int);
10262$slider.owlCarousel(config_slider);
10263});
10264}
10265})
10266}(jQuery));
10267(function ($) {
10268$('#slider--full .slider--full .slider').addClass('owl-carousel');
10269var sliders_full = $('#slider--full .slider--full');
10270sliders_full.each(function(index, element){
10271var $slider = $(element).find('.owl-carousel');
10272var $prev = $(element).find('.owl-prev');
10273var $next = $(element).find('.owl-next');
10274var $play = $(element).find('.owl-play');
10275var isExternText = element.classList.contains('extern-text') ? true : false;
10276var $title = isExternText ? $($(element).attr('data-extern-text-selector')).find('.slider-title') : $(element).find('.slider-title');
10277var $description = isExternText ? $($(element).attr('data-extern-text-selector')).find('.slider-description') : $(element).find('.slider-description');
10278var $link = isExternText ? $($(element).attr('data-extern-text-selector')).find('.read-more') : $(element).find('.read-more');
10279var $dots, index;
10280addons_int = {
10281onInitialized: function(e){
10282index = e.item.index;
10283attachCustomNavEvents($slider, $prev, $next);
10284attachCustomPlayEvents($slider, $play);
10285$dots = $(element).find('.owl-dots');
10286fixRestartAutoplayAfterNavigationClick($slider, $prev, $next, $dots, $play);
10287updateSliderText($slider, $title, $description, $link, index);
10288},
10289onTranslate : function(e){
10290index = e.item.index;
10291updateSliderText($slider, $title, $description, $link, index);
10292}
10293};
10294var config_slider = $.extend({
10295items: 1,
10296video: true,
10297nav: false,
10298loop: true,
10299smartSpeed: 750
10300}, addons_int);
10301$slider.owlCarousel(config_slider);
10302});
10303$('#block_Carousel .read-more').css('display', 'block');
10304}(jQuery));
10305(function ($) {
10306$(document).ready(function(){
10307if($('.block-crossreading').length){
10308$('.block-crossreading').each(function(index, element){
10309if($(element).find('.grid-item').length > 2){
10310$(element).find('.slider').addClass('owl-carousel');
10311var $slider = $(element).find('.owl-carousel');
10312var $prev = $(element).find('.owl-prev');
10313var $next = $(element).find('.owl-next');
10314addons_int = {
10315onInitialized: function(e){
10316manageNavigationDisplay(e, $prev, $next);
10317attachCustomNavEvents($slider, $prev, $next);
10318updatePagination(e, $prev, $next);
10319},
10320onTranslate : function(e){
10321manageNavigationDisplay(e, $prev, $next);
10322updatePagination(e, $prev, $next);
10323}
10324}
10325var config_slider = $.extend({
10326responsive: {
103270: {
10328items: 1,
10329margin: 0
10330},
103311200: {
10332items: 2
10333}
10334},
10335nav: false,
10336smartSpeed: 1000,
10337mouseDrag: false
10338}, addons_int);
10339$slider.owlCarousel(config_slider);
10340}
10341});
10342}
10343});
10344}(jQuery));
10345(function ($) {
10346$(document).ready(function(){
10347if($('.slider-int').length){
10348$('.slider-int .slider').addClass('owl-carousel');
10349var sliders_int = $('.slider-int');
10350sliders_int.each(function(index, element){
10351var $slider = $(element).find('.owl-carousel');
10352var $prev = $(element).find('.owl-prev');
10353var $next = $(element).find('.owl-next');
10354addons_int = {
10355onInitialized: function(e){
10356manageNavigationDisplay(e, $prev, $next);
10357attachCustomNavEvents($slider, $prev, $next);
10358updatePagination(e, $prev, $next);
10359},
10360onTranslate : function(e){
10361manageNavigationDisplay(e, $prev, $next);
10362updatePagination(e, $prev, $next);
10363}
10364};
10365var config_slider = $.extend({
10366items: 1,
10367nav: false,
10368smartSpeed: 1000,
10369mouseDrag: false
10370}, addons_int);
10371$slider.owlCarousel(config_slider);
10372});
10373}
10374})
10375}(jQuery));
10376function init_GMAP(gmap_conf){
10377return (function($){
10378if(!gmap_conf){
10379console.log('Erreur: Pas de paramètres passés à la fonction init_GMAP');
10380}
10381var mapMarkers = [];
10382var mapId = gmap_conf.id;
10383var pois = gmap_conf.pois;
10384var map = new google.maps.Map( document.getElementById( mapId ), {
10385center:  gmap_conf.center ? gmap_conf.center : {lat: 48.896391, lng: 2.160098000000062},
10386zoom : gmap_conf.zoom,
10387mapTypeControl: false,
10388mapTypeControlOptions: {
10389position: google.maps.ControlPosition.TOP_RIGHT,
10390mapTypeIds: ['roadmap', 'terrain']
10391},
10392fullscreenControl: true,
10393zoomControl: false,
10394styles: gmap_conf.style
10395});
10396var templateInfoWindow = gmap_conf.ibTemplateNode.outerHTML.replace('-template', '');
10397var actualInfoBox;
10398function infoWindowContent(data){
10399var attributes = gmap_conf.infos_front;
10400var infoWindowHtml = templateInfoWindow;
10401attributes.forEach(function(attribute, index){
10402if(attribute == 'category' && typeof data.categories !== 'undefined'){
10403infoWindowHtml = infoWindowHtml.replace(/##CATEGORY##/g, data.categories[0].name);
10404}
10405else{
10406var content = data[attribute].replace('"', '&quot;');
10407var regex = new RegExp('##' + attribute.toUpperCase() + '##', 'g');
10408infoWindowHtml = infoWindowHtml.replace(regex, content);
10409}
10410});
10411return infoWindowHtml;
10412}
10413if(pois){
10414for (var i = 0; i < pois.length; i++){
10415var poi = pois[i];
10416var marker_icon = gmap_conf.default_marker;
10417if(poi.marker_icon && poi.marker_icon !== '' && poi.marker_icon != ' '){
10418marker_icon = poi.marker_icon;
10419}
10420poi.marker = new google.maps.Marker({
10421position: { lat: parseFloat(poi.latitude), lng: parseFloat(poi.longitude) },
10422map: map,
10423icon: marker_icon,
10424clickable: gmap_conf.infoWindow
10425});
10426poi.marker.parent = poi;
10427var boxText = document.createElement("div");
10428boxText.style.cssText = "background: #fff;";
10429boxText.innerHTML = infoWindowContent(poi);
10430var myOptions = {
10431content: boxText
10432,alignBottom: true
10433,disableAutoPan: false
10434,maxWidth: 0
10435,pixelOffset: new google.maps.Size(-160, -60)
10436,zIndex: null
10437,closeBoxURL: ""
10438,infoBoxClearance: new google.maps.Size(1, 1)
10439,isHidden: false
10440,pane: "floatPane"
10441,enableEventPropagation: false
10442};
10443poi.ib = new InfoBox(myOptions);
10444if(gmap_conf.infoWindow){
10445poi.marker.addListener('click', function () {
10446var infoB = this.parent.ib;
10447infoB.open(map, this);  // change the map variable appropriately
10448if(actualInfoBox && actualInfoBox != infoB){
10449actualInfoBox.close();
10450}
10451actualInfoBox = infoB;
10452infoB.content_.querySelector('.close-infowindow').addEventListener('click', function(e){
10453e.preventDefault();
10454e.stopPropagation(); // Prevent click on another POI
10455infoB.close();
10456});
10457});
10458}
10459mapMarkers.push( poi.marker );
10460}
10461}
10462var bounds = new google.maps.LatLngBounds();
10463if(mapMarkers.length){
10464console.log(mapMarkers);
10465for(var i=0; i < mapMarkers.length; i++ ){
10466bounds.extend( mapMarkers[i].getPosition() );
10467}
10468map.setCenter( bounds.getCenter() );
10469if( mapMarkers.length > 1 ){
10470map.fitBounds( bounds );
10471if(gmap_conf.hasCluster){
10472var options = {
10473gridSize: 20,
10474imagePath: gmap_conf.clusterImagePath,
10475maxZoom: 16
10476};
10477var markerCluster = new MarkerClusterer(map, mapMarkers, options );
10478}
10479}else{
10480map.setZoom( 15 );
10481}
10482}
10483if($('.btn-event-map').length){
10484$('.event-gmap').addClass('visible');
10485$(document).ready(function(){
10486$('.btn-event-map').click();
10487});
10488}
10489return {map: map, pois: pois};
10490}(jQuery));
10491}
10492function MarkerClusterer(t,e,r){this.extend(MarkerClusterer,google.maps.OverlayView),this.map_=t,this.markers_=[],this.clusters_=[],this.sizes=[53,56,66,78,90],this.styles_=[],this.ready_=!1;var s=r||{};this.gridSize_=s.gridSize||60,this.minClusterSize_=s.minimumClusterSize||2,this.maxZoom_=s.maxZoom||null,this.styles_=s.styles||[],this.imagePath_=s.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_,this.imageExtension_=s.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_,this.zoomOnClick_=!0,void 0!=s.zoomOnClick&&(this.zoomOnClick_=s.zoomOnClick),this.averageCenter_=!1,void 0!=s.averageCenter&&(this.averageCenter_=s.averageCenter),this.setupStyles_(),this.setMap(t),this.prevZoom_=this.map_.getZoom();var i=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var t=i.map_.getZoom();i.prevZoom_!=t&&(i.prevZoom_=t,i.resetViewport())}),google.maps.event.addListener(this.map_,"idle",function(){i.redraw()}),e&&e.length&&this.addMarkers(e,!1)}function Cluster(t){this.markerClusterer_=t,this.map_=t.getMap(),this.gridSize_=t.getGridSize(),this.minClusterSize_=t.getMinClusterSize(),this.averageCenter_=t.isAverageCenter(),this.center_=null,this.markers_=[],this.bounds_=null,this.clusterIcon_=new ClusterIcon(this,t.getStyles(),t.getGridSize())}function ClusterIcon(t,e,r){t.getMarkerClusterer().extend(ClusterIcon,google.maps.OverlayView),this.styles_=e,this.padding_=r||0,this.cluster_=t,this.center_=null,this.map_=t.getMap(),this.div_=null,this.sums_=null,this.visible_=!1,this.setMap(this.map_)}MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_="../images/m",MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_="png",MarkerClusterer.prototype.extend=function(t,e){return function(t){for(var e in t.prototype)this.prototype[e]=t.prototype[e];return this}.apply(t,[e])},MarkerClusterer.prototype.onAdd=function(){this.setReady_(!0)},MarkerClusterer.prototype.draw=function(){},MarkerClusterer.prototype.setupStyles_=function(){if(!this.styles_.length)for(var t,e=0;t=this.sizes[e];e++)this.styles_.push({url:this.imagePath_+(e+1)+"."+this.imageExtension_,height:t,width:t})},MarkerClusterer.prototype.fitMapToMarkers=function(){for(var t,e=this.getMarkers(),r=new google.maps.LatLngBounds,s=0;t=e[s];s++)r.extend(t.getPosition());this.map_.fitBounds(r)},MarkerClusterer.prototype.setStyles=function(t){this.styles_=t},MarkerClusterer.prototype.getStyles=function(){return this.styles_},MarkerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_},MarkerClusterer.prototype.isAverageCenter=function(){return this.averageCenter_},MarkerClusterer.prototype.getMarkers=function(){return this.markers_},MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_.length},MarkerClusterer.prototype.setMaxZoom=function(t){this.maxZoom_=t},MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_},MarkerClusterer.prototype.calculator_=function(t,e){for(var r=0,s=t.length,i=s;0!==i;)i=parseInt(i/10,10),r++;return r=Math.min(r,e),{text:s,index:r}},MarkerClusterer.prototype.setCalculator=function(t){this.calculator_=t},MarkerClusterer.prototype.getCalculator=function(){return this.calculator_},MarkerClusterer.prototype.addMarkers=function(t,e){for(var r,s=0;r=t[s];s++)this.pushMarkerTo_(r);e||this.redraw()},MarkerClusterer.prototype.pushMarkerTo_=function(t){if(t.isAdded=!1,t.draggable){var e=this;google.maps.event.addListener(t,"dragend",function(){t.isAdded=!1,e.repaint()})}this.markers_.push(t)},MarkerClusterer.prototype.addMarker=function(t,e){this.pushMarkerTo_(t),e||this.redraw()},MarkerClusterer.prototype.removeMarker_=function(t){var e=-1;if(this.markers_.indexOf)e=this.markers_.indexOf(t);else for(var r,s=0;r=this.markers_[s];s++)if(r==t){e=s;break}return-1!=e&&(t.setMap(null),this.markers_.splice(e,1),!0)},MarkerClusterer.prototype.removeMarker=function(t,e){var r=this.removeMarker_(t);return!(e||!r)&&(this.resetViewport(),this.redraw(),!0)},MarkerClusterer.prototype.removeMarkers=function(t,e){for(var r,s=!1,i=0;r=t[i];i++){var o=this.removeMarker_(r);s=s||o}if(!e&&s)return this.resetViewport(),this.redraw(),!0},MarkerClusterer.prototype.setReady_=function(t){this.ready_||(this.ready_=t,this.createCluster
10492s_())},MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length},MarkerClusterer.prototype.getMap=function(){return this.map_},MarkerClusterer.prototype.setMap=function(t){this.map_=t},MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_},MarkerClusterer.prototype.setGridSize=function(t){this.gridSize_=t},MarkerClusterer.prototype.getMinClusterSize=function(){return this.minClusterSize_},MarkerClusterer.prototype.setMinClusterSize=function(t){this.minClusterSize_=t},MarkerClusterer.prototype.getExtendedBounds=function(t){var e=this.getProjection(),r=new google.maps.LatLng(t.getNorthEast().lat(),t.getNorthEast().lng()),s=new google.maps.LatLng(t.getSouthWest().lat(),t.getSouthWest().lng()),i=e.fromLatLngToDivPixel(r);i.x+=this.gridSize_,i.y-=this.gridSize_;var o=e.fromLatLngToDivPixel(s);o.x-=this.gridSize_,o.y+=this.gridSize_;var n=e.fromDivPixelToLatLng(i),h=e.fromDivPixelToLatLng(o);return t.extend(n),t.extend(h),t},MarkerClusterer.prototype.isMarkerInBounds_=function(t,e){return e.contains(t.getPosition())},MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers_=[]},MarkerClusterer.prototype.resetViewport=function(t){for(var e,r=0;
10492e=this.clusters_[r];r++)e.remove();for(var s,r=0;s=this.markers_[r];r++)s.isAdded=!1,t&&s.setMap(null);this.clusters_=[]},MarkerClusterer.prototype.repaint=function(){var t=this.clusters_.slice();this.clusters_.length=0,this.resetViewport(),this.redraw(),window.setTimeout(function(){for(var e,r=0;e=t[r];r++)e.remove()},0)},MarkerClusterer.prototype.redraw=function(){this.createClusters_()},MarkerClusterer.prototype.distanceBetweenPoints_=function(t,e){if(!t||!e)return 0;var r=(e.lat()-t.lat())*Math.PI/180,s=(e.lng()-t.lng())*Math.PI/180,i=Math.sin(r/2)*Math.sin(r/2)+Math.cos(t.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(s/2)*Math.sin(s/2);return 6371*(2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i)))},MarkerClusterer.prototype.addToClosestCluster_=function(t){for(var e,r=4e4,s=null,i=(t.getPosition(),0);e=this.clusters_[i];i++){var o=e.getCenter();if(o){var n=this.distanceBetweenPoints_(o,t.getPosition());n<r&&(r=n,s=e)}}s&&s.isMarkerInClusterBounds(t)?s.addMarker(t):((e=new Cluster(this)).addMarker(t),this.clusters_.push(e))},MarkerClusterer.prototype.createClusters_=function(){if(this.ready_)for(var t,e=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest
10492(),this.map_.getBounds().getNorthEast()),r=this.getExtendedBounds(e),s=0;t=this.markers_[s];s++)!t.isAdded&&this.isMarkerInBounds_(t,r)&&this.addToClosestCluster_(t)},Cluster.prototype.isMarkerAlreadyAdded=function(t){if(this.markers_.indexOf)return-1!=this.markers_.indexOf(t);for(var e,r=0;e=this.markers_[r];r++)if(e==t)return!0;return!1},Cluster.prototype.addMarker=function(t){if(this.isMarkerAlreadyAdded(t))return!1;if(this.center_){if(this.averageCenter_){var e=this.markers_.length+1,r=(this.center_.lat()*(e-1)+t.getPosition().lat())/e,s=(this.center_.lng()*(e-1)+t.getPosition().lng())/e;this.center_=new google.maps.LatLng(r,s),this.calculateBounds_()}}else this.center_=t.getPosition(),this.calculateBounds_();t.isAdded=!0,this.markers_.push(t);var i=this.markers_.length;if(i<this.minClusterSize_&&t.getMap()!=this.map_&&t.setMap(this.map_),i==this.minClusterSize_)for(var o=0;o<i;o++)this.markers_[o].setMap(null);return i>=this.minClusterSize_&&t.setMap(null),this.updateIcon(),!0},Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_},Cluster.prototype.getBounds=function(){for(var t,e=new google.maps.LatLngBounds(this.center_,this.center_),r=this.getMarkers(),s=0;t=r[s];s++)e.extend(t.getPosition());return e},Cluster.prototype.remove=function(){this.clusterIcon_.remove(),this.markers_.length=0,delete this.markers_},Cluster.prototype.getSize=function(){return this.markers_.length},Cluster.prototype.getMarkers=function(){return this.markers_},Cluster.prototype.getCenter=function(){return this.center_},Cluster.prototype.calculateBounds_=function(){var t=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(t)},Cluster.prototype.isMarkerInClusterBounds=function(t){return this.bounds_.contains(t.getPosition())},Cluster.prototype.getMap=function(){return this.map_},Cluster.prototype.updateIcon=function(){var t=this.map_.getZoom(),e=this.markerClusterer_.getMaxZoom();if(e&&t>e)for(var r,s=0;r=this.markers_[s];s++)r.setMap(this.map_);else if(this.markers_.length<this.minClusterSize_)this.clusterIcon_.hide();else{var i=this.markerClusterer_.getStyles().length,o=this.markerClusterer_.getCalculator()(this.markers_,i);this.clusterIcon_.setCenter(this.center_),this.clusterIcon_.setSums(o),this.clusterIcon_.show()}},ClusterIcon.prototype.triggerClusterClick=function(t){var e=this.cluster_.getMarkerClusterer();google.maps.event.trigger(e,"clusterclick",this.cluster_,t),e.isZoomOnClick()&&this.map_.fitBounds(this.cluster_.getBounds())},ClusterIcon.prototype.onAdd=function(){if(this.div_=document.createElement("DIV"),this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.innerHTML=this.sums_.text}this.getPanes().overlayMouseTarget.appendChild(this.div_);var e=this,r=!1;google.maps.event.addDomListener(this.div_,"click",function(t){r||e.triggerClusterClick(t)}),google.maps.event.addDomListener(this.div_,"mousedown",function(){r=!1}),google.maps.event.addDomListener(this.div_,"mousemove",function(){r=!0})},ClusterIcon.prototype.getPosFromLatLng_=function(t){var e=this.getProjection().fromLatLngToDivPixel(t);return"object"==typeof this.iconAnchor_&&2===this.iconAnchor_.length?(e.x-=this.iconAnchor_[0],e.y-=this.iconAnchor_[1]):(e.x-=parseInt(this.width_/2,10),e.y-=parseInt(this.height_/2,10)),e},ClusterIcon.prototype.draw=function(){if(this.visible_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.top=t.y+"px",this.div_.style.left=t.x+"px"}},ClusterIcon.prototype.hide=function(){this.div_&&(this.div_.style.display="none"),this.visible_=!1},ClusterIcon.prototype.show=function(){if(this.div_){var t=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(t),this.div_.style.display=""}this.visible_=!0},ClusterIcon.prototype.remove=function(){this.setMap(null)},ClusterIcon.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),this.div_.parentNode.removeChild(this.div_),this.div_=null)},ClusterIcon.prototype.setSums=function(t){this.sums_=t,this.text_=t.text,this.index_=t.index,this.div_&&(this.div_.innerHTML=t.text),this.useStyle()},ClusterIcon.prototype.useStyle=function(){var t=Math.max(0,this.sums_.index-1);t=Math.min(this.styles_.length-1,t);var e=this.styles_[t];this.url_=e.url,this.height_=e.height,this.width_=e.width,this.textColor_=e.textColor,this.anchor_=e.anchor,this.textSize_=e.textSize,this.backgroundPosition_=e.backgroundPosition,this.iconAnchor_=e.iconAnchor},ClusterIcon.prototype.setCenter=function(t){this.center_=t},ClusterIcon.prototype.createCss=function(t){var e=[];e.push("background-image:url("+this.url_+");");var r=this.backgroundPosition_?this.backgroundPosition_:"0 0";e.push("background-position:"+r+";"),"object"==typeof this.anchor_?("number"==typeof this.anchor_[0]&&this.anchor_[0]>0&&this.anchor_[0]<this.height_?e.push("height:"+(this.height_-this.anchor_[0])+"px; padding-top:"+this.anchor_[0]+"px;"):"number"==typeof this.anchor_[0]&&this.anchor_[0]<0&&-this.anchor_[0]<this.height_?e.push("height:"+this.height_+"px; line-height:"+(this.height_+this.anchor_[0])+"px;"):e.push("height:"+this.height_+"px; line-height:"+this.height_+"px;"),"number"==typeof this.anchor_[1]&&this.anchor_[1]>0&&this.anchor_[1]<this.width_?e.push("width:"+(this.width_-this.anchor_[1])+"px; padding-left:"+this.anchor_[1]+"px;"):e.push("width:"+this.width_+"px; text-align:center;")):e.push("height:"+this.height_+"px; line-height:"+this.height_+"px; width:"+this.width_+"px; text-align:center;");var s=this.textColor_?this.textColor_:"black",i=this.textSize_?this.textSize_:11;return e.push("cursor:pointer; top:"+t.y+"px; left:"+t.x+"px; color:"+s+"; position:absolute; font-size:"+i+"px; font-family:Arial,sans-serif; font-weight:bold"),e.join("")};
10493(function ($) {
10494$(document).ready(function(){
10495$('.nav-profil').on('click', function(e){
10496$('.opened', '.block-header').not(this).removeClass('opened');
10497$(this).toggleClass('opened');
10498});
10499$('.translate-select > a').on('click', function(e){
10500e.preventDefault();
10501$('.opened', '.block-header').not('.translate-select').removeClass('opened');
10502$('.translate-select').toggleClass('opened');
10503});
10504$('.search-block .toggle-button').on('click', function(e){
10505$('.opened', '.block-header').not('.search-block').removeClass('opened');
10506$('.search-block').toggleClass('opened');
10507if($('.search-block').hasClass('opened')){
10508$('#mainsearch-input').focus();
10509}
10510})
10511$('#rwdMenuToggle').on('click.menuRWD', function(e){
10512var menuRwd = {
10513node: document.getElementById('main-menu-rwd')
10514,htmlContent: []
10515}
10516//menuRwd.htmlContent.push(document.getElementById('menu-lang').outerHTML);
10517menuRwd.htmlContent.push(document.getElementById('main-menu').innerHTML);
10518menuRwd.htmlContent.push(document.querySelector('.nav-profil').outerHTML);
10519menuRwd.node.querySelector('.content').innerHTML =  menuRwd.htmlContent.join('');
10520$(menuRwd.node).show();
10521$('html').addClass('no-scroll');
10522$('.close', menuRwd.node).on('click.menuRWD', function(e){
10523$('.close', menuRwd.node).off('click.menuRWD');
10524$('.nav-profil', menuRwd.node).off('click.menuRWD');
10525$(menuRwd.node).hide();
10526$('html').removeClass('no-scroll');
10527menuRwd.node.querySelector('.content').innerHTML = '';
10528});
10529$('.nav-profil', menuRwd.node).on('click.menuRWD', function(){
10530$(this).toggleClass('opened');
10531$('ul', this).slideToggle(350);
10532});
10533$('.translate-select > a', menuRwd.node).on('click', function(e){
10534$('.translate-select').toggleClass('opened');
10535$('.translate-select ul', menuRwd.node).slideToggle(350);
10536});
10537});
10538});
10539}(jQuery));
10540(function ($) {
10541$(document).ready(function(){
10542if(document.getElementById("block_Agenda")){
10543const blocAgenda = document.getElementById("block_Agenda");
10544const eventsCategories = {
10545node: blocAgenda.querySelector(".events-categories")
10546};
10547const eventsList = {
10548node: blocAgenda.querySelector(".events-list")
10549};
10550eventsList.template = eventsList.node.querySelector('.template').outerHTML;
10551eventsCategories.template = eventsCategories.node.querySelector('.template').outerHTML;
10552let categoriesLinksHtml = '';
10553event_list_json.forEach(function(element){
10554const newCategory = eventsCategories.template;
10555categoriesLinksHtml += newCategory
10556.replace('template', '')
10557.replace('display:none;', '')
10558.replace(/##CATEGORY##/gi, element.category);
10559});
10560eventsCategories.node.innerHTML = categoriesLinksHtml;
10561eventsCategories.node.classList.remove('loading');
10562$(eventsCategories.node).on('click', 'button', function(e){
10563e.preventDefault();
10564if(eventsCategories.node.querySelector('button.active')){
10565eventsCategories.node.querySelector('button.active').classList.remove('active');
10566}
10567eventsList.node.classList.add('loading');
10568loadCategory(this.dataset.cat);
10569this.classList.add('active');
10570eventsList.node.classList.remove('loading');
10571})
10572eventsCategories.node.querySelector('li:first-child button').click();
10573function loadCategory(categoryName){
10574let category = event_list_json.filter(function( obj ) { return obj.category == categoryName; })[0];
10575let categoryEventsHtml = '';
10576category.events.forEach(function(event){
10577const newEvent = eventsList.template;
10578categoryEventsHtml += newEvent
10579.replace('template', '')
10580.replace('display:none;', '')
10581.replace(/##URL##/gi, event.url)
10582.replace(/##ID##/gi, event.id)
10583.replace(/##IMAGE##/gi, event.image)
10584.replace(/##TAGS##/gi, event.tags.join(', '))
10585.replace('event-tags', !event.tags.length ? 'event-tags empty' : 'event-tags')
10586.replace(/##DATE##/gi, event.date)
10587.replace(/##NAME##/gi, event.name)
10588.replace(/##LEAD##/gi, event.lead);
10589});
10590eventsList.node.innerHTML = categoryEventsHtml;
10591dot();
10592}
10593}
10594if($('body.class_group_home').length){
10595var diaporamaSliderTemplate = '<div id="slider--cms"><div class="slider-int"><ul class="slider unstyled"></ul><div class="owl-nav"><button class="owl-prev"><div class="flexbox"><svg class="owl-prev-icon" width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000"><path d="M 64.00,416.00l 96.00,96.00l 256.00-256.00L 160.00,0.00L 64.00,96.00l 160.00,160.00L 64.00,416.00z"></path></svg><div class="owl-pagination"><div class="owl-current-page"></div><div class="owl-total-page"></div></div></div></button><button class="owl-next"><div class="flexbox"><div class="owl-pagination"><div class="owl-current-page"></div><div class="owl-total-page"></div></div><svg class="owl-next-icon" width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="#000000"><path d="M 64.00,416.00l 96.00,96.00l 256.00-256.00L 160.00,0.00L 64.00,96.00l 160.00,160.00L 64.00,416.00z"></path></svg></div></button></div></div></div>';
10596$('#block_Pictures .visu').on('click.diaporama', function () {
10597var $_overlay = $('<div class="overlay"></div>')
10598, $_popup = $('<div class="pop-up"></div>')
10599, $_close = $('<button type="button" class="close" aria-label="Fermer"><span aria-hidden="true">&times;</span></button>')
10600, $_diaporamaSlider = $(diaporamaSliderTemplate);
10601diaporamaSrc = $('#block_Pictures .diaporama');
10602$('img', diaporamaSrc).each(function (i, el) {
10603$('ul', $_diaporamaSlider).append('<li>' + this.outerHTML + '</li>');
10604});
10605$_close.on('click', function (e) {
10606e.preventDefault();
10607$_overlay.remove();
10608$('body').removeClass('noscroll');
10609})
10610$_popup.append($_close, $_diaporamaSlider);
10611$_overlay.append($_popup);
10612$('body').addClass('noscroll').append($_overlay);
10613var $slider = $('.overlay .slider-int > ul').addClass('owl-carousel');
10614var $prev = $('.overlay .slider-int').find('.owl-prev');
10615var $next = $('.overlay .slider-int').find('.owl-next');
10616$slider.owlCarousel({
10617items: 1,
10618nav: false,
10619smartSpeed: 1000,
10620mouseDrag: false,
10621onInitialized: function (e) {
10622manageNavigationDisplay(e, $prev, $next);
10623attachCustomNavEvents($slider, $prev, $next);
10624updatePagination(e, $prev, $next);
10625},
10626onTranslate: function (e) {
10627manageNavigationDisplay(e, $prev, $next);
10628updatePagination(e, $prev, $next);
10629}
10630});
10631});
10632$('.scrollDown').on('click', function(){
10633$("html, body").animate({scrollTop: $('#block_Actualites').position().top},750);
10634});
10635setTimeout(function(){
10636$('ul', '#block_InstantAccess').attr('data-scroll-animation', 'grid-delayed');
10637$('.ia-item', '#block_InstantAccess').each(function(index, element){
10638$(this).addClass('delayed-element delayed-element-'+(index+1));
10639});
10640$('.news-header-content', '#block_Actualites').attr('data-scroll-animation', 'zoom');
10641$('.news-list', '#block_Actualites').attr('data-scroll-animation', 'grid-line-delayed')
10642$('.news-list li', '#block_Actualites').each(function(index, element){
10643$(this).addClass('delayed-element delayed-element-'+(index+1));
10644});
10645$('.events-list', '#block_Agenda').attr('data-scroll-animation', 'grid-child');
10646$('.highlight-content', '#block_Highlight1').attr('data-scroll-animation', 'zoom');
10647$('#block_Publications').attr('data-scroll-animation', 'dezoom');
10648$('.pictures-list', '#block_Pictures').attr('data-scroll-animation', 'grid-delayed')
10649$('.visu', '#block_Pictures').addClass('delayed-element')
10650.eq(0).addClass('delayed-element-1').end()
10651.eq(1).addClass('delayed-element-4').end()
10652.eq(2).addClass('delayed-element-2').end()
10653.eq(3).addClass('delayed-element-5').end()
10654.eq(4).addClass('delayed-element-3').end();
10655$('.highlight-content', '#block_Highlight2').attr('data-scroll-animation', 'slideup-delayed');
10656$('.block-title, .block-subtitle, a', '#block_Highlight2').addClass('delayed-element').each(function(index, element){
10657$(this).addClass('delayed-element-'+(index+1));
10658});
10659$('[data-scroll-animation]').each(function(index, element){
10660if($(element).offset().top < ((window.innerHeight * 0.75) + $(document).scrollTop()) ){
10661$(element).attr('data-animation-state', 'active');
10662return;
10663}
10664element.controller = new ScrollMagic.Controller();
10665new ScrollMagic.Scene({
10666triggerElement: element,
10667triggerHook: 0.75
10668})
10669.on('start', function(e){
10670if(e.scrollDirection == "FORWARD" && $(element).attr('data-animation-state') != 'active'){
10671$(element).attr('data-animation-state', 'active');
10672}
10673})
10674.addTo(element.controller);
10675});
10676}, 1000);
10677}
10678});
10679}(jQuery));
10680(function ($) {
10681$(document).ready(function(){
10682$('[data-popup-close]').on('click', function(){
10683$('.popup').slideUp();
10684sessionStorage.setItem('user_popup', true);
10685});
10686if(sessionStorage.getItem('user_popup')){
10687$('.popup').hide();
10688}else{
10689$('.popup').show();
10690$('.popup').css('display', 'flex');
10691}
10692});
10693}(jQuery));
10694(function ($) {
10695if (window.location.hash){
10696var id = window.location.hash.substring(1);
10697}
10698$(window).load(function() {
10699if (window.location.hash){
10700$('body, html').animate({
10701scrollTop: $('#'+id).offset().top - 66
10702});
10703}
10704});
10705$('a:not(.webform-progressbar-page)').on('click', function(e){
10706var href = $(this).attr('href');
10707var id;
10708if(href.indexOf('#') != -1){
10709e.preventDefault();
10710var pos = href.search('#')+1;
10711id = href.slice(pos);
10712if($('#'+id).length){
10713cl("Scroll to Element in page");
10714$('body, html').animate({
10715scrollTop: $('#'+id).offset().top - 66
10716}, 800);
10717}else{
10718window.location.replace(href);
10719}
10720}
10721});
10722}(jQuery));
10723(function ($) {
10724$(document).ready(function(){
10725if($('.faq-block').length){
10726$('.faq-answer').slideUp(0);
10727$('.faq-block .faq-item').on('click', '.faq-question', function(e){
10728var item = this.parentNode;
10729if(item.classList.contains('active')){
10730item.classList.remove('active');
10731$('.faq-answer', item).stop().slideUp();
10732}
10733else{
10734item.classList.add('active');
10735$('.faq-answer', item).stop().slideDown();
10736}
10737});
10738}
10739});
10740}(jQuery));
10741(function ($) {
10742$(document).ready(function(){
10743$('[data-scroll-animation]').each(function(index, element){
10744element.controller = new ScrollMagic.Controller();
10745new ScrollMagic.Scene({
10746triggerElement: element,
10747triggerHook: 0.75
10748})
10749.on('enter', function(e){
10750if(e.scrollDirection =="FORWARD" && $(element).attr('data-animation-state') != 'active'){
10751$(element).attr('data-animation-state', 'active');
10752}
10753})
10754.addTo(element.controller);
10755});
10756});
10757}(jQuery));
10758(function ($) {
10759if($('.btn-event-map').length){
10760$('.btn-event-map').on('click', function(){
10761if ($('.event-gmap').hasClass('visible')){
10762$('.event-gmap').slideUp('slow');
10763$('.event-gmap').removeClass('visible');
10764} else{
10765$('.event-gmap').slideDown('slow');
10766$(".event-gmap").css('visibility','inherit');
10767$(".event-gmap").css('position','relative');
10768$('.event-gmap').addClass('visible');
10769$('html, body').animate({
10770scrollTop: $('.event-gmap').offset().top
10771});
10772}
10773});
10774}
10775}(jQuery));
10776(function ($) {
10777$(document).ready(function(){
10778function sectostr(s){return(s-(s%=60))/60+(9<s?':':':0')+s;}
10779function playAudio(audio){
10780audio.$control.addClass('playing');
10781audio.player.play();
10782audio.majTime = setInterval(function(){
10783var current_time = Math.floor(audio.player.currentTime);
10784updateTime(audio, current_time);
10785},50);
10786}
10787function stopAudio(audio){
10788audio.$control.removeClass('playing');
10789audio.player.pause();
10790clearInterval(audio.majTime);
10791}
10792function updateTime(audio, time){
10793var ratio = (time / audio.player.duration) * 100;
10794audio.$bar.width(ratio + '%');
10795audio.$current_time.html(sectostr(time));
10796}
10797function resetAudio(audio){
10798stopAudio(audio);
10799audio.$bar.width(0);
10800audio.$current_time.html('0:00');
10801}
10802var $player = $('.media-audio-player');
10803if($player.length){
10804$player.each(function(index, element){
10805var player = $(element).find('audio')[0];
10806var audio = {
10807player: player,
10808$control: $(element).find('.player-control'),
10809$bar: $(element).find('.player-progress-bar .player-running-bar'),
10810$current_time: $(element).find('.player-time-current'),
10811$total_time: $(element).find('.player-time-total'),
10812$range : $(element).find('input[type="range"]'),
10813majTime : function(){}
10814};
10815audio.$total_time.html('0:00');
10816console.log(audio.player.readyState);
10817if (audio.player.readyState > 3) {
10818audio.$total_time.html(sectostr(Math.floor(audio.player.duration)));
10819}else{
10820audio.player.addEventListener('canplay', function(){
10821audio.$total_time.html(sectostr(Math.floor(audio.player.duration)));
10822});
10823}
10824audio.player.addEventListener('ended', function(){
10825stopAudio(audio);
10826resetAudio(audio);
10827});
10828audio.$range.on('click', function(){
10829var target_time = Math.floor(($(this)[0].value * audio.player.duration) / 100);
10830audio.player.currentTime = target_time;
10831updateTime(audio, target_time);
10832});
10833audio.$control.on('click', function(){
10834if($(this).hasClass('playing')){
10835stopAudio(audio);
10836}else{
10837playAudio(audio);
10838}
10839});
10840});
10841}
10842});
10843}(jQuery));
10844(function ($) {
10845if ($('.media-transcription-button').length){
10846$('.media-transcription-button').on('click', function(){
10847$(this).toggleClass('opened');
10848$(this).parents('.media').find('.media-transcription').slideToggle();
10849});
10850}
10851}(jQuery));
10852;(function( win ) {
10853var $;
10854if( 'shoestring' in win ) {
10855$ = win.shoestring;
10856} else if( 'jQuery' in win ) {
10857$ = win.jQuery;
10858} else {
10859throw new Error( "tablesaw: DOM library not found." );
10860}
10861$( function(){
10862$('.rte table')
10863.addClass('table-content tablesaw tablesaw-stack')
10864.attr('data-tablesaw-mode', 'stack');
10865$( ".rte" ).trigger( "enhance.tablesaw" );
10866});
10867})( typeof window !== "undefined" ? window : this );
10868(function ($) {
10869if ($('.class_group_home, body.front').length) {
10870$(document).ready(function() {
10871});
10872$(window).load(function(){
10873$('.no-js').removeClass('no-js');
10874});
10875};
10876}(jQuery));
10877(function ($) {
10878$(document).ready(function() {
10879$(window).resize(function(){
10880if (environmentChanged) {
10881};
10882});
10883$(window).scroll(function(){
10884});
10885if($('#vote-locations').length){
10886$('#vote-locations .selectize').selectize();
10887}
10888if($('#school').length){
10889$('#school .selectize').selectize();
10890}
10891if($('.user-alert-banner .user-alert-body p').length > 1) {
10892let autoPlay;
10893$countAlert=1;
10894$timeAnimate = $('.user-alert-banner').attr('data-time');
10895const play = () => {
10896$('.user-alert-banner .user-alert-body p').each(function(index) {
10897if(index === $countAlert) {
10898$(this).addClass('active');
10899} else {
10900$(this).removeClass('active');
10901}
10902})
10903$('.user-alert-banner .user-alert-body p:not(.active)').animate({
10904opacity: 0,
10905height: "hide"
10906}, 1000);
10907$('.user-alert-banner .user-alert-body p.active').animate({
10908opacity: 1,
10909height: "show"
10910}, 1000);
10911if ($countAlert === $('.user-alert-banner .user-alert-body p').length - 1) {
10912$countAlert = 0;
10913} else {
10914$countAlert++;
10915}
10916}
10917autoPlay = setInterval(function() {
10918play();
10919}, $timeAnimate);
10920$('.user-alert-banner .btn-nav .pause').on('click', () => {
10921if ($('.user-alert-banner .btn-nav .pause').hasClass('play')) {
10922autoPlay = setInterval(function() {
10923play();
10924}, $timeAnimate);
10925$('.user-alert-banner .btn-nav .pause').removeClass('play');
10926} else {
10927console.log('test');
10928clearInterval(autoPlay);
10929$('.user-alert-banner .btn-nav .pause').addClass('play');
10930}
10931})
10932$('.user-alert-banner .btn-nav .next').on('click', () => {
10933clearInterval(autoPlay);
10934$('.user-alert-banner .btn-nav .pause').addClass('play');
10935play();
10936})
10937}
10938}); // End onReady
10939$(window).load(function(){
10940$('.no-js').removeClass('no-js');
10941}) //End onLoad
10942}(jQuery));
10943(function ($) {
10944(function(){var a,b,c,d,e,f,g,h,i,j;b=window.device,a={},window.device=a,d=window.document.documentElement,j=window.navigator.userAgent.toLowerCase(),a.ios=function(){return a.iphone()||a.ipod()||a.ipad()},a.iphone=function(){return!a.windows()&&e("iphone")},a.ipod=function(){return e("ipod")},a.ipad=function(){return e("ipad")},a.android=function(){return!a.windows()&&e("android")},a.androidPhone=function(){return a.android()&&e("mobile")},a.androidTablet=function(){return a.android()&&!e("mobile")},a.blackberry=function(){return e("blackberry")||e("bb10")||e("rim")},a.blackberryPhone=function(){return a.blackberry()&&!e("tablet")},a.blackberryTablet=function(){return a.blackberry()&&e("tablet")},a.windows=function(){return e("windows")},a.windowsPhone=function(){return a.windows()&&e("phone")},a.windowsTablet=function(){return a.windows()&&e("touch")&&!a.windowsPhone()},a.fxos=function(){return(e("(mobile;")||e("(tablet;"))&&e("; rv:")},a.fxosPhone=function(){return a.fxos()&&e("mobile")},a.fxosTablet=function(){return a.fxos()&&e("tablet")},a.meego=function(){return e("meego")},a.cordova=function(){return window.cordova&&"file:"===location.protocol},a.nodeWebkit=function(){return"object"==typeof window.process},a.mobile=function(){return a.androidPhone()||a.iphone()||a.ipod()||a.windowsPhone()||a.blackberryPhone()||a.fxosPhone()||a.meego()},a.tablet=function(){return a.ipad()||a.androidTablet()||a.blackberryTablet()||a.windowsTablet()||a.fxosTablet()},a.desktop=function(){return!a.tablet()&&!a.mobile()},a.television=function(){var a;for(television=["googletv","viera","smarttv","internet.tv","netcast","nettv","appletv","boxee","kylo","roku","dlnadoc","roku","pov_tv","hbbtv","ce-html"],a=0;a<television.length;){if(e(television[a]))return!0;a++}return!1},a.portrait=function(){return window.innerHeight/window.innerWidth>1},a.landscape=function(){return window.innerHeight/window.innerWidth<1},a.noConflict=function(){return window.device=b,this},e=function(a){return-1!==j.indexOf(a)},g=function(a){var b;return b=new RegExp(a,"i"),d.className.match(b)},c=function(a){var b=null;g(a)||(b=d.className.replace(/^\s+|\s+$/g,""),d.className=b+" "+a)},i=function(a){g(a)&&(d.className=d.className.replace(" "+a,""))},a.ios()?a.ipad()?c("ios ipad tablet"):a.iphone()?c("ios iphone mobile"):a.ipod()&&c("ios ipod mobile"):a.android()?c(a.androidTablet()?"android tablet":"android mobile"):a.blackberry()?c(a.blackberryTablet()?"blackberry tablet":"blackberry mobile"):a.windows()?c(a.windowsTablet()?"windows tablet":a.windowsPhone()?"windows mobile":"desktop"):a.fxos()?c(a.fxosTablet()?"fxos tablet":"fxos mobile"):a.meego()?c("meego mobile"):a.nodeWebkit()?c("node-webkit"):a.television()?c("television"):a.desktop()&&c("desktop"),a.cordova()&&c("cordova"),f=function(){a.landscape()?(i("portrait"),c("landscape")):(i("landscape"),c("portrait"))},h=Object.prototype.hasOwnProperty.call(window,"onorientationchange")?"orientationchange":"resize",window.addEventListener?window.addEventListener(h,f,!1):window.attachEvent?window.attachEvent(h,f):window[h]=f,f(),"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return a}):"undefined"!=typeof module&&module.exports?module.exports=a:window.device=a}).call(this);
10945}(jQuery));

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.